
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.primitivetypes30_50.DateTime30_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 013import java.util.stream.Collectors; 014 015public class AllergyIntolerance30_50 { 016 017 public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r5.model.AllergyIntolerance src) throws FHIRException { 018 if (src == null) 019 return null; 020 org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance(); 021 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 022 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 023 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 024 if (src.hasClinicalStatus()) 025 tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); 026 if (src.hasVerificationStatus()) 027 tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); 028 if (src.hasType()) 029 tgt.setTypeElement(convertAllergyIntoleranceType(src.getTypeElement())); 030 tgt.setCategory(src.getCategory().stream() 031 .map(AllergyIntolerance30_50::convertAllergyIntoleranceCategory) 032 .collect(Collectors.toList())); 033 if (src.hasCriticality()) 034 tgt.setCriticalityElement(convertAllergyIntoleranceCriticality(src.getCriticalityElement())); 035 if (src.hasCode()) 036 tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode())); 037 if (src.hasPatient()) 038 tgt.setPatient(Reference30_50.convertReference(src.getPatient())); 039 if (src.hasOnset()) 040 tgt.setOnset(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getOnset())); 041 if (src.hasRecordedDate()) 042 tgt.setAssertedDateElement(DateTime30_50.convertDateTime(src.getRecordedDateElement())); 043 if (src.hasRecorder()) 044 tgt.setRecorder(Reference30_50.convertReference(src.getRecorder())); 045 if (src.hasAsserter()) 046 tgt.setAsserter(Reference30_50.convertReference(src.getAsserter())); 047 if (src.hasLastOccurrence()) 048 tgt.setLastOccurrenceElement(DateTime30_50.convertDateTime(src.getLastOccurrenceElement())); 049 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t)); 050 for (org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) 051 tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); 052 return tgt; 053 } 054 055 public static org.hl7.fhir.r5.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu3.model.AllergyIntolerance src) throws FHIRException { 056 if (src == null) 057 return null; 058 org.hl7.fhir.r5.model.AllergyIntolerance tgt = new org.hl7.fhir.r5.model.AllergyIntolerance(); 059 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 060 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 061 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 062 if (src.hasClinicalStatus()) 063 tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); 064 if (src.hasVerificationStatus()) 065 tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); 066 if (src.hasType()) 067 tgt.setTypeElement(convertAllergyIntoleranceType(src.getTypeElement())); 068 tgt.setCategory(src.getCategory().stream() 069 .map(AllergyIntolerance30_50::convertAllergyIntoleranceCategory) 070 .collect(Collectors.toList())); 071 if (src.hasCriticality()) 072 tgt.setCriticalityElement(convertAllergyIntoleranceCriticality(src.getCriticalityElement())); 073 if (src.hasCode()) 074 tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode())); 075 if (src.hasPatient()) 076 tgt.setPatient(Reference30_50.convertReference(src.getPatient())); 077 if (src.hasOnset()) 078 tgt.setOnset(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getOnset())); 079 if (src.hasAssertedDate()) 080 tgt.setRecordedDateElement(DateTime30_50.convertDateTime(src.getAssertedDateElement())); 081 if (src.hasRecorder()) 082 tgt.setRecorder(Reference30_50.convertReference(src.getRecorder())); 083 if (src.hasAsserter()) 084 tgt.setAsserter(Reference30_50.convertReference(src.getAsserter())); 085 if (src.hasLastOccurrence()) 086 tgt.setLastOccurrenceElement(DateTime30_50.convertDateTime(src.getLastOccurrenceElement())); 087 for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t)); 088 for (org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) 089 tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); 090 return tgt; 091 } 092 093 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory> convertAllergyIntoleranceCategory(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory> src) throws FHIRException { 094 if (src == null || src.isEmpty()) 095 return null; 096 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()); 097 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 098 switch (src.getValue()) { 099 case FOOD: 100 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD); 101 break; 102 case MEDICATION: 103 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION); 104 break; 105 case ENVIRONMENT: 106 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT); 107 break; 108 case BIOLOGIC: 109 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC); 110 break; 111 default: 112 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL); 113 break; 114 } 115 return tgt; 116 } 117 118 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory> convertAllergyIntoleranceCategory(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory> src) throws FHIRException { 119 if (src == null || src.isEmpty()) 120 return null; 121 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()); 122 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 123 switch (src.getValue()) { 124 case FOOD: 125 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD); 126 break; 127 case MEDICATION: 128 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION); 129 break; 130 case ENVIRONMENT: 131 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT); 132 break; 133 case BIOLOGIC: 134 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC); 135 break; 136 default: 137 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL); 138 break; 139 } 140 return tgt; 141 } 142 143 static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { 144 if (src == null) 145 return null; 146 if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "active")) 147 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE; 148 if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "inactive")) 149 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE; 150 if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "resolved")) 151 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED; 152 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL; 153 } 154 155 static public org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus src) throws FHIRException { 156 if (src == null) 157 return null; 158 switch (src) { 159 case ACTIVE: 160 return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("active")); 161 case INACTIVE: 162 return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("inactive")); 163 case RESOLVED: 164 new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved")); 165 default: 166 return null; 167 } 168 } 169 170 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality> convertAllergyIntoleranceCriticality(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality> src) throws FHIRException { 171 if (src == null || src.isEmpty()) 172 return null; 173 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()); 174 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 175 switch (src.getValue()) { 176 case LOW: 177 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW); 178 break; 179 case HIGH: 180 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH); 181 break; 182 case UNABLETOASSESS: 183 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS); 184 break; 185 default: 186 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL); 187 break; 188 } 189 return tgt; 190 } 191 192 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality> convertAllergyIntoleranceCriticality(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality> src) throws FHIRException { 193 if (src == null || src.isEmpty()) 194 return null; 195 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()); 196 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 197 switch (src.getValue()) { 198 case LOW: 199 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW); 200 break; 201 case HIGH: 202 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH); 203 break; 204 case UNABLETOASSESS: 205 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS); 206 break; 207 default: 208 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL); 209 break; 210 } 211 return tgt; 212 } 213 214 public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { 215 if (src == null) 216 return null; 217 org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); 218 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 219 if (src.hasSubstance()) 220 tgt.setSubstance(CodeableConcept30_50.convertCodeableConcept(src.getSubstance())); 221 for (CodeableReference t : src.getManifestation()) 222 if (t.hasConcept()) tgt.addManifestation(CodeableConcept30_50.convertCodeableConcept(t.getConcept())); 223 if (src.hasDescription()) 224 tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement())); 225 if (src.hasOnset()) 226 tgt.setOnsetElement(DateTime30_50.convertDateTime(src.getOnsetElement())); 227 if (src.hasSeverity()) 228 tgt.setSeverityElement(convertAllergyIntoleranceSeverity(src.getSeverityElement())); 229 if (src.hasExposureRoute()) 230 tgt.setExposureRoute(CodeableConcept30_50.convertCodeableConcept(src.getExposureRoute())); 231 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t)); 232 return tgt; 233 } 234 235 public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { 236 if (src == null) 237 return null; 238 org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); 239 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 240 if (src.hasSubstance()) 241 tgt.setSubstance(CodeableConcept30_50.convertCodeableConcept(src.getSubstance())); 242 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) 243 tgt.addManifestation(new CodeableReference(CodeableConcept30_50.convertCodeableConcept(t))); 244 if (src.hasDescription()) 245 tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement())); 246 if (src.hasOnset()) 247 tgt.setOnsetElement(DateTime30_50.convertDateTime(src.getOnsetElement())); 248 if (src.hasSeverity()) 249 tgt.setSeverityElement(convertAllergyIntoleranceSeverity(src.getSeverityElement())); 250 if (src.hasExposureRoute()) 251 tgt.setExposureRoute(CodeableConcept30_50.convertCodeableConcept(src.getExposureRoute())); 252 for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t)); 253 return tgt; 254 } 255 256 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity> convertAllergyIntoleranceSeverity(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity> src) throws FHIRException { 257 if (src == null || src.isEmpty()) 258 return null; 259 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()); 260 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 261 switch (src.getValue()) { 262 case MILD: 263 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD); 264 break; 265 case MODERATE: 266 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE); 267 break; 268 case SEVERE: 269 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE); 270 break; 271 default: 272 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL); 273 break; 274 } 275 return tgt; 276 } 277 278 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity> convertAllergyIntoleranceSeverity(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity> src) throws FHIRException { 279 if (src == null || src.isEmpty()) 280 return null; 281 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()); 282 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 283 switch (src.getValue()) { 284 case MILD: 285 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD); 286 break; 287 case MODERATE: 288 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE); 289 break; 290 case SEVERE: 291 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE); 292 break; 293 default: 294 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL); 295 break; 296 } 297 return tgt; 298 } 299 300 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType> convertAllergyIntoleranceType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType> src) throws FHIRException { 301 if (src == null || src.isEmpty()) 302 return null; 303 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()); 304 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 305 switch (src.getValue()) { 306 case ALLERGY: 307 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY); 308 break; 309 case INTOLERANCE: 310 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE); 311 break; 312 default: 313 tgt.setValue(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.NULL); 314 break; 315 } 316 return tgt; 317 } 318 319 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType> convertAllergyIntoleranceType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType> src) throws FHIRException { 320 if (src == null || src.isEmpty()) 321 return null; 322 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()); 323 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 324 switch (src.getValue()) { 325 case ALLERGY: 326 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY); 327 break; 328 case INTOLERANCE: 329 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE); 330 break; 331 default: 332 tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.NULL); 333 break; 334 } 335 return tgt; 336 } 337 338 static public org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus src) throws FHIRException { 339 if (src == null) 340 return null; 341 switch (src) { 342 case UNCONFIRMED: 343 return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("unconfirmed")); 344 case CONFIRMED: 345 return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("confirmed")); 346 case REFUTED: 347 return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("refuted")); 348 case ENTEREDINERROR: 349 return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("entered-in-error")); 350 default: 351 return null; 352 } 353 } 354 355 static public org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { 356 if (src == null) 357 return null; 358 if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "unconfirmed")) 359 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED; 360 if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "confirmed")) 361 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED; 362 if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "refuted")) 363 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED; 364 if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "entered-in-error")) 365 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR; 366 return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL; 367 } 368}