"use strict";var e=require("../common/vendor.js"),a=require("../api/test.js");require("../common/request.js");const p={data(){return{scrollTop:0,formJson:null,tempId:null,patient:null,items:{},msgs:[],index:0,item:null}},onLoad(s){this.tempId=s.tempId;var i=this;e.index.$on("refreshOrderPatient",r=>{i.patient=r})},onShow(){this.getTestTempDetails(),this.getTestDetails()},onShareAppMessage(s){if(this.$isLogin())return{title:"\u5065\u5EB7\u4F53\u8D28\u68C0\u6D4B",path:"/pages_index/test?tempId="+this.tempId,imageUrl:"https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png"}},onShareTimeline(s){if(this.utils.isLogin())return{title:"\u5065\u5EB7\u4F53\u8D28\u68C0\u6D4B",imageUrl:"https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png"}},methods:{getTestDetails(){let s={tempId:this.tempId};a.getTestDetails(s).then(i=>{i.code==200?e.index.setNavigationBarTitle({title:i.data.name+"\u81EA\u6D4B"}):e.index.showToast({icon:"none",title:"\u8BF7\u6C42\u5931\u8D25"})},i=>{})},addMsg(s,i){var r={type:s,content:i};this.msgs.push(r);var l=this;e.index.createSelectorQuery().select(".msgs").boundingClientRect(t=>{const o=t.height;l.scrollTop=o,console.log(l.scrollTop)}).exec()},optionClick(s,i){if(this.patient==null){e.index.showToast({icon:"none",title:"\u8BF7\u9009\u62E9\u4F53\u9A8C\u8005"});return}s.option=i.name,console.log(s.option),this.addMsg(2,i.name),this.index++,this.index<=this.items.length-1?(this.item=this.items[this.index],this.addMsg(1,this.item.title)):this.submit()},getTestTempDetails(){var s={tempId:this.tempId};a.getTestTempDetails(s).then(i=>{i.code==200&&(this.items=i.items,this.items.length>0&&(this.item=this.items[0],this.addMsg(1,this.item.title)))},i=>{})},addPatient(){e.index.navigateTo({url:"/pages_user/patient"})},submit(){var s={tempId:this.tempId,patientId:this.patient.patientId,formJson:JSON.stringify(this.items)};a.doReport(s).then(i=>{i.code==200?e.index.redirectTo({url:"/pages_index/testResult?reportId="+i.reportId}):e.index.showToast({icon:"none",title:i.msg})})}}};function d(s,i,r,l,t,o){return e.e({a:t.patient==null},t.patient==null?{b:e.o(n=>o.addPatient())}:{},{c:t.patient!=null},t.patient!=null?e.e({d:e.t(t.patient.patientName),e:t.patient.sex==1},t.patient.sex==1?{}:{},{f:t.patient.sex==2},t.patient.sex==2?{}:{},{g:e.t(s.$getAge(t.patient.birthday)),h:e.t(s.$parseIdCard(t.patient.idCard)),i:e.o(n=>o.addPatient())}):{},{j:e.f(t.msgs,(n,h,m)=>e.e({a:n.type==1},n.type==1?{b:e.t(n.content)}:{},{c:n.type==2},n.type==2?{d:e.t(n.content)}:{})),k:t.scrollTop,l:t.item!=null},t.item!=null?{m:e.t(t.item.title),n:e.f(JSON.parse(t.item.scoreJson),(n,h,m)=>({a:e.t(n.name),b:e.o(g=>o.optionClick(t.item,n))}))}:{})}var c=e._export_sfc(p,[["render",d],["__file","E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_index/test.vue"]]);p.__runtimeHooks=6;wx.createPage(c);
