Search in sources :

Example 26 with CodeableReference

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

the class Contract40_50 method convertActionComponent.

public static org.hl7.fhir.r4.model.Contract.ActionComponent convertActionComponent(org.hl7.fhir.r5.model.Contract.ActionComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r4.model.Contract.ActionComponent tgt = new org.hl7.fhir.r4.model.Contract.ActionComponent();
    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
    if (src.hasDoNotPerform())
        tgt.setDoNotPerformElement(Boolean40_50.convertBoolean(src.getDoNotPerformElement()));
    if (src.hasType())
        tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
    for (org.hl7.fhir.r5.model.Contract.ActionSubjectComponent t : src.getSubject()) tgt.addSubject(convertActionSubjectComponent(t));
    if (src.hasIntent())
        tgt.setIntent(CodeableConcept40_50.convertCodeableConcept(src.getIntent()));
    for (org.hl7.fhir.r5.model.StringType t : src.getLinkId()) tgt.getLinkId().add(String40_50.convertString(t));
    if (src.hasStatus())
        tgt.setStatus(CodeableConcept40_50.convertCodeableConcept(src.getStatus()));
    if (src.hasContext())
        tgt.setContext(Reference40_50.convertReference(src.getContext()));
    for (org.hl7.fhir.r5.model.StringType t : src.getContextLinkId()) tgt.getContextLinkId().add(String40_50.convertString(t));
    if (src.hasOccurrence())
        tgt.setOccurrence(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getOccurrence()));
    for (org.hl7.fhir.r5.model.Reference t : src.getRequester()) tgt.addRequester(Reference40_50.convertReference(t));
    for (org.hl7.fhir.r5.model.StringType t : src.getRequesterLinkId()) tgt.getRequesterLinkId().add(String40_50.convertString(t));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPerformerType()) tgt.addPerformerType(CodeableConcept40_50.convertCodeableConcept(t));
    if (src.hasPerformerRole())
        tgt.setPerformerRole(CodeableConcept40_50.convertCodeableConcept(src.getPerformerRole()));
    if (src.hasPerformer())
        tgt.setPerformer(Reference40_50.convertReference(src.getPerformer()));
    for (org.hl7.fhir.r5.model.StringType t : src.getPerformerLinkId()) tgt.getPerformerLinkId().add(String40_50.convertString(t));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReasonCode(CodeableConcept40_50.convertCodeableConcept(t.getConcept()));
    for (CodeableReference t : src.getReason()) if (t.hasReference())
        tgt.addReasonReference(Reference40_50.convertReference(t.getReference()));
    for (org.hl7.fhir.r5.model.StringType t : src.getReasonLinkId()) tgt.getReason().add(String40_50.convertString(t));
    for (org.hl7.fhir.r5.model.StringType t : src.getReasonLinkId()) tgt.getReasonLinkId().add(String40_50.convertString(t));
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
    for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getSecurityLabelNumber()) tgt.getSecurityLabelNumber().add(UnsignedInt40_50.convertUnsignedInt(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 27 with CodeableReference

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

the class FamilyMemberHistory40_50 method convertFamilyMemberHistory.

public static org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r4.model.FamilyMemberHistory tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory();
    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
    for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) tgt.getInstantiatesCanonical().add(Canonical40_50.convertCanonical(t));
    for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) tgt.getInstantiatesUri().add(Uri40_50.convertUri(t));
    if (src.hasStatus())
        tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement()));
    if (src.hasDataAbsentReason())
        tgt.setDataAbsentReason(CodeableConcept40_50.convertCodeableConcept(src.getDataAbsentReason()));
    if (src.hasPatient())
        tgt.setPatient(Reference40_50.convertReference(src.getPatient()));
    if (src.hasDate())
        tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
    if (src.hasName())
        tgt.setNameElement(String40_50.convertString(src.getNameElement()));
    if (src.hasRelationship())
        tgt.setRelationship(CodeableConcept40_50.convertCodeableConcept(src.getRelationship()));
    if (src.hasSex())
        tgt.setSex(CodeableConcept40_50.convertCodeableConcept(src.getSex()));
    if (src.hasBorn())
        tgt.setBorn(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getBorn()));
    if (src.hasAge())
        tgt.setAge(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getAge()));
    if (src.hasEstimatedAge())
        tgt.setEstimatedAgeElement(Boolean40_50.convertBoolean(src.getEstimatedAgeElement()));
    if (src.hasDeceased())
        tgt.setDeceased(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getDeceased()));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReasonCode(CodeableConcept40_50.convertCodeableConcept(t.getConcept()));
    for (CodeableReference t : src.getReason()) if (t.hasReference())
        tgt.addReasonReference(Reference40_50.convertReference(t.getReference()));
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
    for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 28 with CodeableReference

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

