This commit is contained in:
Ranyunqiao
2026-06-24 14:20:27 +08:00
parent 1a6cd9af9b
commit 77e4286fde
2 changed files with 27 additions and 18 deletions

View File

@@ -1020,6 +1020,10 @@ const statusFlagOptions = ref(undefined);
const domainEnumOptions = ref(undefined);
const deptOptions = ref(undefined); // 部门树选项
const locationOptions = ref(undefined); // 地点树选项
const supplierListOptions = ref(undefined);
const statusRestrictedOptions = ref(undefined);
const partAttributeEnumOptions = ref(undefined);
const tempOrderSplitPropertyOptions = ref(undefined);
const activeName = ref('basic');
const data = reactive({
form: {},

View File

@@ -4877,8 +4877,8 @@ function convertValues(row, index) {
row.dose = row.doseQuantity / row.partPercent;
break;
}
calculateTotalAmount(row, index);
});
// calculateTotalAmount(row, index);
}
// 单次剂量数量改变时自动计算总量
@@ -4904,8 +4904,8 @@ function convertDoseValues(row, index) {
row.doseQuantity = row.dose * row.partPercent;
break;
}
calculateTotalAmount(row, index);
});
// calculateTotalAmount(row, index);
}
// 总量计算,仅适用只有两种单位的情况
@@ -4921,11 +4921,6 @@ function calculateTotalAmount(row, index) {
return;
}
if (row.adviceType == 2) {
calculateTotalPrice(row, index);
return;
}
if (row.adviceType != 1 && row.adviceType != 2) {
return;
}
@@ -4937,7 +4932,7 @@ function calculateTotalAmount(row, index) {
let quantity;
if (row.unitCode == row.minUnitCode) {
quantity = calculateQuantityBySplitType(row.partAttributeEnum, row.doseQuantity, count);
quantity = calculateQuantityBySplitType(row.partAttributeEnum, row.doseQuantity, count, row.partPercent);
row.quantity = quantity;
row.totalPrice = (quantity * row.minUnitPrice).toFixed(2);
} else {
@@ -4972,7 +4967,7 @@ function calculateTotalAmount(row, index) {
if (count) {
let quantity;
if (row.unitCode == row.minUnitCode) {
quantity = calculateQuantityBySplitType(row.partAttributeEnum, row.doseQuantity, count);
quantity = calculateQuantityBySplitType(row.partAttributeEnum, row.doseQuantity, count, row.partPercent);
prescriptionList.value[index].quantity = quantity;
prescriptionList.value[index].totalPrice = (quantity * row.minUnitPrice).toFixed(6);
} else {
@@ -5015,17 +5010,22 @@ function calculateTotalAmount(row, index) {
* @param type 门诊拆分类型
* @param dose 单次剂量 最小单位
* @param count 用药频次和用药天数计算出的总数
* @param partPercent 拆零比
*/
function calculateQuantityBySplitType(type, dose, count) {
switch (type) {
function calculateQuantityBySplitType(type, dose, count, partPercent) {
const percent = Number(partPercent) || 1;
const numType = Number(type);
switch (numType) {
case 1: // 门诊按最小单位每次量向上取整
return Math.ceil(dose) * count;
case 2: // 门诊按包装单位不可拆分
return Math.ceil(dose * count);
return Math.ceil((dose * count) / percent) * percent;
case 3: // 门诊按最小单位总量向上取整
return Math.ceil(dose * count);
case 4: // 门诊按包装单位每次量向上取整
return Math.ceil(dose) * count;
return Math.ceil(dose / percent) * count * percent;
default:
return Math.ceil(dose * count);
}
}
@@ -5035,17 +5035,22 @@ function calculateQuantityBySplitType(type, dose, count) {
* @param type 门诊拆分类型
* @param dose 单次剂量 最小单位
* @param count 用药频次和用药天数计算出的总数
* @param partPercent 拆零比
*/
function calculateQuantity(type, dose, count, partPercent) {
switch (type) {
const percent = Number(partPercent) || 1;
const numType = Number(type);
switch (numType) {
case 1: // 门诊按最小单位每次量向上取整
return Math.ceil(dose / partPercent) * count;
return Math.ceil((Math.ceil(dose) * count) / percent);
case 2: // 门诊按包装单位不可拆分
return Math.ceil(dose * count);
return Math.ceil((dose * count) / percent);
case 3: // 门诊按最小单位总量向上取整
return Math.ceil((dose / partPercent) * count);
return Math.ceil(Math.ceil(dose * count) / percent);
case 4: // 门诊按包装单位每次量向上取整
return Math.ceil(dose) * count;
return Math.ceil(dose / percent) * count;
default:
return Math.ceil((dose * count) / percent);
}
}