我正在使用HAPI-FHIR库,我正在尝试向资源提供者引入新的搜索参数 例如:
@Read
public Patient getResourceById(@IdParam IdDt id,
@RequiredParam(name="session") String session){}
但我有一个例外
"ca.uhn.fhir.rest.server.ConfigurationException: Method[public ca.uhn.fhir.model.dstu.resource.Patient PatientResourceProvider.getResourceById(ca.uhn.fhir.model.primitive.IdDt,java.lang.String)] is not allowed to have a parameter annotated with @ca.uhn.fhir.rest.annotation.RequiredParam(compositeTypes=[], chainBlacklist=[], targetTypes=[], chainWhitelist=[*], name=session)"
有任何建议吗?
答案 0 :(得分:0)
这里的问题是这个方法用@Read注释,所以它是“读”/“vread”而不是“搜索”。要创建接受该参数的搜索方法,请复制现有方法,删除第一个参数,然后将@Read更改为@Search。
请注意,您可能还想返回List而不仅仅是Patient,因为搜索可以返回多个结果。