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