Fix Bug #412: 门诊医生站传染病报告卡保存失败,提示报错
后端 saveInfectiousDiseaseReport 中 getCardNo().trim() 存在空指针异常风险, 增加 cardNo 空值校验避免 NPE 导致保存失败。 前端 buildSubmitData 中 diseaseCode 在 selectedClassA/B/C 为空时会变成 null, 增加从 selectedDiseases 兜底取值逻辑确保 diseaseCode 始终有值。
This commit is contained in:
@@ -580,7 +580,11 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
@Override
|
||||
public R<?> saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto) {
|
||||
// 检查卡片编号唯一性(新增时检查,编辑时排除当前记录)
|
||||
String cardNo = infectiousDiseaseReportDto.getCardNo().trim();
|
||||
String cardNo = infectiousDiseaseReportDto.getCardNo();
|
||||
if (cardNo == null || cardNo.trim().isEmpty()) {
|
||||
return R.fail("卡片编号不能为空");
|
||||
}
|
||||
cardNo = cardNo.trim();
|
||||
LambdaQueryWrapper<InfectiousDiseaseReport> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(InfectiousDiseaseReport::getCardNo, cardNo);
|
||||
long count = iInfectiousDiseaseReportService.count(queryWrapper);
|
||||
|
||||
@@ -1366,6 +1366,9 @@ async function buildSubmitData() {
|
||||
} else if (formData.otherDisease) {
|
||||
// 其他传染病使用自定义编码
|
||||
diseaseCode = 'OTHER';
|
||||
} else if (formData.selectedDiseases && formData.selectedDiseases.length > 0) {
|
||||
// 兜底:如果 ClassA/B/C 都为空但 selectedDiseases 有值,取第一个作为 diseaseCode
|
||||
diseaseCode = formData.selectedDiseases[0];
|
||||
}
|
||||
|
||||
// 转换年龄单位:岁=1, 月=2, 天=3
|
||||
|
||||
Reference in New Issue
Block a user