From 1ac2252c346c71abcaf373cd143b9a278f6879ae Mon Sep 17 00:00:00 2001 From: guanyu Date: Sun, 24 May 2026 14:55:18 +0800 Subject: [PATCH] fix: #568 (codex) --- .../views/clinicmanagement/dayEnd/index.vue | 103 ++++++++---- .../outPatientCharge.vue | 148 +++++++++--------- 2 files changed, 148 insertions(+), 103 deletions(-) diff --git a/openhis-ui-vue3/src/views/clinicmanagement/dayEnd/index.vue b/openhis-ui-vue3/src/views/clinicmanagement/dayEnd/index.vue index 0a606cee..cd7d13fe 100755 --- a/openhis-ui-vue3/src/views/clinicmanagement/dayEnd/index.vue +++ b/openhis-ui-vue3/src/views/clinicmanagement/dayEnd/index.vue @@ -150,6 +150,10 @@ 普通挂号费: {{ formatValue(reportValue.GENERAL_CONSULTATION_FEE) }} + + 挂号费: + {{ formatValue(reportValue.REGISTRATION_FEE) }} + 其他费用: {{ formatValue(reportValue.OTHER_FEE) }} @@ -158,15 +162,15 @@ 退费金额: {{ formatValue(reportValue.returnFee) }} + + 费用总额: - {{ formatValue(Number(reportValue.DIAGNOSTIC_FEE || 0) + Number(reportValue.CHECK_FEE || 0) + Number(reportValue.DIAGNOSTIC_TEST_FEE || 0) + Number(reportValue.MEDICAL_EXPENSE_FEE || 0) + Number(reportValue.WEST_MEDICINE || 0) + Number(reportValue.CHINESE_MEDICINE_SLICES_FEE || 0) + Number(reportValue.CHINESE_MEDICINE_FEE || 0) + Number(reportValue.GENERAL_CONSULTATION_FEE || 0) + Number(reportValue.REGISTRATION_FEE || 0) + Number(reportValue.OTHER_FEE || 0) + Number(reportValue.SANITARY_MATERIALS_FEE || 0)) }} + {{ totalFeeAmount }} - - 医保报销: - {{ formatValue(Number(reportValue.tcSum || 0) + Number(reportValue.zhSum || 0)) }} + {{ insuranceReimbursement }} @@ -174,7 +178,7 @@ diff --git a/openhis-ui-vue3/src/views/medicationmanagement/statisticalManagement/outPatientCharge.vue b/openhis-ui-vue3/src/views/medicationmanagement/statisticalManagement/outPatientCharge.vue index 8a435e77..bc271392 100755 --- a/openhis-ui-vue3/src/views/medicationmanagement/statisticalManagement/outPatientCharge.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/statisticalManagement/outPatientCharge.vue @@ -298,6 +298,7 @@ const { proxy } = getCurrentInstance(); const totalAmount = ref(0); const purchaseinventoryListAll = ref([]); const xiaojiTotal = ref([]); +const rowSpanMap = ref({}); const rowSpan = ref(1); const issuerOptions = ref([]); const payeeOptions = ref([]); @@ -548,92 +549,91 @@ function handleTotalAmount() { }, 0); } -// 门诊号合并行处理 -function getTotals(row, i) { - let totalPriceSums = Number(purchaseinventoryList.value[i].totalPrice); - - for (let j = 1; i - j >= 0; j++) { - if (purchaseinventoryList.value[i].busNo == purchaseinventoryList.value[i - j].busNo) { - totalPriceSums += Number(purchaseinventoryList.value[i - j].totalPrice); - } - } - - xiaojiTotal.value.push({ - inde: i + 1, - busNo: row.busNo, - genderEnum_enumText: row.genderEnum_enumText, - totalPrice: totalPriceSums.toFixed(4) || 0.0, - }); - - purchaseinventoryList.value.splice(i + 1, 0, { - busNo: row.busNo, - genderEnum_enumText: row.genderEnum_enumText, - departmentName: '小计', - totalPrice: totalPriceSums.toFixed(4) || 0.0, - }); -} - -// 表格合并行方法 +// 表格合并行方法(纯函数,不修改数据) const arraySpanMethod = ({ row, column, rowIndex, columnIndex }) => { - if (columnIndex === 1 && purchaseinventoryList.value.length > 0) { - if ( - rowIndex === 0 || - (rowIndex > 0 && row.busNo !== purchaseinventoryList.value[rowIndex - 1]?.busNo) - ) { - let rowspan = 1; - let totalPriceSum = 0; - - for (let i = rowIndex + 1; i < purchaseinventoryList.value.length + 1; i++) { - if (purchaseinventoryList.value[i - 1].departmentName != '合计') { - if ( - purchaseinventoryList.value[i] && - purchaseinventoryList.value[i].busNo === row.busNo - ) { - rowspan++; - totalPriceSum += Number(purchaseinventoryList.value[i].totalPrice); - - if (i == purchaseinventoryList.value.length - 1) { - let findIndexTotal = xiaojiTotal.value.findIndex((k) => k.busNo == row.busNo); - if (findIndexTotal < 0) { - getTotals(row, i); - } - } - } else { - totalPriceSum += Number(row.totalPrice); - let findIndexTotal = xiaojiTotal.value.findIndex((k) => k.busNo == row.busNo); - - if (findIndexTotal < 0) { - xiaojiTotal.value.push({ - inde: i, - genderEnum_enumText: row.genderEnum_enumText, - busNo: row.busNo, - totalPrice: totalPriceSum, - }); - - purchaseinventoryList.value.splice(i, 0, { - busNo: row.busNo, - genderEnum_enumText: row.genderEnum_enumText, - departmentName: '小计', - totalPrice: totalPriceSum.toFixed(4) || 0.0, - }); - } - break; - } - } - } - - return { rowspan, colspan: 1 }; + // 仅处理科室列(columnIndex === 1)的门诊号合并 + if (columnIndex === 1) { + const spanInfo = rowSpanMap.value[rowIndex]; + if (spanInfo) { + return { rowspan: spanInfo.rowspan, colspan: spanInfo.colspan || 1 }; } else { return { rowspan: 0, colspan: 0 }; } } + // 其他列不合并 + return { rowspan: 1, colspan: 1 }; }; +// 预处理列表数据:插入小计行、计算合并行信息 +// 此函数替代了原来在 arraySpanMethod 中 splice 修改数据的做法 +function processListWithSubtotals(list) { + rowSpanMap.value = {}; + xiaojiTotal.value = []; + + const result = []; + let i = 0; + + while (i < list.length) { + const row = list[i]; + // 跳过已有的合计行 + if (row.departmentName === '合计') { + result.push(row); + i++; + continue; + } + + const currentBusNo = row.busNo; + let rowspan = 0; + let totalPriceSum = 0; + let j = i; + + // 计算相同门诊号的行数 + while (j < list.length && list[j].busNo === currentBusNo && list[j].departmentName !== '合计') { + rowspan++; + totalPriceSum += Number(list[j].totalPrice) || 0; + j++; + } + + // 设置第一行的 rowspan + const startRow = result.length; + rowSpanMap.value[startRow] = { rowspan, colspan: 1 }; + + // 添加数据行 + for (let k = i; k < j; k++) { + result.push(list[k]); + } + + // 添加小计行(多于1行时才添加) + if (rowspan > 1) { + const subtotalRow = { + ...list[i], + departmentName: '小计', + totalPrice: totalPriceSum.toFixed(4), + }; + // 小计行不合并 + rowSpanMap.value[result.length] = { rowspan: 1, colspan: 1 }; + result.push(subtotalRow); + xiaojiTotal.value.push({ + inde: result.length, + busNo: currentBusNo, + genderEnum_enumText: list[i].genderEnum_enumText, + totalPrice: totalPriceSum.toFixed(4), + }); + } + + i = j; + } + + return result; +} + + // 统计类型变化处理 function inventoryChange(val) { queryParams.value.statisticsType = val; xiaojiTotal.value = []; purchaseinventoryList.value = []; + rowSpanMap.value = {}; getList(); }