feature: Corrections and Supersession

This commit is contained in:
voltsrage
2026-06-26 16:33:31 +08:00
parent 706318e5d2
commit f232761fd7
35 changed files with 4907 additions and 75 deletions
+8 -5
View File
@@ -453,12 +453,15 @@ public class DraftService : IDraftService
private static void ValidateLabResults(
DigitizationBatch batch, List<string> errors)
{
// Required: Linked patient, encounter, >= 1 lab observation code, recordedAt
if (batch.DraftPatient is null)
errors.Add("Linked patient is required for lab results");
// Corrections inherit patient and encounter from the superseded promoted batch
if (!batch.SupersedesBatchId.HasValue)
{
if (batch.DraftPatient is null)
errors.Add("Linked patient is required for lab results");
if (batch.DraftEncounter is null)
errors.Add("Encounter context is required for lab results");
if (batch.DraftEncounter is null)
errors.Add("Encounter context is required for lab results");
}
if (batch.DraftObservations.Count == 0)
errors.Add("At least one lab observation is required");