diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java index 430d8bb60..d3b4803e7 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java @@ -150,10 +150,21 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService @Override public R getMedicineSummaryFormPage(DispenseFormSearchParam dispenseFormSearchParam, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) { + // 就诊ID集合 + String encounterIds = dispenseFormSearchParam.getEncounterIds(); + dispenseFormSearchParam.setEncounterIds(null); + // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(dispenseFormSearchParam, searchKey, new HashSet<>(List.of(CommonConstants.FieldName.BusNo)), request); + // 如果传了就诊ID,过滤关联的汇总单 + if (StringUtils.isNotEmpty(encounterIds)) { + queryWrapper.inSql(CommonConstants.FieldName.BusNo, + "SELECT DISTINCT summary_no FROM med_medication_dispense " + + "WHERE encounter_id IN (" + encounterIds + ") AND summary_no IS NOT NULL"); + } + // 汇总单分页列表 Page medicineSummaryFormPage = medicineSummaryAppMapper.selectMedicineSummaryFormPage( new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.PREPARATION.getValue(), diff --git a/healthlink-his-ui/src/components/Print/AdvancePayment.json b/healthlink-his-ui/src/components/Print/AdvancePayment.json index d93cb0f23..433ac7f8a 100755 --- a/healthlink-his-ui/src/components/Print/AdvancePayment.json +++ b/healthlink-his-ui/src/components/Print/AdvancePayment.json @@ -3,33 +3,32 @@ { "index": 0, "name": 1, - "paperType": "自定义", - "height": 80, - "width": 279, + "paperType": "A5", + "height": 148, + "width": 210, "paperList": { - "type": "自定义", - "width": 279, - "height": 80 + "type": "A5", + "width": 210, + "height": 148 }, - "panelPageRule": "none", "paperHeader": 0, - "paperFooter": 422.3622047244095, + "paperFooter": 419.53, "paperNumberDisabled": true, "paperNumberContinue": true, "panelAngle": 0, "overPrintOptions": { "content": "", - "opacity": 0.7, + "opacity": 0.01, "type": 1 }, "watermarkOptions": { "content": "", "fillStyle": "rgba(87, 13, 248, 0.5)", - "fontSize": "36px", - "rotate": 25, - "width": 413, - "height": 310, - "timestamp": true, + "fontSize": "10px", + "rotate": 0, + "width": 100, + "height": 100, + "timestamp": false, "format": "YYYY-MM-DD HH:mm" }, "panelLayoutOptions": { @@ -40,238 +39,30 @@ "printElements": [ { "options": { - "left": 0, - "top": 15, - "height": 16.5, - "width": 792, - "title": "{{HOSPITAL_NAME}}预交金收据", - "coordinateSync": false, - "widthHeightSync": false, - "fontWeight": "bold", - "letterSpacing": 0.75, - "textAlign": "center", - "qrCodeLevel": 0, - "fontSize": 15, - "fontFamily": "Microsoft YaHei" - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 111, - "top": 46.5, - "height": 14, - "width": 151.5, - "title": "姓名", - "coordinateSync": false, - "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "patientName", - "fontFamily": "Microsoft YaHei" - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 295.5, - "top": 48, - "height": 14, - "width": 148.5, - "title": "住院号", - "coordinateSync": false, - "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "encounterNosd", - "fontFamily": "Microsoft YaHei" - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 480, - "top": 48, - "height": 14, - "width": 162, - "title": "科室", - "coordinateSync": false, - "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "inHospitalOrgName", - "fontFamily": "Microsoft YaHei" - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 111, - "top": 73.5, - "height": 14, - "width": 153, - "title": "ID号", - "coordinateSync": false, - "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "patientId", - "fontFamily": "Microsoft YaHei" - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 295.5, - "top": 73.5, - "height": 14, - "width": 147, - "title": "医保类别", - "coordinateSync": false, - "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "contractName", - "fontFamily": "Microsoft YaHei" - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 480, - "top": 73.5, - "height": 14, - "width": 163.5, - "title": "时间", - "coordinateSync": false, - "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "currentTime", - "fontFamily": "Microsoft YaHei" - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 111, - "top": 105, - "height": 25, - "width": 120, - "title": "金额", - "coordinateSync": false, - "widthHeightSync": false, - "textAlign": "center", - "textContentVerticalAlign": "middle", - "borderLeft": "solid", - "borderTop": "solid", - "borderRight": "solid", - "borderBottom": "solid", - "qrCodeLevel": 0 - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 231, - "top": 105, - "height": 25, - "width": 393, - "title": "金额", - "coordinateSync": false, - "widthHeightSync": false, - "textAlign": "center", - "textContentVerticalAlign": "middle", - "borderTop": "solid", - "borderRight": "solid", - "borderBottom": "solid", - "qrCodeLevel": 0, - "field": "balanceAmount", - "hideTitle": true - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 111, - "top": 129, - "height": 30, - "width": 120, - "title": "人民币(大写)", - "coordinateSync": false, - "widthHeightSync": false, - "textAlign": "center", - "textContentVerticalAlign": "middle", - "borderLeft": "solid", - "borderTop": "solid", - "borderRight": "solid", - "qrCodeLevel": 0 - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 231, - "top": 129, - "height": 30, - "width": 393, - "title": "金额", - "coordinateSync": false, - "widthHeightSync": false, - "textAlign": "center", - "textContentVerticalAlign": "middle", - "borderTop": "solid", - "borderRight": "solid", - "qrCodeLevel": 0, - "field": "amountInWords", - "hideTitle": true - }, - "printElementType": { - "title": "文本", - "type": "text" - } - }, - { - "options": { - "left": 111, - "top": 159, - "height": 30, - "width": 513, + "left": 505.5, + "top": 20, + "height": 20, + "width": 60, "title": " ", + "field": "reprintTag", + "hideTitle": true, + "customClass": "reprint-tag", "coordinateSync": false, "widthHeightSync": false, "textAlign": "center", "textContentVerticalAlign": "middle", + "fontSize": 9, + "color": "#ff0000", + "fontWeight": "bold", "borderLeft": "solid", "borderRight": "solid", + "borderTop": "solid", "borderBottom": "solid", + "borderColor": "#ff0000", + "borderWidth": 1.5, "qrCodeLevel": 0, - "field": "paymentDetails", - "hideTitle": true + "fixed": true, + "styler": "function(value, options, target, templateData, paperNo) { if (!value || value.trim() === '') { return { display: 'none' }; } return {}; }" }, "printElementType": { "title": "文本", @@ -280,16 +71,20 @@ }, { "options": { - "left": 111, - "top": 198, - "height": 14, - "width": 120, - "title": "签章", + "left": 30, + "top": 20, + "height": 30, + "width": 535.5, + "title": "{{hospitalName}}", "coordinateSync": false, "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "patientNamesfs", - "fontFamily": "Microsoft YaHei" + "textAlign": "center", + "fontWeight": "bold", + "fontSize": 19.5, + "fontFamily": "SimSun", + "letterSpacing": 5, + "color": "#000000", + "fixed": true }, "printElementType": { "title": "文本", @@ -298,16 +93,20 @@ }, { "options": { - "left": 297, - "top": 198, - "height": 14, - "width": 132, - "title": "交款人", + "left": 30, + "top": 52, + "height": 20, + "width": 535.5, + "title": "住院预缴金收据(收执联)", "coordinateSync": false, "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "patientNameada", - "fontFamily": "Microsoft YaHei" + "textAlign": "center", + "fontSize": 12, + "fontFamily": "SimSun", + "fontWeight": "normal", + "letterSpacing": 2, + "color": "#000000", + "fixed": true }, "printElementType": { "title": "文本", @@ -316,16 +115,143 @@ }, { "options": { - "left": 481.5, - "top": 198, - "height": 14, - "width": 124.5, - "title": "收款人", - "coordinateSync": false, - "widthHeightSync": false, - "qrCodeLevel": 0, - "field": "cashier", - "fontFamily": "Microsoft YaHei" + "left": 30, + "top": 78, + "height": 15, + "width": 250, + "title": "收据号:{{receiptNo}}", + "fontSize": 9, + "color": "#000000", + "fixed": true + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 288.35, + "top": 78, + "height": 15, + "width": 277.15, + "title": "收款日期:{{currentTime}}", + "textAlign": "right", + "fontSize": 9, + "color": "#000000", + "fixed": true + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 14.17, + "top": 96.38, + "width": 566.92, + "height": 185.0, + "title": "
住院号{{encounterNosd}}姓名{{patientName}}性别{{gender}}年龄{{age}}
病区/科室{{inHospitalOrgName}}床号{{bedName}}医保类型{{contractName}}
收费项目住院预缴款
支付方式{{paymentMethod}}
金额(大写){{amountInWords}}
金额(小写){{balanceAmount}}
", + "fixed": true + }, + "printElementType": { + "title": "HTML表格", + "type": "text" + } + }, + { + "options": { + "left": 25.0, + "top": 300.0, + "height": 55.0, + "width": 55.0, + "field": "receiptNo", + "hideTitle": true, + "fixed": true + }, + "printElementType": { + "type": "qrcode" + } + }, + { + "options": { + "left": 15.0, + "top": 359.0, + "height": 11.34, + "width": 80.0, + "title": "扫码查验电子票据", + "textAlign": "center", + "fontSize": 7, + "color": "#000000", + "fixed": true + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 113.39, + "top": 300.0, + "height": 65.0, + "width": 467.7, + "title": "说明/备注:\n1. 本收据为预收款凭证,非最终医疗自费/统筹消费发票。\n2. 患者出院结算时,须凭此收据联原件退回换取正式的住院发票。\n3. 请妥善保管此收据。如若遗失,请及时前往收费处办理挂失及证明审核。", + "fontSize": 8, + "lineHeight": 14, + "color": "#000000", + "fixed": true + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 14.17, + "top": 376.0, + "height": 14.17, + "width": 566.92, + "title": "根据《中华人民共和国电子签名法》规定,本电子票据由医院开具并经国家电子认证中心认证,具有法律效力。请妥善保管。", + "textAlign": "center", + "fontSize": 7, + "color": "#000000", + "fixed": true + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 14.17, + "top": 396.0, + "height": 17.01, + "width": 320.0, + "title": "收款单位:{{hospitalName}}财务结算专用章(电子印章)", + "fontSize": 9, + "color": "#000000", + "fixed": true + }, + "printElementType": { + "title": "文本", + "type": "text" + } + }, + { + "options": { + "left": 330.0, + "top": 396.0, + "height": 17.01, + "width": 251.1, + "title": "收款员:{{cashier}}", + "textAlign": "right", + "fontSize": 9, + "color": "#000000", + "fixed": true }, "printElementType": { "title": "文本", @@ -335,4 +261,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/healthlink-his-ui/src/utils/printUtils.js b/healthlink-his-ui/src/utils/printUtils.js index af70501d1..cc4d8fafc 100755 --- a/healthlink-his-ui/src/utils/printUtils.js +++ b/healthlink-his-ui/src/utils/printUtils.js @@ -301,9 +301,19 @@ export function executePrint(data, template, printerName, options = {}, business let processedTemplate; try { - processedTemplate = JSON.parse( - JSON.stringify(template).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName) - ); + let templateStr = JSON.stringify(template); + // 统一处理医院名称占位符(支持大小写) + const hospitalName = userStore.hospitalName || data.hospitalName || "中联医院"; + templateStr = templateStr.replace(/\{\{HOSPITAL_NAME\}\}/gi, hospitalName); + + if (data && typeof data === 'object') { + Object.keys(data).forEach(key => { + // 使用更安全的替换方式 + const val = data[key] ?? ''; + templateStr = templateStr.split(`{{${key}}}`).join(val); + }); + } + processedTemplate = JSON.parse(templateStr); console.log('[4] 模板处理成功'); } catch (parseError) { console.error('[4] 模板处理失败:', parseError); @@ -332,8 +342,8 @@ export function executePrint(data, template, printerName, options = {}, business const printOptions = { title: '打印标题', - height: 210, - width: 148, + width: 210, + height: 297, ...options, }; console.log('[7] 打印选项:', printOptions); @@ -385,7 +395,13 @@ export function executePrint(data, template, printerName, options = {}, business hiprintTemplate.print(data, printOptions, { styleHandler: () => { console.log('[10] styleHandler被调用'); - return ''; + // 从 printOptions 获取纸张尺寸(mm),用于 @page size + const pageWidth = printOptions.width || 210; + const pageHeight = printOptions.height || 297; + const pageStyle = ``; + // 合并外部传入的 styleHandler(包含元素定位样式)与内部 @page 样式 + const externalStyle = (options && typeof options.styleHandler === 'function') ? options.styleHandler() : ''; + return pageStyle + externalStyle; }, callback: (e) => { console.log('[10] 打印回调被调用:', e); diff --git a/healthlink-his-ui/src/views/inHospitalManagement/charge/advanceDeposit/index.vue b/healthlink-his-ui/src/views/inHospitalManagement/charge/advanceDeposit/index.vue index b4ce69f81..2bbb5b829 100755 --- a/healthlink-his-ui/src/views/inHospitalManagement/charge/advanceDeposit/index.vue +++ b/healthlink-his-ui/src/views/inHospitalManagement/charge/advanceDeposit/index.vue @@ -1,4 +1,4 @@ -