[英]How to implement Search operation for an Observation Resource Provider for Hapi Fhir server?
[英]Search a FHIR server for a specific resource id
我正在使用Hapi FHIR DSTU2 HL7Org。 在我的应用程序中,我需要创建一个MedicationOrder并提供更新/删除错误条目的可能性。 我有创建的MedicationOrder的id,patientId等,但用where子句编写代码是很有问题的。 在我看到的所有例子中,条目如
where(Patient.FAMILY.matches().value("duck")
礼物,但我得到了SP_PATIENT,SP_STATUS等。
FhirContext ctx = FhirContext.forDstu2Hl7Org();
IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu2");
Bundle bundle = client.search().forResource(MedicationOrder.class).where(MedicationOrder.SP_PATIENT.equals("patientId")).returnBundle(Bundle.class).encodedXml().prettyPrint().execute();
上面的代码没有编译说“类型IQuery中的(ICriterion)不适用于参数(boolean)”的方法。 我无法创建任何IQuery对象。
有人可以告诉我如何继续吗?
这有点奇怪--DSTU2 HL7Org结构是在我们尚未将所有模型特征从HAPI结构转移到HL7Org结构的地方创建的。 那些“非SP”标准常数是我们没有复制过的东西之一。
好消息是,即使您使用的是DSTU2-H17Org结构,您仍然可以使用DSTU2或DSTU3结构中的结构。 你可以这样做:
FhirContext ctx = FhirContext.forDstu2Hl7Org();
IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu2");
Bundle bundle = client.search().forResource(MedicationOrder.class).where(ca.uhn.fhir.model.dstu2.resource.MedicationOrder.PATIENT.matches().value("duck")).returnBundle(Bundle.class).encodedXml().prettyPrint().execute();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.