index.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. // 慢阻肺患者档案表格组件
  2. var template = ''
  3. $.ajax('../../../component/statistics/CopdPatientRecord/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-patient-record', {
  15. template: template,
  16. props: [],
  17. data() {
  18. return {
  19. docInfo: JSON.parse(window.localStorage.getItem('docInfo')),
  20. daLoading: false,
  21. dataList: [],
  22. // 当前编辑的数据,点击编辑按钮后设置,取消或退出则清空
  23. currentEditData: null,
  24. // 编辑页面是否显示
  25. editViewVisable: false,
  26. userRoleCode: '',
  27. //服务记录是否显示
  28. serviceRecordVisable: false,
  29. transferStatusOptions: [{ code: '', value: '全部' }],
  30. recordStatusOptions: [{ code: '', value: '全部' }],
  31. followStatusArr: [{ code: '', value: '全部' }],
  32. receivingHospitalList: [{ code: '', name: '全部' }],
  33. receiveStatusOptions: [
  34. { value: '', label: '全部' },
  35. { value: '1', label: ' 已接收' },
  36. { value: '0', label: ' 未接收' }
  37. ],
  38. survivalStatusOption: [{ code: '', value: '全部' }],
  39. // 健康档案是否显示
  40. healthRecordVisable: false,
  41. page: 1,
  42. size: 20,
  43. rangeList: [
  44. { name: '按区', code: 'town' },
  45. { name: '按社区', code: 'hospital' }
  46. ],
  47. rangeCode: 'town',
  48. totalPage: 0,
  49. totalCount: 0,
  50. name: '',
  51. years: '',
  52. turnDownStatus: '',
  53. receiveStatus: '',
  54. archivesStatus: '',
  55. hospital: '',
  56. doctorName: '',
  57. isLive: '',
  58. patientCode: '',
  59. firstOrg: '',
  60. currentSelect: [],
  61. followupStatus: [],
  62. dicName: ['jkcopd_archivesStatus', 'jkcopd_turnDownStatus', 'jkcopd_isLive', 'jkcopd_followup_status'],
  63. isShow: false,
  64. startTime: '',
  65. endTime: '',
  66. chooseYear: '',
  67. nowyear: '',
  68. areaList: [],
  69. areaCode: '',
  70. communityCode: '',
  71. fileList: [],
  72. file: undefined,
  73. isProgressShow: false,
  74. percentage: 0,
  75. success: false,
  76. loading: false,
  77. isOver: false,
  78. status: '',
  79. errList: [],
  80. pickerOptions: {
  81. disabledDate(time) {
  82. let timeSpace = time.getTime() <= moment.toDate().getTime()
  83. return timeSpace
  84. }
  85. },
  86. communityList: [],
  87. allocationForm: {},
  88. doctorList: [],
  89. allocationDialog: false,
  90. isGuGan: false, // 判断是否是骨干,若是显示分配,若不是显示批量分配
  91. exportStandardLoading: false
  92. }
  93. },
  94. computed: {
  95. showTotalTable() {
  96. return this.currentEditData == null && this.editViewVisable == false && this.serviceRecordVisable == false && this.healthRecordVisable == false
  97. },
  98. showEditView() {
  99. return this.currentEditData && this.editViewVisable
  100. }
  101. },
  102. mounted() {
  103. var vm = this
  104. var userRole = window.sessionStorage.getItem('selectedRole')
  105. vm.userRoleCode = JSON.parse(userRole).code
  106. this.initTime(vm)
  107. this.initScope(3)
  108. this.hospitalList()
  109. this.isGuGan = this.docInfo.expandLevelName.indexOf('慢病骨干') > -1
  110. EventBus.$on('copd-reset-select', function () {
  111. vm.currentEditData = null
  112. vm.editViewVisable = false
  113. vm.serviceRecordVisable = false
  114. vm.healthRecordVisable = false
  115. })
  116. EventBus.$on('copd-reset-save', function () {
  117. vm.currentEditData = null
  118. vm.editViewVisable = false
  119. vm.serviceRecordVisable = false
  120. vm.healthRecordVisable = false
  121. ;(vm.transferStatusOptions = [{ code: '', value: '全部' }]),
  122. (vm.recordStatusOptions = [{ code: '', value: '全部' }]),
  123. (vm.followStatusArr = [{ code: '', value: '全部' }]),
  124. (vm.receiveStatusOptions = [
  125. { value: '', label: '全部' },
  126. { value: '1', label: ' 已接收' },
  127. { value: '0', label: ' 未接收' }
  128. ]),
  129. (vm.survivalStatusOption = [{ code: '', value: '全部' }]),
  130. vm.getJkCopdPatientPage()
  131. vm.dicName.forEach(function (item) {
  132. vm.getDictByDictName(item)
  133. })
  134. })
  135. this.getJkCopdPatientPage()
  136. this.dicName.forEach(function (item) {
  137. vm.getDictByDictName(item)
  138. })
  139. },
  140. destroyed() {
  141. EventBus.$off('copd-reset-select')
  142. EventBus.$off('copd-reset-save')
  143. },
  144. methods: {
  145. // 初始化时间
  146. initTime(vm) {
  147. var now = new Date()
  148. vm.endTime = now.format('yyyy-MM-dd')
  149. var start = now.getFullYear() + '-' + '01-01'
  150. vm.startTime = new Date(start).format('yyyy-MM-dd')
  151. vm.nowyear = vm.chooseYear = now.getFullYear()
  152. vm.chooseYear = '全部'
  153. vm.nowmonth = now.getMonth() + 1
  154. vm.years = ['全部']
  155. for (i = vm.nowyear; i >= 2013; i--) {
  156. vm.years.push(i)
  157. }
  158. },
  159. // 数据范围初始化
  160. initScope(type) {
  161. var vm = this
  162. //获得缓存中缓存的角色权限
  163. var userRole = window.sessionStorage.getItem('selectedRole')
  164. if (!userRole) {
  165. return false
  166. }
  167. vm.userRole = JSON.parse(userRole)
  168. vm.areaTitle = vm.userRole.name
  169. // const type = vm.rangeCode == 'town' ? 3 : 5
  170. if (type == 3) {
  171. if (vm.userRole.code == '350200' || vm.userRole.code == 'jk_350200') {
  172. vm.getDistrict(type, 350200, '厦门市')
  173. } else if (vm.userRole.code.indexOf('jk_') > -1) {
  174. vm.getDistrict(type, vm.userRole.code.substring(3), vm.areaTitle.substring(0, 3))
  175. } else if (vm.userRole.code.length == 6) {
  176. vm.getDistrict(type, vm.userRole.code, vm.areaTitle.substring(0, 3))
  177. }
  178. }else{
  179. vm.getDistrict(type, vm.areaCode)
  180. }
  181. //level:2、市,3、区,4、社区,5、团队
  182. // vm.initareaLevel = vm.areaLevel = vm.userRole.code == 'jk_350200' ? 2 : vm.userRole.code.length == 9 ? 3 : 4
  183. // vm.initlevel = vm.level = vm.userRole.code == 'jk_350200' ? 4 : vm.userRole.code.length == 9 ? 3 : 2
  184. // // if(vm.userRole.code == 'jk_350200'||vm.userRole.code =='350200'){
  185. // // vm.initareaLevel = vm.areaLevel = 2
  186. // // vm.initlevel = vm.level = 4
  187. // // }else if(vm.userRole.code.length == 9){
  188. // // vm.initareaLevel = vm.areaLevel = 3
  189. // // vm.initlevel = vm.level = 3
  190. // // }else{
  191. // // vm.initareaLevel = vm.areaLevel = 4
  192. // // vm.initlevel = vm.level = 2
  193. // // }
  194. // console.log(vm.initlevel);
  195. // vm.initarea = vm.area = vm.userRole.code
  196. // vm.areaTitle = vm.userRole.name
  197. // if (vm.initlevel == 4) {
  198. // //市获取区
  199. // if(vm.userRole.code == 'jk_350200'){
  200. // vm.getDistrict(3, vm.initarea.substring(3), vm.areaTitle.substr(0, 3))
  201. // }else{
  202. // vm.getDistrict(3, vm.initarea, vm.areaTitle.substr(0, 3))
  203. // }
  204. // vm.rangeCode = vm.rangeList[0].code
  205. // } else if (vm.initlevel == 3) {
  206. // //区获取社区
  207. // vm.areaList = [{ code: vm.initarea, name: vm.areaTitle }]
  208. // vm.areaCode = vm.initarea
  209. // vm.rangeCode = vm.rangeList[0].code
  210. // } else if (vm.initlevel == 2) {
  211. // //社区获取团队
  212. // vm.communityList = [{ code: vm.initarea, name: vm.areaTitle }]
  213. // vm.communityCode = vm.initarea
  214. // vm.rangeList.shift()
  215. // vm.rangeCode = vm.rangeList[0]?.code
  216. // }
  217. // vm.range = vm.rangeCode
  218. },
  219. handlePreview(value) {
  220. var vm = this
  221. var file = value.target.files[0]
  222. this.daLoading = true
  223. if (file && file.size) {
  224. var formFile = new FormData()
  225. formFile.append('file', file)
  226. httpRequest
  227. .post('doctor/jkCopd/importExcel', {
  228. data: formFile,
  229. cache: false, //上传文件无需缓存
  230. processData: false, //用于对data参数进行序列化处理 这里必须false
  231. contentType: false //必须
  232. })
  233. .then(function (res) {
  234. if (res.status == 200) {
  235. vm.getJkCopdPatientPage()
  236. vm.dicName.forEach(function (item) {
  237. vm.getDictByDictName(item)
  238. })
  239. vm.daLoading = false
  240. vm.$message({
  241. message: '导入成功!',
  242. type: 'success'
  243. })
  244. } else {
  245. vm.$message.error('导入失败!')
  246. vm.daLoading = false
  247. }
  248. })
  249. .catch(function (e) {
  250. console.error(e)
  251. vm.daLoading = false
  252. })
  253. // statisticAPI.importExcel({file:formFile}).then(function(res){
  254. // console.log('22222222222',res)
  255. // })
  256. }
  257. },
  258. //获取省市区 type:区3
  259. getDistrict: function (type, code, name) {
  260. var vm = this,
  261. list = [],
  262. param = ''
  263. if (type == 3) {
  264. list = [{ code: code, name: name }]
  265. param = 'area'
  266. } else if (type == 5) {
  267. list = [{ code: '', name: '全部' }]
  268. param = 'community'
  269. }
  270. var params = {
  271. type: type,
  272. code: code
  273. }
  274. homeAPI.getDistrict(params).then(function (res) {
  275. if (res.status == 200) {
  276. vm[param + 'List'] = list.concat(res.list)
  277. // vm[param + 'Code'] = vm[param + 'List'][0].code
  278. // console.log(vm.areaList)
  279. } else {
  280. vm.$message.error(res.msg)
  281. }
  282. })
  283. },
  284. hospitalList() {
  285. var vm = this
  286. statisticAPI.hospitalList({ queryArea: vm.userRoleCode }).then(function (res) {
  287. vm.receivingHospitalList = vm.receivingHospitalList && vm.receivingHospitalList.concat(res.detailModelList)
  288. })
  289. },
  290. exportTable() {
  291. var vm = this
  292. vm.daLoading = true
  293. var params = {
  294. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  295. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31',
  296. name: this.name,
  297. turnDownStatus: this.turnDownStatus,
  298. receiveStatus: this.receiveStatus,
  299. archivesStatus: this.archivesStatus,
  300. hospital: this.hospital,
  301. doctorName: this.doctorName,
  302. isLive: this.isLive,
  303. firstOrg: this.firstOrg,
  304. queryArea: this.userRoleCode
  305. }
  306. statisticAPI.exportJkCopdAchives(params, '居民档案.xls').then(function (res) {
  307. vm.daLoading = false
  308. vm.$message({
  309. message: '导出成功!',
  310. type: 'success'
  311. })
  312. })
  313. },
  314. selectionLineChangeHandle(val) {
  315. var vm = this
  316. var arr = []
  317. val.forEach(function (item) {
  318. arr.push(item.id)
  319. })
  320. vm.currentSelect = arr
  321. },
  322. synPatient() {
  323. var vm = this
  324. if (vm.currentSelect.length) {
  325. statisticAPI
  326. .synPatient({
  327. ids: vm.currentSelect.join(','),
  328. doctor: vm.docInfo.code
  329. })
  330. .then(function (res) {
  331. if (res.status == '200') {
  332. vm.$message({
  333. message: res.message,
  334. type: 'success'
  335. })
  336. vm.getJkCopdPatientPage()
  337. vm.dicName.forEach(function (item) {
  338. vm.getDictByDictName(item)
  339. })
  340. } else {
  341. vm.$message({
  342. message: res.message,
  343. type: 'warning'
  344. })
  345. }
  346. })
  347. } else {
  348. vm.$message('请勾选患者!')
  349. }
  350. },
  351. queryDate() {
  352. this.getJkCopdPatientPage()
  353. },
  354. distributionHospital() {
  355. var vm = this
  356. if (vm.currentSelect.length) {
  357. vm.daLoading = true
  358. statisticAPI
  359. .distributionHospital({
  360. type: 1,
  361. ids: vm.currentSelect.join(','),
  362. doctor: vm.docInfo.code
  363. })
  364. .then(function (res) {
  365. if (res.status == '200') {
  366. vm.daLoading = false
  367. vm.$message({
  368. message: res.message,
  369. type: 'success'
  370. })
  371. vm.getJkCopdPatientPage()
  372. vm.dicName.forEach(function (item) {
  373. vm.getDictByDictName(item)
  374. })
  375. } else {
  376. vm.daLoading = false
  377. vm.$message({
  378. message: res.message,
  379. type: 'warning'
  380. })
  381. }
  382. })
  383. } else {
  384. vm.daLoading = false
  385. vm.$message('请勾选患者!')
  386. }
  387. },
  388. eliminateClick() {
  389. ;(this.name = ''),
  390. (this.turnDownStatus = ''),
  391. (this.receiveStatus = ''),
  392. (this.archivesStatus = ''),
  393. (this.hospital = ''),
  394. (this.doctorName = ''),
  395. (this.isLive = ''),
  396. (this.firstOrg = '')
  397. },
  398. //下转状态
  399. getDictByDictName(value) {
  400. var vm = this
  401. statisticAPI.getDictByDictName({ name: value }).then(function (res) {
  402. if (value == 'jkcopd_turnDownStatus') {
  403. vm.transferStatusOptions = vm.transferStatusOptions.concat(res.list)
  404. } else if (value == 'jkcopd_archivesStatus') {
  405. vm.recordStatusOptions = vm.recordStatusOptions.concat(res.list)
  406. } else if (value == 'jkcopd_isLive') {
  407. vm.survivalStatusOption = vm.survivalStatusOption.concat(res.list)
  408. } else if (value == 'jkcopd_followup_status') {
  409. vm.followStatusArr = vm.followStatusArr.concat(res.list)
  410. }
  411. })
  412. },
  413. onClickEdit(record) {
  414. window.localStorage.setItem('editDetail', JSON.stringify(record))
  415. if (!record) {
  416. return
  417. }
  418. this.currentEditData = record
  419. this.editViewVisable = true
  420. },
  421. onClickServiceRecord(record) {
  422. this.currentEditData = record
  423. this.serviceRecordVisable = true
  424. },
  425. /*打开预览链接*/
  426. openURL(url) {
  427. let aLabel = document.createElement('a')
  428. //设置链接
  429. aLabel.setAttribute('href', url)
  430. //新窗口打开链接
  431. aLabel.setAttribute('target', '_blank')
  432. //设置标签ID
  433. aLabel.setAttribute('id', 'reportpoint')
  434. // 防止反复添加
  435. if (document.getElementById('reportpoint')) {
  436. document.body.removeChild(document.getElementById('reportpoint'))
  437. }
  438. document.body.appendChild(aLabel)
  439. aLabel.click()
  440. //window.open(url);
  441. },
  442. onClickHealthRecord(record) {
  443. this.getCode(record.idcard)
  444. },
  445. getCode(idcard) {
  446. var vm = this
  447. this.patientCode = ''
  448. statisticAPI.getPatientAccetokenByIdcard({ idcard: idcard }).then(function (res) {
  449. if (res.status == 200) {
  450. vm.patientCode = res.data.patientCode
  451. var healthRecordServer = 'http://www.xmtyw.cn/wlyy/profileweb/#/menzhen' //健康档案服务
  452. //var healthRecordServer="https://www.xmtyw.cn/wlyytest/profileweb/#/menzhen" //健康档案服务wlyytest
  453. window.open(healthRecordServer + '?patientCode=' + res.data.patientCode)
  454. } else {
  455. vm.patientCode = ''
  456. this.$message.error('获取授权码失败')
  457. return
  458. }
  459. })
  460. },
  461. handleCurrentChange: function (val) {
  462. this.page = val
  463. this.getJkCopdPatientPage()
  464. },
  465. handleSizeChange(val) {
  466. this.size = val
  467. this.getJkCopdPatientPage()
  468. },
  469. getJkCopdPatientPage: function (val) {
  470. this.daLoading = true
  471. var vm = this
  472. var params = {
  473. page: this.page,
  474. size: this.size,
  475. name: this.name,
  476. turnDownStatus: this.turnDownStatus,
  477. receiveStatus: this.receiveStatus,
  478. archivesStatus: this.archivesStatus,
  479. hospital: this.hospital,
  480. doctorName: this.doctorName,
  481. isLive: this.isLive,
  482. queryArea: this.userRoleCode,
  483. firstOrg: this.firstOrg,
  484. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  485. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31'
  486. }
  487. statisticAPI.jkCopdAchivesPage(params).then(function (res) {
  488. vm.totalCount = res.totalCount
  489. vm.totalPage = res.totalPage
  490. vm.dataList = res.detailModelList
  491. vm.daLoading = false
  492. })
  493. },
  494. //上传
  495. toggle(isShow) {
  496. this.isShow = isShow
  497. if (!isShow) {
  498. this.reset()
  499. }
  500. },
  501. reset(type) {
  502. this.percentage = 0
  503. this.success = false
  504. this.isOver = false
  505. this.errList = []
  506. if (type != 1) {
  507. this.loading = false
  508. this.file = undefined
  509. this.month = ''
  510. }
  511. },
  512. close(type) {
  513. this.reset(type)
  514. this.isProgressShow = false
  515. if (type != 1) {
  516. this.isShow = false
  517. }
  518. },
  519. beforeUploadPic(file) {
  520. this.file = file
  521. },
  522. check() {
  523. var vm = this
  524. vm.loading = true
  525. if (!vm.file) {
  526. vm.loading = false
  527. vm.$message('请选择文件')
  528. return
  529. }
  530. vm.save()
  531. },
  532. save() {
  533. var vm = this
  534. vm.daLoading = true
  535. var formData = new FormData()
  536. formData.append('file', vm.file)
  537. // vm.initProgress()
  538. httpRequest
  539. .post('doctor/jkCopd/importExcel', {
  540. data: formData,
  541. cache: false, //上传文件无需缓存
  542. processData: false, //用于对data参数进行序列化处理 这里必须false
  543. contentType: false //必须
  544. })
  545. .then(function (res) {
  546. if (res.status == 200) {
  547. vm.getJkCopdPatientPage()
  548. vm.dicName.forEach(function (item) {
  549. vm.getDictByDictName(item)
  550. })
  551. vm.daLoading = false
  552. vm.isShow = false
  553. vm.$message({
  554. message: '导入成功!',
  555. type: 'success'
  556. })
  557. } else {
  558. vm.$message.error('导入失败!')
  559. vm.daLoading = false
  560. }
  561. })
  562. .catch(function (e) {
  563. console.error(e)
  564. vm.daLoading = false
  565. })
  566. },
  567. initProgress() {
  568. var vm = this
  569. this.isProgressShow = true
  570. setTimeout(() => {
  571. if (!vm.isOver && vm.percentage != 90) {
  572. vm.percentage += 10
  573. vm.initProgress()
  574. }
  575. }, 1000)
  576. },
  577. openAllocationDialog() {
  578. if (this.currentSelect.length == 0) {
  579. this.$message.warning('请选择患者')
  580. return
  581. }
  582. var vm = this
  583. this.allocationDialog = true
  584. statisticAPI.findDoctorList({ hospital: this.docInfo.hospital }).then(function (res) {
  585. vm.doctorList = res.detailModelList
  586. })
  587. },
  588. closeAllocationDialog() {
  589. this.allocationDialog = false
  590. },
  591. back() {
  592. var vm = this
  593. vm.currentEditData = null
  594. vm.editViewVisable = false
  595. vm.serviceRecordVisable = false
  596. vm.healthRecordVisable = false
  597. },
  598. allocationFn() {
  599. var vm = this
  600. this.$refs.allocationForm.validate(function (valid) {
  601. if (valid) {
  602. statisticAPI.distributionPatient({ ids: vm.currentSelect.join(','), doctor: vm.allocationForm.doctor }).then(function (res) {
  603. if (res.status == 200) {
  604. vm.allocationDialog = false
  605. vm.$message.success('分配成功')
  606. vm.getJkCopdPatientPage()
  607. } else {
  608. vm.$message.error(res.msg)
  609. }
  610. })
  611. }
  612. })
  613. },
  614. standardExport() {
  615. var vm = this
  616. vm.exportStandardLoading = true
  617. var params = {
  618. page: this.page,
  619. size: this.size,
  620. name: this.name,
  621. turnDownStatus: this.turnDownStatus,
  622. receiveStatus: this.receiveStatus,
  623. archivesStatus: this.archivesStatus,
  624. hospital: this.hospital,
  625. doctorName: this.doctorName,
  626. isLive: this.isLive,
  627. queryArea: this.userRoleCode,
  628. firstOrg: this.firstOrg,
  629. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  630. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31'
  631. }
  632. var time = new Date().getTime()
  633. statisticAPI.exportCountryStandard(params, `国家标准${time}.xls`).then(function (res) {
  634. vm.exportStandardLoading = false
  635. vm.$message({
  636. message: '导出成功!',
  637. type: 'success'
  638. })
  639. })
  640. }
  641. }
  642. })