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