index.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  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. } else if (vm.userRole.code.length == 10) {
  227. this.rangeList = [{ name: '按社区', code: 'hospital' }]
  228. this.rangeCode = 'hospital'
  229. this.areaList = [{ name: this.userRole.name.substring(0, 3), code: this.userRole.code.substring(0, 6) }]
  230. this.areaCode = this.userRole.code.substring(0, 6)
  231. this.communityList = [{ name: this.userRole.name, code: this.userRole.code }]
  232. this.communityCode = this.userRole.code
  233. }
  234. } else {
  235. this.communityCode = null
  236. if (this.rangeCode == 'hospital') vm.getDistrict(type, vm.areaCode)
  237. }
  238. //level:2、市,3、区,4、社区,5、团队
  239. // vm.initareaLevel = vm.areaLevel = vm.userRole.code == 'jk_350200' ? 2 : vm.userRole.code.length == 9 ? 3 : 4
  240. // vm.initlevel = vm.level = vm.userRole.code == 'jk_350200' ? 4 : vm.userRole.code.length == 9 ? 3 : 2
  241. // // if(vm.userRole.code == 'jk_350200'||vm.userRole.code =='350200'){
  242. // // vm.initareaLevel = vm.areaLevel = 2
  243. // // vm.initlevel = vm.level = 4
  244. // // }else if(vm.userRole.code.length == 9){
  245. // // vm.initareaLevel = vm.areaLevel = 3
  246. // // vm.initlevel = vm.level = 3
  247. // // }else{
  248. // // vm.initareaLevel = vm.areaLevel = 4
  249. // // vm.initlevel = vm.level = 2
  250. // // }
  251. // console.log(vm.initlevel);
  252. // vm.initarea = vm.area = vm.userRole.code
  253. // vm.areaTitle = vm.userRole.name
  254. // if (vm.initlevel == 4) {
  255. // //市获取区
  256. // if(vm.userRole.code == 'jk_350200'){
  257. // vm.getDistrict(3, vm.initarea.substring(3), vm.areaTitle.substr(0, 3))
  258. // }else{
  259. // vm.getDistrict(3, vm.initarea, vm.areaTitle.substr(0, 3))
  260. // }
  261. // vm.rangeCode = vm.rangeList[0].code
  262. // } else if (vm.initlevel == 3) {
  263. // //区获取社区
  264. // vm.areaList = [{ code: vm.initarea, name: vm.areaTitle }]
  265. // vm.areaCode = vm.initarea
  266. // vm.rangeCode = vm.rangeList[0].code
  267. // } else if (vm.initlevel == 2) {
  268. // //社区获取团队
  269. // vm.communityList = [{ code: vm.initarea, name: vm.areaTitle }]
  270. // vm.communityCode = vm.initarea
  271. // vm.rangeList.shift()
  272. // vm.rangeCode = vm.rangeList[0]?.code
  273. // }
  274. // vm.range = vm.rangeCode
  275. },
  276. handlePreview(value) {
  277. var vm = this
  278. var file = value.target.files[0]
  279. this.daLoading = true
  280. if (file && file.size) {
  281. var formFile = new FormData()
  282. formFile.append('file', file)
  283. httpRequest
  284. .post('doctor/jkCopd/importExcel', {
  285. data: formFile,
  286. cache: false, //上传文件无需缓存
  287. processData: false, //用于对data参数进行序列化处理 这里必须false
  288. contentType: false //必须
  289. })
  290. .then(function (res) {
  291. if (res.status == 200) {
  292. vm.getJkCopdPatientPage()
  293. vm.dicName.forEach(function (item) {
  294. vm.getDictByDictName(item)
  295. })
  296. vm.daLoading = false
  297. vm.$message({
  298. message: '导入成功!',
  299. type: 'success'
  300. })
  301. } else {
  302. vm.$message.error('导入失败!')
  303. vm.daLoading = false
  304. }
  305. })
  306. .catch(function (e) {
  307. console.error(e)
  308. vm.daLoading = false
  309. })
  310. // statisticAPI.importExcel({file:formFile}).then(function(res){
  311. // console.log('22222222222',res)
  312. // })
  313. }
  314. },
  315. //获取省市区 type:区3
  316. getDistrict: function (type, code, name) {
  317. var vm = this,
  318. list = [],
  319. param = ''
  320. if (type == 3) {
  321. list = [{ code: code, name: name }]
  322. param = 'area'
  323. } else if (type == 5) {
  324. list = [{ code: '', name: '全部' }]
  325. param = 'community'
  326. }
  327. var params = {
  328. type: type,
  329. code: code
  330. }
  331. homeAPI.getDistrict(params).then(function (res) {
  332. if (res.status == 200) {
  333. vm[param + 'List'] = list.concat(res.list)
  334. // vm[param + 'Code'] = vm[param + 'List'][0].code
  335. // console.log(vm.areaList)
  336. } else {
  337. vm.$message.error(res.msg)
  338. }
  339. })
  340. },
  341. hospitalList() {
  342. var vm = this
  343. statisticAPI.hospitalList({ queryArea: vm.userRoleCode }).then(function (res) {
  344. vm.receivingHospitalList = vm.receivingHospitalList && vm.receivingHospitalList.concat(res.detailModelList)
  345. })
  346. },
  347. exportTable() {
  348. if (this.rangeCode == 'town' && this.areaCode == null) {
  349. this.$message.warning('请选择地区')
  350. return
  351. }
  352. if (this.rangeCode == 'hospital' && this.communityCode == null) {
  353. this.$message.warning('请选择社区')
  354. return
  355. }
  356. var vm = this
  357. vm.daLoading = true
  358. var params = {
  359. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  360. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31',
  361. name: this.name,
  362. turnDownStatus: this.turnDownStatus,
  363. receiveStatus: this.receiveStatus,
  364. archivesStatus: this.archivesStatus,
  365. hospital: this.hospital,
  366. doctorName: this.doctorName,
  367. isLive: this.isLive,
  368. firstOrg: this.firstOrg,
  369. queryArea: this.areaCode,
  370. queryHospital: this.communityCode == null ? '' : this.communityCode
  371. }
  372. statisticAPI.exportJkCopdAchives(params, '居民档案.xls').then(function (res) {
  373. vm.daLoading = false
  374. vm.$message({
  375. message: '导出成功!',
  376. type: 'success'
  377. })
  378. })
  379. },
  380. selectionLineChangeHandle(val) {
  381. var vm = this
  382. var arr = []
  383. val.forEach(function (item) {
  384. arr.push(item.id)
  385. })
  386. vm.currentSelect = arr
  387. var arr1 = []
  388. val.forEach(function (item) {
  389. arr1.push(item.patient)
  390. })
  391. vm.selectedPatient = arr1
  392. },
  393. synPatient() {
  394. var vm = this
  395. if (vm.currentSelect.length) {
  396. statisticAPI
  397. .synPatient({
  398. ids: vm.currentSelect.join(','),
  399. doctor: vm.docInfo.code
  400. })
  401. .then(function (res) {
  402. if (res.status == '200') {
  403. vm.$message({
  404. message: res.message,
  405. type: 'success'
  406. })
  407. vm.getJkCopdPatientPage()
  408. vm.dicName.forEach(function (item) {
  409. vm.getDictByDictName(item)
  410. })
  411. } else {
  412. vm.$message({
  413. message: res.message,
  414. type: 'warning'
  415. })
  416. }
  417. })
  418. } else {
  419. vm.$message('请勾选患者!')
  420. }
  421. },
  422. queryDate() {
  423. if (this.rangeCode == 'town' && this.areaCode == null) {
  424. this.$message.warning('请选择地区')
  425. return
  426. }
  427. if (this.rangeCode == 'hospital' && this.communityCode == null) {
  428. this.$message.warning('请选择社区')
  429. return
  430. }
  431. this.getJkCopdPatientPage()
  432. },
  433. distributionHospital() {
  434. var vm = this
  435. if (vm.currentSelect.length) {
  436. this.batchAllocation = true
  437. this.batchForm = { status: '', isSign: '', isTurn: '' }
  438. this.searchBatchData()
  439. return
  440. vm.daLoading = true
  441. statisticAPI
  442. .distributionHospital({
  443. type: 1,
  444. ids: vm.currentSelect.join(','),
  445. doctor: vm.docInfo.code
  446. })
  447. .then(function (res) {
  448. if (res.status == '200') {
  449. vm.daLoading = false
  450. vm.$message({
  451. message: res.message,
  452. type: 'success'
  453. })
  454. vm.getJkCopdPatientPage()
  455. vm.dicName.forEach(function (item) {
  456. vm.getDictByDictName(item)
  457. })
  458. } else {
  459. vm.daLoading = false
  460. vm.$message({
  461. message: res.message,
  462. type: 'warning'
  463. })
  464. }
  465. })
  466. } else {
  467. vm.daLoading = false
  468. vm.$message('请勾选患者!')
  469. }
  470. },
  471. eliminateClick() {
  472. ;(this.name = ''),
  473. (this.turnDownStatus = ''),
  474. (this.receiveStatus = ''),
  475. (this.archivesStatus = ''),
  476. (this.hospital = ''),
  477. (this.doctorName = ''),
  478. (this.isLive = ''),
  479. (this.firstOrg = ''),
  480. (this.isSign = ''),
  481. (this.registAddress = []),
  482. (this.liveAddress = [])
  483. },
  484. //下转状态
  485. getDictByDictName(value) {
  486. var vm = this
  487. statisticAPI.getDictByDictName({ name: value }).then(function (res) {
  488. if (value == 'jkcopd_turnDownStatus') {
  489. vm.transferStatusOptions = vm.transferStatusOptions.concat(res.list)
  490. } else if (value == 'jkcopd_archivesStatus') {
  491. vm.recordStatusOptions = vm.recordStatusOptions.concat(res.list)
  492. } else if (value == 'jkcopd_isLive') {
  493. vm.survivalStatusOption = vm.survivalStatusOption.concat(res.list)
  494. } else if (value == 'jkcopd_followup_status') {
  495. vm.followStatusArr = vm.followStatusArr.concat(res.list)
  496. }
  497. })
  498. },
  499. onClickEdit(record) {
  500. window.localStorage.setItem('editDetail', JSON.stringify(record))
  501. if (!record) {
  502. return
  503. }
  504. this.currentEditData = record
  505. this.editViewVisable = true
  506. },
  507. onClickServiceRecord(record) {
  508. this.currentEditData = record
  509. this.serviceRecordVisable = true
  510. },
  511. /*打开预览链接*/
  512. openURL(url) {
  513. let aLabel = document.createElement('a')
  514. //设置链接
  515. aLabel.setAttribute('href', url)
  516. //新窗口打开链接
  517. aLabel.setAttribute('target', '_blank')
  518. //设置标签ID
  519. aLabel.setAttribute('id', 'reportpoint')
  520. // 防止反复添加
  521. if (document.getElementById('reportpoint')) {
  522. document.body.removeChild(document.getElementById('reportpoint'))
  523. }
  524. document.body.appendChild(aLabel)
  525. aLabel.click()
  526. //window.open(url);
  527. },
  528. onClickHealthRecord(record) {
  529. this.getCode(record.idcard)
  530. },
  531. getCode(idcard) {
  532. var vm = this
  533. this.patientCode = ''
  534. statisticAPI.getPatientAccetokenByIdcard({ idcard: idcard }).then(function (res) {
  535. if (res.status == 200) {
  536. vm.patientCode = res.data.patientCode
  537. var healthRecordServer = 'http://www.xmtyw.cn/wlyy/profileweb/#/menzhen' //健康档案服务
  538. //var healthRecordServer="https://www.xmtyw.cn/wlyytest/profileweb/#/menzhen" //健康档案服务wlyytest
  539. window.open(healthRecordServer + '?patientCode=' + res.data.patientCode)
  540. } else {
  541. vm.patientCode = ''
  542. this.$message.error('获取授权码失败')
  543. return
  544. }
  545. })
  546. },
  547. handleCurrentChange: function (val) {
  548. this.page = val
  549. this.getJkCopdPatientPage()
  550. },
  551. handleSizeChange(val) {
  552. this.size = val
  553. this.getJkCopdPatientPage()
  554. },
  555. getJkCopdPatientPage: function (val) {
  556. this.daLoading = true
  557. var vm = this
  558. var params = {
  559. page: this.page,
  560. size: this.size,
  561. name: this.name,
  562. turnDownStatus: this.turnDownStatus,
  563. receiveStatus: this.receiveStatus,
  564. archivesStatus: this.archivesStatus,
  565. hospital: this.hospital,
  566. doctorName: this.doctorName,
  567. isLive: this.isLive,
  568. queryArea: this.areaCode,
  569. firstOrg: this.firstOrg,
  570. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  571. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31',
  572. isSign: this.isSign
  573. }
  574. if (this.liveAddress.length > 0) {
  575. if (this.liveAddress[0] == 'other') {
  576. params.liveProvince = 'other'
  577. } else {
  578. params.liveProvince = this.liveAddress[0]
  579. params.liveCity = this.liveAddress[1]
  580. params.liveTown = this.liveAddress[2]
  581. params.liveStreet = this.liveAddress[3]
  582. }
  583. }
  584. if (this.registAddress.length > 0) {
  585. if (this.registAddress[0] == 'other') {
  586. params.registProvince = 'other'
  587. } else {
  588. params.registProvince = this.registAddress[0]
  589. params.registCity = this.registAddress[1]
  590. params.registTown = this.registAddress[2]
  591. params.registStreet = this.registAddress[3]
  592. }
  593. }
  594. if (this.rangeCode == 'hospital') {
  595. params.queryHospital = this.communityCode
  596. }
  597. statisticAPI.jkCopdAchivesPage(params).then(function (res) {
  598. vm.totalCount = res.totalCount
  599. vm.totalPage = res.totalPage
  600. vm.dataList = res.detailModelList
  601. vm.daLoading = false
  602. })
  603. },
  604. //上传
  605. toggle(isShow) {
  606. this.isShow = isShow
  607. if (!isShow) {
  608. this.reset()
  609. }
  610. },
  611. reset(type) {
  612. this.percentage = 0
  613. this.success = false
  614. this.isOver = false
  615. this.errList = []
  616. if (type != 1) {
  617. this.loading = false
  618. this.file = undefined
  619. this.month = ''
  620. }
  621. },
  622. close(type) {
  623. this.reset(type)
  624. this.isProgressShow = false
  625. if (type != 1) {
  626. this.isShow = false
  627. }
  628. },
  629. beforeUploadPic(file) {
  630. this.file = file
  631. },
  632. check() {
  633. var vm = this
  634. vm.loading = true
  635. if (!vm.file) {
  636. vm.loading = false
  637. vm.$message('请选择文件')
  638. return
  639. }
  640. vm.save()
  641. },
  642. save() {
  643. var vm = this
  644. vm.daLoading = true
  645. var formData = new FormData()
  646. formData.append('file', vm.file)
  647. // vm.initProgress()
  648. httpRequest
  649. .post('doctor/jkCopd/importExcel', {
  650. data: formData,
  651. cache: false, //上传文件无需缓存
  652. processData: false, //用于对data参数进行序列化处理 这里必须false
  653. contentType: false //必须
  654. })
  655. .then(function (res) {
  656. if (res.status == 200) {
  657. vm.getJkCopdPatientPage()
  658. vm.dicName.forEach(function (item) {
  659. vm.getDictByDictName(item)
  660. })
  661. vm.daLoading = false
  662. vm.isShow = false
  663. vm.$message({
  664. message: '导入成功!',
  665. type: 'success'
  666. })
  667. } else {
  668. vm.$message.error('导入失败!')
  669. vm.daLoading = false
  670. }
  671. })
  672. .catch(function (e) {
  673. console.error(e)
  674. vm.daLoading = false
  675. })
  676. },
  677. initProgress() {
  678. var vm = this
  679. this.isProgressShow = true
  680. setTimeout(() => {
  681. if (!vm.isOver && vm.percentage != 90) {
  682. vm.percentage += 10
  683. vm.initProgress()
  684. }
  685. }, 1000)
  686. },
  687. openAllocationDialog() {
  688. if (this.currentSelect.length == 0) {
  689. this.$message.warning('请选择患者')
  690. return
  691. }
  692. var vm = this
  693. this.allocationDialog = true
  694. this.selectLoading = true
  695. statisticAPI.findDoctorList({ hospital: this.docInfo.hospital }).then(function (res) {
  696. vm.doctorList = res.detailModelList
  697. vm.selectLoading = false
  698. })
  699. },
  700. closeAllocationDialog() {
  701. this.allocationDialog = false
  702. },
  703. back() {
  704. var vm = this
  705. vm.currentEditData = null
  706. vm.editViewVisable = false
  707. vm.serviceRecordVisable = false
  708. vm.healthRecordVisable = false
  709. },
  710. allocationFn() {
  711. var vm = this
  712. this.$refs.allocationForm.validate(function (valid) {
  713. if (valid) {
  714. statisticAPI.distributionPatient({ ids: vm.currentSelect.join(','), doctor: vm.allocationForm.doctor }).then(function (res) {
  715. if (res.status == 200) {
  716. vm.allocationDialog = false
  717. vm.$message.success('分配成功')
  718. vm.getJkCopdPatientPage()
  719. } else {
  720. vm.$message.error(res.msg)
  721. }
  722. })
  723. }
  724. })
  725. },
  726. standardExport() {
  727. if (this.rangeCode == 'town' && this.areaCode == null) {
  728. this.$message.warning('请选择地区')
  729. return
  730. }
  731. if (this.rangeCode == 'hospital' && this.communityCode == null) {
  732. this.$message.warning('请选择社区')
  733. return
  734. }
  735. var vm = this
  736. vm.exportStandardLoading = true
  737. var params = {
  738. name: this.name,
  739. turnDownStatus: this.turnDownStatus,
  740. receiveStatus: this.receiveStatus,
  741. archivesStatus: this.archivesStatus,
  742. hospital: this.hospital,
  743. doctorName: this.doctorName,
  744. isLive: this.isLive,
  745. queryArea: this.areaCode,
  746. firstOrg: this.firstOrg,
  747. queryHospital: this.communityCode == null ? '' : this.communityCode,
  748. startTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-01-01',
  749. endTime: this.chooseYear == '全部' ? '' : this.chooseYear + '-12-31'
  750. }
  751. var time = new Date().getTime()
  752. statisticAPI.exportCountryStandard(params, `国家标准${time}.xls`).then(function (res) {
  753. vm.exportStandardLoading = false
  754. vm.$message({
  755. message: '导出成功!',
  756. type: 'success'
  757. })
  758. })
  759. },
  760. searchBatchData() {
  761. var vm = this
  762. statisticAPI.distributionPage({ patients: vm.selectedPatient.join(','), ...this.batchForm }).then(function (res) {
  763. vm.batchData = res.detailModelList
  764. vm.$nextTick(function () {
  765. vm.batchData.forEach(function (item) {
  766. if (item.statusName == '未分配' && item.toHospitalName && item.lastDoctor != item.toDoctorName) {
  767. vm.$refs.batchAllocationTable.toggleRowSelection(item, true)
  768. }
  769. })
  770. })
  771. })
  772. },
  773. confirmBatchData() {
  774. var vm = this
  775. statisticAPI.distributionBatch({ patients: this.selectedPatient1.join(','), doctor: vm.docInfo.code }).then(function (res) {
  776. if (res.status == 200) {
  777. vm.progressVisible = true
  778. vm.allocationProgress = 0
  779. vm.getProgress(res.obj)
  780. }
  781. })
  782. },
  783. selectBatchData(val) {
  784. this.selectedPatient1 = val.map(function (item) {
  785. return item.patient
  786. })
  787. },
  788. getProgress(code) {
  789. var vm = this
  790. statisticAPI.findDistributionBatch({ code: code }).then(function (res) {
  791. var data = res.obj
  792. if (data.successNum + data.failNum < data.total) {
  793. vm.allocationProgress = (data.successNum / data.total) * 100
  794. setTimeout(function () {
  795. vm.getProgress(code)
  796. }, 200)
  797. } else {
  798. vm.allocationProgress = 100
  799. vm.progressContent = `本次共分配${data.total}人,成功${data.successNum}人,<span style="color:#FF0000;">失败${data.failNum}人</span>`
  800. }
  801. })
  802. },
  803. selectable(row, index) {
  804. if (!row.toHospitalName) {
  805. return false
  806. } else {
  807. return true
  808. }
  809. },
  810. handleItemChange(val, type) {
  811. // 获取地址
  812. if (val.length == 1) {
  813. // 获取市
  814. this.baseCityList(val[0], type)
  815. }
  816. if (val.length == 2) {
  817. // 获取区
  818. this.baseTownList(val, type)
  819. }
  820. if (val.length == 3) {
  821. // 获取区
  822. this.stressList(val, type)
  823. }
  824. },
  825. baseCityList: function (code, id) {
  826. var vm = this
  827. var activeIndex = null
  828. var num = id
  829. var arr = vm['addressOptions' + num]
  830. arr.forEach(function (item, index) {
  831. if (item.code == code) {
  832. activeIndex = index
  833. }
  834. })
  835. homeAPI.getDistrict({ type: 2, code: code }).then(function (res) {
  836. if (res.status == 200) {
  837. var detailModelList = res.list
  838. detailModelList.forEach(item => {
  839. item.children = []
  840. })
  841. arr[activeIndex].children = detailModelList
  842. }
  843. })
  844. },
  845. baseTownList(val, id) {
  846. var vm = this
  847. var provinceIndex = null
  848. var activeIndex = null
  849. var num = id
  850. var arr = vm['addressOptions' + num]
  851. arr.forEach(function (item, index) {
  852. if (item.code == val[0]) {
  853. var children = item.children
  854. provinceIndex = index
  855. children.forEach(function (item, idx) {
  856. if (item.code == val[1]) {
  857. activeIndex = idx
  858. }
  859. })
  860. }
  861. })
  862. homeAPI.getDistrict({ type: 3, code: val[1] }).then(function (res) {
  863. if (res.status == 200) {
  864. var detailModelList = res.list
  865. for (let item of detailModelList) {
  866. if (id == 3) {
  867. item.children = null
  868. } else {
  869. item.children = []
  870. }
  871. }
  872. if (arr[provinceIndex].children[activeIndex]) {
  873. arr[provinceIndex].children[activeIndex].children = detailModelList
  874. }
  875. }
  876. })
  877. },
  878. stressList(val, id) {
  879. var vm = this
  880. var provinceIndex = null
  881. var activeIndex = null
  882. var xIndex = null
  883. var num = id
  884. var arr = vm['addressOptions' + num]
  885. arr.forEach(function (item, index) {
  886. if (item.code == val[0]) {
  887. var children = item.children
  888. provinceIndex = index
  889. children.forEach(function (item, idx) {
  890. if (item.code == val[1]) {
  891. activeIndex = idx
  892. var xItem = item.children
  893. xItem.forEach(function (item, xianIndex) {
  894. if (item.code == val[2]) {
  895. xIndex = xianIndex
  896. }
  897. })
  898. }
  899. })
  900. }
  901. })
  902. homeAPI.getDistrict({ type: 4, code: val[2] }).then(function (res) {
  903. if (res.status == 200) {
  904. var detailModelList = res.list
  905. if (arr[provinceIndex].children[activeIndex].children[xIndex]) {
  906. if (detailModelList.length > 0) {
  907. arr[provinceIndex].children[activeIndex].children[xIndex].children = detailModelList
  908. } else {
  909. arr[provinceIndex].children[activeIndex].children[xIndex].children = null
  910. }
  911. }
  912. }
  913. })
  914. },
  915. initDistrict() {
  916. var vm = this
  917. homeAPI.getDistrict({ type: 1, code: '' }).then(function (res) {
  918. var detailModelList = res.list.concat({ code: 'other', name: '不详' })
  919. detailModelList.forEach(function (item) {
  920. if (item.code == 'other') {
  921. item.children = null
  922. } else {
  923. item.children = []
  924. }
  925. })
  926. vm.addressOptions1 = JSON.parse(JSON.stringify(detailModelList))
  927. vm.addressOptions2 = JSON.parse(JSON.stringify(detailModelList))
  928. })
  929. },
  930. selChange: function (type) {
  931. var vm = this,
  932. name = ''
  933. if (type == 3) {
  934. vm.initSelOption('community')
  935. vm.initSelOption('team')
  936. vm.getCommunityHospital()
  937. } else if (type == 5) {
  938. vm.initSelOption('team')
  939. // vm.teamListByArea();
  940. }
  941. },
  942. initSelOption: function (param) {
  943. var vm = this
  944. vm[param + 'List'] = [{ code: '', name: '全部' }]
  945. if (param == 'team') {
  946. vm[param + 'List'] = [{ id: '', name: '全部' }]
  947. }
  948. vm[param + 'Code'] = vm[param + 'List'][0].code || vm[param + 'List'][0].id
  949. },
  950. getCommunityHospital: function () {
  951. var vm = this,
  952. list = [{ code: '', name: '全部' }],
  953. param = 'community'
  954. homeAPI.getCommunityHospital({ area: vm.areaCode == '350200' ? '' : vm.areaCode }).then(function (res) {
  955. if (res.status == 200) {
  956. vm[param + 'List'] = list.concat(res.data)
  957. vm[param + 'Code'] = vm[param + 'List'][0].code
  958. } else {
  959. vm.$message.error(res.msg)
  960. }
  961. })
  962. }
  963. }
  964. })