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