2 Commits

Author SHA1 Message Date
b4e13e1305 fix: 修复门诊划价新增收费项目总金额未自动计算的问题 (BUG #216)
问题原因:
- prescriptionlist.vue 文件中引用了 calculateTotalPrice 函数但未定义
- 选择收费项目后未设置默认数量,也未触发总金额计算

修复内容:
1. 添加 calculateTotalPrice 函数,根据单价×数量自动计算总金额
2. 选择诊疗项目后自动设置默认执行次数为1并计算总金额
3. 选择耗材项目后自动设置默认数量为1并计算总金额

验证:
- 构建成功,无编译错误
2026-03-18 15:01:10 +08:00
dd1cd17801 fix: 修复门诊划价无法检索收费项目问题 (Bug #215)
问题原因:
- 门诊划价调用 getAdviceBaseInfo 时 pricingFlag 为 null
- SQL 固定过滤 pricing_flag=1 OR IS NULL,导致 pricing_flag=0 的诊疗项目被错误过滤

修复方案:
- 将固定过滤条件改为动态条件
- 当 pricingFlag 为 null 时不添加过滤,查询所有启用状态项目
- 当 pricingFlag 有值时按传入值过滤

影响范围:
- 修复门诊划价检索功能
- 不影响医生站等其他场景的 pricing_flag 过滤逻辑
2026-03-18 14:52:53 +08:00
2 changed files with 42 additions and 1 deletions

View File

@@ -238,7 +238,11 @@
AND T3.organization_id = #{organizationId}
</if>
WHERE t1.delete_flag = '0'
AND (t1.pricing_flag = 1 OR t1.pricing_flag IS NULL)
<!-- 🔧 Bug #215 修复:当 pricingFlag 为 null 时不添加过滤条件,
避免门诊划价场景查询诊疗项目 (adviceType=3) 返回空结果 -->
<if test="pricingFlag != null">
AND (t1.pricing_flag = #{pricingFlag} OR t1.pricing_flag IS NULL)
</if>
<if test="searchKey != null and searchKey != ''">
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
</if>

View File

@@ -567,6 +567,9 @@ function selectAdviceBase(key, row) {
prescriptionList.value[rowIndex.value].locationId = stock.locationId;
prescriptionList.value[rowIndex.value].unitPrice = stock.price;
prescriptionList.value[rowIndex.value].positionName = stock.locationName;
// 设置默认数量为1并计算总金额
prescriptionList.value[rowIndex.value].quantity = 1;
calculateTotalPrice(prescriptionList.value[rowIndex.value], rowIndex.value);
}
} else {
// 诊疗:设置执行科室和价格
@@ -576,6 +579,9 @@ function selectAdviceBase(key, row) {
} else {
prescriptionList.value[rowIndex.value].unitPrice = 0;
}
// 设置默认执行次数为1并计算总金额
prescriptionList.value[rowIndex.value].quantity = 1;
calculateTotalPrice(prescriptionList.value[rowIndex.value], rowIndex.value);
}
expandOrder.value = [key];
@@ -804,6 +810,37 @@ function handleSingOut() {
}
});
}
// 计算总价
function calculateTotalPrice(row, index) {
nextTick(() => {
// 对于诊疗(adviceType=3)和耗材(adviceType=2)使用unitPrice * quantity计算总价
if (row.adviceType == 3 || row.adviceType == 2) {
// 检查价格是否为有效数字
if (row.unitPrice !== undefined && row.unitPrice !== null && !isNaN(row.unitPrice) && isFinite(row.unitPrice)) {
row.totalPrice = (row.unitPrice * row.quantity).toFixed(2);
} else {
row.totalPrice = '0.00';
}
} else {
// 其他类型(如药品)
if (row.unitCode == row.minUnitCode) {
if (row.minUnitPrice !== undefined && row.minUnitPrice !== null && !isNaN(row.minUnitPrice) && isFinite(row.minUnitPrice)) {
row.totalPrice = (row.minUnitPrice * row.quantity).toFixed(2);
} else {
row.totalPrice = '0.00';
}
} else {
if (row.unitPrice !== undefined && row.unitPrice !== null && !isNaN(row.unitPrice) && isFinite(row.unitPrice)) {
row.totalPrice = (row.unitPrice * row.quantity).toFixed(2);
} else {
row.totalPrice = '0.00';
}
}
}
});
}
defineExpose({ getListInfo });
</script>