index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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. }
  205. if (this.yearType == '1') {
  206. params.startDate = this.chooseYear + '-01-01'
  207. params.endDate = this.chooseYear + '-12-31'
  208. } else {
  209. if (this.chooseTime) {
  210. params.startDate = this.chooseTime[0]
  211. params.endDate = this.chooseTime[1]
  212. }
  213. }
  214. if (this.form.range == 'town') {
  215. this.tableHeader = getTownHeader().concat(this.constantHeader)
  216. } else if (this.form.range == 'hospital') {
  217. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  218. } else {
  219. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  220. }
  221. httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) {
  222. if (res.status == 200) {
  223. vm.tableData = res.detailModelList.map(function (item) {
  224. var data = JSON.parse(JSON.stringify(item))
  225. if (vm.form.range == 'town') {
  226. data.town = item.name
  227. data.hasChildren = true
  228. } else if (vm.form.range == 'hospital') {
  229. data.hospital = item.name
  230. data.hasChildren = true
  231. } else if (vm.form.range == 'team') {
  232. data.team = item.name
  233. }
  234. return data
  235. })
  236. }
  237. vm.loading = false
  238. })
  239. },
  240. exportTable() {
  241. var vm = this
  242. var params = {
  243. ...this.form
  244. }
  245. if (this.yearType == '1') {
  246. params.startDate = this.chooseYear + '-01-01'
  247. params.endDate = this.chooseYear + '-12-31'
  248. } else {
  249. if (this.chooseTime) {
  250. params.startDate = this.chooseTime[0]
  251. params.endDate = this.chooseTime[1]
  252. }
  253. }
  254. this.exportLoading = true
  255. var fileName = `冠心病出院下转统计表${new Date().getTime()}.xls`
  256. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationInfo', fileName, params).then(function () {
  257. vm.exportLoading = false
  258. })
  259. },
  260. eliminateClick() {
  261. this.resetArea()
  262. this.yearType = '1'
  263. this.chooseYear = new Date().getFullYear()
  264. this.chooseTime = null
  265. this.$forceUpdate()
  266. },
  267. getHospital(code) {
  268. var vm = this
  269. delete this.form.hospital
  270. delete this.form.team
  271. var params = {
  272. type: 5,
  273. code: code
  274. }
  275. httpRequest.post('common/district', { data: params }).then(function (res) {
  276. vm.hospitalOptions = [{ code: '', name: '全部' }]
  277. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  278. })
  279. },
  280. getTeam(code) {
  281. var vm = this
  282. delete this.form.team
  283. var params = {
  284. hospital: code,
  285. area: this.form.area
  286. }
  287. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  288. vm.teamOptions = [{ id: '', name: '全部' }]
  289. vm.teamOptions = vm.teamOptions.concat(res.data)
  290. })
  291. },
  292. load(row, treeNode, resolve) {
  293. var params = {}
  294. var len = row.code.length
  295. if (len == 6) {
  296. params.range = 'hospital'
  297. params.area = row.code
  298. } else if (len == 10) {
  299. params.range = 'team'
  300. params.hospital = row.code
  301. }
  302. if (this.yearType == '1') {
  303. params.startDate = this.chooseYear + '-01-01'
  304. params.endDate = this.chooseYear + '-12-31'
  305. } else {
  306. if (this.chooseTime) {
  307. params.startDate = this.chooseTime[0]
  308. params.endDate = this.chooseTime[1]
  309. }
  310. }
  311. httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) {
  312. if (res.status == 200) {
  313. var children = res.detailModelList.map(function (item) {
  314. var data = JSON.parse(JSON.stringify(item))
  315. if (len == 6) {
  316. data.hospital = item.name
  317. data.hasChildren = true
  318. } else if (len == 10) {
  319. data.team = item.name
  320. }
  321. return data
  322. })
  323. resolve(children)
  324. }
  325. })
  326. },
  327. openDialog(row, prop) {
  328. this.query = {}
  329. var len = row.code.length
  330. if (len == 6) {
  331. this.query.range = 'town'
  332. this.query.area = row.code
  333. } else if (len == 10) {
  334. this.query.range = 'hospital'
  335. this.query.hospital = row.code
  336. } else {
  337. this.query.range = 'team'
  338. this.query.team = row.code
  339. }
  340. this.dataRangeOption = [{ label: row.name, value: row.code }]
  341. if (prop == 'vd1Num' || prop == 'vd3Num') {
  342. this.title = '康复随访消息推送明细'
  343. this.dialogHeader = [
  344. { label: '姓名', prop: 'patientName' },
  345. { label: '性别', prop: 'sex' },
  346. { label: '年龄', prop: 'age' },
  347. { label: '证件号码', prop: 'idcard' },
  348. { label: '签约医院', prop: 'hospitalName' },
  349. { label: '签约医生', prop: 'doctorName' },
  350. { label: '提醒类型', prop: 'typeName' },
  351. { label: '消息推送时间', prop: 'createTime' },
  352. { label: '出院下转时间', prop: 'turnTime' },
  353. { label: '消息推送人', prop: 'senderName' }
  354. ]
  355. if (prop == 'vd1Num') {
  356. this.query.visitCount = 1
  357. } else {
  358. this.query.visitCount = 3
  359. }
  360. this.visible = true
  361. this.selectSmsInfoList()
  362. } else if (prop == 'v2Num' || prop == 'v4Num') {
  363. this.title = '康复随访记录明细'
  364. this.dialogHeader = [
  365. { label: '姓名', prop: 'name' },
  366. { label: '性别', prop: 'name' },
  367. { label: '年龄', prop: 'name' },
  368. { label: '手机号', prop: 'name' },
  369. { label: '下转医院', prop: 'name' },
  370. { label: '下转医生', prop: 'name' },
  371. { label: '下转时间', prop: 'name' },
  372. { label: '所属机构', prop: 'name' },
  373. { label: '随访医生', prop: 'name' },
  374. { label: '计划随访时间', prop: 'name' },
  375. { label: '实际随访时间', prop: 'name' }
  376. ]
  377. if (prop == 'v2Num') {
  378. this.query.visitCount = 2
  379. } else {
  380. this.query.visitCount = 4
  381. }
  382. this.visible = true
  383. this.gxbRehabilitationFollowupRecord()
  384. }
  385. },
  386. gxbRehabilitationFollowupRecord() {
  387. var vm = this
  388. var params = {
  389. ...this.query,
  390. page: this.page,
  391. size: this.size
  392. }
  393. if (this.yearType == '1') {
  394. params.startDate = this.chooseYear + '-01-01'
  395. params.endDate = this.chooseYear + '-12-31'
  396. } else {
  397. if (this.chooseTime) {
  398. params.startDate = this.chooseTime[0]
  399. params.endDate = this.chooseTime[1]
  400. }
  401. }
  402. this.dialogLoading = true
  403. httpRequest.get('statistics/collaborate/gxbRehabilitationFollowupRecord', { data: params }).then(function (res) {
  404. if (res.status == 200) {
  405. vm.dialogTableData = res.detailModelList
  406. vm.total = res.totalCount
  407. }
  408. vm.dialogLoading = false
  409. })
  410. },
  411. dialogSearchFn() {
  412. this.page = 1
  413. this.dialogSearch()
  414. },
  415. dialogSearch() {
  416. if (this.title == '康复随访记录明细') {
  417. this.gxbRehabilitationFollowupRecord()
  418. } else {
  419. this.selectSmsInfoList()
  420. }
  421. },
  422. selectSmsInfoList() {
  423. var vm = this
  424. var params = {
  425. ...this.query,
  426. type: 2,
  427. page: this.page,
  428. size: this.size
  429. }
  430. if (this.yearType == '1') {
  431. params.startDate = this.chooseYear + '-01-01'
  432. params.endDate = this.chooseYear + '-12-31'
  433. } else {
  434. if (this.chooseTime) {
  435. params.startDate = this.chooseTime[0]
  436. params.endDate = this.chooseTime[1]
  437. }
  438. }
  439. this.dialogLoading = true
  440. httpRequest.get('statistics/collaborate/selectSmsInfoList', { data: params }).then(function (res) {
  441. if (res.status == 200) {
  442. vm.dialogTableData = res.detailModelList
  443. vm.total = res.totalCount
  444. }
  445. vm.dialogLoading = false
  446. })
  447. },
  448. dialogExportFn() {
  449. var vm = this
  450. this.exportLoading = true
  451. if (this.title == '康复随访记录明细') {
  452. var params = {
  453. ...this.query
  454. }
  455. if (this.yearType == '1') {
  456. params.startDate = this.chooseYear + '-01-01'
  457. params.endDate = this.chooseYear + '-12-31'
  458. } else {
  459. if (this.chooseTime) {
  460. params.startDate = this.chooseTime[0]
  461. params.endDate = this.chooseTime[1]
  462. }
  463. }
  464. var fileName = `康复随访记录明细${new Date().getTime()}.xls`
  465. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationFollowupRecord', fileName, params).then(function () {
  466. vm.exportLoading = false
  467. })
  468. } else {
  469. var params = {
  470. ...this.query,
  471. type: 2
  472. }
  473. if (this.yearType == '1') {
  474. params.startDate = this.chooseYear + '-01-01'
  475. params.endDate = this.chooseYear + '-12-31'
  476. } else {
  477. if (this.chooseTime) {
  478. params.startDate = this.chooseTime[0]
  479. params.endDate = this.chooseTime[1]
  480. }
  481. }
  482. var fileName = `康复随访消息推送明细${new Date().getTime()}.xls`
  483. httpRequest.downLoadFileForAjax('statistics/collaborate/exportSelectSmsInfoList', fileName, params).then(function () {
  484. vm.exportLoading = false
  485. })
  486. }
  487. },
  488. dialogReset() {
  489. var params = {
  490. ...this.query
  491. }
  492. this.query = {
  493. visitCount: params.visitCount,
  494. range: params.range,
  495. area: params.area,
  496. hospital: params.hospital,
  497. team: params.team
  498. }
  499. },
  500. closeDialog() {
  501. this.visible = false
  502. },
  503. handleCurrentChange(val) {
  504. this.page = val
  505. this.dialogSearch()
  506. },
  507. handleSizeChange(val) {
  508. this.size = val
  509. this.dialogSearch()
  510. },
  511. previewForm(row) {
  512. var vm = this
  513. var params = {
  514. planDetailId: row.planDetailId
  515. }
  516. rehaAPI.serviceItem(params).then(function (res) {
  517. if (res.status == 200) {
  518. vm.service = res.data
  519. top.layer.open({
  520. type: 2,
  521. area: ['600px', '700px'],
  522. shade: 0.5,
  523. title: '记录随访表单',
  524. fixed: true, //不固定
  525. maxmin: true,
  526. closeBtn: 1,
  527. // shift: 5,
  528. shadeClose: false, //点击遮罩关闭层
  529. content: '../../rehabilitation/html/followRecord.html?serviceInfo=' + encodeURIComponent(JSON.stringify(vm.service)) + '&planDetailId=' + row.planDetailId,
  530. end: function () {
  531. // 未点击确定按钮,点击关闭按钮
  532. }
  533. })
  534. }
  535. })
  536. },
  537. previewMess(row) {
  538. this.messageVisible = true
  539. this.messInfo = row.content
  540. },
  541. closeMessageDialog() {
  542. this.messageVisible = false
  543. }
  544. },
  545. mounted() {
  546. this.init()
  547. }
  548. })