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