use of org.hl7.fhir.dstu2.model.Annotation in project org.hl7.fhir.core by hapifhir.
the class FamilyMemberHistory method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("patient"))
// Reference
this.patient = castToReference(value);
else if (name.equals("date"))
// DateTimeType
this.date = castToDateTime(value);
else if (name.equals("status"))
// Enumeration<FamilyHistoryStatus>
this.status = new FamilyHistoryStatusEnumFactory().fromType(value);
else if (name.equals("name"))
// StringType
this.name = castToString(value);
else if (name.equals("relationship"))
// CodeableConcept
this.relationship = castToCodeableConcept(value);
else if (name.equals("gender"))
// Enumeration<AdministrativeGender>
this.gender = new AdministrativeGenderEnumFactory().fromType(value);
else if (name.equals("born[x]"))
// Type
this.born = (Type) value;
else if (name.equals("age[x]"))
// Type
this.age = (Type) value;
else if (name.equals("deceased[x]"))
// Type
this.deceased = (Type) value;
else if (name.equals("note"))
// Annotation
this.note = castToAnnotation(value);
else if (name.equals("condition"))
this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
else
super.setProperty(name, value);
}
use of org.hl7.fhir.dstu2.model.Annotation in project org.hl7.fhir.core by hapifhir.
the class DeviceUseStatement10_40 method convertDeviceUseStatement.
public static org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement();
ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
if (src.hasBodySite())
tgt.setBodySite(ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getBodySite()));
if (src.hasDevice())
tgt.setDevice(Reference10_40.convertReference(src.getDevice()));
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_40.convertIdentifier(t));
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addIndication(CodeableConcept10_40.convertCodeableConcept(t));
for (Annotation t : src.getNote()) tgt.addNotes(t.getText());
if (src.hasRecordedOnElement())
tgt.setRecordedOnElement(DateTime10_40.convertDateTime(src.getRecordedOnElement()));
if (src.hasSubject())
tgt.setSubject(Reference10_40.convertReference(src.getSubject()));
if (src.hasTiming())
tgt.setTiming(ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getTiming()));
return tgt;
}
use of org.hl7.fhir.dstu2.model.Annotation in project org.hl7.fhir.core by hapifhir.
the class JavaResourceGenerator method writeAttributeAnnotation.
private void writeAttributeAnnotation(String indent, ElementDefinition e, int order, String tn, String rn, StructureDefinition structure) throws Exception {
String elementName = getElementName(e.getName(), true);
if (elementName.endsWith("_")) {
// The annotation doesn't need trailing _
elementName = elementName.substring(0, elementName.length() - 1);
}
StringBuilder childB = new StringBuilder();
childB.append(indent);
childB.append("@Child(name = \"");
childB.append(elementName);
childB.append("\", type = {");
childB.append(getTypeClassList(e, tn, structure));
childB.append("}, order=");
childB.append(Integer.toString(order));
childB.append(", min=");
childB.append(Integer.toString(e.getMin()));
childB.append(", max=");
childB.append((e.getMax().equals("*") ? "Child.MAX_UNLIMITED" : e.getMax().toString()));
childB.append(", modifier=");
childB.append(e.getIsModifier());
childB.append(", summary=");
childB.append(e.getIsSummary());
childB.append(")\r\n");
write(childB.toString());
write(indent + "@Description(shortDefinition=\"" + Utilities.escapeJava(replaceTitle(rn, e.getShort())) + "\", formalDefinition=\"" + Utilities.escapeJava(replaceTitle(rn, e.getDefinition())) + "\" )\r\n");
if (e.getBinding() != null) {
if (e.getBinding().getValueSet() != null && !Utilities.noString(e.getBinding().getValueSet())) {
write(indent + "@ca.uhn.fhir.model.api.annotation.Binding(valueSet=\"" + noVer(e.getBinding().getValueSet()) + "\")\r\n");
}
}
}
use of org.hl7.fhir.dstu2.model.Annotation in project org.hl7.fhir.core by hapifhir.
the class FamilyMemberHistory method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("patient"))
// Reference
this.patient = castToReference(value);
else if (name.equals("date"))
// DateTimeType
this.date = castToDateTime(value);
else if (name.equals("status"))
// Enumeration<FamilyHistoryStatus>
this.status = new FamilyHistoryStatusEnumFactory().fromType(value);
else if (name.equals("name"))
// StringType
this.name = castToString(value);
else if (name.equals("relationship"))
// CodeableConcept
this.relationship = castToCodeableConcept(value);
else if (name.equals("gender"))
// Enumeration<AdministrativeGender>
this.gender = new AdministrativeGenderEnumFactory().fromType(value);
else if (name.equals("born[x]"))
// Type
this.born = (Type) value;
else if (name.equals("age[x]"))
// Type
this.age = (Type) value;
else if (name.equals("deceased[x]"))
// Type
this.deceased = (Type) value;
else if (name.equals("note"))
// Annotation
this.note = castToAnnotation(value);
else if (name.equals("condition"))
this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
else
super.setProperty(name, value);
}
use of org.hl7.fhir.dstu2.model.Annotation 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