fix(medical): 修复医嘱剂量计算和数据同步问题
- 修正剂量转换公式,将乘法改为除法以正确计算 - 修复剂量数量字段的计算逻辑错误 - 添加字典文本字段回显支持 - 实现医嘱组套字段同步功能 - 保留组套中的原始值而不是强制重置 - 修复设备名称映射字段错误
This commit is contained in:
@@ -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 组件
|
||||
|
||||
Reference in New Issue
Block a user