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.exceptions.FHIRException; 008import org.hl7.fhir.r5.model.CodeableConcept; 009 010import java.util.List; 011 012public class RelatedPerson30_50 { 013 014 public static org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 019 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) { 020 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 021 } 022 if (src.hasActive()) { 023 if (src.hasActiveElement()) 024 tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement())); 025 } 026 if (src.hasPatient()) { 027 if (src.hasPatient()) 028 tgt.setPatient(Reference30_50.convertReference(src.getPatient())); 029 } 030 List<CodeableConcept> relationships = src.getRelationship(); 031 if (relationships.size() > 0) { 032 tgt.setRelationship(CodeableConcept30_50.convertCodeableConcept(relationships.get(0))); 033 if (relationships.size() > 1) { 034 } 035 } 036 for (org.hl7.fhir.r5.model.HumanName t : src.getName()) { 037 tgt.addName(HumanName30_50.convertHumanName(t)); 038 } 039 for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) { 040 tgt.addTelecom(ContactPoint30_50.convertContactPoint(t)); 041 } 042 if (src.hasGender()) { 043 tgt.setGenderElement(Enumerations30_50.convertAdministrativeGender(src.getGenderElement())); 044 } 045 if (src.hasBirthDate()) { 046 tgt.setBirthDate(tgt.getBirthDate()); 047 } 048 for (org.hl7.fhir.r5.model.Address t : src.getAddress()) { 049 tgt.addAddress(Address30_50.convertAddress(t)); 050 } 051 for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) { 052 tgt.addPhoto(Attachment30_50.convertAttachment(t)); 053 } 054 if (src.hasPeriod()) { 055 if (src.hasPeriod()) 056 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 057 } 058 return tgt; 059 } 060 061 public static org.hl7.fhir.r5.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { 062 if (src == null) 063 return null; 064 org.hl7.fhir.r5.model.RelatedPerson tgt = new org.hl7.fhir.r5.model.RelatedPerson(); 065 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 066 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) { 067 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 068 } 069 if (src.hasActive()) { 070 if (src.hasActiveElement()) 071 tgt.setActiveElement(Boolean30_50.convertBoolean(src.getActiveElement())); 072 } 073 if (src.hasPatient()) { 074 if (src.hasPatient()) 075 tgt.setPatient(Reference30_50.convertReference(src.getPatient())); 076 } 077 if (src.hasRelationship()) { 078 if (src.hasRelationship()) 079 tgt.addRelationship(CodeableConcept30_50.convertCodeableConcept(src.getRelationship())); 080 } 081 for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) { 082 tgt.addName(HumanName30_50.convertHumanName(t)); 083 } 084 for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) { 085 tgt.addTelecom(ContactPoint30_50.convertContactPoint(t)); 086 } 087 if (src.hasGender()) { 088 tgt.setGenderElement(Enumerations30_50.convertAdministrativeGender(src.getGenderElement())); 089 } 090 if (src.hasBirthDate()) { 091 tgt.setBirthDate(tgt.getBirthDate()); 092 } 093 for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) { 094 tgt.addAddress(Address30_50.convertAddress(t)); 095 } 096 for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) { 097 tgt.addPhoto(Attachment30_50.convertAttachment(t)); 098 } 099 if (src.hasPeriod()) { 100 if (src.hasPeriod()) 101 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 102 } 103 return tgt; 104 } 105}