index.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. var template = ''
  2. $.ajax('../../../component/statistics/GxbCy/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-cy', {
  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: 'totalNum' },
  46. { label: '康复计划次数', prop: 'totalTimes' }
  47. ],
  48. tableHeaderChildren: [
  49. {
  50. label: '随访1',
  51. children: [
  52. {
  53. label: '应发送消息人次',
  54. prop: 'v1Num',
  55. width: '130'
  56. },
  57. {
  58. label: '已发送消息人次',
  59. prop: 'vd1Num',
  60. width: '130'
  61. }
  62. ]
  63. },
  64. {
  65. label: '随访2',
  66. children: [
  67. {
  68. label: '已登记人次',
  69. prop: 'v2Num',
  70. width: '100'
  71. },
  72. {
  73. label: '已达标人次',
  74. prop: 'vd2Num',
  75. width: '100'
  76. },
  77. {
  78. label: '达标率',
  79. prop: 'v2Rate',
  80. width: '100'
  81. }
  82. ]
  83. },
  84. {
  85. label: '随访3',
  86. children: [
  87. {
  88. label: '应发送消息人次',
  89. prop: 'v3Num',
  90. width: '130'
  91. },
  92. {
  93. label: '已发送消息人次',
  94. prop: 'vd3Num',
  95. width: '130'
  96. }
  97. ]
  98. },
  99. {
  100. label: '随访4',
  101. children: [
  102. {
  103. label: '已登记人次',
  104. prop: 'v4Num',
  105. width: '100'
  106. },
  107. {
  108. label: '已达标人次',
  109. prop: 'vd4Num',
  110. width: '100'
  111. },
  112. {
  113. label: '达标率',
  114. prop: 'v4Rate',
  115. width: '100'
  116. }
  117. ]
  118. }
  119. ],
  120. level: 0,
  121. visible: false,
  122. title: '',
  123. query: {},
  124. dataRangeOption: [],
  125. dialogTableData: [],
  126. dialogHeader: [],
  127. page: 1,
  128. size: 10,
  129. total: 0,
  130. messageVisible: false,
  131. messInfo: null,
  132. remind: '',
  133. dialogExportLoading: false,
  134. dialogLoading: false,
  135. service: {}
  136. }
  137. },
  138. methods: {
  139. init() {
  140. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  141. if (selectedRole.code.indexOf('350200') > -1) {
  142. this.level = 1 // 市卫健委
  143. this.areaOptions = [
  144. { label: '厦门市', value: '' },
  145. { label: '思明区', value: '350203' },
  146. { label: '海沧区', value: '350205' },
  147. { label: '湖里区', value: '350206' },
  148. { label: '集美区', value: '350211' },
  149. { label: '同安区', value: '350212' },
  150. { label: '翔安区', value: '350213' }
  151. ]
  152. } else if (selectedRole.code.length == 6) {
  153. this.level = 2 // 区管理
  154. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  155. this.form = {
  156. range: 'town',
  157. area: selectedRole.code
  158. }
  159. this.getHospital(selectedRole.code)
  160. } else {
  161. this.level = 3 // 社区管理
  162. this.rangeOptions = [
  163. { label: '社区', value: 'hospital' },
  164. { label: '团队', value: 'team' }
  165. ]
  166. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }]
  167. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  168. this.form = {
  169. range: 'hospital',
  170. area: selectedRole.code.substring(0, 6),
  171. hospital: selectedRole.code
  172. }
  173. this.getTeam(selectedRole.code)
  174. }
  175. this.initTime()
  176. this.searchFn()
  177. },
  178. initTime() {
  179. var vm = this
  180. var now = new Date()
  181. vm.nowyear = vm.chooseYear = now.getFullYear()
  182. vm.years = []
  183. for (i = vm.nowyear; i >= 2013; i--) {
  184. vm.years.push(i)
  185. }
  186. },
  187. resetArea() {
  188. if (this.level == 1) {
  189. delete this.form.area
  190. delete this.form.hospital
  191. delete this.form.team
  192. } else if (this.level == 2) {
  193. delete this.form.hospital
  194. delete this.form.team
  195. } else {
  196. delete this.form.team
  197. }
  198. },
  199. searchFn() {
  200. var vm = this
  201. this.loading = true
  202. var params = {
  203. ...this.form,
  204. isTotal: 1
  205. }
  206. vm.tableData = []
  207. if (this.yearType == '1') {
  208. params.startDate = this.chooseYear + '-01-01'
  209. params.endDate = this.chooseYear + '-12-31'
  210. } else {
  211. if (this.chooseTime) {
  212. params.startDate = this.chooseTime[0]
  213. params.endDate = this.chooseTime[1]
  214. }
  215. }
  216. if (this.form.range == 'town') {
  217. this.tableHeader = getTownHeader().concat(this.constantHeader)
  218. } else if (this.form.range == 'hospital') {
  219. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  220. } else {
  221. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  222. }
  223. httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) {
  224. if (res.status == 200) {
  225. vm.tableData = res.detailModelList.map(function (item) {
  226. var data = JSON.parse(JSON.stringify(item))
  227. if (vm.form.range == 'town') {
  228. data.town = item.name
  229. data.hasChildren = true
  230. } else if (vm.form.range == 'hospital') {
  231. data.hospital = item.name
  232. data.hasChildren = true
  233. } else if (vm.form.range == 'team') {
  234. data.team = item.name
  235. }
  236. return data
  237. })
  238. }
  239. vm.loading = false
  240. })
  241. },
  242. exportTable() {
  243. var vm = this
  244. var params = {
  245. ...this.form
  246. }
  247. if (this.yearType == '1') {
  248. params.startDate = this.chooseYear + '-01-01'
  249. params.endDate = this.chooseYear + '-12-31'
  250. } else {
  251. if (this.chooseTime) {
  252. params.startDate = this.chooseTime[0]
  253. params.endDate = this.chooseTime[1]
  254. }
  255. }
  256. this.exportLoading = true
  257. var fileName = `冠心病康复管理情况统计表${new Date().getTime()}.xls`
  258. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationInfo', fileName, params).then(function () {
  259. vm.exportLoading = false
  260. })
  261. },
  262. eliminateClick() {
  263. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  264. if (this.level == 1) {
  265. this.form = {
  266. range: 'town'
  267. }
  268. } else if (this.level == 2) {
  269. this.form = {
  270. range: 'town',
  271. area: selectedRole.code
  272. }
  273. this.getHospital(selectedRole.code)
  274. } else {
  275. this.form = {
  276. range: 'hospital',
  277. area: selectedRole.code.substring(0, 6),
  278. hospital: selectedRole.code
  279. }
  280. this.getTeam(selectedRole.code)
  281. }
  282. this.yearType = '1'
  283. this.chooseYear = new Date().getFullYear()
  284. this.chooseTime = null
  285. this.$forceUpdate()
  286. },
  287. getHospital(code, flag = true) {
  288. var vm = this
  289. if (flag) {
  290. delete this.form.hospital
  291. delete this.form.team
  292. }
  293. var params = {
  294. type: 5,
  295. code: code
  296. }
  297. httpRequest.post('common/district', { data: params }).then(function (res) {
  298. vm.hospitalOptions = [{ code: '', name: '全部' }]
  299. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  300. })
  301. },
  302. getTeam(code, flag = true) {
  303. var vm = this
  304. if (flag) {
  305. delete this.form.team
  306. }
  307. var params = {
  308. hospital: code,
  309. area: this.form.area
  310. }
  311. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  312. vm.teamOptions = [{ id: '', name: '全部' }]
  313. vm.teamOptions = vm.teamOptions.concat(res.data)
  314. })
  315. },
  316. load(row, treeNode, resolve) {
  317. var params = {}
  318. var len = row.code.length
  319. if (len == 6) {
  320. params.range = 'hospital'
  321. params.area = row.code
  322. } else if (len == 10) {
  323. params.range = 'team'
  324. params.hospital = row.code
  325. }
  326. if (this.yearType == '1') {
  327. params.startDate = this.chooseYear + '-01-01'
  328. params.endDate = this.chooseYear + '-12-31'
  329. } else {
  330. if (this.chooseTime) {
  331. params.startDate = this.chooseTime[0]
  332. params.endDate = this.chooseTime[1]
  333. }
  334. }
  335. httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) {
  336. if (res.status == 200) {
  337. var children = res.detailModelList.map(function (item) {
  338. var data = JSON.parse(JSON.stringify(item))
  339. if (len == 6) {
  340. data.hospital = item.name
  341. data.hasChildren = true
  342. } else if (len == 10) {
  343. data.team = item.name
  344. }
  345. return data
  346. })
  347. resolve(children)
  348. }
  349. })
  350. },
  351. openDialog(row, prop) {
  352. if (!row.code) return
  353. this.page = 1
  354. this.query = {}
  355. var len = row.code.length
  356. if (len == 6) {
  357. this.query.range = 'town'
  358. this.query.area = row.code
  359. } else if (len == 10) {
  360. this.query.range = 'hospital'
  361. this.query.hospital = row.code
  362. } else {
  363. this.query.range = 'team'
  364. this.query.team = row.code
  365. }
  366. this.dataRangeOption = [{ label: row.name, value: row.code }]
  367. if (prop == 'vd1Num' || prop == 'vd3Num') {
  368. this.title = '康复随访消息推送明细'
  369. this.dialogHeader = [
  370. { label: '姓名', prop: 'patientName' },
  371. { label: '性别', prop: 'sex' },
  372. { label: '年龄', prop: 'age' },
  373. { label: '证件号码', prop: 'idcard' },
  374. { label: '签约医院', prop: 'hospitalName' },
  375. { label: '签约医生', prop: 'doctorName' },
  376. { label: '提醒类型', prop: 'typeName' },
  377. { label: '消息推送时间', prop: 'createTime' },
  378. { label: '出院下转时间', prop: 'turnTime' },
  379. { label: '消息推送人', prop: 'senderName' }
  380. ]
  381. if (prop == 'vd1Num') {
  382. this.query.visitCount = 1
  383. } else {
  384. this.query.visitCount = 3
  385. }
  386. this.visible = true
  387. this.selectSmsInfoList()
  388. } else if (prop == 'v2Num' || prop == 'v4Num') {
  389. this.title = '康复随访记录明细'
  390. this.dialogHeader = [
  391. { label: '姓名', prop: 'name' },
  392. { label: '性别', prop: 'sex' },
  393. { label: '年龄', prop: 'age' },
  394. { label: '手机号', prop: 'mobile' },
  395. { label: '下转医院', prop: 'turnHospitalName' },
  396. { label: '下转医生', prop: 'turnDoctorName' },
  397. { label: '下转时间', prop: 'createTime' },
  398. { label: '所属机构', prop: 'hospitalName' },
  399. { label: '随访医生', prop: 'doctorName' },
  400. { label: '计划随访时间', prop: 'followupPlanDate' },
  401. { label: '实际随访时间', prop: 'followupDate' }
  402. ]
  403. if (prop == 'v2Num') {
  404. this.query.visitCount = 2
  405. } else {
  406. this.query.visitCount = 4
  407. }
  408. this.visible = true
  409. this.gxbRehabilitationFollowupRecord()
  410. }
  411. },
  412. gxbRehabilitationFollowupRecord() {
  413. var vm = this
  414. var params = {
  415. ...this.query,
  416. page: this.page,
  417. size: this.size
  418. }
  419. if (this.yearType == '1') {
  420. params.startDate = this.chooseYear + '-01-01'
  421. params.endDate = this.chooseYear + '-12-31'
  422. } else {
  423. if (this.chooseTime) {
  424. params.startDate = this.chooseTime[0]
  425. params.endDate = this.chooseTime[1]
  426. }
  427. }
  428. this.dialogLoading = true
  429. httpRequest.get('statistics/collaborate/gxbRehabilitationFollowupRecord', { data: params }).then(function (res) {
  430. if (res.status == 200) {
  431. vm.dialogTableData = res.detailModelList
  432. vm.total = res.totalCount
  433. }
  434. vm.dialogLoading = false
  435. })
  436. },
  437. dialogSearchFn() {
  438. this.page = 1
  439. this.dialogSearch()
  440. },
  441. dialogSearch() {
  442. if (this.title == '康复随访记录明细') {
  443. this.gxbRehabilitationFollowupRecord()
  444. } else {
  445. this.selectSmsInfoList()
  446. }
  447. },
  448. selectSmsInfoList() {
  449. var vm = this
  450. var params = {
  451. ...this.query,
  452. type: 2,
  453. page: this.page,
  454. size: this.size
  455. }
  456. if (this.yearType == '1') {
  457. params.startDate = this.chooseYear + '-01-01'
  458. params.endDate = this.chooseYear + '-12-31'
  459. } else {
  460. if (this.chooseTime) {
  461. params.startDate = this.chooseTime[0]
  462. params.endDate = this.chooseTime[1]
  463. }
  464. }
  465. this.dialogLoading = true
  466. httpRequest.get('statistics/collaborate/selectSmsInfoList', { data: params }).then(function (res) {
  467. if (res.status == 200) {
  468. vm.dialogTableData = res.detailModelList
  469. vm.total = res.totalCount
  470. }
  471. vm.dialogLoading = false
  472. })
  473. },
  474. dialogExportFn() {
  475. var vm = this
  476. this.exportLoading = true
  477. if (this.title == '康复随访记录明细') {
  478. var params = {
  479. ...this.query
  480. }
  481. if (this.yearType == '1') {
  482. params.startDate = this.chooseYear + '-01-01'
  483. params.endDate = this.chooseYear + '-12-31'
  484. } else {
  485. if (this.chooseTime) {
  486. params.startDate = this.chooseTime[0]
  487. params.endDate = this.chooseTime[1]
  488. }
  489. }
  490. var fileName = `康复随访记录明细${new Date().getTime()}.xls`
  491. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationFollowupRecord', fileName, params).then(function () {
  492. vm.exportLoading = false
  493. })
  494. } else {
  495. var params = {
  496. ...this.query,
  497. type: 2
  498. }
  499. if (this.yearType == '1') {
  500. params.startDate = this.chooseYear + '-01-01'
  501. params.endDate = this.chooseYear + '-12-31'
  502. } else {
  503. if (this.chooseTime) {
  504. params.startDate = this.chooseTime[0]
  505. params.endDate = this.chooseTime[1]
  506. }
  507. }
  508. var fileName = `康复随访消息推送明细${new Date().getTime()}.xls`
  509. httpRequest.downLoadFileForAjax('statistics/collaborate/exportSelectSmsInfoList', fileName, params).then(function () {
  510. vm.exportLoading = false
  511. })
  512. }
  513. },
  514. dialogReset() {
  515. var params = {
  516. ...this.query
  517. }
  518. this.query = {
  519. visitCount: params.visitCount,
  520. range: typeof params.range == 'undefined' ? '' : params.range,
  521. area: typeof params.area == 'undefined' ? '' : params.area,
  522. hospital: typeof params.hospital == 'undefined' ? '' : params.hospital,
  523. team: typeof params.team == 'undefined' ? '' : params.team
  524. }
  525. },
  526. closeDialog() {
  527. this.visible = false
  528. },
  529. seePatientDetail(row, prop) {
  530. if (prop == 'patientName' || prop == 'name') {
  531. EventBus.$emit('preview-person-info', { type: '5', code: row.code })
  532. }
  533. },
  534. handleCurrentChange(val) {
  535. this.page = val
  536. this.dialogSearch()
  537. },
  538. handleSizeChange(val) {
  539. this.size = val
  540. this.dialogSearch()
  541. },
  542. previewForm(row) {
  543. var vm = this
  544. var params = {
  545. planDetailId: row.planDetailId
  546. }
  547. rehaAPI.serviceItem(params).then(function (res) {
  548. if (res.status == 200) {
  549. vm.service = res.data
  550. top.layer.open({
  551. type: 2,
  552. area: ['600px', '700px'],
  553. shade: 0.5,
  554. title: '记录随访表单',
  555. fixed: true, //不固定
  556. maxmin: true,
  557. closeBtn: 1,
  558. // shift: 5,
  559. shadeClose: false, //点击遮罩关闭层
  560. content: '../../rehabilitation/html/followRecord.html?serviceInfo=' + encodeURIComponent(JSON.stringify(vm.service)) + '&planDetailId=' + row.planDetailId,
  561. end: function () {
  562. // 未点击确定按钮,点击关闭按钮
  563. }
  564. })
  565. }
  566. })
  567. },
  568. previewMess(row) {
  569. this.messageVisible = true
  570. this.messInfo = row.content
  571. },
  572. closeMessageDialog() {
  573. this.messageVisible = false
  574. },
  575. getData(data) {
  576. if (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. } else {
  597. this.init()
  598. }
  599. },
  600. renderHeader: function (h, item) {
  601. var label = item.column.label
  602. var column = item.column
  603. var tooltip = {
  604. '签约社区': '显示为该患者当前的签约社区医院名称',
  605. '社区医院': '显示为该患者当前的签约社区医院名称',
  606. '签约医院': '显示为该患者当前的签约社区医院名称',
  607. '签约医生': '显示为该患者当前的签约社区医生名称',
  608. '家庭医生': '显示为该患者当前的签约社区医生名称'
  609. }
  610. if (label == '签约社区' || label == '签约医生' || label == '签约医院' || label == '家庭医生' || label == '社区医院') {
  611. return [
  612. label,
  613. h(
  614. 'el-tooltip',
  615. {
  616. props: {
  617. content: (function () {
  618. return tooltip[label]
  619. })(),
  620. placement: 'top'
  621. }
  622. },
  623. [
  624. h('span', {
  625. class: {
  626. 'el-icon-question': true
  627. }
  628. })
  629. ]
  630. )
  631. ]
  632. } else {
  633. return [column.label]
  634. }
  635. }
  636. },
  637. mounted() {
  638. // this.init()
  639. }
  640. })