001package org.hl7.fhir.convertors.conv30_50;
002
003import java.util.List;
004import org.hl7.fhir.convertors.VersionConvertor_30_50;
005import org.hl7.fhir.dstu3.model.Reference;
006import org.hl7.fhir.exceptions.FHIRException;
007import org.hl7.fhir.r5.model.CodeableReference;
008import org.hl7.fhir.r5.model.Coding;
009
010public class CarePlan30_50 {
011
012    private static final String CarePlanActivityDetailComponentExtension = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CarePlan.activity.detail.category";
013
014    public static org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException {
015        if (src == null)
016            return null;
017        org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan();
018        VersionConvertor_30_50.copyDomainResource(src, tgt);
019        for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t));
020        for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) {
021            tgt.addBasedOn(VersionConvertor_30_50.convertReference(t));
022        }
023        for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) {
024            tgt.addReplaces(VersionConvertor_30_50.convertReference(t));
025        }
026        for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) {
027            tgt.addPartOf(VersionConvertor_30_50.convertReference(t));
028        }
029        if (src.hasStatus()) {
030            if (src.hasStatus())
031                tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
032        }
033        if (src.hasIntent()) {
034            if (src.hasIntent())
035                tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement()));
036        }
037        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) {
038            tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t));
039        }
040        if (src.hasTitle()) {
041            if (src.hasTitleElement())
042                tgt.setTitleElement(VersionConvertor_30_50.convertString(src.getTitleElement()));
043        }
044        if (src.hasDescription()) {
045            if (src.hasDescriptionElement())
046                tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
047        }
048        if (src.hasSubject()) {
049            if (src.hasSubject())
050                tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject()));
051        }
052        if (src.hasContext()) {
053            if (src.hasContext())
054                tgt.setEncounter(VersionConvertor_30_50.convertReference(src.getContext()));
055        }
056        if (src.hasPeriod()) {
057            if (src.hasPeriod())
058                tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod()));
059        }
060        List<Reference> authors = src.getAuthor();
061        if (authors.size() > 0) {
062            tgt.setAuthor(VersionConvertor_30_50.convertReference(authors.get(0)));
063            if (authors.size() > 1) {
064            }
065        }
066        for (org.hl7.fhir.dstu3.model.Reference t : src.getCareTeam()) {
067            tgt.addCareTeam(VersionConvertor_30_50.convertReference(t));
068        }
069        for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) {
070            tgt.addAddresses(VersionConvertor_30_50.convertReferenceToCodableReference(t));
071        }
072        for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) {
073            tgt.addSupportingInfo(VersionConvertor_30_50.convertReference(t));
074        }
075        for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) {
076            tgt.addGoal(VersionConvertor_30_50.convertReference(t));
077        }
078        for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) {
079            tgt.addActivity(convertCarePlanActivityComponent(t));
080        }
081        for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) {
082            tgt.addNote(VersionConvertor_30_50.convertAnnotation(t));
083        }
084        return tgt;
085    }
086
087    public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException {
088        if (src == null)
089            return null;
090        org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan();
091        VersionConvertor_30_50.copyDomainResource(src, tgt);
092        for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t));
093        for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) {
094            tgt.addBasedOn(VersionConvertor_30_50.convertReference(t));
095        }
096        for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) {
097            tgt.addReplaces(VersionConvertor_30_50.convertReference(t));
098        }
099        for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) {
100            tgt.addPartOf(VersionConvertor_30_50.convertReference(t));
101        }
102        if (src.hasStatus()) {
103            if (src.hasStatus())
104                tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
105        }
106        if (src.hasIntent()) {
107            if (src.hasIntent())
108                tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement()));
109        }
110        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) {
111            tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t));
112        }
113        if (src.hasTitle()) {
114            if (src.hasTitleElement())
115                tgt.setTitleElement(VersionConvertor_30_50.convertString(src.getTitleElement()));
116        }
117        if (src.hasDescription()) {
118            if (src.hasDescriptionElement())
119                tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
120        }
121        if (src.hasSubject()) {
122            if (src.hasSubject())
123                tgt.setSubject(VersionConvertor_30_50.convertReference(src.getSubject()));
124        }
125        if (src.hasEncounter()) {
126            if (src.hasEncounter())
127                tgt.setContext(VersionConvertor_30_50.convertReference(src.getEncounter()));
128        }
129        if (src.hasPeriod()) {
130            if (src.hasPeriod())
131                tgt.setPeriod(VersionConvertor_30_50.convertPeriod(src.getPeriod()));
132        }
133        if (src.hasAuthor()) {
134            if (src.hasAuthor())
135                tgt.addAuthor(VersionConvertor_30_50.convertReference(src.getAuthor()));
136        }
137        for (org.hl7.fhir.r5.model.Reference t : src.getCareTeam()) {
138            tgt.addCareTeam(VersionConvertor_30_50.convertReference(t));
139        }
140        for (CodeableReference t : src.getAddresses()) {
141            if (t.hasReference())
142                tgt.addAddresses(VersionConvertor_30_50.convertReference(t.getReference()));
143        }
144        for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) {
145            tgt.addSupportingInfo(VersionConvertor_30_50.convertReference(t));
146        }
147        for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) {
148            tgt.addGoal(VersionConvertor_30_50.convertReference(t));
149        }
150        for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) {
151            tgt.addActivity(convertCarePlanActivityComponent(t));
152        }
153        for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) {
154            tgt.addNote(VersionConvertor_30_50.convertAnnotation(t));
155        }
156        return tgt;
157    }
158
159    public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException {
160        if (src == null)
161            return null;
162        org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent();
163        VersionConvertor_30_50.copyElement(src, tgt);
164        for (CodeableReference t : src.getOutcome()) {
165            if (t.hasConcept())
166                tgt.addOutcomeCodeableConcept(VersionConvertor_30_50.convertCodeableConcept(t.getConcept()));
167        }
168        for (CodeableReference t : src.getOutcome()) {
169            if (t.hasReference())
170                tgt.addOutcomeReference(VersionConvertor_30_50.convertReference(t.getReference()));
171        }
172        for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) {
173            tgt.addProgress(VersionConvertor_30_50.convertAnnotation(t));
174        }
175        if (src.hasReference()) {
176            if (src.hasReference())
177                tgt.setReference(VersionConvertor_30_50.convertReference(src.getReference()));
178        }
179        if (src.hasDetail()) {
180            if (src.hasDetail())
181                tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
182        }
183        return tgt;
184    }
185
186    public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException {
187        if (src == null)
188            return null;
189        org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent();
190        VersionConvertor_30_50.copyElement(src, tgt);
191        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCodeableConcept()) {
192            tgt.addOutcome(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t));
193        }
194        for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) {
195            tgt.addOutcome(VersionConvertor_30_50.convertReferenceToCodableReference(t));
196        }
197        for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) {
198            tgt.addProgress(VersionConvertor_30_50.convertAnnotation(t));
199        }
200        if (src.hasReference()) {
201            if (src.hasReference())
202                tgt.setReference(VersionConvertor_30_50.convertReference(src.getReference()));
203        }
204        if (src.hasDetail()) {
205            if (src.hasDetail())
206                tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
207        }
208        return tgt;
209    }
210
211    public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
212        if (src == null)
213            return null;
214        org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent();
215        VersionConvertor_30_50.copyElement(src, tgt);
216        if (src.hasExtension()) {
217            org.hl7.fhir.r5.model.Extension extension = src.getExtensionByUrl(CarePlanActivityDetailComponentExtension);
218            if (extension != null) {
219                org.hl7.fhir.r5.model.DataType value = extension.getValue();
220                if (value instanceof org.hl7.fhir.r5.model.CodeableConcept) {
221                    tgt.setCategory(VersionConvertor_30_50.convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) value));
222                }
223            }
224        }
225        if (src.hasCode()) {
226            if (src.hasCode())
227                tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
228        }
229        for (CodeableReference t : src.getReason()) {
230            if (t.hasConcept())
231                tgt.addReasonCode(VersionConvertor_30_50.convertCodeableConcept(t.getConcept()));
232        }
233        for (CodeableReference t : src.getReason()) {
234            if (t.hasReference())
235                tgt.addReasonReference(VersionConvertor_30_50.convertReference(t.getReference()));
236        }
237        for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) {
238            tgt.addGoal(VersionConvertor_30_50.convertReference(t));
239        }
240        if (src.hasStatus()) {
241            if (src.hasStatus())
242                tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement()));
243        }
244        if (src.hasStatusReason()) {
245            List<Coding> coding = src.getStatusReason().getCoding();
246            if (coding.size() > 0) {
247                tgt.setStatusReason(coding.get(0).getCode());
248            }
249        }
250        if (src.hasDoNotPerform()) {
251            if (src.hasDoNotPerformElement())
252                tgt.setProhibitedElement(VersionConvertor_30_50.convertBoolean(src.getDoNotPerformElement()));
253        }
254        if (src.hasScheduled()) {
255            if (src.hasScheduled())
256                tgt.setScheduled(VersionConvertor_30_50.convertType(src.getScheduled()));
257        }
258        if (src.hasLocation()) {
259            if (src.getLocation().hasReference())
260                tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation().getReference()));
261        }
262        for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) {
263            tgt.addPerformer(VersionConvertor_30_50.convertReference(t));
264        }
265        if (src.hasProduct()) {
266            if (src.hasProduct())
267                tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct()));
268        }
269        if (src.hasDailyAmount()) {
270            if (src.hasDailyAmount())
271                tgt.setDailyAmount(VersionConvertor_30_50.convertSimpleQuantity(src.getDailyAmount()));
272        }
273        if (src.hasQuantity()) {
274            if (src.hasQuantity())
275                tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity()));
276        }
277        if (src.hasDescription()) {
278            if (src.hasDescriptionElement())
279                tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
280        }
281        return tgt;
282    }
283
284    public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
285        if (src == null)
286            return null;
287        org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent();
288        VersionConvertor_30_50.copyElement(src, tgt);
289        if (src.hasCategory()) {
290            org.hl7.fhir.r5.model.Extension t = new org.hl7.fhir.r5.model.Extension();
291            t.setUrl(CarePlanActivityDetailComponentExtension);
292            t.setValue(VersionConvertor_30_50.convertType(src.getCategory()));
293            tgt.addExtension(t);
294        }
295        if (src.hasCode()) {
296            if (src.hasCode())
297                tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
298        }
299        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) {
300            tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t));
301        }
302        for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) {
303            tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t));
304        }
305        for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) {
306            tgt.addGoal(VersionConvertor_30_50.convertReference(t));
307        }
308        if (src.hasStatus()) {
309            if (src.hasStatus())
310                tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement()));
311        }
312        if (src.hasStatusReason()) {
313            org.hl7.fhir.r5.model.Coding code = new org.hl7.fhir.r5.model.Coding();
314            code.setCode(src.getStatusReason());
315            org.hl7.fhir.r5.model.CodeableConcept t = new org.hl7.fhir.r5.model.CodeableConcept(code);
316            tgt.setStatusReason(t);
317        }
318        if (src.hasProhibited()) {
319            if (src.hasProhibitedElement())
320                tgt.setDoNotPerformElement(VersionConvertor_30_50.convertBoolean(src.getProhibitedElement()));
321        }
322        if (src.hasScheduled()) {
323            if (src.hasScheduled())
324                tgt.setScheduled(VersionConvertor_30_50.convertType(src.getScheduled()));
325        }
326        if (src.hasLocation()) {
327            if (src.hasLocation())
328                tgt.getLocation().setReference(VersionConvertor_30_50.convertReference(src.getLocation()));
329        }
330        for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) {
331            tgt.addPerformer(VersionConvertor_30_50.convertReference(t));
332        }
333        if (src.hasProduct()) {
334            if (src.hasProduct())
335                tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct()));
336        }
337        if (src.hasDailyAmount()) {
338            if (src.hasDailyAmount())
339                tgt.setDailyAmount(VersionConvertor_30_50.convertSimpleQuantity(src.getDailyAmount()));
340        }
341        if (src.hasQuantity()) {
342            if (src.hasQuantity())
343                tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity()));
344        }
345        if (src.hasDescription()) {
346            if (src.hasDescriptionElement())
347                tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
348        }
349        return tgt;
350    }
351
352    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus> convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus> src) throws FHIRException {
353        if (src == null || src.isEmpty())
354            return null;
355        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());
356        VersionConvertor_30_50.copyElement(src, tgt);
357        switch(src.getValue()) {
358            case CANCELLED:
359                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED);
360                break;
361            case COMPLETED:
362                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED);
363                break;
364            case INPROGRESS:
365                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS);
366                break;
367            case NOTSTARTED:
368                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED);
369                break;
370            case ONHOLD:
371                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD);
372                break;
373            case SCHEDULED:
374                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED);
375                break;
376            case UNKNOWN:
377                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.UNKNOWN);
378                break;
379            default:
380                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL);
381                break;
382        }
383        return tgt;
384    }
385
386    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus> convertCarePlanActivityStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus> src) throws FHIRException {
387        if (src == null || src.isEmpty())
388            return null;
389        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatusEnumFactory());
390        VersionConvertor_30_50.copyElement(src, tgt);
391        switch(src.getValue()) {
392            case CANCELLED:
393                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED);
394                break;
395            case COMPLETED:
396                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED);
397                break;
398            case INPROGRESS:
399                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS);
400                break;
401            case NOTSTARTED:
402                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED);
403                break;
404            case ONHOLD:
405                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD);
406                break;
407            case SCHEDULED:
408                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED);
409                break;
410            case UNKNOWN:
411                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.UNKNOWN);
412                break;
413            default:
414                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL);
415                break;
416        }
417        return tgt;
418    }
419
420    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent> convertCarePlanIntent(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanIntent> src) throws FHIRException {
421        if (src == null || src.isEmpty())
422            return null;
423        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntentEnumFactory());
424        VersionConvertor_30_50.copyElement(src, tgt);
425        switch(src.getValue()) {
426            case OPTION:
427                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.OPTION);
428                break;
429            case ORDER:
430                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.ORDER);
431                break;
432            case PLAN:
433                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PLAN);
434                break;
435            case PROPOSAL:
436                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.PROPOSAL);
437                break;
438            default:
439                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent.NULL);
440                break;
441        }
442        return tgt;
443    }
444
445    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CarePlan.CarePlanIntent> convertCarePlanIntent(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent> src) throws FHIRException {
446        if (src == null || src.isEmpty())
447            return null;
448        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());
449        VersionConvertor_30_50.copyElement(src, tgt);
450        switch(src.getValue()) {
451            case OPTION:
452                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.OPTION);
453                break;
454            case ORDER:
455                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.ORDER);
456                break;
457            case PLAN:
458                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PLAN);
459                break;
460            case PROPOSAL:
461                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PROPOSAL);
462                break;
463            default:
464                tgt.setValue(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.NULL);
465                break;
466        }
467        return tgt;
468    }
469
470    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus> convertCarePlanStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestStatus> src) throws FHIRException {
471        if (src == null || src.isEmpty())
472            return null;
473        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatusEnumFactory());
474        VersionConvertor_30_50.copyElement(src, tgt);
475        switch(src.getValue()) {
476            case ACTIVE:
477                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE);
478                break;
479            case REVOKED:
480                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED);
481                break;
482            case COMPLETED:
483                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED);
484                break;
485            case DRAFT:
486                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT);
487                break;
488            case ENTEREDINERROR:
489                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ENTEREDINERROR);
490                break;
491            case ONHOLD:
492                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.SUSPENDED);
493                break;
494            case UNKNOWN:
495                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.UNKNOWN);
496                break;
497            default:
498                tgt.setValue(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL);
499                break;
500        }
501        return tgt;
502    }
503
504    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestStatus> convertCarePlanStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus> src) throws FHIRException {
505        if (src == null || src.isEmpty())
506            return null;
507        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());
508        VersionConvertor_30_50.copyElement(src, tgt);
509        switch(src.getValue()) {
510            case ACTIVE:
511                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE);
512                break;
513            case CANCELLED:
514                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED);
515                break;
516            case COMPLETED:
517                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED);
518                break;
519            case DRAFT:
520                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT);
521                break;
522            case ENTEREDINERROR:
523                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR);
524                break;
525            case SUSPENDED:
526                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD);
527                break;
528            case UNKNOWN:
529                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.UNKNOWN);
530                break;
531            default:
532                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL);
533                break;
534        }
535        return tgt;
536    }
537}