From f5f4e3c48e281c32a2f730322db836e8f2d7fbea Mon Sep 17 00:00:00 2001 From: chenqi Date: Tue, 13 Jan 2026 17:30:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(charge):=20=E4=BF=AE=E5=A4=8D=E6=94=B6?= =?UTF-8?q?=E8=B4=B9=E6=A8=A1=E5=9D=97=E4=B8=AD=E7=9A=84=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=92=8C=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复金额计算精度问题,使用Number转换和toFixed(2)确保数值准确性 - 添加安全访问操作符(?.)避免空指针异常导致页面崩溃 - 修复数组过滤和查找操作的空值处理逻辑 - 优化错误消息显示,提供更友好的用户提示 - 修复模板文件路径引用问题,确保打印功能正常工作 - 统一金额计算逻辑,避免因数据类型不一致导致的计算错误 --- .../cliniccharge/components/chargeDialog.vue | 2 +- .../src/views/charge/cliniccharge/index.vue | 24 +- .../src/views/charge/clinicrefund/index.vue | 10 +- .../components/chargeDialog.vue | 4 +- .../components/refundDialog.vue | 16 +- .../charge/outpatientregistration/index.vue | 6 +- .../components/MedicationDetails.vue | 4 +- .../components/disposalTemplate.json | 337 +++++++++++++++++ .../components/templateJson.json | 339 ++++++++++++++++++ .../charge/feeSettlement/index.vue | 20 +- 10 files changed, 719 insertions(+), 43 deletions(-) create mode 100644 openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/disposalTemplate.json create mode 100644 openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/templateJson.json diff --git a/openhis-ui-vue3/src/views/charge/cliniccharge/components/chargeDialog.vue b/openhis-ui-vue3/src/views/charge/cliniccharge/components/chargeDialog.vue index 3c1e05b4..4d80a692 100644 --- a/openhis-ui-vue3/src/views/charge/cliniccharge/components/chargeDialog.vue +++ b/openhis-ui-vue3/src/views/charge/cliniccharge/components/chargeDialog.vue @@ -528,7 +528,7 @@ async function printReceipt(param) { const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0; const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0; const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0; - return vxValue + unionValue + aliValue + ' 元'; + return (Number(vxValue) + Number(unionValue) + Number(aliValue)).toFixed(2) + ' 元'; })(), Mr_QR_Code: param.regNo, diff --git a/openhis-ui-vue3/src/views/charge/cliniccharge/index.vue b/openhis-ui-vue3/src/views/charge/cliniccharge/index.vue index c18dbdf7..659a71b6 100644 --- a/openhis-ui-vue3/src/views/charge/cliniccharge/index.vue +++ b/openhis-ui-vue3/src/views/charge/cliniccharge/index.vue @@ -287,7 +287,7 @@ function getPatientList() { queryParams.value.receptionTimeETime = undefined; } getList(queryParams.value).then((res) => { - patientList.value = res.data.data.records; + patientList.value = res.data?.data?.records || []; }); } @@ -363,17 +363,17 @@ function confirmCharge() { encounterId: patientInfo.value.encounterId, chargeItemIds: chargeItemIdList.value, }).then((res) => { - if (res.code == 200) { + if (res.code == 200 && res.data) { // totalAmount.value = res.data.psnCashPay; paymentId.value = res.data.paymentId; chrgBchnoList.value = res.data.chrgBchnoList; - totalAmount.value = res.data.details.find((item) => item.payEnum == 220000).amount; - details.value = res.data.details.filter((item) => { + totalAmount.value = res.data.details?.find((item) => item.payEnum == 220000)?.amount ?? 0; + details.value = res.data.details?.filter((item) => { return item.amount > 0; - }); + }) || []; openDialog.value = true; } else { - proxy.$modal.msgError(res.msg); + proxy.$modal.msgError(res?.msg || '预结算失败'); } }); // console.log(patientInfo) @@ -517,11 +517,11 @@ async function handleReadCard(value) { ybMdtrtCertType: userCardInfo.psnCertType, busiCardInfo: userCardInfo.busiCardInfo, }).then((res) => { - if (res.code == 200) { + if (res.code == 200 && res.data) { // totalAmount.value = res.data.psnCashPay; paymentId.value = res.data.paymentId; - totalAmount.value = res.data.details.find((item) => item.payEnum == 220000).amount; - details.value = res.data.details; + totalAmount.value = res.data.details?.find((item) => item.payEnum == 220000)?.amount ?? 0; + details.value = res.data.details || []; // chrgBchnoList.value = res.data.chrgBchnoList; chargeItemIdList.value = selectRows.map((item) => { return item.id; @@ -537,7 +537,7 @@ async function handleReadCard(value) { }); openDialog.value = true; } else { - proxy.$modal.msgError(res.msg); + proxy.$modal.msgError(res?.msg || '预结算失败'); } }); } @@ -648,9 +648,9 @@ function printCharge(row) { getChargeInfo({ paymentId: row.paymentId }).then((res) => { // 设置实收金额 if (res.data && res.data.detail) { - const amountDetail = res.data.detail.find((item) => item.payEnum == 220000); + const amountDetail = res.data.detail?.find((item) => item.payEnum == 220000); if (amountDetail) { - totalAmount.value = amountDetail.amount; + totalAmount.value = amountDetail.amount || 0; // 为合并的行设置金额相关字段值 rows.forEach((item) => { diff --git a/openhis-ui-vue3/src/views/charge/clinicrefund/index.vue b/openhis-ui-vue3/src/views/charge/clinicrefund/index.vue index e0b095ac..bd6534e2 100644 --- a/openhis-ui-vue3/src/views/charge/clinicrefund/index.vue +++ b/openhis-ui-vue3/src/views/charge/clinicrefund/index.vue @@ -302,14 +302,14 @@ function handleRefund(row) { // return new Decimal(accumulator).add(new Decimal(currentRow.totalPrice || 0)); // }, 0); getReturnDetail({ id: row.paymentId }).then((res) => { - if (res.data.length > 0) { + if (res.data?.length > 0) { totalAmount.value = - res.data.find((item) => item.payEnum === 220000).amount - - (res.data.find((item) => item.payEnum === 220500)?.amount || 0); + (res.data.find((item) => item.payEnum === 220000)?.amount ?? 0) - + (res.data.find((item) => item.payEnum === 220500)?.amount ?? 0); } - details.value = res.data.filter((item) => { + details.value = res.data?.filter((item) => { return item.amount > 0; - }); + }) || []; }); paymentId.value = row.paymentId; patientInfo.value.patientId = row.patientId; diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/chargeDialog.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/chargeDialog.vue index 3268a5b3..d90c8980 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/chargeDialog.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/chargeDialog.vue @@ -128,7 +128,7 @@ const getFeeTypeText = computed(() => { } // 如果只有一个选项,直接返回第一个选项的文本 if (props.medfee_paymtd_code.length === 1) { - return props.medfee_paymtd_code[0].label || ''; + return props.medfee_paymtd_code[0]?.label || ''; } return ''; }); @@ -351,7 +351,7 @@ async function printReceipt(param) { const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0; const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0; const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0; - return vxValue + unionValue + aliValue + '元'; + return (Number(vxValue) + Number(unionValue) + Number(aliValue)).toFixed(2) + '元'; })(), // 患者信息 diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/refundDialog.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/refundDialog.vue index 5f33e96f..dff7a44d 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/refundDialog.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/refundDialog.vue @@ -196,7 +196,7 @@ watch( // 计算应退金额并更新表单数据 const targetPayEnums = [220500, 220400, 220100, 220200, 220300]; const sum = res.data - .filter((item) => targetPayEnums.includes(item.payEnum)) + ?.filter((item) => targetPayEnums.includes(item.payEnum)) .reduce((total, item) => total + (Number(item.amount) || 0), 0); if (sum > 0) { formData.totalAmount = sum; @@ -313,9 +313,9 @@ const displayAmount = computed(() => { } const targetPayEnums = [220500, 220400, 220100, 220200, 220300]; const sum = preCancelData.value - .filter((item) => targetPayEnums.includes(item.payEnum)) + ?.filter((item) => targetPayEnums.includes(item.payEnum)) .reduce((sum, item) => sum + (Number(item.amount) || 0), 0); - return sum.toFixed(2); + return sum?.toFixed(2) ?? '0.00'; }); const returnedAmount = computed(() => { @@ -334,7 +334,7 @@ const calculatedTotalAmount = computed(() => { const targetPayEnums = [220500, 220400, 220100, 220200, 220300]; // 应退金额 = (amount - returnAmount) 的总和,即剩余应退金额 const sum = preCancelData.value - .filter((item) => targetPayEnums.includes(item.payEnum)) + ?.filter((item) => targetPayEnums.includes(item.payEnum)) .reduce( (total, item) => total + ((Number(item.amount) || 0) - (Number(item.returnAmount) || 0)), 0 @@ -348,7 +348,7 @@ const calculatedReturnAmount = computed(() => { } const targetPayEnums = [220500, 220400, 220100, 220200, 220300]; const sum = preCancelData.value - .filter((item) => targetPayEnums.includes(item.payEnum)) + ?.filter((item) => targetPayEnums.includes(item.payEnum)) .reduce((total, item) => total + (Number(item.returnAmount) || 0), 0); return sum || 0; }); @@ -359,12 +359,12 @@ const refundMethodsFromApi = computed(() => { return []; } const targetPayEnums = [220500, 220400, 220100, 220200, 220300]; - return preCancelData.value.filter( + return preCancelData.value?.filter( (item) => targetPayEnums.includes(item.payEnum) && item.payEnum_dictText && item.payEnum_dictText.trim() !== '' - ); + ) || []; }); // 根据 payEnum 获取支付方式标签 @@ -380,7 +380,7 @@ const getPayMethodLabel = (payEnum) => { // 计算所有退费方式的总和 const totalRefundAmount = computed(() => { - return refundMethodsFromApi.value.reduce((sum, item) => sum + (Number(item.amount) || 0), 0); + return refundMethodsFromApi.value?.reduce((sum, item) => sum + (Number(item.amount) || 0), 0) ?? 0; }); // 计算剩余可输入金额(应退金额 - 已输入的退费金额总和) diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue index 22c7ea00..2d127da2 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue @@ -801,10 +801,10 @@ const { queryParams, form, rules } = toRefs(data); /** 根据contractNo获取费用性质名称 */ function getFeeTypeName(contractNo) { - if (!contractNo || !medfee_paymtd_code || !Array.isArray(medfee_paymtd_code)) { + if (!contractNo || !medfee_paymtd_code?.value || !Array.isArray(medfee_paymtd_code.value)) { return ''; } - const dictItem = medfee_paymtd_code.find(item => item.value === contractNo); + const dictItem = medfee_paymtd_code.value.find(item => item.value === contractNo); return dictItem ? dictItem.label : ''; } @@ -1185,7 +1185,7 @@ function filterDoctorsByHealthcare() { } // 获取选中的挂号类型信息 - const selectedHealthcare = healthcareList.value.find( + const selectedHealthcare = healthcareList.value?.find( (healthcare) => healthcare.id === form.value.serviceTypeId ); diff --git a/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/MedicationDetails.vue b/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/MedicationDetails.vue index c927f2f2..7d04dea3 100644 --- a/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/MedicationDetails.vue +++ b/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/MedicationDetails.vue @@ -291,8 +291,8 @@ import {advicePrint, getAdjustPriceSwitchState, lotNumberMatch} from '@/api/publ import {debounce} from 'lodash-es'; import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue'; import {hiprint} from 'vue-plugin-hiprint'; -import templateJson from './components/templateJson.json'; -import disposalTemplate from './components/disposalTemplate.json'; +import templateJson from './templateJson.json'; +import disposalTemplate from './disposalTemplate.json'; import {formatInventory} from '@/utils/his.js'; import useUserStore from '@/store/modules/user'; diff --git a/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/disposalTemplate.json b/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/disposalTemplate.json new file mode 100644 index 00000000..ed38afe8 --- /dev/null +++ b/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/disposalTemplate.json @@ -0,0 +1,337 @@ +{ + "panels": [ + { + "index": 0, + "name": 1, + "paperType": "A5", + "height": 210, + "width": 148, + "paperHeader": 0, + "paperFooter": 592.4409448818898, + "paperNumberDisabled": true, + "paperNumberContinue": true, + "expandCss": "", + "overPrintOptions": { + "content": "", + "opacity": 0.7, + "type": 1 + }, + "watermarkOptions": { + "content": "", + "fillStyle": "rgba(184, 184, 184, 0.3)", + "fontSize": "14px", + "rotate": 25, + "width": 200, + "height": 200, + "timestamp": false, + "format": "YYYY-MM-DD HH:mm" + }, + "panelLayoutOptions": {}, + "printElements": [ + { + "options": { + "left": 0, + "top": 22.5, + "height": 12, + "width": 420, + "title": "{{HOSPITAL_NAME}}", + "coordinateSync": false, + "widthHeightSync": false, + "fontSize": 13.5, + "qrCodeLevel": 0, + "textAlign": "center" + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 0, + "top": 45, + "height": 9.75, + "width": 420, + "title": "处置单", + "coordinateSync": false, + "widthHeightSync": false, + "fontSize": 11.25, + "qrCodeLevel": 0, + "textAlign": "center" + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 22.5, + "top": 67.5, + "height": 9.75, + "width": 120, + "title": "姓名", + "field": "patientName", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 157.5, + "top": 67.5, + "height": 9.75, + "width": 120, + "title": "年龄", + "field": "age", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 300, + "top": 67.5, + "height": 9.75, + "width": 120, + "title": "性别", + "field": "genderEnum_enumText", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 22.5, + "top": 94.5, + "height": 9.75, + "width": 96, + "title": "科室", + "field": "departmentName", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 156, + "top": 94.5, + "height": 9.75, + "width": 118.5, + "title": "费用性质", + "field": "contractName", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 300, + "top": 94.5, + "height": 9.75, + "width": 120, + "title": "日期", + "field": "reqTime", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 22.5, + "top": 121.5, + "height": 9.75, + "width": 123, + "title": "门诊号", + "field": "encounterNo", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 156, + "top": 121.5, + "height": 9.75, + "width": 120, + "title": "开单医生", + "field": "doctorName", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 18, + "top": 141, + "height": 9, + "width": 393, + "borderWidth": "1.5", + "title": "undefined+beforeDragIn", + "coordinateSync": false, + "widthHeightSync": false + }, + "printElementType": { + "title": "横线", + "type": "hline" + } + }, + { + "options": { + "left": 22.5, + "top": 156, + "height": 9.75, + "width": 24, + "title": "Rp", + "coordinateSync": false, + "widthHeightSync": false, + "fontSize": 12, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 22.5, + "top": 177, + "height": 36, + "width": 387, + "title": "undefined+beforeDragIn", + "coordinateSync": false, + "widthHeightSync": false, + "field": "adviceItemList", + "columns": [ + [ + { + "title": "项目名", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 180.11284430829235, + "field": "itemName", + "checked": true, + "columnId": "itemName", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "单价", + "titleSync": false, + "align": "right", + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }", + "width": 65.15543233883191, + "field": "unitPrice", + "checked": true, + "columnId": "unitPrice", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "数量", + "titleSync": false, + "align": "right", + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' ' + row.unitCode_dictText; }", + "width": 61.720533008519084, + "field": "quantity", + "checked": true, + "columnId": "quantity", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "执行次数", + "titleSync": false, + "align": "right", + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 80.01119034435662, + "field": "quantity", + "checked": true, + "columnId": "quantity", + "fixed": false, + "rowspan": 1, + "colspan": 1 + } + ] + ] + }, + "printElementType": { + "title": "表格", + "type": "table", + "editable": true, + "columnDisplayEditable": true, + "columnDisplayIndexEditable": true, + "columnTitleEditable": true, + "columnResizable": true, + "columnAlignEditable": true, + "isEnableEditField": true, + "isEnableContextMenu": true, + "isEnableInsertRow": true, + "isEnableDeleteRow": true, + "isEnableInsertColumn": true, + "isEnableDeleteColumn": true, + "isEnableMergeCell": true + } + } + ] + } + ] +} \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/templateJson.json b/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/templateJson.json new file mode 100644 index 00000000..8e29c6be --- /dev/null +++ b/openhis-ui-vue3/src/views/drug/inpatientMedicationDispensing/components/templateJson.json @@ -0,0 +1,339 @@ +{ + "panels": [ + { + "index": 0, + "name": 1, + "paperType": "自定义", + "height": 130, + "width": 210, + "paperNumberDisabled": true, + "paperNumberContinue": true, + "overPrintOptions": { + "content": "", + "opacity": 0.7, + "type": 1 + }, + "watermarkOptions": { + "content": "", + "fillStyle": "rgba(184, 184, 184, 0.3)", + "fontSize": "14px", + "rotate": 25, + "width": 200, + "height": 200, + "timestamp": false, + "format": "YYYY-MM-DD HH:mm" + }, + "panelLayoutOptions": {}, + "paperHeader": 0, + "paperFooter": 841.8897637795277, + "printElements": [ + { + "options": { + "left": 252, + "top": 13.5, + "height": 12, + "width": 75, + "title": "{{HOSPITAL_NAME}}医院", + "coordinateSync": false, + "widthHeightSync": false, + "fontSize": 12, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 19.5, + "top": 33, + "height": 9.75, + "width": 120, + "title": "日期", + "field": "occurrenceTime", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 222, + "top": 33, + "height": 9.75, + "width": 120, + "title": "单据号", + "field": "busNo", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 465, + "top": 33, + "height": 9.75, + "width": 120, + "title": "机构:{{HOSPITAL_NAME}}医院", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 19.5, + "top": 57, + "height": 9.75, + "width": 322.5, + "title": "供应商", + "field": "supplierName", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0 + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 19.5, + "top": 84, + "height": 36, + "width": 570, + "title": "undefined+beforeDragIn", + "field": "purchaseinventoryList", + "coordinateSync": false, + "widthHeightSync": false, + "columns": [ + [ + { + "title": "项目名", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 53.52877835374887, + "field": "name", + "checked": true, + "columnId": "name", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "规格", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 50.3056193642802, + "field": "volume", + "checked": true, + "columnId": "volume", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "厂家/产地", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 84.09807741407441, + "field": "manufacturerText", + "checked": true, + "columnId": "manufacturerText", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "数量", + "titleSync": false, + "align": "right", + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' ' + row.unitCode_dictText; }", + "width": 37.02194283284556, + "field": "itemQuantity", + "checked": true, + "columnId": "itemQuantity", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "采购单价", + "titleSync": false, + "align": "right", + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }", + "width": 45.05495152300426, + "field": "price", + "checked": true, + "columnId": "price", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "金额", + "titleSync": false, + "align": "right", + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }", + "width": 39.04544357631049, + "field": "totalPrice", + "checked": true, + "columnId": "totalPrice", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "仓库", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 40.041954542099724, + "field": "purposeLocationName", + "checked": true, + "columnId": "purposeLocationName", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "产品批号", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 47.05067091842349, + "field": "lotNumber", + "checked": true, + "columnId": "lotNumber", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "生产日期", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 63.089377997062755, + "field": "startTime", + "checked": true, + "columnId": "startTime", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "有效期至", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 59.05673483929025, + "field": "endTime", + "checked": true, + "columnId": "endTime", + "fixed": false, + "rowspan": 1, + "colspan": 1 + }, + { + "title": "发票号", + "titleSync": false, + "halign": "center", + "tableQRCodeLevel": 0, + "tableSummaryTitle": true, + "tableSummary": "", + "width": 51.706448638859854, + "field": "invoiceNo", + "checked": true, + "columnId": "invoiceNo", + "fixed": false, + "rowspan": 1, + "colspan": 1 + } + ] + ] + }, + "printElementType": { + "title": "表格", + "type": "table", + "editable": true, + "columnDisplayEditable": true, + "columnDisplayIndexEditable": true, + "columnTitleEditable": true, + "columnResizable": true, + "columnAlignEditable": true, + "isEnableEditField": true, + "isEnableContextMenu": true, + "isEnableInsertRow": true, + "isEnableDeleteRow": true, + "isEnableInsertColumn": true, + "isEnableDeleteColumn": true, + "isEnableMergeCell": true + } + }, + { + "options": { + "left": 480, + "top": 130.5, + "height": 12, + "width": 109.5, + "title": "合计", + "field": "totalAmount", + "coordinateSync": false, + "widthHeightSync": false, + "qrCodeLevel": 0, + "formatter": "function(title,value,options,templateData,target,paperNo){\n return value + ' 元'\n}" + }, + "printElementType": { + "title": "文本", + "type": "text" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/inHospitalManagement/charge/feeSettlement/index.vue b/openhis-ui-vue3/src/views/inHospitalManagement/charge/feeSettlement/index.vue index 85d8b0d9..6f50d98f 100644 --- a/openhis-ui-vue3/src/views/inHospitalManagement/charge/feeSettlement/index.vue +++ b/openhis-ui-vue3/src/views/inHospitalManagement/charge/feeSettlement/index.vue @@ -498,21 +498,21 @@ function confirmCharge() { encounterId: patientInfo.value.encounterId, chargeItemIds: chargeItemIdList.value, }).then((res) => { - if (res.code == 200) { - const item = res.data.paymentRecDetailDtoList.find((i) => { + if (res.code == 200 && res.data) { + const item = res.data.paymentRecDetailDtoList?.find((i) => { return i.payEnum == 220000; }); - totalAmount.value = item?.amount; + totalAmount.value = item?.amount ?? 0; paymentId.value = res.data.id; newId.value = res.data.newId; oldId.value = res.data.oldId; chrgBchnoList.value = res.data.chrgBchnoList; details.value = res.data.paymentRecDetailDtoList?.filter((item) => { return item.amount > 0; - }); + }) || []; openDialog.value = true; } else { - proxy.$modal.msgError(res.msg); + proxy.$modal.msgError(res?.msg || '预结算失败'); } }); // console.log(patientInfo) @@ -656,12 +656,12 @@ async function handleReadCard(value) { ybMdtrtCertType: userCardInfo.psnCertType, busiCardInfo: userCardInfo.busiCardInfo, }).then((res) => { - if (res.code == 200) { + if (res.code == 200 && res.data) { paymentId.value = res.data.id; - totalAmount.value = res.data.paymentRecDetailDtoList.find( + totalAmount.value = res.data.paymentRecDetailDtoList?.find( (item) => item.payEnum == 220000 - ).amount; - details.value = res.data.paymentRecDetailDtoList; + )?.amount ?? 0; + details.value = res.data.paymentRecDetailDtoList || []; // chrgBchnoList.value = res.data.chrgBchnoList; chargeItemIdList.value = selectRows.map((item) => { return item.id; @@ -680,7 +680,7 @@ async function handleReadCard(value) { openDialog.value = true; } else { - proxy.$modal.msgError(res.msg); + proxy.$modal.msgError(res?.msg || '预结算失败'); } }); }