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.Annotation30_50; 006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50; 007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50; 008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Period30_50; 009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50; 010import org.hl7.fhir.exceptions.FHIRException; 011import org.hl7.fhir.r5.model.CodeableReference; 012 013public class CareTeam30_50 { 014 015 public static org.hl7.fhir.r5.model.CareTeam convertCareTeam(org.hl7.fhir.dstu3.model.CareTeam src) throws FHIRException { 016 if (src == null) 017 return null; 018 org.hl7.fhir.r5.model.CareTeam tgt = new org.hl7.fhir.r5.model.CareTeam(); 019 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 020 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 021 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 022 if (src.hasStatus()) 023 tgt.setStatusElement(convertCareTeamStatus(src.getStatusElement())); 024 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) 025 tgt.addCategory(CodeableConcept30_50.convertCodeableConcept(t)); 026 if (src.hasName()) 027 tgt.setNameElement(String30_50.convertString(src.getNameElement())); 028 if (src.hasSubject()) 029 tgt.setSubject(Reference30_50.convertReference(src.getSubject())); 030 if (src.hasPeriod()) 031 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 032 for (org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) 033 tgt.addParticipant(convertCareTeamParticipantComponent(t)); 034 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) 035 tgt.addReason(Reference30_50.convertCodeableConceptToCodableReference(t)); 036 for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) 037 tgt.addReason(Reference30_50.convertReferenceToCodableReference(t)); 038 for (org.hl7.fhir.dstu3.model.Reference t : src.getManagingOrganization()) 039 tgt.addManagingOrganization(Reference30_50.convertReference(t)); 040 for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t)); 041 return tgt; 042 } 043 044 public static org.hl7.fhir.dstu3.model.CareTeam convertCareTeam(org.hl7.fhir.r5.model.CareTeam src) throws FHIRException { 045 if (src == null) 046 return null; 047 org.hl7.fhir.dstu3.model.CareTeam tgt = new org.hl7.fhir.dstu3.model.CareTeam(); 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.hasStatus()) 052 tgt.setStatusElement(convertCareTeamStatus(src.getStatusElement())); 053 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) 054 tgt.addCategory(CodeableConcept30_50.convertCodeableConcept(t)); 055 if (src.hasName()) 056 tgt.setNameElement(String30_50.convertString(src.getNameElement())); 057 if (src.hasSubject()) 058 tgt.setSubject(Reference30_50.convertReference(src.getSubject())); 059 if (src.hasPeriod()) 060 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 061 for (org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) 062 tgt.addParticipant(convertCareTeamParticipantComponent(t)); 063 for (CodeableReference t : src.getReason()) 064 if (t.hasConcept()) 065 tgt.addReasonCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept())); 066 for (CodeableReference t : src.getReason()) 067 if (t.hasReference()) 068 tgt.addReasonReference(Reference30_50.convertReference(t.getReference())); 069 for (org.hl7.fhir.r5.model.Reference t : src.getManagingOrganization()) 070 tgt.addManagingOrganization(Reference30_50.convertReference(t)); 071 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t)); 072 return tgt; 073 } 074 075 public static org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { 076 if (src == null) 077 return null; 078 org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent(); 079 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 080 if (src.hasRole()) 081 tgt.setRole(CodeableConcept30_50.convertCodeableConcept(src.getRole())); 082 if (src.hasMember()) 083 tgt.setMember(Reference30_50.convertReference(src.getMember())); 084 if (src.hasOnBehalfOf()) 085 tgt.setOnBehalfOf(Reference30_50.convertReference(src.getOnBehalfOf())); 086 if (src.hasCoveragePeriod()) 087 tgt.setPeriod(Period30_50.convertPeriod(src.getCoveragePeriod())); 088 return tgt; 089 } 090 091 public static org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { 092 if (src == null) 093 return null; 094 org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent(); 095 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt); 096 if (src.hasRole()) 097 tgt.setRole(CodeableConcept30_50.convertCodeableConcept(src.getRole())); 098 if (src.hasMember()) 099 tgt.setMember(Reference30_50.convertReference(src.getMember())); 100 if (src.hasOnBehalfOf()) 101 tgt.setOnBehalfOf(Reference30_50.convertReference(src.getOnBehalfOf())); 102 if (src.hasPeriod()) 103 tgt.setCoverage(Period30_50.convertPeriod(src.getPeriod())); 104 return tgt; 105 } 106 107 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus> convertCareTeamStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CareTeam.CareTeamStatus> src) throws FHIRException { 108 if (src == null || src.isEmpty()) 109 return null; 110 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatusEnumFactory()); 111 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 112 switch (src.getValue()) { 113 case PROPOSED: 114 tgt.setValue(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.PROPOSED); 115 break; 116 case ACTIVE: 117 tgt.setValue(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ACTIVE); 118 break; 119 case SUSPENDED: 120 tgt.setValue(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.SUSPENDED); 121 break; 122 case INACTIVE: 123 tgt.setValue(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.INACTIVE); 124 break; 125 case ENTEREDINERROR: 126 tgt.setValue(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ENTEREDINERROR); 127 break; 128 default: 129 tgt.setValue(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.NULL); 130 break; 131 } 132 return tgt; 133 } 134 135 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CareTeam.CareTeamStatus> convertCareTeamStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus> src) throws FHIRException { 136 if (src == null || src.isEmpty()) 137 return null; 138 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CareTeam.CareTeamStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CareTeam.CareTeamStatusEnumFactory()); 139 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 140 switch (src.getValue()) { 141 case PROPOSED: 142 tgt.setValue(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.PROPOSED); 143 break; 144 case ACTIVE: 145 tgt.setValue(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ACTIVE); 146 break; 147 case SUSPENDED: 148 tgt.setValue(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.SUSPENDED); 149 break; 150 case INACTIVE: 151 tgt.setValue(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.INACTIVE); 152 break; 153 case ENTEREDINERROR: 154 tgt.setValue(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ENTEREDINERROR); 155 break; 156 default: 157 tgt.setValue(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.NULL); 158 break; 159 } 160 return tgt; 161 } 162}