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.Dosage30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Annotation30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Duration30_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.complextypes30_50.SimpleQuantity30_50;
012import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
013import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
014import org.hl7.fhir.exceptions.FHIRException;
015import org.hl7.fhir.r5.model.CodeableReference;
016
017public class MedicationRequest30_50 {
018
019  public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r5.model.MedicationRequest src) throws FHIRException {
020    if (src == null)
021      return null;
022    org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest();
023    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
024    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
025      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
026    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference30_50.convertReference(t));
027    if (src.hasGroupIdentifier())
028      tgt.setGroupIdentifier(Identifier30_50.convertIdentifier(src.getGroupIdentifier()));
029    if (src.hasStatus())
030      tgt.setStatusElement(convertMedicationRequestStatus(src.getStatusElement()));
031    if (src.hasIntent())
032      tgt.setIntentElement(convertMedicationRequestIntent(src.getIntentElement()));
033    if (src.hasPriority())
034      tgt.setPriorityElement(convertMedicationRequestPriority(src.getPriorityElement()));
035    if (src.getMedication().hasConcept())
036      tgt.setMedication(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getMedication().getConcept()));
037    if (src.getMedication().hasReference())
038      tgt.setMedication(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getMedication().getReference()));
039    if (src.hasSubject())
040      tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
041    if (src.hasEncounter())
042      tgt.setContext(Reference30_50.convertReference(src.getEncounter()));
043    for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation())
044      tgt.addSupportingInformation(Reference30_50.convertReference(t));
045    if (src.hasAuthoredOn())
046      tgt.setAuthoredOnElement(DateTime30_50.convertDateTime(src.getAuthoredOnElement()));
047    if (src.hasRecorder())
048      tgt.setRecorder(Reference30_50.convertReference(src.getRecorder()));
049    for (CodeableReference t : src.getReason()) {
050      if (t.hasConcept()) {
051        tgt.addReasonCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
052      }
053      if (t.hasReference()) {
054        tgt.addReasonReference(Reference30_50.convertReference(t.getReference()));
055      }
056    }
057    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
058    for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction())
059      tgt.addDosageInstruction(Dosage30_50.convertDosage(t));
060    if (src.hasDispenseRequest())
061      tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest()));
062    if (src.hasSubstitution())
063      tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution()));
064    if (src.hasPriorPrescription())
065      tgt.setPriorPrescription(Reference30_50.convertReference(src.getPriorPrescription()));
066//    for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue())
067//      tgt.addDetectedIssue(Reference30_50.convertReference(t));
068    for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory())
069      tgt.addEventHistory(Reference30_50.convertReference(t));
070    return tgt;
071  }
072
073  public static org.hl7.fhir.r5.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest src) throws FHIRException {
074    if (src == null)
075      return null;
076    org.hl7.fhir.r5.model.MedicationRequest tgt = new org.hl7.fhir.r5.model.MedicationRequest();
077    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
078    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
079      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
080    for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference30_50.convertReference(t));
081    if (src.hasGroupIdentifier())
082      tgt.setGroupIdentifier(Identifier30_50.convertIdentifier(src.getGroupIdentifier()));
083    if (src.hasStatus())
084      tgt.setStatusElement(convertMedicationRequestStatus(src.getStatusElement()));
085    if (src.hasIntent())
086      tgt.setIntentElement(convertMedicationRequestIntent(src.getIntentElement()));
087    if (src.hasPriority())
088      tgt.setPriorityElement(convertMedicationRequestPriority(src.getPriorityElement()));
089    if (src.hasMedicationCodeableConcept())
090      tgt.getMedication().setConcept(CodeableConcept30_50.convertCodeableConcept(src.getMedicationCodeableConcept()));
091    if (src.hasMedicationReference())
092      tgt.getMedication().setReference(Reference30_50.convertReference(src.getMedicationReference()));
093    if (src.hasSubject())
094      tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
095    if (src.hasContext())
096      tgt.setEncounter(Reference30_50.convertReference(src.getContext()));
097    for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation())
098      tgt.addSupportingInformation(Reference30_50.convertReference(t));
099    if (src.hasAuthoredOn())
100      tgt.setAuthoredOnElement(DateTime30_50.convertDateTime(src.getAuthoredOnElement()));
101    if (src.hasRecorder())
102      tgt.setRecorder(Reference30_50.convertReference(src.getRecorder()));
103    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode())
104      tgt.addReason(new CodeableReference().setConcept(CodeableConcept30_50.convertCodeableConcept(t)));
105    for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference())
106      tgt.addReason(new CodeableReference().setReference(Reference30_50.convertReference(t)));
107    for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
108    for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction())
109      tgt.addDosageInstruction(Dosage30_50.convertDosage(t));
110    if (src.hasDispenseRequest())
111      tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest()));
112    if (src.hasSubstitution())
113      tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution()));
114    if (src.hasPriorPrescription())
115      tgt.setPriorPrescription(Reference30_50.convertReference(src.getPriorPrescription()));
116//    for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue())
117//      tgt.addDetectedIssue(Reference30_50.convertReference(t));
118    for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory())
119      tgt.addEventHistory(Reference30_50.convertReference(t));
120    return tgt;
121  }
122
123  public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException {
124    if (src == null)
125      return null;
126    org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent();
127    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
128    if (src.hasValidityPeriod())
129      tgt.setValidityPeriod(Period30_50.convertPeriod(src.getValidityPeriod()));
130    if (src.hasNumberOfRepeatsAllowed())
131      tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed());
132    if (src.hasQuantity())
133      tgt.setQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getQuantity()));
134    if (src.hasExpectedSupplyDuration())
135      tgt.setExpectedSupplyDuration(Duration30_50.convertDuration(src.getExpectedSupplyDuration()));
136    if (src.hasPerformer())
137      tgt.setDispenser(Reference30_50.convertReference(src.getPerformer()));
138    return tgt;
139  }
140
141  public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException {
142    if (src == null)
143      return null;
144    org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent();
145    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
146    if (src.hasValidityPeriod())
147      tgt.setValidityPeriod(Period30_50.convertPeriod(src.getValidityPeriod()));
148    if (src.hasNumberOfRepeatsAllowed())
149      tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed());
150    if (src.hasQuantity())
151      tgt.setQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getQuantity()));
152    if (src.hasExpectedSupplyDuration())
153      tgt.setExpectedSupplyDuration(Duration30_50.convertDuration(src.getExpectedSupplyDuration()));
154    if (src.hasDispenser())
155      tgt.setPerformer(Reference30_50.convertReference(src.getDispenser()));
156    return tgt;
157  }
158
159  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent> convertMedicationRequestIntent(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent> src) throws FHIRException {
160    if (src == null || src.isEmpty())
161      return null;
162    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntentEnumFactory());
163    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
164    switch (src.getValue()) {
165      case PROPOSAL:
166        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PROPOSAL);
167        break;
168      case PLAN:
169        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PLAN);
170        break;
171      case ORDER:
172        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORDER);
173        break;
174      case INSTANCEORDER:
175        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER);
176        break;
177      default:
178        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.NULL);
179        break;
180    }
181    return tgt;
182  }
183
184  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent> convertMedicationRequestIntent(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent> src) throws FHIRException {
185    if (src == null || src.isEmpty())
186      return null;
187    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntentEnumFactory());
188    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
189    switch (src.getValue()) {
190      case PROPOSAL:
191        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PROPOSAL);
192        break;
193      case PLAN:
194        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PLAN);
195        break;
196      case ORDER:
197        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.ORDER);
198        break;
199      case INSTANCEORDER:
200        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER);
201        break;
202      default:
203        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.NULL);
204        break;
205    }
206    return tgt;
207  }
208
209  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> convertMedicationRequestPriority(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority> src) throws FHIRException {
210    if (src == null || src.isEmpty())
211      return null;
212    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestPriorityEnumFactory());
213    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
214    switch (src.getValue()) {
215      case ROUTINE:
216        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE);
217        break;
218      case URGENT:
219        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT);
220        break;
221      case STAT:
222        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT);
223        break;
224      case ASAP:
225        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP);
226        break;
227      default:
228        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL);
229        break;
230    }
231    return tgt;
232  }
233
234  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority> convertMedicationRequestPriority(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> src) throws FHIRException {
235    if (src == null || src.isEmpty())
236      return null;
237    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriorityEnumFactory());
238    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
239    switch (src.getValue()) {
240      case ROUTINE:
241        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ROUTINE);
242        break;
243      case URGENT:
244        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.URGENT);
245        break;
246      case STAT:
247        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.STAT);
248        break;
249      case ASAP:
250        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ASAP);
251        break;
252      default:
253        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.NULL);
254        break;
255    }
256    return tgt;
257  }
258
259  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus> convertMedicationRequestStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus> src) throws FHIRException {
260    if (src == null || src.isEmpty())
261      return null;
262    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatusEnumFactory());
263    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
264    switch (src.getValue()) {
265      case ACTIVE:
266        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ACTIVE);
267        break;
268      case ONHOLD:
269        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ONHOLD);
270        break;
271      case CANCELLED:
272        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.CANCELLED);
273        break;
274      case COMPLETED:
275        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.COMPLETED);
276        break;
277      case ENTEREDINERROR:
278        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ENTEREDINERROR);
279        break;
280      case STOPPED:
281        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.STOPPED);
282        break;
283      case DRAFT:
284        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.DRAFT);
285        break;
286      case UNKNOWN:
287        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.UNKNOWN);
288        break;
289      default:
290        tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.NULL);
291        break;
292    }
293    return tgt;
294  }
295
296  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus> convertMedicationRequestStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus> src) throws FHIRException {
297    if (src == null || src.isEmpty())
298      return null;
299    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatusEnumFactory());
300    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
301    switch (src.getValue()) {
302      case ACTIVE:
303        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ACTIVE);
304        break;
305      case ONHOLD:
306        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ONHOLD);
307        break;
308      case CANCELLED:
309        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.CANCELLED);
310        break;
311      case COMPLETED:
312        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.COMPLETED);
313        break;
314      case ENTEREDINERROR:
315        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR);
316        break;
317      case STOPPED:
318        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.STOPPED);
319        break;
320      case DRAFT:
321        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.DRAFT);
322        break;
323      case UNKNOWN:
324        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.UNKNOWN);
325        break;
326      default:
327        tgt.setValue(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.NULL);
328        break;
329    }
330    return tgt;
331  }
332
333  public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException {
334    if (src == null)
335      return null;
336    org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent();
337    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
338    if (src.hasAllowed())
339      tgt.setAllowed(Boolean30_50.convertBoolean(src.getAllowedElement()));
340    if (src.hasReason())
341      tgt.setReason(CodeableConcept30_50.convertCodeableConcept(src.getReason()));
342    return tgt;
343  }
344
345  public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException {
346    if (src == null)
347      return null;
348    org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent();
349    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
350    if (src.hasAllowedBooleanType())
351      tgt.setAllowedElement(Boolean30_50.convertBoolean(src.getAllowedBooleanType()));
352    if (src.hasReason())
353      tgt.setReason(CodeableConcept30_50.convertCodeableConcept(src.getReason()));
354    return tgt;
355  }
356}