org.hl7.fhir.dstu3.model.Bundle.getEntry()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.hl7.fhir.dstu3.model.Bundle.getEntry()方法的一些代码示例,展示了Bundle.getEntry()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getEntry()方法的具体详情如下:
包路径:org.hl7.fhir.dstu3.model.Bundle
类名称:Bundle
方法名:getEntry

Bundle.getEntry介绍

暂无

代码示例

代码示例来源:origin: jamesagnew/hapi-fhir

@Override
public List<Bundle.BundleEntryComponent> getEntries(Bundle theRequest) {
  return theRequest.getEntry();
}

代码示例来源:origin: jamesagnew/hapi-fhir

@Transaction
public Bundle transaction(@TransactionParam Bundle theInput) {
  for (BundleEntryComponent nextEntry : theInput.getEntry()) {
   // Process entry
  }

  Bundle retVal = new Bundle();
  // Populate return bundle
  return retVal;
}
//END SNIPPET: transaction

代码示例来源:origin: jamesagnew/hapi-fhir

private StructureDefinition getProfileForType(String type) {
 if (logical != null)
  for (BundleEntryComponent be : logical.getEntry()) {
   if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
    StructureDefinition sd = (StructureDefinition) be.getResource();
    if (sd.getId().equals(type))
     return sd;
   }
  }
 long t = System.nanoTime();
 try {
  return context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type);
 } finally {
  sdTime = sdTime + (System.nanoTime() - t);
 }
}

代码示例来源:origin: jamesagnew/hapi-fhir

private void filterBundle(org.hl7.fhir.dstu3.model.Bundle theBundle) {
  for (Iterator<BundleEntryComponent> iter = theBundle.getEntry().iterator(); iter.hasNext(); ) {
    IBaseResource next = iter.next().getResource();
    for (IIdType nextExclude : myExcludes) {
      if (nextExclude.hasResourceType() && nextExclude.toUnqualifiedVersionless().getValue().equals(next.getIdElement().toUnqualifiedVersionless().getValue())) {
        iter.remove();
        continue;
      } else if (nextExclude.getIdPart().equals(next.getIdElement().getIdPart())) {
        iter.remove();
        continue;
      }
    }
  }
}

代码示例来源:origin: jamesagnew/hapi-fhir

private void loadStructureDefinitions(FhirContext theContext, Map<String, StructureDefinition> theCodeSystems, String theClasspath) {
  ourLog.info("Loading structure definitions from classpath: {}", theClasspath);
  InputStream valuesetText = DefaultProfileValidationSupport.class.getResourceAsStream(theClasspath);
  if (valuesetText != null) {
    InputStreamReader reader = new InputStreamReader(valuesetText, Charsets.UTF_8);
    Bundle bundle = theContext.newXmlParser().parseResource(Bundle.class, reader);
    for (BundleEntryComponent next : bundle.getEntry()) {
      if (next.getResource() instanceof StructureDefinition) {
        StructureDefinition nextSd = (StructureDefinition) next.getResource();
        nextSd.getText().setDivAsString("");
        String system = nextSd.getUrl();
        if (isNotBlank(system)) {
          theCodeSystems.put(system, nextSd);
        }
      }
    }
  } else {
    ourLog.warn("Unable to load resource: {}", theClasspath);
  }
}

代码示例来源:origin: jamesagnew/hapi-fhir

private ElementDefinition resolveType(String type)  {
 if (logical != null)
  for (BundleEntryComponent be : logical.getEntry()) {
   if (be.hasResource() && be.getResource() instanceof StructureDefinition) {
    StructureDefinition sd = (StructureDefinition) be.getResource();
    if (sd.getId().equals(type))
     return sd.getSnapshot().getElement().get(0);
   }
  }
 String url = "http://hl7.org/fhir/StructureDefinition/" + type;
 long t = System.nanoTime();
 StructureDefinition sd = context.fetchResource(StructureDefinition.class, url);
 sdTime = sdTime + (System.nanoTime() - t);
 if (sd == null || !sd.hasSnapshot())
  return null;
 else
  return sd.getSnapshot().getElement().get(0);
}

代码示例来源:origin: jamesagnew/hapi-fhir

