feature: Improve dashboard functionality
This commit is contained in:
@@ -124,7 +124,7 @@ public class SepsisBundleService : ISepsisBundleService
|
||||
return bundle;
|
||||
}
|
||||
|
||||
public async Task<PagedResult<SepsisBundle>> ListAsync(
|
||||
public async Task<PagedResult<SepsisBundleSummary>> ListAsync(
|
||||
SepsisBundleComplianceStatus? status, int page, int pageSize)
|
||||
{
|
||||
pageSize = Math.Clamp(pageSize, 1, 100);
|
||||
@@ -132,19 +132,39 @@ public class SepsisBundleService : ISepsisBundleService
|
||||
var query = _db.SepsisBundles
|
||||
.AsNoTracking()
|
||||
.Include(b => b.Elements)
|
||||
.Include(b => b.Encounter)
|
||||
.ThenInclude(e => e.Patient)
|
||||
.AsQueryable();
|
||||
|
||||
if (status.HasValue)
|
||||
query = query.Where(b => b.ComplianceStatus == status.Value);
|
||||
|
||||
var total = await query.CountAsync();
|
||||
var items = await query
|
||||
var bundles = await query
|
||||
.OrderByDescending(b => b.RecognizedAt)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
|
||||
return new PagedResult<SepsisBundle>(items, page, pageSize, total);
|
||||
var items = bundles.Select(b => new SepsisBundleSummary(
|
||||
b.Id,
|
||||
b.EncounterId,
|
||||
b.Encounter.Patient.Mrn,
|
||||
b.Encounter.Patient.FirstName,
|
||||
b.Encounter.Patient.LastName,
|
||||
b.Encounter.RoomBed,
|
||||
b.Encounter.Department,
|
||||
b.TriggeringAlertType,
|
||||
b.RecognizedAt,
|
||||
b.DeadlineAt,
|
||||
b.ComplianceStatus,
|
||||
b.CompletedAt,
|
||||
b.Elements
|
||||
.Select(e => new SepsisBundleElementSummary(e.Id, e.ElementType, e.Status, e.CompletedAt))
|
||||
.ToList()))
|
||||
.ToList();
|
||||
|
||||
return new PagedResult<SepsisBundleSummary>(items, page, pageSize, total);
|
||||
}
|
||||
|
||||
public async Task OnOrderResultedAsync(Guid orderId, CancellationToken ct = default)
|
||||
|
||||
Reference in New Issue
Block a user