转诊方优化
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled

This commit is contained in:
李琦
2026-02-07 14:17:23 +08:00
parent 5158499dd1
commit 6e0dc28f43
3 changed files with 58 additions and 42 deletions

View File

@@ -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 || '未知用户',

View File

@@ -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 () => {
<!-- 卡片底部操作 -->
<div class="card-footer">
<Button
type="default"
size="small"
type="primary"
@click="handleViewDetail"
class="view-btn"
>
查看详情
</Button>
<Button
v-if="transferInfo.status !== 3 && transferInfo.status !== 2"
type="primary"
size="small"
:loading="importing"
@click="handleImportToPrescription"
class="import-btn"
>
<i class="fas fa-download mr-1"></i>
导入处方
</Button>
<Button
v-else-if="transferInfo.status === 2"
type="default"
size="small"
disabled
class="import-btn"
>
已导入
</Button>
<!-- <Button-->
<!-- v-if="transferInfo.status !== 3 && transferInfo.status !== 2"-->
<!-- type="primary"-->
<!-- size="small"-->
<!-- :loading="importing"-->
<!-- @click="handleImportToPrescription"-->
<!-- class="import-btn"-->
<!-- >-->
<!-- <i class="fas fa-download mr-1"></i>-->
<!-- 导入处方-->
<!-- </Button>-->
<!-- <Button-->
<!-- v-else-if="transferInfo.status === 2"-->
<!-- type="default"-->
<!-- size="small"-->
<!-- disabled-->
<!-- class="import-btn"-->
<!-- >-->
<!-- 已导入-->
<!-- </Button>-->
</div>
</Card>
</template>
@@ -437,6 +436,7 @@ const handleImportToPrescription = async () => {
.view-btn,
.import-btn {
width: 100%;
font-size: 13px;
padding: 4px 12px;
height: auto;

View File

@@ -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',
},
],
};