index.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. var template = ''
  2. $.ajax('../../../component/statistics/GxbMz/index.html', {
  3. data: {},
  4. dataType: 'html',
  5. cache: false,
  6. timeout: 60000,
  7. async: false,
  8. error: function (res) {},
  9. success: function (res) {
  10. template = res
  11. }
  12. })
  13. Vue.component('gxb-mz', {
  14. template: template,
  15. props: [],
  16. data: function () {
  17. return {
  18. years: [],
  19. yearType: '1',
  20. chooseYear: null,
  21. chooseTime: null,
  22. rangeOptions: [
  23. { label: '区', value: 'town' },
  24. { label: '社区', value: 'hospital' },
  25. { label: '团队', value: 'team' }
  26. ],
  27. areaOptions: [
  28. { label: '思明区', value: '350203' },
  29. { label: '海沧区', value: '350205' },
  30. { label: '湖里区', value: '350206' },
  31. { label: '集美区', value: '350211' },
  32. { label: '同安区', value: '350212' },
  33. { label: '翔安区', value: '350213' }
  34. ],
  35. hospitalOptions: [],
  36. teamOptions: [],
  37. form: {
  38. range: 'town'
  39. },
  40. loading: false,
  41. exportLoading: false,
  42. tableData: [],
  43. tableHeader: [],
  44. constantHeader: [
  45. { label: '下转次数', prop: 'totalTimes', width: '90' },
  46. { label: '门诊下转次数', prop: 'mzTimes', width: '110' },
  47. { label: '出院下转次数', prop: 'zyTimes', width: '110' },
  48. { label: '下转人数', prop: 'totalNum', width: '110' },
  49. { label: '门诊下转人数', prop: 'mzNum', width: '110' },
  50. { label: '出院下转人数', prop: 'zyNum', width: '110' },
  51. { label: '门诊下转已评估', prop: 'mzScreenNum', width: '120' },
  52. { label: '门诊下转未评估', prop: 'unMzScreenNum', width: '120' },
  53. { label: '出院下转已评估', prop: 'zyScreenNum', width: '120' },
  54. { label: '出院下转未评估', prop: 'unZyScreenNum', width: '120' }
  55. ],
  56. level: 0,
  57. visible: false,
  58. query: {},
  59. dataRangeOption: [],
  60. dialogTableData: [],
  61. dialogHeader: [],
  62. page: 1,
  63. size: 10,
  64. total: 0,
  65. messageVisible: false,
  66. messInfo: null,
  67. remind: '',
  68. dialogLoading: false,
  69. dialogExportLoading: false,
  70. statusOptions: [],
  71. rehabilitationHospital: [],
  72. archiveList: [],
  73. inviteStatus: [
  74. { value: '', label: '全部' },
  75. { value: '1', label: '门诊患者' },
  76. { value: '2', label: '出院患者' }
  77. ],
  78. communityHospitals: [],
  79. title: '',
  80. dialogVisible: false,
  81. signatoryList: []
  82. }
  83. },
  84. methods: {
  85. init() {
  86. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  87. if (selectedRole.code.indexOf('350200') > -1) {
  88. this.level = 1 // 市卫健委
  89. this.areaOptions = [
  90. { label: '厦门市', value: '' },
  91. { label: '思明区', value: '350203' },
  92. { label: '海沧区', value: '350205' },
  93. { label: '湖里区', value: '350206' },
  94. { label: '集美区', value: '350211' },
  95. { label: '同安区', value: '350212' },
  96. { label: '翔安区', value: '350213' }
  97. ]
  98. } else if (selectedRole.code.length == 6) {
  99. this.level = 2 // 区管理
  100. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  101. this.form = {
  102. range: 'town',
  103. area: selectedRole.code
  104. }
  105. this.getHospital(selectedRole.code)
  106. } else {
  107. this.level = 3 // 社区管理
  108. this.rangeOptions = [
  109. { label: '社区', value: 'hospital' },
  110. { label: '团队', value: 'team' }
  111. ]
  112. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  113. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  114. this.form = {
  115. range: 'hospital',
  116. area: selectedRole.code.substring(0, 6),
  117. hospital: selectedRole.code
  118. }
  119. this.getTeam(selectedRole.code)
  120. }
  121. this.initTime()
  122. this.searchFn()
  123. this.getDictData()
  124. this.hospitalsByType()
  125. },
  126. initTime() {
  127. var vm = this
  128. var now = new Date()
  129. vm.nowyear = vm.chooseYear = now.getFullYear()
  130. vm.years = []
  131. for (i = vm.nowyear; i >= 2013; i--) {
  132. vm.years.push(i)
  133. }
  134. },
  135. resetArea() {
  136. if (this.level == 1) {
  137. delete this.form.area
  138. delete this.form.hospital
  139. delete this.form.team
  140. } else if (this.level == 2) {
  141. delete this.form.hospital
  142. delete this.form.team
  143. } else {
  144. delete this.form.team
  145. }
  146. },
  147. getDictData() {
  148. var vm = this
  149. statisticAPI.getDictByDictName({ name: 'rehabilitation_status' }).then(function (res) {
  150. vm.statusOptions = [{ value: '全部', code: '' }]
  151. vm.statusOptions = vm.statusOptions.concat(res.list)
  152. })
  153. statisticAPI.getDictByDictName({ name: 'rehabilitation_hospital' }).then(function (res) {
  154. vm.rehabilitationHospital = [{ value: '全部', code: '' }]
  155. vm.rehabilitationHospital = vm.rehabilitationHospital.concat(res.list)
  156. })
  157. statisticAPI.getDictByDictName({ name: 'archive_status' }).then(function (res) {
  158. vm.archiveList = [{ value: '全部', code: '' }]
  159. vm.archiveList = vm.archiveList.concat(res.list)
  160. })
  161. },
  162. searchFn() {
  163. var vm = this
  164. this.loading = true
  165. var params = {
  166. ...this.form,
  167. isTotal: 1
  168. }
  169. vm.tableData = []
  170. if (this.yearType == '1') {
  171. params.startDate = this.chooseYear + '-01-01'
  172. params.endDate = this.chooseYear + '-12-31'
  173. } else {
  174. if (this.chooseTime) {
  175. params.startDate = this.chooseTime[0]
  176. params.endDate = this.chooseTime[1]
  177. }
  178. }
  179. if (this.form.range == 'town') {
  180. this.tableHeader = getTownHeader().concat(this.constantHeader)
  181. } else if (this.form.range == 'hospital') {
  182. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  183. } else {
  184. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  185. }
  186. httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
  187. if (res.status == 200) {
  188. vm.tableData = res.detailModelList.map(function (item) {
  189. var data = JSON.parse(JSON.stringify(item))
  190. if (vm.form.range == 'town') {
  191. data.town = item.name
  192. data.hasChildren = data.code && true
  193. } else if (vm.form.range == 'hospital') {
  194. data.hospital = item.name
  195. data.hasChildren = data.code && true
  196. } else if (vm.form.range == 'team') {
  197. data.team = item.name
  198. }
  199. return data
  200. })
  201. }
  202. vm.loading = false
  203. })
  204. },
  205. exportTable() {
  206. var vm = this
  207. var params = {
  208. ...this.form
  209. }
  210. if (this.yearType == '1') {
  211. params.startDate = this.chooseYear + '-01-01'
  212. params.endDate = this.chooseYear + '-12-31'
  213. } else {
  214. if (this.chooseTime) {
  215. params.startDate = this.chooseTime[0]
  216. params.endDate = this.chooseTime[1]
  217. }
  218. }
  219. this.exportLoading = true
  220. var fileName = `冠心病门诊下转统计表${new Date().getTime()}.xls`
  221. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnDownInfo', fileName, params).then(function () {
  222. vm.exportLoading = false
  223. })
  224. },
  225. eliminateClick() {
  226. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  227. if (this.level == 1) {
  228. this.form = {
  229. range: 'town'
  230. }
  231. } else if (this.level == 2) {
  232. this.form = {
  233. range: 'town',
  234. area: selectedRole.code
  235. }
  236. this.getHospital(selectedRole.code)
  237. } else {
  238. this.form = {
  239. range: 'hospital',
  240. area: selectedRole.code.substring(0, 6),
  241. hospital: selectedRole.code
  242. }
  243. this.getTeam(selectedRole.code)
  244. }
  245. this.yearType = '1'
  246. this.chooseYear = new Date().getFullYear()
  247. this.chooseTime = null
  248. this.$forceUpdate()
  249. },
  250. getHospital(code, flag = true) {
  251. var vm = this
  252. if (flag) {
  253. delete this.form.hospital
  254. delete this.form.team
  255. }
  256. var params = {
  257. type: 5,
  258. code: code
  259. }
  260. if (!code) {
  261. vm.hospitalOptions = [{ name: '全部', value: '' }]
  262. vm.teamOptions = [{ name: '全部', value: '' }]
  263. return false
  264. }
  265. httpRequest.post('common/district', { data: params }).then(function (res) {
  266. vm.hospitalOptions = res.list
  267. })
  268. },
  269. getTeam(code, flag = true) {
  270. var vm = this
  271. if (flag) {
  272. delete this.form.team
  273. }
  274. var params = {
  275. hospital: code
  276. }
  277. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  278. vm.teamOptions = res.data
  279. })
  280. },
  281. load(row, treeNode, resolve) {
  282. var params = {}
  283. var len = row.code.length
  284. if (len == 6) {
  285. params.range = 'hospital'
  286. params.area = row.code
  287. } else if (len == 10) {
  288. params.range = 'team'
  289. params.hospital = row.code
  290. }
  291. if (this.yearType == '1') {
  292. params.startDate = this.chooseYear + '-01-01'
  293. params.endDate = this.chooseYear + '-12-31'
  294. } else {
  295. if (this.chooseTime) {
  296. params.startDate = this.chooseTime[0]
  297. params.endDate = this.chooseTime[1]
  298. }
  299. }
  300. httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
  301. if (res.status == 200) {
  302. var children = res.detailModelList.map(function (item) {
  303. var data = JSON.parse(JSON.stringify(item))
  304. if (len == 6) {
  305. data.hospital = item.name
  306. data.hasChildren = true
  307. } else if (len == 10) {
  308. data.team = item.name
  309. }
  310. return data
  311. })
  312. resolve(children)
  313. }
  314. })
  315. },
  316. dialogSearchFn() {
  317. this.page = 1
  318. if (this.title == '康复下转明细列表') {
  319. this.rehabilitationPatientInfo()
  320. } else if (this.title == '下转情况数据列表') {
  321. this.turnDownDataPage()
  322. }
  323. },
  324. dialogExportFn() {
  325. var vm = this
  326. var params = {
  327. ...this.query
  328. }
  329. if (this.yearType == '1') {
  330. params.startDate = this.chooseYear + '-01-01'
  331. params.endDate = this.chooseYear + '-12-31'
  332. } else {
  333. if (this.chooseTime) {
  334. params.startDate = this.chooseTime[0]
  335. params.endDate = this.chooseTime[1]
  336. }
  337. }
  338. this.dialogExportLoading = true
  339. var fileName = `冠心病下转情况统计表${new Date().getTime()}.xls`
  340. httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownDataPage', fileName, params).then(function () {
  341. vm.dialogExportLoading = false
  342. })
  343. },
  344. dialogReset() {
  345. var params = {
  346. ...this.query
  347. }
  348. if (this.title == '康复下转明细列表') {
  349. this.query = {
  350. status: '',
  351. hospitalCode: '',
  352. orgCode: '',
  353. archiveStatus: '',
  354. patientType: '',
  355. range: typeof params.range == 'undefined' ? '' : params.range,
  356. area: typeof params.area == 'undefined' ? '' : params.area,
  357. hospital: typeof params.hospital == 'undefined' ? '' : params.hospital,
  358. team: typeof params.team == 'undefined' ? '' : params.team
  359. }
  360. } else if (this.title == '下转情况数据列表') {
  361. this.query = {
  362. sex: '',
  363. isSign: '',
  364. eventType: '',
  365. range: params.range,
  366. area: params.area,
  367. hospital: params.hospital,
  368. team: params.team
  369. }
  370. }
  371. },
  372. handleCurrentChange(val) {
  373. this.page = val
  374. if (this.title == '康复下转明细列表') {
  375. this.rehabilitationPatientInfo()
  376. } else if (this.title == '下转情况数据列表') {
  377. this.turnDownDataPage()
  378. }
  379. },
  380. handleSizeChange(val) {
  381. this.size = val
  382. if (this.title == '康复下转明细列表') {
  383. this.rehabilitationPatientInfo()
  384. } else if (this.title == '下转情况数据列表') {
  385. this.turnDownDataPage()
  386. }
  387. },
  388. // 获取社区医院
  389. hospitalsByType() {
  390. var vm = this
  391. // var code
  392. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  393. if (selectedRole.code.indexOf('350200') > -1) {
  394. code = '350200' // 市卫健委
  395. } else if (selectedRole.code.length == 6) {
  396. code = selectedRole.code
  397. } else {
  398. this.level = 3 // 社区管理
  399. }
  400. if (selectedRole.code.length > 6) {
  401. this.communityHospitals = [{ label: selectedRole.name, value: selectedRole.code }]
  402. } else {
  403. var type = 1
  404. if (selectedRole.code.indexOf('350200') > -1) {
  405. type = 1 // 市卫健委
  406. } else if (selectedRole.code.length == 6) {
  407. type = 2
  408. }
  409. statisticAPI
  410. .hospitalsByType({
  411. type: type,
  412. code: selectedRole.code
  413. })
  414. .then(function (res) {
  415. if (res.status == 200) {
  416. vm.communityHospitals = [{ label: '全部', value: '' }]
  417. res.list.forEach(function (v) {
  418. vm.communityHospitals.push({
  419. value: v.code,
  420. label: v.name
  421. })
  422. })
  423. }
  424. })
  425. .catch(function (err) {
  426. console.log(err, 'Errr')
  427. })
  428. }
  429. },
  430. openDialog(row, prop) {
  431. if (!row.code) return
  432. this.page = 1
  433. if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
  434. this.query = {
  435. status: '',
  436. hospitalCode: '',
  437. orgCode: '',
  438. archiveStatus: '',
  439. patientType: ''
  440. }
  441. this.visible = true
  442. this.title = '康复下转明细列表'
  443. this.dialogHeader = [
  444. { label: '姓名', prop: 'name' },
  445. { label: '性别', prop: 'sex' },
  446. { label: '年龄', prop: 'age' },
  447. { label: '手机号', prop: 'mobile' },
  448. { label: '下转医院', prop: 'hospitalName' },
  449. { label: '下转医生', prop: 'hospitalDoctor' },
  450. { label: '下转时间', prop: 'createTime' },
  451. { label: '患者类型', prop: 'patientType' },
  452. { label: '下转状态', prop: 'statusName' },
  453. { label: '接收社区医院', prop: 'orgName' },
  454. { label: '接收签约医生', prop: 'doctorName' },
  455. { label: '接收时间', prop: 'receiveTime' },
  456. { label: '档案状态', prop: 'archiveStatusName' }
  457. ]
  458. switch (prop) {
  459. case 'mzTimes':
  460. this.query.patientType = '1'
  461. break
  462. case 'zyTimes':
  463. this.query.patientType = '2'
  464. break
  465. }
  466. } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
  467. this.visible = true
  468. this.title = '下转情况数据列表'
  469. this.query = {
  470. sex: '',
  471. isSign: '',
  472. eventType: ''
  473. }
  474. this.dialogHeader = [
  475. { label: '姓名', prop: 'name' },
  476. { label: '性别', prop: 'sex' },
  477. { label: '年龄', prop: 'age' },
  478. { label: '手机号', prop: 'mobile' },
  479. { label: '是否签约', prop: 'isSign' },
  480. { label: '社区医院', prop: 'hospitalName' },
  481. { label: '下转次数', prop: 'num' },
  482. { label: '最近一次下转诊断', prop: 'diagnosisName' },
  483. { label: '最近一次下转时间', prop: 'turnDownTime' },
  484. { label: '最近一次下转类型', prop: 'eventType' }
  485. ]
  486. switch (prop) {
  487. case 'mzNum':
  488. this.query.eventType = '1'
  489. break
  490. case 'zyNum':
  491. this.query.eventType = '2'
  492. break
  493. }
  494. }
  495. var len = row.code.length
  496. if (len == 6) {
  497. this.query.range = 'town'
  498. this.query.area = row.code
  499. } else if (len == 10) {
  500. this.query.range = 'hospital'
  501. this.query.hospital = row.code
  502. } else {
  503. this.query.range = 'team'
  504. this.query.team = row.code
  505. }
  506. this.dataRangeOption = [{ label: row.name, value: row.code }]
  507. if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
  508. this.rehabilitationPatientInfo()
  509. } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
  510. this.turnDownDataPage()
  511. }
  512. },
  513. // 康复下转操作
  514. operation(num, item) {
  515. var vm = this
  516. if (num != 2) {
  517. statisticAPI
  518. .synchronizePationSingle({ id: item.id })
  519. .then(function (res) {
  520. if (res.status == 200) {
  521. vm.$message.success('操作成功')
  522. } else {
  523. vm.$message.error(res.msg)
  524. }
  525. })
  526. .catch(function (err) {
  527. console.log(err, 'Errr')
  528. })
  529. } else {
  530. vm.signatoryList = []
  531. statisticAPI
  532. .kangfuGetSignInfo({ idcard: item.idcard })
  533. .then(function (res) {
  534. if (res.status == 200) {
  535. if (res.data != null) {
  536. vm.signatoryList.push(res.data)
  537. }
  538. }
  539. })
  540. .catch(function (err) {
  541. console.log(err, 'Errr')
  542. })
  543. vm.dialogVisible = true
  544. }
  545. },
  546. rehabilitationPatientInfo() {
  547. var vm = this
  548. var params = {
  549. ...this.query,
  550. page: this.page,
  551. size: this.size,
  552. disease: 3
  553. }
  554. if (this.yearType == '1') {
  555. params.startDate = this.chooseYear + '-01-01'
  556. params.endDate = this.chooseYear + '-12-31'
  557. } else {
  558. if (this.chooseTime) {
  559. params.startDate = this.chooseTime[0]
  560. params.endDate = this.chooseTime[1]
  561. }
  562. }
  563. this.dialogLoading = true
  564. statisticAPI.rehabilitationPatientInfo(params).then(function (res) {
  565. if (res.status == 200) {
  566. res.detailModelList.forEach(function (v) {
  567. v.sex = v.sex == 1 ? '男' : '女'
  568. })
  569. vm.dialogTableData = res.detailModelList
  570. vm.total = res.totalCount
  571. } else {
  572. vm.$message.error(res.msg)
  573. }
  574. vm.dialogLoading = false
  575. })
  576. },
  577. turnDownDataPage() {
  578. var vm = this
  579. var params = {
  580. ...this.query,
  581. page: this.page,
  582. size: this.size
  583. }
  584. if (this.yearType == '1') {
  585. params.startDate = this.chooseYear + '-01-01'
  586. params.endDate = this.chooseYear + '-12-31'
  587. } else {
  588. if (this.chooseTime) {
  589. params.startDate = this.chooseTime[0]
  590. params.endDate = this.chooseTime[1]
  591. }
  592. }
  593. this.dialogLoading = true
  594. httpRequest.get('statistics/collaborate/turnDownDataPage', { data: params }).then(function (res) {
  595. if (res.status == 200) {
  596. vm.dialogTableData = res.detailModelList
  597. vm.total = res.totalCount
  598. }
  599. vm.dialogLoading = false
  600. })
  601. },
  602. closeDialog() {
  603. this.visible = false
  604. },
  605. closeDialog1() {
  606. this.dialogVisible = false
  607. },
  608. getData(data) {
  609. this.yearType = data.yearType
  610. this.form.range = data.range
  611. this.form.area = data.area
  612. this.form.hospital = data.hospital
  613. this.form.team = data.team
  614. if (this.yearType == 1) {
  615. this.chooseYear = data.time
  616. } else {
  617. this.chooseTime = data.time
  618. }
  619. if (this.form.hospital) {
  620. // 如果有社区code传过来就调社区医院列表接口
  621. this.getHospital(data.area, false)
  622. }
  623. if (this.form.team) {
  624. // 如果有团队code传过来就调团队列表接口
  625. this.getTeam(data.hospital, false)
  626. }
  627. this.searchFn()
  628. },
  629. seePatientDetail(row, prop) {
  630. if (prop == 'name') {
  631. if (row.patient) {
  632. EventBus.$emit('preview-person-info', { type: '4', code: row.patient })
  633. } else {
  634. this.$message.warning('未查询到该患者信息')
  635. }
  636. }
  637. },
  638. renderHeader: function (h, item) {
  639. var label = item.column.label
  640. var column = item.column
  641. var tooltip = {
  642. '签约社区': '显示为该患者当前的签约社区医院名称',
  643. '社区医院': '显示为该患者当前的签约社区医院名称',
  644. '签约医院': '显示为该患者当前的签约社区医院名称',
  645. '签约医生': '显示为该患者当前的签约社区医生名称',
  646. '家庭医生': '显示为该患者当前的签约社区医生名称'
  647. }
  648. if (label == '签约社区' || label == '签约医生' || label == '签约医院' || label == '家庭医生' || label == '社区医院') {
  649. return [
  650. label,
  651. h(
  652. 'el-tooltip',
  653. {
  654. props: {
  655. content: (function () {
  656. return tooltip[label]
  657. })(),
  658. placement: 'top'
  659. }
  660. },
  661. [
  662. h('span', {
  663. class: {
  664. 'el-icon-question': true
  665. }
  666. })
  667. ]
  668. )
  669. ]
  670. } else {
  671. return [column.label]
  672. }
  673. }
  674. },
  675. mounted() {
  676. this.init()
  677. }
  678. })