index.js 18 KB

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