index.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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. if (this.yearType == '1') {
  170. params.startDate = this.chooseYear + '-01-01'
  171. params.endDate = this.chooseYear + '-12-31'
  172. } else {
  173. if (this.chooseTime) {
  174. params.startDate = this.chooseTime[0]
  175. params.endDate = this.chooseTime[1]
  176. }
  177. }
  178. if (this.form.range == 'town') {
  179. this.tableHeader = getTownHeader().concat(this.constantHeader)
  180. } else if (this.form.range == 'hospital') {
  181. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  182. } else {
  183. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  184. }
  185. httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
  186. if (res.status == 200) {
  187. vm.tableData = res.detailModelList.map(function (item) {
  188. var data = JSON.parse(JSON.stringify(item))
  189. if (vm.form.range == 'town') {
  190. data.town = item.name
  191. data.hasChildren = data.code && true
  192. } else if (vm.form.range == 'hospital') {
  193. data.hospital = item.name
  194. data.hasChildren = data.code && true
  195. } else if (vm.form.range == 'team') {
  196. data.team = item.name
  197. }
  198. return data
  199. })
  200. }
  201. vm.loading = false
  202. })
  203. },
  204. exportTable() {
  205. var vm = this
  206. var params = {
  207. ...this.form
  208. }
  209. if (this.yearType == '1') {
  210. params.startDate = this.chooseYear + '-01-01'
  211. params.endDate = this.chooseYear + '-12-31'
  212. } else {
  213. if (this.chooseTime) {
  214. params.startDate = this.chooseTime[0]
  215. params.endDate = this.chooseTime[1]
  216. }
  217. }
  218. this.exportLoading = true
  219. var fileName = `冠心病门诊下转统计表${new Date().getTime()}.xls`
  220. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnDownInfo', fileName, params).then(function () {
  221. vm.exportLoading = false
  222. })
  223. },
  224. eliminateClick() {
  225. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  226. if (this.level == 1) {
  227. this.form = {
  228. range: 'town'
  229. }
  230. } else if (this.level == 2) {
  231. this.form = {
  232. range: 'town',
  233. area: selectedRole.code
  234. }
  235. this.getHospital(selectedRole.code)
  236. } else {
  237. this.form = {
  238. range: 'hospital',
  239. area: selectedRole.code.substring(0, 6),
  240. hospital: selectedRole.code
  241. }
  242. this.getTeam(selectedRole.code)
  243. }
  244. this.yearType = '1'
  245. this.chooseYear = new Date().getFullYear()
  246. this.chooseTime = null
  247. this.$forceUpdate()
  248. },
  249. getHospital(code, flag = true) {
  250. var vm = this
  251. if (flag) {
  252. delete this.form.hospital
  253. delete this.form.team
  254. }
  255. var params = {
  256. type: 5,
  257. code: code
  258. }
  259. if (!code) {
  260. vm.hospitalOptions = [{ name: '全部', value: '' }]
  261. vm.teamOptions = [{ name: '全部', value: '' }]
  262. return false
  263. }
  264. httpRequest.post('common/district', { data: params }).then(function (res) {
  265. vm.hospitalOptions = res.list
  266. })
  267. },
  268. getTeam(code, flag = true) {
  269. var vm = this
  270. if (flag) {
  271. delete this.form.team
  272. }
  273. var params = {
  274. hospital: code
  275. }
  276. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  277. vm.teamOptions = res.data
  278. })
  279. },
  280. load(row, treeNode, resolve) {
  281. var params = {}
  282. var len = row.code.length
  283. if (len == 6) {
  284. params.range = 'hospital'
  285. params.area = row.code
  286. } else if (len == 10) {
  287. params.range = 'team'
  288. params.hospital = row.code
  289. }
  290. if (this.yearType == '1') {
  291. params.startDate = this.chooseYear + '-01-01'
  292. params.endDate = this.chooseYear + '-12-31'
  293. } else {
  294. if (this.chooseTime) {
  295. params.startDate = this.chooseTime[0]
  296. params.endDate = this.chooseTime[1]
  297. }
  298. }
  299. httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
  300. if (res.status == 200) {
  301. var children = res.detailModelList.map(function (item) {
  302. var data = JSON.parse(JSON.stringify(item))
  303. if (len == 6) {
  304. data.hospital = item.name
  305. data.hasChildren = true
  306. } else if (len == 10) {
  307. data.team = item.name
  308. }
  309. return data
  310. })
  311. resolve(children)
  312. }
  313. })
  314. },
  315. dialogSearchFn() {
  316. this.page = 1
  317. if (this.title == '康复下转明细列表') {
  318. this.rehabilitationPatientInfo()
  319. } else if (this.title == '下转情况数据列表') {
  320. this.turnDownDataPage()
  321. }
  322. },
  323. dialogExportFn() {
  324. var vm = this
  325. var params = {
  326. ...this.query
  327. }
  328. if (this.yearType == '1') {
  329. params.startDate = this.chooseYear + '-01-01'
  330. params.endDate = this.chooseYear + '-12-31'
  331. } else {
  332. if (this.chooseTime) {
  333. params.startDate = this.chooseTime[0]
  334. params.endDate = this.chooseTime[1]
  335. }
  336. }
  337. this.dialogExportLoading = true
  338. var fileName = `冠心病下转情况统计表${new Date().getTime()}.xls`
  339. httpRequest.downLoadFileForAjax('statistics/collaborate/exportTurnDownDataPage', fileName, params).then(function () {
  340. vm.dialogExportLoading = false
  341. })
  342. },
  343. dialogReset() {
  344. var params = {
  345. ...this.query
  346. }
  347. if (this.title == '康复下转明细列表') {
  348. this.query = {
  349. status: '',
  350. hospitalCode: '',
  351. orgCode: '',
  352. archiveStatus: '',
  353. patientType: '',
  354. range: params.range,
  355. area: params.area,
  356. hospital: params.hospital,
  357. team: params.team
  358. }
  359. } else if (this.title == '下转情况数据列表') {
  360. this.query = {
  361. sex: '',
  362. isSign: '',
  363. eventType: '',
  364. range: params.range,
  365. area: params.area,
  366. hospital: params.hospital,
  367. team: params.team
  368. }
  369. }
  370. },
  371. handleCurrentChange(val) {
  372. this.page = val
  373. if (this.title == '康复下转明细列表') {
  374. this.rehabilitationPatientInfo()
  375. } else if (this.title == '下转情况数据列表') {
  376. this.turnDownDataPage()
  377. }
  378. },
  379. handleSizeChange(val) {
  380. this.size = val
  381. if (this.title == '康复下转明细列表') {
  382. this.rehabilitationPatientInfo()
  383. } else if (this.title == '下转情况数据列表') {
  384. this.turnDownDataPage()
  385. }
  386. },
  387. // 获取社区医院
  388. hospitalsByType() {
  389. var vm = this
  390. // var code
  391. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  392. if (selectedRole.code.indexOf('350200') > -1) {
  393. code = '350200' // 市卫健委
  394. } else if (selectedRole.code.length == 6) {
  395. code = selectedRole.code
  396. } else {
  397. this.level = 3 // 社区管理
  398. }
  399. if (selectedRole.code.length > 6) {
  400. this.communityHospitals = [{ label: selectedRole.name, value: selectedRole.code }]
  401. } else {
  402. var type = 1
  403. if (selectedRole.code.indexOf('350200') > -1) {
  404. type = 1 // 市卫健委
  405. } else if (selectedRole.code.length == 6) {
  406. type = 2
  407. }
  408. statisticAPI
  409. .hospitalsByType({
  410. type: type,
  411. code: selectedRole.code
  412. })
  413. .then(function (res) {
  414. if (res.status == 200) {
  415. vm.communityHospitals = [{ label: '全部', value: '' }]
  416. res.list.forEach(function (v) {
  417. vm.communityHospitals.push({
  418. value: v.code,
  419. label: v.name
  420. })
  421. })
  422. }
  423. })
  424. .catch(function (err) {
  425. console.log(err, 'Errr')
  426. })
  427. }
  428. },
  429. openDialog(row, prop) {
  430. if(!row.code)return
  431. this.page = 1
  432. if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
  433. this.query = {
  434. status: '',
  435. hospitalCode: '',
  436. orgCode: '',
  437. archiveStatus: '',
  438. patientType: ''
  439. }
  440. this.visible = true
  441. this.title = '康复下转明细列表'
  442. this.dialogHeader = [
  443. { label: '姓名', prop: 'name' },
  444. { label: '性别', prop: 'sex' },
  445. { label: '年龄', prop: 'age' },
  446. { label: '手机号', prop: 'mobile' },
  447. { label: '下转医院', prop: 'hospitalName' },
  448. { label: '下转医生', prop: 'hospitalDoctor' },
  449. { label: '下转时间', prop: 'createTime' },
  450. { label: '患者类型', prop: 'patientType' },
  451. { label: '下转状态', prop: 'statusName' },
  452. { label: '接收社区医院', prop: 'orgName' },
  453. { label: '接收签约医生', prop: 'doctorName' },
  454. { label: '接收时间', prop: 'receiveTime' },
  455. { label: '档案状态', prop: 'archiveStatusName' }
  456. ]
  457. switch (prop) {
  458. case 'mzTimes':
  459. this.query.patientType = "1"
  460. break
  461. case 'zyTimes':
  462. this.query.patientType = "2"
  463. break
  464. }
  465. } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
  466. this.visible = true
  467. this.title = '下转情况数据列表'
  468. this.query = {
  469. sex: '',
  470. isSign: '',
  471. eventType: ''
  472. }
  473. this.dialogHeader = [
  474. { label: '姓名', prop: 'name' },
  475. { label: '性别', prop: 'sex' },
  476. { label: '年龄', prop: 'age' },
  477. { label: '手机号', prop: 'mobile' },
  478. { label: '是否签约', prop: 'isSign' },
  479. { label: '社区医院', prop: 'hospitalName' },
  480. { label: '下转次数', prop: 'num' },
  481. { label: '最近一次下转诊断', prop: 'diagnosisName' },
  482. { label: '最近一次下转时间', prop: 'turnDownTime' },
  483. { label: '最近一次下转类型', prop: 'eventType' }
  484. ]
  485. switch (prop) {
  486. case 'mzNum':
  487. this.query.eventType = "1"
  488. break
  489. case 'zyNum':
  490. this.query.eventType = "2"
  491. break
  492. }
  493. }
  494. var len = row.code.length
  495. if (len == 6) {
  496. this.query.range = 'town'
  497. this.query.area = row.code
  498. } else if (len == 10) {
  499. this.query.range = 'hospital'
  500. this.query.hospital = row.code
  501. } else {
  502. this.query.range = 'team'
  503. this.query.team = row.code
  504. }
  505. this.dataRangeOption = [{ label: row.name, value: row.code }]
  506. if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
  507. this.rehabilitationPatientInfo()
  508. } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
  509. this.turnDownDataPage()
  510. }
  511. },
  512. // 康复下转操作
  513. operation(num, item) {
  514. var vm = this
  515. if (num != 2) {
  516. statisticAPI
  517. .synchronizePationSingle({ id: item.id })
  518. .then(function (res) {
  519. if (res.status == 200) {
  520. vm.$message.success('操作成功')
  521. } else {
  522. vm.$message.error(res.msg)
  523. }
  524. })
  525. .catch(function (err) {
  526. console.log(err, 'Errr')
  527. })
  528. } else {
  529. vm.signatoryList = []
  530. statisticAPI
  531. .kangfuGetSignInfo({ idcard: item.idcard })
  532. .then(function (res) {
  533. if (res.status == 200) {
  534. if (res.data != null) {
  535. vm.signatoryList.push(res.data)
  536. }
  537. }
  538. })
  539. .catch(function (err) {
  540. console.log(err, 'Errr')
  541. })
  542. vm.dialogVisible = true
  543. }
  544. },
  545. rehabilitationPatientInfo() {
  546. var vm = this
  547. var params = {
  548. ...this.query,
  549. page: this.page,
  550. size: this.size,
  551. disease: 3
  552. }
  553. if (this.yearType == '1') {
  554. params.startDate = this.chooseYear + '-01-01'
  555. params.endDate = this.chooseYear + '-12-31'
  556. } else {
  557. if (this.chooseTime) {
  558. params.startDate = this.chooseTime[0]
  559. params.endDate = this.chooseTime[1]
  560. }
  561. }
  562. this.dialogLoading = true
  563. statisticAPI.rehabilitationPatientInfo(params).then(function (res) {
  564. if (res.status == 200) {
  565. res.detailModelList.forEach(function (v) {
  566. v.sex = v.sex == 1 ? '男' : '女'
  567. })
  568. vm.dialogTableData = res.detailModelList
  569. vm.total = res.totalCount
  570. } else {
  571. vm.$message.error(res.msg)
  572. }
  573. vm.dialogLoading = false
  574. })
  575. },
  576. turnDownDataPage() {
  577. var vm = this
  578. var params = {
  579. ...this.query,
  580. page: this.page,
  581. size: this.size
  582. }
  583. if (this.yearType == '1') {
  584. params.startDate = this.chooseYear + '-01-01'
  585. params.endDate = this.chooseYear + '-12-31'
  586. } else {
  587. if (this.chooseTime) {
  588. params.startDate = this.chooseTime[0]
  589. params.endDate = this.chooseTime[1]
  590. }
  591. }
  592. this.loading = true
  593. httpRequest.get('statistics/collaborate/turnDownDataPage', { data: params }).then(function (res) {
  594. if (res.status == 200) {
  595. vm.dialogTableData = res.detailModelList
  596. vm.total = res.totalCount
  597. }
  598. vm.loading = false
  599. })
  600. },
  601. closeDialog() {
  602. this.visible = false
  603. },
  604. closeDialog1() {
  605. this.dialogVisible = false
  606. },
  607. getData(data) {
  608. this.yearType = data.yearType
  609. this.form.range = data.range
  610. this.form.area = data.area
  611. this.form.hospital = data.hospital
  612. this.form.team = data.team
  613. if (this.yearType == 1) {
  614. this.chooseYear = data.time
  615. } else {
  616. this.chooseTime = data.time
  617. }
  618. if (this.form.hospital) {
  619. // 如果有社区code传过来就调社区医院列表接口
  620. this.getHospital(data.area, false)
  621. }
  622. if (this.form.team) {
  623. // 如果有团队code传过来就调团队列表接口
  624. this.getTeam(data.hospital, false)
  625. }
  626. this.searchFn()
  627. },
  628. seePatientDetail(row, prop) {
  629. if(prop == 'name'){
  630. if(row.patient){
  631. EventBus.$emit('preview-person-info', { type: '4', code: row.patient })
  632. }else{
  633. this.$message.warning("未查询到该患者信息")
  634. }
  635. }
  636. },
  637. },
  638. mounted() {
  639. this.init()
  640. }
  641. })