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