本文整理汇总了Java中org.hl7.fhir.dstu3.model.Bundle.getEntry方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getEntry方法的具体用法?Java Bundle.getEntry怎么用?Java Bundle.getEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hl7.fhir.dstu3.model.Bundle
的用法示例。
在下文中一共展示了Bundle.getEntry方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copy
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
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());
}
}
示例2: transaction
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
@Transaction
public Bundle transaction(@TransactionParam Bundle theInput) {
for (BundleEntryComponent nextEntry : theInput.getEntry()) {
// Process entry
}
Bundle retVal = new Bundle();
// Populate return bundle
return retVal;
}
示例3: subscriptionsHome
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@RequestMapping(value = { "/subscriptions" })
public String subscriptionsHome(final HttpServletRequest theServletRequest, HomeRequest theRequest, final ModelMap theModel) {
addCommonParams(theServletRequest, theRequest, theModel);
theModel.put("notHome", true);
theModel.put("extraBreadcrumb", "Subscriptions");
ourLog.info(logPrefix(theModel) + "Displayed subscriptions playground page");
CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(theServletRequest, getContext(theRequest), myConfig, interceptor);
Bundle resp = (Bundle) client
.search()
.forResource(Subscription.class)
// .where(Subscription.TYPE.exactly().code(SubscriptionChannelTypeEnum.WEBSOCKET.getCode()))
// .and(Subscription.STATUS.exactly().code(SubscriptionStatusEnum.ACTIVE.getCode()))
.sort().descending(Subscription.TYPE)
.sort().ascending(Subscription.STATUS)
.returnBundle(Bundle.class)
.execute();
List<Subscription> subscriptions = new ArrayList<Subscription>();
for (Bundle.BundleEntryComponent next : resp.getEntry()) {
if (next.getResource() instanceof Subscription) {
subscriptions.add((Subscription) next.getResource());
}
}
theModel.put("subscriptions", subscriptions);
return "subscriptions";
}
示例4: toNameList
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
protected List<String> toNameList(Bundle resp) {
List<String> names = new ArrayList<String>();
for (BundleEntryComponent next : resp.getEntry()) {
Patient nextPt = (Patient) next.getResource();
String nextStr = nextPt.getName().size() > 0 ? nextPt.getName().get(0).getGivenAsSingleString() + " " + nextPt.getName().get(0).getFamily() : "";
if (isNotBlank(nextStr)) {
names.add(nextStr);
}
}
return names;
}
示例5: toIds
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
private List<String> toIds(Bundle theRespBundle) {
ArrayList<String> retVal = new ArrayList<String>();
for (BundleEntryComponent next : theRespBundle.getEntry()) {
retVal.add(next.getResource().getIdElement().toUnqualifiedVersionless().getValue());
}
return retVal;
}
示例6: careplan
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
/**
* Map the given CarePlan to a FHIR CarePlan resource, and add it to the given Bundle.
*
* @param personEntry
* The Entry for the Person
* @param bundle
* Bundle to add the CarePlan to
* @param encounterEntry
* Current Encounter entry
* @param carePlan
* The CarePlan to map to FHIR and add to the bundle
* @return The added Entry
*/
private static BundleEntryComponent careplan(BundleEntryComponent personEntry, Bundle bundle,
BundleEntryComponent encounterEntry, CarePlan carePlan) {
org.hl7.fhir.dstu3.model.CarePlan careplanResource = new org.hl7.fhir.dstu3.model.CarePlan();
careplanResource.setIntent(CarePlanIntent.ORDER);
careplanResource.setSubject(new Reference(personEntry.getFullUrl()));
careplanResource.setContext(new Reference(encounterEntry.getFullUrl()));
Code code = carePlan.codes.get(0);
careplanResource.addCategory(mapCodeToCodeableConcept(code, SNOMED_URI));
CarePlanActivityStatus activityStatus;
GoalStatus goalStatus;
Period period = new Period().setStart(new Date(carePlan.start));
careplanResource.setPeriod(period);
if (carePlan.stop != 0L) {
period.setEnd(new Date(carePlan.stop));
careplanResource.setStatus(CarePlanStatus.COMPLETED);
activityStatus = CarePlanActivityStatus.COMPLETED;
goalStatus = GoalStatus.ACHIEVED;
} else {
careplanResource.setStatus(CarePlanStatus.ACTIVE);
activityStatus = CarePlanActivityStatus.INPROGRESS;
goalStatus = GoalStatus.INPROGRESS;
}
if (!carePlan.activities.isEmpty()) {
for (Code activity : carePlan.activities) {
CarePlanActivityComponent activityComponent = new CarePlanActivityComponent();
CarePlanActivityDetailComponent activityDetailComponent =
new CarePlanActivityDetailComponent();
activityDetailComponent.setStatus(activityStatus);
activityDetailComponent.setCode(mapCodeToCodeableConcept(activity, SNOMED_URI));
activityComponent.setDetail(activityDetailComponent);
careplanResource.addActivity(activityComponent);
}
}
if (!carePlan.reasons.isEmpty()) {
// Only one element in list
Code reason = carePlan.reasons.get(0);
for (BundleEntryComponent entry : bundle.getEntry()) {
if (entry.getResource().fhirType().equals("Condition")) {
Condition condition = (Condition) entry.getResource();
// Only one element in list
Coding coding = condition.getCode().getCoding().get(0);
if (reason.code.equals(coding.getCode())) {
careplanResource.addAddresses().setReference(entry.getFullUrl());
}
}
}
}
for (JsonObject goal : carePlan.goals) {
BundleEntryComponent goalEntry = caregoal(bundle, goalStatus, goal);
careplanResource.addGoal().setReference(goalEntry.getFullUrl());
}
return newEntry(bundle, careplanResource);
}
示例7: testFHIRExport
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
@Test
public void testFHIRExport() throws Exception {
Config.set("exporter.baseDirectory", tempFolder.newFolder().toString());
FhirContext ctx = FhirContext.forDstu3();
IParser parser = ctx.newJsonParser().setPrettyPrint(true);
FhirValidator validator = ctx.newValidator();
validator.setValidateAgainstStandardSchema(true);
validator.setValidateAgainstStandardSchematron(true);
List<String> validationErrors = new ArrayList<String>();
int numberOfPeople = 10;
Generator generator = new Generator(numberOfPeople);
for (int i = 0; i < numberOfPeople; i++) {
int x = validationErrors.size();
TestHelper.exportOff();
Person person = generator.generatePerson(i);
Config.set("exporter.fhir.export", "true");
String fhirJson = FhirStu3.convertToFHIR(person, System.currentTimeMillis());
IBaseResource resource = ctx.newJsonParser().parseResource(fhirJson);
ValidationResult result = validator.validateWithResult(resource);
if (result.isSuccessful() == false) {
// If the validation failed, let's crack open the Bundle and validate
// each individual entry.resource to get context-sensitive error
// messages...
Bundle bundle = parser.parseResource(Bundle.class, fhirJson);
for (BundleEntryComponent entry : bundle.getEntry()) {
ValidationResult eresult = validator.validateWithResult(entry.getResource());
if (eresult.isSuccessful() == false) {
for (SingleValidationMessage emessage : eresult.getMessages()) {
if (emessage.getSeverity() == ResultSeverityEnum.ERROR
|| emessage.getSeverity() == ResultSeverityEnum.FATAL) {
boolean valid = false;
/*
* There are a few bugs in the FHIR schematron files that are distributed with HAPI
* 3.0.0 (these are fixed in the latest `master` branch), specifically with XPath
* expressions.
*
* Two of these bugs are related to the FHIR Invariant rules obs-7 and con-4, which
* have XPath expressions that incorrectly raise errors on validation.
*/
if (emessage.getMessage().contains("Message=obs-7")) {
/*
* The obs-7 invariant basically says that Observations should have values, unless
* they are made of components. This test replaces an invalid XPath expression
* that was causing correct instances to fail validation.
*/
valid = validateObs7((Observation) entry.getResource());
} else if (emessage.getMessage().contains("Message=con-4")) {
/*
* The con-4 invariant says "If condition is abated, then clinicalStatus must be
* either inactive, resolved, or remission" which is very clear and sensical.
* However, the XPath expression does not evaluate correctly for valid instances,
* so we must manually validate.
*/
valid = validateCon4((Condition) entry.getResource());
}
if (!valid) {
System.out.println(parser.encodeResourceToString(entry.getResource()));
System.out.println("ERROR: " + emessage.getMessage());
validationErrors.add(emessage.getMessage());
}
}
}
}
}
}
int y = validationErrors.size();
if (x != y) {
Exporter.export(person, System.currentTimeMillis());
}
}
assertEquals(0, validationErrors.size());
}
示例8: call
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
@Override
public Iterator<T> call(Bundle bundle) throws Exception {
List<T> items = new ArrayList<>();
for (Bundle.BundleEntryComponent component : bundle.getEntry()) {
Resource resource = component.getResource();
if (resource != null
&& resourceName.equals(resource.getResourceType().name())) {
items.add((T) resource);
}
}
return items.iterator();
}
示例9: uploadDefinitionsCareConnectDstu2
import org.hl7.fhir.dstu3.model.Bundle; //导入方法依赖的package包/类
private void uploadDefinitionsCareConnectDstu2(String targetServer, FhirContext ctx,String careConnectServer) throws CommandFailureException {
IGenericClient client = newClient(ctx, targetServer);
ourLog.info("Uploading definitions to server: " + targetServer);
// IGenericClient clientCareConnect = newClient(ctx, careConnectServer);
ourLog.info("From server: " + careConnectServer);
long start = System.currentTimeMillis();
String vsContents;
Bundle bundle = null;
try {
URL url = new URL(careConnectServer+"/ValueSet?_format=xml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Accept","application/xml");
con.setRequestMethod("GET");
con.setDoOutput(true);
con.setDoInput(true);
con.setUseCaches(false);
con.setConnectTimeout(1000 * 5);
con.connect();
int responseCode = con.getResponseCode();
ourLog.info("Resonse Code "+ responseCode);
System.out.println("Resonse Code "+ responseCode);
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
bundle = ctx.newXmlParser().parseResource(Bundle.class,br);
} catch (Exception e) {
throw new CommandFailureException(e.toString());
}
int total = bundle.getEntry().size();
int count = 1;
for (Bundle.BundleEntryComponent i : bundle.getEntry()) {
ValueSet next = (ValueSet) i.getResource();
next.setId(next.getIdElement().toUnqualifiedVersionless());
// System.out.println("Uploading ValueSet "+ next.getUrl());
ourLog.info("Uploading ValueSet {}/{} : {}", new Object[]{count, total, next.getIdElement().getValue()});
try {
client.update().resource(next).execute();
}
catch (Exception ex) {
System.out.println("ValueSet "+ next.getUrl() + " ERROR " +ex.getMessage());
}
count++;
}
ourLog.info("Finished uploading ValueSets");
long delay = System.currentTimeMillis() - start;
ourLog.info("Finished uploading definitions to server (took {} ms)", delay);
}