From 1e1c5499e4045dfa50dde82d4e8017b41ec3d655 Mon Sep 17 00:00:00 2001 From: lik Date: Thu, 5 Nov 2026 22:01:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(escort):=20=E9=99=AA=E8=AF=8A=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=96=B0=E5=A2=9E=E9=97=AE=E8=AF=8A=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=88=E7=97=85=E5=8E=86=E4=B8=8E=E8=AF=89=E6=B1=82=EF=BC=89?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=B8=8E=E5=86=99=E5=85=A5=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/tools/db/admin/escort_record_set.js | 21 +++++++++++++++++-- handler/escort_record.js | 12 +++++------ models/schema/escort_record.js | 9 ++++++++ 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/agent/infra/tools/db/admin/escort_record_set.js b/agent/infra/tools/db/admin/escort_record_set.js index de7be9d..5124595 100644 --- a/agent/infra/tools/db/admin/escort_record_set.js +++ b/agent/infra/tools/db/admin/escort_record_set.js @@ -10,7 +10,7 @@ import { } from "../../../../../utils/record_state.js"; const escortRecordSetTool = tool( - async ({ orderId, status, cancelStatus, notes, payment }) => { + async ({ orderId, status, cancelStatus, notes, inquiry, payment }) => { try { if (!orderId) { return { @@ -92,6 +92,16 @@ const escortRecordSetTool = tool( } } + // 问诊信息:病历与诉求由就诊人补充,管理端可代录 + if (inquiry !== undefined) { + if (inquiry.medicalHistory !== undefined) { + update["inquiry.medicalHistory"] = inquiry.medicalHistory; + } + if (inquiry.demand !== undefined) { + update["inquiry.demand"] = inquiry.demand; + } + } + if (payment !== undefined) { if (payment.totalFee !== undefined) { update["payment.totalFee"] = payment.totalFee; @@ -142,7 +152,7 @@ const escortRecordSetTool = tool( { name: "escort_record_set", description: - "Update escort record fields by record ID (_id). Supports updating service status, cancel status (none/requested/cancelled), notes (patientNote, escortNote, medicalSummary), and payment (totalFee, paidFee, status). Only provided fields will be updated.", + "Update escort record fields by record ID (_id). Supports updating service status, cancel status (none/requested/cancelled), notes (patientNote, escortNote, medicalSummary), inquiry (medicalHistory, demand), and payment (totalFee, paidFee, status). Only provided fields will be updated.", schema: z.object({ orderId: z .string() @@ -167,6 +177,13 @@ const escortRecordSetTool = tool( }) .optional() .describe("Notes information to update"), + inquiry: z + .object({ + medicalHistory: z.string().optional().describe("Medical history / 病历"), + demand: z.string().optional().describe("Patient demand / 诉求"), + }) + .optional() + .describe("Inquiry information to update"), payment: z .object({ totalFee: z.number().optional().describe("Total service fee (RMB)"), diff --git a/handler/escort_record.js b/handler/escort_record.js index e32508a..724d541 100644 --- a/handler/escort_record.js +++ b/handler/escort_record.js @@ -18,23 +18,23 @@ class HandlerEscortRecord { // 白名单:只允许写入 schema 定义的顶层字段(兼容 'patient.name' 等点号路径) static RECORD_FIELDS = [ "userId", "healthProfileId", "patient", "escort", - "attendant", "hospital", "schedule", "payment", "notes", "status", + "attendant", "hospital", "schedule", "payment", "notes", "inquiry", "status", "shippingAddress", ]; // 用户自助可改字段按订单状态区分(费用、状态、陪诊员分配、档案归属一律由平台控制): // - 待支付/已支付:可改医院与排期(改期会写审计时间) - // - 进行中:服务已开始,仅可补充就诊人备注,排期与医院不允许用户单方变更 + // - 进行中:服务已开始,仅可补充病历与诉求,排期与医院不允许用户单方变更 // - 终态:全部不可改 - static OWNER_NOTE_FIELDS = ["notes.patientNote"]; + static OWNER_NOTE_FIELDS = ["notes.patientNote", "inquiry.medicalHistory", "inquiry.demand"]; static OWNER_BOOKING_FIELDS = [ "hospital.province", "hospital.name", "hospital.address", "hospital.department", "hospital.doctor", "hospital.medicalRecordNo", "schedule.date", "schedule.startTime", ]; static OWNER_EDITABLE_BY_STATUS = { - pending: ["notes.patientNote", "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS], - confirmed: ["notes.patientNote", "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS], - in_progress: ["notes.patientNote"], + pending: [...HandlerEscortRecord.OWNER_NOTE_FIELDS, "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS], + confirmed: [...HandlerEscortRecord.OWNER_NOTE_FIELDS, "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS], + in_progress: [...HandlerEscortRecord.OWNER_NOTE_FIELDS], }; // 用户端只能发起取消,服务完成由平台确认,避免用户端重复写入终态。 diff --git a/models/schema/escort_record.js b/models/schema/escort_record.js index e7e457d..38c717d 100644 --- a/models/schema/escort_record.js +++ b/models/schema/escort_record.js @@ -14,6 +14,7 @@ import mongoose from "mongoose"; * - 陪诊员信息:attendant(陪诊员ID、姓名) * - 费用信息:payment(总费用、已支付、支付方式、支付状态) * - 备注信息:notes(患者备注、陪诊记录、就诊摘要) + * - 问诊信息:inquiry(病历、诉求) * - 状态信息:status(陪诊状态) * - 元数据:meta(创建时间、更新时间) */ @@ -154,6 +155,14 @@ const EscortRecordSchema = mongoose.Schema( medicalSummary: { type: String, default: "", comment: "就诊摘要" }, }, + /** + * 问诊信息 - 就诊人补充的病历与诉求,与下单备注分开 + */ + inquiry: { + medicalHistory: { type: String, default: "", comment: "病历" }, + demand: { type: String, default: "", comment: "诉求" }, + }, + /** * 陪诊状态(只描述服务生命周期,不含取消) * - pending: 待确认 - 订单已创建,等待确认