首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >访问捆绑包HL7-FHIR中的资源

访问捆绑包HL7-FHIR中的资源
EN

Stack Overflow用户
提问于 2016-07-26 05:04:32
回答 1查看 988关注 0票数 2

我只是想知道是否有一种方法可以访问包中的资源。

I.E

代码语言:javascript
复制
        FhirContext ctx = FhirContext.forDstu3();
        String baseSite= "http://fhirtest.uhn.ca/baseDstu3/";
        IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3");
        System.out.println("Connected to server");
Bundle bundle = client.search().forResource(DiagnosticReport.class).where(DiagnosticReport.IDENTIFIER.exactly().identifier(id)).returnBundle(Bundle.class).execute();

        DiagnosticReport diag =client.read().resource(DiagnosticReport.class).withId(bundle.getEntry().get(0).getResource());
        String finalBundle=ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(diag);
        System.out.println(finalBundle);
        Observation obv = client.read().resource(Observation.class).withUrl(baseSite+diag.getResult().get(0).getReference()).execute();
        Sequence seq = client.read().resource(Sequence.class).withUrl(baseSite+obv.getRelated().get(0).getTarget()).execute();

diag是目前导致问题的原因。因为我有一个客户端通过生成的ID访问他们的报告(因此是包搜索命令),但是要访问diagnosticReport引用的所有其他资源,我找不到一种方法将资源从包中分离出来,或者直接从包中抓取。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2016-07-26 05:35:43

如果您只想从捆绑包中获取DiagnosticReport资源,您应该能够执行以下操作:

代码语言:javascript
复制
DiagnosticReport dr = (DiagnosticReport) bundle.getEntry().get(0).getResource();

如果需要,还可以使用includes在对服务器的单个调用中返回其他链接的资源:

代码语言:javascript
复制
Bundle bundle = client.search().forResource(DiagnosticReport.class)
  .where(new StringClientParam("_id").matches().value("117376"))
  .include(new Include("DiagnosticReport:patient"))
  .include(new Include("DiagnosticReport:result"))
  .returnBundle(Bundle.class)
  .execute();
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38577397

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档