index.js 19 KB

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