Search in sources :

Example 11 with CodeableReference

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

the class Appointment30_50 method convertAppointment.

public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment();
    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(convertAppointmentStatus(src.getStatusElement()));
    if (src.hasServiceCategory())
        tgt.setServiceCategory(CodeableConcept30_50.convertCodeableConcept(src.getServiceCategoryFirstRep()));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.addServiceType(CodeableConcept30_50.convertCodeableConcept(t));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) tgt.addSpecialty(CodeableConcept30_50.convertCodeableConcept(t));
    if (src.hasAppointmentType())
        tgt.setAppointmentType(CodeableConcept30_50.convertCodeableConcept(src.getAppointmentType()));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReason(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    for (CodeableReference t : src.getReason()) if (t.hasReference())
        tgt.addIndication(Reference30_50.convertReference(t.getReference()));
    if (src.hasPriority())
        tgt.setPriorityElement(convertAppointmentPriority(src.getPriority()));
    if (src.hasDescription())
        tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
    for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(Reference30_50.convertReference(t));
    if (src.hasStart())
        tgt.setStartElement(Instant30_50.convertInstant(src.getStartElement()));
    if (src.hasEnd())
        tgt.setEndElement(Instant30_50.convertInstant(src.getEndElement()));
    if (src.hasMinutesDuration())
        tgt.setMinutesDurationElement(PositiveInt30_50.convertPositiveInt(src.getMinutesDurationElement()));
    for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) tgt.addSlot(Reference30_50.convertReference(t));
    if (src.hasCreated())
        tgt.setCreatedElement(DateTime30_50.convertDateTime(src.getCreatedElement()));
    if (src.hasNote())
        tgt.setCommentElement(String30_50.convertString(src.getNoteFirstRep().getTextElement()));
    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(Reference30_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertAppointmentParticipantComponent(t));
    for (org.hl7.fhir.r5.model.Period t : src.getRequestedPeriod()) tgt.addRequestedPeriod(Period30_50.convertPeriod(t));
    return tgt;
}
Also used : CodeableConcept(org.hl7.fhir.r5.model.CodeableConcept) CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 12 with CodeableReference

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

the class FamilyMemberHistory30_50 method convertFamilyMemberHistory.

public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory();
    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()));
    if (src.hasStatus())
        tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement()));
    if (src.hasDataAbsentReason())
        tgt.setNotDoneReason(CodeableConcept30_50.convertCodeableConcept(src.getDataAbsentReason()));
    if (src.hasPatient())
        tgt.setPatient(Reference30_50.convertReference(src.getPatient()));
    if (src.hasDate())
        tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
    if (src.hasName())
        tgt.setNameElement(String30_50.convertString(src.getNameElement()));
    if (src.hasRelationship())
        tgt.setRelationship(CodeableConcept30_50.convertCodeableConcept(src.getRelationship()));
    if (src.hasBorn())
        tgt.setBorn(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getBorn()));
    if (src.hasAge())
        tgt.setAge(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getAge()));
    if (src.hasEstimatedAge())
        tgt.setEstimatedAgeElement(Boolean30_50.convertBoolean(src.getEstimatedAgeElement()));
    if (src.hasDeceased())
        tgt.setDeceased(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getDeceased()));
    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.Annotation t : src.getNote()) tgt.addNote(Annotation30_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) CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 13 with CodeableReference

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

the class Goal30_50 method convertGoal.

