【发布时间】:2016-03-08 16:51:29
【问题描述】:
我正在尝试了解 Hapi Fhir 中的 RESTful 服务器是如何工作的,并且我想为观察资源实现一些 @Search 方法。
目前,我有这个@Read 操作,它在尝试从浏览器访问资源(如:http://localhost:8080/NewFHIRServer/fhir)时成功:
@Read()
public Observation readObservationById(@IdParam IdDt theId) {
for (Entry<Long, Deque<Observation>> entry : myPatientIdToObservations.entrySet())
{
for (Observation obs : entry.getValue()) {
if (obs.getId().equals(theId)) {
return obs;
}
}
}
throw new ResourceNotFoundException(theId);
}
但是,当我尝试对 @Search 操作执行类似操作时,我遇到了错误。我希望能够通过像这样(或类似)运行搜索来获得响应:
Bundle response = client
.search()
.forResource(Observation.class)
.where(Observation.SUBJECT.hasId("Patient/1"))
.execute();
为了使这成为可能,我的@Read 方法中需要哪些参数?我现在遇到的错误如下:
此服务器上的 FHIR 端点不知道如何处理 GET 操作[Observation],带参数[[subject]]
很明显为什么它不起作用,因为我的标题看起来像这样:
public Observation searchObservationById(@IdParam IdDt theId)
我一直在查看示例以试图弄清楚这一点,但我不太明白这个参数中的语法是什么意思:
public List<Patient> getPatient(@RequiredParam(name = Patient.SP_FAMILY) StringParam theFamilyName)...
为了使用最后一个示例,您将如何进行查询?
谢谢
【问题讨论】: