index.js 16 KB

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