fix(medical): 修复医嘱剂量计算和数据同步问题

- 修正剂量转换公式,将乘法改为除法以正确计算
- 修复剂量数量字段的计算逻辑错误
- 添加字典文本字段回显支持
- 实现医嘱组套字段同步功能
- 保留组套中的原始值而不是强制重置
- 修复设备名称映射字段错误
This commit is contained in:
2026-03-19 10:25:34 +08:00
parent 0c06b05764
commit 3bfe25c2f2
4 changed files with 111 additions and 27 deletions

View File

@@ -146,7 +146,7 @@
v-model="scope.row.doseQuantity"
@input="
(value) => {
scope.row.dose = value * scope.row.unitConversionRatio;
scope.row.dose = value / scope.row.unitConversionRatio;
}
"
/>
@@ -164,7 +164,7 @@
v-model="scope.row.dose"
@input="
(value) => {
scope.row.doseQuantity = value / scope.row.unitConversionRatio;
scope.row.doseQuantity = value * scope.row.unitConversionRatio;
}
"
/>
@@ -543,7 +543,9 @@ function openEdit(tab, row) {
dose: item.dose,
doseQuantity: item.doseQuantity,
methodCode: item.methodCode,
methodCode_dictText: item.methodCode_dictText,
rateCode: item.rateCode,
rateCode_dictText: item.rateCode_dictText,
// 医嘱类型(药品=1没有则按表名推断药品表 -> 药品)
adviceType:
item.adviceType !== undefined

View File

@@ -222,26 +222,26 @@
<template #default="scope">
<template v-if="scope.row.adviceType == 1">
<template v-if="!scope.row.groupPackageId">
<el-input
style="width: 70px; margin-right: 10px"
v-model="scope.row.doseQuantity"
@input="
(value) => {
scope.row.dose = value * scope.row.unitConversionRatio;
}
"
/>
<span>{{ scope.row.minUnitCode_dictText }}</span>
<span>{{ ' = ' }}</span>
<el-input
style="width: 70px; margin-right: 10px"
v-model="scope.row.dose"
@input="
(value) => {
scope.row.doseQuantity = value / scope.row.unitConversionRatio;
}
"
/>
<el-input
style="width: 70px; margin-right: 10px"
v-model="scope.row.doseQuantity"
@input="
(value) => {
scope.row.dose = value / scope.row.unitConversionRatio;
}
"
/>
<span>{{ scope.row.minUnitCode_dictText }}</span>
<span>{{ ' = ' }}</span>
<el-input
style="width: 70px; margin-right: 10px"
v-model="scope.row.dose"
@input="
(value) => {
scope.row.doseQuantity = value * scope.row.unitConversionRatio;
}
"
/>
<span>{{ scope.row.doseUnitCode_dictText }}</span>
</template>
<span v-else>{{ scope.row.dose }}</span>
@@ -586,6 +586,17 @@ function handleEdit(tab, row) {
selectUnitCode: item.unitCode,
adviceName: item.orderDefinitionName,
unitCodeName: item.unitCodeName,
// 回显单次剂量/给药途径/用药频次/天数等字段
dispensePerDuration: item.dispensePerDuration,
dose: item.dose,
doseQuantity: item.doseQuantity,
methodCode: item.methodCode,
methodCode_dictText: item.methodCode_dictText,
rateCode: item.rateCode,
rateCode_dictText: item.rateCode_dictText,
groupId: item.groupId,
groupOrder: item.groupOrder,
therapyEnum: item.therapyEnum != null ? String(item.therapyEnum) : '1',
};
});
prescriptionList.value.unshift({

View File

@@ -2797,6 +2797,69 @@ function handleSaveBatch(prescriptionId) {
});
}
// 🔧 Bug #218 修复:同步组套中的字段到医嘱列表
function syncGroupFields(row) {
if (!row) return;
// 同步频次(用法)
if (row.rateCode) {
prescriptionList.value[rowIndex.value].rateCode = row.rateCode;
}
// 同步用法(给药途径)
if (row.methodCode) {
prescriptionList.value[rowIndex.value].methodCode = row.methodCode;
}
// 同步总量
if (row.quantity !== undefined && row.quantity !== null) {
prescriptionList.value[rowIndex.value].quantity = row.quantity;
}
// 同步单次剂量
if (row.dose !== undefined && row.dose !== null) {
prescriptionList.value[rowIndex.value].dose = row.dose;
}
// 同步单次剂量单位
if (row.doseUnitCode) {
prescriptionList.value[rowIndex.value].doseUnitCode = row.doseUnitCode;
}
// 同步执行科室
if (row.positionId || row.orgId) {
prescriptionList.value[rowIndex.value].orgId = row.positionId || row.orgId;
}
// 同步皮试标记
if (row.skinTestFlag !== undefined && row.skinTestFlag !== null) {
prescriptionList.value[rowIndex.value].skinTestFlag = row.skinTestFlag;
prescriptionList.value[rowIndex.value].skinTestFlag_enumText = row.skinTestFlag == 1 ? '是' : '否';
}
// 同步注射药品标记
if (row.injectionFlag !== undefined && row.injectionFlag !== null) {
prescriptionList.value[rowIndex.value].injectionFlag = row.injectionFlag;
}
// 同步发药持续时间
if (row.dispensePerDuration !== undefined && row.dispensePerDuration !== null) {
prescriptionList.value[rowIndex.value].dispensePerDuration = row.dispensePerDuration;
}
// 同步给药时机
if (row.doseQuantity !== undefined && row.doseQuantity !== null) {
prescriptionList.value[rowIndex.value].doseQuantity = row.doseQuantity;
}
// 计算总金额
const quantity = prescriptionList.value[rowIndex.value].quantity || row.quantity || 1;
const unitPrice = prescriptionList.value[rowIndex.value].unitPrice || 0;
if (unitPrice > 0 && quantity > 0) {
prescriptionList.value[rowIndex.value].totalPrice = (unitPrice * quantity).toFixed(2);
}
}
function setValue(row) {
unitCodeList.value = [];
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
@@ -2836,8 +2899,11 @@ function setValue(row) {
statusEnum: prescriptionList.value[rowIndex.value].statusEnum,
showPopover: false, // 确保查询框关闭
};
prescriptionList.value[rowIndex.value].orgId = undefined;
prescriptionList.value[rowIndex.value].dose = undefined;
// 🔧 Bug #218 修复:保留组套中的值,不要强制设为undefined
// 只有当值未定义时才使用默认值
prescriptionList.value[rowIndex.value].orgId = row.positionId || row.orgId;
prescriptionList.value[rowIndex.value].dose = row.dose || row.doseQuantity;
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
prescriptionList.value[rowIndex.value].unitCodeList = unitCodeList.value;
prescriptionList.value[rowIndex.value].doseUnitCode = row.doseUnitCode;
prescriptionList.value[rowIndex.value].minUnitCode = row.minUnitCode;
@@ -2893,6 +2959,8 @@ function setValue(row) {
.toFixed(6);
prescriptionList.value[rowIndex.value].positionName = stock.locationName;
}
// 🔧 Bug #218 修复:同步组套中的其他字段(频次、用法、总量、单次剂量、皮试等)
syncGroupFields(row);
} else if (row.adviceType == 4) {
// 🔧 Bug #147 修复:耗材类型(adviceType=4)的专门处理
// 耗材从getDeviceList接口获取使用priceList中的价格
@@ -2906,8 +2974,9 @@ function setValue(row) {
prescriptionList.value[rowIndex.value].unitPrice = validPrice;
prescriptionList.value[rowIndex.value].unitTempPrice = validPrice;
prescriptionList.value[rowIndex.value].minUnitPrice = validPrice;
prescriptionList.value[rowIndex.value].quantity = 1;
prescriptionList.value[rowIndex.value].totalPrice = validPrice;
// 🔧 Bug #218 修复保留组套中的quantity如果没有则默认1
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
prescriptionList.value[rowIndex.value].totalPrice = validPrice * (row.quantity || 1);
prescriptionList.value[rowIndex.value].positionName = row.positionName || '';
// 🔧 Bug Fix: 使用 positionId如果为空则使用患者信息中的 orgId
console.log('设置耗材locationId:', {
@@ -2946,6 +3015,8 @@ function setValue(row) {
}
}
}
// 🔧 Bug #218 修复:最后统一同步组套字段(适用于所有类型)
syncGroupFields(row);
}
// 选择组套 - 适配新版 OrderGroupDrawer 组件