Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 02:08:50 +08:00
parent f214a137f7
commit 3fd04450a0
5 changed files with 232 additions and 37 deletions

View File

@@ -27,8 +27,12 @@ public class CheckRequestController {
}
@PostMapping("/submit")
public void submit(@RequestBody List<Map<String, Object>> selected) {
// 校验:同一检查项目只能提交一次,且项目与方法解耦
checkRequestService.validateAndSubmit(selected);
public Map<String, Object> submit(@RequestBody List<Map<String, Object>> selected) {
try {
checkRequestService.validateAndSubmit(selected);
return Map.of("code", 200, "msg", "提交成功");
} catch (IllegalArgumentException e) {
return Map.of("code", 400, "msg", e.getMessage());
}
}
}

View File

@@ -59,7 +59,7 @@ public interface CheckRequestMapper {
" <when test='item.requestTime != null'>#{item.requestTime}</when>",
" <otherwise>NOW()</otherwise>",
"</choose>,",
"0", // 待处理状态
"0",
")",
"</foreach>",
"</script>"

View File

@@ -58,11 +58,10 @@ public class CheckRequestServiceImpl implements CheckRequestService {
List<String> alreadyPending = checkRequestMapper.selectPendingItemCodes(itemCodes);
if (!alreadyPending.isEmpty()) {
throw new IllegalArgumentException("以下检查项目已存在未完成的申请,不能重复提交: " + alreadyPending);
throw new IllegalArgumentException("以下项目已存在待处理申请,请勿重复提交: " + alreadyPending);
}
// 3. 批量插入检查申请明细(一次 INSERT 完成
// 前端只需要提供 itemCode、patientId、doctorId 等必要字段,其他字段在数据库层统一填充
// 3. 批量入库(项目与方法解耦,仅保存主项目记录,方法明细由前端独立组装或另表关联
checkRequestMapper.batchInsertCheckRequests(selected);
}
}