public static org.hl7.fhir.dstu3.model.Goal convertGoal(org.hl7.fhir.r5.model.Goal src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.Goal tgt = new org.hl7.fhir.dstu3.model.Goal();
    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.hasLifecycleStatus())
        tgt.setStatusElement(convertGoalStatus(src.getLifecycleStatusElement()));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(CodeableConcept30_50.convertCodeableConcept(t));
    if (src.hasPriority())
        tgt.setPriority(CodeableConcept30_50.convertCodeableConcept(src.getPriority()));
    if (src.hasDescription())
        tgt.setDescription(CodeableConcept30_50.convertCodeableConcept(src.getDescription()));
    if (src.hasSubject())
        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
    if (src.hasStart())
        tgt.setStart(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getStart()));
    if (src.hasTarget())
        tgt.setTarget(convertGoalTargetComponent(src.getTargetFirstRep()));
    if (src.hasStatusDate())
        tgt.setStatusDateElement(Date30_50.convertDate(src.getStatusDateElement()));
    if (src.hasStatusReason())
        tgt.setStatusReasonElement(String30_50.convertString(src.getStatusReasonElement()));
    for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) tgt.addAddresses(Reference30_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
    for (CodeableReference t : src.getOutcome()) if (t.hasConcept())
        tgt.addOutcomeCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    for (CodeableReference t : src.getOutcome()) if (t.hasReference())
        tgt.addOutcomeReference(Reference30_50.convertReference(t.getReference()));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 14 with CodeableReference

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

the class ImagingStudy30_50 method convertImagingStudy.

public static org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r5.model.ImagingStudy src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) {
        if (URN_DICOM_UID.equals(t.getSystem())) {
            tgt.setUid(t.getValue());
        } else {
            tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
        }
    }
    if (src.hasStatus()) {
        org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus s = src.getStatus();
        switch(s) {
            case REGISTERED:
                tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE);
                break;
            case AVAILABLE:
                tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE);
                break;
            case CANCELLED:
                tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE);
                break;
            default:
                break;
        }
    }
    for (org.hl7.fhir.r5.model.Coding t : src.getModality()) {
        tgt.addModalityList(Coding30_50.convertCoding(t));
    }
    if (src.hasSubject()) {
        if (src.hasSubject())
            tgt.setPatient(Reference30_50.convertReference(src.getSubject()));
    }
    if (src.hasEncounter()) {
        if (src.hasEncounter())
            tgt.setContext(Reference30_50.convertReference(src.getEncounter()));
    }
    if (src.hasStarted()) {
        if (src.hasStartedElement())
            tgt.setStartedElement(DateTime30_50.convertDateTime(src.getStartedElement()));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) {
        tgt.addBasedOn(Reference30_50.convertReference(t));
    }
    if (src.hasReferrer()) {
        if (src.hasReferrer())
            tgt.setReferrer(Reference30_50.convertReference(src.getReferrer()));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getInterpreter()) {
        tgt.addInterpreter(Reference30_50.convertReference(t));
    }
    for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) {
        tgt.addEndpoint(Reference30_50.convertReference(t));
    }
    if (src.hasNumberOfSeries()) {
        if (src.hasNumberOfSeriesElement())
            tgt.setNumberOfSeriesElement(UnsignedInt30_50.convertUnsignedInt(src.getNumberOfSeriesElement()));
    }
    if (src.hasNumberOfInstances()) {
        if (src.hasNumberOfInstancesElement())
            tgt.setNumberOfInstancesElement(UnsignedInt30_50.convertUnsignedInt(src.getNumberOfInstancesElement()));
    }
    for (CodeableReference t : src.getProcedure()) {
        if (t.hasReference()) {
            tgt.addProcedureReference(Reference30_50.convertReference(t.getReference()));
        } else {
            tgt.addProcedureCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
        }
    }
    List<CodeableReference> reasonCodes = src.getReason();
    if (reasonCodes.size() > 0) {
        tgt.setReason(CodeableConcept30_50.convertCodeableConcept(reasonCodes.get(0).getConcept()));
        if (reasonCodes.size() > 1) {
        }
    }
    if (src.hasDescription()) {
        if (src.hasDescriptionElement())
            tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
    }
    for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) {
        tgt.addSeries(convertImagingStudySeriesComponent(t));
    }
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 15 with CodeableReference

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

the class Encounter30_50 method convertEncounter.

public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter();
    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(convertEncounterStatus(src.getStatusElement()));
    for (org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) tgt.addStatusHistory(convertStatusHistoryComponent(t));
    if (src.hasClass_())
        tgt.setClass_(Coding30_50.convertCoding(src.getClass_()));
    for (org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) tgt.addClassHistory(convertClassHistoryComponent(t));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.addType(CodeableConcept30_50.convertCodeableConcept(t));
    if (src.hasPriority())
        tgt.setPriority(CodeableConcept30_50.convertCodeableConcept(src.getPriority()));
    if (src.hasSubject())
        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
    for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) tgt.addEpisodeOfCare(Reference30_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addIncomingReferral(Reference30_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertEncounterParticipantComponent(t));
    if (src.hasAppointment())
        tgt.setAppointment(Reference30_50.convertReference(src.getAppointmentFirstRep()));
    if (src.hasActualPeriod())
        tgt.setPeriod(Period30_50.convertPeriod(src.getActualPeriod()));
    if (src.hasLength())
        tgt.setLength(Duration30_50.convertDuration(src.getLength()));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReason(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    for (org.hl7.fhir.r5.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) tgt.addDiagnosis(convertDiagnosisComponent(t));
    for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) tgt.addAccount(Reference30_50.convertReference(t));
    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(Reference30_50.convertReference(src.getServiceProvider()));
    if (src.hasPartOf())
        tgt.setPartOf(Reference30_50.convertReference(src.getPartOf()));
    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