feature: Backend as Single Source of Truth for Batch-Type Field Requirements
This commit is contained in:
@@ -7,6 +7,7 @@ public record BatchDetailResponse(
|
||||
string Status,
|
||||
string BatchType,
|
||||
string Track,
|
||||
BatchTypeFieldRequirements FieldRequirements,
|
||||
Guid? PatientId,
|
||||
string DocumentRef,
|
||||
string? DocumentUrl,
|
||||
@@ -34,6 +35,7 @@ public record BatchDetailResponse(
|
||||
batch.Status.ToDbString(),
|
||||
batch.BatchType.ToDbString(),
|
||||
batch.Track.ToDbString(),
|
||||
BatchTypeFieldRequirements.ForBatchType(batch.BatchType),
|
||||
batch.PatientId,
|
||||
batch.DocumentRef,
|
||||
documentUrl,
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
public record BatchTypeFieldRequirements(
|
||||
bool ShowPatientDemographics,
|
||||
bool ShowEncounterContext,
|
||||
bool ShowEncounterSummaryFields,
|
||||
bool ShowObservations,
|
||||
bool ShowAllergies,
|
||||
bool ShowMedications
|
||||
)
|
||||
{
|
||||
public static BatchTypeFieldRequirements ForBatchType(BatchType batchType) => batchType switch
|
||||
{
|
||||
BatchType.PatientRegistration => new(
|
||||
ShowPatientDemographics: true,
|
||||
ShowEncounterContext: false,
|
||||
ShowEncounterSummaryFields: false,
|
||||
ShowObservations: false,
|
||||
ShowAllergies: false,
|
||||
ShowMedications: false),
|
||||
|
||||
BatchType.VitalsSheet => new(
|
||||
ShowPatientDemographics: true,
|
||||
ShowEncounterContext: true,
|
||||
ShowEncounterSummaryFields: false,
|
||||
ShowObservations: true,
|
||||
ShowAllergies: false,
|
||||
ShowMedications: false),
|
||||
|
||||
BatchType.LabResults => new(
|
||||
ShowPatientDemographics: true,
|
||||
ShowEncounterContext: true,
|
||||
ShowEncounterSummaryFields: false,
|
||||
ShowObservations: true,
|
||||
ShowAllergies: false,
|
||||
ShowMedications: false),
|
||||
|
||||
BatchType.AllergyUpdate => new(
|
||||
ShowPatientDemographics: true,
|
||||
ShowEncounterContext: false,
|
||||
ShowEncounterSummaryFields: false,
|
||||
ShowObservations: false,
|
||||
ShowAllergies: true,
|
||||
ShowMedications: false),
|
||||
|
||||
BatchType.EncounterSummary => new(
|
||||
ShowPatientDemographics: true,
|
||||
ShowEncounterContext: true,
|
||||
ShowEncounterSummaryFields: true,
|
||||
ShowObservations: false,
|
||||
ShowAllergies: false,
|
||||
ShowMedications: false),
|
||||
|
||||
BatchType.MedicationList => new(
|
||||
ShowPatientDemographics: true,
|
||||
ShowEncounterContext: false,
|
||||
ShowEncounterSummaryFields: false,
|
||||
ShowObservations: false,
|
||||
ShowAllergies: false,
|
||||
ShowMedications: true),
|
||||
|
||||
BatchType.Mixed => new(
|
||||
ShowPatientDemographics: true,
|
||||
ShowEncounterContext: true,
|
||||
ShowEncounterSummaryFields: true,
|
||||
ShowObservations: true,
|
||||
ShowAllergies: true,
|
||||
ShowMedications: true),
|
||||
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(batchType))
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,7 @@ public record DraftPayloadResponse(
|
||||
Guid BatchId,
|
||||
string Status,
|
||||
string BatchType,
|
||||
BatchTypeFieldRequirements FieldRequirements,
|
||||
DraftPatientDto? Patient,
|
||||
DraftEncounterDto? Encounter,
|
||||
List<DraftObservationDto> Observations
|
||||
|
||||
Reference in New Issue
Block a user