Compare commits

...
2 Commits
4 changed files with 34 additions and 9 deletions
-1
View File
@@ -59,7 +59,6 @@ export default class EscortAgent {
if (clearMsg) { if (clearMsg) {
this.messages = []; this.messages = [];
this.agent = null; this.agent = null;
callback("main", "ai", "好,之前的对话已经清空,我们重新开始。", clearMsg.id);
return; return;
} }
@@ -10,7 +10,7 @@ import {
} from "../../../../../utils/record_state.js"; } from "../../../../../utils/record_state.js";
const escortRecordSetTool = tool( const escortRecordSetTool = tool(
async ({ orderId, status, cancelStatus, notes, payment }) => { async ({ orderId, status, cancelStatus, notes, inquiry, payment }) => {
try { try {
if (!orderId) { if (!orderId) {
return { 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 !== undefined) {
if (payment.totalFee !== undefined) { if (payment.totalFee !== undefined) {
update["payment.totalFee"] = payment.totalFee; update["payment.totalFee"] = payment.totalFee;
@@ -142,7 +152,7 @@ const escortRecordSetTool = tool(
{ {
name: "escort_record_set", name: "escort_record_set",
description: 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({ schema: z.object({
orderId: z orderId: z
.string() .string()
@@ -167,6 +177,13 @@ const escortRecordSetTool = tool(
}) })
.optional() .optional()
.describe("Notes information to update"), .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 payment: z
.object({ .object({
totalFee: z.number().optional().describe("Total service fee (RMB)"), totalFee: z.number().optional().describe("Total service fee (RMB)"),
+6 -6
View File
@@ -18,23 +18,23 @@ class HandlerEscortRecord {
// 白名单:只允许写入 schema 定义的顶层字段(兼容 'patient.name' 等点号路径) // 白名单:只允许写入 schema 定义的顶层字段(兼容 'patient.name' 等点号路径)
static RECORD_FIELDS = [ static RECORD_FIELDS = [
"userId", "healthProfileId", "patient", "escort", "userId", "healthProfileId", "patient", "escort",
"attendant", "hospital", "schedule", "payment", "notes", "status", "attendant", "hospital", "schedule", "payment", "notes", "inquiry", "status",
"shippingAddress", "shippingAddress",
]; ];
// 用户自助可改字段按订单状态区分(费用、状态、陪诊员分配、档案归属一律由平台控制): // 用户自助可改字段按订单状态区分(费用、状态、陪诊员分配、档案归属一律由平台控制):
// - 待支付/已支付:可改医院与排期(改期会写审计时间) // - 待支付/已支付:可改医院与排期(改期会写审计时间)
// - 进行中:服务已开始,仅可补充就诊人备注,排期与医院不允许用户单方变更 // - 进行中:服务已开始,仅可补充病历与诉求,排期与医院不允许用户单方变更
// - 终态:全部不可改 // - 终态:全部不可改
static OWNER_NOTE_FIELDS = ["notes.patientNote"]; static OWNER_NOTE_FIELDS = ["notes.patientNote", "inquiry.medicalHistory", "inquiry.demand"];
static OWNER_BOOKING_FIELDS = [ static OWNER_BOOKING_FIELDS = [
"hospital.province", "hospital.name", "hospital.address", "hospital.department", "hospital.province", "hospital.name", "hospital.address", "hospital.department",
"hospital.doctor", "hospital.medicalRecordNo", "schedule.date", "schedule.startTime", "hospital.doctor", "hospital.medicalRecordNo", "schedule.date", "schedule.startTime",
]; ];
static OWNER_EDITABLE_BY_STATUS = { static OWNER_EDITABLE_BY_STATUS = {
pending: ["notes.patientNote", "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS], pending: [...HandlerEscortRecord.OWNER_NOTE_FIELDS, "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS],
confirmed: ["notes.patientNote", "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS], confirmed: [...HandlerEscortRecord.OWNER_NOTE_FIELDS, "payment.payChannel", ...HandlerEscortRecord.OWNER_BOOKING_FIELDS],
in_progress: ["notes.patientNote"], in_progress: [...HandlerEscortRecord.OWNER_NOTE_FIELDS],
}; };
// 用户端只能发起取消,服务完成由平台确认,避免用户端重复写入终态。 // 用户端只能发起取消,服务完成由平台确认,避免用户端重复写入终态。
+9
View File
@@ -14,6 +14,7 @@ import mongoose from "mongoose";
* - 陪诊员信息:attendant(陪诊员ID、姓名) * - 陪诊员信息:attendant(陪诊员ID、姓名)
* - 费用信息:payment(总费用、已支付、支付方式、支付状态) * - 费用信息:payment(总费用、已支付、支付方式、支付状态)
* - 备注信息:notes(患者备注、陪诊记录、就诊摘要) * - 备注信息:notes(患者备注、陪诊记录、就诊摘要)
* - 问诊信息:inquiry(病历、诉求)
* - 状态信息:status(陪诊状态) * - 状态信息:status(陪诊状态)
* - 元数据:meta(创建时间、更新时间) * - 元数据:meta(创建时间、更新时间)
*/ */
@@ -154,6 +155,14 @@ const EscortRecordSchema = mongoose.Schema(
medicalSummary: { type: String, default: "", comment: "就诊摘要" }, medicalSummary: { type: String, default: "", comment: "就诊摘要" },
}, },
/**
* 问诊信息 - 就诊人补充的病历与诉求,与下单备注分开
*/
inquiry: {
medicalHistory: { type: String, default: "", comment: "病历" },
demand: { type: String, default: "", comment: "诉求" },
},
/** /**
* 陪诊状态(只描述服务生命周期,不含取消) * 陪诊状态(只描述服务生命周期,不含取消)
* - pending: 待确认 - 订单已创建,等待确认 * - pending: 待确认 - 订单已创建,等待确认