我只是想知道是否有一种方法可以访问包中的资源。
I.E
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引用的所有其他资源,我找不到一种方法将资源从包中分离出来,或者直接从包中抓取。
谢谢
发布于 2016-07-26 05:35:43
如果您只想从捆绑包中获取DiagnosticReport资源,您应该能够执行以下操作:
DiagnosticReport dr = (DiagnosticReport) bundle.getEntry().get(0).getResource();如果需要,还可以使用includes在对服务器的单个调用中返回其他链接的资源:
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();https://stackoverflow.com/questions/38577397
复制相似问题