feature: Degraded Operations Visibility

This commit is contained in:
voltsrage
2026-06-23 23:18:31 +08:00
parent 940e27c0ac
commit 4399996448
81 changed files with 3949 additions and 323 deletions
@@ -12,8 +12,15 @@ using Microsoft.AspNetCore.Mvc;
public class EncountersController : ControllerBase
{
private readonly IEncounterService _encounters;
private readonly IDischargeSummaryService _dischargeSummary;
public EncountersController(IEncounterService encounters) => _encounters = encounters;
public EncountersController(
IEncounterService encounters,
IDischargeSummaryService dischargeSummary)
{
_encounters = encounters;
_dischargeSummary = dischargeSummary;
}
/// <summary>
/// Lists encounters for ward dashboards with denormalized clinical summary fields.
@@ -115,4 +122,31 @@ public class EncountersController : ControllerBase
var timeline = await _encounters.GetTimelineAsync(id);
return Ok(ApiResponse<object>.Ok(timeline));
}
/// <summary>
/// Returns discharge summary availability for a discharged encounter.
/// </summary>
[HttpGet("{id:guid}/discharge-summary")]
[AuthorizePermission(ClinicalPermissions.EncountersRead)]
[ProducesResponseType(typeof(ApiResponse<DischargeSummaryInfo>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status404NotFound)]
public async Task<IActionResult> GetDischargeSummary(Guid id)
{
var info = await _dischargeSummary.GetInfoAsync(id);
return Ok(ApiResponse<DischargeSummaryInfo>.Ok(info));
}
/// <summary>
/// Downloads the generated discharge summary document.
/// </summary>
[HttpGet("{id:guid}/discharge-summary/content")]
[AuthorizePermission(ClinicalPermissions.EncountersRead)]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status409Conflict)]
public async Task<IActionResult> DownloadDischargeSummary(Guid id)
{
var content = await _dischargeSummary.GetContentAsync(id);
return File(content.Stream, content.ContentType, content.FileName);
}
}