addEditPatient.js 8.3 KB

1
  1. "use strict";var r=require("../common/vendor.js"),n=require("../api/patient.js");require("../common/request.js");const d={data(){return{relationShow:!1,relations:[{name:"\u672C\u4EBA"},{name:"\u914D\u5076"},{name:"\u7236\u6BCD"},{name:"\u5B50\u5973"},{name:"\u670B\u53CB"},{name:"\u4EB2\u621A"},{name:"\u5176\u4ED6"}],historyAllergics:[{name:"\u963F\u53F8\u5339\u6797",checked:0},{name:"\u78FA\u80FA\u7C7B",checked:0},{name:"\u5934\u5B62\u7C7B",checked:0},{name:"\u9752\u6BD2\u7D20\u7C7B",checked:0},{name:"\u5976\u5236\u54C1",checked:0},{name:"\u5176\u4ED6",checked:0}],selfMedHistorys:[{name:"\u7CD6\u5C3F\u75C5",checked:0},{name:"\u54EE\u5598",checked:0},{name:"\u6076\u6027\u80BF\u7624",checked:0},{name:"\u9AD8\u8840\u538B",checked:0},{name:"\u5176\u4ED6",checked:0}],familyMedHistorys:[{name:"\u7CD6\u5C3F\u75C5",checked:0},{name:"\u54EE\u5598",checked:0},{name:"\u6076\u6027\u80BF\u7624",checked:0},{name:"\u9AD8\u8840\u538B",checked:0},{name:"\u5176\u4ED6",checked:0}],type:null,patientId:null,form:{sex:1,birthday:"",idCard:"",relation:"",liverUnusual:"\u6B63\u5E38",renalUnusual:"\u6B63\u5E38",historyAllergic:"\u65E0",familyMedHistory:"\u65E0",selfMedHistory:"\u65E0"}}},onLoad(e){this.type=e.type,this.type=="edit"?(this.patientId=e.patientId,this.getPatientById(),r.index.setNavigationBarTitle({title:"\u7F16\u8F91\u5C31\u8BCA\u4EBA"})):r.index.setNavigationBarTitle({title:"\u65B0\u589E\u5C31\u8BCA\u4EBA"})},methods:{liverUnusualChange(e){console.log(e),this.form.liverUnusual=e.detail.value},renalUnusualChange(e){console.log(e),this.form.renalUnusual=e.detail.value},historyAllergicOptionChange(e){e.checked=e.checked==1?0:1},selfMedHistoryOptionChange(e){e.checked=e.checked==1?0:1},familyMedHistoryOptionChange(e){e.checked=e.checked==1?0:1},historyAllergicChange(e){console.log(e),this.form.historyAllergic=e.detail.value},selfMedHistoryChange(e){console.log(e),this.form.selfMedHistory=e.detail.value},familyMedHistoryChange(e){console.log(e),this.form.familyMedHistory=e.detail.value},relationSelect(e){this.form.relation=e.name},idcardChange(){if(this.form.idCard.length==18){var e=this.$parseIDCardInfo(this.form.idCard);this.form.birthday=e.birthday,console.log(e)}},genderChange(e){this.form.sex=e},getPatientById(){var e={patientId:this.patientId};n.getPatientById(e).then(o=>{if(o.code==200){if(this.form=o.data,this.date=this.form.birthday,this.form.historyAllergic!=null&&this.form.historyAllergic!="\u65E0"){var l=this.form.historyAllergic.split(",");this.historyAllergics.forEach(a=>{for(var i=0;i<l.length;i++)a.name==l[i]&&(a.checked=1)}),this.form.historyAllergic="\u6709"}if(this.form.selfMedHistory!=null&&this.form.selfMedHistory!="\u65E0"){var l=this.form.selfMedHistory.split(",");this.selfMedHistorys.forEach(i=>{for(var s=0;s<l.length;s++)i.name==l[s]&&(i.checked=1)}),this.form.selfMedHistory="\u6709"}if(this.form.familyMedHistory!=null&&this.form.familyMedHistory!="\u65E0"){var l=this.form.familyMedHistory.split(",");this.familyMedHistorys.forEach(i=>{for(var s=0;s<l.length;s++)i.name==l[s]&&(i.checked=1)}),this.form.familyMedHistory="\u6709"}}else r.index.showToast({title:o.msg})},o=>{})},submit(){this.type=="add"?this.addPatient():this.type=="edit"&&this.editPatient()},editPatient(){var e={patientId:this.patientId,patientName:this.form.patientName,mobile:this.form.mobile,sex:this.form.sex,birthday:this.form.birthday,idCard:this.form.idCard,relation:this.form.relation,liverUnusual:this.form.liverUnusual,renalUnusual:this.form.renalUnusual};if(this.form.historyAllergic=="\u6709"){var o=[];this.historyAllergics.forEach(l=>{l.checked==1&&o.push(l.name)}),e.historyAllergic=o.toString()}else e.historyAllergic=this.form.historyAllergic;if(this.form.selfMedHistory=="\u6709"){var o=[];this.selfMedHistorys.forEach(a=>{a.checked==1&&o.push(a.name)}),e.selfMedHistory=o.toString()}else e.selfMedHistory=this.form.selfMedHistory;if(this.form.familyMedHistory=="\u6709"){var o=[];this.familyMedHistorys.forEach(a=>{a.checked==1&&o.push(a.name)}),e.familyMedHistory=o.toString()}else e.familyMedHistory=this.form.familyMedHistory;n.editPatient(e).then(l=>{l.code==200?(r.index.showToast({icon:"success",title:"\u64CD\u4F5C\u6210\u529F"}),setTimeout(function(){r.index.$emit("refreshPatient"),r.index.navigateBack({delta:1})},500)):r.index.showToast({icon:"none",title:l.msg})},l=>{})},addPatient(){var e={patientName:this.form.patientName,mobile:this.form.mobile,sex:this.form.sex,birthday:this.form.birthday,idCard:this.form.idCard,relation:this.form.relation,liverUnusual:this.form.liverUnusual,renalUnusual:this.form.renalUnusual};if(this.form.historyAllergic=="\u6709"){var o=[];this.historyAllergics.forEach(l=>{l.checked==1&&o.push(l.name)}),e.historyAllergic=o.toString()}else e.historyAllergic=this.form.historyAllergic;if(this.form.selfMedHistory=="\u6709"){var o=[];this.selfMedHistorys.forEach(a=>{a.checked==1&&o.push(a.name)}),e.selfMedHistory=o.toString()}else e.selfMedHistory=this.form.selfMedHistory;if(this.form.familyMedHistory=="\u6709"){var o=[];this.familyMedHistorys.forEach(a=>{a.checked==1&&o.push(a.name)}),e.familyMedHistory=o.toString()}else e.familyMedHistory=this.form.familyMedHistory;n.addPatient(e).then(l=>{l.code==200?(r.index.showToast({icon:"success",title:"\u64CD\u4F5C\u6210\u529F"}),setTimeout(function(){r.index.$emit("refreshPatient"),r.index.navigateBack({delta:1})},500)):r.index.showToast({icon:"none",title:l.msg})},l=>{})},birthdayChange:function(e){this.form.birthday=e.target.value}}};if(!Array){const e=r.resolveComponent("u-alert"),o=r.resolveComponent("u-tag"),l=r.resolveComponent("u-action-sheet");(e+o+l)()}const m=()=>"../uni_modules/uview-plus/components/u-alert/u-alert.js",y=()=>"../uni_modules/uview-plus/components/u-tag/u-tag.js",u=()=>"../uni_modules/uview-plus/components/u-action-sheet/u-action-sheet.js";Math||(m+y+u)();function g(e,o,l,a,i,s){return r.e({a:r.p({title:"\u56FD\u5BB6\u536B\u5065\u59D4\u8981\u6C42\uFF0C\u5C31\u533B\u884C\u4E3A\u5FC5\u987B\u5B9E\u540D\u767B\u8BB0",type:"info"}),b:i.form.patientName,c:r.o(t=>i.form.patientName=t.detail.value),d:r.o(t=>s.genderChange(1)),e:i.form.sex===1,f:r.o(t=>s.genderChange(2)),g:i.form.sex===2,h:i.form.mobile,i:r.o(t=>i.form.mobile=t.detail.value),j:r.o(t=>s.idcardChange()),k:i.form.idCard,l:r.o(t=>i.form.idCard=t.detail.value),m:i.form.birthday,n:i.form.birthday,o:r.o((...t)=>s.birthdayChange&&s.birthdayChange(...t)),p:i.form.relation,q:r.o(t=>i.relationShow=!0),r:i.form.liverUnusual==="\u6B63\u5E38",s:i.form.liverUnusual==="\u5F02\u5E38",t:r.o((...t)=>s.liverUnusualChange&&s.liverUnusualChange(...t)),v:i.form.renalUnusual==="\u6B63\u5E38",w:i.form.renalUnusual==="\u5F02\u5E38",x:r.o((...t)=>s.renalUnusualChange&&s.renalUnusualChange(...t)),y:i.form.historyAllergic==="\u65E0",z:i.form.historyAllergic==="\u6709",A:r.o((...t)=>s.historyAllergicChange&&s.historyAllergicChange(...t)),B:i.form.historyAllergic=="\u6709"},i.form.historyAllergic=="\u6709"?{C:r.f(i.historyAllergics,(t,h,f)=>({a:r.o(c=>s.historyAllergicOptionChange(t)),b:"0a9339af-1-"+f,c:r.p({borderColor:t.checked==1?"#ffffff":"#C39A58",bgColor:t.checked==1?"#C39A58":"#ffffff",color:t.checked==1?"#ffffff":"#C39A58",shape:"circle",text:t.name})}))}:{},{D:i.form.selfMedHistory==="\u65E0",E:i.form.selfMedHistory==="\u6709",F:r.o((...t)=>s.selfMedHistoryChange&&s.selfMedHistoryChange(...t)),G:i.form.selfMedHistory=="\u6709"},i.form.selfMedHistory=="\u6709"?{H:r.f(i.selfMedHistorys,(t,h,f)=>({a:r.o(c=>s.selfMedHistoryOptionChange(t)),b:"0a9339af-2-"+f,c:r.p({borderColor:t.checked==1?"#ffffff":"#C39A58",bgColor:t.checked==1?"#C39A58":"#ffffff",color:t.checked==1?"#ffffff":"#C39A58",shape:"circle",text:t.name})}))}:{},{I:i.form.familyMedHistory==="\u65E0",J:i.form.familyMedHistory==="\u6709",K:r.o((...t)=>s.familyMedHistoryChange&&s.familyMedHistoryChange(...t)),L:i.form.familyMedHistory=="\u6709"},i.form.familyMedHistory=="\u6709"?{M:r.f(i.familyMedHistorys,(t,h,f)=>({a:r.o(c=>s.familyMedHistoryOptionChange(t)),b:"0a9339af-3-"+f,c:r.p({borderColor:t.checked==1?"#ffffff":"#C39A58",bgColor:t.checked==1?"#C39A58":"#ffffff",color:t.checked==1?"#ffffff":"#C39A58",shape:"circle",text:t.name})}))}:{},{N:r.o(t=>s.submit()),O:r.o(t=>i.relationShow=!1),P:r.o(s.relationSelect),Q:r.p({show:i.relationShow,actions:i.relations,title:"\u8BF7\u9009\u62E9"})})}var C=r._export_sfc(d,[["render",g],["__file","E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/addEditPatient.vue"]]);wx.createPage(C);