Java Code Examples for org.hl7.fhir.dstu3.model.Parameters#addParameter()
The following examples show how to use
org.hl7.fhir.dstu3.model.Parameters#addParameter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 6 votes |
private void addEvaluatedResourcesToParameters(Bundle contained, Parameters parameters) { Map<String, Resource> resourceMap = new HashMap<>(); if (contained.hasEntry()) { for (Bundle.BundleEntryComponent entry : contained.getEntry()) { if (entry.hasResource() && !(entry.getResource() instanceof ListResource)) { if (!resourceMap.containsKey(entry.getResource().getIdElement().getValue())) { parameters.addParameter(new Parameters.ParametersParameterComponent().setName("resource") .setResource(entry.getResource())); resourceMap.put(entry.getResource().getIdElement().getValue(), entry.getResource()); resolveReferences(entry.getResource(), parameters, resourceMap); } } } } }
Example 2
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 6 votes |
private void resolveReferences(Resource resource, Parameters parameters, Map<String, Resource> resourceMap) { List<IBase> values; for (BaseRuntimeChildDefinition child : this.measureResourceProvider.getContext().getResourceDefinition(resource).getChildren()) { values = child.getAccessor().getValues(resource); if (values == null || values.isEmpty()) { continue; } else if (values.get(0) instanceof Reference && ((Reference) values.get(0)).getReferenceElement().hasResourceType() && ((Reference) values.get(0)).getReferenceElement().hasIdPart()) { Resource fetchedResource = (Resource) registry .getResourceDao(((Reference) values.get(0)).getReferenceElement().getResourceType()) .read(new IdType(((Reference) values.get(0)).getReferenceElement().getIdPart())); if (!resourceMap.containsKey(fetchedResource.getIdElement().getValue())) { parameters.addParameter(new Parameters.ParametersParameterComponent().setName("resource") .setResource(fetchedResource)); resourceMap.put(fetchedResource.getIdElement().getValue(), fetchedResource); } } } }
Example 3
Source File: MeasureOperationsProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Operation(name = "$collect-data", idempotent = true, type = Measure.class) public Parameters collectData(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart, @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "patient") String patientRef, @OptionalParam(name = "practitioner") String practitionerRef, @OptionalParam(name = "lastReceivedOn") String lastReceivedOn) throws FHIRException { // TODO: Spec says that the periods are not required, but I am not sure what to // do when they aren't supplied so I made them required MeasureReport report = evaluateMeasure(theId, periodStart, periodEnd, null, null, patientRef, null, practitionerRef, lastReceivedOn, null, null, null); report.setGroup(null); Parameters parameters = new Parameters(); parameters.addParameter( new Parameters.ParametersParameterComponent().setName("measurereport").setResource(report)); if (report.hasContained()) { for (Resource contained : report.getContained()) { if (contained instanceof Bundle) { addEvaluatedResourcesToParameters((Bundle) contained, parameters); } } } // TODO: need a way to resolve referenced resources within the evaluated // resources // Should be able to use _include search with * wildcard, but HAPI doesn't // support that return parameters; }