index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  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. if (!userRole) {
  154. return false;
  155. }
  156. vm.userRole = JSON.parse(userRole);
  157. //level:2、市,3、区,4、社区,5、团队
  158. vm.initareaLevel = vm.areaLevel = vm.userRole.code == '350200' ? 2 : vm.userRole.code.length == 6 ? 3 : 4;
  159. vm.initlevel = vm.level = vm.userRole.code == '350200' ? 4 : vm.userRole.code.length == 6 ? 3 : 2;
  160. // vm.lowLevel = vm.initlowLevel = vm.userRole.code == '350200' ? 3 : vm.userRole.code.length == 6 ? 2 : 1;
  161. vm.initarea = vm.area = vm.userRole.code;
  162. vm.areaTitle = vm.userRole.name;
  163. if (vm.initlevel == 4) {
  164. //市获取区
  165. vm.getDistrict(3, vm.initarea, vm.areaTitle.substr(0, 3));
  166. vm.rangeCode = vm.rangeList[0].code;
  167. } else if (vm.initlevel == 3) {
  168. //区获取社区
  169. vm.areaList = [{code: vm.initarea, name: vm.areaTitle}];
  170. vm.areaCode = vm.initarea;
  171. vm.rangeCode = vm.rangeList[0].code;
  172. } else if (vm.initlevel == 2) {
  173. //社区获取团队
  174. vm.communityList = [{code: vm.initarea, name: vm.areaTitle}];
  175. vm.communityCode = vm.initarea;
  176. vm.rangeList.shift();
  177. vm.rangeCode = vm.rangeList[0].code;
  178. }
  179. vm.range = vm.rangeCode;
  180. },
  181. handlePreview(value) {
  182. var vm = this
  183. var file = value.target.files[0]
  184. this.daLoading=true
  185. console.log(file,'vvvvvvvvvvvv',value,value.target.files[0])
  186. if(file && file.size) {
  187. var formFile = new FormData()
  188. formFile.append("file", file)
  189. httpRequest.post('doctor/jkCopd/importExcel',{
  190. data: formFile,
  191. cache: false,//上传文件无需缓存
  192. processData: false,//用于对data参数进行序列化处理 这里必须false
  193. contentType: false, //必须
  194. }).then(function(res) {
  195. if(res.status == 200) {
  196. vm.getJkCopdPatientPage()
  197. vm.dicName.forEach(function(item) {
  198. vm.getDictByDictName(item)
  199. });
  200. vm.daLoading=false
  201. vm.$message({
  202. message: '导入成功!',
  203. type: 'success'
  204. });
  205. } else {
  206. vm.$message.error('导入失败!')
  207. vm.daLoading=false
  208. }
  209. }).catch(function(e) {
  210. console.error(e)
  211. vm.daLoading=false
  212. })
  213. // statisticAPI.importExcel({file:formFile}).then(function(res){
  214. // console.log('22222222222',res)
  215. // })
  216. }
  217. },
  218. //获取省市区 type:区3
  219. getDistrict: function (type, code, name) {
  220. var vm = this,
  221. list = [],
  222. param = '';
  223. if (type == 3) {
  224. list = [{code: code, name: name}];
  225. param = 'area';
  226. } else if (type == 5) {
  227. list = [{code: '', name: '全部'}];
  228. param = 'community';
  229. }
  230. var params = {
  231. type: type,
  232. code: code
  233. };
  234. homeAPI.getDistrict(params).then(function (res) {
  235. if (res.status == 200) {
  236. vm[param + 'List'] = list.concat(res.list);
  237. vm[param + 'Code'] = vm[param + 'List'][0].code;
  238. } else {
  239. vm.$message.error(res.msg);
  240. }
  241. });
  242. },
  243. hospitalList(){
  244. var vm=this
  245. statisticAPI.hospitalList({queryArea:vm.userRoleCode}).then(function(res){
  246. vm.receivingHospitalList=vm.receivingHospitalList&& vm.receivingHospitalList.concat(res.detailModelList)
  247. })
  248. },
  249. exportTable(){
  250. var vm=this
  251. vm.daLoading=true
  252. var params = {
  253. startTime: this.chooseYear=='全部'?'': this.chooseYear+'-01-01',
  254. endTime:this.chooseYear=='全部'?'': this.chooseYear+'-12-31',
  255. name:this.name,
  256. turnDownStatus:this.turnDownStatus,
  257. receiveStatus:this.receiveStatus,
  258. archivesStatus:this.archivesStatus,
  259. hospital:this.hospital,
  260. doctorName:this.doctorName,
  261. isLive: this.isLive,
  262. firstOrg: this.firstOrg,
  263. queryArea:this.userRoleCode
  264. }
  265. statisticAPI.exportJkCopdAchives(params,'居民档案.xls').then(
  266. function(res){
  267. vm.daLoading=false
  268. vm.$message({
  269. message: '导出成功!',
  270. type: 'success'
  271. });
  272. }
  273. )
  274. },
  275. selectionLineChangeHandle(val){
  276. var vm=this
  277. var arr=[]
  278. val.forEach(function(item){
  279. arr.push(item.id)
  280. })
  281. vm.currentSelect=arr
  282. },
  283. synPatient(){
  284. var vm=this
  285. if(vm.currentSelect.length){
  286. statisticAPI.synPatient({
  287. ids:vm.currentSelect.join(','),
  288. doctor: vm.docInfo.code
  289. }).then(function(res){
  290. if(res.status=='200'){
  291. vm.$message({
  292. message: res.message,
  293. type: 'success'
  294. });
  295. vm.getJkCopdPatientPage()
  296. vm.dicName.forEach(function(item) {
  297. vm.getDictByDictName(item)
  298. });
  299. }else{
  300. vm.$message({
  301. message: res.message,
  302. type: 'warning'
  303. });
  304. }
  305. })
  306. }else{
  307. vm.$message('请勾选患者!')
  308. }
  309. },
  310. queryDate(){
  311. this.getJkCopdPatientPage()
  312. },
  313. distributionHospital(){
  314. var vm=this
  315. if(vm.currentSelect.length){
  316. vm.daLoading=true
  317. statisticAPI.distributionHospital({
  318. type:1,
  319. ids:vm.currentSelect.join(','),
  320. doctor: vm.docInfo.code
  321. }).then(function(res){
  322. if(res.status=='200'){
  323. vm.daLoading=false
  324. vm.$message({
  325. message: res.message,
  326. type: 'success'
  327. });
  328. vm.getJkCopdPatientPage()
  329. vm.dicName.forEach(function(item) {
  330. vm.getDictByDictName(item)
  331. });
  332. }else{
  333. vm.daLoading=false
  334. vm.$message({
  335. message: res.message,
  336. type: 'warning'
  337. });
  338. }
  339. })
  340. }else{
  341. vm.daLoading=false
  342. vm.$message('请勾选患者!')
  343. }
  344. },
  345. eliminateClick(){
  346. this.name='',
  347. this.turnDownStatus='',
  348. this.receiveStatus='',
  349. this.archivesStatus='',
  350. this.hospital='',
  351. this.doctorName='',
  352. this.isLive= '',
  353. this.firstOrg= ''
  354. },
  355. //下转状态
  356. getDictByDictName(value){
  357. var vm=this
  358. statisticAPI.getDictByDictName({name:value}).then(function(res){
  359. if(value=='jkcopd_turnDownStatus'){
  360. vm.transferStatusOptions= vm.transferStatusOptions.concat(res.list)
  361. }else if(value=='jkcopd_archivesStatus'){
  362. vm.recordStatusOptions=vm.recordStatusOptions.concat(res.list)
  363. }else if(value=='jkcopd_isLive'){
  364. vm.survivalStatusOption= vm.survivalStatusOption.concat(res.list)
  365. }else if(value=='jkcopd_followup_status'){
  366. vm.followStatusArr= vm.followStatusArr.concat(res.list)
  367. }
  368. })
  369. },
  370. onClickEdit(record) {
  371. window.localStorage.setItem('editDetail',JSON.stringify(record))
  372. if (!record) {
  373. return
  374. }
  375. this.currentEditData = record
  376. this.editViewVisable = true
  377. },
  378. onClickServiceRecord(record) {
  379. this.currentEditData = record
  380. this.serviceRecordVisable = true
  381. },
  382. /*打开预览链接*/
  383. openURL (url) {
  384. let aLabel = document.createElement('a');
  385. //设置链接
  386. aLabel.setAttribute('href', url);
  387. //新窗口打开链接
  388. aLabel.setAttribute('target', '_blank');
  389. //设置标签ID
  390. aLabel.setAttribute('id', 'reportpoint');
  391. // 防止反复添加
  392. if (document.getElementById('reportpoint')) {
  393. document.body.removeChild(document.getElementById('reportpoint'));
  394. }
  395. document.body.appendChild(aLabel);
  396. aLabel.click();
  397. console.log("打开链接:",url);
  398. //window.open(url);
  399. },
  400. onClickHealthRecord(record) {
  401. this.getCode(record.idcard)
  402. },
  403. getCode(idcard){
  404. var vm=this
  405. this.patientCode = ''
  406. statisticAPI.getPatientAccetokenByIdcard({idcard:idcard}).then(function(res){
  407. if (res.status == 200) {
  408. vm.patientCode=res.data.patientCode
  409. var healthRecordServer="http://www.xmtyw.cn/wlyy/profileweb/#/menzhen" //健康档案服务
  410. //var healthRecordServer="https://www.xmtyw.cn/wlyytest/profileweb/#/menzhen" //健康档案服务wlyytest
  411. window.open(healthRecordServer + '?patientCode=' + res.data.patientCode)
  412. }else{
  413. vm.patientCode=''
  414. this.$message.error('获取授权码失败')
  415. return
  416. }
  417. })
  418. },
  419. handleCurrentChange:function(val) {
  420. this.page = val
  421. this.getJkCopdPatientPage()
  422. },
  423. getJkCopdPatientPage: function (val) {
  424. this.daLoading=true
  425. var vm =this
  426. var params = {
  427. page: this.page,
  428. size: this.size,
  429. name:this.name,
  430. turnDownStatus:this.turnDownStatus,
  431. receiveStatus:this.receiveStatus,
  432. archivesStatus:this.archivesStatus,
  433. hospital:this.hospital,
  434. doctorName:this.doctorName,
  435. isLive: this.isLive,
  436. queryArea:this.userRoleCode,
  437. firstOrg: this.firstOrg,
  438. startTime: this.chooseYear=='全部'?"": this.chooseYear+'-01-01',
  439. endTime:this.chooseYear=='全部'?"": this.chooseYear+'-12-31',
  440. }
  441. statisticAPI.jkCopdAchivesPage(params).then(function (res) {
  442. vm.totalCount = res.totalCount
  443. vm.totalPage = res.totalPage
  444. vm.currentPage=res.currPage
  445. vm.dataList = res.detailModelList
  446. console.log(vm.currentPage,res,'88888888888')
  447. vm.daLoading=false
  448. })
  449. },
  450. //上传
  451. toggle(isShow){
  452. this.isShow = isShow
  453. if(!isShow){
  454. this.reset()
  455. }
  456. },
  457. reset(type){
  458. this.percentage = 0
  459. this.success = false
  460. this.isOver = false
  461. this.errList = []
  462. if(type!=1){
  463. this.loading = false
  464. this.file = undefined
  465. this.month = ""
  466. }
  467. },
  468. close(type){
  469. this.reset(type)
  470. this.isProgressShow = false
  471. if(type!=1){
  472. this.isShow = false
  473. }
  474. },
  475. beforeUploadPic(file){
  476. console.log(file,'000000000000000000000')
  477. this.file = file
  478. },
  479. check(){
  480. var vm = this
  481. vm.loading = true
  482. if(!vm.file){
  483. vm.loading = false
  484. vm.$message('请选择文件');
  485. return
  486. }
  487. vm.save()
  488. },
  489. save(){
  490. var vm = this
  491. vm.daLoading=true
  492. var formData = new FormData()
  493. formData.append("file", vm.file)
  494. // vm.initProgress()
  495. console.log(formData, 'formData');
  496. httpRequest.post('doctor/jkCopd/importExcel',{
  497. data: formData,
  498. cache: false,//上传文件无需缓存
  499. processData: false,//用于对data参数进行序列化处理 这里必须false
  500. contentType: false, //必须
  501. }).then(function(res) {
  502. if(res.status == 200) {
  503. vm.getJkCopdPatientPage()
  504. vm.dicName.forEach(function(item) {
  505. vm.getDictByDictName(item)
  506. });
  507. vm.daLoading=false
  508. vm.isShow = false
  509. vm.$message({
  510. message: '导入成功!',
  511. type: 'success'
  512. });
  513. } else {
  514. vm.$message.error('导入失败!')
  515. vm.daLoading=false
  516. }
  517. }).catch(function(e) {
  518. console.error(e)
  519. vm.daLoading=false
  520. })
  521. },
  522. initProgress(){
  523. var vm = this
  524. this.isProgressShow = true
  525. setTimeout(()=>{
  526. if(!vm.isOver && vm.percentage!=90){
  527. vm.percentage += 10
  528. vm.initProgress()
  529. }
  530. }, 1000)
  531. }
  532. }
  533. })