index.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  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. }
  136. },
  137. methods: {
  138. init() {
  139. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  140. if (selectedRole.code.indexOf('350200') > -1) {
  141. this.level = 1 // 市卫健委
  142. this.areaOptions = [
  143. { label: '厦门市', value: '' },
  144. { label: '思明区', value: '350203' },
  145. { label: '海沧区', value: '350205' },
  146. { label: '湖里区', value: '350206' },
  147. { label: '集美区', value: '350211' },
  148. { label: '同安区', value: '350212' },
  149. { label: '翔安区', value: '350213' }
  150. ]
  151. } else if (selectedRole.code.length == 6) {
  152. this.level = 2 // 区管理
  153. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  154. this.form = {
  155. range: 'town',
  156. area: selectedRole.code
  157. }
  158. this.getHospital(selectedRole.code)
  159. } else {
  160. this.level = 3 // 社区管理
  161. this.rangeOptions = [
  162. { label: '社区', value: 'hospital' },
  163. { label: '团队', value: 'team' }
  164. ]
  165. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }]
  166. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  167. this.form = {
  168. range: 'hospital',
  169. area: selectedRole.code.substring(0, 6),
  170. hospital: selectedRole.code
  171. }
  172. this.getTeam(selectedRole.code)
  173. }
  174. this.initTime()
  175. this.searchFn()
  176. },
  177. initTime() {
  178. var vm = this
  179. var now = new Date()
  180. vm.nowyear = vm.chooseYear = now.getFullYear()
  181. vm.years = []
  182. for (i = vm.nowyear; i >= 2013; i--) {
  183. vm.years.push(i)
  184. }
  185. },
  186. resetArea() {
  187. if (this.level == 1) {
  188. delete this.form.area
  189. delete this.form.hospital
  190. delete this.form.team
  191. } else if (this.level == 2) {
  192. delete this.form.hospital
  193. delete this.form.team
  194. } else {
  195. delete this.form.team
  196. }
  197. },
  198. searchFn() {
  199. var vm = this
  200. this.loading = true
  201. var params = {
  202. ...this.form
  203. }
  204. if (this.yearType == '1') {
  205. params.startDate = this.chooseYear + '-01-01'
  206. params.endDate = this.chooseYear + '-12-31'
  207. } else {
  208. if (this.chooseTime) {
  209. params.startDate = this.chooseTime[0]
  210. params.endDate = this.chooseTime[1]
  211. }
  212. }
  213. if (this.form.range == 'town') {
  214. this.tableHeader = getTownHeader().concat(this.constantHeader)
  215. } else if (this.form.range == 'hospital') {
  216. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  217. } else {
  218. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  219. }
  220. httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) {
  221. if (res.status == 200) {
  222. vm.tableData = res.detailModelList.map(function (item) {
  223. var data = JSON.parse(JSON.stringify(item))
  224. if (vm.form.range == 'town') {
  225. data.town = item.name
  226. data.hasChildren = true
  227. } else if (vm.form.range == 'hospital') {
  228. data.hospital = item.name
  229. data.hasChildren = true
  230. } else if (vm.form.range == 'team') {
  231. data.team = item.name
  232. }
  233. return data
  234. })
  235. }
  236. vm.loading = false
  237. })
  238. },
  239. exportTable() {
  240. var vm = this
  241. var params = {
  242. ...this.form
  243. }
  244. if (this.yearType == '1') {
  245. params.startDate = this.chooseYear + '-01-01'
  246. params.endDate = this.chooseYear + '-12-31'
  247. } else {
  248. if (this.chooseTime) {
  249. params.startDate = this.chooseTime[0]
  250. params.endDate = this.chooseTime[1]
  251. }
  252. }
  253. this.exportLoading = true
  254. var fileName = `冠心病出院下转统计表${new Date().getTime()}.xls`
  255. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationInfo', fileName, params).then(function () {
  256. vm.exportLoading = false
  257. })
  258. },
  259. eliminateClick() {
  260. this.resetArea()
  261. this.yearType = '1'
  262. this.chooseYear = new Date().getFullYear()
  263. this.chooseTime = null
  264. this.$forceUpdate()
  265. },
  266. getHospital(code) {
  267. var vm = this
  268. delete this.form.hospital
  269. delete this.form.team
  270. var params = {
  271. type: 5,
  272. code: code
  273. }
  274. httpRequest.post('common/district', { data: params }).then(function (res) {
  275. vm.hospitalOptions = [{ code: '', name: '全部' }]
  276. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  277. })
  278. },
  279. getTeam(code) {
  280. var vm = this
  281. delete this.form.team
  282. var params = {
  283. hospital: code,
  284. area: this.form.area
  285. }
  286. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  287. vm.teamOptions = [{ id: '', name: '全部' }]
  288. vm.teamOptions = vm.teamOptions.concat(res.data)
  289. })
  290. },
  291. load(row, treeNode, resolve) {
  292. var params = {}
  293. var len = row.code.length
  294. if (len == 6) {
  295. params.range = 'hospital'
  296. params.area = row.code
  297. } else if (len == 10) {
  298. params.range = 'team'
  299. params.hospital = row.code
  300. }
  301. if (this.yearType == '1') {
  302. params.startDate = this.chooseYear + '-01-01'
  303. params.endDate = this.chooseYear + '-12-31'
  304. } else {
  305. if (this.chooseTime) {
  306. params.startDate = this.chooseTime[0]
  307. params.endDate = this.chooseTime[1]
  308. }
  309. }
  310. httpRequest.get('statistics/collaborate/gxbRehabilitationInfo', { data: params }).then(function (res) {
  311. if (res.status == 200) {
  312. var children = res.detailModelList.map(function (item) {
  313. var data = JSON.parse(JSON.stringify(item))
  314. if (len == 6) {
  315. data.hospital = item.name
  316. data.hasChildren = true
  317. } else if (len == 10) {
  318. data.team = item.name
  319. }
  320. return data
  321. })
  322. resolve(children)
  323. }
  324. })
  325. },
  326. openDialog(row, prop) {
  327. this.query = {}
  328. var len = row.code.length
  329. if (len == 6) {
  330. this.query.range = 'town'
  331. this.query.area = row.code
  332. } else if (len == 10) {
  333. this.query.range = 'hospital'
  334. this.query.hospital = row.code
  335. } else {
  336. this.query.range = 'team'
  337. this.query.team = row.code
  338. }
  339. this.dataRangeOption = [{ label: row.name, value: row.code }]
  340. if (prop == 'vd1Num' || prop == 'vd3Num') {
  341. this.title = '康复随访消息推送明细'
  342. this.dialogHeader = [
  343. { label: '姓名', prop: 'patientName' },
  344. { label: '性别', prop: 'sex' },
  345. { label: '年龄', prop: 'age' },
  346. { label: '证件号码', prop: 'idcard' },
  347. { label: '签约医院', prop: 'hospitalName' },
  348. { label: '签约医生', prop: 'doctorName' },
  349. { label: '提醒类型', prop: 'typeName' },
  350. { label: '消息推送时间', prop: 'createTime' },
  351. { label: '出院下转时间', prop: 'turnTime' },
  352. { label: '消息推送人', prop: 'senderName' }
  353. ]
  354. if (prop == 'vd1Num') {
  355. this.query.visitCount = 1
  356. } else {
  357. this.query.visitCount = 3
  358. }
  359. this.visible = true
  360. this.selectSmsInfoList()
  361. } else if (prop == 'v2Num' || prop == 'v4Num') {
  362. this.title = '康复随访记录明细'
  363. this.dialogHeader = [
  364. { label: '姓名', prop: 'name' },
  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. ]
  376. if (prop == 'v2Num') {
  377. this.query.visitCount = 2
  378. } else {
  379. this.query.visitCount = 4
  380. }
  381. this.visible = true
  382. this.gxbRehabilitationFollowupRecord()
  383. }
  384. },
  385. gxbRehabilitationFollowupRecord() {
  386. var vm = this
  387. var params = {
  388. ...this.query,
  389. page: this.page,
  390. size: this.size
  391. }
  392. if (this.yearType == '1') {
  393. params.startDate = this.chooseYear + '-01-01'
  394. params.endDate = this.chooseYear + '-12-31'
  395. } else {
  396. if (this.chooseTime) {
  397. params.startDate = this.chooseTime[0]
  398. params.endDate = this.chooseTime[1]
  399. }
  400. }
  401. this.dialogLoading = true
  402. httpRequest.get('statistics/collaborate/gxbRehabilitationFollowupRecord', { data: params }).then(function (res) {
  403. if (res.status == 200) {
  404. vm.dialogTableData = res.detailModelList
  405. vm.total = res.totalCount
  406. }
  407. vm.dialogLoading = false
  408. })
  409. },
  410. dialogSearchFn() {
  411. this.page = 1
  412. this.dialogSearch()
  413. },
  414. dialogSearch() {
  415. if (this.title == '康复随访记录明细') {
  416. this.gxbRehabilitationFollowupRecord()
  417. } else {
  418. this.selectSmsInfoList()
  419. }
  420. },
  421. selectSmsInfoList() {
  422. var vm = this
  423. var params = {
  424. ...this.query,
  425. type: 2,
  426. page: this.page,
  427. size: this.size
  428. }
  429. if (this.yearType == '1') {
  430. params.startDate = this.chooseYear + '-01-01'
  431. params.endDate = this.chooseYear + '-12-31'
  432. } else {
  433. if (this.chooseTime) {
  434. params.startDate = this.chooseTime[0]
  435. params.endDate = this.chooseTime[1]
  436. }
  437. }
  438. this.dialogLoading = true
  439. httpRequest.get('statistics/collaborate/selectSmsInfoList', { data: params }).then(function (res) {
  440. if (res.status == 200) {
  441. vm.dialogTableData = res.detailModelList
  442. vm.total = res.totalCount
  443. }
  444. vm.dialogLoading = false
  445. })
  446. },
  447. dialogExportFn() {
  448. var vm = this
  449. this.exportLoading = true
  450. if (this.title == '康复随访记录明细') {
  451. var params = {
  452. ...this.query
  453. }
  454. if (this.yearType == '1') {
  455. params.startDate = this.chooseYear + '-01-01'
  456. params.endDate = this.chooseYear + '-12-31'
  457. } else {
  458. if (this.chooseTime) {
  459. params.startDate = this.chooseTime[0]
  460. params.endDate = this.chooseTime[1]
  461. }
  462. }
  463. var fileName = `康复随访记录明细${new Date().getTime()}.xls`
  464. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbRehabilitationFollowupRecord', fileName, params).then(function () {
  465. vm.exportLoading = false
  466. })
  467. } else {
  468. var params = {
  469. ...this.query,
  470. type: 2
  471. }
  472. if (this.yearType == '1') {
  473. params.startDate = this.chooseYear + '-01-01'
  474. params.endDate = this.chooseYear + '-12-31'
  475. } else {
  476. if (this.chooseTime) {
  477. params.startDate = this.chooseTime[0]
  478. params.endDate = this.chooseTime[1]
  479. }
  480. }
  481. var fileName = `康复随访消息推送明细${new Date().getTime()}.xls`
  482. httpRequest.downLoadFileForAjax('statistics/collaborate/exportSelectSmsInfoList', fileName, params).then(function () {
  483. vm.exportLoading = false
  484. })
  485. }
  486. },
  487. dialogReset() {
  488. var params = {
  489. ...this.query
  490. }
  491. this.query = {
  492. visitCount: params.visitCount,
  493. range: params.range,
  494. area: params.area,
  495. hospital: params.hospital,
  496. team: params.team
  497. }
  498. },
  499. closeDialog() {
  500. this.visible = false
  501. },
  502. handleCurrentChange(val) {
  503. this.page = val
  504. this.dialogSearch()
  505. },
  506. handleSizeChange(val) {
  507. this.size = val
  508. this.dialogSearch()
  509. },
  510. previewForm(row) {},
  511. previewMess(row) {
  512. this.messageVisible = true
  513. this.messInfo = row.content
  514. },
  515. closeMessageDialog() {
  516. this.messageVisible = false
  517. }
  518. },
  519. mounted() {
  520. this.init()
  521. }
  522. })