我是 FHIR 的新手。我正在尝试在 Spring MVC 中公开一个 REST url,它将公开 FHIR 的 JSON 数据模型并对其进行处理。使用 FHIR 网站上提供的示例请求,我无法将其映射回数据对象,因为我无法找出要映射的顶级数据对象。
FhirModelWrapper.java
private Resource resourceType;
public Resource getResourceType() {
if(resourceType.getResourceType() == ResourceType.Encounter) {
return new Encounter();
}
return new Patient();
}
public void setResourceType(Resource resourceType) {
this.resourceType = resourceType;
}
样品请求
{
"resourceType": "Encounter",
"identifier": [
{
"value": "id-12345"
}
],
"location": [
{
"location": {
"display": "Soliz House"
},
"period": {
"start": "2013-11-29",
"end": "2013-12-01"
}
}
]
}
弹簧控制器
@RequestMapping(method = RequestMethod.POST, produces = "application/json", consumes = "application/json")
public @ResponseBody String[] getPatientDetails(@RequestBody FhirResource fhirModelWrapper) {
LOGGER.debug("POST Request Received for getPatientDetails " + fhirModelWrapper);
FhirModelWrapper gg = new FhirModelWrapper();
String returnT[] = rulesProcessor.process(gg);
LOGGER.debug("Request Processed.");
return returnT ;
}
我收到错误400 Bad Request