我正在使用Rapi的Hapi FHIR Jpa Server实现。我正在此服务器上尝试隔离搜索。它抛出错误。我正在使用通用客户端执行隔离专区搜索。
response = client.search()
.forResource(FamilyMemberHistory.class)
.withIdAndCompartment("b3126407-6d25-4fc1-a8b2-d0d6f629be92", "Patient")
.returnBundle(Bundle.class)
.execute();
我已经向我的GenericClient注册了LoggingInterceptor
,以查看请求的形成方式。看起来像http://localhost:8090/fhir/FamilyMemberHistory/b3126407-6d25-4fc1-a8b2-d0d6f629be92/Patient
。当Hapi Fhir JPA Server收到此请求时,将引发以下错误。
2020-05-13 14:03:49.033 TRACE 52512 --- [io-8090-exec-10] c.u.f.r.s.method.SearchMethodBinding : Method public ca.uhn.fhir.rest.api.server.IBundleProvider ca.uhn.fhir.jpa.rp.r4.FamilyMemberHistoryResourceProvider.search(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,ca.uhn.fhir.rest.api.server.RequestDetails,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.UriAndListParam,ca.uhn.fhir.rest.param.UriAndListParam,ca.uhn.fhir.rest.param.HasAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.DateRangeParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.ReferenceAndListParam,ca.uhn.fhir.rest.param.UriAndListParam,ca.uhn.fhir.rest.param.ReferenceAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,java.util.Map,java.util.Set,ca.uhn.fhir.rest.param.DateRangeParam,java.util.Set,ca.uhn.fhir.rest.api.SortSpec,java.lang.Integer,ca.uhn.fhir.rest.api.SummaryEnum,ca.uhn.fhir.rest.api.SearchTotalModeEnum) doesn't match because ID is not null: FamilyMemberHistory/b3126407-6d25-4fc1-a8b2-d0d6f629be92
2020-05-13 14:03:49.033 TRACE 52512 --- [io-8090-exec-10] ca.uhn.fhir.rest.server.ResourceBinding : Handler public ca.uhn.fhir.rest.api.server.IBundleProvider ca.uhn.fhir.jpa.rp.r4.FamilyMemberHistoryResourceProvider.search(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,ca.uhn.fhir.rest.api.server.RequestDetails,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.UriAndListParam,ca.uhn.fhir.rest.param.UriAndListParam,ca.uhn.fhir.rest.param.HasAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.StringAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.DateRangeParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.ReferenceAndListParam,ca.uhn.fhir.rest.param.UriAndListParam,ca.uhn.fhir.rest.param.ReferenceAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,ca.uhn.fhir.rest.param.TokenAndListParam,java.util.Map,java.util.Set,ca.uhn.fhir.rest.param.DateRangeParam,java.util.Set,ca.uhn.fhir.rest.api.SortSpec,java.lang.Integer,ca.uhn.fhir.rest.api.SummaryEnum,ca.uhn.fhir.rest.api.SearchTotalModeEnum) does not match
2020-05-13 14:03:49.033 DEBUG 52512 --- [io-8090-exec-10] ca.uhn.fhir.rest.server.ResourceBinding : Looking for a handler for ca.uhn.fhir.rest.server.servlet.ServletRequestDetails@25b24c89
2020-05-13 14:03:49.033 WARN 52512 --- [io-8090-exec-10] c.u.f.r.s.i.ExceptionHandlingInterceptor : Failure during REST processing: ca.uhn.fhir.rest.server.exceptions.InvalidRequestException: Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[FamilyMemberHistory/b3126407-6d25-4fc1-a8b2-d0d6f629be92/Patient] with parameters [[]]
似乎Hapi库以错误的方式构造了搜索URL。我希望您的代码会产生GET [base]/Patient/[id]/FamilyMemberHistory
,因为隔离专区搜索应首先列出隔离专区(即“患者”)。
也许您可以通过在代码中切换资源类型来解决此问题?