feature: Schema, Migrations, Core CRUD, and Redis Threshold Cache

This commit is contained in:
voltsrage
2026-06-16 17:59:16 +08:00
commit 882d4af3e6
63 changed files with 3923 additions and 0 deletions
@@ -0,0 +1,12 @@
public class AlertThreshold
{
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 DateTimeOffset CreatedAt { get; set; }
}
@@ -0,0 +1,17 @@
public class ClinicalAlert
{
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 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 Encounter Encounter { get; set; } = null!;
}
@@ -0,0 +1,17 @@
public class Encounter
{
public Guid Id { get; set; }
public Guid PatientId { get; set; }
public EncounterType EncounterType { get; set; }
public EncounterStatus Status { get; set; }
public string Department { get; set; } = null!;
public string AttendingPhysician { get; set; } = null!;
public DateTimeOffset AdmittedAt { get; set; }
public DateTimeOffset? DischargedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }
public Patient Patient { get; set; } = null!;
public ICollection<Observation> Observations { get; set; } = new List<Observation>();
public ICollection<ClinicalAlert> Alerts { get; set; } = new List<ClinicalAlert>();
public ICollection<Order> Orders { get; set; } = new List<Order>();
}
@@ -0,0 +1,14 @@
public class Observation
{
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 Encounter Encounter { get; set; } = null!;
}
@@ -0,0 +1,13 @@
public class Order
{
public Guid Id { get; set; }
public Guid EncounterId { get; set; }
public OrderType OrderType { get; set; }
public string Description { get; set; } = null!;
public string OrderedBy { get; set; } = null!;
public string Status { get; set; } = "pending";
public DateTimeOffset OrderedAt { get; set; }
public DateTimeOffset? ResultedAt { get; set; }
public Encounter Encounter { get; set; } = null!;
}
@@ -0,0 +1,8 @@
public class OutboxEvent
{
public Guid Id { get; set; }
public string Topic { get; set; } = null!;
public string Payload { get; set; } = null!; // JSON string
public DateTimeOffset CreatedAt { get; set; }
public DateTimeOffset? ProcessedAt { get; set; }
}
@@ -0,0 +1,13 @@
public class Patient
{
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 string Status { get; set; } = "active";
public DateTimeOffset CreatedAt { get; set; }
public ICollection<Encounter> Encounters { get; set; } = new List<Encounter>();
}
@@ -0,0 +1,10 @@
public class ReconciliationAlert
{
public Guid Id { get; set; }
public ReconciliationCheckType CheckType { get; set; }
public Guid? EncounterId { get; set; }
public Guid? PatientId { get; set; }
public string Details { get; set; } = null!;
public DateTimeOffset? ResolvedAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }
}