index.js 12 KB

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