use of org.opencds.cqf.ruler.cr.r4.builder.ExtensionBuilder in project cqf-ruler by DBCG.
the class Session method resolveCdsHooksPlanDefinition.
// For library use
public CarePlan resolveCdsHooksPlanDefinition(RequestDetails theRequest, Context context, PlanDefinition planDefinition, String patientId) {
CarePlanBuilder carePlanBuilder = new CarePlanBuilder();
RequestGroupBuilder requestGroupBuilder = new RequestGroupBuilder().buildStatus().buildIntent();
// links
if (planDefinition.hasRelatedArtifact()) {
List<Extension> extensions = new ArrayList<>();
for (RelatedArtifact relatedArtifact : planDefinition.getRelatedArtifact()) {
AttachmentBuilder attachmentBuilder = new AttachmentBuilder();
ExtensionBuilder extensionBuilder = new ExtensionBuilder();
if (relatedArtifact.hasDisplay()) {
// label
attachmentBuilder.buildTitle(relatedArtifact.getDisplay());
}
if (relatedArtifact.hasUrl()) {
// url
attachmentBuilder.buildUrl(relatedArtifact.getUrl());
}
if (relatedArtifact.hasExtension()) {
// type
attachmentBuilder.buildExtension(relatedArtifact.getExtension());
}
extensionBuilder.buildUrl("http://example.org");
extensionBuilder.buildValue(attachmentBuilder.build());
extensions.add(extensionBuilder.build());
}
requestGroupBuilder.buildExtension(extensions);
}
resolveActions(theRequest, planDefinition, planDefinition.getAction(), context, patientId, requestGroupBuilder, new ArrayList<>());
CarePlanActivityBuilder carePlanActivityBuilder = new CarePlanActivityBuilder();
carePlanActivityBuilder.buildReferenceTarget(requestGroupBuilder.build());
carePlanBuilder.buildActivity(carePlanActivityBuilder.build());
return carePlanBuilder.build();
}
use of org.opencds.cqf.ruler.cr.r4.builder.ExtensionBuilder in project cqf-ruler by DBCG.
the class Session method resolveCdsHooksPlanDefinition.
// For library use
public CarePlan resolveCdsHooksPlanDefinition(Context context, PlanDefinition planDefinition, String patientId, RequestDetails theRequest) {
CarePlanBuilder carePlanBuilder = new CarePlanBuilder();
RequestGroupBuilder requestGroupBuilder = new RequestGroupBuilder().buildStatus().buildIntent();
// links
if (planDefinition.hasRelatedArtifact()) {
List<Extension> extensions = new ArrayList<>();
for (RelatedArtifact relatedArtifact : planDefinition.getRelatedArtifact()) {
AttachmentBuilder attachmentBuilder = new AttachmentBuilder();
ExtensionBuilder extensionBuilder = new ExtensionBuilder();
if (relatedArtifact.hasDisplay()) {
// label
attachmentBuilder.buildTitle(relatedArtifact.getDisplay());
}
if (relatedArtifact.hasUrl()) {
// url
attachmentBuilder.buildUrl(relatedArtifact.getUrl());
}
if (relatedArtifact.hasExtension()) {
// type
attachmentBuilder.buildExtension(relatedArtifact.getExtension());
}
extensionBuilder.buildUrl("http://example.org");
extensionBuilder.buildValue(attachmentBuilder.build());
extensions.add(extensionBuilder.build());
}
requestGroupBuilder.buildExtension(extensions);
}
resolveActions(planDefinition.getAction(), context, patientId, requestGroupBuilder, new ArrayList<>(), theRequest);
CarePlanActivityBuilder carePlanActivityBuilder = new CarePlanActivityBuilder();
carePlanActivityBuilder.buildReferenceTarget(requestGroupBuilder.build());
carePlanBuilder.buildActivity(carePlanActivityBuilder.build());
return carePlanBuilder.build();
}
Aggregations