feature: HL7 FHIR R4 Integration

This commit is contained in:
voltsrage
2026-06-27 22:23:45 +08:00
parent 756cff332c
commit 5646dfddb4
27 changed files with 2658 additions and 16 deletions
@@ -0,0 +1,42 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("fhir/Encounter")]
[Produces("application/fhir+json")]
[Authorize]
public class FhirEncounterController : ControllerBase
{
private readonly IFhirService _fhir;
public FhirEncounterController(IFhirService fhir) => _fhir = fhir;
/// <summary>
/// FHIR read: GET /fhir/Encounter/{id}
/// </summary>
[HttpGet("{id}")]
public async Task<IActionResult> Read(string id)
{
var encounter = await _fhir.GetEncounterAsync(Guid.Parse(id));
if (encounter is null)
return NotFound(FhirErrorHelper.NotFound("Encounter", id));
return Ok(encounter);
}
/// <summary>
/// FHIR search: GET /fhir/Encounter?patient=X&status=Y&date=Z
/// Supports search by patient reference, status, and date range.
/// </summary>
[HttpGet]
public async Task<IActionResult> Search(
[FromQuery] string? patient,
[FromQuery] string? status,
[FromQuery] string? date,
[FromQuery(Name = "_count")] int count = 20,
[FromQuery(Name = "_offset")] int offset = 0)
{
var bundle = await _fhir.SearchEncountersAsync(patient, status, date, count, offset);
return Ok(bundle);
}
}