用于FHIR数据模型的Java REST客户端

用于FHIR数据模型的Java REST客户端,java,rest,hl7,hl7-fhir,Java,Rest,Hl7,Hl7 Fhir,有人能举一个例子,让Java REST客户端使用FHIR数据模型搜索患者吗?是一个简单的RESTful客户端API,可与FHIR服务器一起使用 下面是一个简单的代码示例,它搜索给定服务器上的所有患者,然后打印出他们的姓名 // Create a client (only needed once) FhirContext ctx = new FhirContext(); IGenericClient client = ctx.newRestfulGenericClient("http://f

有人能举一个例子,让Java REST客户端使用FHIR数据模型搜索患者吗?

是一个简单的RESTful客户端API,可与FHIR服务器一起使用

下面是一个简单的代码示例,它搜索给定服务器上的所有患者,然后打印出他们的姓名

 // Create a client (only needed once)
 FhirContext ctx = new FhirContext();
 IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/base");

 // Invoke the client
 Bundle bundle = client.search()
         .forResource(Patient.class)
         .execute();

 System.out.println("patients count=" + bundle.size());
 List<Patient> list = bundle.getResources(Patient.class);
 for (Patient p : list) {
     System.out.println("name=" + p.getName());
 }
下面是一个可以约束搜索查询的示例:

Bundle response = client.search()
      .forResource(Patient.class)
      .where(Patient.BIRTHDATE.beforeOrEquals().day("2011-01-01"))
      .and(Patient.PROVIDER.hasChainedProperty(Organization.NAME.matches().value("Health")))
      .execute();
同样,您也可以从中使用DSTUJava参考库
这包括模型API和FhirJavaReferenceClient。

您有使用hapi实现java RESTful客户端的文档吗?不幸的是,文档不够丰富@JasonM1:亲爱的,我尝试使用Bundle类的size()和getResources()方法,但R4 FHIR版本不存在。有一些等效的方法??多年来的重大重新设计和重构。回顾历史。下载R4FHIR源代码包以查找使用Bundle的示例代码。
Bundle response = client.search()
      .forResource(Patient.class)
      .where(Patient.BIRTHDATE.beforeOrEquals().day("2011-01-01"))
      .and(Patient.PROVIDER.hasChainedProperty(Organization.NAME.matches().value("Health")))
      .execute();