001package org.hl7.fhir.convertors.conv10_50.resources10_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_50;
004import org.hl7.fhir.convertors.conv10_50.datatypes10_50.Reference10_50;
005import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.*;
006import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Boolean10_50;
007import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Date10_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class Practitioner10_50 {
011
012  public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException {
013    if (src == null || src.isEmpty())
014      return null;
015    org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner();
016    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
017    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
018      tgt.addIdentifier(Identifier10_50.convertIdentifier(t));
019    if (src.hasActiveElement())
020      tgt.setActiveElement(Boolean10_50.convertBoolean(src.getActiveElement()));
021    if (src.hasName())
022      tgt.addName(HumanName10_50.convertHumanName(src.getName()));
023    for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom())
024      tgt.addTelecom(ContactPoint10_50.convertContactPoint(t));
025    for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(Address10_50.convertAddress(t));
026    if (src.hasGender())
027      tgt.setGenderElement(Enumerations10_50.convertAdministrativeGender(src.getGenderElement()));
028    if (src.hasBirthDateElement())
029      tgt.setBirthDateElement(Date10_50.convertDate(src.getBirthDateElement()));
030    for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment10_50.convertAttachment(t));
031    for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
032      tgt.addQualification(convertPractitionerQualificationComponent(t));
033    for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication())
034      tgt.addCommunication(CodeableConcept10_50.convertCodeableConcept(t));
035    return tgt;
036  }
037
038  public static org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException {
039    if (src == null || src.isEmpty())
040      return null;
041    org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner();
042    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
043    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
044      tgt.addIdentifier(Identifier10_50.convertIdentifier(t));
045    if (src.hasActiveElement())
046      tgt.setActiveElement(Boolean10_50.convertBoolean(src.getActiveElement()));
047    for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.setName(HumanName10_50.convertHumanName(t));
048    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom())
049      tgt.addTelecom(ContactPoint10_50.convertContactPoint(t));
050    for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(Address10_50.convertAddress(t));
051    if (src.hasGender())
052      tgt.setGenderElement(Enumerations10_50.convertAdministrativeGender(src.getGenderElement()));
053    if (src.hasBirthDateElement())
054      tgt.setBirthDateElement(Date10_50.convertDate(src.getBirthDateElement()));
055    for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment10_50.convertAttachment(t));
056    for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
057      tgt.addQualification(convertPractitionerQualificationComponent(t));
058    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication())
059      tgt.addCommunication(CodeableConcept10_50.convertCodeableConcept(t));
060    return tgt;
061  }
062
063  public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
064    if (src == null || src.isEmpty())
065      return null;
066    org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent();
067    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
068    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
069      tgt.addIdentifier(Identifier10_50.convertIdentifier(t));
070    if (src.hasCode())
071      tgt.setCode(CodeableConcept10_50.convertCodeableConcept(src.getCode()));
072    if (src.hasPeriod())
073      tgt.setPeriod(Period10_50.convertPeriod(src.getPeriod()));
074    if (src.hasIssuer())
075      tgt.setIssuer(Reference10_50.convertReference(src.getIssuer()));
076    return tgt;
077  }
078
079  public static org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
080    if (src == null || src.isEmpty())
081      return null;
082    org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent();
083    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
084    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
085      tgt.addIdentifier(Identifier10_50.convertIdentifier(t));
086    if (src.hasCode())
087      tgt.setCode(CodeableConcept10_50.convertCodeableConcept(src.getCode()));
088    if (src.hasPeriod())
089      tgt.setPeriod(Period10_50.convertPeriod(src.getPeriod()));
090    if (src.hasIssuer())
091      tgt.setIssuer(Reference10_50.convertReference(src.getIssuer()));
092    return tgt;
093  }
094}