index.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. var template = ''
  2. $.ajax('../../../component/statistics/GxbTurnup/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-turnup', {
  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: 'turnUpNum', width: '110' },
  46. { label: '上转人次', prop: 'turnUpTimes', width: '110' },
  47. { label: '上转转门诊', prop: 'mzTimes', width: '110', tooltip: '统计已上转的人次中,前往医院进行就诊的人次' },
  48. { label: '上转转门诊转化率', prop: 'mzRate', width: '130' },
  49. { label: '门诊转住院', prop: 'zyTimes', width: '110', tooltip: '统计已就诊的人次中,在医院办理住院的人次' },
  50. { label: '门诊转住院转化率', prop: 'zyRate', width: '130' }
  51. ],
  52. level: 0,
  53. visible: false,
  54. query: {},
  55. dataRangeOption: [],
  56. dialogTableData: [],
  57. dialogHeader: [],
  58. page: 1,
  59. size: 10,
  60. total: 0,
  61. messageVisible: false,
  62. messInfo: null,
  63. remind: '',
  64. dialogExportLoading: false
  65. }
  66. },
  67. methods: {
  68. init() {
  69. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  70. if (selectedRole.code.indexOf('350200') > -1) {
  71. this.level = 1 // 市卫健委
  72. this.areaOptions = [
  73. { label: '厦门市', value: '' },
  74. { label: '思明区', value: '350203' },
  75. { label: '海沧区', value: '350205' },
  76. { label: '湖里区', value: '350206' },
  77. { label: '集美区', value: '350211' },
  78. { label: '同安区', value: '350212' },
  79. { label: '翔安区', value: '350213' }
  80. ]
  81. } else if (selectedRole.code.length == 6) {
  82. this.level = 2 // 区管理
  83. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  84. this.form = {
  85. range: 'town',
  86. area: selectedRole.code
  87. }
  88. this.getHospital(selectedRole.code)
  89. } else {
  90. this.level = 3 // 社区管理
  91. this.rangeOptions = [
  92. { label: '社区', value: 'hospital' },
  93. { label: '团队', value: 'team' }
  94. ]
  95. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code.substring(0, 6) }]
  96. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  97. this.form = {
  98. range: 'hospital',
  99. area: selectedRole.code.substring(0, 6),
  100. hospital: selectedRole.code
  101. }
  102. this.getTeam(selectedRole.code)
  103. }
  104. this.initTime()
  105. this.searchFn()
  106. },
  107. initTime() {
  108. var vm = this
  109. var now = new Date()
  110. vm.nowyear = vm.chooseYear = now.getFullYear()
  111. vm.years = []
  112. for (i = vm.nowyear; i >= 2013; i--) {
  113. vm.years.push(i)
  114. }
  115. },
  116. resetArea() {
  117. if (this.level == 1) {
  118. delete this.form.area
  119. delete this.form.hospital
  120. delete this.form.team
  121. } else if (this.level == 2) {
  122. delete this.form.hospital
  123. delete this.form.team
  124. } else {
  125. delete this.form.team
  126. }
  127. },
  128. searchFn() {
  129. var vm = this
  130. this.loading = true
  131. var params = {
  132. ...this.form,
  133. isTotal: 1
  134. }
  135. vm.tableData = []
  136. if (this.yearType == '1') {
  137. params.startDate = this.chooseYear + '-01-01'
  138. params.endDate = this.chooseYear + '-12-31'
  139. } else {
  140. if (this.chooseTime) {
  141. params.startDate = this.chooseTime[0]
  142. params.endDate = this.chooseTime[1]
  143. }
  144. }
  145. if (this.form.range == 'town') {
  146. this.tableHeader = getTownHeader().concat(this.constantHeader)
  147. } else if (this.form.range == 'hospital') {
  148. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  149. } else {
  150. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  151. }
  152. httpRequest.get('statistics/collaborate/gxbTurnUpInfo', { data: params }).then(function (res) {
  153. if (res.status == 200) {
  154. vm.tableData = res.detailModelList.map(function (item) {
  155. var data = JSON.parse(JSON.stringify(item))
  156. if (vm.form.range == 'town') {
  157. data.town = item.name
  158. data.hasChildren = item.code && true
  159. } else if (vm.form.range == 'hospital') {
  160. data.hospital = item.name
  161. data.hasChildren = item.code && true
  162. } else if (vm.form.range == 'team') {
  163. data.team = item.name
  164. }
  165. return data
  166. })
  167. }
  168. vm.loading = false
  169. })
  170. },
  171. exportTable() {
  172. var vm = this
  173. var params = {
  174. ...this.form
  175. }
  176. if (this.yearType == '1') {
  177. params.startDate = this.chooseYear + '-01-01'
  178. params.endDate = this.chooseYear + '-12-31'
  179. } else {
  180. if (this.chooseTime) {
  181. params.startDate = this.chooseTime[0]
  182. params.endDate = this.chooseTime[1]
  183. }
  184. }
  185. this.exportLoading = true
  186. var fileName = `冠心病上转情况统计表${new Date().getTime()}.xls`
  187. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnUpInfo', fileName, params).then(function () {
  188. vm.exportLoading = false
  189. })
  190. },
  191. eliminateClick() {
  192. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  193. if (this.level == 1) {
  194. this.form = {
  195. range: 'town'
  196. }
  197. } else if (this.level == 2) {
  198. this.form = {
  199. range: 'town',
  200. area: selectedRole.code
  201. }
  202. this.getHospital(selectedRole.code)
  203. } else {
  204. this.form = {
  205. range: 'hospital',
  206. area: selectedRole.code.substring(0, 6),
  207. hospital: selectedRole.code
  208. }
  209. this.getTeam(selectedRole.code)
  210. }
  211. this.yearType = '1'
  212. this.chooseYear = new Date().getFullYear()
  213. this.chooseTime = null
  214. this.$forceUpdate()
  215. },
  216. getHospital(code, flag = true) {
  217. var vm = this
  218. if (flag) {
  219. delete this.form.hospital
  220. delete this.form.team
  221. }
  222. var params = {
  223. type: 5,
  224. code: code
  225. }
  226. httpRequest.post('common/district', { data: params }).then(function (res) {
  227. vm.hospitalOptions = [{ code: '', name: '全部' }]
  228. vm.hospitalOptions = vm.hospitalOptions.concat(res.list)
  229. })
  230. },
  231. getTeam(code, flag) {
  232. var vm = this
  233. if (flag) {
  234. delete this.form.team
  235. }
  236. var params = {
  237. hospital: code,
  238. area: this.form.area
  239. }
  240. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  241. vm.teamOptions = [{ id: '', name: '全部' }]
  242. vm.teamOptions = vm.teamOptions.concat(res.data)
  243. })
  244. },
  245. load(row, treeNode, resolve) {
  246. var params = {}
  247. var len = row.code.length
  248. if (len == 6) {
  249. params.range = 'hospital'
  250. params.area = row.code
  251. } else if (len == 10) {
  252. params.range = 'team'
  253. params.hospital = row.code
  254. }
  255. if (this.yearType == '1') {
  256. params.startDate = this.chooseYear + '-01-01'
  257. params.endDate = this.chooseYear + '-12-31'
  258. } else {
  259. if (this.chooseTime) {
  260. params.startDate = this.chooseTime[0]
  261. params.endDate = this.chooseTime[1]
  262. }
  263. }
  264. httpRequest.get('statistics/collaborate/gxbTurnUpInfo', { data: params }).then(function (res) {
  265. if (res.status == 200) {
  266. var children = res.detailModelList.map(function (item) {
  267. var data = JSON.parse(JSON.stringify(item))
  268. if (len == 6) {
  269. data.hospital = item.name
  270. data.hasChildren = true
  271. } else if (len == 10) {
  272. data.team = item.name
  273. }
  274. return data
  275. })
  276. resolve(children)
  277. }
  278. })
  279. },
  280. dialogSearchFn() {
  281. this.page = 1
  282. this.gxbTurnUpInfoPage()
  283. },
  284. dialogExportFn() {
  285. var vm = this
  286. var params = {
  287. ...this.query
  288. }
  289. if (this.yearType == '1') {
  290. params.startDate = this.chooseYear + '-01-01'
  291. params.endDate = this.chooseYear + '-12-31'
  292. } else {
  293. if (this.chooseTime) {
  294. params.startDate = this.chooseTime[0]
  295. params.endDate = this.chooseTime[1]
  296. }
  297. }
  298. this.dialogExportLoading = true
  299. var fileName = `上转预约明细列表${new Date().getTime()}.xls`
  300. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnUpInfoPage2', fileName, params).then(function () {
  301. vm.dialogExportLoading = false
  302. })
  303. },
  304. dialogReset() {
  305. var params = {
  306. ...this.query
  307. }
  308. this.query = {
  309. sex: '',
  310. range: typeof params.range == 'undefined' ? '' : params.range,
  311. area: typeof params.area == 'undefined' ? '' : params.area,
  312. hospital: typeof params.hospital == 'undefined' ? '' : params.hospital,
  313. team: typeof params.team == 'undefined' ? '' : params.team
  314. }
  315. },
  316. handleCurrentChange(val) {
  317. this.page = val
  318. this.gxbTurnUpInfoPage()
  319. },
  320. handleSizeChange(val) {
  321. this.size = val
  322. this.gxbTurnUpInfoPage()
  323. },
  324. openDialog(row, prop) {
  325. if (!row.code) return
  326. this.page = 1
  327. if (prop == 'turnUpTimes') {
  328. this.query = { sex: '' }
  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. this.dialogHeader = [
  342. { label: '姓名', prop: 'name' },
  343. { label: '性别', prop: 'sex' },
  344. { label: '年龄', prop: 'age' },
  345. { label: '社区医院', prop: 'signHospitalName' },
  346. { label: '签约医生', prop: 'signDoctorName' },
  347. { label: '手机号', prop: 'mobile' },
  348. { label: '证件号码', prop: 'idcard' },
  349. { label: '预约医院', prop: 'orgName' },
  350. { label: '预约医生', prop: 'dName' },
  351. { label: '预约科室', prop: 'deptName' },
  352. { label: '预约时间', prop: 'orderTime' },
  353. { label: '数据来源', prop: 'sourceType' }
  354. ]
  355. this.visible = true
  356. this.gxbTurnUpInfoPage()
  357. }
  358. },
  359. gxbTurnUpInfoPage() {
  360. var vm = this
  361. vm.dialogLoading = true
  362. var params = {
  363. ...this.query,
  364. page: this.page,
  365. pageSize: this.size
  366. }
  367. if (this.yearType == '1') {
  368. params.startDate = this.chooseYear + '-01-01'
  369. params.endDate = this.chooseYear + '-12-31'
  370. } else {
  371. if (this.chooseTime) {
  372. params.startDate = this.chooseTime[0]
  373. params.endDate = this.chooseTime[1]
  374. }
  375. }
  376. httpRequest.get('statistics/collaborate/gxbTurnUpInfoPage2', { data: params }).then(function (res) {
  377. if (res.status == 200) {
  378. vm.dialogTableData = res.detailModelList
  379. vm.total = res.totalCount
  380. }
  381. vm.dialogLoading = false
  382. })
  383. },
  384. seePatientDetail(row, prop) {
  385. if (prop == 'name') {
  386. EventBus.$emit('preview-person-info', { type: '2', code: row.code })
  387. }
  388. },
  389. closeDialog() {
  390. this.visible = false
  391. },
  392. getData(data) {
  393. if (data) {
  394. this.yearType = data.yearType
  395. this.form.range = data.range
  396. this.form.area = data.area
  397. this.form.hospital = data.hospital
  398. this.form.team = data.team
  399. if (this.yearType == 1) {
  400. this.chooseYear = data.time
  401. } else {
  402. this.chooseTime = data.time
  403. }
  404. if (this.form.hospital) {
  405. // 如果有社区code传过来就调社区医院列表接口
  406. this.getHospital(data.area, false)
  407. }
  408. if (this.form.team) {
  409. // 如果有团队code传过来就调团队列表接口
  410. this.getTeam(data.hospital, false)
  411. }
  412. this.searchFn()
  413. } else {
  414. this.init()
  415. }
  416. },
  417. renderHeader: function (h, item) {
  418. var label = item.column.label
  419. var column = item.column
  420. var tooltip = {
  421. '签约社区': '显示为该患者当前的签约社区医院名称',
  422. '社区医院': '显示为该患者当前的签约社区医院名称',
  423. '签约医院': '显示为该患者当前的签约社区医院名称',
  424. '签约医生': '显示为该患者当前的签约社区医生名称',
  425. '家庭医生': '显示为该患者当前的签约社区医生名称'
  426. }
  427. if (label == '签约社区' || label == '签约医生' || label == '签约医院' || label == '家庭医生' || label == '社区医院') {
  428. return [
  429. label,
  430. h(
  431. 'el-tooltip',
  432. {
  433. props: {
  434. content: (function () {
  435. return tooltip[label]
  436. })(),
  437. placement: 'top'
  438. }
  439. },
  440. [
  441. h('span', {
  442. class: {
  443. 'el-icon-question': true
  444. }
  445. })
  446. ]
  447. )
  448. ]
  449. } else {
  450. return [column.label]
  451. }
  452. }
  453. },
  454. mounted() {
  455. this.init()
  456. }
  457. })