fix issues with phase-32

This commit is contained in:
voltsrage
2026-06-23 00:16:39 +08:00
parent 1824e4eef1
commit 90b8baa2a1
12 changed files with 237 additions and 14 deletions
@@ -103,6 +103,17 @@ public class News2Detector
var hasSingleParamThree = paramScores.Any(s => s == 3);
var riskLevel = News2Calculator.DetermineRiskLevel(totalScore, hasSingleParamThree);
using (var scope = _services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
if (!await db.Encounters.AnyAsync(e => e.Id == encounterId, ct))
{
_logger.LogWarning(
"Skipping NEWS2 score for unknown encounter {EncounterId}", encounterId);
return News2Result.EncounterNotFound;
}
}
await PersistScoreAsync(
encounterId, patientId, totalScore, riskLevel,
paramScores, hasSingleParamThree, ct);