Search in sources :

Example 6 with CodeableReference

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

the class CarePlan30_50 method convertCarePlanActivityDetailComponent.

public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
    if (src.hasExtension()) {
        org.hl7.fhir.r5.model.Extension extension = src.getExtensionByUrl(CarePlanActivityDetailComponentExtension);
        if (extension != null) {
            org.hl7.fhir.r5.model.DataType value = extension.getValue();
            if (value instanceof org.hl7.fhir.r5.model.CodeableConcept) {
                tgt.setCategory(CodeableConcept30_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) value));
            }
        }
    }
    if (src.hasCode()) {
        if (src.hasCode())
            tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
    }
    for (CodeableReference t : src.getReason()) {
        if (t.hasConcept())
            tgt.addReasonCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    }
    for (CodeableReference t : src.getReason()) {
        if (t.hasReference())
            tgt.addReasonReference(Reference30_50.convertReference(t.getReference()));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) {
        tgt.addGoal(Reference30_50.convertReference(t));
    }
    if (src.hasStatus()) {
        if (src.hasStatus())
            tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement()));
    }
    if (src.hasStatusReason()) {
        List<Coding> coding = src.getStatusReason().getCoding();
        if (coding.size() > 0) {
            tgt.setStatusReason(coding.get(0).getCode());
        }
    }
    if (src.hasDoNotPerform()) {
        if (src.hasDoNotPerformElement())
            tgt.setProhibitedElement(Boolean30_50.convertBoolean(src.getDoNotPerformElement()));
    }
    if (src.hasScheduled()) {
        if (src.hasScheduled())
            tgt.setScheduled(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getScheduled()));
    }
    if (src.hasLocation()) {
        if (src.getLocation().hasReference())
            tgt.setLocation(Reference30_50.convertReference(src.getLocation().getReference()));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) {
        tgt.addPerformer(Reference30_50.convertReference(t));
    }
    if (src.hasProduct()) {
        if (src.hasProduct())
            tgt.setProduct(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getProduct()));
    }
    if (src.hasDailyAmount()) {
        if (src.hasDailyAmount())
            tgt.setDailyAmount(SimpleQuantity30_50.convertSimpleQuantity(src.getDailyAmount()));
    }
    if (src.hasQuantity()) {
        if (src.hasQuantity())
            tgt.setQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getQuantity()));
    }
    if (src.hasDescription()) {
        if (src.hasDescriptionElement())
            tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
    }
    return tgt;
}
Also used : Coding(org.hl7.fhir.r5.model.Coding) CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 7 with CodeableReference

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

the class CarePlan30_50 method convertCarePlan.

public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) {
        tgt.addBasedOn(Reference30_50.convertReference(t));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) {
        tgt.addReplaces(Reference30_50.convertReference(t));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) {
        tgt.addPartOf(Reference30_50.convertReference(t));
    }
    if (src.hasStatus()) {
        if (src.hasStatus())
            tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
    }
    if (src.hasIntent()) {
        if (src.hasIntent())
            tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement()));
    }
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) {
        tgt.addCategory(CodeableConcept30_50.convertCodeableConcept(t));
    }
    if (src.hasTitle()) {
        if (src.hasTitleElement())
            tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
    }
    if (src.hasDescription()) {
        if (src.hasDescriptionElement())
            tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
    }
    if (src.hasSubject()) {
        if (src.hasSubject())
            tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
    }
    if (src.hasEncounter()) {
        if (src.hasEncounter())
            tgt.setContext(Reference30_50.convertReference(src.getEncounter()));
    }
    if (src.hasPeriod()) {
        if (src.hasPeriod())
            tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod()));
    }
    if (src.hasAuthor()) {
        if (src.hasAuthor())
            tgt.addAuthor(Reference30_50.convertReference(src.getAuthor()));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getCareTeam()) {
        tgt.addCareTeam(Reference30_50.convertReference(t));
    }
    for (CodeableReference t : src.getAddresses()) {
        if (t.hasReference())
            tgt.addAddresses(Reference30_50.convertReference(t.getReference()));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) {
        tgt.addSupportingInfo(Reference30_50.convertReference(t));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) {
        tgt.addGoal(Reference30_50.convertReference(t));
    }
    for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) {
        tgt.addActivity(convertCarePlanActivityComponent(t));
    }
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) {
        tgt.addNote(Annotation30_50.convertAnnotation(t));
    }
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 8 with CodeableReference

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

the class CarePlan30_50 method convertCarePlanActivityComponent.

