Files
2026-09-10 15:23:03 +08:00

2 lines
15 KiB
JavaScript

import{o as J,ap as Se,bo as ke,be as Ce,q as m,r as S,v as l,D as n,b9 as xe,aw as Ee,u as a,b6 as Ue,b7 as De,b8 as W,bm as Ne,F as D,G as N,O as b,bn as Te,K as qe,L as _,bg as Be,s as v,ac as L,T as c,P as F,bj as Fe,bk as Pe,br as Re,bi as Ae,C as M,bp as He,c5 as Ie,bc as Le,bb as Me,bt as $e,ba as $,M as k,p as P}from"./.pnpm-BHOjf1ZS.js";import{_ as Ke}from"./index.vue_vue_type_script_setup_true_lang-CDLrQsa9.js";import{_ as Oe}from"./index.vue_vue_type_script_setup_true_lang-Cmgm_Z5P.js";import{j as g,n as je}from"./index-B31vLELt.js";import{a as Ge,b as Ye,c as Qe}from"./doctor-CI72mqZm.js";import{a as ze}from"./appointment-type-DJT6wPaT.js";import{o as We}from"./tcm-BkYsBTA3.js";import{u as Je}from"./usePaging-oaNM6A9T.js";const Xe={class:"guahao-list"},Ze={class:"flex flex-wrap items-center gap-3 mb-4"},et={key:0,class:"text-sm text-gray-500"},tt={class:"text-sm"},lt={class:"font-medium"},at={class:"text-gray-500"},nt={class:"text-xs text-gray-400"},ot={class:"text-gray-500"},st={class:"text-sm"},it={key:0,class:"text-xs text-gray-400 truncate"},rt={class:"flex justify-end mt-4"},ut={class:"text-sm text-gray-600 mb-4"},dt=J({name:"consumerPrescriptionGuahao"}),Vt=J({...dt,setup(mt){const u=$({start_date:"",end_date:"",patient_name:"",doctor_name:"",assistant_id:void 0,appointment_type:"",status:"",channel_source:""}),X={start_date:"",end_date:"",patient_name:"",doctor_name:"",assistant_id:void 0,appointment_type:"",status:"",channel_source:""},{pager:E,getLists:U,resetPage:T}=Je({fetchFun:Ge,params:u}),q=k([]),K=k(null),h=k([]);function Z(s){h.value=s}const ee=new Set(["自媒体3Q","自媒体3H","自媒体2H","自媒体2Q"]);function B(s){return ee.has(String(s??"").trim())}const y=k([]),te=P(()=>{const s=o.channel_source;if(s===""||s==null)return"";const e=y.value.find(i=>String(i.value)===String(s));return e?String(e.name??"").trim():""}),O=P(()=>B(te.value)),le=P(()=>{const s=p.channel_source;if(s===""||s==null)return"";const e=y.value.find(i=>String(i.value)===String(s));return e?String(e.name??"").trim():""}),j=P(()=>B(le.value));function ae(s){const e=y.value.find(d=>String(d.value)===String(s)),i=e?String(e.name??"").trim():"";B(i)||(p.channel_source_detail="")}const C=k(!1),R=k(!1),p=$({channel_source:"",channel_source_detail:""});function ne(){if(h.value.length===0){g.msgWarning("请先勾选挂号记录");return}p.channel_source="",p.channel_source_detail="",C.value=!0}function oe(){p.channel_source="",p.channel_source_detail=""}async function se(){var s,e;if(h.value.length===0){g.msgWarning("请先勾选挂号记录");return}if(!p.channel_source){g.msgError("请选择渠道来源");return}if(j.value&&!p.channel_source_detail.trim()){g.msgError("请填写自媒体补充说明");return}R.value=!0;try{const i=h.value.map(d=>Number(d.id));await Ye({ids:i,channel_source:p.channel_source,channel_source_detail:p.channel_source_detail.trim()}),g.msgSuccess("批量修改成功"),C.value=!1,(e=(s=K.value)==null?void 0:s.clearSelection)==null||e.call(s),h.value=[],U()}finally{R.value=!1}}function ie(s){const e=y.value.find(d=>String(d.value)===String(s)),i=e?String(e.name??"").trim():"";B(i)||(o.channel_source_detail="")}const x=k(!1),A=k(!1),o=$({id:0,appointment_date:"",appointment_time:"",period:"morning",appointment_type:"video",status:1,remark:"",assistant_id:void 0,channel_source:"",channel_source_detail:""});function re(s){const e=String(s||"");return e.length>=11?e.slice(0,3)+"****"+e.slice(-4):e||"—"}function G(s){const e=String(s||"");return e.length>=5?e.slice(0,5):e||"—"}function ue(){Object.assign(u,X),T()}function de(s){const e=String(s.period??s.type??"morning");return e==="afternoon"||e==="all"?e:"morning"}async function me(){try{const s=await We();q.value=(s==null?void 0:s.lists)??s??[]}catch{q.value=[]}}async function pe(){try{const s=await je({type:"channels"}),e=((s==null?void 0:s.channels)||[]).filter(i=>i.status!==0);e.sort((i,d)=>{const r=Number((d==null?void 0:d.sort)??0)-Number((i==null?void 0:i.sort)??0);return r!==0?r:Number((d==null?void 0:d.id)??0)-Number((i==null?void 0:i.id)??0)}),y.value=e}catch{y.value=[]}}function _e(s){o.id=Number(s.id),o.appointment_date=String(s.appointment_date||""),o.appointment_time=G(String(s.appointment_time||"")),o.period=de(s),o.appointment_type=String(s.appointment_type||"video"),o.status=Number(s.status),o.remark=String(s.remark||"");const e=s.appointment_assistant_id;o.assistant_id=e!=null&&e!==""?Number(e):void 0,o.channel_source=String(s.channel_source??s.channels??""),o.channel_source_detail=String(s.channel_source_detail??""),x.value=!0}function ce(){o.id=0,o.appointment_date="",o.appointment_time="",o.period="morning",o.appointment_type="video",o.status=1,o.remark="",o.assistant_id=void 0,o.channel_source="",o.channel_source_detail=""}async function fe(){if(!o.appointment_date){g.msgError("请选择预约日期");return}if(!o.appointment_time){g.msgError("请选择预约时间");return}if(!o.channel_source){g.msgError("请选择渠道来源");return}if(O.value&&!o.channel_source_detail.trim()){g.msgError("请填写自媒体补充说明");return}A.value=!0;try{const s={id:o.id,appointment_date:o.appointment_date,appointment_time:o.appointment_time,period:o.period,appointment_type:o.appointment_type,status:o.status,remark:o.remark,assistant_id:o.assistant_id??"",channel_source:o.channel_source,channel_source_detail:o.channel_source_detail.trim()};await Qe(s),g.msgSuccess("保存成功"),x.value=!1,U()}finally{A.value=!1}}return Se(()=>{me(),pe()}),ke(()=>{U()}),U(),(s,e)=>{const i=Ue,d=De,r=Te,V=Ne,w=qe,H=xe,Y=Be,f=Pe,be=Re,ve=Fe,ge=Ke,he=He,ye=Ie,I=Me,Ve=Le,Q=$e,z=Ce("perms"),we=Ae;return m(),S("div",Xe,[l(Y,{class:"!border-none",shadow:"never"},{default:n(()=>[l(H,{class:"mb-[-16px]",model:a(u),inline:!0,onSubmit:e[8]||(e[8]=Ee(()=>{},["prevent"]))},{default:n(()=>[l(i,{label:"预约日期"},{default:n(()=>[l(Oe,{startTime:a(u).start_date,"onUpdate:startTime":e[0]||(e[0]=t=>a(u).start_date=t),endTime:a(u).end_date,"onUpdate:endTime":e[1]||(e[1]=t=>a(u).end_date=t)},null,8,["startTime","endTime"])]),_:1}),l(i,{label:"患者姓名"},{default:n(()=>[l(d,{modelValue:a(u).patient_name,"onUpdate:modelValue":e[2]||(e[2]=t=>a(u).patient_name=t),placeholder:"模糊搜索",clearable:"",class:"!w-[160px]",onKeyup:W(a(T),["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),l(i,{label:"医生"},{default:n(()=>[l(d,{modelValue:a(u).doctor_name,"onUpdate:modelValue":e[3]||(e[3]=t=>a(u).doctor_name=t),placeholder:"模糊搜索",clearable:"",class:"!w-[140px]",onKeyup:W(a(T),["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),l(i,{label:"医助"},{default:n(()=>[l(V,{modelValue:a(u).assistant_id,"onUpdate:modelValue":e[4]||(e[4]=t=>a(u).assistant_id=t),placeholder:"全部",clearable:"",filterable:"",class:"!w-[180px]"},{default:n(()=>[(m(!0),S(D,null,N(a(q),t=>(m(),b(r,{key:t.id,label:t.name+(t.account?` (${t.account})`:""),value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"挂号类型"},{default:n(()=>[l(V,{modelValue:a(u).appointment_type,"onUpdate:modelValue":e[5]||(e[5]=t=>a(u).appointment_type=t),placeholder:"全部",clearable:"",class:"!w-[140px]"},{default:n(()=>[l(r,{label:"全部",value:""}),l(r,{label:"视频问诊",value:"video"}),l(r,{label:"图文问诊",value:"text"})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"状态"},{default:n(()=>[l(V,{modelValue:a(u).status,"onUpdate:modelValue":e[6]||(e[6]=t=>a(u).status=t),placeholder:"全部",clearable:"",class:"!w-[130px]"},{default:n(()=>[l(r,{label:"已预约",value:1}),l(r,{label:"已取消",value:2}),l(r,{label:"已完成",value:3}),l(r,{label:"已过号",value:4})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"渠道"},{default:n(()=>[l(V,{modelValue:a(u).channel_source,"onUpdate:modelValue":e[7]||(e[7]=t=>a(u).channel_source=t),placeholder:"全部",clearable:"",filterable:"",class:"!w-[200px]"},{default:n(()=>[(m(!0),S(D,null,N(a(y),t=>(m(),b(r,{key:String(t.value),label:t.name,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(i,null,{default:n(()=>[l(w,{type:"primary",onClick:a(T)},{default:n(()=>[...e[25]||(e[25]=[_("查询",-1)])]),_:1},8,["onClick"]),l(w,{onClick:ue},{default:n(()=>[...e[26]||(e[26]=[_("重置",-1)])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),l(Y,{class:"!border-none mt-4",shadow:"never"},{default:n(()=>[v("div",Ze,[L((m(),b(w,{type:"primary",disabled:a(h).length===0,onClick:ne},{default:n(()=>[...e[27]||(e[27]=[_(" 批量修改渠道 ",-1)])]),_:1},8,["disabled"])),[[z,["doctor.appointment/edit"]]]),a(h).length>0?(m(),S("span",et," 已选 "+c(a(h).length)+" 条 ",1)):F("",!0)]),L((m(),b(ve,{ref_key:"tableRef",ref:K,"row-key":"id",data:a(E).lists,size:"large",stripe:"",onSelectionChange:Z},{default:n(()=>[l(f,{type:"selection",width:"48",align:"center","reserve-selection":""}),l(f,{label:"ID",prop:"id",width:"72",align:"center"}),l(f,{label:"诊单/患者","min-width":"140"},{default:n(({row:t})=>[v("div",tt,[v("div",lt,c(t.patient_name||"—"),1),v("div",at,c(re(t.patient_phone)),1),v("div",nt,"诊单 #"+c(t.diagnosis_id??t.patient_id),1)])]),_:1}),l(f,{label:"医生",prop:"doctor_name",width:"100","show-overflow-tooltip":""}),l(f,{label:"医助",prop:"assistant_name",width:"100","show-overflow-tooltip":""}),l(f,{label:"预约时间","min-width":"128"},{default:n(({row:t})=>[v("div",null,c(t.appointment_date),1),v("div",ot,c(G(t.appointment_time))+" · "+c(t.period_desc),1)]),_:1}),l(f,{label:"挂号类型",width:"110"},{default:n(({row:t})=>[_(c(a(ze)(t.appointment_type)),1)]),_:1}),l(f,{label:"渠道","min-width":"130","show-overflow-tooltip":""},{default:n(({row:t})=>[v("div",st,c(t.channel_source_desc||"—"),1),t.channel_source_detail?(m(),S("div",it,c(t.channel_source_detail),1)):F("",!0)]),_:1}),l(f,{label:"状态",width:"96",align:"center"},{default:n(({row:t})=>[l(be,{type:t.status===1?"success":t.status===2?"info":t.status===3?"primary":"danger",size:"small",effect:"light"},{default:n(()=>[_(c(t.status_desc),1)]),_:2},1032,["type"])]),_:1}),l(f,{label:"备注",prop:"remark","min-width":"120","show-overflow-tooltip":""}),l(f,{label:"操作",width:"100",fixed:"right",align:"center"},{default:n(({row:t})=>[L((m(),b(w,{type:"primary",link:"",onClick:pt=>_e(t)},{default:n(()=>[...e[28]||(e[28]=[_(" 编辑 ",-1)])]),_:1},8,["onClick"])),[[z,["doctor.appointment/edit"]]])]),_:1})]),_:1},8,["data"])),[[we,a(E).loading]]),v("div",rt,[l(ge,{modelValue:a(E),"onUpdate:modelValue":e[9]||(e[9]=t=>M(E)?E.value=t:null),onChange:a(U)},null,8,["modelValue","onChange"])])]),_:1}),l(Q,{modelValue:a(x),"onUpdate:modelValue":e[20]||(e[20]=t=>M(x)?x.value=t:null),title:"编辑挂号",width:"560px","destroy-on-close":"",onClosed:ce},{footer:n(()=>[l(w,{onClick:e[19]||(e[19]=t=>x.value=!1)},{default:n(()=>[...e[32]||(e[32]=[_("取消",-1)])]),_:1}),l(w,{type:"primary",loading:a(A),onClick:fe},{default:n(()=>[...e[33]||(e[33]=[_("保存",-1)])]),_:1},8,["loading"])]),default:n(()=>[l(H,{model:a(o),"label-width":"96px"},{default:n(()=>[l(i,{label:"预约日期",required:""},{default:n(()=>[l(he,{modelValue:a(o).appointment_date,"onUpdate:modelValue":e[10]||(e[10]=t=>a(o).appointment_date=t),type:"date","value-format":"YYYY-MM-DD",placeholder:"选择日期",class:"!w-full"},null,8,["modelValue"])]),_:1}),l(i,{label:"预约时间",required:""},{default:n(()=>[l(ye,{modelValue:a(o).appointment_time,"onUpdate:modelValue":e[11]||(e[11]=t=>a(o).appointment_time=t),format:"HH:mm","value-format":"HH:mm",placeholder:"时间",class:"!w-full"},null,8,["modelValue"])]),_:1}),l(i,{label:"时段",required:""},{default:n(()=>[l(Ve,{modelValue:a(o).period,"onUpdate:modelValue":e[12]||(e[12]=t=>a(o).period=t)},{default:n(()=>[l(I,{label:"morning"},{default:n(()=>[...e[29]||(e[29]=[_("上午",-1)])]),_:1}),l(I,{label:"afternoon"},{default:n(()=>[...e[30]||(e[30]=[_("下午",-1)])]),_:1}),l(I,{label:"all"},{default:n(()=>[...e[31]||(e[31]=[_("全天",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"挂号类型",required:""},{default:n(()=>[l(V,{modelValue:a(o).appointment_type,"onUpdate:modelValue":e[13]||(e[13]=t=>a(o).appointment_type=t),class:"!w-full"},{default:n(()=>[l(r,{label:"视频问诊",value:"video"}),l(r,{label:"图文问诊",value:"text"})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"渠道来源",required:""},{default:n(()=>[l(V,{modelValue:a(o).channel_source,"onUpdate:modelValue":e[14]||(e[14]=t=>a(o).channel_source=t),placeholder:"请选择渠道来源",filterable:"",class:"!w-full",onChange:ie},{default:n(()=>[(m(!0),S(D,null,N(a(y),t=>(m(),b(r,{key:String(t.value),label:t.name,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(O)?(m(),b(i,{key:0,label:"自媒体补充",required:""},{default:n(()=>[l(d,{modelValue:a(o).channel_source_detail,"onUpdate:modelValue":e[15]||(e[15]=t=>a(o).channel_source_detail=t),maxlength:"128","show-word-limit":"",placeholder:"请输入自媒体相关补充内容",clearable:"",class:"!w-full"},null,8,["modelValue"])]),_:1})):F("",!0),l(i,{label:"状态",required:""},{default:n(()=>[l(V,{modelValue:a(o).status,"onUpdate:modelValue":e[16]||(e[16]=t=>a(o).status=t),class:"!w-full"},{default:n(()=>[l(r,{label:"已预约",value:1}),l(r,{label:"已取消",value:2}),l(r,{label:"已完成",value:3}),l(r,{label:"已过号",value:4})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"挂号医助"},{default:n(()=>[l(V,{modelValue:a(o).assistant_id,"onUpdate:modelValue":e[17]||(e[17]=t=>a(o).assistant_id=t),placeholder:"不修改可留空",clearable:"",filterable:"",class:"!w-full"},{default:n(()=>[(m(!0),S(D,null,N(a(q),t=>(m(),b(r,{key:t.id,label:t.name+(t.account?` (${t.account})`:""),value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"备注"},{default:n(()=>[l(d,{modelValue:a(o).remark,"onUpdate:modelValue":e[18]||(e[18]=t=>a(o).remark=t),type:"textarea",rows:3,maxlength:"500","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"]),l(Q,{modelValue:a(C),"onUpdate:modelValue":e[24]||(e[24]=t=>M(C)?C.value=t:null),title:"批量修改渠道",width:"520px","destroy-on-close":"",onClosed:oe},{footer:n(()=>[l(w,{onClick:e[23]||(e[23]=t=>C.value=!1)},{default:n(()=>[...e[34]||(e[34]=[_("取消",-1)])]),_:1}),l(w,{type:"primary",loading:a(R),onClick:se},{default:n(()=>[...e[35]||(e[35]=[_("确定",-1)])]),_:1},8,["loading"])]),default:n(()=>[v("p",ut,"将对已选 "+c(a(h).length)+" 条挂号写入同一渠道来源(仅改渠道,不改其它字段)。",1),l(H,{model:a(p),"label-width":"96px"},{default:n(()=>[l(i,{label:"渠道来源",required:""},{default:n(()=>[l(V,{modelValue:a(p).channel_source,"onUpdate:modelValue":e[21]||(e[21]=t=>a(p).channel_source=t),placeholder:"请选择渠道来源",filterable:"",class:"!w-full",onChange:ae},{default:n(()=>[(m(!0),S(D,null,N(a(y),t=>(m(),b(r,{key:String(t.value),label:t.name,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(j)?(m(),b(i,{key:0,label:"自媒体补充",required:""},{default:n(()=>[l(d,{modelValue:a(p).channel_source_detail,"onUpdate:modelValue":e[22]||(e[22]=t=>a(p).channel_source_detail=t),maxlength:"128","show-word-limit":"",placeholder:"请输入自媒体相关补充内容",clearable:"",class:"!w-full"},null,8,["modelValue"])]),_:1})):F("",!0)]),_:1},8,["model"])]),_:1},8,["modelValue"])])}}});export{Vt as default};