for (BundleEntryComponent next : bundle.getEntry()) {
  if (next.getResource() instanceof CodeSystem) {
    CodeSystem nextValueSet = (CodeSystem) next.getResource();

代码示例来源:origin: jamesagnew/hapi-fhir

total = bundle.getEntry().size();
count = 1;
Collections.sort(bundle.getEntry(), new Comparator<BundleEntryComponent>() {
  @Override
  public int compare(BundleEntryComponent theO1, BundleEntryComponent theO2) {
for (BundleEntryComponent i : bundle.getEntry()) {
  org.hl7.fhir.dstu3.model.Resource next = i.getResource();
  next.setId(next.getIdElement().toUnqualifiedVersionless());

代码示例来源:origin: jamesagnew/hapi-fhir

Set<String> fullIds = new HashSet<String>();
for (Iterator<BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
  BundleEntryComponent next = iterator.next();
for (Iterator<BundleEntryComponent> iterator = bundle.getEntry().iterator(); iterator.hasNext(); ) {
  BundleEntryComponent next = iterator.next();
  if (next.getResource().getIdElement().getIdPart() != null) {
for (BundleEntryComponent next : bundle.getEntry()) {
  List<ResourceReferenceInfo> refs = ctx.newTerser().getAllResourceReferences(next.getResource());
  for (ResourceReferenceInfo nextRef : refs) {
System.gc();
ourLog.info("Final bundle: {} entries", bundle.getEntry().size());

代码示例来源:origin: jamesagnew/hapi-fhir

filterBundle(bundle);
total = bundle.getEntry().size();
count = 1;
for (BundleEntryComponent i : bundle.getEntry()) {
  org.hl7.fhir.dstu3.model.Resource next = i.getResource();
  next.setId(next.getIdElement().toUnqualifiedVersionless());
filterBundle(bundle);
total = bundle.getEntry().size();
count = 1;
for (BundleEntryComponent i : bundle.getEntry()) {
  org.hl7.fhir.dstu3.model.Resource next = i.getResource();
  next.setId(next.getIdElement().toUnqualifiedVersionless());
total = bundle.getEntry().size();
count = 1;
for (BundleEntryComponent i : bundle.getEntry()) {
  org.hl7.fhir.dstu3.model.Resource next = i.getResource();
  if (next.getIdElement().isIdPartValidLong()) {

代码示例来源:origin: jamesagnew/hapi-fhir

private static void copy(FhirContext theCtx, IGenericClient theTarget, String theResType, List<IBaseResource> theQueued, Set<String> theSent, Bundle theReceived) {
  for (Bundle.BundleEntryComponent nextEntry : theReceived.getEntry()) {
    Resource nextResource = nextEntry.getResource();
    nextResource.setId(theResType + "/" + "CR-" + nextResource.getIdElement().getIdPart());
    boolean haveUnsentReference = false;
    for (ResourceReferenceInfo nextRefInfo : theCtx.newTerser().getAllResourceReferences(nextResource)) {
      IIdType nextRef = nextRefInfo.getResourceReference().getReferenceElement();
      if (nextRef.hasIdPart()) {
        String newRef = nextRef.getResourceType() + "/" + "CR-" + nextRef.getIdPart();
        ourLog.info("Changing reference {} to {}", nextRef.getValue(), newRef);
        nextRefInfo.getResourceReference().setReference(newRef);
        if (!theSent.contains(newRef)) {
          haveUnsentReference = true;
        }
      }
    }
    if (haveUnsentReference) {
      ourLog.info("Queueing {} for delivery after", nextResource.getId());
      theQueued.add(nextResource);
      continue;
    }
    IIdType newId = theTarget
      .update()
      .resource(nextResource)
      .execute()
      .getId();
    ourLog.info("Copied resource {} and got ID {}", nextResource.getId(), newId);
    theSent.add(nextResource.getIdElement().toUnqualifiedVersionless().getValue());
  }
}

代码示例来源:origin: jamesagnew/hapi-fhir

protected String addReference(DomainResource r, String title, String id) throws Exception {
  if (r.getText() == null)
    r.setText(new Narrative());
  if (r.getText().getDiv() == null) {
    r.getText().setStatus(NarrativeStatus.GENERATED);
    new NarrativeGenerator("", "", context).generate(r);
  }
  r.setMeta(new Meta().setLastUpdatedElement(InstantType.now()));
  r.setId(id);
  feed.getEntry().add(new BundleEntryComponent().setResource(r));
  return id;
}

代码示例来源:origin: jamesagnew/hapi-fhir

MyPatient pat0 = (MyPatient) bundle.getEntry().get(0).getResource();
MyPatient historyPatient0 = (MyPatient) bundle.getEntry().get(0).getResource();

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-structures-dstu3

/**
 * @return The first repetition of repeating field {@link #entry}, creating it if it does not already exist
 */
public BundleEntryComponent getEntryFirstRep() { 
 if (getEntry().isEmpty()) {
  addEntry();
 }
 return getEntry().get(0);
}

代码示例来源:origin: jamesagnew/hapi-fhir

public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException {
 if (src == null || src.isEmpty())
  return null;
 org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle();
 copyResource(src, tgt);
 tgt.setType(convertBundleType(src.getType()));
 if (src.hasTotal())
  tgt.setTotal(src.getTotal());
 for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink())
  tgt.addLink(convertBundleLinkComponent(t));
 for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry())
  tgt.addEntry(convertBundleEntryComponent(t));
 tgt.setSignature(convertSignature(src.getSignature()));
 return tgt;
}

代码示例来源:origin: org.openehealth.ipf.commons/ipf-commons-ihe-fhir-stu3-core

private Set<NamingSystem> setOfNamingSystems(Bundle bundle) {
  return bundle.getEntry().stream()
      .map(bec -> (NamingSystem) bec.getResource())
      .collect(Collectors.toSet());
}

代码示例来源:origin: jamesagnew/hapi-fhir

public org.hl7.fhir.instance.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException {
 if (src == null || src.isEmpty())
  return null;
 org.hl7.fhir.instance.model.Bundle tgt = new org.hl7.fhir.instance.model.Bundle();
 copyResource(src, tgt);
 tgt.setType(convertBundleType(src.getType()));
 if (src.hasTotal())
  tgt.setTotal(src.getTotal());
 for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink())
  tgt.addLink(convertBundleLinkComponent(t));
 for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry())
  tgt.addEntry(convertBundleEntryComponent(t));
 if (src.hasSignature())
  tgt.setSignature(convertSignature(src.getSignature()));
 return tgt;
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-converter

protected String addReference(DomainResource r, String title, String id) throws Exception {
  if (r.getText() == null)
    r.setText(new Narrative());
  if (r.getText().getDiv() == null) {
    r.getText().setStatus(NarrativeStatus.GENERATED);
    new NarrativeGenerator("", "", context).generate(r);
  }
  r.setMeta(new Meta().setLastUpdatedElement(InstantType.now()));
  r.setId(id);
  feed.getEntry().add(new BundleEntryComponent().setResource(r));
  return id;
}

代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-ihe-fhir-stu3-mhd

@Test
public void testSendIti66WithPatientReference() {
  Bundle result = sendManually(manifestPatientReferenceParameter());
  assertEquals(Bundle.BundleType.SEARCHSET, result.getType());
  assertEquals(ResourceType.Bundle, result.getResourceType());
  assertEquals(1, result.getTotal());
  DocumentManifest p = (DocumentManifest) result.getEntry().get(0).getResource();
  assertEquals("9bc72458-49b0-11e6-8a1c-3c1620524153", p.getIdElement().getIdPart());
}

代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-ihe-fhir-stu3-mhd

@Test
public void testSendIti67WithPatientReference() {
  Bundle result = sendManually(referencePatientReferenceParameter());
  assertEquals(Bundle.BundleType.SEARCHSET, result.getType());
  assertEquals(ResourceType.Bundle, result.getResourceType());
  assertEquals(1, result.getTotal());
  DocumentReference p = (DocumentReference) result.getEntry().get(0).getResource();
  assertEquals("63ab1c29-4225-11e6-9b33-0050569b0094", p.getIdElement().getIdPart());
}

相关文章