2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
|
|
import{d as e,a,r as t,c as s,o as l,b as n,e as o,f as i,w as c,i as u,E as r,j as d,t as m,l as f,m as v,F as p,n as _,k as g,g as h,G as y,y as b,z as k,x as w,S as x,u as C,I as $}from"./index-pnQqyMoS.js";import{_ as E}from"./config-doctor.TgARj_nM.js";import{r as j}from"./cases.4_d-snq4.js";import{F as D,a as A,r as I,b as T,d as O,u as N,s as q,e as P}from"./session.CQodznPl.js";import{c as S,a as F,b as V}from"./navigation.DVfJwOxJ.js";import{_ as G}from"./_plugin-vue_export-helper.BCo6x5W8.js";const K={id:"case-1006004",title:"持续胸痛3小时",patientName:"陈先生",gender:"男",age:60,department:"心血管内科",scene:"住院部",caseNo:"1006004",tone:"orange",mode:"training"};function M(e){if(!Number.isInteger(e)||e<=0)throw new Error("未找到当前会话,请先生成模拟场景")}async function R(e,a){var t;M(e);const s=await fetch(`${D}/sessions/${e}/${a}`,{method:"GET",headers:A()});if(!s.ok)throw new Error(await I(s));const l=await s.json();if("OK"!==l.code||!Array.isArray(null==(t=l.data)?void 0:t.items))throw new Error(l.message||"检查列表加载失败");return l.data.items}async function U(e,a,t){var s;M(e);const l=await fetch(`${D}/sessions/${e}/${a}/${encodeURIComponent(t)}`,{method:"POST",headers:A()});if(!l.ok)throw new Error(await I(l));const n=await l.json();if("OK"!==n.code||!(null==(s=n.data)?void 0:s.item_code))throw new Error(n.message||"检查结果获取失败");return n.data}const z=G(e({__name:"chat",props:{caseItem:{}},emits:["open-settings","open-profile","go-home"],setup(e,{emit:D}){const A=e,I=D,G=S(I),M=F(I),z=V(I),B=a({patient:{name:"陈先生",gender:"男",age:60,department:"心血管内科",chiefComplaint:"持续胸痛3小时"},stages:[{key:"history",label:"病史采集",active:!0},{key:"diagnosis",label:"初步诊断",active:!1},{key:"treatment",label:"治疗方案",active:!1}],messages:[]}),Q=t(""),H=t(!1),J=t(!1),L=t(!1),W=t(0),X=t(""),Y=t(!1),Z=t(!1),ee=t(!1),ae=t(null),te=t(null),se=t([]),le=t([]),ne=t(!1),oe=t(!1),ie=t(!1);let ce=null,ue=null,re=null;const de=s((()=>A.caseItem||te.value)),me=s((()=>B.patient.chiefComplaint.includes("胸痛")?"胸痛":B.patient.chiefComplaint.slice(0,6)));function fe(){(function(e){const a=e||K,t="毕波涛"===a.patientName?"陈先生":a.patientName;return Promise.resolve({patient:{name:t,gender:a.gender,age:a.age,department:a.department,chiefComplaint:a.title},stages:[{key:"history",label:"病史采集",active:!0},{key:"diagnosis",label:"初步诊断",active:!1},{key:"treatment",label:"治疗方案",active:!1}],messages:[{id:"patient-initial",role:"patient",content:"心血管内科"===a.department?"医生,我心口这儿针扎一样疼了两个小时了,现在感觉喘气都费劲。":`医生,我这次主要是${a.title},有点担心。`,label:"患者"},{id:"mentor-initial",role:"mentor",content:"观察患者的面部表情和生命体征。你的第一个问题应该如何询问,以明确疼痛的性质?",label:"王主任"}]})})(de.value).then((e=>{var a;Object.assign(B.patient,e.patient),B.stages=e.stages;const t=T();if(null==(a=null==t?void 0:t.session)?void 0:a.session_id)return ae.value=t.session.session_id,B.messages=t.session.patient_opening?[{id:`patient-opening-${t.session.session_id}`,role:"patient",content:t.session.patient_opening,label:"患者"}]:[],Ce(),void we("开始问诊");B.messages=e.messages,Ce()}))}async function ve(){if(L.value)return;if(H.value||J.value)return void $e("请等待当前回复完成");const e=ae.value;if(e){L.value=!0;try{const a=await O(e);N(a.status),y({url:"/pages/diagnosis/diagnosis"})}catch(a){$e(a instanceof Error?a.message:"完成采集失败")}finally{L.value=!1}}else $e("未找到当前会话,请先生成模拟场景")}async function pe(){const e=ae.value;if(e){if(ee.value=!1,Z.value=!0,!(le.value.length>0||oe.value)){oe.value=!0;try{le.value=await function(e){return R(e,"auxiliary-exams")}(e)}catch(a){$e(a instanceof Error?a.message:"辅助检查列表加载失败")}finally{oe.value=!1}}}else $e("未找到当前会话,请先生成模拟场景")}async function _e(){
|