feat(escort): 陪诊记录新增问诊信息(病历与诉求)字段与写入白名单
This commit is contained in:
@@ -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)"),
|
||||
|
||||
@@ -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],
|
||||
};
|
||||
|
||||
// 用户端只能发起取消,服务完成由平台确认,避免用户端重复写入终态。
|
||||
|
||||
@@ -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: 待确认 - 订单已创建,等待确认
|
||||
|
||||
Reference in New Issue
Block a user