import{_ as Nt,Y as He,o as Mt,r as K,c as Vt,d as w,e as z,i as c,k as D,v as V,q as M,x as B,j as A,w as _,h as dt,f,F as ze,t as Pe,Z as nt,l as F,y as Be,$ as Rt,m as zt,g as v,a0 as Pt,E as G,a1 as Bt,a2 as Yt,a3 as ve,N as _e,a4 as Ot,a5 as $t,a6 as at,a7 as Lt,a8 as Ut}from"./index-c64ce9a7.js";const jt={class:"YuYue202506"},Ht={key:0,class:"patientInfo"},Jt={class:"item"},Ft={class:"name"},Gt={class:"item"},At={class:"value"},qt={class:"item"},Wt={class:"value"},Zt={key:0,class:"item"},Kt={class:"value"},Qt={key:1,class:"item"},Xt={class:"value"},ed={key:2,class:"item"},td={class:"value"},dd={key:1},nd={style:{"font-weight":"700",color:"#e6a23c"}},ad={style:{"font-weight":"700",color:"#e6a23c"}},sd={class:"entrustList"},id={key:0,style:{"font-size":"12px",color:"#909399"}},ld={style:{"margin-right":"4px",color:"#999"}},od={key:0,class:"errMsg"},rd={key:1},pd={key:0},ud={key:1},_d={key:0,style:{color:"orangered"}},md={key:1},cd={key:0},fd={key:0},gd={key:1},xd={class:"planInfo"},hd={style:{display:"flex","justify-content":"space-between","align-items":"center","margin-top":"8px","margin-bottom":"8px"}},bd={style:{display:"flex","align-items":"center"}},yd=["onClick"],vd={style:{display:"flex","flex-direction":"column","margin-left":"12px"}},wd={style:{border:"1px solid #efefef"}},kd={class:"planTable"},Sd={key:0,style:{"background-color":"#f1f1f1"}},Ed={style:{"font-weight":"700"}},Cd=["onClick"],Dd={key:0},Id={key:0},Td={key:1,style:{"background-color":"#fff"}},Nd={class:"dialog-footer"},Md={style:{display:"flex","align-items":"flex-start",gap:"12px"}},Vd=["innerHTML"],Rd={style:{display:"flex","align-items":"flex-start",gap:"12px"}},zd=["innerHTML"],Pd={style:{display:"flex","align-items":"flex-start",gap:"12px"}},Bd=["innerHTML"],Yd={style:{display:"flex","align-items":"flex-start",gap:"12px"}},Od=["innerHTML"],$d={key:0,style:{color:"#f56c6c"}},Ld={key:0,style:{color:"#f56c6c","font-size":"12px","margin-top":"2px"}},Ud=`1.未预约状态,如果多个检查项目能在同一个检查室进行检查,系统会自动选中能一起预约的项目,只需要点击一次预约按钮即可完成预约 2.已预约状态,预约到同一个时段的同一个检查室的项目,系统会自动选中,更改预约或取消预约只需点击一次 3.不同状态的预约的预约项目无法一起选中`,jd={__name:"YuYue202506",props:{reg_num:{type:String},entrust_ids:{type:String},episode_id:{type:String},appointment_type:{type:[String,Number]},dotype:{type:Number},do_user:{default:"",type:[String,Number]},special_privileges:{type:Array,default:()=>[]},scope:{type:String,default:"all"}},setup(st){const k=st;let q=v(null),j=v(null),p=v([]);const me=o=>o?o.requestComment?`${o.entrust}(${o.requestComment})`:o.entrust:"";let re=v([]),ie=v(!1),H=v(!1),oe=v(["1"]),Ye=v(!0),pe=v([]),we=v([]),O=v(""),$=v(0),L=v([]),J=v([]),h=v([]),X=v(!0),ke=v([]),ee=v([]),Se=v("add"),ue=v(""),Ee=v([]),Ce=v([]),ce=v([]),it=v(0),Je=v(!1),fe=v(!0),Oe=v(""),$e=v(""),ne=v(!1),Q=v(!1),ge=v(""),xe=v(null),he=v(null),le=v(!1),Fe=v(""),te=v(!1),De=v(""),de=v(!1),Ie=v(""),Z=v(!1),Ge=v([]),Ae=v(!1),Te=v(!1),qe=v(null);const We=()=>{Z.value=!1,kt(qe.value)},lt=({row:o})=>o.check_status==="fail"?"precheck-fail-row":"",ot=o=>{let e=["周日","周一","周二","周三","周四","周五","周六"];const t=new Date(o).getDay();return e[t]},Ze=He(()=>{const o=h.value.map(t=>{var s;return(s=t.department_resources)==null?void 0:s.department_resources_name}).filter(Boolean),e=[...new Set(o)];if(e.length!==1)return 0;const d=e[0];return p.value.filter(t=>{var s;return((s=t.department_resources)==null?void 0:s.department_resources_name)===d}).length}),Ke=He(()=>k.special_privileges.includes("emergency")),rt=He(()=>{const o=p.value.filter(d=>!!(d.list_status===1&&d.reservation_date||d.list_status===0&&d.temp_plan_id&&d.reservation_date));return o.length<2?!1:new Set(o.map(d=>d.reservation_date)).size>1});let Ne=null;const pt=()=>{Ne&&clearTimeout(Ne),Ne=setTimeout(()=>{se(),Ne=null},500)},ut=o=>{var d,t,s,i,l,a,r,g,N,P;if(L.value=[],J.value=[],pe.value=[],we.value=[],re.value=[],O.value="",h.value=o,console.log("11111",h.value),h.value.forEach((x,u)=>{L.value.push(x.id),J.value.push(x.entrust_id)}),h.value.every(x=>{var u;return x.roster_id===((u=h.value[0])==null?void 0:u.roster_id)}))$.value=(d=h.value[0])==null?void 0:d.roster_id,$.value!==0&&$.value&&(ue.value=(t=h.value[0])==null?void 0:t.reservation_date,It(et(),(s=h.value[0])==null?void 0:s.reservation_date)&&((i=h.value[0])!=null&&i.reservation_date)?ae.value=Ve((l=h.value[0])==null?void 0:l.reservation_date):ae.value=Ve(et()),O.value=(r=(a=h.value[0])==null?void 0:a.department_resources)==null?void 0:r.department_resources_name);else if($.value=0,h.value.length>0){const x=(N=(g=h.value[0])==null?void 0:g.department_resources)==null?void 0:N.execute_department_id;if(x&&h.value.every(y=>{var S;return((S=y.department_resources)==null?void 0:S.execute_department_id)===x})){const y=(P=h.value[0].department_resources)==null?void 0:P.department_resources_name;y&&(O.value=y)}}ke.value.forEach(x=>{h.value.find(u=>u===x)||(Se.value="cancel")}),h.value.length==0&&(Se.value="add",ke.value=[]),console.log(Se.value),J.value.length>0&&X.value&&(Se.value==="add"&&h.value[0].list_status==0?fe.value?gt():se():pt()),xe.value&&p.value.findIndex(u=>L.value.includes(u.id))+1===xe.value.idx&&(ge.value=xe.value.html,Q.value=!0,xe.value=null),he.value&&p.value.findIndex(u=>L.value.includes(u.id))+1===he.value.idx&&(Ie.value=he.value.html,de.value=!0,he.value=null),_t()},_t=()=>{var d,t;if(h.value.length===0){Ye.value=!0;return}const o=(t=(d=h.value[0])==null?void 0:d.department_resources)==null?void 0:t.execute_department_id;if(o==null){Ye.value=!0;return}const e=h.value.every(s=>{var i;return((i=s.department_resources)==null?void 0:i.execute_department_id)===o});Ye.value=!e},mt=o=>h.value.findIndex(e=>e.id===o.id)>-1,ct=({row:o,rowIndex:e})=>{if(o.tishi_msg!="")return"disabled-row";if(mt(o))return"selected-row"},ft=(o,e)=>o.tishi_msg=="";let be=v([]);const Me=(o,e)=>{let d=L.value;p.value=[],ie.value=!0,Pt({regnum:k.reg_num,entrustid:k.entrust_ids,episodeid:k.episode_id,appointment_type:k.appointment_type}).then(t=>{var s;if(ie.value=!1,t.status){if(t.data.info.length>0){let i=t.data.info;if(j.value=i[0].maininfo,i.forEach((l,a)=>{var g,N;let r=l.maininfo;r.tishi_msg=l.msg,r.limosis=(g=l.iteminfo[0])==null?void 0:g.limosis,p.value.push(r),l.msg!=""&&l.msg!=null&&be.value.push({msg:l.msg,item_name:(N=l.iteminfo[0])==null?void 0:N.item_name})}),t.data.no_appointment_dept&&t.data.no_appointment_dept.length>0){const l=[...new Set(t.data.no_appointment_dept.map(r=>r.resource_name))],a=[...new Set(t.data.no_appointment_dept.map(r=>r.item_name))];Oe.value="注意:"+l.join(",")+"下属的"+a.join(",")+"项目属于不用预约项目!"}if(t.data.no_schedule&&t.data.no_schedule.length>0){const l=[...new Set(t.data.no_schedule.map(r=>r.resource_name))],a=[...new Set(t.data.no_schedule.map(r=>r.item_name))];$e.value="注意:"+l.join(",")+"下属的"+a.join(",")+"项目未配置排班计划,请联系检查室!"}if(d.length>0&&!e)d.forEach((l,a)=>{p.value.forEach((r,g)=>{l==r.id&&q.value.toggleRowSelection(p.value[g],!0)})});else{for(let l=0;l{var g;r.id!==p.value[l].id&&r.list_status===0&&r.tishi_msg===""&&((g=r.department_resources)==null?void 0:g.department_resources_name)===a&&q.value.toggleRowSelection(r,!0)}),p.value[l].roster_id!=null&&($.value=p.value[l].roster_id,O.value=a);break}if(L.value.length===0){const l=p.value.find(a=>a.tishi_msg==="");l&&(X.value=!1,e&&d.length>0?d.forEach(a=>{const r=p.value.find(g=>g.id===a);r&&q.value.toggleRowSelection(r,!0)}):q.value.toggleRowSelection(l,!0),X.value=!0)}}je.value&&(je.value=!1,be.value.length>0&&(console.log("22222222222222",be.value),ne.value=!0)),Ce.value=JSON.parse(JSON.stringify(p.value)),o&&o()}}else G.error(t.msg)})},gt=()=>{let o=[],e=h.value.length;if(h.value[e-1].list_status!=0)return!1;p.value.forEach((d,t)=>{d.list_status==0&&d.tishi_msg==""&&(d.id==h.value[e-1].id?o.push({name:d.entrust,rowid:t,first:1}):o.push({name:d.entrust,rowid:t,first:0}))}),o.length>=2?(ie.value=!0,Bt({items:o}).then(d=>{ie.value=!1,d.status?(o.forEach((s,i)=>{X.value=!1,q.value.toggleRowSelection(p.value[s.rowid],!1)}),d.data.rowids.forEach((s,i)=>{X.value=!1,q.value.toggleRowSelection(p.value[s],!0)}),ke.value=h.value,se()):G.error(d.msg),X.value=!0})):(ke.value=h.value,se())};let ae=v([]);const se=()=>{if(J.value.length==0)return G.error("请选择检查项目"),!1;H.value=!0;const o=[...J.value].sort().join(",");Yt({regnum:k.reg_num,entrustid:J.value,episodeid:k.episode_id,appointment_type:k.appointment_type,date:ae.value,scope:k.scope,do_user:k.do_user}).then(e=>{H.value=!1;const d=[...J.value].sort().join(",");if(o===d)if(re.value=[],pe.value=[],e.status){let t=e.data.plan_list,s=e.data.zhanWeiCount,i=e.data.is_emergency;if(ce.value=t,it.value=s,t.length>0){t.some(x=>x.department_resources_name===O.value)||(O.value=t[0].department_resources_name);const a=new Set,r=new Set;t.forEach(x=>{if(x.no_plan){r.add(x.department_resources_name);return}if(x.department_resources_name==O.value){const u=`${x.begin_time.substring(0,5)}-${x.end_time.substring(0,5)}`;a.add(u)}r.add(x.department_resources_name)});const g=Array.from(r);if(we.value.length>0){const x=[],u=[...g];we.value.forEach(y=>{const S=u.indexOf(y);S!==-1&&(x.push(y),u.splice(S,1))}),pe.value=[...x,...u]}else pe.value=g;we.value=[...pe.value],Array.from(a).sort().forEach(x=>{const u={time_range:x};ae.value.forEach(y=>{const S=t.find(m=>!m.no_plan&&`${m.begin_time.substring(0,5)}-${m.end_time.substring(0,5)}`===x&&m.date===y&&m.department_resources_name==O.value);let n=!1;S?(S.plan_enable===!0&&(n=!0),i===!0&&S.plan_enable===!0&&Ke.value==!0&&(n=!0),u[y]={use_count:`${S.used_count}/${S.count}`,id:S.id,enable:n}):u[y]={use_count:"0/0",id:null,enable:n}}),re.value.push(u)}),$.value=0;const P=Qe();if(P.length>0)ee.value=P,$.value=P[0];else{ee.value=[];const x=t.find(u=>u.department_resources_name==O.value&&u.plan_enable===!0);x&&($.value=x.id)}if(!Je.value){Je.value=!0;const x=p.value.filter(u=>u.list_status===0);if(x.length>0){const u=x.map(y=>{var S;return{id:y.id,entrust_id:y.entrust_id,department_resources_name:((S=y.department_resources)==null?void 0:S.department_resources_name)||"",date:y.reservation_date||"",begin_time:y.period_begin_time||"",end_time:y.period_end_time||""}});ve({type:"optimal_time",regnum:k.reg_num,entrustid:J.value,episodeid:k.episode_id,appointment_type:k.appointment_type,items:u,scope:k.scope,do_user:k.do_user}).then(y=>{if(y.status){y.data.forEach(b=>{const T=p.value.find(Y=>Y.id===b.id);T&&(T.department_resources||(T.department_resources={}),T.department_resources.department_resources_name=b.department_resources_name,T.reservation_date=b.date,T.period_begin_time=b.begin_time,T.period_end_time=b.end_time,T.temp_plan_id=b.plan_id)});const S={};y.data.forEach(b=>{var Y,W;const T=b.department_resources_name;S[T]||(S[T]={items:[],timeSlots:new Set,dates:new Set}),S[T].items.push(b),S[T].timeSlots.add(((Y=b.begin_time)==null?void 0:Y.substring(0,5))+"-"+((W=b.end_time)==null?void 0:W.substring(0,5))),S[T].dates.add(b.date)});const n=[];for(const[b,T]of Object.entries(S))(T.timeSlots.size>1||T.dates.size>1)&&T.items.forEach(Y=>{var C,E;const W=p.value.findIndex(U=>U.id===Y.id);n.push({idx:W!==-1?W+1:"",room:Y.department_resources_name,date:Y.date,timeSlot:((C=Y.begin_time)==null?void 0:C.substring(0,5))+"-"+((E=Y.end_time)==null?void 0:E.substring(0,5)),entrust:me(p.value.find(U=>U.id===Y.id))})});if(n.length>0){let b='';b+='';let T="",Y="#f5f5f5";n.sort((E,U)=>E.idx-U.idx).forEach(E=>{E.timeSlot!==T&&(Y=Y==="#fff"?"#d5dce6":"#fff",T=E.timeSlot),b+='"}),b+="
序号项目名称检查室日期时间段
'+E.idx+''+E.entrust+''+E.room+''+E.date+''+E.timeSlot+"
";const W=Math.min(...n.map(E=>E.idx));p.value.findIndex(E=>L.value.includes(E.id))+1===W?(ge.value=b,Q.value=!0):xe.value={html:b,idx:W}}const m=new Set(y.data.map(b=>b.id)),I=u.filter(b=>!m.has(b.id));if(I.length>0){let b='';b+='';let T=1;y.data.forEach(E=>{var ye,Re,tt;const U=((ye=p.value.find(Tt=>Tt.id===E.id))==null?void 0:ye.entrust)||"";b+=''}),I.forEach(E=>{var ye;const U=((ye=p.value.find(Re=>Re.id===E.id))==null?void 0:ye.entrust)||"";b+=''}),b+="
序号项目名称排班资源日期时间段结果
'+T+++''+U+''+E.department_resources_name+''+E.date+''+((Re=E.begin_time)==null?void 0:Re.substring(0,5))+"-"+((tt=E.end_time)==null?void 0:tt.substring(0,5))+'✅ 成功匹配
'+T+++''+U+'❌ 未找到合适号源
";const Y=I.map(E=>p.value.findIndex(U=>U.id===E.id)+1).filter(E=>E>0),W=Math.min(...Y);p.value.findIndex(E=>L.value.includes(E.id))+1===W?(Ie.value=b,de.value=!0):he.value={html:b,idx:W}}const R=Qe();R.length>0&&(ee.value=R,$.value=R[0])}})}}}}else G.error(e.msg)})},xt=o=>{O.value=o,$.value=0,ee.value=[],se()},Qe=()=>{const o=[];for(const e of p.value)if(L.value.includes(e.id)&&e.list_status===0&&e.temp_plan_id){const d=ce.value.find(t=>t.id===e.temp_plan_id&&t.department_resources_name===O.value);d&&!o.includes(d.id)&&o.push(d.id)}for(const e of p.value)if(L.value.includes(e.id)&&e.list_status===1&&e.roster_id){const d=ce.value.find(t=>t.id===e.roster_id&&t.department_resources_name===O.value);d&&!o.includes(d.id)&&o.push(d.id)}return o},ht=o=>{if(console.log(o),o==null)return;const e=ce.value.find(d=>d.id===o);e&&($.value=o,ee.value=[o],wt(),h.value.forEach(d=>{const t=p.value.find(s=>s.id===d.id);t&&(t.department_resources||(t.department_resources={}),t.department_resources.department_resources_name=e.department_resources_name,t.reservation_date=e.date,t.period_begin_time=e.begin_time,t.period_end_time=e.end_time,t.temp_plan_id=o)}))},bt=()=>{if(J.value.length===0){G.error("请选择检查项目");return}H.value=!0,h.value.forEach(d=>{const t=Ce.value.find(i=>i.id===d.id);if(!t)return;const s=p.value.find(i=>i.id===d.id);s&&(s.department_resources=t.department_resources,s.reservation_date=t.reservation_date,s.period_begin_time=t.period_begin_time,s.period_end_time=t.period_end_time,s.temp_plan_id=void 0)});const o=h.value.filter(d=>d.list_status===0).map(d=>{var t;return{id:d.id,entrust_id:d.entrust_id,department_resources_name:((t=d.department_resources)==null?void 0:t.department_resources_name)||"",date:d.reservation_date||"",begin_time:d.period_begin_time||"",end_time:d.period_end_time||""}}),e=p.value.filter(d=>!L.value.includes(d.id)&&d.list_status===0&&d.temp_plan_id).map(d=>d.temp_plan_id);ve({type:"optimal_time",regnum:k.reg_num,entrustid:J.value,episodeid:k.episode_id,appointment_type:k.appointment_type,items:o,occupied_plan_ids:e,scope:k.scope,do_user:k.do_user}).then(d=>{if(H.value=!1,d.status){d.data.forEach(a=>{const r=p.value.find(g=>g.id===a.id);r&&(r.department_resources||(r.department_resources={}),r.department_resources.department_resources_name=a.department_resources_name,r.reservation_date=a.date,r.period_begin_time=a.begin_time,r.period_end_time=a.end_time,r.temp_plan_id=a.plan_id)});const t={};d.data.forEach(a=>{var g,N;const r=a.department_resources_name;t[r]||(t[r]={items:[],timeSlots:new Set,dates:new Set}),t[r].items.push(a),t[r].timeSlots.add(((g=a.begin_time)==null?void 0:g.substring(0,5))+"-"+((N=a.end_time)==null?void 0:N.substring(0,5))),t[r].dates.add(a.date)});const s=[];for(const[a,r]of Object.entries(t))(r.timeSlots.size>1||r.dates.size>1)&&r.items.forEach(g=>{var P,x;const N=p.value.findIndex(u=>u.id===g.id);s.push({idx:N!==-1?N+1:"",room:g.department_resources_name,date:g.date,timeSlot:((P=g.begin_time)==null?void 0:P.substring(0,5))+"-"+((x=g.end_time)==null?void 0:x.substring(0,5)),entrust:me(p.value.find(u=>u.id===g.id))})});if(s.length>0){let a='';a+='';let r="",g="#f5f5f5";s.sort((N,P)=>N.idx-P.idx).forEach(N=>{N.timeSlot!==r&&(g=g==="#fff"?"#d5dce6":"#fff",r=N.timeSlot),a+='"}),a+="
序号项目名称检查室日期时间段
'+N.idx+''+N.entrust+''+N.room+''+N.date+''+N.timeSlot+"
",ge.value=a,Q.value=!0}const i=new Set(d.data.map(a=>a.id)),l=o.filter(a=>!i.has(a.id));if(l.length>0){let a='';a+='';let r=1;d.data.forEach(g=>{var P,x;const N=me(p.value.find(u=>u.id===g.id));a+=''}),l.forEach(g=>{const N=me(p.value.find(P=>P.id===g.id));a+=''}),a+="
序号项目名称排班资源日期时间段结果
'+r+++''+N+''+g.department_resources_name+''+g.date+''+((P=g.begin_time)==null?void 0:P.substring(0,5))+"-"+((x=g.end_time)==null?void 0:x.substring(0,5))+'✅ 成功匹配
'+r+++''+N+'❌ 未找到合适号源
",Ie.value=a,de.value=!0}else d.data.length===0&&_e.confirm("所有项目均未匹配到合适号源,请重新选择号源","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"error",showCancelButton:!1});d.data.length>0&&(O.value=d.data[0].department_resources_name,ee.value=d.data.map(a=>a.plan_id),$.value=d.data[0].plan_id)}else G.error(d.msg)})},yt=()=>{if(J.value.length===0){G.error("请选择检查项目");return}H.value=!0,h.value.forEach(d=>{const t=Ce.value.find(i=>i.id===d.id);if(!t)return;const s=p.value.find(i=>i.id===d.id);s&&(s.department_resources=t.department_resources,s.reservation_date=t.reservation_date,s.period_begin_time=t.period_begin_time,s.period_end_time=t.period_end_time,s.temp_plan_id=void 0)});const o=h.value.filter(d=>d.list_status===0).map(d=>{var t;return{id:d.id,entrust_id:d.entrust_id,department_resources_name:((t=d.department_resources)==null?void 0:t.department_resources_name)||"",date:d.reservation_date||"",begin_time:d.period_begin_time||"",end_time:d.period_end_time||""}}),e=p.value.filter(d=>!L.value.includes(d.id)&&d.list_status===0&&d.temp_plan_id).map(d=>d.temp_plan_id);ve({type:"full_day",regnum:k.reg_num,entrustid:J.value,episodeid:k.episode_id,appointment_type:k.appointment_type,items:o,occupied_plan_ids:e,scope:k.scope,do_user:k.do_user}).then(d=>{if(H.value=!1,d.status)if(d.data.forEach(t=>{const s=p.value.find(i=>i.id===t.id);s&&(s.department_resources||(s.department_resources={}),s.department_resources.department_resources_name=t.department_resources_name,s.reservation_date=t.date,s.period_begin_time=t.begin_time,s.period_end_time=t.end_time,s.temp_plan_id=t.plan_id)}),d.data.length>0){const t={};d.data.forEach(i=>{var a,r;const l=i.department_resources_name;t[l]||(t[l]={items:[],timeSlots:new Set,dates:new Set}),t[l].items.push(i),t[l].timeSlots.add(((a=i.begin_time)==null?void 0:a.substring(0,5))+"-"+((r=i.end_time)==null?void 0:r.substring(0,5))),t[l].dates.add(i.date)});const s=[];for(const[i,l]of Object.entries(t))(l.timeSlots.size>1||l.dates.size>1)&&l.items.forEach(a=>{var g,N;const r=p.value.findIndex(P=>P.id===a.id);s.push({idx:r!==-1?r+1:"",room:a.department_resources_name,date:a.date,timeSlot:((g=a.begin_time)==null?void 0:g.substring(0,5))+"-"+((N=a.end_time)==null?void 0:N.substring(0,5)),entrust:me(p.value.find(P=>P.id===a.id))})});if(s.length>0){let i='';i+='';let l="",a="#f5f5f5";s.sort((r,g)=>r.idx-g.idx).forEach(r=>{r.timeSlot!==l&&(a=a==="#fff"?"#d5dce6":"#fff",l=r.timeSlot),i+='"}),i+="
序号项目名称检查室日期时间段
'+r.idx+''+r.entrust+''+r.room+''+r.date+''+r.timeSlot+"
",ge.value=i,Q.value=!0}O.value=d.data[0].department_resources_name,ee.value=d.data.map(i=>i.plan_id),$.value=d.data[0].plan_id}else _e.confirm("未找到任何一天可满足所有检查项目的号源","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",showCancelButton:!1});else G.error(d.msg)})},vt=()=>{if(J.value.length===0){G.error("请选择检查项目");return}H.value=!0,h.value.forEach(d=>{const t=Ce.value.find(i=>i.id===d.id);if(!t)return;const s=p.value.find(i=>i.id===d.id);s&&(s.department_resources=t.department_resources,s.reservation_date=t.reservation_date,s.period_begin_time=t.period_begin_time,s.period_end_time=t.period_end_time,s.temp_plan_id=void 0)});const o=h.value.filter(d=>d.list_status===0).map(d=>{var t;return{id:d.id,entrust_id:d.entrust_id,department_resources_name:((t=d.department_resources)==null?void 0:t.department_resources_name)||"",date:d.reservation_date||"",begin_time:d.period_begin_time||"",end_time:d.period_end_time||""}}),e=p.value.filter(d=>!L.value.includes(d.id)&&d.list_status===0&&d.temp_plan_id).map(d=>d.temp_plan_id);ve({type:"same_day_slot",regnum:k.reg_num,entrustid:J.value,episodeid:k.episode_id,appointment_type:k.appointment_type,items:o,occupied_plan_ids:e,scope:k.scope,do_user:k.do_user}).then(d=>{if(H.value=!1,d.status)if(d.data.length>0){const t={};d.data.forEach(i=>{var a,r;const l=i.department_resources_name;t[l]||(t[l]={timeSlots:new Set}),t[l].timeSlots.add(((a=i.begin_time)==null?void 0:a.substring(0,5))+"-"+((r=i.end_time)==null?void 0:r.substring(0,5)))});let s=!1;for(const i of Object.values(t))if(i.timeSlots.size>1){s=!0;break}if(s){_e.confirm("未找到同一时段号源,无法匹配","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",showCancelButton:!1});return}d.data.forEach(i=>{const l=p.value.find(a=>a.id===i.id);l&&(l.department_resources||(l.department_resources={}),l.department_resources.department_resources_name=i.department_resources_name,l.reservation_date=i.date,l.period_begin_time=i.begin_time,l.period_end_time=i.end_time,l.temp_plan_id=i.plan_id)}),O.value=d.data[0].department_resources_name,ee.value=d.data.map(i=>i.plan_id),$.value=d.data[0].plan_id}else _e.confirm("未找到同一时段号源,无法匹配","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",showCancelButton:!1});else G.error(d.msg)})},wt=()=>{H.value=!0;const o=ce.value.find(s=>s.id===$.value);if(!o){H.value=!1;return}const e=o.date+" "+o.begin_time,d=o.date+" "+o.end_time,t=o.department_resources_name;Ot({reg_num:k.reg_num,planid:$.value}).then(s=>{var l;H.value=!1;let i=[];if(!s.status&&((l=s.data)!=null&&l.conflicts)&&(i=i.concat(s.data.conflicts.filter(a=>a.room_name!==t))),p.value.forEach(a=>{var P,x,u,y;if(a.list_status!==0||!a.temp_plan_id||!a.reservation_date||((P=a.department_resources)==null?void 0:P.department_resources_name)===t)return;const g=a.reservation_date+" "+a.period_begin_time,N=a.reservation_date+" "+a.period_end_time;g<=d&&e<=N&&(i.some(n=>n.entrust===a.entrust&&n.date===a.reservation_date)||i.push({entrust:a.entrust,date:a.reservation_date,begin_time:(x=a.period_begin_time)==null?void 0:x.substring(0,5),end_time:(u=a.period_end_time)==null?void 0:u.substring(0,5),room_name:((y=a.department_resources)==null?void 0:y.department_resources_name)||""}))}),i.length>0){let a='';a+='',i.forEach((r,g)=>{a+='"}),a+="
序号项目名称检查室日期时间段
'+(g+1)+''+r.entrust+''+(r.room_name||"")+''+r.date+''+r.begin_time+"-"+r.end_time+"
",Fe.value=a,le.value=!0}})},Le=async o=>{if(J.length==0)return G.error("请选择检查项目"),!1;if($.value==0||$.value==""||$.value==null)return G.error("请选择号源"),!1;const e={};L.value.forEach(s=>{const i=p.value.find(a=>a.id===s),l=(i==null?void 0:i.temp_plan_id)||(i==null?void 0:i.roster_id);l&&(e[l]||(e[l]=[]),e[l].push(s))});const d=Object.entries(e).map(([s,i])=>({planid:Number(s),mainlistid:i})),t=await $t({groups:d,appointment_type:k.appointment_type,dotype:o,do_user:k.do_user,is_emergency:o==111?1:null});if(!t.status){G.error(t.msg);return}Ge.value=t.data.list||[],Ae.value=t.data.has_mismatch||!1,Te.value=t.data.has_fail||!1,qe.value=o,Z.value=!0},kt=async o=>{var N,P,x;H.value=!0;const e={};p.value.forEach(u=>{var y;!L.value.includes(u.id)&&u.temp_plan_id&&(e[u.id]={temp_plan_id:u.temp_plan_id,department_resources_name:(y=u.department_resources)==null?void 0:y.department_resources_name,reservation_date:u.reservation_date,period_begin_time:u.period_begin_time,period_end_time:u.period_end_time})}),console.log("tempPlanCache 缓存:",JSON.parse(JSON.stringify(e)));const d={};let t=!1;if(L.value.forEach(u=>{const y=p.value.find(n=>n.id===u),S=(y==null?void 0:y.temp_plan_id)||(y==null?void 0:y.roster_id);if(!S){t=!0;return}d[S]||(d[S]=[]),d[S].push(u)}),t){H.value=!1,G.error("存在未分配号源的项目,请先选择号源");return}const s=Object.keys(d);if(s.length===1){const u=Number(s[0]),y=d[u];at({mainlistid:y,planid:u,appointment_type:k.appointment_type,dotype:o,do_user:k.do_user,is_emergency:o==111?1:null}).then(S=>{var n,m,I,R;if(H.value=!1,S.status){if(Ee.value.forEach((b,T)=>{b.label=="开启申请单pdf"&&b.value}),Me(()=>{var W;X.value=!1;const b=[...L.value],T=p.value.filter(C=>C.list_status===0&&C.tishi_msg==="");if(T.length===0)b.forEach(C=>{const E=p.value.find(U=>U.id===C);E&&q.value.toggleRowSelection(E,!0)});else{q.value.clearSelection();const C=new Set(T.map(E=>{var U;return(U=E.department_resources)==null?void 0:U.department_resources_name}).filter(Boolean));p.value.forEach(E=>{var U;E.tishi_msg===""&&(E.list_status===0||C.has((U=E.department_resources)==null?void 0:U.department_resources_name))&&q.value.toggleRowSelection(E,!0)})}if(X.value=!0,p.value.forEach(C=>{e[C.id]&&(console.log("回填 temp_plan_id:",C.id,e[C.id].temp_plan_id),C.temp_plan_id=e[C.id].temp_plan_id,C.department_resources||(C.department_resources={}),C.department_resources.department_resources_name=e[C.id].department_resources_name,C.reservation_date=e[C.id].reservation_date,C.period_begin_time=e[C.id].period_begin_time,C.period_end_time=e[C.id].period_end_time)}),console.log("回填后 entrustTableDate:",JSON.parse(JSON.stringify(p.value.map(C=>({id:C.id,temp_plan_id:C.temp_plan_id,list_status:C.list_status}))))),setTimeout(()=>{console.log("延迟检查 temp_plan_id:",JSON.parse(JSON.stringify(p.value.map(C=>({id:C.id,temp_plan_id:C.temp_plan_id,list_status:C.list_status})))))},2e3),h.value.length>0){const C=(W=h.value[0].department_resources)==null?void 0:W.department_resources_name;C&&(O.value=C)}if(h.value.some(C=>C.list_status===0)||se(),oe.value.length>0){const C=h.value.filter(E=>E.list_status===1).map(E=>E.entrust_id);C.length>0&&Ue(C)}},!0),((m=(n=S.data)==null?void 0:n.fail_items)==null?void 0:m.length)>0){let b='';b+='',S.data.fail_items.forEach((T,Y)=>{b+='"}),b+="
序号项目名称结果
'+(Y+1)+''+T.name+''+T.reason+"
",De.value=b,te.value=!0}}else if(((R=(I=S.data)==null?void 0:I.fail_items)==null?void 0:R.length)>0){let b='';b+='',S.data.fail_items.forEach((T,Y)=>{b+='"}),b+="
序号项目名称结果
'+(Y+1)+''+T.name+''+T.reason+"
",De.value=b,te.value=!0}else _e.confirm(S.msg,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"error",showCancelButton:!1}).then(()=>{}).catch(()=>{})});return}const i=[],l=[],a=[];for(const u of s){const y=Number(u),S=d[u];try{const n=await at({mainlistid:S,planid:y,appointment_type:k.appointment_type,dotype:o,do_user:k.do_user,is_emergency:o==111?1:null});n.status?((((N=n.data)==null?void 0:N.mainlistids)||S).forEach(I=>{var b;const R=p.value.find(T=>T.id===I);if(R){const T=(R.period_begin_time?R.period_begin_time.substring(0,5):"")+"-"+(R.period_end_time?R.period_end_time.substring(0,5):"");i.push({name:R.entrust,room:((b=R.department_resources)==null?void 0:b.department_resources_name)||"",date:R.reservation_date||"",time:T}),a.push(R.entrust_id)}}),((x=(P=n.data)==null?void 0:P.fail_items)==null?void 0:x.length)>0&&n.data.fail_items.forEach(I=>{l.push({name:I.name,msg:I.reason})})):S.forEach(m=>{const I=p.value.find(R=>R.id===m);I&&l.push({name:I.entrust,msg:n.msg})})}catch{S.forEach(m=>{const I=p.value.find(R=>R.id===m);I&&l.push({name:I.entrust,msg:"请求异常"})})}}H.value=!1;let r='';r+='';let g=1;i.forEach(u=>{r+=''}),l.forEach(u=>{r+='"}),r+="
序号项目名称检查室日期时间段结果
'+g+++''+u.name+''+u.room+''+u.date+''+u.time+'预约成功
'+g+++''+u.name+''+u.msg+"
",De.value=r,te.value=!0,i.length>0&&(Me(()=>{var n;X.value=!1;const u=[...L.value],y=p.value.filter(m=>m.list_status===0&&m.tishi_msg==="");if(y.length===0)u.forEach(m=>{const I=p.value.find(R=>R.id===m);I&&q.value.toggleRowSelection(I,!0)});else{q.value.clearSelection();const m=new Set(y.map(I=>{var R;return(R=I.department_resources)==null?void 0:R.department_resources_name}).filter(Boolean));p.value.forEach(I=>{var R;I.tishi_msg===""&&(I.list_status===0||m.has((R=I.department_resources)==null?void 0:R.department_resources_name))&&q.value.toggleRowSelection(I,!0)})}if(X.value=!0,p.value.forEach(m=>{e[m.id]&&(console.log("回填 temp_plan_id:",m.id,e[m.id].temp_plan_id),m.temp_plan_id=e[m.id].temp_plan_id,m.department_resources||(m.department_resources={}),m.department_resources.department_resources_name=e[m.id].department_resources_name,m.reservation_date=e[m.id].reservation_date,m.period_begin_time=e[m.id].period_begin_time,m.period_end_time=e[m.id].period_end_time)}),console.log("回填后 entrustTableDate:",JSON.parse(JSON.stringify(p.value.map(m=>({id:m.id,temp_plan_id:m.temp_plan_id,list_status:m.list_status}))))),setTimeout(()=>{console.log("延迟检查 temp_plan_id:",JSON.parse(JSON.stringify(p.value.map(m=>({id:m.id,temp_plan_id:m.temp_plan_id,list_status:m.list_status})))))},2e3),h.value.length>0){const m=(n=h.value[0].department_resources)==null?void 0:n.department_resources_name;m&&(O.value=m)}h.value.some(m=>m.list_status===0)||se(),oe.value.length>0&&Ue(a)},!0),Ee.value.forEach((u,y)=>{u.label=="开启申请单pdf"&&u.value}))},St=()=>{_e.confirm("确定取消预约吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{const o={};p.value.forEach(t=>{var s;!L.value.includes(t.id)&&t.temp_plan_id&&(o[t.id]={temp_plan_id:t.temp_plan_id,department_resources_name:(s=t.department_resources)==null?void 0:s.department_resources_name,reservation_date:t.reservation_date,period_begin_time:t.period_begin_time,period_end_time:t.period_end_time})});const e=h.value.map(t=>{var s;return{id:t.id,entrust_id:t.entrust_id,department_resources_name:((s=t.department_resources)==null?void 0:s.department_resources_name)||"",date:t.reservation_date||"",begin_time:t.period_begin_time||"",end_time:t.period_end_time||""}});ie.value=!0;const d=await Lt({ids:h.value.map(t=>t.id),reg_num:h.value[0].reg_num,do_user:k.do_user});d.status?(G.success("取消成功"),ie.value=!1,Me(()=>{p.value.forEach(s=>{o[s.id]&&(s.temp_plan_id=o[s.id].temp_plan_id,s.department_resources||(s.department_resources={}),s.department_resources.department_resources_name=o[s.id].department_resources_name,s.reservation_date=o[s.id].reservation_date,s.period_begin_time=o[s.id].period_begin_time,s.period_end_time=o[s.id].period_end_time)});const t=e;if(t.length>0){const s=p.value.filter(i=>!t.find(l=>l.id===i.id)&&i.list_status===0&&i.temp_plan_id).map(i=>i.temp_plan_id);ve({type:"optimal_time",regnum:k.reg_num,entrustid:t.map(i=>i.entrust_id),episodeid:k.episode_id,appointment_type:k.appointment_type,items:t,occupied_plan_ids:s,scope:k.scope,do_user:k.do_user}).then(i=>{i.status&&i.data.length>0&&(i.data.forEach(l=>{const a=p.value.find(r=>r.id===l.id);a&&(a.department_resources||(a.department_resources={}),a.department_resources.department_resources_name=l.department_resources_name,a.reservation_date=l.date,a.period_begin_time=l.begin_time,a.period_end_time=l.end_time,a.temp_plan_id=l.plan_id)}),O.value=i.data[0].department_resources_name,ee.value=i.data.map(l=>l.plan_id),$.value=i.data[0].plan_id)})}},!0)):(G.error(d.msg||"取消失败"),ie.value=!1)})},Et=()=>{Ut({config_arrs:["开启申请单pdf","医生端打印"]}).then(o=>{o.status&&(Ee.value=o.data.list,Ee.value.forEach((e,d)=>{console.log(k.appointment_type),e.label=="医生端打印"&&e.value==="0"&&k.appointment_type==1&&(oe.value=[])}))})},Ue=o=>{const e=o||J.value,d=h.value.filter(i=>e.includes(i.entrust_id)&&i.list_status!=1);if(d.length>0){const i={0:"未预约",2:"登记",3:"完成"};be.value=d.map(l=>({item_name:l.entrust,msg:i[l.list_status]||"未知状态"})),ne.value=!0;return}const s="https://yj.dev.cjy.net.cn/api/GetCheckPdf?Dev=1&Type=group&"+e.map(i=>"OrderNoList[]="+i).join("&");fetch(s).then(i=>i.blob()).then(i=>{const l=URL.createObjectURL(i),a=document.createElement("iframe");a.style.display="none",a.src=l,a.onload=()=>{a.contentWindow.print(),URL.revokeObjectURL(l)},document.body.appendChild(a)})},Ct=()=>{O.value="",ae.value=Ve(ue.value),console.log(ae.value),se()};function Dt(o){const e=o.getFullYear(),d=String(o.getMonth()+1).padStart(2,"0"),t=String(o.getDate()).padStart(2,"0");return`${e}-${d}-${t}`}function Ve(o=new Date,e=15){const d=new Date(o),t=[];if(isNaN(d.getTime()))throw new Error("无效的日期格式");for(let s=0;s15}function et(){const o=new Date,e=o.getFullYear(),d=String(o.getMonth()+1).padStart(2,"0"),t=String(o.getDate()).padStart(2,"0");return`${e}-${d}-${t}`}let je=v(!1);return Mt(()=>{je.value=!0,Et(),ae.value=Ve(),Me(()=>{h.value.some(e=>e.list_status===0)||se()})}),(o,e)=>{var S;const d=K("el-alert"),t=K("el-table-column"),s=K("el-tag"),i=K("el-table"),l=K("el-button"),a=K("el-checkbox"),r=K("el-checkbox-group"),g=K("el-tooltip"),N=K("el-date-picker"),P=K("el-empty"),x=K("el-dialog"),u=K("el-icon"),y=Vt("loading");return w(),z("div",jt,[c(j)?(w(),z("div",Ht,[D("div",Jt,[D("span",Ft,V(c(j).user_name),1),M("("+V(c(j).user_sex_label)+" "+V(c(j).age)+"岁)",1)]),D("div",Gt,[M(V(c(j).patient_type_label)+"号:",1),D("span",At,V(c(j).patient_type==0?(S=c(j).episodeid)==null?void 0:S.slice(-10):c(j).reg_num),1)]),D("div",qt,[e[22]||(e[22]=M("电话:",-1)),D("span",Wt,V(c(j).user_phone),1)]),c(j).warddesc?(w(),z("div",Zt,[e[23]||(e[23]=M("病区:",-1)),D("span",Kt,V(c(j).warddesc),1)])):B("",!0),c(j).bedno?(w(),z("div",Qt,[e[24]||(e[24]=M("床号:",-1)),D("span",Xt,V(c(j).bedno),1)])):B("",!0),c(j).diagnosisName?(w(),z("div",ed,[e[25]||(e[25]=M("诊断:",-1)),D("span",td,V(c(j).diagnosisName),1)])):B("",!0)])):(w(),z("div",dd," 获取患者信息失败 ")),rt.value?(w(),A(d,{key:2,type:"danger",closable:!1,"show-icon":"",style:{"margin-bottom":"8px"}},{title:_(()=>[...e[26]||(e[26]=[D("span",{style:{"font-weight":"700",color:"#f56c6c"}},"患者所有检查项目未预约至同一天,请注意是否需手动调整预约",-1)])]),_:1})):B("",!0),c(Oe)?(w(),A(d,{key:3,type:"warning",closable:!1,"show-icon":"",style:{"margin-bottom":"8px"}},{title:_(()=>[D("span",nd,V(c(Oe)),1)]),_:1})):B("",!0),c($e)?(w(),A(d,{key:4,type:"warning",closable:!1,"show-icon":"",style:{"margin-bottom":"8px"}},{title:_(()=>[D("span",ad,V(c($e)),1)]),_:1})):B("",!0),D("div",sd,[dt((w(),A(i,{data:c(p),style:{width:"100%"},"row-key":"id",ref_key:"entrustTableRef",ref:q,"row-class-name":ct,onSelectionChange:ut},{default:_(()=>[f(t,{type:"selection",width:"36",selectable:ft}),f(t,{prop:"tishi_msg",width:"200"},{header:_(()=>[D("div",null,[D("div",null,"共 "+V(c(p).length)+" 项,已选 "+V(c(L).length)+" 项",1),Ze.value>0?(w(),z("div",id,"同检查室项目 "+V(Ze.value)+" 项",1)):B("",!0)])]),default:_(n=>[D("span",ld,V(n.$index+1),1),n.row.tishi_msg!=""?(w(),z("span",od,V(n.row.tishi_msg),1)):(w(),z("span",rd,"正常"))]),_:1}),f(t,{prop:"list_status",label:"预约状态",width:"80"},{default:_(n=>[n.row.list_status===0?(w(),A(s,{key:0,class:"ml-2",type:"info"},{default:_(()=>[...e[27]||(e[27]=[M("未预约",-1)])]),_:1})):B("",!0),n.row.list_status===1?(w(),A(s,{key:1,class:"ml-2",type:"success"},{default:_(()=>[...e[28]||(e[28]=[M("已预约",-1)])]),_:1})):B("",!0),n.row.list_status===2?(w(),A(s,{key:2,class:"ml-2"},{default:_(()=>[...e[29]||(e[29]=[M("登记",-1)])]),_:1})):B("",!0),n.row.list_status===3?(w(),A(s,{key:3,class:"ml-2",type:"warning"},{default:_(()=>[...e[30]||(e[30]=[M("完成",-1)])]),_:1})):B("",!0)]),_:1}),f(t,{label:"项目","show-overflow-tooltip":""},{default:_(n=>[M(V(n.row.entrust)+V(n.row.requestComment?"("+n.row.requestComment+")":""),1)]),_:1}),f(t,{prop:"is_pay",label:"是否交费",width:"60",align:"center"},{default:_(n=>[n.row.is_pay==1?(w(),z("span",pd,"是")):B("",!0),n.row.is_pay==0?(w(),z("span",ud,"否")):B("",!0)]),_:1}),f(t,{prop:"his_is_emergency",label:"是否加急",width:"60",align:"center"},{default:_(n=>[n.row.his_is_emergency==1?(w(),z("span",_d,"是")):B("",!0),n.row.his_is_emergency==0?(w(),z("span",md,"否")):B("",!0)]),_:1}),f(t,{prop:"department_resources.department_resources_name",label:"排班",width:"220"}),f(t,{prop:"reservation_date",label:"预约日期",width:"120"}),f(t,{prop:"check_begin_time",label:"预约时间",width:"120"},{default:_(n=>[n.row.period_begin_time&&n.row.period_end_time?(w(),z("span",cd,V(n.row.period_begin_time.substring(0,5))+"~"+V(n.row.period_end_time.substring(0,5)),1)):B("",!0)]),_:1}),f(t,{prop:"limosis",label:"是否空腹",width:"60",align:"center"},{default:_(n=>[n.row.limosis==0?(w(),z("span",fd,"否")):(w(),z("span",gd,"是"))]),_:1}),f(t,{prop:"reservation_department",label:"申请科室",width:"150"}),f(t,{prop:"",label:"医嘱时间",width:"200"},{default:_(n=>[M(V(n.row.entrust_date)+" "+V(n.row.entrust_time),1)]),_:1}),f(t,{prop:"docotr",label:"申请医生",width:"80"})]),_:1},8,["data"])),[[y,c(ie)]])]),D("div",xd,[D("div",hd,[D("div",bd,[(w(!0),z(ze,null,Pe(c(pe),(n,m)=>(w(),z("div",{key:m,class:nt({"ZhenShiButton zhenshiButton_active":c(O)===n,ZhenShiButton:c(O)!==n}),onClick:I=>xt(n)},V(n),11,yd))),128)),e[41]||(e[41]=D("div",{class:"shuxian"},null,-1)),Ke.value?(w(),A(l,{key:0,class:"do_button",type:"danger",onClick:e[0]||(e[0]=n=>Le(111))},{default:_(()=>[...e[31]||(e[31]=[M("加急预约",-1)])]),_:1})):B("",!0),f(l,{class:"do_button",type:"success",onClick:e[1]||(e[1]=n=>Le(1))},{default:_(()=>[...e[32]||(e[32]=[M("预约",-1)])]),_:1}),f(l,{class:"do_button",type:"warning",onClick:e[2]||(e[2]=n=>Le(2))},{default:_(()=>[...e[33]||(e[33]=[M("更改预约时间",-1)])]),_:1}),f(l,{class:"do_button",type:"danger",onClick:e[3]||(e[3]=n=>St())},{default:_(()=>[...e[34]||(e[34]=[M("取消预约",-1)])]),_:1}),f(l,{onClick:e[4]||(e[4]=n=>Ue())},{default:_(()=>[...e[35]||(e[35]=[M("打印申请单",-1)])]),_:1}),D("div",vd,[f(r,{modelValue:c(oe),"onUpdate:modelValue":e[5]||(e[5]=n=>F(oe)?oe.value=n:oe=n)},{default:_(()=>[f(a,{label:"1"},{default:_(()=>[...e[36]||(e[36]=[M("预约完成后打印申请单",-1)])]),_:1})]),_:1},8,["modelValue"]),f(g,{placement:"top",content:Ud,"popper-class":"tip-pre-line"},{default:_(()=>[f(a,{modelValue:c(fe),"onUpdate:modelValue":e[6]||(e[6]=n=>F(fe)?fe.value=n:fe=n)},{default:_(()=>[...e[37]||(e[37]=[M("自动选中能一起预约的检查项目",-1)])]),_:1},8,["modelValue"])]),_:1})]),f(g,{placement:"top",content:"点击此按钮,系统会推荐最近能用的时间段号源,多个检查项目可能会跨天跨时间段","popper-class":"tip-pre-line"},{default:_(()=>[f(l,{class:"do_button_recommend",type:"primary",style:{"margin-left":"20px",width:"120px"},onClick:bt},{default:_(()=>[...e[38]||(e[38]=[M("推荐最近时间号源",-1)])]),_:1})]),_:1}),f(g,{placement:"top",content:"点击此按钮,系统会推荐最近的能在同一天完成检查的号源","popper-class":"tip-pre-line"},{default:_(()=>[f(l,{class:"do_button_recommend",type:"primary",style:{width:"120px"},onClick:yt},{default:_(()=>[...e[39]||(e[39]=[M("推荐同一天号源",-1)])]),_:1})]),_:1}),f(g,{placement:"top",content:"点击此按钮,系统会推荐最近的能在同一天同一时间段完成检查的号源","popper-class":"tip-pre-line"},{default:_(()=>[f(l,{class:"do_button_recommend",type:"primary",onClick:vt},{default:_(()=>[...e[40]||(e[40]=[M("推荐同一天同一时间段号源",-1)])]),_:1})]),_:1})]),D("div",null,[f(N,{modelValue:c(ue),"onUpdate:modelValue":e[7]||(e[7]=n=>F(ue)?ue.value=n:ue=n),type:"date",placeholder:"跳转日期",onChange:e[8]||(e[8]=n=>Ct())},null,8,["modelValue"])])]),dt((w(),z("div",wd,[D("table",kd,[c(h).length>0?(w(),z("tr",Sd,[e[42]||(e[42]=D("td",{style:{width:"120px"}},null,-1)),(w(!0),z(ze,null,Pe(c(ae),(n,m)=>(w(),z("td",Ed,V(n.substring(5,10))+" "+V(ot(n)),1))),256))])):B("",!0),c(ae).length>0&&c(re).length>0?(w(!0),z(ze,{key:1},Pe(c(re),(n,m)=>(w(),z("tr",{key:m,class:"table_plan_row"},[(w(!0),z(ze,null,Pe(n,(I,R)=>(w(),z("td",{key:R,class:nt({planActive:c(ee).includes(I.id)&&I.id!==0&&I.id,plandisable:!I.enable&&R!=="time_range"}),onClick:b=>ht(I.id)},[R=="time_range"?(w(),z("span",Dd,V(I),1)):B("",!0),D("span",null,V(I.use_count),1)],10,Cd))),128))]))),128)):B("",!0)]),c(h).length==0?(w(),z("div",Id,[f(P,{description:"请选择项目"})])):B("",!0),c(h).length>0&&c(re).length==0?(w(),z("div",Td,[f(P,{description:"暂无号源"})])):B("",!0)])),[[y,c(H)]])]),f(x,{modelValue:c(ne),"onUpdate:modelValue":e[10]||(e[10]=n=>F(ne)?ne.value=n:ne=n),title:"提示",width:"500"},{footer:_(()=>[D("div",Nd,[f(l,{type:"primary",onClick:e[9]||(e[9]=n=>F(ne)?ne.value=!1:ne=!1)},{default:_(()=>[...e[43]||(e[43]=[M(" 确定 ",-1)])]),_:1})])]),default:_(()=>[e[44]||(e[44]=D("div",{style:{"margin-bottom":"12px","font-weight":"700",color:"#f56c6c"}},"以下检查暂不可打印申请单",-1)),f(i,{data:c(be),style:{width:"100%"},"row-key":"id"},{default:_(()=>[f(t,{prop:"item_name",label:"项目名称"}),f(t,{prop:"msg",label:"异常提示"})]),_:1},8,["data"])]),_:1},8,["modelValue"]),f(x,{modelValue:c(Q),"onUpdate:modelValue":e[12]||(e[12]=n=>F(Q)?Q.value=n:Q=n),title:"提示",width:"800"},{footer:_(()=>[f(l,{type:"primary",onClick:e[11]||(e[11]=n=>F(Q)?Q.value=!1:Q=!1)},{default:_(()=>[...e[46]||(e[46]=[M("确定",-1)])]),_:1})]),default:_(()=>[D("div",Md,[f(u,{class:"el-icon-warning",style:{color:"#e6a23c","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Be))]),_:1}),D("div",null,[e[45]||(e[45]=D("p",{style:{margin:"0 0 12px 0","font-weight":"700"}},"最近可用的同一时间段号源数量不足,无法把当前全部检查项目预约在同一时间段,系统已经自动拆分。",-1)),D("div",{innerHTML:c(ge)},null,8,Vd)])])]),_:1},8,["modelValue"]),f(x,{modelValue:c(le),"onUpdate:modelValue":e[14]||(e[14]=n=>F(le)?le.value=n:le=n),title:"时段冲突",width:"800"},{footer:_(()=>[f(l,{type:"primary",onClick:e[13]||(e[13]=n=>F(le)?le.value=!1:le=!1)},{default:_(()=>[...e[48]||(e[48]=[M("我知道了",-1)])]),_:1})]),default:_(()=>[D("div",Rd,[f(u,{style:{color:"#F56C6C","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Be))]),_:1}),D("div",null,[e[47]||(e[47]=D("p",{style:{margin:"0 0 12px 0","font-weight":"700"}}," 以下项目与当前选择的时间段存在冲突,请确认是否继续预约: ",-1)),D("div",{innerHTML:c(Fe)},null,8,zd)])])]),_:1},8,["modelValue"]),f(x,{modelValue:c(te),"onUpdate:modelValue":e[16]||(e[16]=n=>F(te)?te.value=n:te=n),title:"预约结果",width:"800"},{footer:_(()=>[f(l,{type:"primary",onClick:e[15]||(e[15]=n=>F(te)?te.value=!1:te=!1)},{default:_(()=>[...e[49]||(e[49]=[M("确定",-1)])]),_:1})]),default:_(()=>[D("div",Pd,[f(u,{style:{color:"#e6a23c","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Be))]),_:1}),D("div",{innerHTML:c(De)},null,8,Bd)])]),_:1},8,["modelValue"]),f(x,{modelValue:c(de),"onUpdate:modelValue":e[18]||(e[18]=n=>F(de)?de.value=n:de=n),title:"预约推荐结果",width:"800"},{footer:_(()=>[f(l,{type:"primary",onClick:e[17]||(e[17]=n=>F(de)?de.value=!1:de=!1)},{default:_(()=>[...e[50]||(e[50]=[M("确定",-1)])]),_:1})]),default:_(()=>[D("div",Yd,[f(u,{style:{color:"#e6a23c","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Be))]),_:1}),D("div",{innerHTML:c(Ie)},null,8,Od)])]),_:1},8,["modelValue"]),f(x,{modelValue:c(Z),"onUpdate:modelValue":e[21]||(e[21]=n=>F(Z)?Z.value=n:Z=n),title:"预约确认",width:"800","close-on-click-modal":!1,onKeyup:zt(We,["enter"])},{footer:_(()=>[c(Te)?B("",!0):(w(),A(l,{key:0,onClick:e[19]||(e[19]=n=>F(Z)?Z.value=!1:Z=!1)},{default:_(()=>[...e[54]||(e[54]=[M("取消",-1)])]),_:1})),c(Te)?B("",!0):(w(),A(l,{key:1,type:"primary",onClick:We},{default:_(()=>[...e[55]||(e[55]=[M("确认",-1)])]),_:1})),c(Te)?(w(),A(l,{key:2,type:"primary",onClick:e[20]||(e[20]=n=>F(Z)?Z.value=!1:Z=!1)},{default:_(()=>[...e[56]||(e[56]=[M("确认",-1)])]),_:1})):B("",!0)]),default:_(()=>[c(Ae)?(w(),A(d,{key:0,type:"warning",closable:!1,"show-icon":"",style:{"margin-bottom":"12px"}},{title:_(()=>[...e[51]||(e[51]=[M("医嘱选择的执行科室与预约选择的执行科室不一致,请确认。",-1)])]),_:1})):B("",!0),f(i,{data:c(Ge),style:{width:"100%"},"max-height":"400","row-class-name":lt},{default:_(()=>[f(t,{prop:"item_name",label:"项目名称","min-width":"140"}),f(t,{label:"执行科室","min-width":"180"},{default:_(n=>[D("div",{style:Rt({color:n.row.dept_mismatch?"#f56c6c":"inherit"})},[M(V(n.row.entrust_dept_name)+" ",1),n.row.dept_mismatch?(w(),z("span",$d,"→ "+V(n.row.appointment_dept_name),1)):B("",!0)],4)]),_:1}),f(t,{label:"检查时间","min-width":"160"},{default:_(n=>{var m,I;return[D("div",null,V(n.row.appointment_date)+" "+V((m=n.row.begin_time)==null?void 0:m.substring(0,5))+"-"+V((I=n.row.end_time)==null?void 0:I.substring(0,5)),1),n.row.check_status==="fail"?(w(),z("div",Ld,V(n.row.check_msg),1)):B("",!0)]}),_:1}),f(t,{label:"校验结果",width:"80"},{default:_(n=>[n.row.check_status==="pass"?(w(),A(s,{key:0,type:"success"},{default:_(()=>[...e[52]||(e[52]=[M("通过",-1)])]),_:1})):(w(),A(s,{key:1,type:"danger"},{default:_(()=>[...e[53]||(e[53]=[M("失败",-1)])]),_:1}))]),_:1})]),_:1},8,["data"])]),_:1},8,["modelValue"])])}}},Jd=Nt(jd,[["__scopeId","data-v-3deb4bde"]]);export{Jd as Y};