index.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  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. signList: [
  40. { value: '', label: '全部' },
  41. { value: '1', label: '是' },
  42. { value: '2', label: '否' }
  43. ],
  44. // 健康档案是否显示
  45. healthRecordVisable: false,
  46. page: 1,
  47. size: 20,
  48. rangeList: [
  49. { name: '按区', code: 'town' },
  50. { name: '按社区', code: 'hospital' }
  51. ],
  52. rangeCode: 'town',
  53. totalPage: 0,
  54. totalCount: 0,
  55. name: '',
  56. years: '',
  57. turnDownStatus: '',
  58. receiveStatus: '',
  59. archivesStatus: '',
  60. hospital: '',
  61. doctorName: '',
  62. isLive: '',
  63. isSign: '',
  64. patientCode: '',
  65. firstOrg: '',
  66. currentSelect: [],
  67. followupStatus: [],
  68. dicName: ['jkcopd_archivesStatus', 'jkcopd_turnDownStatus', 'jkcopd_isLive', 'jkcopd_followup_status'],
  69. isShow: false,
  70. startTime: '',
  71. endTime: '',
  72. chooseYear: '',
  73. nowyear: '',
  74. areaList: [],
  75. areaCode: null,
  76. communityCode: null,
  77. fileList: [],
  78. file: undefined,
  79. isProgressShow: false,
  80. percentage: 0,
  81. success: false,
  82. loading: false,
  83. isOver: false,
  84. status: '',
  85. errList: [],
  86. pickerOptions: {
  87. disabledDate(time) {
  88. let timeSpace = time.getTime() <= moment.toDate().getTime()
  89. return timeSpace
  90. }
  91. },
  92. communityList: [],
  93. allocationForm: {},
  94. doctorList: [],
  95. allocationDialog: false,
  96. isGuGan: false, // 判断是否是骨干,若是显示分配,若不是显示批量分配
  97. exportStandardLoading: false,
  98. selectLoading: false,
  99. batchAllocation: false,
  100. batchForm: { status: '', isSign: '', isTurn: '' },
  101. batchData: [],
  102. selectedPatient: [],
  103. selectedPatient1: [],
  104. progressVisible: false,
  105. progressContent: '正在批量分配患者,请稍等',
  106. allocationProgress: 0,
  107. addressOptions1: [],
  108. addressOptions2: [],
  109. registAddress: [],
  110. liveAddress: [],
  111. props: {
  112. label: 'name',
  113. value: 'code',
  114. children: 'children'
  115. }
  116. }
  117. },
  118. computed: {
  119. showTotalTable() {
  120. return this.currentEditData == null && this.editViewVisable == false && this.serviceRecordVisable == false && this.healthRecordVisable == false
  121. },
  122. showEditView() {
  123. return this.currentEditData && this.editViewVisable
  124. }
  125. },
  126. mounted() {
  127. var vm = this
  128. var userRole = window.sessionStorage.getItem('selectedRole')
  129. vm.userRoleCode = JSON.parse(userRole).code
  130. this.initTime(vm)
  131. if (this.docInfo.expandLevelName) {
  132. this.isGuGan = this.docInfo.expandLevelName.indexOf('慢病骨干') > -1
  133. }
  134. this.initScope(3)
  135. if (this.isGuGan) {
  136. // 如何是慢病骨干 则只能选社区,并且限定死社区
  137. this.rangeList = [{ name: '按社区', code: 'hospital' }]
  138. this.rangeCode = 'hospital'
  139. this.areaList = [{ name: this.docInfo.hospitalName.substring(0, 3), code: this.docInfo.town }]
  140. this.areaCode = this.docInfo.town
  141. this.communityList = [{ name: this.docInfo.hospitalName, code: this.docInfo.hospital }]
  142. this.communityCode = this.docInfo.hospital
  143. vm.receivingHospitalList = [{ code: this.docInfo.hospital, name: this.docInfo.hospitalName }]
  144. this.hospital = this.docInfo.hospital
  145. } else {
  146. this.hospitalList()
  147. }
  148. EventBus.$on('copd-reset-select', function () {
  149. vm.currentEditData = null
  150. vm.editViewVisable = false
  151. vm.serviceRecordVisable = false
  152. vm.healthRecordVisable = false
  153. })
  154. EventBus.$on('copd-reset-save', function () {
  155. vm.currentEditData = null
  156. vm.editViewVisable = false
  157. vm.serviceRecordVisable = false
  158. vm.healthRecordVisable = false
  159. ;(vm.transferStatusOptions = [{ code: '', value: '全部' }]),
  160. (vm.recordStatusOptions = [{ code: '', value: '全部' }]),
  161. (vm.followStatusArr = [{ code: '', value: '全部' }]),
  162. (vm.receiveStatusOptions = [
  163. { value: '', label: '全部' },
  164. { value: '1', label: ' 已接收' },
  165. { value: '0', label: ' 未接收' }
  166. ]),
  167. (vm.survivalStatusOption = [{ code: '', value: '全部' }]),
  168. vm.getJkCopdPatientPage()
  169. vm.dicName.forEach(function (item) {
  170. vm.getDictByDictName(item)
  171. })
  172. })
  173. this.dicName.forEach(function (item) {
  174. vm.getDictByDictName(item)
  175. })
  176. this.initDistrict()
  177. },
  178. watch: {
  179. rangeCode(nv) {
  180. if (nv == 'hospital') {
  181. this.initScope(5)
  182. }
  183. }
  184. },
  185. destroyed() {
  186. EventBus.$off('copd-reset-select')
  187. EventBus.$off('copd-reset-save')
  188. },
  189. methods: {
  190. // 初始化时间
  191. initTime(vm) {
  192. var now = new Date()
  193. vm.endTime = now.format('yyyy-MM-dd')
  194. var start = now.getFullYear() + '-' + '01-01'
  195. vm.startTime = new Date(start).format('yyyy-MM-dd')
  196. vm.nowyear = vm.chooseYear = now.getFullYear()
  197. vm.chooseYear = '全部'
  198. vm.nowmonth = now.getMonth() + 1
  199. vm.years = ['全部']
  200. for (i = vm.nowyear; i >= 2013; i--) {
  201. vm.years.push(i)
  202. }
  203. },
  204. // 数据范围初始化
  205. initScope(type) {
  206. var vm = this
  207. //获得缓存中缓存的角色权限
  208. var userRole = window.sessionStorage.getItem('selectedRole')
  209. if (!userRole) {
  210. return false
  211. }
  212. vm.userRole = JSON.parse(userRole)
  213. vm.areaTitle = vm.userRole.name
  214. if (vm.isGuGan) {
  215. return
  216. }
  217. if (type == 3) {
  218. this.areaCode = null
  219. this.communityCode = null
  220. if (vm.userRole.code == '350200' || vm.userRole.code == 'jk_350200') {
  221. vm.getDistrict(type, 350200, '厦门市')
  222. } else if (vm.userRole.code.indexOf('jk_') > -1) {
  223. vm.getDistrict(type, vm.userRole.code.substring(3), vm.areaTitle.substring(0, 3))
  224. } else if (vm.userRole.code.length == 6) {
  225. vm.getDistrict(type, vm.userRole.code, vm.areaTitle.substring(0, 3))
  226. }
  227. } else {
  228. this.communityCode = null
  229. if (this.rangeCode == 'hospital') vm.getDistrict(type, vm.areaCode)
  230. }
  231. //level:2、市,3、区,4、社区,5、团队
  232. // vm.initareaLevel = vm.areaLevel = vm.userRole.code == 'jk_350200' ? 2 : vm.userRole.code.length == 9 ? 3 : 4
  233. // vm.initlevel = vm.level = vm.userRole.code == 'jk_350200' ? 4 : vm.userRole.code.length == 9 ? 3 : 2
  234. // // if(vm.userRole.code == 'jk_350200'||vm.userRole.code =='350200'){
  235. // // vm.initareaLevel = vm.areaLevel = 2
  236. // // vm.initlevel = vm.level = 4
  237. // // }else if(vm.userRole.code.length == 9){
  238. // // vm.initareaLevel = vm.areaLevel = 3
  239. // // vm.initlevel = vm.level = 3
  240. // // }else{
  241. // // vm.initareaLevel = vm.areaLevel = 4
  242. // // vm.initlevel = vm.level = 2
  243. // // }
  244. // console.log(vm.initlevel);
  245. // vm.initarea = vm.area = vm.userRole.code
  246. // vm.areaTitle = vm.userRole.name
  247. // if (vm.initlevel == 4) {
  248. // //市获取区
  249. // if(vm.userRole.code == 'jk_350200'){
  250. // vm.getDistrict(3, vm.initarea.substring(3), vm.areaTitle.substr(0, 3))
  251. // }else{
  252. // vm.getDistrict(3, vm.initarea, vm.areaTitle.substr(0, 3))
  253. // }
  254. // vm.rangeCode = vm.rangeList[0].code
  255. // } else if (vm.initlevel == 3) {
  256. // //区获取社区
  257. // vm.areaList = [{ code: vm.initarea, name: vm.areaTitle }]
  258. // vm.areaCode = vm.initarea
  259. // vm.rangeCode = vm.rangeList[0].code
  260. // } else if (vm.initlevel == 2) {
  261. // //社区获取团队
  262. // vm.communityList = [{ code: vm.initarea, name: vm.areaTitle }]
  263. // vm.communityCode = vm.initarea
  264. // vm.rangeList.shift()
  265. // vm.rangeCode = vm.rangeList[0]?.code
  266. // }
  267. // vm.range = vm.rangeCode
  268. },
  269. handlePreview(value) {
  270. var vm = this
  271. var file = value.target.files[0]
  272. this.daLoading = true
  273. if (file && file.size) {
  274. var formFile = new FormData()
  275. formFile.append('file', file)
  276. httpRequest
  277. .post('doctor/jkCopd/importExcel', {
  278. data: formFile,
  279. cache: false, //上传文件无需缓存
  280. processData: false, //用于对data参数进行序列化处理 这里必须false
  281. contentType: false //必须
  282. })
  283. .then(function (res) {
  284. if (res.status == 200) {
  285. vm.getJkCopdPatientPage()
  286. vm.dicName.forEach(function (item) {
  287. vm.getDictByDictName(item)
  288. })
  289. vm.daLoading = false
  290. vm.$message({
  291. message: '导入成功!',
  292. type: 'success'
  293. })
  294. } else {
  295. vm.$message.error('导入失败!')
  296. vm.daLoading = false
  297. }
  298. })
  299. .catch(function (e) {
  300. console.error(e)
  301. vm.daLoading = false
  302. })
  303. // statisticAPI.importExcel({file:formFile}).then(function(res){
  304. // console.log('22222222222',res)
  305. // })
  306. }
  307. },
  308. //获取省市区 type:区3
  309. getDistrict: function (type, code, name) {
  310. var vm = this,
  311. list = [],
  312. param = ''
  313. if (type == 3) {
  314. list = [{ code: code, name: name }]
  315. param = 'area'
  316. } else if (type == 5) {
  317. list = [{ code: '', name: '全部' }]
  318. param = 'community'
  319. }
  320. var params = {
  321. type: type,
  322. code: code
  323. }
  324. homeAPI.getDistrict(params).then(function (res) {
  325. if (res.status == 200) {
  326. vm[param + 'List'] = list.concat(res.list)
  327. // vm[param + 'Code'] = vm[param + 'List'][0].code
  328. // console.log(vm.areaList)
  329. } else {
  330. vm.$message.error(res.msg)
  331. }
  332. })
  333. },
  334. hospitalList() {
  335. var vm = this
  336. statisticAPI.hospitalList({ queryArea: vm.userRoleCode }).then(function (res) {
  337. vm.receivingHospitalList = vm.receivingHospitalList && vm.receivingHospitalList.concat(res.detailModelList)
  338. })
  339. },
  340. exportTable() {
  341. if (this.rangeCode == 'town' && this.areaCode == null) {
  342. this.$message.warning('请选择地区')
  343. return
  344. }
  345. if (this.rangeCode == 'hospital' && this.communityCode == null) {
  346. this.$message.warning('请选择社区')
  347. return
  348. }
  349. var vm = this
  350. vm.daLoading = true
  351. var params = {
  352. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  353. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31',
  354. name: this.name,
  355. turnDownStatus: this.turnDownStatus,
  356. receiveStatus: this.receiveStatus,
  357. archivesStatus: this.archivesStatus,
  358. hospital: this.hospital,
  359. doctorName: this.doctorName,
  360. isLive: this.isLive,
  361. firstOrg: this.firstOrg,
  362. queryArea: this.areaCode,
  363. queryHospital: this.communityCode == null ? '' : this.communityCode
  364. }
  365. statisticAPI.exportJkCopdAchives(params, '居民档案.xls').then(function (res) {
  366. vm.daLoading = false
  367. vm.$message({
  368. message: '导出成功!',
  369. type: 'success'
  370. })
  371. })
  372. },
  373. selectionLineChangeHandle(val) {
  374. var vm = this
  375. var arr = []
  376. val.forEach(function (item) {
  377. arr.push(item.id)
  378. })
  379. vm.currentSelect = arr
  380. var arr1 = []
  381. val.forEach(function (item) {
  382. arr1.push(item.patient)
  383. })
  384. vm.selectedPatient = arr1
  385. },
  386. synPatient() {
  387. var vm = this
  388. if (vm.currentSelect.length) {
  389. statisticAPI
  390. .synPatient({
  391. ids: vm.currentSelect.join(','),
  392. doctor: vm.docInfo.code
  393. })
  394. .then(function (res) {
  395. if (res.status == '200') {
  396. vm.$message({
  397. message: res.message,
  398. type: 'success'
  399. })
  400. vm.getJkCopdPatientPage()
  401. vm.dicName.forEach(function (item) {
  402. vm.getDictByDictName(item)
  403. })
  404. } else {
  405. vm.$message({
  406. message: res.message,
  407. type: 'warning'
  408. })
  409. }
  410. })
  411. } else {
  412. vm.$message('请勾选患者!')
  413. }
  414. },
  415. queryDate() {
  416. if (this.rangeCode == 'town' && this.areaCode == null) {
  417. this.$message.warning('请选择地区')
  418. return
  419. }
  420. if (this.rangeCode == 'hospital' && this.communityCode == null) {
  421. this.$message.warning('请选择社区')
  422. return
  423. }
  424. this.getJkCopdPatientPage()
  425. },
  426. distributionHospital() {
  427. var vm = this
  428. if (vm.currentSelect.length) {
  429. this.batchAllocation = true
  430. this.batchForm = { status: '', isSign: '', isTurn: '' }
  431. this.searchBatchData()
  432. return
  433. vm.daLoading = true
  434. statisticAPI
  435. .distributionHospital({
  436. type: 1,
  437. ids: vm.currentSelect.join(','),
  438. doctor: vm.docInfo.code
  439. })
  440. .then(function (res) {
  441. if (res.status == '200') {
  442. vm.daLoading = false
  443. vm.$message({
  444. message: res.message,
  445. type: 'success'
  446. })
  447. vm.getJkCopdPatientPage()
  448. vm.dicName.forEach(function (item) {
  449. vm.getDictByDictName(item)
  450. })
  451. } else {
  452. vm.daLoading = false
  453. vm.$message({
  454. message: res.message,
  455. type: 'warning'
  456. })
  457. }
  458. })
  459. } else {
  460. vm.daLoading = false
  461. vm.$message('请勾选患者!')
  462. }
  463. },
  464. eliminateClick() {
  465. ;(this.name = ''),
  466. (this.turnDownStatus = ''),
  467. (this.receiveStatus = ''),
  468. (this.archivesStatus = ''),
  469. (this.hospital = ''),
  470. (this.doctorName = ''),
  471. (this.isLive = ''),
  472. (this.firstOrg = ''),
  473. (this.isSign = ''),
  474. (this.registAddress = []),
  475. (this.liveAddress = [])
  476. },
  477. //下转状态
  478. getDictByDictName(value) {
  479. var vm = this
  480. statisticAPI.getDictByDictName({ name: value }).then(function (res) {
  481. if (value == 'jkcopd_turnDownStatus') {
  482. vm.transferStatusOptions = vm.transferStatusOptions.concat(res.list)
  483. } else if (value == 'jkcopd_archivesStatus') {
  484. vm.recordStatusOptions = vm.recordStatusOptions.concat(res.list)
  485. } else if (value == 'jkcopd_isLive') {
  486. vm.survivalStatusOption = vm.survivalStatusOption.concat(res.list)
  487. } else if (value == 'jkcopd_followup_status') {
  488. vm.followStatusArr = vm.followStatusArr.concat(res.list)
  489. }
  490. })
  491. },
  492. onClickEdit(record) {
  493. window.localStorage.setItem('editDetail', JSON.stringify(record))
  494. if (!record) {
  495. return
  496. }
  497. this.currentEditData = record
  498. this.editViewVisable = true
  499. },
  500. onClickServiceRecord(record) {
  501. this.currentEditData = record
  502. this.serviceRecordVisable = true
  503. },
  504. /*打开预览链接*/
  505. openURL(url) {
  506. let aLabel = document.createElement('a')
  507. //设置链接
  508. aLabel.setAttribute('href', url)
  509. //新窗口打开链接
  510. aLabel.setAttribute('target', '_blank')
  511. //设置标签ID
  512. aLabel.setAttribute('id', 'reportpoint')
  513. // 防止反复添加
  514. if (document.getElementById('reportpoint')) {
  515. document.body.removeChild(document.getElementById('reportpoint'))
  516. }
  517. document.body.appendChild(aLabel)
  518. aLabel.click()
  519. //window.open(url);
  520. },
  521. onClickHealthRecord(record) {
  522. this.getCode(record.idcard)
  523. },
  524. getCode(idcard) {
  525. var vm = this
  526. this.patientCode = ''
  527. statisticAPI.getPatientAccetokenByIdcard({ idcard: idcard }).then(function (res) {
  528. if (res.status == 200) {
  529. vm.patientCode = res.data.patientCode
  530. var healthRecordServer = 'http://www.xmtyw.cn/wlyy/profileweb/#/menzhen' //健康档案服务
  531. //var healthRecordServer="https://www.xmtyw.cn/wlyytest/profileweb/#/menzhen" //健康档案服务wlyytest
  532. window.open(healthRecordServer + '?patientCode=' + res.data.patientCode)
  533. } else {
  534. vm.patientCode = ''
  535. this.$message.error('获取授权码失败')
  536. return
  537. }
  538. })
  539. },
  540. handleCurrentChange: function (val) {
  541. this.page = val
  542. this.getJkCopdPatientPage()
  543. },
  544. handleSizeChange(val) {
  545. this.size = val
  546. this.getJkCopdPatientPage()
  547. },
  548. getJkCopdPatientPage: function (val) {
  549. this.daLoading = true
  550. var vm = this
  551. var params = {
  552. page: this.page,
  553. size: this.size,
  554. name: this.name,
  555. turnDownStatus: this.turnDownStatus,
  556. receiveStatus: this.receiveStatus,
  557. archivesStatus: this.archivesStatus,
  558. hospital: this.hospital,
  559. doctorName: this.doctorName,
  560. isLive: this.isLive,
  561. queryArea: this.areaCode,
  562. firstOrg: this.firstOrg,
  563. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  564. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31',
  565. isSign: this.isSign
  566. }
  567. if(this.liveAddress.length >0){
  568. if(this.liveAddress[0]=='other'){
  569. params.liveProvince = 'other'
  570. }else{
  571. params.liveProvince = this.liveAddress[0]
  572. params.liveCity = this.liveAddress[1]
  573. params.liveTown = this.liveAddress[2]
  574. params.liveStreet = this.liveAddress[3]
  575. }
  576. }
  577. if(this.registAddress.length > 0){
  578. if(this.registAddress[0]=='other'){
  579. params.registProvince = 'other'
  580. }else{
  581. params.registProvince = this.registAddress[0]
  582. params.registCity = this.registAddress[1]
  583. params.registTown = this.registAddress[2]
  584. params.registStreet = this.registAddress[3]
  585. }
  586. }
  587. if (this.rangeCode == 'hospital') {
  588. params.queryHospital = this.communityCode
  589. }
  590. statisticAPI.jkCopdAchivesPage(params).then(function (res) {
  591. vm.totalCount = res.totalCount
  592. vm.totalPage = res.totalPage
  593. vm.dataList = res.detailModelList
  594. vm.daLoading = false
  595. })
  596. },
  597. //上传
  598. toggle(isShow) {
  599. this.isShow = isShow
  600. if (!isShow) {
  601. this.reset()
  602. }
  603. },
  604. reset(type) {
  605. this.percentage = 0
  606. this.success = false
  607. this.isOver = false
  608. this.errList = []
  609. if (type != 1) {
  610. this.loading = false
  611. this.file = undefined
  612. this.month = ''
  613. }
  614. },
  615. close(type) {
  616. this.reset(type)
  617. this.isProgressShow = false
  618. if (type != 1) {
  619. this.isShow = false
  620. }
  621. },
  622. beforeUploadPic(file) {
  623. this.file = file
  624. },
  625. check() {
  626. var vm = this
  627. vm.loading = true
  628. if (!vm.file) {
  629. vm.loading = false
  630. vm.$message('请选择文件')
  631. return
  632. }
  633. vm.save()
  634. },
  635. save() {
  636. var vm = this
  637. vm.daLoading = true
  638. var formData = new FormData()
  639. formData.append('file', vm.file)
  640. // vm.initProgress()
  641. httpRequest
  642. .post('doctor/jkCopd/importExcel', {
  643. data: formData,
  644. cache: false, //上传文件无需缓存
  645. processData: false, //用于对data参数进行序列化处理 这里必须false
  646. contentType: false //必须
  647. })
  648. .then(function (res) {
  649. if (res.status == 200) {
  650. vm.getJkCopdPatientPage()
  651. vm.dicName.forEach(function (item) {
  652. vm.getDictByDictName(item)
  653. })
  654. vm.daLoading = false
  655. vm.isShow = false
  656. vm.$message({
  657. message: '导入成功!',
  658. type: 'success'
  659. })
  660. } else {
  661. vm.$message.error('导入失败!')
  662. vm.daLoading = false
  663. }
  664. })
  665. .catch(function (e) {
  666. console.error(e)
  667. vm.daLoading = false
  668. })
  669. },
  670. initProgress() {
  671. var vm = this
  672. this.isProgressShow = true
  673. setTimeout(() => {
  674. if (!vm.isOver && vm.percentage != 90) {
  675. vm.percentage += 10
  676. vm.initProgress()
  677. }
  678. }, 1000)
  679. },
  680. openAllocationDialog() {
  681. if (this.currentSelect.length == 0) {
  682. this.$message.warning('请选择患者')
  683. return
  684. }
  685. var vm = this
  686. this.allocationDialog = true
  687. this.selectLoading = true
  688. statisticAPI.findDoctorList({ hospital: this.docInfo.hospital }).then(function (res) {
  689. vm.doctorList = res.detailModelList
  690. vm.selectLoading = false
  691. })
  692. },
  693. closeAllocationDialog() {
  694. this.allocationDialog = false
  695. },
  696. back() {
  697. var vm = this
  698. vm.currentEditData = null
  699. vm.editViewVisable = false
  700. vm.serviceRecordVisable = false
  701. vm.healthRecordVisable = false
  702. },
  703. allocationFn() {
  704. var vm = this
  705. this.$refs.allocationForm.validate(function (valid) {
  706. if (valid) {
  707. statisticAPI.distributionPatient({ ids: vm.currentSelect.join(','), doctor: vm.allocationForm.doctor }).then(function (res) {
  708. if (res.status == 200) {
  709. vm.allocationDialog = false
  710. vm.$message.success('分配成功')
  711. vm.getJkCopdPatientPage()
  712. } else {
  713. vm.$message.error(res.msg)
  714. }
  715. })
  716. }
  717. })
  718. },
  719. standardExport() {
  720. if (this.rangeCode == 'town' && this.areaCode == null) {
  721. this.$message.warning('请选择地区')
  722. return
  723. }
  724. if (this.rangeCode == 'hospital' && this.communityCode == null) {
  725. this.$message.warning('请选择社区')
  726. return
  727. }
  728. var vm = this
  729. vm.exportStandardLoading = true
  730. var params = {
  731. name: this.name,
  732. turnDownStatus: this.turnDownStatus,
  733. receiveStatus: this.receiveStatus,
  734. archivesStatus: this.archivesStatus,
  735. hospital: this.hospital,
  736. doctorName: this.doctorName,
  737. isLive: this.isLive,
  738. queryArea: this.areaCode,
  739. firstOrg: this.firstOrg,
  740. queryHospital: this.communityCode == null ? '' : this.communityCode,
  741. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  742. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31'
  743. }
  744. var time = new Date().getTime()
  745. statisticAPI.exportCountryStandard(params, `国家标准${time}.xls`).then(function (res) {
  746. vm.exportStandardLoading = false
  747. vm.$message({
  748. message: '导出成功!',
  749. type: 'success'
  750. })
  751. })
  752. },
  753. searchBatchData() {
  754. var vm = this
  755. statisticAPI.distributionPage({ patients: vm.selectedPatient.join(','), ...this.batchForm }).then(function (res) {
  756. vm.batchData = res.detailModelList
  757. vm.$nextTick(function () {
  758. vm.batchData.forEach(function (item) {
  759. if (item.statusName == '未分配' && item.toHospitalName && item.lastDoctor != item.toDoctorName) {
  760. vm.$refs.batchAllocationTable.toggleRowSelection(item, true)
  761. }
  762. })
  763. })
  764. })
  765. },
  766. confirmBatchData() {
  767. var vm = this
  768. statisticAPI.distributionBatch({ patients: this.selectedPatient1.join(','), doctor: vm.docInfo.code }).then(function (res) {
  769. if (res.status == 200) {
  770. vm.progressVisible = true
  771. vm.allocationProgress = 0
  772. vm.getProgress(res.obj)
  773. }
  774. })
  775. },
  776. selectBatchData(val) {
  777. this.selectedPatient1 = val.map(function (item) {
  778. return item.patient
  779. })
  780. },
  781. getProgress(code) {
  782. var vm = this
  783. statisticAPI.findDistributionBatch({ code: code }).then(function (res) {
  784. var data = res.obj
  785. if (data.successNum + data.failNum < data.total) {
  786. vm.allocationProgress = (data.successNum / data.total) * 100
  787. setTimeout(function () {
  788. vm.getProgress(code)
  789. }, 200)
  790. } else {
  791. vm.allocationProgress = 100
  792. vm.progressContent = `本次共分配${data.total}人,成功${data.successNum}人,<span style="color:#FF0000;">失败${data.failNum}人</span>`
  793. }
  794. })
  795. },
  796. selectable(row, index) {
  797. if (!row.toHospitalName) {
  798. return false
  799. } else {
  800. return true
  801. }
  802. },
  803. handleItemChange(val, type){
  804. // 获取地址
  805. if (val.length == 1) {
  806. // 获取市
  807. this.baseCityList(val[0], type)
  808. }
  809. if (val.length == 2) {
  810. // 获取区
  811. this.baseTownList(val, type)
  812. }
  813. if (val.length == 3) {
  814. // 获取区
  815. this.stressList(val, type)
  816. }
  817. },
  818. baseCityList: function (code, id) {
  819. var vm = this
  820. var activeIndex = null
  821. var num = id
  822. var arr = vm['addressOptions' + num]
  823. arr.forEach(function (item, index) {
  824. if (item.code == code) {
  825. activeIndex = index
  826. }
  827. })
  828. homeAPI.getDistrict({ type: 2, code: code }).then(function (res) {
  829. if (res.status == 200) {
  830. var detailModelList = res.list
  831. detailModelList.forEach(item => {
  832. item.children = []
  833. })
  834. arr[activeIndex].children = detailModelList
  835. }
  836. })
  837. },
  838. baseTownList(val, id) {
  839. var vm = this
  840. var provinceIndex = null
  841. var activeIndex = null
  842. var num = id
  843. var arr = vm['addressOptions' + num]
  844. arr.forEach(function (item, index) {
  845. if (item.code == val[0]) {
  846. var children = item.children
  847. provinceIndex = index
  848. children.forEach(function (item, idx) {
  849. if (item.code == val[1]) {
  850. activeIndex = idx
  851. }
  852. })
  853. }
  854. })
  855. homeAPI.getDistrict({ type: 3, code: val[1] }).then(function (res) {
  856. if (res.status == 200) {
  857. var detailModelList = res.list
  858. for(let item of detailModelList){
  859. if(id == 3){
  860. item.children = null
  861. }else{
  862. item.children = []
  863. }
  864. }
  865. if (arr[provinceIndex].children[activeIndex]) {
  866. arr[provinceIndex].children[activeIndex].children = detailModelList
  867. }
  868. }
  869. })
  870. },
  871. stressList(val, id) {
  872. var vm = this
  873. var provinceIndex = null
  874. var activeIndex = null
  875. var xIndex = null
  876. var num = id
  877. var arr = vm['addressOptions' + num]
  878. arr.forEach(function (item, index) {
  879. if (item.code == val[0]) {
  880. var children = item.children
  881. provinceIndex = index
  882. children.forEach(function (item, idx) {
  883. if (item.code == val[1]) {
  884. activeIndex = idx
  885. var xItem = item.children
  886. xItem.forEach(function (item, xianIndex) {
  887. if (item.code == val[2]) {
  888. xIndex = xianIndex
  889. }
  890. })
  891. }
  892. })
  893. }
  894. })
  895. homeAPI.getDistrict({ type: 4, code: val[2] }).then(function (res) {
  896. if (res.status == 200) {
  897. var detailModelList = res.list
  898. if (arr[provinceIndex].children[activeIndex].children[xIndex]) {
  899. if(detailModelList.length >0){
  900. arr[provinceIndex].children[activeIndex].children[xIndex].children = detailModelList
  901. }else{
  902. arr[provinceIndex].children[activeIndex].children[xIndex].children = null
  903. }
  904. }
  905. }
  906. })
  907. },
  908. initDistrict() {
  909. var vm = this
  910. homeAPI.getDistrict({ type: 1, code: '' }).then(function (res) {
  911. var detailModelList = res.list.concat({code:'other',name:'不详'})
  912. detailModelList.forEach(function (item) {
  913. if(item.code == 'other'){
  914. item.children = null
  915. }else{
  916. item.children = []
  917. }
  918. })
  919. vm.addressOptions1 = JSON.parse(JSON.stringify(detailModelList))
  920. vm.addressOptions2 = JSON.parse(JSON.stringify(detailModelList))
  921. })
  922. },
  923. }
  924. })