fix(consultation): 修复会诊取消提交逻辑并优化医生列表显示
新增检查医生确认/签名状态的逻辑,防止已确认/签名的会诊被取消提交 优化前端参与医生列表的显示,只显示已确认或已签名的医生
This commit is contained in:
@@ -444,6 +444,17 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
if (!ConsultationStatusEnum.SUBMITTED.getCode().equals(entity.getConsultationStatus())) {
|
||||
throw new IllegalArgumentException("只有已提交状态的会诊申请才能取消提交");
|
||||
}
|
||||
|
||||
// 🎯 新增:检查是否有医生已确认或签名
|
||||
// 即使整体状态还是10(部分医生确认/签名),也不允许取消提交
|
||||
LambdaQueryWrapper<ConsultationInvited> invitedCheckWrapper = new LambdaQueryWrapper<>();
|
||||
invitedCheckWrapper.eq(ConsultationInvited::getConsultationRequestId, entity.getId())
|
||||
.ge(ConsultationInvited::getInvitedStatus, ConsultationStatusEnum.CONFIRMED.getCode());
|
||||
long confirmedOrSignedCount = consultationInvitedMapper.selectCount(invitedCheckWrapper);
|
||||
if (confirmedOrSignedCount > 0) {
|
||||
throw new IllegalArgumentException("已有医生确认或签名,无法取消提交");
|
||||
}
|
||||
|
||||
// 取消提交:将状态从"已提交"改回"新开"
|
||||
entity.setConsultationStatus(ConsultationStatusEnum.NEW.getCode());
|
||||
entity.setConfirmingPhysician(null);
|
||||
@@ -724,8 +735,8 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
dto.setInvitedList(invitedDtoList);
|
||||
|
||||
|
||||
|
||||
|
||||
// 🎯 如果会诊已确认、已签名或已完成,填充会诊记录信息(从会诊确认表中获取)
|
||||
// 会诊状态:20=已确认,30=已签名,40=已完成
|
||||
if (entity.getConsultationStatus() != null &&
|
||||
@@ -785,11 +796,6 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
confirmedAndSignedPhysicians.size(), signedPhysicians.size());
|
||||
}
|
||||
}
|
||||
|
||||
log.info("填充会诊记录信息,已确认和已签名医生数:{},已签名医生数:{}",
|
||||
confirmedAndSignedPhysicians.size(), signedPhysicians.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1198,7 +1204,7 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
// 10=已提交(待确认)、20=已确认(待签名)、30=已签名,排除40=已完成
|
||||
LambdaQueryWrapper<ConsultationInvited> invitedWrapper = new LambdaQueryWrapper<>();
|
||||
invitedWrapper.eq(ConsultationInvited::getInvitedPhysicianId, currentPhysicianId)
|
||||
.in(ConsultationInvited::getInvitedStatus,
|
||||
.in(ConsultationInvited::getInvitedStatus,
|
||||
ConsultationStatusEnum.SUBMITTED.getCode(), // 10-待确认
|
||||
ConsultationStatusEnum.CONFIRMED.getCode(), // 20-已确认(待签名)
|
||||
ConsultationStatusEnum.SIGNED.getCode()) // 30-已签名
|
||||
@@ -1312,9 +1318,9 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
||||
|
||||
// 4. 更新邀请记录(存储会诊意见)
|
||||
// 格式:科室-医生:意见内容
|
||||
String formattedOpinion = String.format("%s-%s:%s",
|
||||
currentDeptName,
|
||||
currentPhysicianName,
|
||||
String formattedOpinion = String.format("%s-%s:%s",
|
||||
currentDeptName,
|
||||
currentPhysicianName,
|
||||
dto.getConsultationOpinion());
|
||||
|
||||
invited.setInvitedStatus(ConsultationStatusEnum.CONFIRMED.getCode()); // 已确认
|
||||
|
||||
Reference in New Issue
Block a user