Files
vueapp/dist/assets/pages-assessment-assessment.DBigRajl.js
T
2026-06-13 06:06:07 +08:00

2 lines
13 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as e,a,r as t,c as l,o as s,b as n,e as o,f as r,w as i,i as c,j as u,t as d,g as f,l as m,K as v,F as p,m as _,n as h,L as y,M as w,q as b,G as g,s as k,D as x,Q as $,z as N,A as T,y as j,x as E,S as D,H as P,u as C}from"./index-DR4MYR5F.js";import{_ as F}from"./config-doctor.TgARj_nM.js";import{o as M}from"./uni-app.es.CXV8m51O.js";import{F as A,a as S,r as U,f as I}from"./session.EmQEGqqa.js";import{b as L}from"./profile.e1L0urBE.js";import{_ as O}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./auth.CseBt7py.js";async function R(e){const a=await fetch(`${A}/evaluations/${e}`,{method:"GET",headers:S()});if(!a.ok)throw new Error(await U(a));const t=await a.json();if("OK"!==t.code||!t.data)throw new Error(t.message||"评价详情加载失败");return t.data}async function Y(e){var a;const t=await fetch(`${A}/evaluations/${e}/download-pdf`,{method:"GET",headers:S("application/pdf")});if(!t.ok)throw new Error(await U(t));const l=t.headers.get("Content-Type")||"",s=function(e,a){var t,l;const s=null==(t=e.match(/filename\*=UTF-8''([^;]+)/i))?void 0:t[1];if(s)return decodeURIComponent(s);const n=null==(l=e.match(/filename="?([^"]+)"?/i))?void 0:l[1];return n||`training_record_${a}.pdf`}(t.headers.get("Content-Disposition")||"",e);if(l.includes("application/json")){const e=await t.json();if("OK"!==e.code||!(null==(a=e.data)?void 0:a.file_path))throw new Error(e.message||"PDF 下载失败");return{filePath:e.data.file_path,fileName:B(e.data.file_path,s)}}return{blob:await t.blob(),fileName:s}}function B(e,a){return e.split("?")[0].split("#")[0].split("/").filter(Boolean).pop()||a}const X=O(e({__name:"assessment",setup(e){const O=a({date:"生成中",no:"生成中",caseTitle:"",score:0,scoreText:"--",level:"生成中",overallComment:"评价生成中,请稍候。"}),B=t(!1),X=t(""),G=t(!1),K=t(null),V=t(null),q=t(null),z=t(!1),H=t(!1),J=t(!1),Q=t(null),W=l((()=>264-264*O.score/100)),Z=l((()=>O.overallComment||ee.value)),ee=l((()=>J.value?"评价生成失败,请稍后重试。":H.value?"本次评价暂无详细点评。":"评价生成中,请稍候。")),ae=l((()=>J.value?"评价生成失败,请稍后重试。":H.value?"暂无分项评分。":"分项评分生成中。")),te=l((()=>J.value?"评价生成失败,暂无雷达图。":H.value?"暂无足够分项数据生成雷达图。":"雷达图生成中。")),le=l((()=>{var e,a;const t=V.value||K.value;return t?Array.isArray(t.dimension_scores)&&t.dimension_scores.length>0?t.dimension_scores.map((e=>{const a=e.max_score>0?fe(Number(e.score)/Number(e.max_score)*100):fe(Number(e.score)),t=[e.comment,e.improvement?`改进建议:${e.improvement}`:""].filter(Boolean).join(" ");return{label:e.dimension,percent:a,displayScore:e.max_score>0?`${e.score}/${e.max_score}`:`${e.score}%`,analysis:t||"暂无分项解析。"}})):Array.isArray(t.score_details)&&t.score_details.length>0?t.score_details.map((e=>({label:e.dimension,percent:fe(Number(e.score)),displayScore:`${e.score}%`,analysis:e.comment||e.deducted_reason||"暂无分项解析。"}))):V.value&&Array.isArray(null==(e=K.value)?void 0:e.dimension_scores)&&K.value.dimension_scores.length>0?K.value.dimension_scores.map((e=>{const a=Number(e.score),t=Number(e.max_score),l=fe(t>0?a/t*100:a),s=[e.comment,e.improvement?`改进建议:${e.improvement}`:""].filter(Boolean).join(" ");return{label:e.dimension,percent:l,displayScore:t>0?`${e.score}/${e.max_score}`:`${e.score}%`,analysis:s||"暂无分项解析。"}})):V.value&&Array.isArray(null==(a=K.value)?void 0:a.score_details)&&K.value.score_details.length>0?K.value.score_details.map((e=>({label:e.dimension,percent:fe(Number(e.score)),displayScore:`${e.score}%`,analysis:e.comment||e.deducted_reason||"暂无分项解析。"}))):[]:[]})),se=l((()=>{const e=le.value.slice(0,6),a=e.length;return a<3?[]:e.map(((e,t)=>{const l=-Math.PI/2+2*Math.PI*t/a,s=e.percent/100*160,n=200+184*Math.cos(l),o=200+184*Math.sin(l);return{...e,axisX:me(200+160*Math.cos(l)),axisY:me(200+160*Math.sin(l)),labelX:me(n),labelY:me(o),pointX:me(200+Math.cos(l)*s),pointY:me(200+Math.sin(l)*s),anchor:n<170?"end":n>230?"start":"middle"}}))})),ne=l((()=>se.value.map((e=>`${e.pointX},${e.pointY}`)).join(" ")));let oe=null;function re(){"function"==typeof y&&y().length>1?w():ie()}function ie(){b({url:"/pages/home/home"})}function ce(){g({url:"/pages/learning-assistant/learning-assistant"})}function ue(e){oe&&clearTimeout(oe),X.value=e,G.value=!0,oe=setTimeout((()=>{G.value=!1}),2200)}function de(e){return`${e.getFullYear()}${e.getMonth()+1}${e.getDate()}`}function fe(e){return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):0}function me(e){return Math.round(100*e)/100}function ve(e){return e>=90?"优秀":e>=80?"优良":e>=70?"良好":e>=60?"合格":"待加强"}function pe(e){K.value=e,q.value=e.evaluation_id,O.no=`EV-${e.evaluation_id}`,he(e.total_score),O.level=ve(O.score),O.date=de(new Date),O.overallComment=e.overall_comment||"本次评价暂无详细点评。"}function _e(e){var a;V.value=e,q.value=e.evaluation_id,O.no=`EV-${e.evaluation_id}`,O.caseTitle=e.case_title||"",O.date=function(e){if(!e)return de(new Date);const a=new Date(e);return Number.isNaN(a.getTime())?e:de(a)}(e.created_at),he(e.total_score),O.level=ve(O.score),O.overallComment=e.overall_comment||(null==(a=K.value)?void 0:a.overall_comment)||"本次评价暂无详细点评。"}function he(e){O.score=fe(Number(e)),O.scoreText=Number.isFinite(Number(e))?String(O.score):"--"}async function ye(){H.value=!1,J.value=!1;try{if(Q.value)return void(await async function(e){const a=await L(e);k("clinical-thinking-evaluation-detail",a),_e(a),K.value=null,H.value=!0}(Q.value));if("teaching"===x("clinical-thinking-case-mode")&&Boolean(we(!1)))return void(await async function(){const e=we(),a=function(){const e=x("clinical-thinking-teaching-evaluation");return e&&"object"==typeof e?e:null}();a&&pe(a);const t=await R(e);k("clinical-thinking-evaluation-detail",t),_e(t),H.value=!0}());const e=I();O.no=`SID-${e}`;const a=await async function(e,a="percentage"){const t=await fetch(`${A}/sessions/${e}/evaluation`,{method:"POST",headers:S(),body:JSON.stringify({score_type:a})});if(!t.ok)throw new Error(await U(t));const l=await t.json();if("OK"!==l.code||!l.data)throw new Error(l.message||"评价生成失败");return l.data}(e,"percentage");k("clinical-thinking-evaluation",a),pe(a);const t=await R(a.evaluation_id);k("clinical-thinking-evaluation-detail",t),_e(t),H.value=!0}catch(e){J.value=!0,K.value=null,V.value=null,q.value=null,O.date="--",O.no="--",O.caseTitle="",O.score=0,O.scoreText="--",O.level="生成失败",O.overallComment="评价生成失败,请稍后重试。",ue(e instanceof Error?e.message:"评价生成失败")}finally{B.value=!1,C((()=>{setTimeout((()=>{B.value=!0}),120)}))}}function we(e=!0){const a=x("clinical-thinking-teaching-evaluation-id"),t=Number(a);if(Number.isInteger(t)&&t>0)return t;if(e)throw new Error("未找到教学评价,请先完成教学题目");return 0}async function be(){if(q.value&&!z.value){z.value=!0;try{const e=await Y(q.value);k("clinical-thinking-evaluation-pdf",{fileName:e.fileName,filePath:e.filePath||""}),await async function(e){if(e.blob){if("undefined"==typeof window||"undefined"==typeof document)return;const a=window.URL.createObjectURL(e.blob);return ge(a,e.fileName),void window.setTimeout((()=>{window.URL.revokeObjectURL(a)}),1e3)}if(!e.filePath)throw new Error("PDF 下载地址为空");const a=function(e){const a=e.trim();return/^https?:\/\//i.test(a)||a.startsWith("/")?a:`/${a}`}(e.filePath),t=e.fileName;if("undefined"==typeof window||"undefined"==typeof document)return void $({url:a,fail:()=>ue("PDF 下载失败")});try{const e=await fetch(a,{method:"GET",credentials:"include"});if(!e.ok)throw new Error(`PDF 下载失败(${e.status}`);const l=await e.blob(),s=window.URL.createObjectURL(l);ge(s,t),window.setTimeout((()=>{window.URL.revokeObjectURL(s)}),1e3)}catch(l){ge(a,t)}}(e),ue("PDF 已生成")}catch(e){ue(e instanceof Error?e.message:"PDF 下载失败")}finally{z.value=!1}}}function ge(e,a){const t=document.createElement("a");t.href=e,t.download=a,t.rel="noopener",t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}return M((e=>{Q.value=function(e){const a=Number(e);return Number.isInteger(a)&&a>0?a:null}((null==e?void 0:e.evaluation_id)||(null==e?void 0:e.id))})),s((()=>{ye()})),n((()=>{oe&&clearTimeout(oe)})),(e,a)=>{const t=N,l=T,s=j,n=E,y=D;return o(),r(t,{class:"assessment-page"},{default:i((()=>[c(t,{class:"top-app-bar"},{default:i((()=>[c(l,{class:"icon-button","aria-label":"返回",onClick:re},{default:i((()=>[c(t,{class:"back-icon"})])),_:1}),c(s,{class:"app-title"},{default:i((()=>[u("AI 学习助手")])),_:1})])),_:1}),c(y,{class:"report-content","scroll-y":""},{default:i((()=>[c(t,{class:"report-head"},{default:i((()=>[c(s,{class:"report-title"},{default:i((()=>[u("训练总结与 AI 评估报告")])),_:1}),c(t,{class:"report-meta"},{default:i((()=>[c(s,null,{default:i((()=>[u("评估日期:"+d(O.date),1)])),_:1}),c(s,null,{default:i((()=>[u("模拟编号:"+d(O.no),1)])),_:1}),O.caseTitle?(o(),r(s,{key:0},{default:i((()=>[u("病例:"+d(O.caseTitle),1)])),_:1})):f("",!0)])),_:1})])),_:1}),c(t,{class:"content-stack"},{default:i((()=>[c(t,{class:"overall-card"},{default:i((()=>[c(t,{class:"score-ring"},{default:i((()=>[(o(),m("svg",{class:"ring-svg",viewBox:"0 0 100 100"},[v("circle",{class:"ring-track",cx:"50",cy:"50",fill:"transparent",r:"42","stroke-width":"10"}),v("circle",{class:"ring-value",cx:"50",cy:"50",fill:"transparent",r:"42","stroke-dasharray":"264","stroke-dashoffset":W.value,"stroke-linecap":"round","stroke-width":"10"},null,8,["stroke-dashoffset"])])),c(t,{class:"score-center"},{default:i((()=>[c(s,{class:"score-value"},{default:i((()=>[u(d(O.scoreText),1)])),_:1}),c(s,{class:"score-total"},{default:i((()=>[u("/100")])),_:1})])),_:1})])),_:1}),c(t,{class:"overall-copy"},{default:i((()=>[c(s,{class:"overall-title"},{default:i((()=>[u("本次考核评价:"),c(s,{class:"primary-text"},{default:i((()=>[u(d(O.level),1)])),_:1})])),_:1}),c(s,{class:"overall-desc"},{default:i((()=>[u(d(O.overallComment),1)])),_:1})])),_:1})])),_:1}),c(t,{class:"report-card"},{default:i((()=>[c(t,{class:"section-heading"},{default:i((()=>[c(t,{class:"hub-icon"}),c(s,null,{default:i((()=>[u("临床胜任力雷达图")])),_:1})])),_:1}),c(t,{class:"radar-wrap"},{default:i((()=>[se.value.length>=3?(o(),m("svg",{key:0,class:"radar-svg",viewBox:"0 0 400 400"},[v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"160"}),v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"120"}),v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"80"}),v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"40"}),(o(!0),m(p,null,_(se.value,(e=>(o(),m("line",{key:`axis-${e.label}`,class:"radar-grid",x1:"200",x2:e.axisX,y1:"200",y2:e.axisY},null,8,["x2","y2"])))),128)),v("polygon",{class:"radar-area",points:ne.value},null,8,["points"]),(o(!0),m(p,null,_(se.value,(e=>(o(),r(s,{key:`label-${e.label}`,class:"radar-label","text-anchor":e.anchor,x:e.labelX,y:e.labelY},{default:i((()=>[u(d(e.label),1)])),_:2},1032,["text-anchor","x","y"])))),128))])):(o(),r(t,{key:1,class:"empty-data radar-empty"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(te.value),1)])),_:1})])),_:1}))])),_:1})])),_:1}),c(t,{class:"report-card"},{default:i((()=>[c(t,{class:"section-heading breakdown-title"},{default:i((()=>[c(t,{class:"analytics-icon"}),c(s,null,{default:i((()=>[u("分项得分与解析")])),_:1})])),_:1}),c(t,{class:"breakdown-list"},{default:i((()=>[0===le.value.length?(o(),r(t,{key:0,class:"empty-data"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(ae.value),1)])),_:1})])),_:1})):(o(!0),m(p,{key:1},_(le.value,((e,a)=>(o(),r(t,{key:`${e.label}-${a}`,class:"breakdown-item"},{default:i((()=>[c(t,{class:"breakdown-head"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(e.label),1)])),_:2},1024),c(s,{class:"breakdown-score"},{default:i((()=>[u(d(e.displayScore),1)])),_:2},1024)])),_:2},1024),c(t,{class:"progress-track"},{default:i((()=>[c(t,{class:"progress-fill",style:P({width:B.value?`${e.percent}%`:"0%"})},null,8,["style"])])),_:2},1024),c(t,{class:"analysis-box"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(e.analysis),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1}),c(t,{class:"mentor-section"},{default:i((()=>[c(t,{class:"mentor-head"},{default:i((()=>[c(n,{class:"mentor-avatar",src:F,mode:"aspectFill"}),c(t,{class:"mentor-title-group"},{default:i((()=>[c(s,{class:"mentor-title"},{default:i((()=>[u("王主任点评")])),_:1}),c(s,{class:"mentor-subtitle"},{default:i((()=>[u("Director's Mentorship")])),_:1})])),_:1})])),_:1}),c(t,{class:"mentor-bubble"},{default:i((()=>[c(t,{class:"mentor-tail"}),c(s,{class:"mentor-copy"},{default:i((()=>[u(d(Z.value),1)])),_:1}),c(t,{class:"mentor-action-row"},{default:i((()=>[c(l,{class:"read-button",onClick:ce},{default:i((()=>[c(s,null,{default:i((()=>[u("去查阅")])),_:1}),c(t,{class:"arrow-forward-icon"})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1}),c(t,{class:"footer-actions"},{default:i((()=>[c(l,{class:h(["download-button",{disabled:!q.value||z.value}]),disabled:!q.value||z.value,onClick:be},{default:i((()=>[u(d(z.value?"PDF 生成中...":"下载完整 PDF 报告"),1)])),_:1},8,["class","disabled"]),c(l,{class:"next-button",onClick:ie},{default:i((()=>[u(" 开始下一轮强化训练 ")])),_:1})])),_:1}),c(t,{class:h(["toast",{visible:G.value}])},{default:i((()=>[u(d(X.value),1)])),_:1},8,["class"])])),_:1})}}}),[["__scopeId","data-v-6015f15c"]]);export{X as default};