001package org.hl7.fhir.convertors.conv40_50;
002
003
004import org.hl7.fhir.convertors.VersionConvertor_40_50;
005import org.hl7.fhir.exceptions.FHIRException;
006import org.hl7.fhir.r5.model.CodeableReference;
007
008/*
009  Copyright (c) 2011+, HL7, Inc.
010  All rights reserved.
011  
012  Redistribution and use in source and binary forms, with or without modification, 
013  are permitted provided that the following conditions are met:
014  
015   * Redistributions of source code must retain the above copyright notice, this 
016     list of conditions and the following disclaimer.
017   * Redistributions in binary form must reproduce the above copyright notice, 
018     this list of conditions and the following disclaimer in the documentation 
019     and/or other materials provided with the distribution.
020   * Neither the name of HL7 nor the names of its contributors may be used to 
021     endorse or promote products derived from this software without specific 
022     prior written permission.
023  
024  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
025  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
026  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
027  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
028  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
029  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
030  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
031  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
032  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
033  POSSIBILITY OF SUCH DAMAGE.
034  
035*/
036// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
037public class CarePlan40_50 extends VersionConvertor_40_50 {
038
039    public static org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.r4.model.CarePlan src) throws FHIRException {
040        if (src == null)
041            return null;
042        org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan();
043        copyDomainResource(src, tgt);
044        for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
045        for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) tgt.getInstantiatesCanonical().add(convertCanonical(t));
046        for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) tgt.getInstantiatesUri().add(convertUri(t));
047        for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(convertReference(t));
048        for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) tgt.addReplaces(convertReference(t));
049        for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addPartOf(convertReference(t));
050        if (src.hasStatus())
051            tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
052        if (src.hasIntent())
053            tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement()));
054        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) tgt.addCategory(convertCodeableConcept(t));
055        if (src.hasTitle())
056            tgt.setTitleElement(convertString(src.getTitleElement()));
057        if (src.hasDescription())
058            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
059        if (src.hasSubject())
060            tgt.setSubject(convertReference(src.getSubject()));
061        if (src.hasEncounter())
062            tgt.setEncounter(convertReference(src.getEncounter()));
063        if (src.hasPeriod())
064            tgt.setPeriod(convertPeriod(src.getPeriod()));
065        if (src.hasCreated())
066            tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
067        if (src.hasAuthor())
068            tgt.setAuthor(convertReference(src.getAuthor()));
069        for (org.hl7.fhir.r4.model.Reference t : src.getContributor()) tgt.addContributor(convertReference(t));
070        for (org.hl7.fhir.r4.model.Reference t : src.getCareTeam()) tgt.addCareTeam(convertReference(t));
071        for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) tgt.addAddresses(convertReferenceToCodeableReference(t));
072        for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) tgt.addSupportingInfo(convertReference(t));
073        for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) tgt.addGoal(convertReference(t));
074        for (org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t));
075        for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
076        return tgt;
077    }
078
079    public static org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException {
080        if (src == null)
081            return null;
082        org.hl7.fhir.r4.model.CarePlan tgt = new org.hl7.fhir.r4.model.CarePlan();
083        copyDomainResource(src, tgt);
084        for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
085        for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) tgt.getInstantiatesCanonical().add(convertCanonical(t));
086        for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) tgt.getInstantiatesUri().add(convertUri(t));
087        for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(convertReference(t));
088        for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) tgt.addReplaces(convertReference(t));
089        for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(convertReference(t));
090        if (src.hasStatus())
091            tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
092        if (src.hasIntent())
093            tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement()));
094        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(convertCodeableConcept(t));
095        if (src.hasTitle())
096            tgt.setTitleElement(convertString(src.getTitleElement()));
097        if (src.hasDescription())
098            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
099        if (src.hasSubject())
100            tgt.setSubject(convertReference(src.getSubject()));
101        if (src.hasEncounter())
102            tgt.setEncounter(convertReference(src.getEncounter()));
103        if (src.hasPeriod())
104            tgt.setPeriod(convertPeriod(src.getPeriod()));
105        if (src.hasCreated())
106            tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
107        if (src.hasAuthor())
108            tgt.setAuthor(convertReference(src.getAuthor()));
109        for (org.hl7.fhir.r5.model.Reference t : src.getContributor()) tgt.addContributor(convertReference(t));
110        for (org.hl7.fhir.r5.model.Reference t : src.getCareTeam()) tgt.addCareTeam(convertReference(t));
111        for (CodeableReference t : src.getAddresses()) if (t.hasReference())
112            tgt.addAddresses(convertReference(t.getReference()));
113        for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) tgt.addSupportingInfo(convertReference(t));
114        for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) tgt.addGoal(convertReference(t));
115        for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) tgt.addActivity(convertCarePlanActivityComponent(t));
116        for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
117        return tgt;
118    }
119
120    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestStatus> convertCarePlanStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanStatus> src) throws FHIRException {
121        if (src == null || src.isEmpty())
122            return null;
123        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestStatusEnumFactory());
124        VersionConvertor_40_50.copyElement(src, tgt);
125        switch(src.getValue()) {
126            case DRAFT:
127                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT);
128                break;
129            case ACTIVE:
130                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE);
131                break;
132            case ONHOLD:
133                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD);
134                break;
135            case REVOKED:
136                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED);
137                break;
138            case COMPLETED:
139                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED);
140                break;
141            case ENTEREDINERROR:
142                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR);
143                break;
144            case UNKNOWN:
145                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.UNKNOWN);
146                break;
147            default:
148                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL);
149                break;
150        }
151        return tgt;
152    }
153
154    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanStatus> convertCarePlanStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestStatus> src) throws FHIRException {
155        if (src == null || src.isEmpty())
156            return null;
157        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CarePlan.CarePlanStatusEnumFactory());
158        VersionConvertor_40_50.copyElement(src, tgt);
159        switch(src.getValue()) {
160            case DRAFT:
161                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT);
162                break;
163            case ACTIVE:
164                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE);
165                break;
166            case ONHOLD:
167                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ONHOLD);
168                break;
169            case REVOKED:
170                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.REVOKED);
171                break;
172            case COMPLETED:
173                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED);
174                break;
175            case ENTEREDINERROR:
176                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ENTEREDINERROR);
177                break;
178            case UNKNOWN:
179                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.UNKNOWN);
180                break;
181            default:
182                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL);
183                break;
184        }
185        return tgt;
186    }
187
188    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanIntent> convertCarePlanIntent(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanIntent> src) throws FHIRException {
189        if (src == null || src.isEmpty())
190            return null;
191        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanIntent> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CarePlan.CarePlanIntentEnumFactory());
192        VersionConvertor_40_50.copyElement(src, tgt);
193        switch(src.getValue()) {
194            case PROPOSAL:
195                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PROPOSAL);
196                break;
197            case PLAN:
198                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PLAN);
199                break;
200            case ORDER:
201                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.ORDER);
202                break;
203            case OPTION:
204                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.OPTION);
205                break;
206            default:
207                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.NULL);
208                break;
209        }
210        return tgt;
211    }
212
213    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanIntent> convertCarePlanIntent(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanIntent> src) throws FHIRException {
214        if (src == null || src.isEmpty())
215            return null;
216        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanIntent> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CarePlan.CarePlanIntentEnumFactory());
217        VersionConvertor_40_50.copyElement(src, tgt);
218        switch(src.getValue()) {
219            case PROPOSAL:
220                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PROPOSAL);
221                break;
222            case PLAN:
223                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PLAN);
224                break;
225            case ORDER:
226                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.ORDER);
227                break;
228            case OPTION:
229                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.OPTION);
230                break;
231            default:
232                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.NULL);
233                break;
234        }
235        return tgt;
236    }
237
238    public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent src) throws FHIRException {
239        if (src == null)
240            return null;
241        org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent();
242        copyElement(src, tgt);
243        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCodeableConcept()) tgt.addOutcome(convertCodeableConceptToCodeableReference(t));
244        for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) tgt.addOutcome(convertReferenceToCodeableReference(t));
245        for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) tgt.addProgress(convertAnnotation(t));
246        if (src.hasReference())
247            tgt.setReference(convertReference(src.getReference()));
248        if (src.hasDetail())
249            tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
250        return tgt;
251    }
252
253    public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException {
254        if (src == null)
255            return null;
256        org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent();
257        copyElement(src, tgt);
258        for (CodeableReference t : src.getOutcome()) if (t.hasConcept())
259            tgt.addOutcomeCodeableConcept(convertCodeableConcept(t.getConcept()));
260        for (CodeableReference t : src.getOutcome()) if (t.hasReference())
261            tgt.addOutcomeReference(convertReference(t.getReference()));
262        for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) tgt.addProgress(convertAnnotation(t));
263        if (src.hasReference())
264            tgt.setReference(convertReference(src.getReference()));
265        if (src.hasDetail())
266            tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
267        return tgt;
268    }
269
270    public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
271        if (src == null)
272            return null;
273        org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent();
274        copyElement(src, tgt);
275        if (src.hasKind())
276            tgt.setKindElement(convertCarePlanActivityKind(src.getKindElement()));
277        for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) tgt.getInstantiatesCanonical().add(convertCanonical(t));
278        for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) tgt.getInstantiatesUri().add(convertUri(t));
279        if (src.hasCode())
280            tgt.setCode(convertCodeableConcept(src.getCode()));
281        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(convertCodeableConceptToCodeableReference(t));
282        for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReason(convertReferenceToCodeableReference(t));
283        for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) tgt.addGoal(convertReference(t));
284        if (src.hasStatus())
285            tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement()));
286        if (src.hasStatusReason())
287            tgt.setStatusReason(convertCodeableConcept(src.getStatusReason()));
288        if (src.hasDoNotPerform())
289            tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement()));
290        if (src.hasScheduled())
291            tgt.setScheduled(convertType(src.getScheduled()));
292        if (src.hasLocation())
293            tgt.getLocation().setReference(convertReference(src.getLocation()));
294        for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) tgt.addPerformer(convertReference(t));
295        if (src.hasProduct())
296            tgt.setProduct(convertType(src.getProduct()));
297        if (src.hasDailyAmount())
298            tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount()));
299        if (src.hasQuantity())
300            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
301        if (src.hasDescription())
302            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
303        return tgt;
304    }
305
306    public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
307        if (src == null)
308            return null;
309        org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent();
310        copyElement(src, tgt);
311        if (src.hasKind())
312            tgt.setKindElement(convertCarePlanActivityKind(src.getKindElement()));
313        for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) tgt.getInstantiatesCanonical().add(convertCanonical(t));
314        for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) tgt.getInstantiatesUri().add(convertUri(t));
315        if (src.hasCode())
316            tgt.setCode(convertCodeableConcept(src.getCode()));
317        for (CodeableReference t : src.getReason()) if (t.hasConcept())
318            tgt.addReasonCode(convertCodeableConcept(t.getConcept()));
319        for (CodeableReference t : src.getReason()) if (t.hasReference())
320            tgt.addReasonReference(convertReference(t.getReference()));
321        for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) tgt.addGoal(convertReference(t));
322        if (src.hasStatus())
323            tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement()));
324        if (src.hasStatusReason())
325            tgt.setStatusReason(convertCodeableConcept(src.getStatusReason()));
326        if (src.hasDoNotPerform())
327            tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement()));
328        if (src.hasScheduled())
329            tgt.setScheduled(convertType(src.getScheduled()));
330        if (src.getLocation().hasReference())
331            tgt.setLocation(convertReference(src.getLocation().getReference()));
332        for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) tgt.addPerformer(convertReference(t));
333        if (src.hasProduct())
334            tgt.setProduct(convertType(src.getProduct()));
335        if (src.hasDailyAmount())
336            tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount()));
337        if (src.hasQuantity())
338            tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
339        if (src.hasDescription())
340            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
341        return tgt;
342    }
343
344    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind> convertCarePlanActivityKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind> src) throws FHIRException {
345        if (src == null || src.isEmpty())
346            return null;
347        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKindEnumFactory());
348        VersionConvertor_40_50.copyElement(src, tgt);
349        switch(src.getValue()) {
350            case APPOINTMENT:
351                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.APPOINTMENT);
352                break;
353            case COMMUNICATIONREQUEST:
354                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.COMMUNICATIONREQUEST);
355                break;
356            case DEVICEREQUEST:
357                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.DEVICEREQUEST);
358                break;
359            case MEDICATIONREQUEST:
360                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.MEDICATIONREQUEST);
361                break;
362            case NUTRITIONORDER:
363                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.NUTRITIONORDER);
364                break;
365            case TASK:
366                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.TASK);
367                break;
368            case SERVICEREQUEST:
369                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.SERVICEREQUEST);
370                break;
371            case VISIONPRESCRIPTION:
372                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.VISIONPRESCRIPTION);
373                break;
374            default:
375                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.NULL);
376                break;
377        }
378        return tgt;
379    }
380
381    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind> convertCarePlanActivityKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind> src) throws FHIRException {
382        if (src == null || src.isEmpty())
383            return null;
384        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKindEnumFactory());
385        VersionConvertor_40_50.copyElement(src, tgt);
386        switch(src.getValue()) {
387            case APPOINTMENT:
388                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.APPOINTMENT);
389                break;
390            case COMMUNICATIONREQUEST:
391                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.COMMUNICATIONREQUEST);
392                break;
393            case DEVICEREQUEST:
394                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.DEVICEREQUEST);
395                break;
396            case MEDICATIONREQUEST:
397                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.MEDICATIONREQUEST);
398                break;
399            case NUTRITIONORDER:
400                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.NUTRITIONORDER);
401                break;
402            case TASK:
403                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.TASK);
404                break;
405            case SERVICEREQUEST:
406                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.SERVICEREQUEST);
407                break;
408            case VISIONPRESCRIPTION:
409                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.VISIONPRESCRIPTION);
410                break;
411            default:
412                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.NULL);
413                break;
414        }
415        return tgt;
416    }
417
418    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus> convertCarePlanActivityStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus> src) throws FHIRException {
419        if (src == null || src.isEmpty())
420            return null;
421        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatusEnumFactory());
422        VersionConvertor_40_50.copyElement(src, tgt);
423        switch(src.getValue()) {
424            case NOTSTARTED:
425                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED);
426                break;
427            case SCHEDULED:
428                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED);
429                break;
430            case INPROGRESS:
431                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS);
432                break;
433            case ONHOLD:
434                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD);
435                break;
436            case COMPLETED:
437                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED);
438                break;
439            case CANCELLED:
440                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED);
441                break;
442            case STOPPED:
443                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.STOPPED);
444                break;
445            case UNKNOWN:
446                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.UNKNOWN);
447                break;
448            case ENTEREDINERROR:
449                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ENTEREDINERROR);
450                break;
451            default:
452                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL);
453                break;
454        }
455        return tgt;
456    }
457
458    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus> convertCarePlanActivityStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus> src) throws FHIRException {
459        if (src == null || src.isEmpty())
460            return null;
461        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatusEnumFactory());
462        VersionConvertor_40_50.copyElement(src, tgt);
463        switch(src.getValue()) {
464            case NOTSTARTED:
465                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NOTSTARTED);
466                break;
467            case SCHEDULED:
468                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.SCHEDULED);
469                break;
470            case INPROGRESS:
471                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.INPROGRESS);
472                break;
473            case ONHOLD:
474                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ONHOLD);
475                break;
476            case COMPLETED:
477                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.COMPLETED);
478                break;
479            case CANCELLED:
480                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.CANCELLED);
481                break;
482            case STOPPED:
483                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.STOPPED);
484                break;
485            case UNKNOWN:
486                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.UNKNOWN);
487                break;
488            case ENTEREDINERROR:
489                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ENTEREDINERROR);
490                break;
491            default:
492                tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NULL);
493                break;
494        }
495        return tgt;
496    }
497}