Clinical Sync Batch Engine: first commit

This commit is contained in:
voltsrage
2026-06-23 03:02:30 +08:00
parent 90b8baa2a1
commit c9994b1ba2
60 changed files with 3547 additions and 31 deletions
@@ -0,0 +1,30 @@
public class ClinicalSyncBatch
{
public Guid Id { get; private set; }
public Guid GatewayId { get; private set; }
public Guid SiteId { get; private set; }
public Guid BatchReference { get; private set; }
public ClinicalSyncBatchStatus Status { get; private set; } = ClinicalSyncBatchStatus.Received;
public string Payload { get; private set; } = "{}";
public DateTimeOffset SubmittedAt { get; private set; }
public DateTimeOffset? ProcessedAt { get; private set; }
public WardGateway Gateway { get; private set; } = null!;
public ICollection<ClinicalSyncConflict> Conflicts { get; private set; } = [];
private ClinicalSyncBatch() { }
public ClinicalSyncBatch(Guid gatewayId, Guid siteId, Guid batchReference, string payload)
{
GatewayId = gatewayId;
SiteId = siteId;
BatchReference = batchReference;
Payload = payload;
SubmittedAt = DateTimeOffset.UtcNow;
}
public void MarkProcessing() => Status = ClinicalSyncBatchStatus.Processing;
public void MarkApplied() { Status = ClinicalSyncBatchStatus.Applied; ProcessedAt = DateTimeOffset.UtcNow; }
public void MarkConflict() { Status = ClinicalSyncBatchStatus.Conflict; ProcessedAt = DateTimeOffset.UtcNow; }
public void MarkRejected() { Status = ClinicalSyncBatchStatus.Rejected; ProcessedAt = DateTimeOffset.UtcNow; }
}