bug 700
This commit is contained in:
@@ -689,6 +689,164 @@ function maskIdCard(idCard) {
|
|||||||
return idCard;
|
return idCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印入院证
|
||||||
|
* @param {Object} data 入院证数据
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export function printAdmissionCertificate(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const printContent = `
|
||||||
|
<div class="certificate">
|
||||||
|
<div class="title">${data.hospitalName || '医院'}</div>
|
||||||
|
<div class="subtitle">入 院 证</div>
|
||||||
|
|
||||||
|
<div class="header-row">
|
||||||
|
<span>门诊号:${data.outpatientNo || '—'}</span>
|
||||||
|
<span>住院号:${data.inpatientNo || '—'}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info-grid">
|
||||||
|
<div class="info-item"><span class="label">姓名:</span><span class="value">${data.patientName || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">性别:</span><span class="value">${data.gender || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">年龄:</span><span class="value">${data.age || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">费用类型:</span><span class="value">${data.feeType || '—'}</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info-grid">
|
||||||
|
<div class="info-item"><span class="label">身份证号:</span><span class="value">${data.idCard || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">电话:</span><span class="value">${data.phone || '—'}</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info-grid">
|
||||||
|
<div class="info-item full-width"><span class="label">住址:</span><span class="value">${data.address || '—'}</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info-grid">
|
||||||
|
<div class="info-item full-width"><span class="label">联系人:</span><span class="value">${data.contactPerson || '—'}${data.contactRelation ? '(' + data.contactRelation + ')' : ''} ${data.contactPhone || ''}</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="info-grid three-col">
|
||||||
|
<div class="info-item"><span class="label">入院科室:</span><span class="value">${data.department || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">入院类型:</span><span class="value">${data.admissionType || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">入院病区:</span><span class="value">${data.ward || '—'}</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info-grid three-col">
|
||||||
|
<div class="info-item"><span class="label">入院方式:</span><span class="value">${data.admissionMethod || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">患者病情:</span><span class="value">${data.patientCondition || '—'}</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="diagnosis-section">
|
||||||
|
<div class="label">入院诊断:</div>
|
||||||
|
<div class="diagnosis-item">1. ${data.westernDiagnosis || '—'}(西医)</div>
|
||||||
|
<div class="diagnosis-item">2. ${data.tcmDiagnosis || '—'}(中医)</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="info-grid">
|
||||||
|
<div class="info-item"><span class="label">开单医生:</span><span class="value">${data.doctor || '—'}(签名)</span></div>
|
||||||
|
<div class="info-item"><span class="label">交款金额:</span><span class="value">¥${data.paymentAmount || '0.00'} 元(盖章有效)</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info-grid">
|
||||||
|
<div class="info-item"><span class="label">申请日期:</span><span class="value">${data.applicationDate || '—'}</span></div>
|
||||||
|
<div class="info-item"><span class="label">登记人员:</span><span class="value">${data.registrar || '—'}(签章)</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="reminder">
|
||||||
|
<div class="reminder-title">【温馨提示】</div>
|
||||||
|
<div class="reminder-item">1. 医保患者请于24小时内持医保卡至住院窗口办理联网,逾期无法报销。</div>
|
||||||
|
<div class="reminder-item">2. 住院期间请勿随身携带贵重物品,请携带必要洗漱用具。</div>
|
||||||
|
<div class="reminder-item">3. 本证3日内有效。</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const printWindow = window.open('', '_blank');
|
||||||
|
if (!printWindow) {
|
||||||
|
reject(new Error('无法打开打印窗口,请检查浏览器弹窗设置'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printWindow.document.write(`
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>入院证</title>
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
body { font-family: SimSun, '宋体', serif; padding: 20px; color: #000; }
|
||||||
|
.certificate { max-width: 700px; margin: 0 auto; }
|
||||||
|
.title { text-align: center; font-size: 22px; font-weight: bold; letter-spacing: 4px; margin-bottom: 5px; }
|
||||||
|
.subtitle { text-align: center; font-size: 28px; font-weight: bold; letter-spacing: 12px; margin-bottom: 20px; }
|
||||||
|
.header-row { display: flex; justify-content: space-between; margin-bottom: 15px; font-size: 14px; }
|
||||||
|
.info-grid { display: flex; flex-wrap: wrap; margin-bottom: 10px; }
|
||||||
|
.info-grid.three-col .info-item { width: 33.33%; }
|
||||||
|
.info-item { width: 50%; margin-bottom: 8px; font-size: 14px; }
|
||||||
|
.info-item.full-width { width: 100%; }
|
||||||
|
.info-item .label { font-weight: bold; }
|
||||||
|
.info-item .value { }
|
||||||
|
.divider { border-bottom: 1px dashed #999; margin: 12px 0; }
|
||||||
|
.diagnosis-section { margin-bottom: 10px; font-size: 14px; }
|
||||||
|
.diagnosis-section .label { font-weight: bold; margin-bottom: 5px; }
|
||||||
|
.diagnosis-item { margin-left: 20px; margin-bottom: 5px; }
|
||||||
|
.reminder { margin-top: 15px; font-size: 13px; }
|
||||||
|
.reminder-title { font-weight: bold; margin-bottom: 5px; }
|
||||||
|
.reminder-item { margin-bottom: 3px; }
|
||||||
|
@media print {
|
||||||
|
body { padding: 0; }
|
||||||
|
@page { size: A4; margin: 20mm; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
${printContent}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`);
|
||||||
|
|
||||||
|
printWindow.document.close();
|
||||||
|
printWindow.onload = function () {
|
||||||
|
setTimeout(() => {
|
||||||
|
printWindow.print();
|
||||||
|
resolve({ success: true, message: '打印窗口已打开' });
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('打印入院证失败:', error);
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化日期
|
||||||
|
* @param {string|Date} date 日期
|
||||||
|
* @returns {string} 格式化后的日期字符串
|
||||||
|
*/
|
||||||
|
export function formatDate(date) {
|
||||||
|
if (!date) return '';
|
||||||
|
const d = new Date(date);
|
||||||
|
if (isNaN(d.getTime())) return '';
|
||||||
|
const year = d.getFullYear();
|
||||||
|
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(d.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(d.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(d.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(d.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
|
||||||
// 默认导出简化的打印方法
|
// 默认导出简化的打印方法
|
||||||
export default {
|
export default {
|
||||||
print: simplePrint,
|
print: simplePrint,
|
||||||
@@ -699,4 +857,6 @@ export default {
|
|||||||
getPrinterList,
|
getPrinterList,
|
||||||
getCachedPrinter,
|
getCachedPrinter,
|
||||||
savePrinterToCache,
|
savePrinterToCache,
|
||||||
|
printAdmissionCertificate,
|
||||||
|
formatDate,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,15 +17,19 @@
|
|||||||
>
|
>
|
||||||
查询
|
查询
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="primary" @click="handlePrintCertificate">打印住院证</el-button>
|
||||||
</el-space>
|
</el-space>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<vxe-table
|
<vxe-table
|
||||||
|
ref="tableRef"
|
||||||
:data="treatHospitalizedData"
|
:data="treatHospitalizedData"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
show-overflow="title"
|
show-overflow="title"
|
||||||
|
@radio-change="handleRadioChange"
|
||||||
>
|
>
|
||||||
|
<vxe-column type="radio" width="50" align="center" />
|
||||||
<vxe-column
|
<vxe-column
|
||||||
type="seq"
|
type="seq"
|
||||||
width="80"
|
width="80"
|
||||||
@@ -76,6 +80,17 @@
|
|||||||
{{ scope.row.admitSourceCode || '-' }}
|
{{ scope.row.admitSourceCode || '-' }}
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
<vxe-column
|
||||||
|
align="center"
|
||||||
|
title="登记状态"
|
||||||
|
width="100"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.statusEnum == 8" type="info" size="small">已作废</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.statusEnum == 5" type="warning" size="small">已入科</el-tag>
|
||||||
|
<el-tag v-else type="success" size="small">已登记</el-tag>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
field="sourceName"
|
field="sourceName"
|
||||||
align="center"
|
align="center"
|
||||||
@@ -100,17 +115,6 @@
|
|||||||
align="center"
|
align="center"
|
||||||
title="登记员"
|
title="登记员"
|
||||||
/>
|
/>
|
||||||
<vxe-column
|
|
||||||
align="center"
|
|
||||||
title="登记状态"
|
|
||||||
width="100"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
|
||||||
<span :style="{ color: scope.row.statusEnum == 8 ? '#F56C6C' : '#67C23A' }">
|
|
||||||
{{ scope.row.statusEnum == 8 ? '已作废' : '已登记' }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</vxe-column>
|
|
||||||
<vxe-column
|
<vxe-column
|
||||||
fixed="right"
|
fixed="right"
|
||||||
align="center"
|
align="center"
|
||||||
@@ -192,10 +196,15 @@
|
|||||||
import PatientRegister from './patientRegister.vue';
|
import PatientRegister from './patientRegister.vue';
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus';
|
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||||
import {getAdmissionPage, getContractList, getInHospitalInfo, getPatientBasicInfo, voidRegistration} from './api';
|
import {getAdmissionPage, getContractList, getInHospitalInfo, getPatientBasicInfo, voidRegistration} from './api';
|
||||||
|
import useUserStore from '@/store/modules/user';
|
||||||
|
import {printAdmissionCertificate, formatDate} from '@/utils/printUtils';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { admit_source_code } = proxy.useDict('admit_source_code');
|
const { admit_source_code } = proxy.useDict('admit_source_code');
|
||||||
const emits = defineEmits([]);
|
const emits = defineEmits([]);
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const tableRef = ref(null);
|
||||||
|
const selectedRow = ref(null);
|
||||||
const total = ref();
|
const total = ref();
|
||||||
const inHospitalInfo = ref({});
|
const inHospitalInfo = ref({});
|
||||||
const alreadyEdit = ref(true);
|
const alreadyEdit = ref(true);
|
||||||
@@ -262,6 +271,68 @@ const doVoid = (row) => {
|
|||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRadioChange = ({ newValue }) => {
|
||||||
|
selectedRow.value = newValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePrintCertificate = async () => {
|
||||||
|
if (!selectedRow.value) {
|
||||||
|
ElMessage.warning('请先从列表中选中一位患者');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const row = selectedRow.value;
|
||||||
|
|
||||||
|
if (row.statusEnum == 8) {
|
||||||
|
ElMessage.warning('该记录已作废,无法打印入院证');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取患者基本信息和住院信息
|
||||||
|
const [patientRes, hospitalRes] = await Promise.all([
|
||||||
|
getPatientBasicInfo(row.patientId),
|
||||||
|
getInHospitalInfo(row.encounterId),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const patient = patientRes.data || {};
|
||||||
|
const hospital = hospitalRes.data || {};
|
||||||
|
|
||||||
|
const printData = {
|
||||||
|
hospitalName: userStore.hospitalName || userStore.tenantName || '',
|
||||||
|
outpatientNo: patient.busNo || '',
|
||||||
|
inpatientNo: row.busNo || '',
|
||||||
|
patientName: row.patientName || '',
|
||||||
|
gender: row.genderEnum_enumText || '',
|
||||||
|
age: row.age || '',
|
||||||
|
feeType: row.contractNo || '',
|
||||||
|
idCard: patient.idCard || '',
|
||||||
|
phone: patient.phone || '',
|
||||||
|
address: patient.address || '',
|
||||||
|
contactPerson: patient.linkName || '',
|
||||||
|
contactRelation: patient.linkRelationCode_enumText || '',
|
||||||
|
contactPhone: patient.linkTelcom || '',
|
||||||
|
department: row.sourceName || hospital.inHospitalOrgName || '',
|
||||||
|
admissionType: row.admitSourceCode || '',
|
||||||
|
ward: row.wardName || hospital.wardName || '',
|
||||||
|
admissionMethod: hospital.inWayCode_dictText || '',
|
||||||
|
patientCondition: hospital.priorityEnum_enumText || '',
|
||||||
|
westernDiagnosis: hospital.ambDiagnosisName || '',
|
||||||
|
tcmDiagnosis: '',
|
||||||
|
doctor: hospital.ambDoctorPractitionerName || '',
|
||||||
|
paymentAmount: hospital.balanceAmount ? Number(hospital.balanceAmount).toFixed(2) : '0.00',
|
||||||
|
applicationDate: formatDate(hospital.startTime || row.requestTime),
|
||||||
|
registrar: row.registrar || '',
|
||||||
|
};
|
||||||
|
|
||||||
|
await printAdmissionCertificate(printData);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('打印入院证失败:', error);
|
||||||
|
ElMessage.error('打印入院证失败:' + (error.message || '未知错误'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
getContract();
|
getContract();
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
@@ -321,6 +392,12 @@ const getList = () => {
|
|||||||
queryParams.value.sortField = 'requestTime';
|
queryParams.value.sortField = 'requestTime';
|
||||||
queryParams.value.sortOrder = 'DESC';
|
queryParams.value.sortOrder = 'DESC';
|
||||||
|
|
||||||
|
// 清除选中状态
|
||||||
|
selectedRow.value = null;
|
||||||
|
if (tableRef.value) {
|
||||||
|
tableRef.value.clearRadioRow();
|
||||||
|
}
|
||||||
|
|
||||||
getAdmissionPage(queryParams.value).then((res) => {
|
getAdmissionPage(queryParams.value).then((res) => {
|
||||||
console.log('priceTypeList=======', JSON.stringify(priceTypeList.value));
|
console.log('priceTypeList=======', JSON.stringify(priceTypeList.value));
|
||||||
let dataList = [];
|
let dataList = [];
|
||||||
|
|||||||
@@ -60,6 +60,15 @@
|
|||||||
{{ scope.row.age ? `${scope.row.age}岁` : '-' }}
|
{{ scope.row.age ? `${scope.row.age}岁` : '-' }}
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
<vxe-column
|
||||||
|
align="center"
|
||||||
|
title="登记状态"
|
||||||
|
width="100"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
<el-tag type="primary" size="small">待登记</el-tag>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
field="requestTime"
|
field="requestTime"
|
||||||
align="center"
|
align="center"
|
||||||
|
|||||||
Reference in New Issue
Block a user