index.js 17 KB

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