From 6e0dc28f432546f360561408298e277d53440951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Sat, 7 Feb 2026 14:17:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E8=AF=8A=E6=96=B9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/chat/components/MessageList.vue | 16 +++-- .../TransferPrescriptionMessageCard.vue | 70 +++++++++---------- .../components/AssistantConfigModal.vue | 14 ++++ 3 files changed, 58 insertions(+), 42 deletions(-) diff --git a/apps/web-antd/src/views/business/chat/components/MessageList.vue b/apps/web-antd/src/views/business/chat/components/MessageList.vue index 97c79d09..cb47b93a 100644 --- a/apps/web-antd/src/views/business/chat/components/MessageList.vue +++ b/apps/web-antd/src/views/business/chat/components/MessageList.vue @@ -30,11 +30,13 @@ const assistantConfig = ref({ // 加载助理配置 const loadAssistantConfig = async () => { try { - const res = await getTransferAssistantConfig(); - if (res?.result) { + const result = await getTransferAssistantConfig(); + // 兼容不同的API响应格式:res.data.result 或 res.result + // const result = res?.data?.result ?? res?.result; + if (result) { assistantConfig.value = { - name: res.result.name || '医生助理', - avatar: res.result.avatar || '', + name: result.name || '医生助理', + avatar: result.avatar || '', }; } } catch (error) { @@ -50,7 +52,7 @@ onMounted(() => { // 获取发送者信息 const getSenderInfo = (message) => { const senderId = message.sender_user_id || message.senderId; - + // 如果是医生助理发送的消息 if (senderId === 'doctor_assistant') { return { @@ -59,7 +61,7 @@ const getSenderInfo = (message) => { color: '#4cc9f0', }; } - + // 如果是当前医生发送的消息 if (senderId === userStore.currentUser.doctor_id || senderId === `doctor-${userStore.currentUser.doctor_id}`) { return { @@ -68,7 +70,7 @@ const getSenderInfo = (message) => { color: userStore.currentUser.color || '#4cc9f0', }; } - + // 其他情况(患者发送的消息) return { nick_name: chatStore.currentFriend?.nick_name || '未知用户', diff --git a/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue index 5327dbce..b4e75cc4 100644 --- a/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue +++ b/apps/web-antd/src/views/doctor/online-consultation/components/TransferPrescriptionMessageCard.vue @@ -34,7 +34,7 @@ const transferInfo = computed(() => { // 解析处方内容(从content字段,后端已解析为对象) const prescriptionContent = computed(() => { if (!transferInfo.value) return null; - + // 如果已经有解析好的prescription字段,直接使用 if (transferInfo.value.prescription && transferInfo.value.prescription.content) { return { @@ -43,14 +43,14 @@ const prescriptionContent = computed(() => { content: transferInfo.value.prescription.content || [], }; } - + // 从content字段获取(后端已解析为对象) const content = transferInfo.value.content; if (!content) return null; - + // 构建药品列表 let drugList = []; - + // 如果content是对象,检查repice字段 if (typeof content === 'object' && !Array.isArray(content)) { // 从repice数组中提取药品 @@ -66,7 +66,7 @@ const prescriptionContent = computed(() => { recipeContent = []; } } - + // 如果recipeContent是数组,合并到drugList if (Array.isArray(recipeContent)) { drugList = drugList.concat(recipeContent); @@ -74,7 +74,7 @@ const prescriptionContent = computed(() => { } } } - + return { clinical_diagnose: content.clinical_diagnose || transferInfo.value.original_prescription?.clinical_diagnose || '', doctor_order: content.doctor_order || transferInfo.value.original_prescription?.doctor_order || '', @@ -88,7 +88,7 @@ const prescriptionContent = computed(() => { content: content, }; } - + return null; }); @@ -129,7 +129,7 @@ const convertDrugDataForImport = (drug) => { // }, // price: ..., // } - + // 转接方的药品数据结构: // { // id: ..., @@ -141,7 +141,7 @@ const convertDrugDataForImport = (drug) => { // use_unit: {...}, // ... // } - + return { id: drug.id || drug.drug_id || 0, drug: { @@ -190,10 +190,10 @@ const handleImportToPrescription = async () => { // 先将处方类型设置为中药(1) prescriptionStore.changeCategory(1); - + // 直接使用前端已获取的数据进行导入 const drugList = prescriptionContent.value.content; - + if (!drugList || drugList.length === 0) { message.warning('处方中没有药品信息'); return; @@ -209,7 +209,7 @@ const handleImportToPrescription = async () => { addedCount++; } } - + // 导入诊断和医嘱 if (prescriptionContent.value.clinical_diagnose) { prescriptionStore.diagnosis = prescriptionContent.value.clinical_diagnose; @@ -217,7 +217,7 @@ const handleImportToPrescription = async () => { if (prescriptionContent.value.doctor_order) { prescriptionStore.medicalAdvice = prescriptionContent.value.doctor_order; } - + if (addedCount > 0) { message.success(`已成功导入 ${addedCount} 个药品到处方单`); // 构建处方数据对象,用于触发事件 @@ -302,33 +302,32 @@ const handleImportToPrescription = async () => { @@ -437,6 +436,7 @@ const handleImportToPrescription = async () => { .view-btn, .import-btn { + width: 100%; font-size: 13px; padding: 4px 12px; height: auto; diff --git a/apps/web-antd/src/views/system/transfer-question/components/AssistantConfigModal.vue b/apps/web-antd/src/views/system/transfer-question/components/AssistantConfigModal.vue index 55ca5b8a..0cbf7684 100644 --- a/apps/web-antd/src/views/system/transfer-question/components/AssistantConfigModal.vue +++ b/apps/web-antd/src/views/system/transfer-question/components/AssistantConfigModal.vue @@ -36,6 +36,20 @@ const assistantFormProps = { fieldName: 'avatar', label: '助理头像', }, + { + component: 'InputNumber', + componentProps: { + placeholder: '请输入回复延迟时间(秒)', + min: 0, + max: 10, + step: 0.1, + precision: 2, + }, + fieldName: 'reply_delay', + label: '回复延迟时间(秒)', + defaultValue: 1.00, + rules: 'required', + }, ], };