index.js 14 KB

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