diff --git a/openhis-ui-vue3/src/utils/printUtils.js b/openhis-ui-vue3/src/utils/printUtils.js
index b71105cc..3f6bba13 100644
--- a/openhis-ui-vue3/src/utils/printUtils.js
+++ b/openhis-ui-vue3/src/utils/printUtils.js
@@ -412,6 +412,211 @@ export function previewPrint(elementDom) {
}
}
+
+/**
+ * 打印门诊挂号收据(使用浏览器打印,模板与补打挂号一致)
+ * @param {Object} data 打印数据
+ * @param {Object} options 打印选项
+ * @returns {Promise} 打印结果 Promise
+ */
+export function printRegistrationReceipt(data, options = {}) {
+ return new Promise((resolve, reject) => {
+ try {
+ // 构建打印内容的 HTML
+ const printContent = `
+
+
+
+
患者基本信息
+
+ 患者姓名:
+ ${data.patientName || '-'}
+
+
+ 就诊卡号:
+ ${data.cardNo || data.busNo || '-'}
+
+
+ 身份证号:
+ ${data.idCard ? maskIdCard(data.idCard) : '-'}
+
+
+ 联系电话:
+ ${data.phone || '-'}
+
+
+
+
+
挂号信息
+
+ 就诊科室:
+ ${data.organizationName || '-'}
+
+
+ 医生姓名:
+ ${data.practitionerName || '-'}
+
+
+ 挂号类型:
+ ${data.healthcareName || '-'}
+
+
+ 挂号时间:
+ ${data.visitTime || data.chargeTime || '-'}
+
+
+
+
+
费用信息
+
+
+
+ | 项目 |
+ 数量 |
+ 单价 |
+ 金额 |
+
+
+
+
+ | 挂号费 |
+ 1 |
+ ¥${parseFloat(data.price || 0).toFixed(2)} |
+ ¥${parseFloat(data.price || 0).toFixed(2)} |
+
+ ${parseFloat(data.activityPrice || 0) > 0 ? `
+
+ | 诊疗费 |
+ 1 |
+ ¥${parseFloat(data.activityPrice || 0).toFixed(2)} |
+ ¥${parseFloat(data.activityPrice || 0).toFixed(2)} |
+
` : ''}
+ ${parseFloat(data.medicalRecordFee || 0) > 0 ? `
+
+ | 病历费 |
+ 1 |
+ ¥${parseFloat(data.medicalRecordFee || 0).toFixed(2)} |
+ ¥${parseFloat(data.medicalRecordFee || 0).toFixed(2)} |
+
` : ''}
+
+
+
+ | 合计: |
+ ¥${parseFloat(data.totalPrice || data.amount || 0).toFixed(2)} |
+
+
+
+
+
+
+
+ 流水号:
+ ${data.serialNo || data.encounterId || '-'}
+
+
+
+
+
+
+ `;
+
+ // 创建新窗口用于打印
+ const printWindow = window.open('', '_blank');
+ if (!printWindow) {
+ reject(new Error('无法打开打印窗口,请检查浏览器弹窗设置'));
+ return;
+ }
+
+ // 写入打印内容
+ printWindow.document.write(`
+
+
+
+
+ 门诊预约挂号凭条
+
+
+
+
+ ${printContent}
+
+
+
+ `);
+
+ printWindow.document.close();
+ printWindow.onload = function() {
+ setTimeout(() => {
+ printWindow.print();
+ resolve({ success: true, message: '打印窗口已打开' });
+ }, 250);
+ };
+ } catch (error) {
+ console.error('打印门诊挂号收据失败:', error);
+ reject(error);
+ }
+ });
+}
+
+/**
+ * 脱敏身份证号
+ * @param {string} idCard 身份证号
+ * @returns {string} 脱敏后的身份证号
+ */
+function maskIdCard(idCard) {
+ if (!idCard) return '';
+ if (idCard.length >= 10) {
+ const prefix = idCard.substring(0, 6);
+ const suffix = idCard.substring(idCard.length - 4);
+ const stars = '*'.repeat(Math.max(0, idCard.length - 10));
+ return prefix + stars + suffix;
+ } else if (idCard.length >= 6) {
+ const prefix = idCard.substring(0, 3);
+ const suffix = idCard.substring(idCard.length - 1);
+ return prefix + '*'.repeat(idCard.length - 4) + suffix;
+ }
+ return idCard;
+}
+
// 默认导出简化的打印方法
export default {
print: simplePrint,
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 52c597dd..9f19249b 100644
--- a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/chargeDialog.vue
+++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/chargeDialog.vue
@@ -114,7 +114,7 @@ import {savePayment, wxPay, WxPayResult} from './outpatientregistration';
import {computed, getCurrentInstance, nextTick, reactive, ref, watch} from 'vue';
import {Delete} from '@element-plus/icons-vue';
import {debounce} from 'lodash-es';
-import printUtils, {PRINT_TEMPLATE} from '@/utils/printUtils';
+import printUtils, {PRINT_TEMPLATE, printRegistrationReceipt} from '@/utils/printUtils';
// 获取费用性质文本
const getFeeTypeText = computed(() => {
@@ -202,196 +202,41 @@ watch(
const emit = defineEmits(['close']);
-// 根据printUtils实现的打印方法
+// 根据 printUtils 实现的打印方法 - 使用与补打挂号相同的模板 (去掉"补打"字样)
async function printReceipt(param) {
- console.log('打印收费小票数据:', param);
+ console.log('打印挂号收据数据:', param);
console.log('患者信息:', props.patientInfo);
try {
- // 构造打印数据
+ // 构造打印数据 - 使用与补打挂号相同的格式
const printData = {
- data: [
- {
- ...param,
- // 基础支付类型
- YB_FUND_PAY: param.detail?.find((t) => t.payEnum === 100000)?.amount ?? 0, // 基金支付总额
- SELF_PAY: param.detail?.find((t) => t.payEnum === 200000)?.amount ?? 0, // 个人负担总金额
- OTHER_PAY: param.detail?.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额)
-
- // 基本医保统筹基金支出
- YB_TC_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 110000)?.amount ?? 0, // 基本医保统筹基金支出
- YB_BC_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 120000)?.amount ?? 0, // 补充医疗保险基金支出
- YB_JZ_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 130000)?.amount ?? 0, // 医疗救助基金支出
- YB_OTHER_AMOUNT: param.detail?.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出
-
- // 职工基本医疗保险
- YB_TC_ZG_FUND_VALUE: param.detail?.find((t) => t.payEnum === 110100)?.amount ?? 0, // 职工基本医疗保险
- YB_TC_JM_FUND_VALUE: param.detail?.find((t) => t.payEnum === 110200)?.amount ?? 0, // 居民基本医疗保险
-
- // 补充医疗保险基金支出细分
- YB_BC_JM_DB_VALUE: param.detail?.find((t) => t.payEnum === 120100)?.amount ?? 0, // 全体参保人的居民大病保险
- YB_BC_DE_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120200)?.amount ?? 0, // 大额医疗费用补助
- YB_BC_ZG_DE_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120300)?.amount ?? 0, // 企业职工大额医疗费用补助
- YB_BC_GWY_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120400)?.amount ?? 0, // 公务员医疗补助
-
- // 其他支出细分
- OTHER_PAY_DD_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300001)?.amount ?? 0, // 兜底基金支出
- OTHER_PAY_YW_SH_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300002)?.amount ?? 0, // 意外伤害基金支出
- OTHER_PAY_LX_YL_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300003)?.amount ?? 0, // 离休人员医疗保障金支出
- OTHER_PAY_LX_YH_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300004)?.amount ?? 0, // 离休人员优惠金支出
- OTHER_PAY_CZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300005)?.amount ?? 0, // 财政基金支出
- OTHER_PAY_CZ_YZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300006)?.amount ?? 0, // 财政预支支出
- OTHER_PAY_ZG_DB_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300007)?.amount ?? 0, // 职工大病基金支出
- OTHER_PAY_EY_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300008)?.amount ?? 0, // 二乙基金支出
- OTHER_PAY_QX_JZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300009)?.amount ?? 0, // 倾斜救助支出
- OTHER_PAY_YL_JZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300010)?.amount ?? 0, // 医疗救助再救助基金
- HOSP_PART_AMT: param.detail?.find((t) => t.payEnum === 300011)?.amount ?? 0, // 医院负担金额
-
- // 医保结算返回值 - 修复运算符优先级问题,添加括号确保正确拼接'元'
- FULAMT_OWNPAY_AMT: (param.detail?.find((t) => t.payEnum === 1)?.amount ?? 0) + '元', // 全自费金额
- OVERLMT_SELFPAY: (param.detail?.find((t) => t.payEnum === 3)?.amount ?? 0) + '元', // 超限价自费费用
- PRESELFPAY_AMT: (param.detail?.find((t) => t.payEnum === 4)?.amount ?? 0) + '元', // 先行自付金额
- INSCP_SCP_AMT: (param.detail?.find((t) => t.payEnum === 5)?.amount ?? 0) + '元', // 符合政策范围金额
- ACT_PAY_DEDC: (param.detail?.find((t) => t.payEnum === 6)?.amount ?? 0) + '元', // 实际支付起付线
- POOL_PROP_SELFPAY: (param.detail?.find((t) => t.payEnum === 7)?.amount ?? 0) + '元', // 基本医疗保险统筹基金支付比例
- BALC: (param.detail?.find((t) => t.payEnum === 8)?.amount ?? 0) + '元', // 余额
-
- // 特殊支付方式
- SELF_YB_ZH_PAY:
- (param.detail?.find((t) => t.payEnum === 210000)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 210000)?.amount ?? 0) + '元'
- : '', // 个人医保账户支付
- SELF_YB_ZH_GJ_VALUE:
- (param.detail?.find((t) => t.payEnum === 210100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 210100)?.amount ?? 0) + '元'
- : '', // 账户共济支付金额
- SELF_CASH_PAY:
- (param.detail?.find((t) => t.payEnum === 220000)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 220000)?.amount ?? 0) + '元'
- : '', // 个人现金支付金额
- SELF_VX_PAY:
- (param.detail?.find((t) => t.payEnum === 230000)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 230000)?.amount ?? 0) + '元'
- : '', // 微信支付金额
- SELF_ALI_PAY:
- (param.detail?.find((t) => t.payEnum === 240000)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 240000)?.amount ?? 0) + '元'
- : '', // 阿里支付金额
-
- // 现金支付细分
- SELF_CASH_VALUE:
- (param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0) + '元'
- : '', // 个人现金支付金额(现金)
- SELF_CASH_VX_VALUE:
- (param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0) + '元'
- : '', // 个人现金支付金额(微信)
- SELF_CASH_ALI_VALUE:
- (param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0) + '元'
- : '', // 个人现金支付金额(支付宝)
- SELF_CASH_UNION_VALUE:
- (param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0) + '元'
- : '', // 个人现金支付金额(银联)
-
- // 基金类型(扩展)
- BIRTH_FUND:
- (param.detail?.find((t) => t.payEnum === 510100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 510100)?.amount ?? 0) + '元'
- : '', // 生育基金
- RETIREE_MEDICAL:
- (param.detail?.find((t) => t.payEnum === 340100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 340100)?.amount ?? 0) + '元'
- : '', // 离休人员医疗保障基金
- URBAN_BASIC_MEDICAL:
- (param.detail?.find((t) => t.payEnum === 390100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 390100)?.amount ?? 0) + '元'
- : '', // 城乡居民基本医疗保险基金
- URBAN_SERIOUS_ILLNESS:
- (param.detail?.find((t) => t.payEnum === 390200)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 390200)?.amount ?? 0) + '元'
- : '', // 城乡居民大病医疗保险基金
- MEDICAL_ASSISTANCE:
- (param.detail?.find((t) => t.payEnum === 610100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 610100)?.amount ?? 0) + '元'
- : '', // 医疗救助基金
- GOVERNMENT_SUBSIDY:
- (param.detail?.find((t) => t.payEnum === 640100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 640100)?.amount ?? 0) + '元'
- : '', // 政府兜底基金
- ACCIDENT_INSURANCE:
- (param.detail?.find((t) => t.payEnum === 390400)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 390400)?.amount ?? 0) + '元'
- : '', // 意外伤害基金
- CARE_INSURANCE:
- (param.detail?.find((t) => t.payEnum === 620100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 620100)?.amount ?? 0) + '元'
- : '', // 照护保险基金
- FINANCIAL_FUND:
- (param.detail?.find((t) => t.payEnum === 360100)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 360100)?.amount ?? 0) + '元'
- : '', // 财政基金
- HOSPITAL_ADVANCE:
- (param.detail?.find((t) => t.payEnum === 999900)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 999900)?.amount ?? 0) + '元'
- : '', // 医院垫付
- SUPPLEMENTARY_INSURANCE:
- (param.detail?.find((t) => t.payEnum === 390300)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 390300)?.amount ?? 0) + '元'
- : '', // 城乡居民大病补充保险基金
- HEALTHCARE_PREPAYMENT:
- (param.detail?.find((t) => t.payEnum === 360300)?.amount ?? 0) > 0
- ? (param.detail?.find((t) => t.payEnum === 360300)?.amount ?? 0) + '元'
- : '', // 保健预支基金
- //微信刷卡支付
- SELF_CASH_VX_VALUE: (() => {
- // const cashValue = param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0;
- 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 (Number(vxValue) + Number(unionValue) + Number(aliValue)).toFixed(2) + '元';
- })(),
-
- // 患者信息
- patientName: param.patientName || '',
- sex: param.sex === 1 ? '女' : param.sex === 0 ? '男' : param.sex || '',
- age: param.age ? param.age + '岁' : '',
- personType: param.contractName, //病人类型
-
- // 挂号和就诊信息
- encounterId: props.patientInfo?.encounterId || '',
- busNo: props.patientInfo?.busNo || '',
- Mr_QR_Code: param.regNo || props.registerBusNo,
- // 科室和医生信息
- organizationName: props.orgName || props.patientInfo?.organizationName || '',
- practitionerName: props.patientInfo?.practitionerName || '',
- healthcareName: props.patientInfo?.healthcareName || '',
- // 费用信息
- fixmedinsName: param.fixmedinsName
- ? param.fixmedinsName + '门诊收费明细'
- : '门诊收费明细',
- // 收费员
- cashier: param.paymentEmployee,
-
- // 收费时间
- chargeTime: new Date().toLocaleString(),
- //电子收据二维码
- pictureUrl: param.pictureUrl || 'https://chinaebill.com/img/xiaochengxu.png',
- },
- ],
+ patientName: props.patientInfo?.patientName || props.patientInfo?.name || '',
+ cardNo: props.patientInfo?.busNo || param.busNo || '',
+ idCard: param.idCard || '',
+ phone: props.patientInfo?.phone || '',
+ organizationName: props.orgName || props.patientInfo?.organizationName || '',
+ practitionerName: props.patientInfo?.practitionerName || '',
+ healthcareName: props.patientInfo?.healthcareName || '',
+ visitTime: new Date().toLocaleString(),
+ price: param.totalPrice || props.totalAmount || 0,
+ activityPrice: 0,
+ medicalRecordFee: 0,
+ totalPrice: param.totalPrice || props.totalAmount || 0,
+ serialNo: props.patientInfo?.encounterId || param.encounterId || '',
+ encounterId: props.patientInfo?.encounterId || param.encounterId || '',
+ printTime: new Date().toLocaleString(),
};
- // 选择门诊手术计费打印模板(含流程图)
- console.log('printDataprintDataprintDataprintDataprintData', printData.data[0]);
- await printUtils.print(PRINT_TEMPLATE.OUTPATIENT_SURGERY_CHARGE, printData.data[0]);
+
+ console.log('printReceipt printData', printData);
+
+ // 使用与补打挂号相同的打印模板 (不带"补打"字样)
+ await printRegistrationReceipt(printData);
console.log('打印成功');
} catch (error) {
console.error('打印失败:', error);
- proxy.$modal.msgError('打印失败: ' + error.message);
+ proxy.$modal.msgError('打印失败:' + error.message);
}
}
-
function handleWxPay() {
console.log('开始微信支付,当前支付详情:', formData.selfPay);
console.log(