feature: FHIR R4 Inbound Facade
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using Hl7.Fhir.Model;
|
||||
using Hl7.Fhir.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using static Hl7.Fhir.Model.CapabilityStatement;
|
||||
|
||||
[ApiController]
|
||||
[Route("fhir/R4")]
|
||||
[ServiceFilter(typeof(FhirExceptionFilter))]
|
||||
public class FhirMetadataController : ControllerBase
|
||||
{
|
||||
[HttpGet("metadata")]
|
||||
[Produces("application/fhir+json")]
|
||||
public IActionResult Metadata()
|
||||
{
|
||||
var capability = new CapabilityStatement
|
||||
{
|
||||
Status = PublicationStatus.Active,
|
||||
Date = DateTimeOffset.UtcNow.ToString("o"),
|
||||
Kind = CapabilityStatementKind.Instance,
|
||||
Software = new CapabilityStatement.SoftwareComponent { Name = "VigilCare Clinical" },
|
||||
Implementation = new CapabilityStatement.ImplementationComponent
|
||||
{
|
||||
Description = "VigilCare Clinical FHIR R4 inbound facade",
|
||||
Url = $"{Request.Scheme}://{Request.Host}/fhir/R4"
|
||||
},
|
||||
FhirVersion = FHIRVersion.N4_0_1,
|
||||
Format = new[] { "application/fhir+json" },
|
||||
Rest = new List<CapabilityStatement.RestComponent>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Mode = CapabilityStatement.RestfulCapabilityMode.Server,
|
||||
Resource = new List<CapabilityStatement.ResourceComponent>
|
||||
{
|
||||
ResourceCapability("Patient", TypeRestfulInteraction.Create),
|
||||
ResourceCapability("Encounter", TypeRestfulInteraction.Create),
|
||||
ResourceCapability("Observation", TypeRestfulInteraction.Create),
|
||||
ResourceCapability("MedicationAdministration", TypeRestfulInteraction.Create),
|
||||
new CapabilityStatement.ResourceComponent
|
||||
{
|
||||
Type = "Bundle",
|
||||
Interaction = new List<CapabilityStatement.ResourceInteractionComponent>
|
||||
{
|
||||
new() { Code = TypeRestfulInteraction.Create }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Content(new FhirJsonSerializer().SerializeToString(capability), "application/fhir+json");
|
||||
}
|
||||
|
||||
private static CapabilityStatement.ResourceComponent ResourceCapability(
|
||||
string type, TypeRestfulInteraction interaction) =>
|
||||
new()
|
||||
{
|
||||
Type = type,
|
||||
Interaction = new List<CapabilityStatement.ResourceInteractionComponent>
|
||||
{
|
||||
new() { Code = interaction }
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user