From f31ea913151df416645141dcf74d3f59a63dc8bd Mon Sep 17 00:00:00 2001 From: Euni4U <958079825@qq.com> Date: Thu, 10 Apr 2025 12:20:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=9F=E6=88=90=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=97=B4=E9=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectPatientController.java | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java index 22d17f3..632ffff 100644 --- a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java +++ b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java @@ -439,7 +439,19 @@ public class InspectPatientController { } else { // 如果未打印,生成新的条码 checkBarCode1 = DateUtils.generateUniqueCode(); + try { + // 等待2毫秒,确保时间戳不同 + Thread.sleep(2); + } catch (InterruptedException e) { + // 忽略中断异常 + } checkBarCode2 = DateUtils.generateUniqueCode(); + try { + // 等待2毫秒,确保时间戳不同 + Thread.sleep(2); + } catch (InterruptedException e) { + // 忽略中断异常 + } checkBarCode3 = DateUtils.generateUniqueCode(); } @@ -1386,28 +1398,18 @@ public class InspectPatientController { String reportDate = ""; String medicalSn = patientDO.getMedicalSn(); - if (medicalSn != null && medicalSn.length() >= 8) { - // 提取前8位作为日期 - reportDate = medicalSn.substring(0, 8); - // 转换为yyyy-MM-dd格式 - if (reportDate.length() == 8) { - reportDate = reportDate.substring(0, 4) + "-" + reportDate.substring(4, 6) + "-" + reportDate.substring(6, 8); - } + // 使用medicalDateTime字段获取日期 + LocalDateTime medicalDateTime = patientDO.getMedicalDateTime(); + if (medicalDateTime != null) { + reportDate = medicalDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); } else { - // 尝试从URL中提取体检编号 - int lastSlashIndex = pdfUrl.lastIndexOf('/'); - if (lastSlashIndex != -1) { - String fileName = pdfUrl.substring(lastSlashIndex + 1); - int dashIndex = fileName.indexOf('-'); - if (dashIndex != -1) { - String examNo = fileName.substring(0, dashIndex); - if (examNo.length() >= 8) { - reportDate = examNo.substring(0, 8); - // 转换为yyyy-MM-dd格式 - if (reportDate.length() == 8) { - reportDate = reportDate.substring(0, 4) + "-" + reportDate.substring(4, 6) + "-" + reportDate.substring(6, 8); - } - } + // 如果medicalDateTime为空,则使用medicalSn中的日期作为备选 + if (medicalSn != null && medicalSn.length() >= 8) { + // 提取前8位作为日期 + reportDate = medicalSn.substring(0, 8); + // 转换为yyyy-MM-dd格式 + if (reportDate.length() == 8) { + reportDate = reportDate.substring(0, 4) + "-" + reportDate.substring(4, 6) + "-" + reportDate.substring(6, 8); } } }