public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
    for (CodeableReference t : src.getPerformedActivity()) {
        if (t.hasConcept())
            tgt.addOutcomeCodeableConcept(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    }
    for (CodeableReference t : src.getPerformedActivity()) {
        if (t.hasReference())
            tgt.addOutcomeReference(Reference30_50.convertReference(t.getReference()));
    }
    for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) {
        tgt.addProgress(Annotation30_50.convertAnnotation(t));
    }
    if (src.hasPlannedActivityReference()) {
        if (src.hasPlannedActivityReference())
            tgt.setReference(Reference30_50.convertReference(src.getPlannedActivityReference()));
    }
    if (src.hasPlannedActivityDetail()) {
        if (src.hasPlannedActivityDetail())
            tgt.setDetail(convertCarePlanActivityDetailComponent(src.getPlannedActivityDetail()));
    }
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 9 with CodeableReference

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

the class Communication30_50 method convertCommunication.

public static org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesCanonical()) tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue()));
    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference30_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(Reference30_50.convertReference(t));
    if (src.hasStatus())
        if (src.getStatus() == org.hl7.fhir.r5.model.Enumerations.EventStatus.NOTDONE)
            tgt.setNotDone(true);
        else
            tgt.setStatusElement(convertCommunicationStatus(src.getStatusElement()));
    if (src.hasStatusReason())
        tgt.setNotDoneReason(CodeableConcept30_50.convertCodeableConcept(src.getStatusReason()));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(CodeableConcept30_50.convertCodeableConcept(t));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) tgt.addMedium(CodeableConcept30_50.convertCodeableConcept(t));
    if (src.hasSubject())
        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
    for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) tgt.addRecipient(Reference30_50.convertReference(t));
    if (src.hasEncounter())
        tgt.setContext(Reference30_50.convertReference(src.getEncounter()));
    if (src.hasSent())
        tgt.setSentElement(DateTime30_50.convertDateTime(src.getSentElement()));
    if (src.hasReceived())
        tgt.setReceivedElement(DateTime30_50.convertDateTime(src.getReceivedElement()));
    if (src.hasSender())
        tgt.setSender(Reference30_50.convertReference(src.getSender()));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReasonCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    for (CodeableReference t : src.getReason()) if (t.hasReference())
        tgt.addReasonReference(Reference30_50.convertReference(t.getReference()));
    for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) tgt.addPayload(convertCommunicationPayloadComponent(t));
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference) CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 10 with CodeableReference

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

the class ActivityDefinition30_50 method convertActivityDefinition.

public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    if (src.hasUrl())
        tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    if (src.hasVersion())
        tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
    if (src.hasName())
        tgt.setNameElement(String30_50.convertString(src.getNameElement()));
    if (src.hasTitle())
        tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
    if (src.hasStatus())
        tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
    if (src.hasExperimental())
        tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
    if (src.hasDate())
        tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
    if (src.hasPublisher())
        tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
    if (src.hasDescription())
        tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
    if (src.hasPurpose())
        tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
    if (src.hasUsage())
        tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
    if (src.hasApprovalDate())
        tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
    if (src.hasLastReviewDate())
        tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
    if (src.hasEffectivePeriod())
        tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(CodeableConcept30_50.convertCodeableConcept(t));
    for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) {
        if (t.getType() == ContributorType.AUTHOR)
            for (ContactDetail c : t.getContact()) tgt.addAuthor(ContactDetail30_50.convertContactDetail(c));
        if (t.getType() == ContributorType.EDITOR)
            for (ContactDetail c : t.getContact()) tgt.addEditor(ContactDetail30_50.convertContactDetail(c));
        if (t.getType() == ContributorType.REVIEWER)
            for (ContactDetail c : t.getContact()) tgt.addReviewer(ContactDetail30_50.convertContactDetail(c));
        if (t.getType() == ContributorType.ENDORSER)
            for (ContactDetail c : t.getContact()) tgt.addEndorser(ContactDetail30_50.convertContactDetail(c));
    }
    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(ContactDetail30_50.convertContactDetail(t));
    if (src.hasCopyright())
        tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
    for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
    for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(Reference30_50.convertReferenceToCanonical(t));
    if (src.hasKind())
        tgt.setKindElement(convertActivityDefinitionKind(src.getKindElement()));
    if (src.hasCode())
        tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
    if (src.hasTiming())
        tgt.setTiming(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTiming()));
    if (src.hasLocation())
        tgt.setLocation(new CodeableReference(Reference30_50.convertReference(src.getLocation())));
    for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
    if (src.hasProduct())
        tgt.setProduct(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getProduct()));
    if (src.hasQuantity())
        tgt.setQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getQuantity()));
    for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage30_50.convertDosage(t));
    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(CodeableConcept30_50.convertCodeableConcept(t));
    if (src.hasTransform())
        tgt.setTransformElement(Reference30_50.convertReferenceToCanonical(src.getTransform()));
    for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t));
    return tgt;
}
Also used : ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail) ContactDetail(org.hl7.fhir.dstu3.model.ContactDetail) CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

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