feat(escort): 病历与诉求支持多材料解析为四段摘要

新增独立病历整理 Agent 与异步解析任务,支持 PDF 文本、图片 OCR、
语音 ASR 与文字输入,统一整理为基础健康、检查治疗、用药和问诊诉求。
Agent 只产出草稿,订单本人在编辑页核对确认后才写入当前订单;
原件在任务结束、失败或取消时立即清除。

inquiry 增加三段规范字段,medicalHistory 保留为旧版兼容摘要,
并兼容旧客户端只写 medicalHistory 的更新方式。
This commit is contained in:
lik
2026-11-16 20:44:46 +08:00
parent 77a201c0b3
commit 6d2fc04424
17 changed files with 901 additions and 12 deletions
+3 -1
View File
@@ -14,6 +14,7 @@ const STATIC_DIR = fileURLToPath(new URL('./statics', import.meta.url));
// 语音/图片识别、培训报名材料与陪诊师入驻证件照走 base64 JSON,单请求体可能达到数 MB;
// 只对这些前缀放宽解析上限,其余接口维持 1MB,避免全局放大内存占用
const LARGE_BODY_PREFIXES = ['/health/ai/', '/health/training-application', '/health/attendant-application'];
const INQUIRY_PARSE_PATH = /^\/health\/escort-record\/[^/]+\/inquiry\/parse(?:\/|$)/;
const DEFAULT_BODY_LIMIT = '1mb';
const LARGE_BODY_LIMIT = '20mb';
const defaultBodyParser = bodyParser({
@@ -101,7 +102,8 @@ class APP {
// Web 后台(escort.huashengtec.com)跨域直连时需要 PATCH,koa-cors 默认不含
this.app.use(cors({ methods: 'GET,HEAD,PUT,POST,DELETE,PATCH' }));
this.app.use((ctx, next) => {
const parser = LARGE_BODY_PREFIXES.some((prefix) => ctx.path.startsWith(prefix))
const parser = INQUIRY_PARSE_PATH.test(ctx.path)
|| LARGE_BODY_PREFIXES.some((prefix) => ctx.path.startsWith(prefix))
? largeBodyParser
: defaultBodyParser;
return parser(ctx, next);