fix(surgery): 解决手术管理中的空指针异常和数据库字段映射问题 BUG#233

- 移除了前端手术对话框中的错误注释代码
- 在手术排班服务中添加了对多个可为空字符串字段的默认值处理
- 为手术实体类中的关键字段添加了MyBatis-Plus字段策略注解
- 确保术前诊断、术后诊断、麻醉方式等字段在数据库操作时正确处理空值情况
- 统一了手术相关字段的插入策略为忽略空值,避免数据库约束错误
This commit is contained in:
2026-03-19 15:52:55 +08:00
parent d41d3066b3
commit f1087b04f0
3 changed files with 89 additions and 1 deletions

View File

@@ -113,6 +113,44 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
OpSchedule opSchedule = new OpSchedule();
BeanUtils.copyProperties(opCreateScheduleDto, opSchedule);
// 处理可能为null的字符串字段设置默认值为空字符串
if (opSchedule.getPreoperativeDiagnosis() == null) {
opSchedule.setPreoperativeDiagnosis("");
}
if (opSchedule.getPostoperativeDiagnosis() == null) {
opSchedule.setPostoperativeDiagnosis("");
}
if (opSchedule.getAnesMethod() == null) {
opSchedule.setAnesMethod("");
}
if (opSchedule.getAnesDoctor1Code() == null) {
opSchedule.setAnesDoctor1Code("");
}
if (opSchedule.getAnesDoctor2Code() == null) {
opSchedule.setAnesDoctor2Code("");
}
if (opSchedule.getAnesDoctor3Code() == null) {
opSchedule.setAnesDoctor3Code("");
}
if (opSchedule.getScrubNurseCode() == null) {
opSchedule.setScrubNurseCode("");
}
if (opSchedule.getCircuNurse1Code() == null) {
opSchedule.setCircuNurse1Code("");
}
if (opSchedule.getCircuNurse2Code() == null) {
opSchedule.setCircuNurse2Code("");
}
if (opSchedule.getScrubNurse1Code() == null) {
opSchedule.setScrubNurse1Code("");
}
if (opSchedule.getScrubNurse2Code() == null) {
opSchedule.setScrubNurse2Code("");
}
if (opSchedule.getSurgeonCode() == null) {
opSchedule.setSurgeonCode("");
}
// 设置创建者ID
opSchedule.setCreatorId(userId);
//设置创建人名称
@@ -158,6 +196,44 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
OpSchedule opSchedule = new OpSchedule();
BeanUtils.copyProperties(opScheduleDto, opSchedule);
// 处理可能为null的字符串字段设置默认值为空字符串
if (opSchedule.getPreoperativeDiagnosis() == null) {
opSchedule.setPreoperativeDiagnosis("");
}
if (opSchedule.getPostoperativeDiagnosis() == null) {
opSchedule.setPostoperativeDiagnosis("");
}
if (opSchedule.getAnesMethod() == null) {
opSchedule.setAnesMethod("");
}
if (opSchedule.getAnesDoctor1Code() == null) {
opSchedule.setAnesDoctor1Code("");
}
if (opSchedule.getAnesDoctor2Code() == null) {
opSchedule.setAnesDoctor2Code("");
}
if (opSchedule.getAnesDoctor3Code() == null) {
opSchedule.setAnesDoctor3Code("");
}
if (opSchedule.getScrubNurseCode() == null) {
opSchedule.setScrubNurseCode("");
}
if (opSchedule.getCircuNurse1Code() == null) {
opSchedule.setCircuNurse1Code("");
}
if (opSchedule.getCircuNurse2Code() == null) {
opSchedule.setCircuNurse2Code("");
}
if (opSchedule.getScrubNurse1Code() == null) {
opSchedule.setScrubNurse1Code("");
}
if (opSchedule.getScrubNurse2Code() == null) {
opSchedule.setScrubNurse2Code("");
}
if (opSchedule.getSurgeonCode() == null) {
opSchedule.setSurgeonCode("");
}
// 更新时间
opSchedule.setUpdateTime(new Date());