Stream: implementers
Topic: Fhir With Spring
Aman (Oct 17 2019 at 17:09):
Hi, Wondering if anyone got a change to to retrieve patient info using spring? I have the following code to Retrieve a HAPI Patient:
@GetMapping({"/PatientError/{id}"})
public JsonNode getPatientByIdError(@PathVariable(value = "id") Integer id) throws IOException {
String patientString = tokenReciever.getTokenResponse()
.flatMap(tokenResponse -> client.get().uri(
baseUri+"Patient/"+id)
.headers(h -> h.setBearerAuth(tokenResponse.getAccessToken()))
.header(HttpHeaders.ACCEPT, "application/json+fhir").retrieve()
.bodyToMono(String.class))
.block();
JsonNode node = objectMapper.readTree(patientString);
Patient patient
= objectMapper.treeToValue(node,Patient.class);
return node;
}
however when I parse the String to convert it to Patient.class
I get following error:
Conflicting setter definitions for property "gender": ca.uhn.fhir.model.dstu2.resource.Patient#setGender(1 params) vs ca.uhn.fhir.model.dstu2.resource.Patient#setGender(1 params) at [Source: UNKNOWN; line: -1, column: -1]
Jens Villadsen (Oct 17 2019 at 20:54):
And using http://hapifhir.io/doc_rest_client.html is not an option?
Last updated: Apr 12 2022 at 19:14 UTC