No SOFA trend chart or organ-system timeline
No GCS trend chart or component history
No qSOFA history view
This commit is contained in:
voltsrage
2026-06-23 18:00:43 +08:00
parent 729c19830c
commit 7751d6df06
30 changed files with 3866 additions and 41 deletions
@@ -14,4 +14,37 @@ public class GcsService : IGcsService
.OrderByDescending(s => s.CalculatedAt)
.FirstOrDefaultAsync();
}
public async Task<CursorPage<GcsScore>> GetHistoryAsync(
Guid encounterId, int limit, string? cursorToken)
{
limit = Math.Clamp(limit, 1, 100);
var cursor = GcsScoreCursor.Decode(cursorToken);
var query = _db.GcsScores
.AsNoTracking()
.Where(s => s.EncounterId == encounterId);
if (cursor is not null)
{
query = query.Where(s =>
s.CalculatedAt < cursor.CalculatedAt ||
(s.CalculatedAt == cursor.CalculatedAt && s.Id.CompareTo(cursor.Id) < 0));
}
var items = await query
.OrderByDescending(s => s.CalculatedAt)
.ThenByDescending(s => s.Id)
.Take(limit + 1)
.ToListAsync();
var hasMore = items.Count > limit;
if (hasMore) items.RemoveAt(limit);
var nextCursor = hasMore
? new GcsScoreCursor(items[^1].CalculatedAt, items[^1].Id).Encode()
: null;
return new CursorPage<GcsScore>(items, nextCursor, hasMore);
}
}