index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. var template = ''
  2. $.ajax('../../../component/statistics/GxbEvaluation/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-evaluation', {
  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', width: '90' },
  46. { label: '日常评估人数', prop: 'dailyNum', width: '110' },
  47. { label: '住院补筛人数', prop: 'inScreenNum', width: '110' },
  48. { label: '低危人数', prop: 'lRiskNum', width: '90' },
  49. { label: '中危人数', prop: 'mRiskNum', width: '90' },
  50. { label: '高危人数', prop: 'hRiskNum', width: '90' },
  51. { label: '极高危人数', prop: 'uhRiskNum', width: '90' },
  52. { label: '超高危人数', prop: 'ehRiskNum', width: '90' },
  53. { label: '已筛次数', prop: 'totalTimes', width: '90' },
  54. { label: '低危次数', prop: 'lRiskTimes', width: '90' },
  55. { label: '中危次数', prop: 'mRiskTimes', width: '90' },
  56. { label: '高危次数', prop: 'hRiskTimes', width: '90' },
  57. { label: '极高危次数', prop: 'uhRiskTimes', width: '90' },
  58. { label: '超高危次数', prop: 'ehRiskTimes', width: '90' },
  59. { label: '上转人次', prop: 'turnUpNum', width: '90' },
  60. { label: '消息提醒人次', prop: 'messageTimes', width: '110' },
  61. { label: '社区随访人次', prop: 'hosFollowNum', width: '110' }
  62. ],
  63. // page: 1,
  64. // size: 10,
  65. // total: 0,
  66. level: 0,
  67. visible: false,
  68. title: '',
  69. query: {},
  70. dataRangeOption: [],
  71. dialogTableData: [],
  72. dialogHeader: [],
  73. page: 1,
  74. size: 10,
  75. total: 0,
  76. messageVisible: false,
  77. messInfo: null,
  78. remind: '',
  79. dialogExportLoading: false
  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.substring(0, 6) }]
  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. },
  122. initTime() {
  123. var vm = this
  124. var now = new Date()
  125. var nowyear = (vm.chooseYear = now.getFullYear())
  126. vm.years = []
  127. for (i = nowyear; i >= 2013; i--) {
  128. vm.years.push(i)
  129. }
  130. },
  131. resetArea() {
  132. if (this.level == 1) {
  133. delete this.form.area
  134. delete this.form.hospital
  135. delete this.form.team
  136. } else if (this.level == 2) {
  137. delete this.form.hospital
  138. delete this.form.team
  139. } else {
  140. delete this.form.team
  141. }
  142. },
  143. searchFn() {
  144. var vm = this
  145. this.loading = true
  146. var params = {
  147. ...this.form,
  148. isTotal: 1
  149. }
  150. if (this.yearType == '1') {
  151. params.startDate = this.chooseYear + '-01-01'
  152. params.endDate = this.chooseYear + '-12-31'
  153. } else {
  154. if (this.chooseTime) {
  155. params.startDate = this.chooseTime[0]
  156. params.endDate = this.chooseTime[1]
  157. }
  158. }
  159. if (this.form.range == 'town') {
  160. this.tableHeader = getTownHeader().concat(this.constantHeader)
  161. } else if (this.form.range == 'hospital') {
  162. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  163. } else {
  164. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  165. }
  166. // constantHeader
  167. httpRequest.get('statistics/collaborate/gxbScreenInfoStatistics', { data: params }).then(function (res) {
  168. if (res.status == 200) {
  169. vm.tableData = res.detailModelList.map(function (item) {
  170. var data = JSON.parse(JSON.stringify(item))
  171. if (vm.form.range == 'town') {
  172. data.town = item.name
  173. data.hasChildren = item.code && true
  174. } else if (vm.form.range == 'hospital') {
  175. data.hospital = item.name
  176. data.hasChildren = item.code && true
  177. } else if (vm.form.range == 'team') {
  178. data.team = item.name
  179. }
  180. return data
  181. })
  182. }
  183. vm.loading = false
  184. })
  185. },
  186. exportTable() {
  187. var vm = this
  188. var params = {
  189. ...this.form
  190. }
  191. if (this.yearType == '1') {
  192. params.startDate = this.chooseYear + '-01-01'
  193. params.endDate = this.chooseYear + '-12-31'
  194. } else {
  195. if (this.chooseTime) {
  196. params.startDate = this.chooseTime[0]
  197. params.endDate = this.chooseTime[1]
  198. }
  199. }
  200. this.exportLoading = true
  201. var fileName = `冠心病评估情况统计表${new Date().getTime()}.xls`
  202. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbScreenInfoStatistics', fileName, params).then(function () {
  203. vm.exportLoading = false
  204. })
  205. },
  206. eliminateClick() {
  207. this.resetArea()
  208. this.yearType = '1'
  209. this.chooseYear = new Date().getFullYear()
  210. this.chooseTime = null
  211. this.$forceUpdate()
  212. },
  213. getHospital(code, flag = true) {
  214. var vm = this
  215. if (flag) {
  216. delete this.form.hospital
  217. delete this.form.team
  218. }
  219. var params = {
  220. type: 5,
  221. code: code
  222. }
  223. httpRequest.post('common/district', { data: params }).then(function (res) {
  224. vm.hospitalOptions = [{ code: '', name: '全部' }]
  225. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  226. })
  227. },
  228. getTeam(code, flag = true) {
  229. var vm = this
  230. if (flag) delete this.form.team
  231. var params = {
  232. hospital: code,
  233. area: this.form.area
  234. }
  235. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  236. vm.teamOptions = [{ id: '', name: '全部' }]
  237. vm.teamOptions = vm.teamOptions.concat(res.data)
  238. })
  239. },
  240. load(row, treeNode, resolve) {
  241. var params = {}
  242. var len = row.code.length
  243. if (len == 6) {
  244. params.range = 'hospital'
  245. params.area = row.code
  246. } else if (len == 10) {
  247. params.range = 'team'
  248. params.hospital = row.code
  249. }
  250. if (this.yearType == '1') {
  251. params.startDate = this.chooseYear + '-01-01'
  252. params.endDate = this.chooseYear + '-12-31'
  253. } else {
  254. if (this.chooseTime) {
  255. params.startDate = this.chooseTime[0]
  256. params.endDate = this.chooseTime[1]
  257. }
  258. }
  259. httpRequest.get('statistics/collaborate/gxbScreenInfoStatistics', { data: params }).then(function (res) {
  260. if (res.status == 200) {
  261. var children = res.detailModelList.map(function (item) {
  262. var data = JSON.parse(JSON.stringify(item))
  263. if (len == 6) {
  264. data.hospital = item.name
  265. data.hasChildren = true
  266. } else if (len == 10) {
  267. data.team = item.name
  268. }
  269. return data
  270. })
  271. resolve(children)
  272. }
  273. })
  274. },
  275. openDialog(row, prop) {
  276. var vm = this
  277. this.query = {}
  278. switch (prop) {
  279. case 'totalNum':
  280. this.title = '个案数据列表'
  281. break
  282. case 'dailyNum':
  283. this.query.surveyStatus = 1
  284. this.title = '个案数据列表'
  285. break
  286. case 'inScreenNum':
  287. this.query.surveyStatus = 2
  288. this.title = '个案数据列表'
  289. break
  290. case 'lRiskNum':
  291. this.query.screenResultCode = 5
  292. this.title = '个案数据列表'
  293. break
  294. case 'mRiskNum':
  295. this.query.screenResultCode = 4
  296. this.title = '个案数据列表'
  297. break
  298. case 'hRiskNum':
  299. this.query.screenResultCode = 3
  300. this.title = '个案数据列表'
  301. break
  302. case 'uhRiskNum':
  303. this.query.screenResultCode = 2
  304. this.title = '个案数据列表'
  305. break
  306. case 'ehRiskNum':
  307. this.query.screenResultCode = 1
  308. this.title = '个案数据列表'
  309. break
  310. case 'messageTimes':
  311. this.title = '评估随访消息推送明细'
  312. break
  313. }
  314. var len = row.code.length
  315. if (len == 6) {
  316. this.query.range = 'town'
  317. this.query.area = row.code
  318. } else if (len == 10) {
  319. this.query.range = 'hospital'
  320. this.query
  321. this.query.hospital = row.code
  322. } else {
  323. this.query.range = 'team'
  324. this.query.team = row.code
  325. }
  326. this.dataRangeOption = [{ label: row.name, value: row.code }]
  327. if (['totalNum', 'dailyNum', 'inScreenNum', 'lRiskNum', 'mRiskNum', 'hRiskNum', 'uhRiskNum', 'ehRiskNum'].includes(prop)) {
  328. this.query.sex = ''
  329. vm.dialogHeader = [
  330. { label: '姓名', prop: 'name' },
  331. { label: '性别', prop: 'sex' },
  332. { label: '年龄', prop: 'age' },
  333. { label: '评估结果', prop: 'screenResult' },
  334. { label: '评估医生', prop: 'doctorName' },
  335. { label: '评估时间', prop: 'czrq' },
  336. { label: '手机号', prop: 'mobile' },
  337. { label: '证件号码', prop: 'idcard' },
  338. { label: '签约社区', prop: 'signHospitalName' },
  339. { label: '签约医生', prop: 'signDoctorName' }
  340. ]
  341. this.gxbCaseDataPage()
  342. vm.visible = true
  343. }
  344. if (prop == 'messageTimes') {
  345. vm.dialogHeader = [
  346. { label: '姓名', prop: 'patientName' },
  347. { label: '性别', prop: 'sex' },
  348. { label: '年龄', prop: 'age' },
  349. { label: '证件号码', prop: 'idcard' },
  350. { label: '签约医院', prop: 'hospitalName' },
  351. { label: '签约医生', prop: 'doctorName' },
  352. { label: '提醒类型', prop: 'typeName' },
  353. { label: '消息推送时间', prop: 'createTime' },
  354. { label: '出院下转时间', prop: 'turnTime' },
  355. { label: '消息推送人', prop: 'senderName' }
  356. ]
  357. this.selectSmsInfoList()
  358. vm.visible = true
  359. }
  360. },
  361. dialogSearchFn() {
  362. this.page = 1
  363. if (this.title == '个案数据列表') {
  364. this.gxbCaseDataPage()
  365. } else {
  366. this.selectSmsInfoList()
  367. }
  368. },
  369. gxbCaseDataPage() {
  370. var vm = this
  371. var params = JSON.parse(JSON.stringify(this.query))
  372. params.page = this.page
  373. params.pageSize = this.size
  374. if (this.yearType == '1') {
  375. params.startDate = this.chooseYear + '-01-01'
  376. params.endDate = this.chooseYear + '-12-31'
  377. } else {
  378. if (this.chooseTime) {
  379. params.startDate = this.chooseTime[0]
  380. params.endDate = this.chooseTime[1]
  381. }
  382. }
  383. httpRequest.get('statistics/collaborate/gxbCaseDataPage', { data: params }).then(function (res) {
  384. if (res.status == 200) {
  385. vm.dialogTableData = res.detailModelList
  386. vm.total = res.totalCount
  387. }
  388. })
  389. },
  390. handleCurrentChange(val) {
  391. this.page = val
  392. if (this.title == '个案数据列表') {
  393. this.gxbCaseDataPage()
  394. } else {
  395. this.selectSmsInfoList()
  396. }
  397. },
  398. handleSizeChange(val) {
  399. this.size = val
  400. if (this.title == '个案数据列表') {
  401. this.gxbCaseDataPage()
  402. } else {
  403. this.selectSmsInfoList()
  404. }
  405. },
  406. selectSmsInfoList() {
  407. var vm = this
  408. var params = {
  409. ...this.query
  410. }
  411. params.type = 1
  412. params.page = this.page
  413. params.size = this.size
  414. if (this.yearType == '1') {
  415. params.startDate = this.chooseYear + '-01-01'
  416. params.endDate = this.chooseYear + '-12-31'
  417. } else {
  418. if (this.chooseTime) {
  419. params.startDate = this.chooseTime[0]
  420. params.endDate = this.chooseTime[1]
  421. }
  422. }
  423. httpRequest.get('statistics/collaborate/selectSmsInfoList', { data: params }).then(function (res) {
  424. if (res.status == 200) {
  425. vm.dialogTableData = res.detailModelList
  426. vm.total = res.totalCount
  427. }
  428. })
  429. },
  430. dialogExportFn() {
  431. this.dialogExportLoading = true
  432. var vm = this
  433. var params = {
  434. ...this.query
  435. }
  436. if (this.yearType == '1') {
  437. params.startDate = this.chooseYear + '-01-01'
  438. params.endDate = this.chooseYear + '-12-31'
  439. } else {
  440. if (this.chooseTime) {
  441. params.startDate = this.chooseTime[0]
  442. params.endDate = this.chooseTime[1]
  443. }
  444. }
  445. if (this.title == '个案数据列表') {
  446. var fileName = `个案数据列表${new Date().getTime()}.xls`
  447. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbCaseDataPage', fileName, params).then(function () {
  448. vm.dialogExportLoading = false
  449. })
  450. } else {
  451. var fileName = `评估随访消息推送明细${new Date().getTime()}.xls`
  452. httpRequest.downLoadFileForAjax('statistics/collaborate/exportSelectSmsInfoList', fileName, params).then(function () {
  453. vm.dialogExportLoading = false
  454. })
  455. }
  456. },
  457. closeDialog() {
  458. this.visible = false
  459. },
  460. seePatientDetail(row) {
  461. EventBus.$emit('preview-person-info', { type: '1', code: row.code })
  462. },
  463. dialogReset() {
  464. var params = {
  465. ...this.query
  466. }
  467. this.query = {
  468. sex: '',
  469. screenResultCode: '',
  470. range: params.range,
  471. area: params.area,
  472. hospital: params.hospital,
  473. team: params.team
  474. }
  475. },
  476. previewMess(row) {
  477. this.messageVisible = true
  478. this.messInfo = row.content
  479. },
  480. closeMessageDialog() {
  481. this.messageVisible = false
  482. },
  483. getData(data) {
  484. this.yearType = data.yearType
  485. this.form.range = data.range
  486. this.form.area = data.area
  487. this.form.hospital = data.hospital
  488. this.form.team = data.team
  489. if (this.yearType == 1) {
  490. this.chooseYear = data.time
  491. } else {
  492. this.chooseTime = data.time
  493. }
  494. if (this.form.hospital) {
  495. // 如果有社区code传过来就调社区医院列表接口
  496. this.getHospital(data.area, false)
  497. }
  498. if (this.form.team) {
  499. // 如果有团队code传过来就调团队列表接口
  500. this.getTeam(data.hospital, false)
  501. }
  502. this.searchFn()
  503. }
  504. },
  505. mounted() {
  506. this.init()
  507. }
  508. })