fix(#743): guanyu (文件合入)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# HealthLink-HIS 代码模块索引
|
||||
|
||||
> 供 LLM 快速定位代码。每个模块列出 Controller → Service → Mapper 关键文件。
|
||||
> 最后更新: 2026-06-14 00:00 (298 个 Controller)
|
||||
> 最后更新: 2026-06-14 06:00 (298 个 Controller)
|
||||
|
||||
## 关键词 → 模块速查
|
||||
|
||||
|
||||
@@ -165,6 +165,18 @@ public class EmergencyController {
|
||||
@PostMapping("/rescue/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> addRescue(@RequestBody EmergencyRescue rescue) {
|
||||
// Bug#743: 修复 patientId 为 null 时数据库 NOT NULL 约束冲突
|
||||
// 如果传了 triageId 但没传 patientId,从分诊记录自动关联患者
|
||||
if (rescue.getPatientId() == null && rescue.getTriageId() != null) {
|
||||
EmergencyTriage triage = triageService.getById(rescue.getTriageId());
|
||||
if (triage != null) {
|
||||
rescue.setPatientId(triage.getPatientId());
|
||||
}
|
||||
}
|
||||
// 校验:patientId 必须存在(数据库 NOT NULL 约束)
|
||||
if (rescue.getPatientId() == null) {
|
||||
return R.fail("患者ID不能为空,请提供患者ID或分诊ID");
|
||||
}
|
||||
rescue.setRescueStart(new Date());
|
||||
rescue.setCreateTime(new Date());
|
||||
rescueService.save(rescue);
|
||||
|
||||
Reference in New Issue
Block a user