use of org.hl7.elm.r1.DateTime in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeNutritionOrder.
protected void composeNutritionOrder(Complex parent, String parentType, String name, NutritionOrder element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "NutritionOrder", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "NutritionOrder", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "NutritionOrder", "status", element.getStatusElement(), -1);
if (element.hasPatient())
composeReference(t, "NutritionOrder", "patient", element.getPatient(), -1);
if (element.hasEncounter())
composeReference(t, "NutritionOrder", "encounter", element.getEncounter(), -1);
if (element.hasDateTimeElement())
composeDateTime(t, "NutritionOrder", "dateTime", element.getDateTimeElement(), -1);
if (element.hasOrderer())
composeReference(t, "NutritionOrder", "orderer", element.getOrderer(), -1);
for (int i = 0; i < element.getAllergyIntolerance().size(); i++) composeReference(t, "NutritionOrder", "allergyIntolerance", element.getAllergyIntolerance().get(i), i);
for (int i = 0; i < element.getFoodPreferenceModifier().size(); i++) composeCodeableConcept(t, "NutritionOrder", "foodPreferenceModifier", element.getFoodPreferenceModifier().get(i), i);
for (int i = 0; i < element.getExcludeFoodModifier().size(); i++) composeCodeableConcept(t, "NutritionOrder", "excludeFoodModifier", element.getExcludeFoodModifier().get(i), i);
if (element.hasOralDiet())
composeNutritionOrderNutritionOrderOralDietComponent(t, "NutritionOrder", "oralDiet", element.getOralDiet(), -1);
for (int i = 0; i < element.getSupplement().size(); i++) composeNutritionOrderNutritionOrderSupplementComponent(t, "NutritionOrder", "supplement", element.getSupplement().get(i), i);
if (element.hasEnteralFormula())
composeNutritionOrderNutritionOrderEnteralFormulaComponent(t, "NutritionOrder", "enteralFormula", element.getEnteralFormula(), -1);
}
use of org.hl7.elm.r1.DateTime in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireBuilder method convertType.
@SuppressWarnings("unchecked")
private Type convertType(Base value, QuestionnaireItemType af, ValueSet vs, String path) throws FHIRException {
switch(af) {
// simple cases
case BOOLEAN:
if (value instanceof BooleanType)
return (Type) value;
case DECIMAL:
if (value instanceof DecimalType)
return (Type) value;
case INTEGER:
if (value instanceof IntegerType)
return (Type) value;
case DATE:
if (value instanceof DateType)
return (Type) value;
case DATETIME:
if (value instanceof DateTimeType)
return (Type) value;
case INSTANT:
if (value instanceof InstantType)
return (Type) value;
case TIME:
if (value instanceof TimeType)
return (Type) value;
case STRING:
if (value instanceof StringType)
return (Type) value;
else if (value instanceof UriType)
return new StringType(((UriType) value).asStringValue());
case TEXT:
if (value instanceof StringType)
return (Type) value;
case QUANTITY:
if (value instanceof Quantity)
return (Type) value;
// ? QuestionnaireItemTypeAttachment: ...?
case CHOICE:
case OPENCHOICE:
if (value instanceof Coding)
return (Type) value;
else if (value instanceof Enumeration) {
Coding cc = new Coding();
cc.setCode(((Enumeration<Enum<?>>) value).asStringValue());
cc.setSystem(getSystemForCode(vs, cc.getCode(), path));
return cc;
} else if (value instanceof StringType) {
Coding cc = new Coding();
cc.setCode(((StringType) value).asStringValue());
cc.setSystem(getSystemForCode(vs, cc.getCode(), path));
return cc;
}
case REFERENCE:
if (value instanceof Reference)
return (Type) value;
else if (value instanceof StringType) {
Reference r = new Reference();
r.setReference(((StringType) value).asStringValue());
}
}
throw new FHIRException("Unable to convert from '" + value.getClass().toString() + "' for Answer Format " + af.toCode() + ", path = " + path);
}
use of org.hl7.elm.r1.DateTime in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireBuilder method convertType.
@SuppressWarnings("unchecked")
private Type convertType(Base value, QuestionnaireItemType af, ValueSet vs, String path) throws FHIRException {
switch(af) {
// simple cases
case BOOLEAN:
if (value instanceof BooleanType)
return (Type) value;
case DECIMAL:
if (value instanceof DecimalType)
return (Type) value;
case INTEGER:
if (value instanceof IntegerType)
return (Type) value;
case DATE:
if (value instanceof DateType)
return (Type) value;
case DATETIME:
if (value instanceof DateTimeType)
return (Type) value;
case TIME:
if (value instanceof TimeType)
return (Type) value;
case STRING:
if (value instanceof StringType)
return (Type) value;
else if (value instanceof UriType)
return new StringType(((UriType) value).asStringValue());
case TEXT:
if (value instanceof StringType)
return (Type) value;
case QUANTITY:
if (value instanceof Quantity)
return (Type) value;
// ? QuestionnaireItemTypeAttachment: ...?
case CHOICE:
case OPENCHOICE:
if (value instanceof Coding)
return (Type) value;
else if (value instanceof Enumeration) {
Coding cc = new Coding();
cc.setCode(((Enumeration<Enum<?>>) value).asStringValue());
cc.setSystem(getSystemForCode(vs, cc.getCode(), path));
return cc;
} else if (value instanceof StringType) {
Coding cc = new Coding();
cc.setCode(((StringType) value).asStringValue());
cc.setSystem(getSystemForCode(vs, cc.getCode(), path));
return cc;
}
case REFERENCE:
if (value instanceof Reference)
return (Type) value;
else if (value instanceof StringType) {
Reference r = new Reference();
r.setReference(((StringType) value).asStringValue());
}
}
throw new FHIRException("Unable to convert from '" + value.getClass().toString() + "' for Answer Format " + af.toCode() + ", path = " + path);
}
use of org.hl7.elm.r1.DateTime in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeConsent.
protected void composeConsent(Complex parent, String parentType, String name, Consent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Consent", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Consent", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "Consent", "status", element.getStatusElement(), -1);
if (element.hasScope())
composeCodeableConcept(t, "Consent", "scope", element.getScope(), -1);
for (int i = 0; i < element.getCategory().size(); i++) composeCodeableConcept(t, "Consent", "category", element.getCategory().get(i), i);
if (element.hasPatient())
composeReference(t, "Consent", "patient", element.getPatient(), -1);
if (element.hasDateTimeElement())
composeDateTime(t, "Consent", "dateTime", element.getDateTimeElement(), -1);
for (int i = 0; i < element.getPerformer().size(); i++) composeReference(t, "Consent", "performer", element.getPerformer().get(i), i);
for (int i = 0; i < element.getOrganization().size(); i++) composeReference(t, "Consent", "organization", element.getOrganization().get(i), i);
if (element.hasSource())
composeType(t, "Consent", "source", element.getSource(), -1);
for (int i = 0; i < element.getPolicy().size(); i++) composeConsentConsentPolicyComponent(t, "Consent", "policy", element.getPolicy().get(i), i);
if (element.hasPolicyRule())
composeCodeableConcept(t, "Consent", "policyRule", element.getPolicyRule(), -1);
for (int i = 0; i < element.getVerification().size(); i++) composeConsentConsentVerificationComponent(t, "Consent", "verification", element.getVerification().get(i), i);
if (element.hasProvision())
composeConsentprovisionComponent(t, "Consent", "provision", element.getProvision(), -1);
}
use of org.hl7.elm.r1.DateTime in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireBuilder method processDataType.
private void processDataType(StructureDefinition profile, QuestionnaireItemComponent group, ElementDefinition element, String path, TypeRefComponent t, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups, List<ElementDefinition> parents) throws FHIRException {
String tc = t.getWorkingCode();
if (tc.equals("code"))
addCodeQuestions(group, element, path, answerGroups);
else if (Utilities.existsInList(tc, "string", "id", "oid", "uuid", "markdown"))
addStringQuestions(group, element, path, answerGroups);
else if (Utilities.existsInList(tc, "uri", "url", "canonical"))
addUriQuestions(group, element, path, answerGroups);
else if (tc.equals("boolean"))
addBooleanQuestions(group, element, path, answerGroups);
else if (tc.equals("decimal"))
addDecimalQuestions(group, element, path, answerGroups);
else if (tc.equals("dateTime") || tc.equals("date"))
addDateTimeQuestions(group, element, path, answerGroups);
else if (tc.equals("instant"))
addInstantQuestions(group, element, path, answerGroups);
else if (tc.equals("time"))
addTimeQuestions(group, element, path, answerGroups);
else if (tc.equals("CodeableConcept"))
addCodeableConceptQuestions(group, element, path, answerGroups);
else if (tc.equals("Period"))
addPeriodQuestions(group, element, path, answerGroups);
else if (tc.equals("Ratio"))
addRatioQuestions(group, element, path, answerGroups);
else if (tc.equals("HumanName"))
addHumanNameQuestions(group, element, path, answerGroups);
else if (tc.equals("Address"))
addAddressQuestions(group, element, path, answerGroups);
else if (tc.equals("ContactPoint"))
addContactPointQuestions(group, element, path, answerGroups);
else if (tc.equals("Identifier"))
addIdentifierQuestions(group, element, path, answerGroups);
else if (tc.equals("integer") || tc.equals("positiveInt") || tc.equals("unsignedInt"))
addIntegerQuestions(group, element, path, answerGroups);
else if (tc.equals("Coding"))
addCodingQuestions(group, element, path, answerGroups);
else if (Utilities.existsInList(tc, "Quantity", "Count", "Age", "Duration", "Distance", "Money"))
addQuantityQuestions(group, element, path, answerGroups);
else if (tc.equals("Money"))
addMoneyQuestions(group, element, path, answerGroups);
else if (tc.equals("Reference"))
addReferenceQuestions(group, element, path, t.getTargetProfile(), answerGroups);
else if (tc.equals("Duration"))
addDurationQuestions(group, element, path, answerGroups);
else if (tc.equals("base64Binary"))
addBinaryQuestions(group, element, path, answerGroups);
else if (tc.equals("Attachment"))
addAttachmentQuestions(group, element, path, answerGroups);
else if (tc.equals("Age"))
addAgeQuestions(group, element, path, answerGroups);
else if (tc.equals("Range"))
addRangeQuestions(group, element, path, answerGroups);
else if (tc.equals("Timing"))
addTimingQuestions(group, element, path, answerGroups);
else if (tc.equals("Annotation"))
addAnnotationQuestions(group, element, path, answerGroups);
else if (tc.equals("SampledData"))
addSampledDataQuestions(group, element, path, answerGroups);
else if (tc.equals("Extension")) {
if (t.hasProfile())
addExtensionQuestions(profile, group, element, path, t.getProfile().get(0).getValue(), answerGroups, parents);
} else if (tc.equals("SampledData"))
addSampledDataQuestions(group, element, path, answerGroups);
else if (!tc.equals("Narrative") && !tc.equals("Resource") && !tc.equals("Meta") && !tc.equals("Signature")) {
StructureDefinition sd = context.fetchTypeDefinition(tc);
if (sd == null)
throw new NotImplementedException("Unhandled Data Type: " + tc + " on element " + element.getPath());
buildGroup(group, sd, sd.getSnapshot().getElementFirstRep(), parents, answerGroups);
}
}
Aggregations