index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. // 慢阻肺患者档案-服务档案
  2. var template = ''
  3. $.ajax('../../../component/statistics/CopdServeNum/index.html', {
  4. data: {},
  5. dataType: 'html',
  6. cache: false,
  7. timeout: 60000,
  8. async: false,
  9. error: function (res) {},
  10. success: function (res) {
  11. template = res
  12. }
  13. })
  14. Vue.component('copd-serve-num', {
  15. template: template,
  16. props: [],
  17. data() {
  18. return {
  19. // 当前显示的字段
  20. communityArr: [],
  21. tableFieldList: [],
  22. quotaStrArr: [],
  23. value1: [],
  24. rangeList: [
  25. { name: '按区', code: 'town' },
  26. { name: '按社区', code: 'hospital' }
  27. ],
  28. startTime: '',
  29. endTime: '',
  30. rangeCode: 'town',
  31. quotaStr: '',
  32. range: '',
  33. area: '',
  34. hospital: '',
  35. page: 1,
  36. size: 20,
  37. chooseYear: '',
  38. years: '',
  39. userRole: '',
  40. levelList: [
  41. { level: '4', areaLevel: '2' },
  42. { level: '3', areaLevel: '3' },
  43. { level: '2', areaLevel: '4' }
  44. ], //两种搜索,地区等级对比
  45. areaLevel: '', // 2、市,3、区,4、社区,5、团队
  46. initareaLevel: '',
  47. initlevel: '',
  48. initarea: '',
  49. level: '',
  50. areaTitle: '',
  51. areaCode: null,
  52. communityList: [{ code: '', name: '全部' }],
  53. communityCode: null,
  54. teamList: [{ code: '', name: '全部' }],
  55. teamCode: '',
  56. userRoleCode: '',
  57. docInfo: JSON.parse(window.localStorage.getItem('docInfo')),
  58. isShowBtn: 0,
  59. isGuGan: false,
  60. areaList: [],
  61. tabledata: [],
  62. tableHeader: [
  63. { label: '地区', prop: 'name', width: '90' },
  64. { label: '总患者人数', prop: 'patientNum', width: '90' },
  65. { label: '计划服务人数', prop: 'planNum', width: '90' },
  66. { label: '已服务人数', prop: 'serviceNum', width: '90' },
  67. { label: '服务完成度', prop: 'serviceProgress', width: '90' }
  68. ],
  69. radio: '1',
  70. fileList: [],
  71. file: undefined,
  72. isProgressShow: false,
  73. percentage: 0,
  74. success: false,
  75. loading: false,
  76. isOver: false,
  77. status: '',
  78. errList: [],
  79. daLoading: false,
  80. isShow: false,
  81. datatotal: 0
  82. }
  83. },
  84. methods: {
  85. gotoDownLoad() {
  86. const a = document.createElement('a')
  87. a.style.display = 'none'
  88. a.download = '模板.xlsx'
  89. a.href = './template.xls'
  90. a.target = '_blank'
  91. a.click()
  92. },
  93. hospitalList() {
  94. var vm = this
  95. statisticAPI.hospitalList({ queryArea: vm.userRoleCode }).then(function (res) {
  96. if (res.status == 200) {
  97. vm.communityArr = res.detailModelList
  98. }
  99. })
  100. },
  101. //获取省市区 type:区3
  102. getDistrict: function (type, code, name) {
  103. var vm = this,
  104. list = [],
  105. param = ''
  106. if (type == 3) {
  107. list = [{ code: code, name: name }]
  108. param = 'area'
  109. } else if (type == 5) {
  110. list = [{ code: '', name: '全部' }]
  111. param = 'community'
  112. }
  113. var params = {
  114. type: type,
  115. code: code
  116. }
  117. homeAPI.getDistrict(params).then(function (res) {
  118. if (res.status == 200) {
  119. vm[param + 'List'] = list.concat(res.list)
  120. if (type == 3) {
  121. vm[param + 'Code'] = vm[param + 'List'][0].code
  122. vm.selChange(3)
  123. vm.search()
  124. }
  125. } else {
  126. vm.$message.error(res.msg)
  127. }
  128. })
  129. },
  130. // 初始化时间
  131. initTime(vm) {
  132. var now = new Date()
  133. vm.endTime = now.format('yyyy-MM-dd')
  134. var start = now.getFullYear() + '-' + '01-01'
  135. vm.startTime = new Date(start).format('yyyy-MM-dd')
  136. vm.nowyear = vm.chooseYear = now.getFullYear()
  137. // vm.chooseYear = '2022'
  138. vm.nowmonth = now.getMonth() + 1
  139. vm.years = ['2025']
  140. // for (i = vm.nowyear; i >= 2013; i--) {
  141. // vm.years.push(i)
  142. // }
  143. },
  144. // 数据范围初始化
  145. initScope(type) {
  146. var vm = this
  147. //获得缓存中缓存的角色权限
  148. var userRole = window.sessionStorage.getItem('selectedRole')
  149. if (!userRole) {
  150. return false
  151. }
  152. vm.userRole = JSON.parse(userRole)
  153. vm.areaTitle = vm.userRole.name
  154. if (vm.isGuGan) {
  155. return
  156. }
  157. if (type == 3) {
  158. this.areaCode = null
  159. this.communityCode = null
  160. if (vm.userRole.code == '350200' || vm.userRole.code == 'jk_350200') {
  161. vm.isShowBtn = 1
  162. vm.getDistrict(type, 350200, '厦门市')
  163. } else if (vm.userRole.code.indexOf('jk_') > -1) {
  164. vm.getDistrict(type, vm.userRole.code.substring(3), vm.areaTitle.substring(0, 3))
  165. } else if (vm.userRole.code.length == 6) {
  166. vm.getDistrict(type, vm.userRole.code, vm.areaTitle.substring(0, 3))
  167. }
  168. } else {
  169. this.communityCode = null
  170. if (this.rangeCode == 'hospital') vm.getDistrict(type, vm.areaCode)
  171. }
  172. return
  173. //获得缓存中缓存的角色权限
  174. var userRole = window.sessionStorage.getItem('selectedRole')
  175. if (!userRole) {
  176. return false
  177. }
  178. vm.userRole = JSON.parse(userRole)
  179. //level:2、市,3、区,4、社区,5、团队
  180. vm.initareaLevel = vm.areaLevel = vm.userRole.code == 'jk_350200' ? 2 : vm.userRole.code.length == 9 ? 3 : 4
  181. vm.initlevel = vm.level = vm.userRole.code == 'jk_350200' ? 4 : vm.userRole.code.length == 9 ? 3 : 2
  182. // vm.lowLevel = vm.initlowLevel = vm.userRole.code == '350200' ? 3 : vm.userRole.code.length == 6 ? 2 : 1;
  183. vm.initarea = vm.area = vm.userRole.code
  184. vm.areaTitle = vm.userRole.name
  185. if (vm.initlevel == 4) {
  186. //市获取区
  187. vm.getDistrict(3, vm.initarea.substring(3), vm.areaTitle.substr(0, 3))
  188. vm.rangeCode = vm.rangeList[0].code
  189. } else if (vm.initlevel == 3) {
  190. //区获取社区
  191. vm.areaList = [{ code: vm.initarea, name: vm.areaTitle }]
  192. vm.areaCode = vm.initarea
  193. vm.rangeCode = vm.rangeList[0].code
  194. } else if (vm.initlevel == 2) {
  195. //社区获取团队
  196. vm.communityList = [{ code: vm.initarea, name: vm.areaTitle }]
  197. vm.communityCode = vm.initarea
  198. vm.rangeList.shift()
  199. vm.rangeCode = vm.rangeList[0].code
  200. }
  201. vm.range = vm.rangeCode
  202. },
  203. toggleField(fieldName) {
  204. return this.tableFieldList.indexOf(fieldName) !== -1
  205. },
  206. selChange: function (type) {
  207. var vm = this,
  208. name = ''
  209. if (type == 3) {
  210. vm.initSelOption('community')
  211. vm.initSelOption('team')
  212. vm.getCommunityHospital()
  213. } else if (type == 5) {
  214. vm.initSelOption('team')
  215. // vm.teamListByArea();
  216. }
  217. },
  218. initSelOption: function (param) {
  219. var vm = this
  220. vm[param + 'List'] = [{ code: '', name: '全部' }]
  221. if (param == 'team') {
  222. vm[param + 'List'] = [{ id: '', name: '全部' }]
  223. }
  224. vm[param + 'Code'] = vm[param + 'List'][0].code || vm[param + 'List'][0].id
  225. },
  226. getCommunityHospital: function () {
  227. var vm = this,
  228. list = [{ code: '', name: '全部' }],
  229. param = 'community'
  230. homeAPI.getCommunityHospital({ area: vm.areaCode == '350200' ? '' : vm.areaCode }).then(function (res) {
  231. if (res.status == 200) {
  232. vm[param + 'List'] = list.concat(res.data)
  233. vm[param + 'Code'] = vm[param + 'List'][0].code
  234. } else {
  235. vm.$message.error(res.msg)
  236. }
  237. })
  238. },
  239. exportTable() {
  240. var vm = this
  241. vm.daLoading = true
  242. var params = {
  243. year: this.chooseYear,
  244. range: this.rangeCode,
  245. area: this.areaCode == '350200' ? '' : this.areaCode === null ? '' : this.areaCode
  246. }
  247. if (this.rangeCode == 'hospital') {
  248. params.hospital = this.communityCode
  249. }
  250. statisticAPI.exportServiceProgress(params, '服务人数配置及进度查询.xls').then(function (res) {
  251. vm.daLoading = false
  252. vm.$message({
  253. message: '导出成功!',
  254. type: 'success'
  255. })
  256. })
  257. },
  258. resetDate() {
  259. if (this.isGuGan) {
  260. this.rangeCode = 'hospital'
  261. this.areaCode = this.docInfo.town
  262. this.communityCode = this.docInfo.hospital
  263. } else {
  264. this.rangeCode = 'town'
  265. this.areaCode = ''
  266. this.communityCode = ''
  267. }
  268. this.startTime = ''
  269. this.endTime = ''
  270. this.quotaStr = ''
  271. this.range = ''
  272. this.area = ''
  273. this.hospital = ''
  274. this.sex = ''
  275. this.firstVisitType = ''
  276. this.firstVisitArea = ''
  277. this.firstVisitOrgLevel = ''
  278. this.hasLung = ''
  279. this.hasCt = ''
  280. this.hasx = ''
  281. this.hasBloodGas = ''
  282. this.hasSmoke = ''
  283. this.hasDrink = ''
  284. this.diseaseConversion = ''
  285. this.age = ''
  286. },
  287. handleCurrentChange(val) {
  288. this.page = val
  289. this.search()
  290. },
  291. handleSizeChange(val) {
  292. this.size = val
  293. this.search()
  294. },
  295. //上传
  296. toggle(isShow) {
  297. this.isShow = isShow
  298. if (!isShow) {
  299. this.reset()
  300. }
  301. },
  302. reset(type) {
  303. this.percentage = 0
  304. this.success = false
  305. this.isOver = false
  306. this.errList = []
  307. if (type != 1) {
  308. this.loading = false
  309. this.file = undefined
  310. this.month = ''
  311. }
  312. },
  313. search() {
  314. var vm = this
  315. vm.daLoading = true
  316. var params = {
  317. year: this.chooseYear,
  318. range: this.rangeCode,
  319. area: this.areaCode == '350200' ? '' : this.areaCode === null ? '' : this.areaCode
  320. }
  321. if (this.rangeCode == 'hospital') {
  322. params.hospital = this.communityCode
  323. }
  324. statisticAPI.getServiceProgress(params).then(function (res) {
  325. vm.daLoading = false
  326. if (res.status == 200) {
  327. vm.tabledata = res.detailModelList
  328. vm.totalCount = res.totalCount
  329. vm.totalPage = res.totalPage
  330. } else {
  331. vm.$message.error(res.msg)
  332. }
  333. console.log(res, 'llllllllllllllllllllllllllllllll')
  334. })
  335. },
  336. close(type) {
  337. this.reset(type)
  338. this.isProgressShow = false
  339. if (type != 1) {
  340. this.isShow = false
  341. }
  342. },
  343. beforeUploadPic(file) {
  344. this.file = file
  345. },
  346. check() {
  347. var vm = this
  348. vm.loading = true
  349. if (!vm.file) {
  350. vm.loading = false
  351. vm.$message('请选择文件')
  352. return
  353. }
  354. vm.save()
  355. },
  356. save() {
  357. var vm = this
  358. vm.daLoading = true
  359. var formData = new FormData()
  360. formData.append('file', vm.file)
  361. // vm.initProgress()
  362. httpRequest
  363. .post('doctor/jkCopd/importPlanExcel', {
  364. data: formData,
  365. cache: false, //上传文件无需缓存
  366. processData: false, //用于对data参数进行序列化处理 这里必须false
  367. contentType: false //必须
  368. })
  369. .then(function (res) {
  370. if (res.status == 200) {
  371. vm.search()
  372. vm.daLoading = false
  373. vm.isShow = false
  374. vm.$message({
  375. message: '导入成功!',
  376. type: 'success'
  377. })
  378. } else {
  379. vm.$message.error('导入失败!')
  380. vm.daLoading = false
  381. }
  382. })
  383. .catch(function (e) {
  384. console.error(e)
  385. vm.daLoading = false
  386. })
  387. },
  388. initProgress() {
  389. var vm = this
  390. this.isProgressShow = true
  391. setTimeout(() => {
  392. if (!vm.isOver && vm.percentage != 90) {
  393. vm.percentage += 10
  394. vm.initProgress()
  395. }
  396. }, 1000)
  397. }
  398. },
  399. mounted() {
  400. var vm = this
  401. var userRole = JSON.parse(window.sessionStorage.getItem('selectedRole'))
  402. vm.userRoleCode = userRole.code
  403. this.initTime(this)
  404. if (this.docInfo.expandLevelName) {
  405. this.isGuGan = this.docInfo.expandLevelName.indexOf('慢病骨干') > -1
  406. }
  407. this.initScope(3)
  408. if (this.isGuGan) {
  409. // 如何是慢病骨干 则只能选社区,并且限定死社区
  410. this.rangeList = [{ name: '按社区', code: 'hospital' }]
  411. this.rangeCode = 'hospital'
  412. this.areaList = [{ name: this.docInfo.hospitalName.substring(0, 3), code: this.docInfo.town }]
  413. this.areaCode = this.docInfo.town
  414. this.communityList = [{ name: this.docInfo.hospitalName, code: this.docInfo.hospital }]
  415. this.communityCode = this.docInfo.hospital
  416. // vm.receivingHospitalList = [{code:this.docInfo.hospital,name:this.docInfo.hospitalName}]
  417. // this.hospital = this.docInfo.hospital
  418. }
  419. this.search()
  420. EventBus.$on('copd-record-filter-change', function (event) {
  421. vm.quotaStrArr = event
  422. console.log(vm.quotaStrArr, '999sd8s9a8d9s8ad9sa89')
  423. })
  424. },
  425. destroyed() {
  426. EventBus.$off('copd-record-filter-change')
  427. }
  428. })