001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.*;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Date30_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010public class Practitioner30_50 {
011
012  public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException {
013    if (src == null)
014      return null;
015    org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner();
016    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
017    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
018      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
019    if (src.hasActive())
020      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
021    for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.addName(HumanName30_50.convertHumanName(t));
022    for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
023      tgt.addTelecom(ContactPoint30_50.convertContactPoint(t));
024    for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(Address30_50.convertAddress(t));
025    if (src.hasGender())
026      tgt.setGenderElement(Enumerations30_50.convertAdministrativeGender(src.getGenderElement()));
027    if (src.hasBirthDate())
028      tgt.setBirthDateElement(Date30_50.convertDate(src.getBirthDateElement()));
029    for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment30_50.convertAttachment(t));
030    for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
031      tgt.addQualification(convertPractitionerQualificationComponent(t));
032    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication())
033      tgt.addCommunication(CodeableConcept30_50.convertCodeableConcept(t));
034    return tgt;
035  }
036
037  public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException {
038    if (src == null)
039      return null;
040    org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner();
041    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
042    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
043      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
044    if (src.hasActive())
045      tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement()));
046    for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.addName(HumanName30_50.convertHumanName(t));
047    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom())
048      tgt.addTelecom(ContactPoint30_50.convertContactPoint(t));
049    for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(Address30_50.convertAddress(t));
050    if (src.hasGender())
051      tgt.setGenderElement(Enumerations30_50.convertAdministrativeGender(src.getGenderElement()));
052    if (src.hasBirthDate())
053      tgt.setBirthDateElement(Date30_50.convertDate(src.getBirthDateElement()));
054    for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment30_50.convertAttachment(t));
055    for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
056      tgt.addQualification(convertPractitionerQualificationComponent(t));
057    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication())
058      tgt.addCommunication(CodeableConcept30_50.convertCodeableConcept(t));
059    return tgt;
060  }
061
062  public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
063    if (src == null)
064      return null;
065    org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent();
066    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
067    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
068      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
069    if (src.hasCode())
070      tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
071    if (src.hasPeriod())
072      tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod()));
073    if (src.hasIssuer())
074      tgt.setIssuer(Reference30_50.convertReference(src.getIssuer()));
075    return tgt;
076  }
077
078  public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
079    if (src == null)
080      return null;
081    org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent();
082    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
083    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
084      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
085    if (src.hasCode())
086      tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
087    if (src.hasPeriod())
088      tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod()));
089    if (src.hasIssuer())
090      tgt.setIssuer(Reference30_50.convertReference(src.getIssuer()));
091    return tgt;
092  }
093}