2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{o as at,W as Nt,M as I,ap as Et,aq as St,q as i,r as c,s as a,v as l,D as r,u as T,ce as xt,w as Vt,L as k,bp as Mt,cw as $t,bn as It,bm as Tt,bA as et,b8 as Ct,b7 as Dt,K as At,cx as Rt,cl as Pt,F as z,G as nt,O as C,bb as Bt,T as p,bc as Ut,P as N,ac as Yt,bi as zt,bk as Lt,ae as G,br as Ft,bX as Ot,ba as qt,p as D,bj as Gt,bB as Kt}from"./.pnpm-BGZW0UGg.js";import{d as K}from"./dayjs-BnultS00.js";import{f as jt,a as st}from"./doctor-CF92xvl4.js";import{u as Wt,_ as Ht}from"./index-CeIwrh_6.js";const Xt={class:"dp-page"},Zt={class:"dp-glass dp-toolbar"},Jt={class:"dp-toolbar-row"},Qt={class:"dp-field-label"},wt={class:"dp-field-label"},te={class:"dp-field-label"},ee={class:"dp-toolbar-actions"},ne={key:0,class:"dp-glass dp-doc-section"},se={class:"dp-section-head"},ae={class:"dp-glass dp-table-wrap"},le={class:"dp-table-head"},oe={class:"dp-table-head-left"},ie={key:0,class:"dp-table-range"},de={class:"dp-table-badges"},ue={key:0,class:"dp-chip dp-chip--account"},re={key:1,class:"dp-chip dp-chip--doc"},ce={key:2,class:"dp-chip dp-chip--count"},pe={key:3,class:"dp-chip dp-chip--muted"},me={class:"dp-my-patients-eta"},_e={class:"dp-cell-user-body"},fe={class:"dp-avatar"},ve={class:"dp-user-meta"},be={class:"dp-user-name"},ge={class:"dp-user-phone"},he={class:"dp-time"},ye={class:"dp-steps"},ke={class:"dp-step-dot"},Ne={class:"dp-step-text"},Ee={class:"dp-step-name"},Se={key:0,class:"dp-step-hint"},xe={key:1,class:"dp-muted"},Ve={key:1,class:"dp-muted"},Me=at({name:"doctorProgress"}),$e=at({...Me,setup(Ie){const lt=Nt(),j=Wt(),A=I(!1),E=I([]),f=I(void 0),S=I([]),R=()=>K().format("YYYY-MM-DD"),h=I([R(),R()]),v=qt({status:"",patient_name:""}),W=D(()=>{const e=f.value;if(e===void 0)return"";const t=E.value.find(n=>Number(n.id)===e);return t?String(t.name||t.account||""):""}),ot=D(()=>{var t;const e=(t=j.userInfo)==null?void 0:t.id;return e!=null&&e!==""?Number(e):NaN}),H=D(()=>{const e=j.userInfo||{};return String(e.name||e.account||"").trim()});function L(e){const t=ot.value;if(Number.isNaN(t))return!1;const n=e==null?void 0:e.assistant_id;return n==null||n===""?!1:Number(n)===t}const it=15,X=I(0);let P=null;function Z(e){const t=String(e.appointment_date||"");let n=e.appointment_time||"";return typeof n=="string"&&n.length>5&&(n=n.slice(0,5)),`${t} ${n}`.trim()}function dt(e){const t=e.appointment_date;if(!t)return null;let n=e.appointment_time||"00:00";typeof n=="string"&&n.length>5&&(n=n.slice(0,5));const o=K(`${t} ${n}`);return o.isValid()?o:null}function J(e){const t=Math.max(0,Math.round(e));if(t===0)return"不到 1 分钟";if(t<60)return`${t} 分钟`;const n=Math.floor(t/60),o=t%60;return o===0?`${n} 小时`:`${n} 小时${o} 分钟`}function ut(e){if(X.value,!L(e))return"";const t=Number(e.status);if(t===3)return"面诊已完成(医生已点完成)";if(t===4)return"已过号,无法按序预估";if(t!==1)return"";const n=K(),o=dt(e),d=o?o.isAfter(n):!1,m=d&&o?Math.max(0,o.diff(n,"minute")):0,y=S.value.filter(u=>u.appointment_date===e.appointment_date&&Number(u.status)===1).slice().sort((u,M)=>{const Y=Z(u).localeCompare(Z(M));return Y!==0?Y:Number(u.id)-Number(M.id)}).findIndex(u=>Number(u.id)===Number(e.id)),b=y>=0?y:0,V=b*it,_=[];return d&&_.push(`距预约时段还有约 ${J(m)}`),b===0?_.push(d?"到号后可优先安排面诊":"已到号,可尽快面诊"):_.push(`前面约 ${b} 人,按序粗估约 ${J(V)}`),_.join(";")}function Q(){const e=v.status;return e===""||e===void 0||e===null}const B=D(()=>Q()?S.value.filter(e=>Number(e.status)===3).length:0),F=D(()=>Q()?S.value.filter(e=>Number(e.status)!==3):S.value),rt=D(()=>B.value>0&&F.value.length===0?`本时段有 ${B.value} 条「已完成」已隐藏,可在状态中选择「已完成」查看`:"该时段内暂无挂号");function ct(e){const t=String(e||"?").trim();return t?t[0]:"?"}function pt(e){const t=e.appointment_date||"";let n=e.appointment_time||"";return typeof n=="string"&&n.length>5&&(n=n.slice(0,5)),t?`${t} ${n}`.trim():"—"}function mt(e){return e===3?"success":e===4?"warning":e===2?"info":"primary"}function w(e){const t=Number(e.status)===2,n=!t&&[1,3,4].includes(Number(e.status)),o=!!e.diagnosis_confirmed,d=Number(e.status)===3,m=!!e.has_prescription;return[{label:"挂号",done:n,current:n&&!o&&Number(e.status)===1,hint:t?"已取消":Number(e.status)===4?"已过号":""},{label:"确认诊单",done:o,current:n&&!o,hint:""},{label:"就诊中",done:d,current:n&&o&&!d&&Number(e.status)===1,hint:Number(e.status)===1&&o?"待完诊":""},{label:"开方",done:m,current:d&&!m,hint:""}]}function _t(e){const n=w(e).filter(o=>o.done).length;return Math.round(n/4*100)}const O=2e3,ft=15e3;let U=null;async function vt(){const e=await jt({role_id:1,page_type:0,page_no:1,progress_board:1});if(E.value=(e==null?void 0:e.lists)||[],!E.value.length){f.value=void 0,S.value=[];return}const t=E.value.some(n=>Number(n.id)===f.value);(f.value===void 0||!t)&&(f.value=Number(E.value[0].id))}async function x(e){var n,o;if(f.value===void 0){S.value=[];return}const t=(e==null?void 0:e.silent)===!0;t||(A.value=!0);try{const d={doctor_id:f.value,page_type:1,page_no:1,page_size:O,prescription_today_only:1,exclude_cancelled:1,progress_board:1};((n=h.value)==null?void 0:n.length)===2&&(d.start_date=h.value[0],d.end_date=h.value[1]),v.status!==""&&(d.status=v.status),(o=v.patient_name)!=null&&o.trim()&&(d.patient_name=v.patient_name.trim());const m=await st(d);let g=(m==null?void 0:m.lists)||[];const y=Number((m==null?void 0:m.count)??g.length);if(y>g.length&&g.length>=O){const b=[],V=Math.min(Math.ceil(y/O),20);for(let _=2;_<=V;_++){const u=await st({...d,page_no:_}),M=(u==null?void 0:u.lists)||[];if(!M.length)break;b.push(...M)}g=[...g,...b]}S.value=[...g].sort((b,V)=>{const _=`${b.appointment_date||""} ${b.appointment_time||""}`,u=`${V.appointment_date||""} ${V.appointment_time||""}`;return _.localeCompare(u)})}catch(d){console.error(d),t||(S.value=[])}finally{t||(A.value=!1)}}function bt(){typeof document<"u"&&document.hidden||x({silent:!0}).catch(()=>{})}function gt(){v.status="",v.patient_name="",h.value=[R(),R()],x()}function ht(e){lt.push({path:"/tcm/diagnosis",query:{id:String(e)}})}return Et(async()=>{await vt(),await x(),U=setInterval(bt,ft),P=setInterval(()=>{X.value+=1},6e4)}),St(()=>{U!=null&&(clearInterval(U),U=null),P!=null&&(clearInterval(P),P=null)}),(e,t)=>{var tt;const n=Vt,o=Mt,d=It,m=Tt,g=Dt,y=At,b=Bt,V=Ut,_=Kt,u=Lt,M=Ft,Y=Ot,yt=Gt,kt=zt;return i(),c("div",Xt,[a("section",Zt,[a("div",Jt,[a("span",Qt,[l(n,null,{default:r(()=>[l(T(xt))]),_:1}),t[9]||(t[9]=k(" 预约日期 ",-1))]),l(o,{modelValue:h.value,"onUpdate:modelValue":t[0]||(t[0]=s=>h.value=s),type:"daterange","range-separator":"—","start-placeholder":"开始","end-placeholder":"结束","value-format":"YYYY-MM-DD","unlink-panels":"",class:"dp-field-date",onChange:t[1]||(t[1]=()=>x())},null,8,["modelValue"]),a("span",wt,[l(n,null,{default:r(()=>[l(T($t))]),_:1}),t[10]||(t[10]=k(" 状态 ",-1))]),l(m,{modelValue:v.status,"onUpdate:modelValue":t[2]||(t[2]=s=>v.status=s),placeholder:"全部",clearable:"",class:"dp-field-select",onChange:t[3]||(t[3]=()=>x())},{default:r(()=>[l(d,{label:"全部状态",value:""}),l(d,{label:"已预约(待就诊)",value:"1"}),l(d,{label:"已完成",value:"3"}),l(d,{label:"已过号",value:"4"})]),_:1},8,["modelValue"]),a("span",te,[l(n,null,{default:r(()=>[l(T(et))]),_:1}),t[11]||(t[11]=k(" 患者 ",-1))]),l(g,{modelValue:v.patient_name,"onUpdate:modelValue":t[4]||(t[4]=s=>v.patient_name=s),placeholder:"姓名",clearable:"",class:"dp-field-search",onKeyup:t[5]||(t[5]=Ct(()=>x(),["enter"]))},null,8,["modelValue"]),a("div",ee,[l(y,{type:"primary",loading:A.value,icon:T(et),onClick:t[6]||(t[6]=()=>x())},{default:r(()=>[...t[12]||(t[12]=[k(" 查询 ",-1)])]),_:1},8,["loading","icon"]),l(y,{icon:T(Rt),onClick:gt},{default:r(()=>[...t[13]||(t[13]=[k("重置",-1)])]),_:1},8,["icon"])])])]),E.value.length?(i(),c("section",ne,[a("div",se,[l(n,{class:"dp-section-icon"},{default:r(()=>[l(T(Pt))]),_:1}),t[14]||(t[14]=a("span",{class:"dp-section-title"},"选择医生",-1)),t[15]||(t[15]=a("span",{class:"dp-section-hint"},"切换后自动加载该医生挂号",-1))]),l(V,{modelValue:f.value,"onUpdate:modelValue":t[7]||(t[7]=s=>f.value=s),class:"dp-doc-pills",onChange:t[8]||(t[8]=()=>x())},{default:r(()=>[(i(!0),c(z,null,nt(E.value,s=>(i(),C(b,{key:s.id,label:Number(s.id),class:"dp-doc-pill"},{default:r(()=>[k(p(s.name||s.account||"—"),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):N("",!0),Yt((i(),c("section",ae,[a("div",le,[a("div",oe,[t[16]||(t[16]=a("span",{class:"dp-table-title"},"患者列表",-1)),((tt=h.value)==null?void 0:tt.length)===2?(i(),c("span",ie,p(h.value[0])+" ~ "+p(h.value[1]),1)):N("",!0)]),a("div",de,[H.value?(i(),c("span",ue,"当前账号 "+p(H.value),1)):N("",!0),W.value?(i(),c("span",re,p(W.value),1)):N("",!0),f.value!==void 0&&!A.value?(i(),c("span",ce,p(F.value.length)+" 人",1)):N("",!0),B.value>0?(i(),c("span",pe,"已隐藏已完成 "+p(B.value),1)):N("",!0)])]),E.value.length?f.value===void 0?(i(),C(_,{key:1,description:"请选择医生"})):(i(),C(yt,{key:2,data:F.value,class:"dp-table",size:"default","empty-text":rt.value},{default:r(()=>[l(u,{label:"患者","min-width":"200",fixed:"left"},{default:r(({row:s})=>[a("div",{class:G(["dp-cell-user",{"is-my-patients":L(s)}])},[L(s)?(i(),c(z,{key:0},[t[17]||(t[17]=a("div",{class:"dp-my-patients-caption"},"我的患者",-1)),a("div",me,p(ut(s)),1)],64)):N("",!0),a("div",_e,[a("div",fe,p(ct(s.patient_name)),1),a("div",ve,[a("span",be,p(s.patient_name||"—"),1),a("span",ge,p(s.patient_phone||"—"),1)])])],2)]),_:1}),l(u,{label:"预约时间",width:"170"},{default:r(({row:s})=>[a("span",he,p(pt(s)),1)]),_:1}),l(u,{label:"挂号",width:"104",align:"center"},{default:r(({row:s})=>[l(M,{type:mt(s.status),effect:"light",round:"",size:"small"},{default:r(()=>[k(p(s.status_desc),1)]),_:2},1032,["type"])]),_:1}),l(u,{label:"面诊进度","min-width":"360"},{default:r(({row:s})=>[a("div",ye,[(i(!0),c(z,null,nt(w(s),($,q)=>(i(),c(z,{key:q},[a("div",{class:G(["dp-step",{"is-done":$.done,"is-current":$.current&&!$.done}])},[a("div",ke,p(q+1),1),a("div",Ne,[a("span",Ee,p($.label),1),$.hint?(i(),c("span",Se,p($.hint),1)):N("",!0)])],2),q<3?(i(),c("div",{key:0,class:G(["dp-step-line",{"is-done":$.done}])},null,2)):N("",!0)],64))),128))]),l(Y,{percentage:_t(s),"stroke-width":8,class:"dp-progress"},null,8,["percentage"])]),_:1}),l(u,{label:"处方",width:"92",align:"center"},{default:r(({row:s})=>[s.has_prescription?(i(),C(M,{key:0,type:"success",effect:"dark",round:"",size:"small"},{default:r(()=>[...t[18]||(t[18]=[k("已开",-1)])]),_:1})):(i(),c("span",xe,"未开"))]),_:1}),l(u,{label:"操作",width:"96",fixed:"right",align:"center"},{default:r(({row:s})=>[s.diagnosis_id?(i(),C(y,{key:0,type:"primary",size:"small",round:"",plain:"",onClick:$=>ht(s.diagnosis_id)},{default:r(()=>[...t[19]||(t[19]=[k(" 诊单 ",-1)])]),_:1},8,["onClick"])):(i(),c("span",Ve,"—"))]),_:1})]),_:1},8,["data","empty-text"])):(i(),C(_,{key:0,description:"暂无医生数据"}))])),[[kt,A.value]])])}}}),Re=Ht($e,[["__scopeId","data-v-6bc1551c"]]);export{Re as default};
|