挂号补单功能的完善

This commit is contained in:
2026-01-14 10:12:25 +08:00
parent 8e61490005
commit d8c4348341
8 changed files with 423 additions and 32 deletions

View File

@@ -151,10 +151,6 @@
<span class="label">患者姓名:</span>
<span class="value">{{ form.name || '-' }}</span>
</div>
<div class="info-row">
<span class="label">门诊号:</span>
<span class="value">{{ form.serialNo || '-' }}</span>
</div>
<div class="info-row">
<span class="label">就诊卡号:</span>
<span class="value">{{ form.cardNo || '-' }}</span>
@@ -233,6 +229,12 @@
</table>
</div>
<!-- 流水号显示在左下角 -->
<div class="serial-number-bottom-left">
<span class="serial-label">流水号:</span>
<span class="serial-value">{{ form.serialNo || '-' }}</span>
</div>
<div class="print-footer">
<div class="reminder">温馨提示: 请妥善保管此凭条就诊时请携带</div>
</div>
@@ -545,29 +547,47 @@ function formatDateTime(date) {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
// 计算流水号(与 fillForm 中的逻辑一致)
// 计算流水号:格式为 YYYYMMDD-XXX其中 XXX 为后端按"科室+医生+当日"自增的 displayOrder
// 确保同一科室同一医生同一天内是 001、002、003... 递增
function calculateSerialNo(row) {
if (!row) {
return '-';
}
// 优先使用已有的 serialNo如果存在
if (row.serialNo) {
return row.serialNo;
// 获取挂号日期YYYYMMDD格式
let dateStr = '';
if (row.registerTime) {
const date = new Date(row.registerTime);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
dateStr = `${year}${month}${day}`;
} else {
// 如果没有挂号时间,使用当前日期
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
dateStr = `${year}${month}${day}`;
}
// 使用 encounterId 的后3位计算流水号
if (row.encounterId) {
const idStr = String(row.encounterId);
const lastThree = idStr.slice(-3);
const num = parseInt(lastThree) || 0;
return String((num % 999) + 1).padStart(3, '0');
// 获取序号部分3位数字001-999
// 直接使用后端返回的 displayOrder自增逻辑在后端按"科室+医生+当日"保证
let serialNum = 1;
if (row.displayOrder != null && row.displayOrder !== undefined) {
const num = Number(row.displayOrder) || 0;
serialNum = num > 0 ? num : 1;
} else if (row.serialNo) {
// 兼容旧数据:如果有已有的 serialNo 字段
const num = Number(row.serialNo) || 0;
serialNum = num > 0 ? num : 1;
} else {
// 兜底:没有任何序号信息时,给 1
serialNum = 1;
}
// 如果 encounterId 为空生成一个001-999的序列号
const timestamp = Date.now();
const serial = (timestamp % 999) + 1;
return String(serial).padStart(3, '0');
// 格式YYYYMMDD-XXX例如20250113-001
return `${dateStr}-${String(serialNum).padStart(3, '0')}`;
}
// 提交补打挂号
@@ -835,6 +855,26 @@ function handleBrowserPrint() {
font-weight: bold;
color: red;
}
.serial-number-bottom-left {
position: absolute;
bottom: 20px;
left: 20px;
font-size: 14px;
font-weight: bold;
}
.serial-number-bottom-left .serial-label {
font-weight: bold;
margin-right: 5px;
}
.serial-number-bottom-left .serial-value {
font-weight: bold;
color: #333;
}
.print-content {
position: relative;
min-height: 500px;
padding-bottom: 60px;
}
.print-footer {
margin-top: 20px;
font-size: 12px;
@@ -1052,6 +1092,31 @@ async function handleConfirmSelect() {
color: red;
}
/* 流水号显示在左下角,加粗 */
.serial-number-bottom-left {
position: absolute;
bottom: 20px;
left: 20px;
font-size: 14px;
font-weight: bold;
}
.serial-number-bottom-left .serial-label {
font-weight: bold;
margin-right: 5px;
}
.serial-number-bottom-left .serial-value {
font-weight: bold;
color: #333;
}
.print-content {
position: relative;
min-height: 500px;
padding-bottom: 60px; /* 为左下角流水号留出空间 */
}
.print-footer {
margin-top: 20px;
font-size: 12px;