Принятие ресурса FHIR «Пациент» в качестве тела запроса при весенней загрузкеJAVA

Программисты JAVA общаются здесь
Anonymous
Принятие ресурса FHIR «Пациент» в качестве тела запроса при весенней загрузке

Сообщение Anonymous »

Я хочу принять тело JSON ресурса FHIR пациента как @RequestBody в API загрузки Spring. Я пытался это сделать:

Код: Выделить всё

@RestController
@RequestMapping("/api")
public class DemoController {

@PostMapping("/Patient/save")
public String savePatientDetails(@RequestBody Patient p) {
IGenericClient client = fhirContext.newRestfulGenericClient("http://localhost:8080/fhir");
MethodOutcome s = client.create().resource(p).prettyPrint()
.encodedJson()
.execute();
return s.toString();
}
}
Использование модели пациента из HAPI FHIR (https://hapifhir.io/hapi-fhir/apidocs/h ... r/r4/model /Patient.html)
И вызвал указанную выше конечную точку с помощью почтальона с приведенным ниже телом запроса:

Код: Выделить всё

{
"resourceType":"Patient",
"name": [{
"use": "official",
"given": ["temp"],
"family": "temp"
}],
"birthDate": "1996-04-07"
}
но ниже выдается ошибка десериализации Джексона:

Код: Выделить всё

[nio-8081-exec-1] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class org.hl7.fhir.r4.model.Patient]]: com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "referenceElement": org.hl7.fhir.r4.model.Reference#setReferenceElement(1 params) vs org.hl7.fhir.r4.model.Reference#setReferenceElement(1 params)
2022-02-25 09:32:43.332  WARN 71185 --- [nio-8081-exec-1] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class org.hl7.fhir.r4.model.Patient]]: com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "referenceElement": org.hl7.fhir.r4.model.Reference#setReferenceElement(1 params) vs org.hl7.fhir.r4.model.Reference#setReferenceElement(1 params)
2022-02-25 09:32:43.356  WARN 71185 --- [nio-8081-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported]
Заранее спасибо.

Подробнее здесь: https://stackoverflow.com/questions/722 ... pring-boot

Вернуться в «JAVA»