增加生成时间间隔

This commit is contained in:
Euni4U 2025-04-10 12:20:06 +08:00
parent 11ee7c5b9f
commit f31ea91315

View File

@ -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);
}
}
}