the class Reference40_50 method convertReferenceToCodeableReference.

public static CodeableReference convertReferenceToCodeableReference(org.hl7.fhir.r4.model.Reference src) {
    CodeableReference tgt = new CodeableReference();
    tgt.setReference(convertReference(src));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 29 with CodeableReference

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

the class CodeableConcept40_50 method convertCodeableConceptToCodeableReference.

public static CodeableReference convertCodeableConceptToCodeableReference(org.hl7.fhir.r4.model.CodeableConcept src) {
    CodeableReference tgt = new CodeableReference();
    tgt.setConcept(convertCodeableConcept(src));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 30 with CodeableReference

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

the class ProfileDrivenRenderer method displayLeaf.

private boolean displayLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, String name, boolean showCodeDetails, boolean allowLinks) 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) {
        if (Utilities.isAbsoluteUrlLinkable(((UriType) e).getValue()) && allowLinks) {
            x.tx(name + ": ");
            x.ah(((UriType) e).getValue()).addText(((UriType) e).getValue());
        } else {
            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.r4b.model.DateType) {
        x.addText(name + ": " + ((org.hl7.fhir.r4b.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).hasValue()) {
            x.addText(name);
            x.addText(": ");
            x.addText(((BooleanType) e).getValueAsString());
            return true;
        }
    } else if (e instanceof CodeableReference) {
        if (((CodeableReference) e).hasReference()) {
            Reference r = ((CodeableReference) e).getReference();
            renderReference(res, x, r, allowLinks);
        } else {
            renderCodeableConcept(x, ((CodeableReference) e).getConcept(), showCodeDetails);
        }
        return true;
    } else if (e instanceof CodeableConcept) {
        renderCodeableConcept(x, (CodeableConcept) e, showCodeDetails);
        return true;
    } else if (e instanceof Coding) {
        renderCoding(x, (Coding) e, showCodeDetails);
        return true;
    } else if (e instanceof Annotation) {
        renderAnnotation(x, (Annotation) e, showCodeDetails);
        return true;
    } else if (e instanceof org.hl7.fhir.r4b.model.IntegerType) {
        x.addText(Integer.toString(((org.hl7.fhir.r4b.model.IntegerType) e).getValue()));
        return true;
    } else if (e instanceof org.hl7.fhir.r4b.model.DecimalType) {
        x.addText(((org.hl7.fhir.r4b.model.DecimalType) e).getValue().toString());
        return true;
    } else if (e instanceof Identifier) {
        renderIdentifier(x, (Identifier) e);
        return true;
    } else if (e instanceof HumanName) {
        renderHumanName(x, (HumanName) e);
        return true;
    } else if (e instanceof SampledData) {
        renderSampledData(x, (SampledData) e);
        return true;
    } else if (e instanceof Address) {
        renderAddress(x, (Address) e);
        return true;
    } else if (e instanceof ContactPoint) {
        if (allowLinks) {
            renderContactPoint(x, (ContactPoint) e);
        } else {
            displayContactPoint(x, (ContactPoint) e);
        }
        return true;
    } else if (e instanceof Timing) {
        renderTiming(x, (Timing) e);
        return true;
    } else if (e instanceof Quantity) {
        renderQuantity(x, (Quantity) e, showCodeDetails);
        return true;
    } else if (e instanceof Ratio) {
        renderQuantity(x, ((Ratio) e).getNumerator(), showCodeDetails);
        x.tx("/");
        renderQuantity(x, ((Ratio) e).getDenominator(), showCodeDetails);
        return true;
    } else if (e instanceof Period) {
        Period p = (Period) e;
        x.addText(name + ": ");
        x.addText(!p.hasStart() ? "?ngen-2?" : 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() : "?ngen-3");
        } else
            x.tx("?ngen-4?");
        return true;
    } else if (e instanceof Narrative) {
        return false;
    } else if (e instanceof Resource) {
        return false;
    } else if (e instanceof ContactDetail) {
        ContactDetail cd = (ContactDetail) e;
        if (cd.hasName()) {
            x.tx(cd.getName() + ": ");
        }
        boolean first = true;
        for (ContactPoint c : cd.getTelecom()) {
            if (first)
                first = false;
            else
                x.tx(",");
            if (allowLinks) {
                renderContactPoint(x, c);
            } else {
                displayContactPoint(x, c);
            }
        }
        return true;
    } 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 RelatedArtifact) {
        return false;
    } else if (e instanceof ElementDefinition) {
        return false;
    } else if (e instanceof Base64BinaryType) {
        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.r4b.model.Meta) Address(org.hl7.fhir.r4b.model.Address) StringType(org.hl7.fhir.r4b.model.StringType) Attachment(org.hl7.fhir.r4b.model.Attachment) Dosage(org.hl7.fhir.r4b.model.Dosage) Identifier(org.hl7.fhir.r4b.model.Identifier) Coding(org.hl7.fhir.r4b.model.Coding) Narrative(org.hl7.fhir.r4b.model.Narrative) SampledData(org.hl7.fhir.r4b.model.SampledData) PrimitiveType(org.hl7.fhir.r4b.model.PrimitiveType) ElementDefinition(org.hl7.fhir.r4b.model.ElementDefinition) InstantType(org.hl7.fhir.r4b.model.InstantType) DomainResource(org.hl7.fhir.r4b.model.DomainResource) Resource(org.hl7.fhir.r4b.model.Resource) Period(org.hl7.fhir.r4b.model.Period) ResourceWithReference(org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceWithReference) Range(org.hl7.fhir.r4b.model.Range) RelatedArtifact(org.hl7.fhir.r4b.model.RelatedArtifact) IdType(org.hl7.fhir.r4b.model.IdType) DateTimeType(org.hl7.fhir.r4b.model.DateTimeType) UsageContext(org.hl7.fhir.r4b.model.UsageContext) Timing(org.hl7.fhir.r4b.model.Timing) CodeableConcept(org.hl7.fhir.r4b.model.CodeableConcept) NotImplementedException(org.apache.commons.lang3.NotImplementedException) UriType(org.hl7.fhir.r4b.model.UriType) HumanName(org.hl7.fhir.r4b.model.HumanName) ContactPoint(org.hl7.fhir.r4b.model.ContactPoint) Ratio(org.hl7.fhir.r4b.model.Ratio) Enumeration(org.hl7.fhir.r4b.model.Enumeration) CodeableReference(org.hl7.fhir.r4b.model.CodeableReference) ResourceWithReference(org.hl7.fhir.r4b.renderers.utils.Resolver.ResourceWithReference) Reference(org.hl7.fhir.r4b.model.Reference) BooleanType(org.hl7.fhir.r4b.model.BooleanType) Quantity(org.hl7.fhir.r4b.model.Quantity) Base(org.hl7.fhir.r4b.model.Base) Annotation(org.hl7.fhir.r4b.model.Annotation) Extension(org.hl7.fhir.r4b.model.Extension) ContactDetail(org.hl7.fhir.r4b.model.ContactDetail) CodeableReference(org.hl7.fhir.r4b.model.CodeableReference) Signature(org.hl7.fhir.r4b.model.Signature) CodeType(org.hl7.fhir.r4b.model.CodeType) Base64BinaryType(org.hl7.fhir.r4b.model.Base64BinaryType)

Aggregations

CodeableReference (org.hl7.fhir.r5.model.CodeableReference)58 CodeableConcept (org.hl7.fhir.r5.model.CodeableConcept)5 NotImplementedException (org.apache.commons.lang3.NotImplementedException)4 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)3 Annotation (org.hl7.fhir.r5.model.Annotation)3 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Base64 (org.apache.commons.codec.binary.Base64)2 ElementDefn (org.hl7.fhir.definitions.model.ElementDefn)2 Address (org.hl7.fhir.r4b.model.Address)2 Annotation (org.hl7.fhir.r4b.model.Annotation)2 Attachment (org.hl7.fhir.r4b.model.Attachment)2 Base (org.hl7.fhir.r4b.model.Base)2 Base64BinaryType (org.hl7.fhir.r4b.model.Base64BinaryType)2 BooleanType (org.hl7.fhir.r4b.model.BooleanType)2 CodeType (org.hl7.fhir.r4b.model.CodeType)2 CodeableConcept (org.hl7.fhir.r4b.model.CodeableConcept)2 CodeableReference (org.hl7.fhir.r4b.model.CodeableReference)2 Coding (org.hl7.fhir.r4b.model.Coding)2