feature: Ward Gateway Service (Local-First Clinical Path)

This commit is contained in:
voltsrage
2026-06-23 16:45:38 +08:00
parent d8e142fffe
commit 1bf8359097
100 changed files with 5474 additions and 4 deletions
@@ -0,0 +1,12 @@
public class BufferedSyncItem
{
public Guid Id { get; set; }
public BufferedSyncItemType ItemType { get; set; }
public string Payload { get; set; } = null!;
public string IdempotencyKey { get; set; } = null!;
public Guid EncounterId { get; set; }
public DateTimeOffset RecordedAt { get; set; }
public bool Synced { get; set; }
public DateTimeOffset? SyncedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }
}
@@ -0,0 +1,6 @@
public class GatewaySyncState
{
public Guid Id { get; set; }
public DateTimeOffset? LastEncounterSyncAt { get; set; }
public bool InitialSyncCompleted { get; set; }
}
@@ -0,0 +1,19 @@
public class LocalClinicalAlert
{
public Guid Id { get; set; }
public Guid EncounterId { get; set; }
public Guid PatientId { get; set; }
public Guid? ObservationId { get; set; }
public AlertType AlertType { get; set; }
public AlertSeverity Severity { get; set; }
public string Details { get; set; } = null!;
public string? ObservationCode { get; set; }
public AlertStatus Status { get; set; } = AlertStatus.Open;
public DateTimeOffset? AcknowledgedAt { get; set; }
public string? AcknowledgedBy { get; set; }
public DateTimeOffset? ResolvedAt { get; set; }
public DateTimeOffset TriggeredAt { get; set; }
public Guid ClientAlertId { get; set; }
public ReplicaEncounter Encounter { get; set; } = null!;
}
@@ -0,0 +1,14 @@
public class LocalObservation
{
public Guid Id { get; set; }
public Guid EncounterId { get; set; }
public string ObservationCode { get; set; } = null!;
public decimal Value { get; set; }
public string Unit { get; set; } = null!;
public ObservationSource Source { get; set; } = ObservationSource.Manual;
public string? IdempotencyKey { get; set; }
public DateTimeOffset RecordedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }
public ReplicaEncounter Encounter { get; set; } = null!;
}
@@ -0,0 +1,13 @@
public class ReplicaAlertThreshold
{
public Guid Id { get; set; }
public string ObservationCode { get; set; } = null!;
public string DisplayName { get; set; } = null!;
public string Unit { get; set; } = null!;
public decimal? CriticalLow { get; set; }
public decimal? WarningLow { get; set; }
public decimal? WarningHigh { get; set; }
public decimal? CriticalHigh { get; set; }
public int? SuppressionWindowMinutes { get; set; }
public DateTimeOffset SyncedAt { get; set; }
}
@@ -0,0 +1,16 @@
public class ReplicaEncounter
{
public Guid Id { get; set; }
public Guid PatientId { get; set; }
public EncounterType EncounterType { get; set; } = EncounterType.Inpatient;
public EncounterStatus Status { get; set; }
public Department Department { get; set; }
public string AttendingPhysician { get; set; } = null!;
public string? RoomBed { get; set; }
public DateTimeOffset AdmittedAt { get; set; }
public DateTimeOffset SyncedAt { get; set; }
public ReplicaPatient Patient { get; set; } = null!;
public ICollection<LocalObservation> Observations { get; set; } = new List<LocalObservation>();
public ICollection<LocalClinicalAlert> Alerts { get; set; } = new List<LocalClinicalAlert>();
}
@@ -0,0 +1,12 @@
public class ReplicaPatient
{
public Guid Id { get; set; }
public string Mrn { get; set; } = null!;
public string FirstName { get; set; } = null!;
public string LastName { get; set; } = null!;
public DateOnly DateOfBirth { get; set; }
public string Gender { get; set; } = null!;
public DateTimeOffset SyncedAt { get; set; }
public ICollection<ReplicaEncounter> Encounters { get; set; } = new List<ReplicaEncounter>();
}
@@ -0,0 +1,8 @@
public class SyncOutboxEntry
{
public Guid Id { get; set; }
public Guid? BatchId { get; set; }
public SyncOutboxStatus Status { get; set; } = SyncOutboxStatus.Pending;
public DateTimeOffset CreatedAt { get; set; }
public DateTimeOffset? SubmittedAt { get; set; }
}