"use strict";var t=require("../common/vendor.js"),e=require("../api/test.js");require("../common/request.js");const i={data:()=>({scrollTop:0,formJson:null,tempId:null,patient:null,items:{},msgs:[],index:0,item:null}),onLoad(e){this.tempId=e.tempId;var i=this;t.index.$on("refreshOrderPatient",(t=>{i.patient=t}))},onShow(){this.getTestTempDetails(),this.getTestDetails()},onShareAppMessage(t){if(this.$isLogin())return{title:"健康体质检测",path:"/pages_index/test?tempId="+this.tempId,imageUrl:"https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png"}},onShareTimeline(t){if(this.utils.isLogin())return{title:"健康体质检测",imageUrl:"https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png"}},methods:{getTestDetails(){let i={tempId:this.tempId};e.getTestDetails(i).then((e=>{200==e.code?t.index.setNavigationBarTitle({title:e.data.name+"自测"}):t.index.showToast({icon:"none",title:"请求失败"})}),(t=>{}))},addMsg(e,i){var s={type:e,content:i};this.msgs.push(s);var n=this;t.index.createSelectorQuery().select(".msgs").boundingClientRect((t=>{const e=t.height;n.scrollTop=e,console.log(n.scrollTop)})).exec()},optionClick(e,i){null!=this.patient?(e.option=i.name,console.log(e.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()):t.index.showToast({icon:"none",title:"请选择体验者"})},getTestTempDetails(){var t={tempId:this.tempId};e.getTestTempDetails(t).then((t=>{200==t.code&&(this.items=t.items,this.items.length>0&&(this.item=this.items[0],this.addMsg(1,this.item.title)))}),(t=>{}))},addPatient(){t.index.navigateTo({url:"/pages_user/patient"})},submit(){var i={tempId:this.tempId,patientId:this.patient.patientId,formJson:JSON.stringify(this.items)};e.doReport(i).then((e=>{200==e.code?t.index.redirectTo({url:"/pages_index/testResult?reportId="+e.reportId}):t.index.showToast({icon:"none",title:e.msg})}))}}};var s=t._export_sfc(i,[["render",function(e,i,s,n,o,a){return t.e({a:null==o.patient},null==o.patient?{b:t.o((t=>a.addPatient()))}:{},{c:null!=o.patient},null!=o.patient?t.e({d:t.t(o.patient.patientName),e:1==o.patient.sex},(o.patient.sex,{}),{f:2==o.patient.sex},(o.patient.sex,{}),{g:t.t(e.$getAge(o.patient.birthday)),h:t.t(e.$parseIdCard(o.patient.idCard)),i:t.o((t=>a.addPatient()))}):{},{j:t.f(o.msgs,((e,i,s)=>t.e({a:1==e.type},1==e.type?{b:t.t(e.content)}:{},{c:2==e.type},2==e.type?{d:t.t(e.content)}:{}))),k:o.scrollTop,l:null!=o.item},null!=o.item?{m:t.t(o.item.title),n:t.f(JSON.parse(o.item.scoreJson),((e,i,s)=>({a:t.t(e.name),b:t.o((t=>a.optionClick(o.item,e)))})))}:{})}]]);i.__runtimeHooks=6,wx.createPage(s);
