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