fix(medical): 修复医嘱剂量计算和数据同步问题
- 修正剂量转换公式,将乘法改为除法以正确计算 - 修复剂量数量字段的计算逻辑错误 - 添加字典文本字段回显支持 - 实现医嘱组套字段同步功能 - 保留组套中的原始值而不是强制重置 - 修复设备名称映射字段错误
This commit is contained in:
@@ -194,7 +194,7 @@
|
|||||||
SELECT tad.dev_act_id,
|
SELECT tad.dev_act_id,
|
||||||
tad.quantity,
|
tad.quantity,
|
||||||
tad.unit_code,
|
tad.unit_code,
|
||||||
addf.device_name,
|
addf.name AS device_name,
|
||||||
addf.py_str AS device_py_str,
|
addf.py_str AS device_py_str,
|
||||||
addf.wb_str AS device_wb_str
|
addf.wb_str AS device_wb_str
|
||||||
FROM tmp_activity_device tad
|
FROM tmp_activity_device tad
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
v-model="scope.row.doseQuantity"
|
v-model="scope.row.doseQuantity"
|
||||||
@input="
|
@input="
|
||||||
(value) => {
|
(value) => {
|
||||||
scope.row.dose = value * scope.row.unitConversionRatio;
|
scope.row.dose = value / scope.row.unitConversionRatio;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
v-model="scope.row.dose"
|
v-model="scope.row.dose"
|
||||||
@input="
|
@input="
|
||||||
(value) => {
|
(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,
|
dose: item.dose,
|
||||||
doseQuantity: item.doseQuantity,
|
doseQuantity: item.doseQuantity,
|
||||||
methodCode: item.methodCode,
|
methodCode: item.methodCode,
|
||||||
|
methodCode_dictText: item.methodCode_dictText,
|
||||||
rateCode: item.rateCode,
|
rateCode: item.rateCode,
|
||||||
|
rateCode_dictText: item.rateCode_dictText,
|
||||||
// 医嘱类型(药品=1):没有则按表名推断(药品表 -> 药品)
|
// 医嘱类型(药品=1):没有则按表名推断(药品表 -> 药品)
|
||||||
adviceType:
|
adviceType:
|
||||||
item.adviceType !== undefined
|
item.adviceType !== undefined
|
||||||
|
|||||||
@@ -222,26 +222,26 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<template v-if="scope.row.adviceType == 1">
|
<template v-if="scope.row.adviceType == 1">
|
||||||
<template v-if="!scope.row.groupPackageId">
|
<template v-if="!scope.row.groupPackageId">
|
||||||
<el-input
|
<el-input
|
||||||
style="width: 70px; margin-right: 10px"
|
style="width: 70px; margin-right: 10px"
|
||||||
v-model="scope.row.doseQuantity"
|
v-model="scope.row.doseQuantity"
|
||||||
@input="
|
@input="
|
||||||
(value) => {
|
(value) => {
|
||||||
scope.row.dose = value * scope.row.unitConversionRatio;
|
scope.row.dose = value / scope.row.unitConversionRatio;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<span>{{ scope.row.minUnitCode_dictText }}</span>
|
<span>{{ scope.row.minUnitCode_dictText }}</span>
|
||||||
<span>{{ ' = ' }}</span>
|
<span>{{ ' = ' }}</span>
|
||||||
<el-input
|
<el-input
|
||||||
style="width: 70px; margin-right: 10px"
|
style="width: 70px; margin-right: 10px"
|
||||||
v-model="scope.row.dose"
|
v-model="scope.row.dose"
|
||||||
@input="
|
@input="
|
||||||
(value) => {
|
(value) => {
|
||||||
scope.row.doseQuantity = value / scope.row.unitConversionRatio;
|
scope.row.doseQuantity = value * scope.row.unitConversionRatio;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<span>{{ scope.row.doseUnitCode_dictText }}</span>
|
<span>{{ scope.row.doseUnitCode_dictText }}</span>
|
||||||
</template>
|
</template>
|
||||||
<span v-else>{{ scope.row.dose }}</span>
|
<span v-else>{{ scope.row.dose }}</span>
|
||||||
@@ -586,6 +586,17 @@ function handleEdit(tab, row) {
|
|||||||
selectUnitCode: item.unitCode,
|
selectUnitCode: item.unitCode,
|
||||||
adviceName: item.orderDefinitionName,
|
adviceName: item.orderDefinitionName,
|
||||||
unitCodeName: item.unitCodeName,
|
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({
|
prescriptionList.value.unshift({
|
||||||
|
|||||||
@@ -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) {
|
function setValue(row) {
|
||||||
unitCodeList.value = [];
|
unitCodeList.value = [];
|
||||||
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
|
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,
|
statusEnum: prescriptionList.value[rowIndex.value].statusEnum,
|
||||||
showPopover: false, // 确保查询框关闭
|
showPopover: false, // 确保查询框关闭
|
||||||
};
|
};
|
||||||
prescriptionList.value[rowIndex.value].orgId = undefined;
|
// 🔧 Bug #218 修复:保留组套中的值,不要强制设为undefined
|
||||||
prescriptionList.value[rowIndex.value].dose = 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].unitCodeList = unitCodeList.value;
|
||||||
prescriptionList.value[rowIndex.value].doseUnitCode = row.doseUnitCode;
|
prescriptionList.value[rowIndex.value].doseUnitCode = row.doseUnitCode;
|
||||||
prescriptionList.value[rowIndex.value].minUnitCode = row.minUnitCode;
|
prescriptionList.value[rowIndex.value].minUnitCode = row.minUnitCode;
|
||||||
@@ -2893,6 +2959,8 @@ function setValue(row) {
|
|||||||
.toFixed(6);
|
.toFixed(6);
|
||||||
prescriptionList.value[rowIndex.value].positionName = stock.locationName;
|
prescriptionList.value[rowIndex.value].positionName = stock.locationName;
|
||||||
}
|
}
|
||||||
|
// 🔧 Bug #218 修复:同步组套中的其他字段(频次、用法、总量、单次剂量、皮试等)
|
||||||
|
syncGroupFields(row);
|
||||||
} else if (row.adviceType == 4) {
|
} else if (row.adviceType == 4) {
|
||||||
// 🔧 Bug #147 修复:耗材类型(adviceType=4)的专门处理
|
// 🔧 Bug #147 修复:耗材类型(adviceType=4)的专门处理
|
||||||
// 耗材从getDeviceList接口获取,使用priceList中的价格
|
// 耗材从getDeviceList接口获取,使用priceList中的价格
|
||||||
@@ -2906,8 +2974,9 @@ function setValue(row) {
|
|||||||
prescriptionList.value[rowIndex.value].unitPrice = validPrice;
|
prescriptionList.value[rowIndex.value].unitPrice = validPrice;
|
||||||
prescriptionList.value[rowIndex.value].unitTempPrice = validPrice;
|
prescriptionList.value[rowIndex.value].unitTempPrice = validPrice;
|
||||||
prescriptionList.value[rowIndex.value].minUnitPrice = validPrice;
|
prescriptionList.value[rowIndex.value].minUnitPrice = validPrice;
|
||||||
prescriptionList.value[rowIndex.value].quantity = 1;
|
// 🔧 Bug #218 修复:保留组套中的quantity,如果没有则默认1
|
||||||
prescriptionList.value[rowIndex.value].totalPrice = validPrice;
|
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
||||||
|
prescriptionList.value[rowIndex.value].totalPrice = validPrice * (row.quantity || 1);
|
||||||
prescriptionList.value[rowIndex.value].positionName = row.positionName || '';
|
prescriptionList.value[rowIndex.value].positionName = row.positionName || '';
|
||||||
// 🔧 Bug Fix: 使用 positionId,如果为空则使用患者信息中的 orgId
|
// 🔧 Bug Fix: 使用 positionId,如果为空则使用患者信息中的 orgId
|
||||||
console.log('设置耗材locationId:', {
|
console.log('设置耗材locationId:', {
|
||||||
@@ -2946,6 +3015,8 @@ function setValue(row) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 🔧 Bug #218 修复:最后统一同步组套字段(适用于所有类型)
|
||||||
|
syncGroupFields(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选择组套 - 适配新版 OrderGroupDrawer 组件
|
// 选择组套 - 适配新版 OrderGroupDrawer 组件
|
||||||
|
|||||||
Reference in New Issue
Block a user