index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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. firstOrg: '',
  52. currentSelect:[],
  53. followupStatus:[],
  54. dicName:['jkcopd_archivesStatus','jkcopd_turnDownStatus','jkcopd_isLive','jkcopd_followup_status'],
  55. isShow: false,
  56. startTime:'',
  57. endTime:'',
  58. chooseYear: '',
  59. nowyear:'',
  60. fileList: [],
  61. file: undefined,
  62. isProgressShow: false,
  63. percentage: 0,
  64. success: false,
  65. loading: false,
  66. isOver: false,
  67. status: "",
  68. errList: [],
  69. pickerOptions: {
  70. disabledDate(time) {
  71. let timeSpace = time.getTime() <= moment.toDate().getTime();
  72. return timeSpace;
  73. }
  74. },
  75. }
  76. },
  77. computed: {
  78. showTotalTable() {
  79. return (
  80. this.currentEditData == null &&
  81. this.editViewVisable == false &&
  82. this.serviceRecordVisable == false &&
  83. this.healthRecordVisable == false
  84. )
  85. },
  86. showEditView() {
  87. return this.currentEditData && this.editViewVisable
  88. }
  89. },
  90. mounted() {
  91. var vm = this
  92. this.initTime(vm)
  93. this.hospitalList()
  94. EventBus.$on('copd-reset-select', function () {
  95. vm.currentEditData = null
  96. vm.editViewVisable = false
  97. vm.serviceRecordVisable = false
  98. vm.healthRecordVisable = false
  99. })
  100. EventBus.$on('copd-reset-save', function () {
  101. vm.currentEditData = null
  102. vm.editViewVisable = false
  103. vm.serviceRecordVisable = false
  104. vm.healthRecordVisable = false
  105. vm.transferStatusOptions=[{code:'',value:'全部'}],
  106. vm.recordStatusOptions=[{code:'',value:'全部'}],
  107. vm.followStatusArr=[{code:'',value:'全部'}],
  108. vm.receivingHospitalList=[{code:'',name:'全部'}],
  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. onClickHealthRecord(record) {
  316. console.log('ssssssssssssssss',record)
  317. var healthRecordServer="http://www.xmtyw.cn/wlyy/profileweb/#/" //健康档案服务
  318. var healthRecordServer="https://www.xmtyw.cn/wlyytest/profileweb/#/" //健康档案服务wlyytest
  319. window.open(healthRecordServer + '?patientCode=' + record.patient)
  320. // this.healthRecordVisable = true
  321. },
  322. handleCurrentChange:function(val) {
  323. this.page = val
  324. this.getJkCopdPatientPage()
  325. },
  326. getJkCopdPatientPage: function (val) {
  327. this.daLoading=true
  328. var vm =this
  329. var params = {
  330. page: this.page,
  331. size: this.size,
  332. name:this.name,
  333. turnDownStatus:this.turnDownStatus,
  334. receiveStatus:this.receiveStatus,
  335. archivesStatus:this.archivesStatus,
  336. hospital:this.hospital,
  337. doctorName:this.doctorName,
  338. isLive: this.isLive,
  339. firstOrg: this.firstOrg,
  340. startTime: this.chooseYear=='全部'?"": this.chooseYear+'-01-01',
  341. endTime:this.chooseYear=='全部'?"": this.chooseYear+'-12-31',
  342. }
  343. statisticAPI.jkCopdAchivesPage(params).then(function (res) {
  344. vm.totalCount = res.totalCount
  345. vm.totalPage = res.totalPage
  346. vm.currentPage=res.currPage
  347. vm.dataList = res.detailModelList
  348. console.log(vm.currentPage,res,'88888888888')
  349. vm.daLoading=false
  350. })
  351. },
  352. //上传
  353. toggle(isShow){
  354. this.isShow = isShow
  355. if(!isShow){
  356. this.reset()
  357. }
  358. },
  359. reset(type){
  360. this.percentage = 0
  361. this.success = false
  362. this.isOver = false
  363. this.errList = []
  364. if(type!=1){
  365. this.loading = false
  366. this.file = undefined
  367. this.month = ""
  368. }
  369. },
  370. close(type){
  371. this.reset(type)
  372. this.isProgressShow = false
  373. if(type!=1){
  374. this.isShow = false
  375. }
  376. },
  377. beforeUploadPic(file){
  378. console.log(file,'000000000000000000000')
  379. this.file = file
  380. },
  381. check(){
  382. var vm = this
  383. vm.loading = true
  384. if(!vm.file){
  385. vm.loading = false
  386. vm.$message('请选择文件');
  387. return
  388. }
  389. vm.save()
  390. },
  391. save(){
  392. var vm = this
  393. vm.daLoading=true
  394. var formData = new FormData()
  395. formData.append("file", vm.file)
  396. // vm.initProgress()
  397. console.log(formData, 'formData');
  398. httpRequest.post('doctor/jkCopd/importExcel',{
  399. data: formData,
  400. cache: false,//上传文件无需缓存
  401. processData: false,//用于对data参数进行序列化处理 这里必须false
  402. contentType: false, //必须
  403. }).then(function(res) {
  404. if(res.status == 200) {
  405. vm.getJkCopdPatientPage()
  406. vm.dicName.forEach(function(item) {
  407. vm.getDictByDictName(item)
  408. });
  409. vm.daLoading=false
  410. vm.isShow = false
  411. vm.$message({
  412. message: '导入成功!',
  413. type: 'success'
  414. });
  415. } else {
  416. vm.$message.error('导入失败!')
  417. vm.daLoading=false
  418. }
  419. }).catch(function(e) {
  420. console.error(e)
  421. vm.daLoading=false
  422. })
  423. },
  424. initProgress(){
  425. var vm = this
  426. this.isProgressShow = true
  427. setTimeout(()=>{
  428. if(!vm.isOver && vm.percentage!=90){
  429. vm.percentage += 10
  430. vm.initProgress()
  431. }
  432. }, 1000)
  433. }
  434. }
  435. })