index.js 19 KB

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