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.Duration43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50; 009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.SimpleQuantity43_50; 010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50; 011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.UnsignedInt43_50; 013import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Dosage43_50; 014import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50; 015import org.hl7.fhir.exceptions.FHIRException; 016 017/* 018 Copyright (c) 2011+, HL7, Inc. 019 All rights reserved. 020 021 Redistribution and use in source and binary forms, with or without modification, 022 are permitted provided that the following conditions are met: 023 024 * Redistributions of source code must retain the above copyright notice, this 025 list of conditions and the following disclaimer. 026 * Redistributions in binary form must reproduce the above copyright notice, 027 this list of conditions and the following disclaimer in the documentation 028 and/or other materials provided with the distribution. 029 * Neither the name of HL7 nor the names of its contributors may be used to 030 endorse or promote products derived from this software without specific 031 prior written permission. 032 033 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 034 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 035 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 036 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 037 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 038 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 039 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 040 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 041 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 042 POSSIBILITY OF SUCH DAMAGE. 043 044*/ 045// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 046public class MedicationRequest43_50 { 047 048 public static org.hl7.fhir.r5.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r4b.model.MedicationRequest src) throws FHIRException { 049 if (src == null) 050 return null; 051 org.hl7.fhir.r5.model.MedicationRequest tgt = new org.hl7.fhir.r5.model.MedicationRequest(); 052 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 053 for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) 054 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 055 if (src.hasStatus()) 056 tgt.setStatusElement(convertMedicationRequestStatus(src.getStatusElement())); 057 if (src.hasStatusReason()) 058 tgt.setStatusReason(CodeableConcept43_50.convertCodeableConcept(src.getStatusReason())); 059 if (src.hasIntent()) 060 tgt.setIntentElement(convertMedicationRequestIntent(src.getIntentElement())); 061 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getCategory()) 062 tgt.addCategory(CodeableConcept43_50.convertCodeableConcept(t)); 063 if (src.hasPriority()) 064 tgt.setPriorityElement(convertMedicationRequestPriority(src.getPriorityElement())); 065 if (src.hasDoNotPerform()) 066 tgt.setDoNotPerformElement(Boolean43_50.convertBoolean(src.getDoNotPerformElement())); 067 if (src.hasReportedBooleanType()) 068 tgt.setReportedElement(Boolean43_50.convertBoolean(src.getReportedBooleanType())); 069 if (src.hasReportedReference()) 070 tgt.addInformationSource(Reference43_50.convertReference(src.getReportedReference())); 071 if (src.hasMedicationCodeableConcept()) 072 tgt.getMedication().setConcept(CodeableConcept43_50.convertCodeableConcept(src.getMedicationCodeableConcept())); 073 if (src.hasMedicationReference()) 074 tgt.getMedication().setReference(Reference43_50.convertReference(src.getMedicationReference())); 075 if (src.hasSubject()) 076 tgt.setSubject(Reference43_50.convertReference(src.getSubject())); 077 if (src.hasEncounter()) 078 tgt.setEncounter(Reference43_50.convertReference(src.getEncounter())); 079 for (org.hl7.fhir.r4b.model.Reference t : src.getSupportingInformation()) 080 tgt.addSupportingInformation(Reference43_50.convertReference(t)); 081 if (src.hasAuthoredOn()) 082 tgt.setAuthoredOnElement(DateTime43_50.convertDateTime(src.getAuthoredOnElement())); 083 if (src.hasRequester()) 084 tgt.setRequester(Reference43_50.convertReference(src.getRequester())); 085 if (src.hasPerformer()) 086 tgt.addPerformer(Reference43_50.convertReference(src.getPerformer())); 087 if (src.hasPerformerType()) 088 tgt.setPerformerType(CodeableConcept43_50.convertCodeableConcept(src.getPerformerType())); 089 if (src.hasRecorder()) 090 tgt.setRecorder(Reference43_50.convertReference(src.getRecorder())); 091 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getReasonCode()) 092 tgt.addReason().setConcept(CodeableConcept43_50.convertCodeableConcept(t)); 093 for (org.hl7.fhir.r4b.model.Reference t : src.getReasonReference()) 094 tgt.addReason().setReference(Reference43_50.convertReference(t)); 095// for (org.hl7.fhir.r4b.model.CanonicalType t : src.getInstantiatesCanonical()) 096// tgt.getInstantiatesCanonical().add(Canonical43_50.convertCanonical(t)); 097// for (org.hl7.fhir.r4b.model.UriType t : src.getInstantiatesUri()) 098// tgt.getInstantiatesUri().add(Uri43_50.convertUri(t)); 099 for (org.hl7.fhir.r4b.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference43_50.convertReference(t)); 100 if (src.hasGroupIdentifier()) 101 tgt.setGroupIdentifier(Identifier43_50.convertIdentifier(src.getGroupIdentifier())); 102 if (src.hasCourseOfTherapyType()) 103 tgt.setCourseOfTherapyType(CodeableConcept43_50.convertCodeableConcept(src.getCourseOfTherapyType())); 104 for (org.hl7.fhir.r4b.model.Reference t : src.getInsurance()) tgt.addInsurance(Reference43_50.convertReference(t)); 105 for (org.hl7.fhir.r4b.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 106 for (org.hl7.fhir.r4b.model.Dosage t : src.getDosageInstruction()) 107 tgt.addDosageInstruction(Dosage43_50.convertDosage(t)); 108 if (src.hasDispenseRequest()) 109 tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); 110 if (src.hasSubstitution()) 111 tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); 112 if (src.hasPriorPrescription()) 113 tgt.setPriorPrescription(Reference43_50.convertReference(src.getPriorPrescription())); 114 for (org.hl7.fhir.r4b.model.Reference t : src.getDetectedIssue()) 115// tgt.addDetectedIssue(Reference43_50.convertReference(t)); 116// for (org.hl7.fhir.r4b.model.Reference t : src.getEventHistory()) 117 tgt.addEventHistory(Reference43_50.convertReference(t)); 118 return tgt; 119 } 120 121 public static org.hl7.fhir.r4b.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r5.model.MedicationRequest src) throws FHIRException { 122 if (src == null) 123 return null; 124 org.hl7.fhir.r4b.model.MedicationRequest tgt = new org.hl7.fhir.r4b.model.MedicationRequest(); 125 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 126 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 127 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 128 if (src.hasStatus()) 129 tgt.setStatusElement(convertMedicationRequestStatus(src.getStatusElement())); 130 if (src.hasStatusReason()) 131 tgt.setStatusReason(CodeableConcept43_50.convertCodeableConcept(src.getStatusReason())); 132 if (src.hasIntent()) 133 tgt.setIntentElement(convertMedicationRequestIntent(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(convertMedicationRequestPriority(src.getPriorityElement())); 138 if (src.hasDoNotPerform()) 139 tgt.setDoNotPerformElement(Boolean43_50.convertBoolean(src.getDoNotPerformElement())); 140 if (src.hasReported()) 141 tgt.setReported(Boolean43_50.convertBoolean(src.getReportedElement())); 142 if (src.hasInformationSource()) 143 tgt.setReported(Reference43_50.convertReference(src.getInformationSourceFirstRep())); 144 if (src.getMedication().hasReference()) 145 tgt.setMedication(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getMedication().getReference())); 146 if (src.getMedication().hasConcept()) 147 tgt.setMedication(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getMedication().getConcept())); 148 if (src.hasSubject()) 149 tgt.setSubject(Reference43_50.convertReference(src.getSubject())); 150 if (src.hasEncounter()) 151 tgt.setEncounter(Reference43_50.convertReference(src.getEncounter())); 152 for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) 153 tgt.addSupportingInformation(Reference43_50.convertReference(t)); 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.hasPerformer()) 159 tgt.setPerformer(Reference43_50.convertReference(src.getPerformerFirstRep())); 160 if (src.hasPerformerType()) 161 tgt.setPerformerType(CodeableConcept43_50.convertCodeableConcept(src.getPerformerType())); 162 if (src.hasRecorder()) 163 tgt.setRecorder(Reference43_50.convertReference(src.getRecorder())); 164 for (org.hl7.fhir.r5.model.CodeableReference t : src.getReason()) { 165 if (t.hasConcept()) 166 tgt.addReasonCode(CodeableConcept43_50.convertCodeableConcept(t.getConcept())); 167 if (t.hasReference()) 168 tgt.addReasonReference(Reference43_50.convertReference(t.getReference())); 169 } 170// for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) 171// tgt.getInstantiatesCanonical().add(Canonical43_50.convertCanonical(t)); 172// for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) 173// tgt.getInstantiatesUri().add(Uri43_50.convertUri(t)); 174 for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference43_50.convertReference(t)); 175 if (src.hasGroupIdentifier()) 176 tgt.setGroupIdentifier(Identifier43_50.convertIdentifier(src.getGroupIdentifier())); 177 if (src.hasCourseOfTherapyType()) 178 tgt.setCourseOfTherapyType(CodeableConcept43_50.convertCodeableConcept(src.getCourseOfTherapyType())); 179 for (org.hl7.fhir.r5.model.Reference t : src.getInsurance()) tgt.addInsurance(Reference43_50.convertReference(t)); 180 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 181 for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) 182 tgt.addDosageInstruction(Dosage43_50.convertDosage(t)); 183 if (src.hasDispenseRequest()) 184 tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); 185 if (src.hasSubstitution()) 186 tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); 187 if (src.hasPriorPrescription()) 188 tgt.setPriorPrescription(Reference43_50.convertReference(src.getPriorPrescription())); 189// for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) 190// tgt.addDetectedIssue(Reference43_50.convertReference(t)); 191 for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) 192 tgt.addEventHistory(Reference43_50.convertReference(t)); 193 return tgt; 194 } 195 196 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus> convertMedicationRequestStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus> src) throws FHIRException { 197 if (src == null || src.isEmpty()) 198 return null; 199 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()); 200 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 201 switch (src.getValue()) { 202 case ACTIVE: 203 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ACTIVE); 204 break; 205 case ONHOLD: 206 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ONHOLD); 207 break; 208 case CANCELLED: 209 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.CANCELLED); 210 break; 211 case COMPLETED: 212 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.COMPLETED); 213 break; 214 case ENTEREDINERROR: 215 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.ENTEREDINERROR); 216 break; 217 case STOPPED: 218 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.STOPPED); 219 break; 220 case DRAFT: 221 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.DRAFT); 222 break; 223 case UNKNOWN: 224 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.UNKNOWN); 225 break; 226 default: 227 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus.NULL); 228 break; 229 } 230 return tgt; 231 } 232 233 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus> convertMedicationRequestStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationrequestStatus> src) throws FHIRException { 234 if (src == null || src.isEmpty()) 235 return null; 236 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatusEnumFactory()); 237 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 238 switch (src.getValue()) { 239 case ACTIVE: 240 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.ACTIVE); 241 break; 242 case ONHOLD: 243 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.ONHOLD); 244 break; 245 case CANCELLED: 246 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.CANCELLED); 247 break; 248 case COMPLETED: 249 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.COMPLETED); 250 break; 251 case ENTEREDINERROR: 252 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.ENTEREDINERROR); 253 break; 254 case STOPPED: 255 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.STOPPED); 256 break; 257 case DRAFT: 258 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.DRAFT); 259 break; 260 case UNKNOWN: 261 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.UNKNOWN); 262 break; 263 default: 264 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationrequestStatus.NULL); 265 break; 266 } 267 return tgt; 268 } 269 270 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent> convertMedicationRequestIntent(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent> src) throws FHIRException { 271 if (src == null || src.isEmpty()) 272 return null; 273 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()); 274 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 275 switch (src.getValue()) { 276 case PROPOSAL: 277 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PROPOSAL); 278 break; 279 case PLAN: 280 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PLAN); 281 break; 282 case ORDER: 283 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORDER); 284 break; 285 case ORIGINALORDER: 286 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORIGINALORDER); 287 break; 288 case REFLEXORDER: 289 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.REFLEXORDER); 290 break; 291 case FILLERORDER: 292 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.FILLERORDER); 293 break; 294 case INSTANCEORDER: 295 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER); 296 break; 297 case OPTION: 298 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.OPTION); 299 break; 300 default: 301 tgt.setValue(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.NULL); 302 break; 303 } 304 return tgt; 305 } 306 307 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent> convertMedicationRequestIntent(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent> src) throws FHIRException { 308 if (src == null || src.isEmpty()) 309 return null; 310 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntentEnumFactory()); 311 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 312 switch (src.getValue()) { 313 case PROPOSAL: 314 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.PROPOSAL); 315 break; 316 case PLAN: 317 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.PLAN); 318 break; 319 case ORDER: 320 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.ORDER); 321 break; 322 case ORIGINALORDER: 323 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.ORIGINALORDER); 324 break; 325 case REFLEXORDER: 326 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.REFLEXORDER); 327 break; 328 case FILLERORDER: 329 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.FILLERORDER); 330 break; 331 case INSTANCEORDER: 332 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER); 333 break; 334 case OPTION: 335 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.OPTION); 336 break; 337 default: 338 tgt.setValue(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestIntent.NULL); 339 break; 340 } 341 return tgt; 342 } 343 344 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> convertMedicationRequestPriority(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> src) throws FHIRException { 345 if (src == null || src.isEmpty()) 346 return null; 347 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()); 348 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 349 switch (src.getValue()) { 350 case ROUTINE: 351 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE); 352 break; 353 case URGENT: 354 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT); 355 break; 356 case ASAP: 357 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP); 358 break; 359 case STAT: 360 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT); 361 break; 362 default: 363 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL); 364 break; 365 } 366 return tgt; 367 } 368 369 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> convertMedicationRequestPriority(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> src) throws FHIRException { 370 if (src == null || src.isEmpty()) 371 return null; 372 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()); 373 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 374 switch (src.getValue()) { 375 case ROUTINE: 376 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ROUTINE); 377 break; 378 case URGENT: 379 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.URGENT); 380 break; 381 case ASAP: 382 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ASAP); 383 break; 384 case STAT: 385 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.STAT); 386 break; 387 default: 388 tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.NULL); 389 break; 390 } 391 return tgt; 392 } 393 394 public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { 395 if (src == null) 396 return null; 397 org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); 398 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 399 if (src.hasInitialFill()) 400 tgt.setInitialFill(convertMedicationRequestDispenseRequestInitialFillComponent(src.getInitialFill())); 401 if (src.hasDispenseInterval()) 402 tgt.setDispenseInterval(Duration43_50.convertDuration(src.getDispenseInterval())); 403 if (src.hasValidityPeriod()) 404 tgt.setValidityPeriod(Period43_50.convertPeriod(src.getValidityPeriod())); 405 if (src.hasNumberOfRepeatsAllowed()) 406 tgt.setNumberOfRepeatsAllowedElement(UnsignedInt43_50.convertUnsignedInt(src.getNumberOfRepeatsAllowedElement())); 407 if (src.hasQuantity()) 408 tgt.setQuantity(SimpleQuantity43_50.convertSimpleQuantity(src.getQuantity())); 409 if (src.hasExpectedSupplyDuration()) 410 tgt.setExpectedSupplyDuration(Duration43_50.convertDuration(src.getExpectedSupplyDuration())); 411 if (src.hasPerformer()) 412 tgt.setDispenser(Reference43_50.convertReference(src.getPerformer())); 413 return tgt; 414 } 415 416 public static org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { 417 if (src == null) 418 return null; 419 org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); 420 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 421 if (src.hasInitialFill()) 422 tgt.setInitialFill(convertMedicationRequestDispenseRequestInitialFillComponent(src.getInitialFill())); 423 if (src.hasDispenseInterval()) 424 tgt.setDispenseInterval(Duration43_50.convertDuration(src.getDispenseInterval())); 425 if (src.hasValidityPeriod()) 426 tgt.setValidityPeriod(Period43_50.convertPeriod(src.getValidityPeriod())); 427 if (src.hasNumberOfRepeatsAllowed()) 428 tgt.setNumberOfRepeatsAllowedElement(UnsignedInt43_50.convertUnsignedInt(src.getNumberOfRepeatsAllowedElement())); 429 if (src.hasQuantity()) 430 tgt.setQuantity(SimpleQuantity43_50.convertSimpleQuantity(src.getQuantity())); 431 if (src.hasExpectedSupplyDuration()) 432 tgt.setExpectedSupplyDuration(Duration43_50.convertDuration(src.getExpectedSupplyDuration())); 433 if (src.hasDispenser()) 434 tgt.setPerformer(Reference43_50.convertReference(src.getDispenser())); 435 return tgt; 436 } 437 438 public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent convertMedicationRequestDispenseRequestInitialFillComponent(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent src) throws FHIRException { 439 if (src == null) 440 return null; 441 org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent(); 442 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 443 if (src.hasQuantity()) 444 tgt.setQuantity(SimpleQuantity43_50.convertSimpleQuantity(src.getQuantity())); 445 if (src.hasDuration()) 446 tgt.setDuration(Duration43_50.convertDuration(src.getDuration())); 447 return tgt; 448 } 449 450 public static org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent convertMedicationRequestDispenseRequestInitialFillComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent src) throws FHIRException { 451 if (src == null) 452 return null; 453 org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent tgt = new org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent(); 454 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 455 if (src.hasQuantity()) 456 tgt.setQuantity(SimpleQuantity43_50.convertSimpleQuantity(src.getQuantity())); 457 if (src.hasDuration()) 458 tgt.setDuration(Duration43_50.convertDuration(src.getDuration())); 459 return tgt; 460 } 461 462 public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { 463 if (src == null) 464 return null; 465 org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent(); 466 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 467 if (src.hasAllowed()) 468 tgt.setAllowed(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getAllowed())); 469 if (src.hasReason()) 470 tgt.setReason(CodeableConcept43_50.convertCodeableConcept(src.getReason())); 471 return tgt; 472 } 473 474 public static org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { 475 if (src == null) 476 return null; 477 org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r4b.model.MedicationRequest.MedicationRequestSubstitutionComponent(); 478 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 479 if (src.hasAllowed()) 480 tgt.setAllowed(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getAllowed())); 481 if (src.hasReason()) 482 tgt.setReason(CodeableConcept43_50.convertCodeableConcept(src.getReason())); 483 return tgt; 484 } 485}