001package org.hl7.fhir.convertors.conv43_50.resources43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Annotation43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
013import org.hl7.fhir.exceptions.FHIRException;
014import org.hl7.fhir.r5.model.CodeableReference;
015import org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestOrderDetailComponent;
016import org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestOrderDetailParameterComponent;
017
018/*
019  Copyright (c) 2011+, HL7, Inc.
020  All rights reserved.
021  
022  Redistribution and use in source and binary forms, with or without modification, 
023  are permitted provided that the following conditions are met:
024  
025   * Redistributions of source code must retain the above copyright notice, this 
026     list of conditions and the following disclaimer.
027   * Redistributions in binary form must reproduce the above copyright notice, 
028     this list of conditions and the following disclaimer in the documentation 
029     and/or other materials provided with the distribution.
030   * Neither the name of HL7 nor the names of its contributors may be used to 
031     endorse or promote products derived from this software without specific 
032     prior written permission.
033  
034  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
035  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
036  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
037  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
038  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
039  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
040  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
041  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
042  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
043  POSSIBILITY OF SUCH DAMAGE.
044  
045*/
046// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
047public class ServiceRequest43_50 {
048
049  public static org.hl7.fhir.r5.model.ServiceRequest convertServiceRequest(org.hl7.fhir.r4b.model.ServiceRequest src) throws FHIRException {
050    if (src == null)
051      return null;
052    org.hl7.fhir.r5.model.ServiceRequest tgt = new org.hl7.fhir.r5.model.ServiceRequest();
053    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
054    for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
055      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
056    for (org.hl7.fhir.r4b.model.CanonicalType t : src.getInstantiatesCanonical())
057      tgt.getInstantiatesCanonical().add(Canonical43_50.convertCanonical(t));
058    for (org.hl7.fhir.r4b.model.UriType t : src.getInstantiatesUri())
059      tgt.getInstantiatesUri().add(Uri43_50.convertUri(t));
060    for (org.hl7.fhir.r4b.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference43_50.convertReference(t));
061    for (org.hl7.fhir.r4b.model.Reference t : src.getReplaces()) tgt.addReplaces(Reference43_50.convertReference(t));
062    if (src.hasRequisition())
063      tgt.setRequisition(Identifier43_50.convertIdentifier(src.getRequisition()));
064    if (src.hasStatus())
065      tgt.setStatusElement(convertServiceRequestStatus(src.getStatusElement()));
066    if (src.hasIntent())
067      tgt.setIntentElement(convertServiceRequestIntent(src.getIntentElement()));
068    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getCategory())
069      tgt.addCategory(CodeableConcept43_50.convertCodeableConcept(t));
070    if (src.hasPriority())
071      tgt.setPriorityElement(convertServiceRequestPriority(src.getPriorityElement()));
072    if (src.hasDoNotPerform())
073      tgt.setDoNotPerformElement(Boolean43_50.convertBoolean(src.getDoNotPerformElement()));
074    if (src.hasCode())
075      tgt.setCode(CodeableConcept43_50.convertCodeableConceptToCodeableReference(src.getCode()));
076    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getOrderDetail())
077      tgt.addOrderDetail().addParameter().setValue(CodeableConcept43_50.convertCodeableConcept(t));
078    if (src.hasQuantity())
079      tgt.setQuantity(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getQuantity()));
080    if (src.hasSubject())
081      tgt.setSubject(Reference43_50.convertReference(src.getSubject()));
082    if (src.hasEncounter())
083      tgt.setEncounter(Reference43_50.convertReference(src.getEncounter()));
084    if (src.hasOccurrence())
085      tgt.setOccurrence(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOccurrence()));
086    if (src.hasAsNeeded())
087      tgt.setAsNeeded(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getAsNeeded()));
088    if (src.hasAuthoredOn())
089      tgt.setAuthoredOnElement(DateTime43_50.convertDateTime(src.getAuthoredOnElement()));
090    if (src.hasRequester())
091      tgt.setRequester(Reference43_50.convertReference(src.getRequester()));
092    if (src.hasPerformerType())
093      tgt.setPerformerType(CodeableConcept43_50.convertCodeableConcept(src.getPerformerType()));
094    for (org.hl7.fhir.r4b.model.Reference t : src.getPerformer()) tgt.addPerformer(Reference43_50.convertReference(t));
095    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getLocationCode())
096      tgt.addLocation(CodeableConcept43_50.convertCodeableConceptToCodeableReference(t));
097    for (org.hl7.fhir.r4b.model.Reference t : src.getLocationReference())
098      tgt.addLocation(Reference43_50.convertReferenceToCodeableReference(t));
099    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getReasonCode())
100      tgt.addReason(CodeableConcept43_50.convertCodeableConceptToCodeableReference(t));
101    for (org.hl7.fhir.r4b.model.Reference t : src.getReasonReference())
102      tgt.addReason(Reference43_50.convertReferenceToCodeableReference(t));
103    for (org.hl7.fhir.r4b.model.Reference t : src.getInsurance()) tgt.addInsurance(Reference43_50.convertReference(t));
104    for (org.hl7.fhir.r4b.model.Reference t : src.getSupportingInfo())
105      tgt.addSupportingInfo(Reference43_50.convertReferenceToCodeableReference(t));
106    for (org.hl7.fhir.r4b.model.Reference t : src.getSpecimen()) tgt.addSpecimen(Reference43_50.convertReference(t));
107    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getBodySite())
108      tgt.addBodySite(CodeableConcept43_50.convertCodeableConcept(t));
109    for (org.hl7.fhir.r4b.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t));
110    if (src.hasPatientInstruction())
111      tgt.addPatientInstruction().setInstruction(String43_50.convertStringToMarkdown(src.getPatientInstructionElement()));
112    for (org.hl7.fhir.r4b.model.Reference t : src.getRelevantHistory())
113      tgt.addRelevantHistory(Reference43_50.convertReference(t));
114    return tgt;
115  }
116
117  public static org.hl7.fhir.r4b.model.ServiceRequest convertServiceRequest(org.hl7.fhir.r5.model.ServiceRequest src) throws FHIRException {
118    if (src == null)
119      return null;
120    org.hl7.fhir.r4b.model.ServiceRequest tgt = new org.hl7.fhir.r4b.model.ServiceRequest();
121    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
122    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
123      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
124    for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical())
125      tgt.getInstantiatesCanonical().add(Canonical43_50.convertCanonical(t));
126    for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri())
127      tgt.getInstantiatesUri().add(Uri43_50.convertUri(t));
128    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference43_50.convertReference(t));
129    for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) tgt.addReplaces(Reference43_50.convertReference(t));
130    if (src.hasRequisition())
131      tgt.setRequisition(Identifier43_50.convertIdentifier(src.getRequisition()));
132    if (src.hasStatus())
133      tgt.setStatusElement(convertServiceRequestStatus(src.getStatusElement()));
134    if (src.hasIntent())
135      tgt.setIntentElement(convertServiceRequestIntent(src.getIntentElement()));
136    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory())
137      tgt.addCategory(CodeableConcept43_50.convertCodeableConcept(t));
138    if (src.hasPriority())
139      tgt.setPriorityElement(convertServiceRequestPriority(src.getPriorityElement()));
140    if (src.hasDoNotPerform())
141      tgt.setDoNotPerformElement(Boolean43_50.convertBoolean(src.getDoNotPerformElement()));
142    if (src.hasCode())
143      tgt.setCode(CodeableConcept43_50.convertCodeableReferenceToCodeableConcept(src.getCode()));
144    for (ServiceRequestOrderDetailComponent t : src.getOrderDetail()) {
145      for (ServiceRequestOrderDetailParameterComponent t1 : t.getParameter()) {
146        if (t1.hasValueCodeableConcept()) {
147          tgt.addOrderDetail(CodeableConcept43_50.convertCodeableConcept(t1.getValueCodeableConcept()));
148        }
149      }
150    }
151    if (src.hasQuantity())
152      tgt.setQuantity(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getQuantity()));
153    if (src.hasSubject())
154      tgt.setSubject(Reference43_50.convertReference(src.getSubject()));
155    if (src.hasEncounter())
156      tgt.setEncounter(Reference43_50.convertReference(src.getEncounter()));
157    if (src.hasOccurrence())
158      tgt.setOccurrence(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOccurrence()));
159    if (src.hasAsNeeded())
160      tgt.setAsNeeded(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getAsNeeded()));
161    if (src.hasAuthoredOn())
162      tgt.setAuthoredOnElement(DateTime43_50.convertDateTime(src.getAuthoredOnElement()));
163    if (src.hasRequester())
164      tgt.setRequester(Reference43_50.convertReference(src.getRequester()));
165    if (src.hasPerformerType())
166      tgt.setPerformerType(CodeableConcept43_50.convertCodeableConcept(src.getPerformerType()));
167    for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) tgt.addPerformer(Reference43_50.convertReference(t));
168    for (CodeableReference t : src.getLocation())
169      if (t.hasConcept())
170        tgt.addLocationCode(CodeableConcept43_50.convertCodeableConcept(t.getConcept()));
171    for (CodeableReference t : src.getLocation())
172      if (t.hasReference())
173        tgt.addLocationReference(Reference43_50.convertReference(t.getReference()));
174    for (CodeableReference t : src.getReason())
175      if (t.hasConcept())
176        tgt.addReasonCode(CodeableConcept43_50.convertCodeableConcept(t.getConcept()));
177    for (CodeableReference t : src.getReason())
178      if (t.hasReference())
179        tgt.addReasonReference(Reference43_50.convertReference(t.getReference()));
180    for (org.hl7.fhir.r5.model.Reference t : src.getInsurance()) tgt.addInsurance(Reference43_50.convertReference(t));
181    for (CodeableReference t : src.getSupportingInfo())
182      if (t.hasReference())
183        tgt.addSupportingInfo(Reference43_50.convertReference(t.getReference()));
184    for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) tgt.addSpecimen(Reference43_50.convertReference(t));
185    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite())
186      tgt.addBodySite(CodeableConcept43_50.convertCodeableConcept(t));
187    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t));
188    if (src.getPatientInstructionFirstRep().hasInstructionMarkdownType())
189      tgt.setPatientInstructionElement(String43_50.convertString(src.getPatientInstructionFirstRep().getInstructionMarkdownType()));
190    for (org.hl7.fhir.r5.model.Reference t : src.getRelevantHistory())
191      tgt.addRelevantHistory(Reference43_50.convertReference(t));
192    return tgt;
193  }
194
195  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestStatus> convertServiceRequestStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestStatus> src) throws FHIRException {
196    if (src == null || src.isEmpty())
197      return null;
198    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());
199    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
200    switch (src.getValue()) {
201      case DRAFT:
202        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT);
203        break;
204      case ACTIVE:
205        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE);
206        break;
207      case ONHOLD:
208        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD);
209        break;
210      case REVOKED:
211        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED);
212        break;
213      case COMPLETED:
214        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED);
215        break;
216      case ENTEREDINERROR:
217        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR);
218        break;
219      case UNKNOWN:
220        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.UNKNOWN);
221        break;
222      default:
223        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL);
224        break;
225    }
226    return tgt;
227  }
228
229  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestStatus> convertServiceRequestStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestStatus> src) throws FHIRException {
230    if (src == null || src.isEmpty())
231      return null;
232    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.RequestStatusEnumFactory());
233    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
234    switch (src.getValue()) {
235      case DRAFT:
236        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.DRAFT);
237        break;
238      case ACTIVE:
239        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.ACTIVE);
240        break;
241      case ONHOLD:
242        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.ONHOLD);
243        break;
244      case REVOKED:
245        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.REVOKED);
246        break;
247      case COMPLETED:
248        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.COMPLETED);
249        break;
250      case ENTEREDINERROR:
251        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.ENTEREDINERROR);
252        break;
253      case UNKNOWN:
254        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.UNKNOWN);
255        break;
256      default:
257        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestStatus.NULL);
258        break;
259    }
260    return tgt;
261  }
262
263  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestIntent> convertServiceRequestIntent(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestIntent> src) throws FHIRException {
264    if (src == null || src.isEmpty())
265      return null;
266    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestIntent> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestIntentEnumFactory());
267    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
268    switch (src.getValue()) {
269      case PROPOSAL:
270        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.PROPOSAL);
271        break;
272      case PLAN:
273        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.PLAN);
274        break;
275      case DIRECTIVE:
276        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.DIRECTIVE);
277        break;
278      case ORDER:
279        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.ORDER);
280        break;
281      case ORIGINALORDER:
282        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.ORIGINALORDER);
283        break;
284      case REFLEXORDER:
285        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.REFLEXORDER);
286        break;
287      case FILLERORDER:
288        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.FILLERORDER);
289        break;
290      case INSTANCEORDER:
291        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.INSTANCEORDER);
292        break;
293      case OPTION:
294        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.OPTION);
295        break;
296      default:
297        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.NULL);
298        break;
299    }
300    return tgt;
301  }
302
303  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestIntent> convertServiceRequestIntent(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestIntent> src) throws FHIRException {
304    if (src == null || src.isEmpty())
305      return null;
306    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestIntent> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.RequestIntentEnumFactory());
307    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
308    switch (src.getValue()) {
309      case PROPOSAL:
310        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.PROPOSAL);
311        break;
312      case PLAN:
313        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.PLAN);
314        break;
315      case DIRECTIVE:
316        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.DIRECTIVE);
317        break;
318      case ORDER:
319        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.ORDER);
320        break;
321      case ORIGINALORDER:
322        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.ORIGINALORDER);
323        break;
324      case REFLEXORDER:
325        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.REFLEXORDER);
326        break;
327      case FILLERORDER:
328        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.FILLERORDER);
329        break;
330      case INSTANCEORDER:
331        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.INSTANCEORDER);
332        break;
333      case OPTION:
334        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.OPTION);
335        break;
336      default:
337        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.NULL);
338        break;
339    }
340    return tgt;
341  }
342
343  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> convertServiceRequestPriority(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> src) throws FHIRException {
344    if (src == null || src.isEmpty())
345      return null;
346    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());
347    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
348    switch (src.getValue()) {
349      case ROUTINE:
350        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE);
351        break;
352      case URGENT:
353        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT);
354        break;
355      case ASAP:
356        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP);
357        break;
358      case STAT:
359        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT);
360        break;
361      default:
362        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL);
363        break;
364    }
365    return tgt;
366  }
367
368  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> convertServiceRequestPriority(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> src) throws FHIRException {
369    if (src == null || src.isEmpty())
370      return null;
371    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.RequestPriorityEnumFactory());
372    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
373    switch (src.getValue()) {
374      case ROUTINE:
375        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ROUTINE);
376        break;
377      case URGENT:
378        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.URGENT);
379        break;
380      case ASAP:
381        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ASAP);
382        break;
383      case STAT:
384        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.STAT);
385        break;
386      default:
387        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.NULL);
388        break;
389    }
390    return tgt;
391  }
392}