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(); OpSchedule opSchedule = new OpSchedule();
BeanUtils.copyProperties(opCreateScheduleDto, 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 // 设置创建者ID
opSchedule.setCreatorId(userId); opSchedule.setCreatorId(userId);
//设置创建人名称 //设置创建人名称
@@ -158,6 +196,44 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
OpSchedule opSchedule = new OpSchedule(); OpSchedule opSchedule = new OpSchedule();
BeanUtils.copyProperties(opScheduleDto, 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()); opSchedule.setUpdateTime(new Date());

View File

@@ -45,9 +45,11 @@ public class OpSchedule extends HisBaseEntity {
private String operName; private String operName;
/** 术前诊断 */ /** 术前诊断 */
@TableField(value = "preoperative_diagnosis", insertStrategy = FieldStrategy.IGNORED)
private String preoperativeDiagnosis; private String preoperativeDiagnosis;
/** 术后诊断 */ /** 术后诊断 */
@TableField(value = "postoperative_diagnosis", insertStrategy = FieldStrategy.IGNORED)
private String postoperativeDiagnosis; private String postoperativeDiagnosis;
/** 手术安排日期 */ /** 手术安排日期 */
@@ -87,33 +89,43 @@ public class OpSchedule extends HisBaseEntity {
private String tableNo; private String tableNo;
/** 麻醉方式 */ /** 麻醉方式 */
@TableField(value = "anes_method", insertStrategy = FieldStrategy.IGNORED)
private String anesMethod; private String anesMethod;
/** 麻醉医生1编码 */ /** 麻醉医生1编码 */
@TableField(value = "anes_doctor1_code", insertStrategy = FieldStrategy.IGNORED)
private String anesDoctor1Code; private String anesDoctor1Code;
/** 麻醉医生2编码 */ /** 麻醉医生2编码 */
@TableField(value = "anes_doctor2_code", insertStrategy = FieldStrategy.IGNORED)
private String anesDoctor2Code; private String anesDoctor2Code;
/** 麻醉医生3编码 */ /** 麻醉医生3编码 */
@TableField(value = "anes_doctor3_code", insertStrategy = FieldStrategy.IGNORED)
private String anesDoctor3Code; private String anesDoctor3Code;
/** 洗手护士编码 */ /** 洗手护士编码 */
@TableField(value = "scrub_nurse_code", insertStrategy = FieldStrategy.IGNORED)
private String scrubNurseCode; private String scrubNurseCode;
/** 巡回护士1编码 */ /** 巡回护士1编码 */
@TableField(value = "circu_nurse1_code", insertStrategy = FieldStrategy.IGNORED)
private String circuNurse1Code; private String circuNurse1Code;
/** 巡回护士2编码 */ /** 巡回护士2编码 */
@TableField(value = "circu_nurse2_code", insertStrategy = FieldStrategy.IGNORED)
private String circuNurse2Code; private String circuNurse2Code;
/** 器械护士1编码 */ /** 器械护士1编码 */
@TableField(value = "scrub_nurse1_code", insertStrategy = FieldStrategy.IGNORED)
private String scrubNurse1Code; private String scrubNurse1Code;
/** 器械护士2编码 */ /** 器械护士2编码 */
@TableField(value = "scrub_nurse2_code", insertStrategy = FieldStrategy.IGNORED)
private String scrubNurse2Code; private String scrubNurse2Code;
/** 主刀医生编码 */ /** 主刀医生编码 */
@TableField(value = "surgeon_code", insertStrategy = FieldStrategy.IGNORED)
private String surgeonCode; private String surgeonCode;
/** 助手1编码 */ /** 助手1编码 */

View File

@@ -195,7 +195,7 @@
<!-- 新增或修改手术对话框 --> <!-- 新增或修改手术对话框 -->
<el-dialog :title="title" v-model="open" width="800px" @close="cancel" append-to-body :close-on-click-modal="false"> <el-dialog :title="title" v-model="open" width="800px" @close="cancel" append-to-body :close-on-click-modal="false">
<!-- 编辑模式下显示当前状态 -->ElMessageBox is not defined <!-- 编辑模式下显示当前状态 -->
<el-alert v-if="isEditMode && form.statusEnum !== undefined" :title="'当前状态: ' + getStatusText(form.statusEnum)" :type="getStatusType(form.statusEnum)" :closable="false" style="margin-bottom: 20px;" /> <el-alert v-if="isEditMode && form.statusEnum !== undefined" :title="'当前状态: ' + getStatusText(form.statusEnum)" :type="getStatusType(form.statusEnum)" :closable="false" style="margin-bottom: 20px;" />
<!-- 查看模式下显示提示 --> <!-- 查看模式下显示提示 -->
<el-alert v-if="isViewMode" title="当前为查看模式,所有字段均为只读状态" type="info" :closable="false" style="margin-bottom: 20px;" /> <el-alert v-if="isViewMode" title="当前为查看模式,所有字段均为只读状态" type="info" :closable="false" style="margin-bottom: 20px;" />