feat: derive subject status from visits

This commit is contained in:
Cheng Zhou
2026-05-21 14:47:42 +08:00
parent 9305ced664
commit da6f2f2d41
6 changed files with 125 additions and 26 deletions
+3 -2
View File
@@ -176,9 +176,10 @@ async def update_subject(
# 基线/治疗日期是访视计划的唯一推算基准,不能用入组日期替代。
if updated.baseline_date:
await subject_crud.sync_visits_from_baseline(db, updated)
updated = await subject_crud.sync_subject_status(db, updated)
detail = None
if subject_in.status and subject_in.status != old_status:
detail = f"参与者 {updated.subject_no} 状态 {old_status} -> {subject_in.status}"
if updated.status != old_status:
detail = f"参与者 {updated.subject_no} 状态 {old_status} -> {updated.status}"
await audit_crud.log_action(
db,
study_id=study_id,