Created
October 25, 2021 06:48
-
-
Save balteravishay/6f91a37a23cbd29673cfe41aa74c09c2 to your computer and use it in GitHub Desktop.
Create a FHIR patient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
[Authorize(Policy = "OwnerOrAdmin")] | |
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(Patient))] | |
[ProducesResponseType(StatusCodes.Status500InternalServerError, Type = typeof(Error))] | |
[ProducesResponseType(StatusCodes.Status422UnprocessableEntity, Type = typeof(UnprocessableInputException))] | |
public async Task<IActionResult> CreatePatient([FromBody] dynamic value) | |
{ | |
Patient patient = _fhirParser.Parse<Patient>(value.ToString()); | |
var user = ((User)HttpContext.Items["User"]); | |
patient = await _authorizedFhirService.CreateAsync(user, patient); | |
string createdPatientJson = await patient.ToJsonAsync(); | |
return Content(createdPatientJson, MediaTypeNames.Application.Json); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment