Search in sources :

Example 96 with Enumeration

use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.

the class ImplementationGuide14_40 method convertImplementationGuide.

public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide();
    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt);
    if (src.hasUrlElement())
        tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement()));
    if (src.hasVersion())
        tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
    if (src.hasNameElement())
        tgt.setNameElement(String14_40.convertString(src.getNameElement()));
    if (src.hasStatus())
        tgt.setStatusElement(Enumerations14_40.convertConformanceResourceStatus(src.getStatusElement()));
    if (src.hasExperimental())
        tgt.setExperimentalElement(Boolean14_40.convertBoolean(src.getExperimentalElement()));
    if (src.hasPublisher())
        tgt.setPublisherElement(String14_40.convertString(src.getPublisherElement()));
    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertImplementationGuideContactComponent(t));
    if (src.hasDate())
        tgt.setDateElement(DateTime14_40.convertDateTime(src.getDateElement()));
    if (src.hasDescription())
        tgt.setDescription(src.getDescription());
    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept())
        tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t.getValueCodeableConcept()));
    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t));
    if (src.hasCopyright())
        tgt.setCopyright(src.getCopyright());
    if (src.hasFhirVersion())
        for (Enumeration<org.hl7.fhir.r4.model.Enumerations.FHIRVersion> v : src.getFhirVersion()) {
            tgt.setFhirVersion(v.asStringValue());
        }
    for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) tgt.addDependency(convertImplementationGuideDependencyComponent(t));
    for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) tgt.addPackage(convertImplementationGuidePackageComponent(t));
    for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t));
    for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) tgt.addGlobal(convertImplementationGuideGlobalComponent(t));
    tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage()));
    return tgt;
}
Also used : Enumeration(org.hl7.fhir.r4.model.Enumeration) ImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide) ImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide)

Example 97 with Enumeration

use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.

the class EnrollmentResponse 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("request"))
        // Reference
        this.request = castToReference(value);
    else if (name.equals("outcome"))
        // Enumeration<RemittanceOutcome>
        this.outcome = new RemittanceOutcomeEnumFactory().fromType(value);
    else if (name.equals("disposition"))
        // StringType
        this.disposition = castToString(value);
    else if (name.equals("ruleset"))
        // Coding
        this.ruleset = castToCoding(value);
    else if (name.equals("originalRuleset"))
        // Coding
        this.originalRuleset = castToCoding(value);
    else if (name.equals("created"))
        // DateTimeType
        this.created = castToDateTime(value);
    else if (name.equals("organization"))
        // Reference
        this.organization = castToReference(value);
    else if (name.equals("requestProvider"))
        // Reference
        this.requestProvider = castToReference(value);
    else if (name.equals("requestOrganization"))
        // Reference
        this.requestOrganization = castToReference(value);
    else
        super.setProperty(name, value);
}
Also used : RemittanceOutcomeEnumFactory(org.hl7.fhir.dstu2.model.Enumerations.RemittanceOutcomeEnumFactory)

Example 98 with Enumeration

use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.

the class EligibilityResponse 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("request"))
        // Reference
        this.request = castToReference(value);
    else if (name.equals("outcome"))
        // Enumeration<RemittanceOutcome>
        this.outcome = new RemittanceOutcomeEnumFactory().fromType(value);
    else if (name.equals("disposition"))
        // StringType
        this.disposition = castToString(value);
    else if (name.equals("ruleset"))
        // Coding
        this.ruleset = castToCoding(value);
    else if (name.equals("originalRuleset"))
        // Coding
        this.originalRuleset = castToCoding(value);
    else if (name.equals("created"))
        // DateTimeType
        this.created = castToDateTime(value);
    else if (name.equals("organization"))
        // Reference
        this.organization = castToReference(value);
    else if (name.equals("requestProvider"))
        // Reference
        this.requestProvider = castToReference(value);
    else if (name.equals("requestOrganization"))
        // Reference
        this.requestOrganization = castToReference(value);
    else
        super.setProperty(name, value);
}
Also used : RemittanceOutcomeEnumFactory(org.hl7.fhir.dstu2.model.Enumerations.RemittanceOutcomeEnumFactory)

Example 99 with Enumeration

use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method displayLeaf.

private boolean displayLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, String name, boolean showCodeDetails) throws FHIRException, UnsupportedEncodingException, IOException {
    if (ew == null)
        return false;
    Base e = ew.getBase();
    if (e == null)
        return false;
    Map<String, String> displayHints = readDisplayHints(defn);
    if (name.endsWith("[x]"))
        name = name.substring(0, name.length() - 3);
    if (!showCodeDetails && e instanceof PrimitiveType && isDefault(displayHints, ((PrimitiveType) e)))
        return false;
    if (e instanceof StringType) {
        x.addText(name + ": " + ((StringType) e).getValue());
        return true;
    } else if (e instanceof CodeType) {
        x.addText(name + ": " + ((CodeType) e).getValue());
        return true;
    } else if (e instanceof IdType) {
        x.addText(name + ": " + ((IdType) e).getValue());
        return true;
    } else if (e instanceof UriType) {
        x.addText(name + ": " + ((UriType) e).getValue());
        return true;
    } else if (e instanceof DateTimeType) {
        x.addText(name + ": " + ((DateTimeType) e).toHumanDisplay());
        return true;
    } else if (e instanceof InstantType) {
        x.addText(name + ": " + ((InstantType) e).toHumanDisplay());
        return true;
    } else if (e instanceof Extension) {
        // x.tx("Extensions: todo");
        return false;
    } else if (e instanceof org.hl7.fhir.dstu3.model.DateType) {
        x.addText(name + ": " + ((org.hl7.fhir.dstu3.model.DateType) e).toHumanDisplay());
        return true;
    } else if (e instanceof Enumeration) {
        // todo: look up a display name if there is one
        x.addText(((Enumeration<?>) e).getValue().toString());
        return true;
    } else if (e instanceof BooleanType) {
        if (((BooleanType) e).getValue()) {
            x.addText(name);
            return true;
        }
    } else if (e instanceof CodeableConcept) {
        renderCodeableConcept((CodeableConcept) e, x, showCodeDetails);
        return true;
    } else if (e instanceof Coding) {
        renderCoding((Coding) e, x, showCodeDetails);
        return true;
    } else if (e instanceof Annotation) {
        renderAnnotation((Annotation) e, x, showCodeDetails);
        return true;
    } else if (e instanceof org.hl7.fhir.dstu3.model.IntegerType) {
        x.addText(Integer.toString(((org.hl7.fhir.dstu3.model.IntegerType) e).getValue()));
        return true;
    } else if (e instanceof org.hl7.fhir.dstu3.model.DecimalType) {
        x.addText(((org.hl7.fhir.dstu3.model.DecimalType) e).getValue().toString());
        return true;
    } else if (e instanceof Identifier) {
        renderIdentifier((Identifier) e, x);
        return true;
    } else if (e instanceof HumanName) {
        renderHumanName((HumanName) e, x);
        return true;
    } else if (e instanceof SampledData) {
        renderSampledData((SampledData) e, x);
        return true;
    } else if (e instanceof Address) {
        renderAddress((Address) e, x);
        return true;
    } else if (e instanceof ContactPoint) {
        renderContactPoint((ContactPoint) e, x);
        return true;
    } else if (e instanceof Timing) {
        renderTiming((Timing) e, x);
        return true;
    } else if (e instanceof Quantity) {
        renderQuantity((Quantity) e, x, showCodeDetails);
        return true;
    } else if (e instanceof Ratio) {
        renderQuantity(((Ratio) e).getNumerator(), x, showCodeDetails);
        x.tx("/");
        renderQuantity(((Ratio) e).getDenominator(), x, showCodeDetails);
        return true;
    } else if (e instanceof Period) {
        Period p = (Period) e;
        x.addText(name + ": ");
        x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay());
        x.tx(" --> ");
        x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
        return true;
    } else if (e instanceof Reference) {
        Reference r = (Reference) e;
        if (r.hasDisplayElement())
            x.addText(r.getDisplay());
        else if (r.hasReferenceElement()) {
            ResourceWithReference tr = resolveReference(res, r.getReference());
            // getDisplayForReference(tr.getReference()));
            x.addText(tr == null ? r.getReference() : "????");
        } else
            x.tx("??");
        return true;
    } else if (e instanceof Narrative) {
        return false;
    } else if (e instanceof Resource) {
        return false;
    } else if (e instanceof ContactDetail) {
        return false;
    } else if (e instanceof Range) {
        return false;
    } else if (e instanceof Meta) {
        return false;
    } else if (e instanceof Dosage) {
        return false;
    } else if (e instanceof Signature) {
        return false;
    } else if (e instanceof UsageContext) {
        return false;
    } else if (e instanceof ElementDefinition) {
        return false;
    } else if (!(e instanceof Attachment))
        throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
    return false;
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) Address(org.hl7.fhir.dstu3.model.Address) StringType(org.hl7.fhir.dstu3.model.StringType) NotImplementedException(org.apache.commons.lang3.NotImplementedException) Attachment(org.hl7.fhir.dstu3.model.Attachment) Dosage(org.hl7.fhir.dstu3.model.Dosage) UriType(org.hl7.fhir.dstu3.model.UriType) HumanName(org.hl7.fhir.dstu3.model.HumanName) ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) Narrative(org.hl7.fhir.dstu3.model.Narrative) SampledData(org.hl7.fhir.dstu3.model.SampledData) PrimitiveType(org.hl7.fhir.dstu3.model.PrimitiveType) Ratio(org.hl7.fhir.dstu3.model.Ratio) ElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition) InstantType(org.hl7.fhir.dstu3.model.InstantType) Enumeration(org.hl7.fhir.dstu3.model.Enumeration) Reference(org.hl7.fhir.dstu3.model.Reference) BooleanType(org.hl7.fhir.dstu3.model.BooleanType) DomainResource(org.hl7.fhir.dstu3.model.DomainResource) MetadataResource(org.hl7.fhir.dstu3.model.MetadataResource) Resource(org.hl7.fhir.dstu3.model.Resource) Quantity(org.hl7.fhir.dstu3.model.Quantity) Period(org.hl7.fhir.dstu3.model.Period) Range(org.hl7.fhir.dstu3.model.Range) Base(org.hl7.fhir.dstu3.model.Base) Annotation(org.hl7.fhir.dstu3.model.Annotation) IdType(org.hl7.fhir.dstu3.model.IdType) Extension(org.hl7.fhir.dstu3.model.Extension) ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) UsageContext(org.hl7.fhir.dstu3.model.UsageContext) Signature(org.hl7.fhir.dstu3.model.Signature) CodeType(org.hl7.fhir.dstu3.model.CodeType) EventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming) Timing(org.hl7.fhir.dstu3.model.Timing) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 100 with Enumeration

use of org.hl7.fhir.r5.model.Enumeration in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method displayTiming.

private String displayTiming(Timing s) throws FHIRException {
    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
    if (s.hasCode())
        b.append("Code: " + displayCodeableConcept(s.getCode()));
    if (s.getEvent().size() > 0) {
        CommaSeparatedStringBuilder c = new CommaSeparatedStringBuilder();
        for (DateTimeType p : s.getEvent()) {
            c.append(p.toHumanDisplay());
        }
        b.append("Events: " + c.toString());
    }
    if (s.hasRepeat()) {
        TimingRepeatComponent rep = s.getRepeat();
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasStart())
            b.append("Starting " + rep.getBoundsPeriod().getStartElement().toHumanDisplay());
        if (rep.hasCount())
            b.append("Count " + Integer.toString(rep.getCount()) + " times");
        if (rep.hasDuration())
            b.append("Duration " + rep.getDuration().toPlainString() + displayTimeUnits(rep.getPeriodUnit()));
        if (rep.hasWhen()) {
            String st = "";
            if (rep.hasOffset()) {
                st = Integer.toString(rep.getOffset()) + "min ";
            }
            b.append("Do " + st);
            for (Enumeration<EventTiming> wh : rep.getWhen()) b.append(displayEventCode(wh.getValue()));
        } else {
            String st = "";
            if (!rep.hasFrequency() || (!rep.hasFrequencyMax() && rep.getFrequency() == 1))
                st = "Once";
            else {
                st = Integer.toString(rep.getFrequency());
                if (rep.hasFrequencyMax())
                    st = st + "-" + Integer.toString(rep.getFrequency());
            }
            if (rep.hasPeriod()) {
                st = st + " per " + rep.getPeriod().toPlainString();
                if (rep.hasPeriodMax())
                    st = st + "-" + rep.getPeriodMax().toPlainString();
                st = st + " " + displayTimeUnits(rep.getPeriodUnit());
            }
            b.append("Do " + st);
        }
        if (rep.hasBoundsPeriod() && rep.getBoundsPeriod().hasEnd())
            b.append("Until " + rep.getBoundsPeriod().getEndElement().toHumanDisplay());
    }
    return b.toString();
}
Also used : EventTiming(org.hl7.fhir.r4.model.Timing.EventTiming) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) TimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent)

Aggregations

CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)14 ArrayList (java.util.ArrayList)11 NotImplementedException (org.apache.commons.lang3.NotImplementedException)11 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)10 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)10 FHIRException (org.hl7.fhir.exceptions.FHIRException)7 StringType (org.hl7.fhir.r5.model.StringType)7 ConformanceResourceStatusEnumFactory (org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatusEnumFactory)6 Enumeration (org.hl7.fhir.dstu3.model.Enumeration)6 Enumeration (org.hl7.fhir.r4.model.Enumeration)6 StringType (org.hl7.fhir.r4b.model.StringType)6 Enumeration (org.hl7.fhir.r5.model.Enumeration)6 UriType (org.hl7.fhir.r5.model.UriType)6 Base64 (org.apache.commons.codec.binary.Base64)5 PublicationStatusEnumFactory (org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory)5 StringType (org.hl7.fhir.dstu3.model.StringType)5 Enumeration (org.hl7.fhir.dstu2.model.Enumeration)4 Reference (org.hl7.fhir.dstu2.model.Reference)4 StringType (org.hl7.fhir.dstu2.model.StringType)4 Patient (org.hl7.fhir.r4.model.Patient)4