Search in sources :

Example 46 with CodeableReference

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

the class Encounter10_50 method convertEncounter.

public static org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter();
    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_50.convertIdentifier(t));
    if (src.hasStatus())
        tgt.setStatusElement(convertEncounterState(src.getStatusElement()));
    if (src.hasClass_())
        tgt.setClass_(convertEncounterClass(src.getClass_()));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(CodeableConcept10_50.convertCodeableConcept(t));
    if (src.hasPriority())
        tgt.setPriority(CodeableConcept10_50.convertCodeableConcept(src.getPriority()));
    if (src.hasSubject())
        tgt.setPatient(Reference10_50.convertReference(src.getSubject()));
    for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(Reference10_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(Reference10_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t));
    if (src.hasAppointment())
        tgt.setAppointment(Reference10_50.convertReference(src.getAppointmentFirstRep()));
    if (src.hasActualPeriod())
        tgt.setPeriod(Period10_50.convertPeriod(src.getActualPeriod()));
    if (src.hasLength())
        tgt.setLength(Duration10_50.convertDuration(src.getLength()));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReason(CodeableConcept10_50.convertCodeableConcept(t.getConcept()));
    if (src.hasHospitalization())
        tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization()));
    for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) tgt.addLocation(convertEncounterLocationComponent(t));
    if (src.hasServiceProvider())
        tgt.setServiceProvider(Reference10_50.convertReference(src.getServiceProvider()));
    if (src.hasPartOf())
        tgt.setPartOf(Reference10_50.convertReference(src.getPartOf()));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 47 with CodeableReference

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

the class CarePlan10_50 method convertCarePlan.

public static org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan();
    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_50.convertIdentifier(t));
    if (src.hasSubject())
        tgt.setSubject(Reference10_50.convertReference(src.getSubject()));
    if (src.hasStatus())
        tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
    if (src.hasEncounter())
        tgt.setContext(Reference10_50.convertReference(src.getEncounter()));
    if (src.hasPeriod())
        tgt.setPeriod(Period10_50.convertPeriod(src.getPeriod()));
    if (src.hasAuthor())
        tgt.addAuthor(Reference10_50.convertReference(src.getAuthor()));
    for (org.hl7.fhir.r5.model.Reference t : src.getContributor()) tgt.addAuthor(Reference10_50.convertReference(t));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(CodeableConcept10_50.convertCodeableConcept(t));
    if (src.hasDescriptionElement())
        tgt.setDescriptionElement(String10_50.convertString(src.getDescriptionElement()));
    for (CodeableReference t : src.getAddresses()) {
        if (t.hasReference()) {
            tgt.addAddresses(Reference10_50.convertReference(t.getReference()));
        }
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) tgt.addGoal(Reference10_50.convertReference(t));
    for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 48 with CodeableReference

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

the class CarePlan10_50 method convertReferenceToCodableReference.

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

Example 49 with CodeableReference

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

the class Provenance10_50 method convertProvenance.

public static org.hl7.fhir.dstu2.model.Provenance convertProvenance(org.hl7.fhir.r5.model.Provenance src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu2.model.Provenance tgt = new org.hl7.fhir.dstu2.model.Provenance();
    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) tgt.addTarget(Reference10_50.convertReference(t));
    if (src.hasOccurredPeriod())
        tgt.setPeriod(Period10_50.convertPeriod(src.getOccurredPeriod()));
    if (src.hasRecorded())
        tgt.setRecordedElement(Instant10_50.convertInstant(src.getRecordedElement()));
    for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) tgt.getPolicy().add(Uri10_50.convertUri(t));
    if (src.hasLocation())
        tgt.setLocation(Reference10_50.convertReference(src.getLocation()));
    for (CodeableReference t : src.getAuthorization()) if (t.hasConcept())
        tgt.addReason(CodeableConcept10_50.convertCodeableConcept(t.getConcept()));
    if (src.hasActivity())
        tgt.setActivity(CodeableConcept10_50.convertCodeableConcept(src.getActivity()));
    for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) tgt.addAgent(convertProvenanceAgentComponent(t));
    for (org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) tgt.addEntity(convertProvenanceEntityComponent(t));
    for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) tgt.addSignature(Signature10_50.convertSignature(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 50 with CodeableReference

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

the class Immunization30_50 method convertImmunization.

public static org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.r5.model.Immunization src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization();
    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));
    if (src.hasStatus())
        tgt.setStatusElement(convertImmunizationStatus(src.getStatusElement()));
    if (src.hasVaccineCode())
        tgt.setVaccineCode(CodeableConcept30_50.convertCodeableConcept(src.getVaccineCode()));
    if (src.hasPatient())
        tgt.setPatient(Reference30_50.convertReference(src.getPatient()));
    if (src.hasEncounter())
        tgt.setEncounter(Reference30_50.convertReference(src.getEncounter()));
    if (src.hasOccurrenceDateTimeType())
        tgt.setDateElement(DateTime30_50.convertDateTime(src.getOccurrenceDateTimeType()));
    if (src.hasPrimarySource())
        tgt.setPrimarySourceElement(Boolean30_50.convertBoolean(src.getPrimarySourceElement()));
    if (src.hasInformationSourceCodeableConcept())
        tgt.setReportOrigin(CodeableConcept30_50.convertCodeableConcept(src.getInformationSourceCodeableConcept()));
    if (src.hasLocation())
        tgt.setLocation(Reference30_50.convertReference(src.getLocation()));
    if (src.hasManufacturer())
        tgt.setManufacturer(Reference30_50.convertReference(src.getManufacturer()));
    if (src.hasLotNumber())
        tgt.setLotNumberElement(String30_50.convertString(src.getLotNumberElement()));
    if (src.hasExpirationDate())
        tgt.setExpirationDateElement(Date30_50.convertDate(src.getExpirationDateElement()));
    if (src.hasSite())
        tgt.setSite(CodeableConcept30_50.convertCodeableConcept(src.getSite()));
    if (src.hasRoute())
        tgt.setRoute(CodeableConcept30_50.convertCodeableConcept(src.getRoute()));
    if (src.hasDoseQuantity())
        tgt.setDoseQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getDoseQuantity()));
    for (org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) tgt.addPractitioner(convertImmunizationPractitionerComponent(t));
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.getExplanation().addReason(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    return tgt;
}
Also used : 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