001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.*;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
008import org.hl7.fhir.dstu3.model.Reference;
009import org.hl7.fhir.exceptions.FHIRException;
010import org.hl7.fhir.r5.model.CodeableReference;
011import org.hl7.fhir.r5.model.Coding;
012
013import java.util.List;
014
015public class CarePlan30_50 {
016
017  private static final String CarePlanActivityDetailComponentExtension = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CarePlan.activity.detail.category";
018
019  public static org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException {
020    if (src == null)
021      return null;
022    org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan();
023    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
024    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
025      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
026    for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) {
027      tgt.addBasedOn(Reference30_50.convertReference(t));
028    }
029    for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) {
030      tgt.addReplaces(Reference30_50.convertReference(t));
031    }
032    for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) {
033      tgt.addPartOf(Reference30_50.convertReference(t));
034    }
035    if (src.hasStatus()) {
036      if (src.hasStatus())
037        tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
038    }
039    if (src.hasIntent()) {
040      if (src.hasIntent())
041        tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement()));
042    }
043    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) {
044      tgt.addCategory(CodeableConcept30_50.convertCodeableConcept(t));
045    }
046    if (src.hasTitle()) {
047      if (src.hasTitleElement())
048        tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
049    }
050    if (src.hasDescription()) {
051      if (src.hasDescriptionElement())
052        tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
053    }
054    if (src.hasSubject()) {
055      if (src.hasSubject())
056        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
057    }
058    if (src.hasContext()) {
059      if (src.hasContext())
060        tgt.setEncounter(Reference30_50.convertReference(src.getContext()));
061    }
062    if (src.hasPeriod()) {
063      if (src.hasPeriod())
064        tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod()));
065    }
066    List<Reference> authors = src.getAuthor();
067    if (authors.size() > 0) {
068      tgt.setAuthor(Reference30_50.convertReference(authors.get(0)));
069      if (authors.size() > 1) {
070      }
071    }
072    for (org.hl7.fhir.dstu3.model.Reference t : src.getCareTeam()) {
073      tgt.addCareTeam(Reference30_50.convertReference(t));
074    }
075    for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) {
076      tgt.addAddresses(Reference30_50.convertReferenceToCodableReference(t));
077    }
078    for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) {
079      tgt.addSupportingInfo(Reference30_50.convertReference(t));
080    }
081    for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) {
082      tgt.addGoal(Reference30_50.convertReference(t));
083    }
084    for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) {
085      tgt.addActivity(convertCarePlanActivityComponent(t));
086    }
087    for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) {
088      tgt.addNote(Annotation30_50.convertAnnotation(t));
089    }
090    return tgt;
091  }
092
093  public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException {
094    if (src == null)
095      return null;
096    org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan();
097    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
098    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
099      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
100    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) {
101      tgt.addBasedOn(Reference30_50.convertReference(t));
102    }
103    for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) {
104      tgt.addReplaces(Reference30_50.convertReference(t));
105    }
106    for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) {
107      tgt.addPartOf(Reference30_50.convertReference(t));
108    }
109    if (src.hasStatus()) {
110      if (src.hasStatus())
111        tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement()));
112    }
113    if (src.hasIntent()) {
114      if (src.hasIntent())
115        tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement()));
116    }
117    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) {
118      tgt.addCategory(CodeableConcept30_50.convertCodeableConcept(t));
119    }
120    if (src.hasTitle()) {
121      if (src.hasTitleElement())
122        tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
123    }
124    if (src.hasDescription()) {
125      if (src.hasDescriptionElement())
126        tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
127    }
128    if (src.hasSubject()) {
129      if (src.hasSubject())
130        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
131    }
132    if (src.hasEncounter()) {
133      if (src.hasEncounter())
134        tgt.setContext(Reference30_50.convertReference(src.getEncounter()));
135    }
136    if (src.hasPeriod()) {
137      if (src.hasPeriod())
138        tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod()));
139    }
140    if (src.hasAuthor()) {
141      if (src.hasAuthor())
142        tgt.addAuthor(Reference30_50.convertReference(src.getAuthor()));
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().copyElement(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().copyElement(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().copyElement(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().copyElement(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}