using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
///
/// Sepsis bundle compliance tracking: current bundle by encounter and bundle detail by id.
///
[ApiController]
[Produces("application/json")]
[AuthorizePermission(ClinicalPermissions.EncountersRead)]
public class SepsisBundlesController : ControllerBase
{
private readonly ISepsisBundleService _bundles;
public SepsisBundlesController(ISepsisBundleService bundles) => _bundles = bundles;
///
/// Returns the current (most recent) sepsis bundle for an encounter with elements and linked orders.
///
/// Encounter id.
[HttpGet("api/v1/encounters/{encounterId:guid}/sepsis-bundle/current")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
public async Task GetCurrentByEncounter(Guid encounterId)
{
var bundle = await _bundles.GetCurrentByEncounterAsync(encounterId);
if (bundle is null)
return Ok(ApiResponse.Ok(null));
return Ok(ApiResponse.Ok(bundle));
}
///
/// Returns a sepsis bundle by id with all elements and linked orders.
///
/// Bundle id.
[HttpGet("api/v1/sepsis-bundles/{id:guid}")]
[ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ApiResponse