001package org.hl7.fhir.convertors.conv10_40.resources10_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_40;
004import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Reference10_40;
005import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Address10_40;
006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Attachment10_40;
007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.CodeableConcept10_40;
008import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.ContactPoint10_40;
009import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.HumanName10_40;
010import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Identifier10_40;
011import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Period10_40;
012import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Boolean10_40;
013import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Date10_40;
014import org.hl7.fhir.exceptions.FHIRException;
015
016public class Practitioner10_40 {
017
018  public static org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.r4.model.Practitioner src) throws FHIRException {
019    if (src == null || src.isEmpty())
020      return null;
021    org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner();
022    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
023    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
024      tgt.addIdentifier(Identifier10_40.convertIdentifier(t));
025    if (src.hasActiveElement())
026      tgt.setActiveElement(Boolean10_40.convertBoolean(src.getActiveElement()));
027    for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.setName(HumanName10_40.convertHumanName(t));
028    for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
029      tgt.addTelecom(ContactPoint10_40.convertContactPoint(t));
030    for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(Address10_40.convertAddress(t));
031    if (src.hasGender())
032      tgt.setGenderElement(Enumerations10_40.convertAdministrativeGender(src.getGenderElement()));
033    if (src.hasBirthDateElement())
034      tgt.setBirthDateElement(Date10_40.convertDate(src.getBirthDateElement()));
035    for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment10_40.convertAttachment(t));
036    for (org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
037      tgt.addQualification(convertPractitionerQualificationComponent(t));
038    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication())
039      tgt.addCommunication(CodeableConcept10_40.convertCodeableConcept(t));
040    return tgt;
041  }
042
043  public static org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException {
044    if (src == null || src.isEmpty())
045      return null;
046    org.hl7.fhir.r4.model.Practitioner tgt = new org.hl7.fhir.r4.model.Practitioner();
047    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
048    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
049      tgt.addIdentifier(Identifier10_40.convertIdentifier(t));
050    if (src.hasActiveElement())
051      tgt.setActiveElement(Boolean10_40.convertBoolean(src.getActiveElement()));
052    if (src.hasName())
053      tgt.addName(HumanName10_40.convertHumanName(src.getName()));
054    for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom())
055      tgt.addTelecom(ContactPoint10_40.convertContactPoint(t));
056    for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(Address10_40.convertAddress(t));
057    if (src.hasGender())
058      tgt.setGenderElement(Enumerations10_40.convertAdministrativeGender(src.getGenderElement()));
059    if (src.hasBirthDateElement())
060      tgt.setBirthDateElement(Date10_40.convertDate(src.getBirthDateElement()));
061    for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment10_40.convertAttachment(t));
062    for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
063      tgt.addQualification(convertPractitionerQualificationComponent(t));
064    for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication())
065      tgt.addCommunication(CodeableConcept10_40.convertCodeableConcept(t));
066    return tgt;
067  }
068
069  public static org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
070    if (src == null || src.isEmpty())
071      return null;
072    org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent();
073    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt);
074    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
075      tgt.addIdentifier(Identifier10_40.convertIdentifier(t));
076    if (src.hasCode())
077      tgt.setCode(CodeableConcept10_40.convertCodeableConcept(src.getCode()));
078    if (src.hasPeriod())
079      tgt.setPeriod(Period10_40.convertPeriod(src.getPeriod()));
080    if (src.hasIssuer())
081      tgt.setIssuer(Reference10_40.convertReference(src.getIssuer()));
082    return tgt;
083  }
084
085  public static org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
086    if (src == null || src.isEmpty())
087      return null;
088    org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent();
089    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt);
090    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
091      tgt.addIdentifier(Identifier10_40.convertIdentifier(t));
092    if (src.hasCode())
093      tgt.setCode(CodeableConcept10_40.convertCodeableConcept(src.getCode()));
094    if (src.hasPeriod())
095      tgt.setPeriod(Period10_40.convertPeriod(src.getPeriod()));
096    if (src.hasIssuer())
097      tgt.setIssuer(Reference10_40.convertReference(src.getIssuer()));
098    return tgt;
099  }
100}