修改新增患者体检编号计算方式
This commit is contained in:
parent
b065287673
commit
c02d7b0044
@ -89,7 +89,7 @@ import java.util.Locale;
|
||||
@RequestMapping("/inspect/patient")
|
||||
@Validated
|
||||
public class InspectPatientController {
|
||||
private static final AtomicInteger counter = new AtomicInteger(0);
|
||||
// private static final AtomicInteger counter = new AtomicInteger(0);
|
||||
@Resource
|
||||
private InspectPatientService patientService;
|
||||
@Resource
|
||||
@ -206,13 +206,17 @@ public class InspectPatientController {
|
||||
// 获取当前日期并格式化为 yyyyMMdd 格式
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
String datePart = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 生成一个6位的序列号
|
||||
int sequenceNumber = counter.incrementAndGet() % 1000000; // 确保序列号是6位数
|
||||
String MedicalSn = datePart + String.format("%06d", sequenceNumber);
|
||||
// 生成一个唯一的6位的随机数
|
||||
Random random = new Random();
|
||||
String sequencePart;
|
||||
do {
|
||||
int sequenceNumber = 100000 + random.nextInt(900000); // 生成一个6位的随机数
|
||||
sequencePart = datePart + String.format("%06d", sequenceNumber);
|
||||
} while (patientService.IsMedicalSnExist(sequencePart)); // 检查是否存在,如果存在则继续生成
|
||||
//患者信息
|
||||
InspectPatientSaveReqVO rowData = new InspectPatientSaveReqVO();
|
||||
|
||||
rowData.setMedicalSn(MedicalSn);
|
||||
rowData.setMedicalSn(sequencePart);
|
||||
//填充患者信息
|
||||
for (int i = 0; i < row.getLastCellNum(); i++) {
|
||||
Cell cell = row.getCell(i);
|
||||
@ -341,8 +345,16 @@ public class InspectPatientController {
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
String datePart = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 生成一个6位的序列号
|
||||
int sequenceNumber = counter.incrementAndGet() % 1000000; // 确保序列号是6位数
|
||||
String sequencePart = datePart + String.format("%06d", sequenceNumber);
|
||||
// int sequenceNumber = counter.incrementAndGet() % 1000000; // 确保序列号是6位数
|
||||
// String sequencePart = datePart + String.format("%06d", sequenceNumber);
|
||||
// 生成一个唯一的6位的随机数
|
||||
Random random = new Random();
|
||||
String sequencePart;
|
||||
do {
|
||||
int sequenceNumber = 100000 + random.nextInt(900000); // 生成一个6位的随机数
|
||||
sequencePart = datePart + String.format("%06d", sequenceNumber);
|
||||
} while (patientService.IsMedicalSnExist(sequencePart)); // 检查是否存在,如果存在则继续生成
|
||||
|
||||
//患者信息
|
||||
InspectPatientSaveReqVO rowData = new InspectPatientSaveReqVO();
|
||||
rowData.setMedicalSn(sequencePart);
|
||||
|
@ -101,6 +101,10 @@ public interface InspectPatientService {
|
||||
InspectPatientDO getPatientOfMedicalSn(String medicalSn);
|
||||
//验证身份证号是否存在
|
||||
boolean validateIdCardExists(String idCard);
|
||||
/*
|
||||
* 通过体检编号判断体检编号是否存在
|
||||
* */
|
||||
boolean IsMedicalSnExist(String medicalSn);
|
||||
|
||||
//根据身份证、姓名、体检编码获取患者信息
|
||||
List<InspectPatientDO> getPatientBySearchKey(String searchKey);
|
||||
|
@ -210,6 +210,13 @@ public class InspectPatientServiceImpl implements InspectPatientService {
|
||||
lambdaQuery.eq(InspectPatientDO::getCardId, idCard);
|
||||
return patientMapper.selectCount(lambdaQuery) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean IsMedicalSnExist(String medicalSn) {
|
||||
LambdaQueryWrapper<InspectPatientDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(InspectPatientDO::getMedicalSn, medicalSn);
|
||||
return patientMapper.selectCount(queryWrapper) > 0;
|
||||
}
|
||||
@Override
|
||||
public List<InspectPatientDO> getPatientBySearchKey(String searchKey) {
|
||||
LambdaQueryWrapper<InspectPatientDO> lambdaQuery = new LambdaQueryWrapper<>();
|
||||
|
Loading…
Reference in New Issue
Block a user