use of org.hl7.fhir.dstu3.model.CommunicationRequest in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCommunicationRequest.
protected void composeCommunicationRequest(Complex parent, String parentType, String name, CommunicationRequest element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "CommunicationRequest", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "CommunicationRequest", "identifier", element.getIdentifier().get(i), i);
for (int i = 0; i < element.getBasedOn().size(); i++) composeReference(t, "CommunicationRequest", "basedOn", element.getBasedOn().get(i), i);
for (int i = 0; i < element.getReplaces().size(); i++) composeReference(t, "CommunicationRequest", "replaces", element.getReplaces().get(i), i);
if (element.hasGroupIdentifier())
composeIdentifier(t, "CommunicationRequest", "groupIdentifier", element.getGroupIdentifier(), -1);
if (element.hasStatusElement())
composeEnum(t, "CommunicationRequest", "status", element.getStatusElement(), -1);
if (element.hasStatusReason())
composeCodeableConcept(t, "CommunicationRequest", "statusReason", element.getStatusReason(), -1);
for (int i = 0; i < element.getCategory().size(); i++) composeCodeableConcept(t, "CommunicationRequest", "category", element.getCategory().get(i), i);
if (element.hasPriorityElement())
composeEnum(t, "CommunicationRequest", "priority", element.getPriorityElement(), -1);
if (element.hasDoNotPerformElement())
composeBoolean(t, "CommunicationRequest", "doNotPerform", element.getDoNotPerformElement(), -1);
for (int i = 0; i < element.getMedium().size(); i++) composeCodeableConcept(t, "CommunicationRequest", "medium", element.getMedium().get(i), i);
if (element.hasSubject())
composeReference(t, "CommunicationRequest", "subject", element.getSubject(), -1);
for (int i = 0; i < element.getAbout().size(); i++) composeReference(t, "CommunicationRequest", "about", element.getAbout().get(i), i);
if (element.hasEncounter())
composeReference(t, "CommunicationRequest", "encounter", element.getEncounter(), -1);
for (int i = 0; i < element.getPayload().size(); i++) composeCommunicationRequestCommunicationRequestPayloadComponent(t, "CommunicationRequest", "payload", element.getPayload().get(i), i);
if (element.hasOccurrence())
composeType(t, "CommunicationRequest", "occurrence", element.getOccurrence(), -1);
if (element.hasAuthoredOnElement())
composeDateTime(t, "CommunicationRequest", "authoredOn", element.getAuthoredOnElement(), -1);
if (element.hasRequester())
composeReference(t, "CommunicationRequest", "requester", element.getRequester(), -1);
for (int i = 0; i < element.getRecipient().size(); i++) composeReference(t, "CommunicationRequest", "recipient", element.getRecipient().get(i), i);
if (element.hasSender())
composeReference(t, "CommunicationRequest", "sender", element.getSender(), -1);
for (int i = 0; i < element.getReasonCode().size(); i++) composeCodeableConcept(t, "CommunicationRequest", "reasonCode", element.getReasonCode().get(i), i);
for (int i = 0; i < element.getReasonReference().size(); i++) composeReference(t, "CommunicationRequest", "reasonReference", element.getReasonReference().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "CommunicationRequest", "note", element.getNote().get(i), i);
}
use of org.hl7.fhir.dstu3.model.CommunicationRequest in project org.hl7.fhir.core by hapifhir.
the class TurtleTests method test_communicationrequest_example.
@Test
public void test_communicationrequest_example() throws FileNotFoundException, IOException, Exception {
System.out.println("communicationrequest-example.ttl");
new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\communicationrequest-example.ttl"));
}
use of org.hl7.fhir.dstu3.model.CommunicationRequest in project cqf-ruler by DBCG.
the class ActivityDefinitionApplyProvider method resolveCommunicationRequest.
private CommunicationRequest resolveCommunicationRequest(ActivityDefinition activityDefinition, String patientId) {
CommunicationRequest communicationRequest = new CommunicationRequest();
communicationRequest.setStatus(CommunicationRequest.CommunicationRequestStatus.UNKNOWN);
communicationRequest.setSubject(new Reference(patientId));
// Unsure if this is correct - this is the way Motive is doing it...
if (activityDefinition.hasCode()) {
if (activityDefinition.getCode().hasText()) {
communicationRequest.addPayload().setContent(new StringType(activityDefinition.getCode().getText()));
}
}
if (activityDefinition.hasRelatedArtifact()) {
for (RelatedArtifact artifact : activityDefinition.getRelatedArtifact()) {
if (artifact.hasUrl()) {
Attachment attachment = new Attachment().setUrl(artifact.getUrl());
if (artifact.hasDisplay()) {
attachment.setTitle(artifact.getDisplay());
}
CommunicationRequest.CommunicationRequestPayloadComponent payload = new CommunicationRequest.CommunicationRequestPayloadComponent();
payload.setContent(artifact.hasDisplay() ? attachment.setTitle(artifact.getDisplay()) : attachment);
communicationRequest.setPayload(Collections.singletonList(payload));
}
// TODO - other relatedArtifact types
}
}
return communicationRequest;
}
use of org.hl7.fhir.dstu3.model.CommunicationRequest in project cqf-ruler by DBCG.
the class ActivityDefinitionApplyProvider method resolveActivityDefinition.
// For library use
public Resource resolveActivityDefinition(ActivityDefinition activityDefinition, String patientId, String practitionerId, String organizationId, RequestDetails theRequest) throws FHIRException {
Resource result = newResource(activityDefinition.getKind().toCode());
switch(result.fhirType()) {
case "ProcedureRequest":
result = resolveProcedureRequest(activityDefinition, patientId, practitionerId, organizationId);
break;
case "MedicationRequest":
result = resolveMedicationRequest(activityDefinition, patientId);
break;
case "SupplyRequest":
result = resolveSupplyRequest(activityDefinition, practitionerId, organizationId);
break;
case "Procedure":
result = resolveProcedure(activityDefinition, patientId);
break;
case "DiagnosticReport":
result = resolveDiagnosticReport(activityDefinition, patientId);
break;
case "Communication":
result = resolveCommunication(activityDefinition, patientId);
break;
case "CommunicationRequest":
result = resolveCommunicationRequest(activityDefinition, patientId);
break;
}
for (ActivityDefinition.ActivityDefinitionDynamicValueComponent dynamicValue : activityDefinition.getDynamicValue()) {
if (dynamicValue.getExpression() != null) {
Boolean aliasedExpression = null;
if (dynamicValue.hasLanguage()) {
String language = dynamicValue.getLanguage();
if (language.equals("text/cql.identifier") || language.equals("text/cql-identifier") || language.equals("text/cql.name") || language.equals("text/cql-name")) {
aliasedExpression = true;
} else {
aliasedExpression = false;
}
} else {
aliasedExpression = false;
}
/*
* TODO: Passing the activityDefinition as context here because that's what will
* have the libraries, but perhaps the "context" here should be the result
* resource?
*/
Object value = expressionEvaluation.evaluateInContext(activityDefinition, dynamicValue.getExpression(), aliasedExpression, patientId, theRequest);
// TODO need to verify type... yay
if (value instanceof Boolean) {
value = new BooleanType((Boolean) value);
}
this.modelResolver.setValue(result, dynamicValue.getPath(), value);
}
}
return result;
}
use of org.hl7.fhir.dstu3.model.CommunicationRequest in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCommunicationRequestCommunicationRequestPayloadComponent.
protected void composeCommunicationRequestCommunicationRequestPayloadComponent(Complex parent, String parentType, String name, CommunicationRequest.CommunicationRequestPayloadComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "payload", name, element, index);
if (element.hasContent())
composeType(t, "CommunicationRequest", "content", element.getContent(), -1);
}
Aggregations