use of org.hl7.fhir.dstu2016may.model.Period in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeEncounter.
protected void composeEncounter(Complex parent, String parentType, String name, Encounter element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Encounter", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Encounter", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "Encounter", "status", element.getStatusElement(), -1);
for (int i = 0; i < element.getStatusHistory().size(); i++) composeEncounterEncounterStatusHistoryComponent(t, "Encounter", "statusHistory", element.getStatusHistory().get(i), i);
if (element.hasClass_Element())
composeEnum(t, "Encounter", "class", element.getClass_Element(), -1);
for (int i = 0; i < element.getType().size(); i++) composeCodeableConcept(t, "Encounter", "type", element.getType().get(i), i);
if (element.hasPriority())
composeCodeableConcept(t, "Encounter", "priority", element.getPriority(), -1);
if (element.hasPatient())
composeReference(t, "Encounter", "patient", element.getPatient(), -1);
for (int i = 0; i < element.getEpisodeOfCare().size(); i++) composeReference(t, "Encounter", "episodeOfCare", element.getEpisodeOfCare().get(i), i);
for (int i = 0; i < element.getIncomingReferral().size(); i++) composeReference(t, "Encounter", "incomingReferral", element.getIncomingReferral().get(i), i);
for (int i = 0; i < element.getParticipant().size(); i++) composeEncounterEncounterParticipantComponent(t, "Encounter", "participant", element.getParticipant().get(i), i);
if (element.hasAppointment())
composeReference(t, "Encounter", "appointment", element.getAppointment(), -1);
if (element.hasPeriod())
composePeriod(t, "Encounter", "period", element.getPeriod(), -1);
if (element.hasLength())
composeQuantity(t, "Encounter", "length", element.getLength(), -1);
for (int i = 0; i < element.getReason().size(); i++) composeCodeableConcept(t, "Encounter", "reason", element.getReason().get(i), i);
for (int i = 0; i < element.getIndication().size(); i++) composeReference(t, "Encounter", "indication", element.getIndication().get(i), i);
if (element.hasHospitalization())
composeEncounterEncounterHospitalizationComponent(t, "Encounter", "hospitalization", element.getHospitalization(), -1);
for (int i = 0; i < element.getLocation().size(); i++) composeEncounterEncounterLocationComponent(t, "Encounter", "location", element.getLocation().get(i), i);
if (element.hasServiceProvider())
composeReference(t, "Encounter", "serviceProvider", element.getServiceProvider(), -1);
if (element.hasPartOf())
composeReference(t, "Encounter", "partOf", element.getPartOf(), -1);
}
use of org.hl7.fhir.dstu2016may.model.Period in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeRelatedPerson.
protected void composeRelatedPerson(Complex parent, String parentType, String name, RelatedPerson element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "RelatedPerson", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "RelatedPerson", "identifier", element.getIdentifier().get(i), i);
if (element.hasPatient())
composeReference(t, "RelatedPerson", "patient", element.getPatient(), -1);
if (element.hasRelationship())
composeCodeableConcept(t, "RelatedPerson", "relationship", element.getRelationship(), -1);
if (element.hasName())
composeHumanName(t, "RelatedPerson", "name", element.getName(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "RelatedPerson", "telecom", element.getTelecom().get(i), i);
if (element.hasGenderElement())
composeEnum(t, "RelatedPerson", "gender", element.getGenderElement(), -1);
if (element.hasBirthDateElement())
composeDate(t, "RelatedPerson", "birthDate", element.getBirthDateElement(), -1);
for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "RelatedPerson", "address", element.getAddress().get(i), i);
for (int i = 0; i < element.getPhoto().size(); i++) composeAttachment(t, "RelatedPerson", "photo", element.getPhoto().get(i), i);
if (element.hasPeriod())
composePeriod(t, "RelatedPerson", "period", element.getPeriod(), -1);
}
use of org.hl7.fhir.dstu2016may.model.Period in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeTimingTimingRepeatComponent.
protected void composeTimingTimingRepeatComponent(Complex parent, String parentType, String name, Timing.TimingRepeatComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeElement(t, "repeat", name, element, index);
if (element.hasBounds())
composeType(t, "Timing", "bounds", element.getBounds(), -1);
if (element.hasCountElement())
composeInteger(t, "Timing", "count", element.getCountElement(), -1);
if (element.hasCountMaxElement())
composeInteger(t, "Timing", "countMax", element.getCountMaxElement(), -1);
if (element.hasDurationElement())
composeDecimal(t, "Timing", "duration", element.getDurationElement(), -1);
if (element.hasDurationMaxElement())
composeDecimal(t, "Timing", "durationMax", element.getDurationMaxElement(), -1);
if (element.hasDurationUnitElement())
composeEnum(t, "Timing", "durationUnit", element.getDurationUnitElement(), -1);
if (element.hasFrequencyElement())
composeInteger(t, "Timing", "frequency", element.getFrequencyElement(), -1);
if (element.hasFrequencyMaxElement())
composeInteger(t, "Timing", "frequencyMax", element.getFrequencyMaxElement(), -1);
if (element.hasPeriodElement())
composeDecimal(t, "Timing", "period", element.getPeriodElement(), -1);
if (element.hasPeriodMaxElement())
composeDecimal(t, "Timing", "periodMax", element.getPeriodMaxElement(), -1);
if (element.hasPeriodUnitElement())
composeEnum(t, "Timing", "periodUnit", element.getPeriodUnitElement(), -1);
if (element.hasWhenElement())
composeEnum(t, "Timing", "when", element.getWhenElement(), -1);
if (element.hasOffsetElement())
composeUnsignedInt(t, "Timing", "offset", element.getOffsetElement(), -1);
}
use of org.hl7.fhir.dstu2016may.model.Period in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeSampledData.
protected void composeSampledData(Complex parent, String parentType, String name, SampledData element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeElement(t, "SampledData", name, element, index);
if (element.hasOrigin())
composeQuantity(t, "SampledData", "origin", element.getOrigin(), -1);
if (element.hasPeriodElement())
composeDecimal(t, "SampledData", "period", element.getPeriodElement(), -1);
if (element.hasFactorElement())
composeDecimal(t, "SampledData", "factor", element.getFactorElement(), -1);
if (element.hasLowerLimitElement())
composeDecimal(t, "SampledData", "lowerLimit", element.getLowerLimitElement(), -1);
if (element.hasUpperLimitElement())
composeDecimal(t, "SampledData", "upperLimit", element.getUpperLimitElement(), -1);
if (element.hasDimensionsElement())
composePositiveInt(t, "SampledData", "dimensions", element.getDimensionsElement(), -1);
if (element.hasDataElement())
composeString(t, "SampledData", "data", element.getDataElement(), -1);
}
use of org.hl7.fhir.dstu2016may.model.Period in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method renderLeaf.
private void renderLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, boolean title, boolean showCodeDetails, Map<String, String> displayHints) throws FHIRException, UnsupportedEncodingException, IOException {
if (ew == null)
return;
Base e = ew.getBase();
if (e instanceof StringType)
x.addText(((StringType) e).getValue());
else if (e instanceof CodeType)
x.addText(((CodeType) e).getValue());
else if (e instanceof IdType)
x.addText(((IdType) e).getValue());
else if (e instanceof Extension)
x.addText("Extensions: Todo");
else if (e instanceof InstantType)
x.addText(((InstantType) e).toHumanDisplay());
else if (e instanceof DateTimeType)
x.addText(((DateTimeType) e).toHumanDisplay());
else if (e instanceof Base64BinaryType)
x.addText(new Base64().encodeAsString(((Base64BinaryType) e).getValue()));
else if (e instanceof org.hl7.fhir.dstu2016may.model.DateType)
x.addText(((org.hl7.fhir.dstu2016may.model.DateType) e).toHumanDisplay());
else if (e instanceof Enumeration) {
Object ev = ((Enumeration<?>) e).getValue();
// todo: look up a display name if there is one
x.addText(ev == null ? "" : ev.toString());
} else if (e instanceof BooleanType)
x.addText(((BooleanType) e).getValue().toString());
else if (e instanceof CodeableConcept) {
renderCodeableConcept((CodeableConcept) e, x, showCodeDetails);
} else if (e instanceof Coding) {
renderCoding((Coding) e, x, showCodeDetails);
} else if (e instanceof Annotation) {
renderAnnotation((Annotation) e, x);
} else if (e instanceof Identifier) {
renderIdentifier((Identifier) e, x);
} else if (e instanceof org.hl7.fhir.dstu2016may.model.IntegerType) {
x.addText(Integer.toString(((org.hl7.fhir.dstu2016may.model.IntegerType) e).getValue()));
} else if (e instanceof org.hl7.fhir.dstu2016may.model.DecimalType) {
x.addText(((org.hl7.fhir.dstu2016may.model.DecimalType) e).getValue().toString());
} else if (e instanceof HumanName) {
renderHumanName((HumanName) e, x);
} else if (e instanceof SampledData) {
renderSampledData((SampledData) e, x);
} else if (e instanceof Address) {
renderAddress((Address) e, x);
} else if (e instanceof ContactPoint) {
renderContactPoint((ContactPoint) e, x);
} else if (e instanceof UriType) {
renderUri((UriType) e, x);
} else if (e instanceof Timing) {
renderTiming((Timing) e, x);
} else if (e instanceof Range) {
renderRange((Range) e, x);
} else if (e instanceof Quantity) {
renderQuantity((Quantity) e, x, showCodeDetails);
} else if (e instanceof Ratio) {
renderQuantity(((Ratio) e).getNumerator(), x, showCodeDetails);
x.addText("/");
renderQuantity(((Ratio) e).getDenominator(), x, showCodeDetails);
} else if (e instanceof Period) {
Period p = (Period) e;
x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay());
x.addText(" --> ");
x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
} else if (e instanceof Reference) {
Reference r = (Reference) e;
XhtmlNode c = x;
ResourceWithReference tr = null;
if (r.hasReferenceElement()) {
tr = resolveReference(res, r.getReference());
if (!r.getReference().startsWith("#")) {
if (tr != null && tr.getReference() != null)
c = x.addTag("a").attribute("href", tr.getReference());
else
c = x.addTag("a").attribute("href", r.getReference());
}
}
// what to display: if text is provided, then that. if the reference was resolved, then show the generated narrative
if (r.hasDisplayElement()) {
c.addText(r.getDisplay());
if (tr != null) {
c.addText(". Generated Summary: ");
generateResourceSummary(c, tr.getResource(), true, r.getReference().startsWith("#"));
}
} else if (tr != null) {
generateResourceSummary(c, tr.getResource(), r.getReference().startsWith("#"), r.getReference().startsWith("#"));
} else {
c.addText(r.getReference());
}
} else if (e instanceof Resource) {
return;
} else if (e instanceof ElementDefinition) {
x.addText("todo-bundle");
} else if (e != null && !(e instanceof Attachment) && !(e instanceof Narrative) && !(e instanceof Meta))
throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
}
Aggregations