fixes: PromoteAsync (retry path) does not create clinical entities + Patient deduplication by exact name + DOB is fragile + Batch assignment creates inconsistent interim state

This commit is contained in:
voltsrage
2026-06-27 14:15:40 +08:00
parent 66ae95956a
commit 46c3492bb9
8 changed files with 1195 additions and 1107 deletions
@@ -6,7 +6,6 @@ public class DraftService : IDraftService
private readonly AppDbContext _db;
private readonly ILogger<DraftService> _logger;
// Statuses that allow data entry to begin or continue
private static readonly HashSet<BatchStatus> _entryAllowedStatuses = new()
{
BatchStatus.Uploaded,
@@ -335,15 +334,10 @@ public class DraftService : IDraftService
return batch;
}
/// <summary>
/// Transitions the batch from Uploaded or Rejected to InEntry on first save.
/// If the batch is already InEntry, this is a no-op.
/// </summary>
private void TransitionToInEntryIfNeeded(DigitizationBatch batch, Guid actorUserId)
{
if (batch.Status == BatchStatus.InEntry) return;
// batch.Status is Uploaded or Rejected (validated by LoadBatchForEntryAsync)
var previousStatus = batch.Status.ToDbString();
batch.Status = BatchStatus.InEntry;
batch.UpdatedAt = DateTimeOffset.UtcNow;