001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import java.util.stream.Collectors;
004
005import org.hl7.fhir.convertors.context.ConversionContext40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Annotation40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
012import org.hl7.fhir.exceptions.FHIRException;
013import org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceParticipantComponent;
014import org.hl7.fhir.r5.model.CodeableConcept;
015import org.hl7.fhir.r5.model.CodeableReference;
016import org.hl7.fhir.r5.model.Coding;
017
018/*
019  Copyright (c) 2011+, HL7, Inc.
020  All rights reserved.
021  
022  Redistribution and use in source and binary forms, with or without modification, 
023  are permitted provided that the following conditions are met:
024  
025   * Redistributions of source code must retain the above copyright notice, this 
026     list of conditions and the following disclaimer.
027   * Redistributions in binary form must reproduce the above copyright notice, 
028     this list of conditions and the following disclaimer in the documentation 
029     and/or other materials provided with the distribution.
030   * Neither the name of HL7 nor the names of its contributors may be used to 
031     endorse or promote products derived from this software without specific 
032     prior written permission.
033  
034  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
035  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
036  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
037  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
038  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
039  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
040  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
041  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
042  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
043  POSSIBILITY OF SUCH DAMAGE.
044  
045*/
046// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
047public class AllergyIntolerance40_50 {
048
049  public static org.hl7.fhir.r5.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r4.model.AllergyIntolerance src) throws FHIRException {
050    if (src == null)
051      return null;
052    org.hl7.fhir.r5.model.AllergyIntolerance tgt = new org.hl7.fhir.r5.model.AllergyIntolerance();
053    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
054    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
055      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
056    if (src.hasClinicalStatus())
057      tgt.setClinicalStatus(CodeableConcept40_50.convertCodeableConcept(src.getClinicalStatus()));
058    if (src.hasVerificationStatus())
059      tgt.setVerificationStatus(CodeableConcept40_50.convertCodeableConcept(src.getVerificationStatus()));
060    if (src.hasType())
061      tgt.setType(convertAllergyIntoleranceType(src.getTypeElement()));
062    tgt.setCategory(src.getCategory().stream()
063      .map(AllergyIntolerance40_50::convertAllergyIntoleranceCategory)
064      .collect(Collectors.toList()));
065    if (src.hasCriticality())
066      tgt.setCriticalityElement(convertAllergyIntoleranceCriticality(src.getCriticalityElement()));
067    if (src.hasCode())
068      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
069    if (src.hasPatient())
070      tgt.setPatient(Reference40_50.convertReference(src.getPatient()));
071    if (src.hasEncounter())
072      tgt.setEncounter(Reference40_50.convertReference(src.getEncounter()));
073    if (src.hasOnset())
074      tgt.setOnset(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getOnset()));
075    if (src.hasRecordedDate())
076      tgt.setRecordedDateElement(DateTime40_50.convertDateTime(src.getRecordedDateElement()));
077    if (src.hasRecorder())
078      tgt.addParticipant(new AllergyIntoleranceParticipantComponent()
079          .setFunction(new CodeableConcept().addCoding(new Coding("http://terminology.hl7.org/CodeSystem/provenance-participant-type", "author", "Author")))
080          .setActor(Reference40_50.convertReference(src.getRecorder())));
081    if (src.hasAsserter())
082      tgt.addParticipant(new AllergyIntoleranceParticipantComponent()
083          .setFunction(new CodeableConcept().addCoding(new Coding("http://terminology.hl7.org/CodeSystem/provenance-participant-type", "attester", "Attester")))
084          .setActor(Reference40_50.convertReference(src.getRecorder())));
085    if (src.hasLastOccurrence())
086      tgt.setLastOccurrenceElement(DateTime40_50.convertDateTime(src.getLastOccurrenceElement()));
087    for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
088    for (org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction())
089      tgt.addReaction(convertAllergyIntoleranceReactionComponent(t));
090    return tgt;
091  }
092
093  public static org.hl7.fhir.r4.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r5.model.AllergyIntolerance src) throws FHIRException {
094    if (src == null)
095      return null;
096    org.hl7.fhir.r4.model.AllergyIntolerance tgt = new org.hl7.fhir.r4.model.AllergyIntolerance();
097    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
098    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
099      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
100    if (src.hasClinicalStatus())
101      tgt.setClinicalStatus(CodeableConcept40_50.convertCodeableConcept(src.getClinicalStatus()));
102    if (src.hasVerificationStatus())
103      tgt.setVerificationStatus(CodeableConcept40_50.convertCodeableConcept(src.getVerificationStatus()));
104    if (src.hasType())
105      tgt.setTypeElement(convertAllergyIntoleranceType(src.getType()));
106    tgt.setCategory(src.getCategory().stream()
107      .map(AllergyIntolerance40_50::convertAllergyIntoleranceCategory)
108      .collect(Collectors.toList()));
109    if (src.hasCriticality())
110      tgt.setCriticalityElement(convertAllergyIntoleranceCriticality(src.getCriticalityElement()));
111    if (src.hasCode())
112      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
113    if (src.hasPatient())
114      tgt.setPatient(Reference40_50.convertReference(src.getPatient()));
115    if (src.hasEncounter())
116      tgt.setEncounter(Reference40_50.convertReference(src.getEncounter()));
117    if (src.hasOnset())
118      tgt.setOnset(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getOnset()));
119    if (src.hasRecordedDate())
120      tgt.setRecordedDateElement(DateTime40_50.convertDateTime(src.getRecordedDateElement()));
121    for (AllergyIntoleranceParticipantComponent t : src.getParticipant()) {
122      if (t.getFunction().hasCoding("http://terminology.hl7.org/CodeSystem/provenance-participant-type", "author"))
123        tgt.setRecorder(Reference40_50.convertReference(t.getActor()));
124      if (t.getFunction().hasCoding("http://terminology.hl7.org/CodeSystem/provenance-participant-type", "attester"))
125        tgt.setAsserter(Reference40_50.convertReference(t.getActor()));
126    }
127    if (src.hasLastOccurrence())
128      tgt.setLastOccurrenceElement(DateTime40_50.convertDateTime(src.getLastOccurrenceElement()));
129    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
130    for (org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction())
131      tgt.addReaction(convertAllergyIntoleranceReactionComponent(t));
132    return tgt;
133  }
134
135  static public org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType> src) throws FHIRException {
136    if (src == null || src.isEmpty())
137      return null;
138    org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept();
139    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
140    switch (src.getValue()) {
141    case ALLERGY:
142      tgt.addCoding("http://hl7.org/fhir/allergy-intolerance-type", "allergy", "Allergy");
143      break;
144    case INTOLERANCE:
145      tgt.addCoding("http://hl7.org/fhir/allergy-intolerance-type", "intolerance", "Intolerance");
146      break;
147    default:
148      break;
149    }
150    return tgt;
151  }
152
153  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType> convertAllergyIntoleranceType(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException {
154    if (src == null || src.isEmpty())
155      return null;
156    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceTypeEnumFactory());
157    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
158    if (src.hasCoding("http://hl7.org/fhir/allergy-intolerance-type", "allergy")) {
159      tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY);
160    } else if (src.hasCoding("http://hl7.org/fhir/allergy-intolerance-type", "intolerance")) {
161      tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE);
162    }
163    return tgt;
164  }
165
166  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory> convertAllergyIntoleranceCategory(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory> src) throws FHIRException {
167    if (src == null || src.isEmpty())
168      return null;
169    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());
170    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
171    switch (src.getValue()) {
172      case FOOD:
173        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD);
174        break;
175      case MEDICATION:
176        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION);
177        break;
178      case ENVIRONMENT:
179        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT);
180        break;
181      case BIOLOGIC:
182        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC);
183        break;
184      default:
185        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL);
186        break;
187    }
188    return tgt;
189  }
190
191  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory> convertAllergyIntoleranceCategory(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory> src) throws FHIRException {
192    if (src == null || src.isEmpty())
193      return null;
194    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory());
195    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
196    switch (src.getValue()) {
197      case FOOD:
198        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD);
199        break;
200      case MEDICATION:
201        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION);
202        break;
203      case ENVIRONMENT:
204        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT);
205        break;
206      case BIOLOGIC:
207        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC);
208        break;
209      default:
210        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL);
211        break;
212    }
213    return tgt;
214  }
215
216  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality> convertAllergyIntoleranceCriticality(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality> src) throws FHIRException {
217    if (src == null || src.isEmpty())
218      return null;
219    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());
220    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
221    switch (src.getValue()) {
222      case LOW:
223        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW);
224        break;
225      case HIGH:
226        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH);
227        break;
228      case UNABLETOASSESS:
229        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS);
230        break;
231      default:
232        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL);
233        break;
234    }
235    return tgt;
236  }
237
238  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality> convertAllergyIntoleranceCriticality(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality> src) throws FHIRException {
239    if (src == null || src.isEmpty())
240      return null;
241    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory());
242    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
243    switch (src.getValue()) {
244      case LOW:
245        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW);
246        break;
247      case HIGH:
248        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH);
249        break;
250      case UNABLETOASSESS:
251        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS);
252        break;
253      default:
254        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL);
255        break;
256    }
257    return tgt;
258  }
259
260  public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException {
261    if (src == null)
262      return null;
263    org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent();
264    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
265    if (src.hasSubstance())
266      tgt.setSubstance(CodeableConcept40_50.convertCodeableConcept(src.getSubstance()));
267    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getManifestation())
268      tgt.addManifestation(new CodeableReference(CodeableConcept40_50.convertCodeableConcept(t)));
269    if (src.hasDescription())
270      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
271    if (src.hasOnset())
272      tgt.setOnsetElement(DateTime40_50.convertDateTime(src.getOnsetElement()));
273    if (src.hasSeverity())
274      tgt.setSeverityElement(convertAllergyIntoleranceSeverity(src.getSeverityElement()));
275    if (src.hasExposureRoute())
276      tgt.setExposureRoute(CodeableConcept40_50.convertCodeableConcept(src.getExposureRoute()));
277    for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
278    return tgt;
279  }
280
281  public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException {
282    if (src == null)
283      return null;
284    org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent();
285    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
286    if (src.hasSubstance())
287      tgt.setSubstance(CodeableConcept40_50.convertCodeableConcept(src.getSubstance()));
288    for (CodeableReference t : src.getManifestation())
289      if (t.hasConcept()) tgt.addManifestation(CodeableConcept40_50.convertCodeableConcept(t.getConcept()));
290    if (src.hasDescription())
291      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
292    if (src.hasOnset())
293      tgt.setOnsetElement(DateTime40_50.convertDateTime(src.getOnsetElement()));
294    if (src.hasSeverity())
295      tgt.setSeverityElement(convertAllergyIntoleranceSeverity(src.getSeverityElement()));
296    if (src.hasExposureRoute())
297      tgt.setExposureRoute(CodeableConcept40_50.convertCodeableConcept(src.getExposureRoute()));
298    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
299    return tgt;
300  }
301
302  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity> convertAllergyIntoleranceSeverity(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity> src) throws FHIRException {
303    if (src == null || src.isEmpty())
304      return null;
305    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());
306    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
307    switch (src.getValue()) {
308      case MILD:
309        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD);
310        break;
311      case MODERATE:
312        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE);
313        break;
314      case SEVERE:
315        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE);
316        break;
317      default:
318        tgt.setValue(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL);
319        break;
320    }
321    return tgt;
322  }
323
324  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity> convertAllergyIntoleranceSeverity(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity> src) throws FHIRException {
325    if (src == null || src.isEmpty())
326      return null;
327    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory());
328    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
329    switch (src.getValue()) {
330      case MILD:
331        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD);
332        break;
333      case MODERATE:
334        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE);
335        break;
336      case SEVERE:
337        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE);
338        break;
339      default:
340        tgt.setValue(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL);
341        break;
342    }
343    return tgt;
344  }
345}