001package org.hl7.fhir.convertors.conv30_40.resources30_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_40; 004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40; 005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.*; 006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Boolean30_40; 007import org.hl7.fhir.exceptions.FHIRException; 008import org.hl7.fhir.r4.model.CodeableConcept; 009 010import java.util.List; 011 012public class RelatedPerson30_40 { 013 014 public static org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r4.model.RelatedPerson src) throws FHIRException { 015 if (src == null) 016 return null; 017 org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); 018 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 019 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) { 020 tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); 021 } 022 if (src.hasActive()) { 023 if (src.hasActiveElement()) 024 tgt.setActiveElement(Boolean30_40.convertBoolean(src.getActiveElement())); 025 } 026 if (src.hasPatient()) { 027 if (src.hasPatient()) 028 tgt.setPatient(Reference30_40.convertReference(src.getPatient())); 029 } 030 List<CodeableConcept> relationships = src.getRelationship(); 031 if (relationships.size() > 0) { 032 tgt.setRelationship(CodeableConcept30_40.convertCodeableConcept(relationships.get(0))); 033 if (relationships.size() > 1) { 034 } 035 } 036 for (org.hl7.fhir.r4.model.HumanName t : src.getName()) { 037 tgt.addName(HumanName30_40.convertHumanName(t)); 038 } 039 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) { 040 tgt.addTelecom(ContactPoint30_40.convertContactPoint(t)); 041 } 042 if (src.hasGender()) { 043 tgt.setGenderElement(Enumerations30_40.convertAdministrativeGender(src.getGenderElement())); 044 } 045 if (src.hasBirthDate()) { 046 tgt.setBirthDate(src.getBirthDate()); 047 } 048 for (org.hl7.fhir.r4.model.Address t : src.getAddress()) { 049 tgt.addAddress(Address30_40.convertAddress(t)); 050 } 051 for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) { 052 tgt.addPhoto(Attachment30_40.convertAttachment(t)); 053 } 054 if (src.hasPeriod()) { 055 tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 056 } 057 return tgt; 058 } 059 060 public static org.hl7.fhir.r4.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { 061 if (src == null) 062 return null; 063 org.hl7.fhir.r4.model.RelatedPerson tgt = new org.hl7.fhir.r4.model.RelatedPerson(); 064 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 065 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { 066 tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); 067 } 068 if (src.hasActive()) { 069 if (src.hasActiveElement()) 070 tgt.setActiveElement(Boolean30_40.convertBoolean(src.getActiveElement())); 071 } 072 if (src.hasPatient()) { 073 if (src.hasPatient()) 074 tgt.setPatient(Reference30_40.convertReference(src.getPatient())); 075 } 076 if (src.hasRelationship()) { 077 if (src.hasRelationship()) 078 tgt.addRelationship(CodeableConcept30_40.convertCodeableConcept(src.getRelationship())); 079 } 080 for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) { 081 tgt.addName(HumanName30_40.convertHumanName(t)); 082 } 083 for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) { 084 tgt.addTelecom(ContactPoint30_40.convertContactPoint(t)); 085 } 086 if (src.hasGender()) { 087 tgt.setGenderElement(Enumerations30_40.convertAdministrativeGender(src.getGenderElement())); 088 } 089 if (src.hasBirthDate()) { 090 tgt.setBirthDate(src.getBirthDate()); 091 } 092 for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) { 093 tgt.addAddress(Address30_40.convertAddress(t)); 094 } 095 for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) { 096 tgt.addPhoto(Attachment30_40.convertAttachment(t)); 097 } 098 if (src.hasPeriod()) { 099 tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 100 } 101 return tgt; 102 } 103}