use of org.hl7.fhir.dstu2.model.Address in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePatientContactComponent.
protected void composePatientContactComponent(Complex parent, String parentType, String name, Patient.ContactComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "contact", name, element, index);
for (int i = 0; i < element.getRelationship().size(); i++) composeCodeableConcept(t, "Patient", "relationship", element.getRelationship().get(i), i);
if (element.hasName())
composeHumanName(t, "Patient", "name", element.getName(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Patient", "telecom", element.getTelecom().get(i), i);
if (element.hasAddress())
composeAddress(t, "Patient", "address", element.getAddress(), -1);
if (element.hasGenderElement())
composeEnum(t, "Patient", "gender", element.getGenderElement(), -1);
if (element.hasOrganization())
composeReference(t, "Patient", "organization", element.getOrganization(), -1);
if (element.hasPeriod())
composePeriod(t, "Patient", "period", element.getPeriod(), -1);
}
use of org.hl7.fhir.dstu2.model.Address in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePractitioner.
protected void composePractitioner(Complex parent, String parentType, String name, Practitioner element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Practitioner", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Practitioner", "identifier", element.getIdentifier().get(i), i);
if (element.hasActiveElement())
composeBoolean(t, "Practitioner", "active", element.getActiveElement(), -1);
for (int i = 0; i < element.getName().size(); i++) composeHumanName(t, "Practitioner", "name", element.getName().get(i), i);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Practitioner", "telecom", element.getTelecom().get(i), i);
for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "Practitioner", "address", element.getAddress().get(i), i);
if (element.hasGenderElement())
composeEnum(t, "Practitioner", "gender", element.getGenderElement(), -1);
if (element.hasBirthDateElement())
composeDate(t, "Practitioner", "birthDate", element.getBirthDateElement(), -1);
for (int i = 0; i < element.getPhoto().size(); i++) composeAttachment(t, "Practitioner", "photo", element.getPhoto().get(i), i);
for (int i = 0; i < element.getPractitionerRole().size(); i++) composePractitionerPractitionerPractitionerRoleComponent(t, "Practitioner", "practitionerRole", element.getPractitionerRole().get(i), i);
for (int i = 0; i < element.getQualification().size(); i++) composePractitionerPractitionerQualificationComponent(t, "Practitioner", "qualification", element.getQualification().get(i), i);
for (int i = 0; i < element.getCommunication().size(); i++) composeCodeableConcept(t, "Practitioner", "communication", element.getCommunication().get(i), i);
}
use of org.hl7.fhir.dstu2.model.Address in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeLocation.
protected void composeLocation(Complex parent, String parentType, String name, Location element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Location", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Location", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "Location", "status", element.getStatusElement(), -1);
if (element.hasNameElement())
composeString(t, "Location", "name", element.getNameElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "Location", "description", element.getDescriptionElement(), -1);
if (element.hasModeElement())
composeEnum(t, "Location", "mode", element.getModeElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Location", "type", element.getType(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Location", "telecom", element.getTelecom().get(i), i);
if (element.hasAddress())
composeAddress(t, "Location", "address", element.getAddress(), -1);
if (element.hasPhysicalType())
composeCodeableConcept(t, "Location", "physicalType", element.getPhysicalType(), -1);
if (element.hasPosition())
composeLocationLocationPositionComponent(t, "Location", "position", element.getPosition(), -1);
if (element.hasManagingOrganization())
composeReference(t, "Location", "managingOrganization", element.getManagingOrganization(), -1);
if (element.hasPartOf())
composeReference(t, "Location", "partOf", element.getPartOf(), -1);
}
use of org.hl7.fhir.dstu2.model.Address 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.dstu2.model.Address 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