index.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. var template = ''
  2. $.ajax('../../../component/statistics/GxbMz/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-mz', {
  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: 'totalTimes', width: '90' },
  46. { label: '门诊下转次数', prop: 'mzTimes', width: '110' },
  47. { label: '出院下转次数', prop: 'zyTimes', width: '110' },
  48. { label: '下转人数', prop: 'totalNum', width: '110' },
  49. { label: '门诊下转人数', prop: 'mzNum', width: '110' },
  50. { label: '出院下转人数', prop: 'zyNum', width: '110' },
  51. { label: '门诊下转已评估', prop: 'mzScreenNum', width: '120' },
  52. { label: '门诊下转未评估', prop: 'unMzScreenNum', width: '120' },
  53. { label: '出院下转已评估', prop: 'zyScreenNum', width: '120' },
  54. { label: '出院下转未评估', prop: 'unZyScreenNum', width: '120' }
  55. ],
  56. level: 0,
  57. visible: false,
  58. query: {},
  59. dataRangeOption: [],
  60. dialogTableData: [],
  61. dialogHeader: [],
  62. page: 1,
  63. size: 10,
  64. total: 0,
  65. messageVisible: false,
  66. messInfo: null,
  67. remind: '',
  68. dialogExportLoading: false,
  69. statusOptions: [],
  70. rehabilitationHospital: [],
  71. archiveList: [],
  72. inviteStatus: [
  73. { value: '', label: '全部' },
  74. { value: '1', label: '门诊患者' },
  75. { value: '2', label: '出院患者' }
  76. ],
  77. communityHospitals: [],
  78. title: ''
  79. }
  80. },
  81. methods: {
  82. init() {
  83. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  84. if (selectedRole.code.indexOf('350200') > -1) {
  85. this.level = 1 // 市卫健委
  86. this.areaOptions = [
  87. { label: '厦门市', value: '' },
  88. { label: '思明区', value: '350203' },
  89. { label: '海沧区', value: '350205' },
  90. { label: '湖里区', value: '350206' },
  91. { label: '集美区', value: '350211' },
  92. { label: '同安区', value: '350212' },
  93. { label: '翔安区', value: '350213' }
  94. ]
  95. } else if (selectedRole.code.length == 6) {
  96. this.level = 2 // 区管理
  97. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  98. this.form = {
  99. range: 'town',
  100. area: selectedRole.code
  101. }
  102. this.getHospital(selectedRole.code)
  103. } else {
  104. this.level = 3 // 社区管理
  105. this.rangeOptions = [
  106. { label: '社区', value: 'hospital' },
  107. { label: '团队', value: 'team' }
  108. ]
  109. this.areaOptions = [{ label: selectedRole.name.substring(0, 3), value: selectedRole.code }]
  110. this.hospitalOptions = [{ name: selectedRole.name, code: selectedRole.code }]
  111. this.form = {
  112. range: 'hospital',
  113. area: selectedRole.code.substring(0, 6),
  114. hospital: selectedRole.code
  115. }
  116. this.getTeam(selectedRole.code)
  117. }
  118. this.initTime()
  119. this.searchFn()
  120. this.getDictData()
  121. this.hospitalsByType()
  122. },
  123. initTime() {
  124. var vm = this
  125. var now = new Date()
  126. vm.nowyear = vm.chooseYear = now.getFullYear()
  127. vm.years = []
  128. for (i = vm.nowyear; i >= 2013; i--) {
  129. vm.years.push(i)
  130. }
  131. },
  132. resetArea() {
  133. if (this.level == 1) {
  134. delete this.form.area
  135. delete this.form.hospital
  136. delete this.form.team
  137. } else if (this.level == 2) {
  138. delete this.form.hospital
  139. delete this.form.team
  140. } else {
  141. delete this.form.team
  142. }
  143. },
  144. getDictData() {
  145. var vm = this
  146. statisticAPI.getDictByDictName({ name: 'rehabilitation_status' }).then(function (res) {
  147. vm.statusOptions = [{ value: '全部', code: '' }]
  148. vm.statusOptions = vm.statusOptions.concat(res.list)
  149. })
  150. statisticAPI.getDictByDictName({ name: 'rehabilitation_hospital' }).then(function (res) {
  151. vm.rehabilitationHospital = [{ value: '全部', code: '' }]
  152. vm.rehabilitationHospital = vm.rehabilitationHospital.concat(res.list)
  153. })
  154. statisticAPI.getDictByDictName({ name: 'archive_status' }).then(function (res) {
  155. vm.archiveList = [{ value: '全部', code: '' }]
  156. vm.archiveList = vm.archiveList.concat(res.list)
  157. })
  158. },
  159. searchFn() {
  160. var vm = this
  161. this.loading = true
  162. var params = {
  163. ...this.form
  164. }
  165. if (this.yearType == '1') {
  166. params.startDate = this.chooseYear + '-01-01'
  167. params.endDate = this.chooseYear + '-12-31'
  168. } else {
  169. if (this.chooseTime) {
  170. params.startDate = this.chooseTime[0]
  171. params.endDate = this.chooseTime[1]
  172. }
  173. }
  174. if (this.form.range == 'town') {
  175. this.tableHeader = getTownHeader().concat(this.constantHeader)
  176. } else if (this.form.range == 'hospital') {
  177. this.tableHeader = getHospitalHeader().concat(this.constantHeader)
  178. } else {
  179. this.tableHeader = getTeamHeader().concat(this.constantHeader)
  180. }
  181. httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
  182. if (res.status == 200) {
  183. vm.tableData = res.detailModelList.map(function (item) {
  184. var data = JSON.parse(JSON.stringify(item))
  185. if (vm.form.range == 'town') {
  186. data.town = item.name
  187. data.hasChildren = true
  188. } else if (vm.form.range == 'hospital') {
  189. data.hospital = item.name
  190. data.hasChildren = true
  191. } else if (vm.form.range == 'team') {
  192. data.team = item.name
  193. }
  194. return data
  195. })
  196. }
  197. vm.loading = false
  198. })
  199. },
  200. exportTable() {
  201. var vm = this
  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. this.exportLoading = true
  215. var fileName = `冠心病门诊下转统计表${new Date().getTime()}.xls`
  216. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnDownInfo', fileName, params).then(function () {
  217. vm.exportLoading = false
  218. })
  219. },
  220. eliminateClick() {
  221. this.resetArea()
  222. this.form.hospital = ''
  223. this.hospitalOptions = []
  224. this.form.team = ''
  225. this.teamOptions = []
  226. this.yearType = '1'
  227. this.chooseYear = new Date().getFullYear()
  228. this.chooseTime = null
  229. this.$forceUpdate()
  230. },
  231. getHospital(code) {
  232. var vm = this
  233. delete this.form.hospital
  234. delete this.form.team
  235. var params = {
  236. type: 5,
  237. code: code
  238. }
  239. if (!code) {
  240. vm.hospitalOptions = [{ name: '全部', value: '' }]
  241. vm.teamOptions = [{ name: '全部', value: '' }]
  242. return false
  243. }
  244. httpRequest.post('common/district', { data: params }).then(function (res) {
  245. vm.hospitalOptions = res.list
  246. })
  247. },
  248. getTeam(code) {
  249. var vm = this
  250. delete this.form.team
  251. var params = {
  252. hospital: code
  253. }
  254. httpRequest.get('statisticsExport/teamList', { data: params }).then(function (res) {
  255. vm.teamOptions = res.data
  256. })
  257. },
  258. load(row, treeNode, resolve) {
  259. var params = {}
  260. var len = row.code.length
  261. if (len == 6) {
  262. params.range = 'hospital'
  263. params.area = row.code
  264. } else if (len == 10) {
  265. params.range = 'team'
  266. params.hospital = row.code
  267. }
  268. if (this.yearType == '1') {
  269. params.startDate = this.chooseYear + '-01-01'
  270. params.endDate = this.chooseYear + '-12-31'
  271. } else {
  272. if (this.chooseTime) {
  273. params.startDate = this.chooseTime[0]
  274. params.endDate = this.chooseTime[1]
  275. }
  276. }
  277. httpRequest.get('statistics/collaborate/gxbTurnDownInfo', { data: params }).then(function (res) {
  278. if (res.status == 200) {
  279. var children = res.detailModelList.map(function (item) {
  280. var data = JSON.parse(JSON.stringify(item))
  281. if (len == 6) {
  282. data.hospital = item.name
  283. data.hasChildren = true
  284. } else if (len == 10) {
  285. data.team = item.name
  286. }
  287. return data
  288. })
  289. resolve(children)
  290. }
  291. })
  292. },
  293. dialogSearchFn() {
  294. this.page = 1
  295. this.gxbTurnUpInfoPage()
  296. },
  297. dialogExportFn() {
  298. var vm = this
  299. var params = {
  300. ...this.query
  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. this.dialogExportLoading = true
  312. var fileName = `冠心病下转情况统计表${new Date().getTime()}.xls`
  313. httpRequest.downLoadFileForAjax('statistics/collaborate/exportGxbTurnDownInfo', fileName, params).then(function () {
  314. vm.dialogExportLoading = false
  315. })
  316. },
  317. dialogReset() {
  318. var params = {
  319. ...this.query
  320. }
  321. this.query = {
  322. sex: '',
  323. range: params.range,
  324. area: params.area,
  325. hospital: params.hospital,
  326. team: params.team
  327. }
  328. },
  329. handleCurrentChange(val) {
  330. this.page = val
  331. this.gxbTurnUpInfoPage()
  332. },
  333. handleSizeChange(val) {
  334. this.size = val
  335. this.gxbTurnUpInfoPage()
  336. },
  337. // 获取社区医院
  338. hospitalsByType() {
  339. var vm = this
  340. // var code
  341. var selectedRole = JSON.parse(sessionStorage.getItem('selectedRole'))
  342. if (selectedRole.code.indexOf('350200') > -1) {
  343. code = '350200' // 市卫健委
  344. } else if (selectedRole.code.length == 6) {
  345. code = selectedRole.code
  346. } else {
  347. this.level = 3 // 社区管理
  348. }
  349. if (selectedRole.code.length > 6) {
  350. this.communityHospitals = [{ label: selectedRole.name, value: selectedRole.code }]
  351. } else {
  352. var type = 1
  353. if (selectedRole.code.indexOf('350200') > -1) {
  354. type = 1 // 市卫健委
  355. } else if (selectedRole.code.length == 6) {
  356. type = 2
  357. }
  358. statisticAPI
  359. .hospitalsByType({
  360. type: type,
  361. code: selectedRole.code
  362. })
  363. .then(function (res) {
  364. if (res.status == 200) {
  365. vm.communityHospitals = [{ label: '全部', value: '' }]
  366. res.list.forEach(function (v) {
  367. vm.communityHospitals.push({
  368. value: v.code,
  369. label: v.name
  370. })
  371. })
  372. }
  373. })
  374. .catch(function (err) {
  375. console.log(err, 'Errr')
  376. })
  377. }
  378. },
  379. openDialog(row, prop) {
  380. this.query = {}
  381. if (['totalTimes', 'mzTimes', 'zyTimes'].includes(prop)) {
  382. this.visible = true
  383. this.title = '康复下转明细列表'
  384. this.dialogHeader = [
  385. { label: '姓名', prop: 'name' },
  386. { label: '性别', prop: 'sex' },
  387. { label: '年龄', prop: 'age' },
  388. { label: '手机号', prop: 'mobile' },
  389. { label: '下转医院', prop: 'hospitalName' },
  390. { label: '下转医生', prop: 'hospitalDoctor' },
  391. { label: '下转时间', prop: 'createTime' },
  392. { label: '患者类型', prop: 'patientType' },
  393. { label: '下转状态', prop: 'statusName' },
  394. { label: '接收社区医院', prop: 'orgName' },
  395. { label: '接收签约医生', prop: 'doctorName' },
  396. { label: '接收时间', prop: 'receiveTime' },
  397. { label: '档案状态', prop: 'archiveStatusName' }
  398. ]
  399. switch (prop) {
  400. case 'mzTimes':
  401. this.query.patientType = 1
  402. break
  403. case 'zyTimes':
  404. this.query.patientType = 2
  405. break
  406. }
  407. } else if (['totalNum', 'mzNum', 'zyNum'].includes(prop)) {
  408. this.visible = true
  409. this.title = '下转情况数据列表'
  410. this.dialogHeader = [
  411. { label: '姓名', prop: 'name' },
  412. { label: '性别', prop: 'sex' },
  413. { label: '年龄', prop: 'age' },
  414. { label: '手机号', prop: 'mobile' },
  415. { label: '是否签约', prop: 'isSign' },
  416. { label: '社区医院', prop: 'hospitalName' },
  417. { label: '下转次数', prop: 'num' },
  418. { label: '最近一次下转诊断', prop: 'diagnosisName' },
  419. { label: '最近一次下转时间', prop: 'turnDownTime' },
  420. { label: '最近一次下转类型', prop: 'eventType' }
  421. ]
  422. }
  423. var len = row.code.length
  424. if (len == 6) {
  425. this.query.range = 'town'
  426. this.query.area = row.code
  427. } else if (len == 10) {
  428. this.query.range = 'hospital'
  429. this.query.hospital = row.code
  430. } else {
  431. this.query.range = 'team'
  432. this.query.team = row.code
  433. }
  434. this.dataRangeOption = [{ label: row.name, value: row.code }]
  435. },
  436. closeDialog() {
  437. this.visible = false
  438. }
  439. },
  440. mounted() {
  441. this.init()
  442. }
  443. })