feat(escort): 病历与诉求支持多材料解析为四段摘要
新增独立病历整理 Agent 与异步解析任务,支持 PDF 文本、图片 OCR、 语音 ASR 与文字输入,统一整理为基础健康、检查治疗、用药和问诊诉求。 Agent 只产出草稿,订单本人在编辑页核对确认后才写入当前订单; 原件在任务结束、失败或取消时立即清除。 inquiry 增加三段规范字段,medicalHistory 保留为旧版兼容摘要, 并兼容旧客户端只写 medicalHistory 的更新方式。
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
} from "../../../../../utils/record_state.js";
|
||||
import { HandlerPayment } from "../../../../../handler/payment.js";
|
||||
import logger from "../../../../../utils/logger.js";
|
||||
import { INQUIRY_FIELDS, buildLegacyMedicalHistory, normalizeInquiryView } from "../../../../../utils/inquiry.js";
|
||||
|
||||
const escortRecordSetTool = tool(
|
||||
async ({ orderId, status, cancelStatus, notes, inquiry, payment }) => {
|
||||
@@ -99,13 +100,23 @@ const escortRecordSetTool = tool(
|
||||
}
|
||||
}
|
||||
|
||||
// 问诊信息:病历与诉求由就诊人补充,管理端可代录
|
||||
// 问诊信息:四段为规范字段,旧 medicalHistory 写入时归入检查与治疗病历。
|
||||
if (inquiry !== undefined) {
|
||||
if (inquiry.medicalHistory !== undefined) {
|
||||
update["inquiry.medicalHistory"] = inquiry.medicalHistory;
|
||||
const nextInquiry = normalizeInquiryView(record.inquiry);
|
||||
const hasStructured = INQUIRY_FIELDS.some((field) => inquiry[field] !== undefined);
|
||||
if (inquiry.medicalHistory !== undefined && !hasStructured) {
|
||||
nextInquiry.basicHealth = "";
|
||||
nextInquiry.treatmentHistory = inquiry.medicalHistory;
|
||||
nextInquiry.medications = "";
|
||||
}
|
||||
if (inquiry.demand !== undefined) {
|
||||
update["inquiry.demand"] = inquiry.demand;
|
||||
for (const field of INQUIRY_FIELDS) {
|
||||
if (inquiry[field] !== undefined) nextInquiry[field] = inquiry[field];
|
||||
if (hasStructured || inquiry.medicalHistory !== undefined) {
|
||||
update[`inquiry.${field}`] = nextInquiry[field];
|
||||
}
|
||||
}
|
||||
if (hasStructured || inquiry.medicalHistory !== undefined) {
|
||||
update["inquiry.medicalHistory"] = buildLegacyMedicalHistory(nextInquiry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +283,10 @@ const escortRecordSetTool = tool(
|
||||
.describe("Notes information to update"),
|
||||
inquiry: z
|
||||
.object({
|
||||
medicalHistory: z.string().optional().describe("Medical history / 病历"),
|
||||
basicHealth: z.string().optional().describe("Basic health and underlying diseases / 基础健康与基础疾病"),
|
||||
treatmentHistory: z.string().optional().describe("Examinations and treatment history / 检查与治疗病历"),
|
||||
medications: z.string().optional().describe("Current medications / 用药情况"),
|
||||
medicalHistory: z.string().optional().describe("Legacy medical history / 病历兼容摘要"),
|
||||
demand: z.string().optional().describe("Patient demand / 诉求"),
|
||||
})
|
||||
.optional()
|
||||
|
||||
Reference in New Issue
Block a user