001package org.hl7.fhir.dstu3.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045import org.hl7.fhir.exceptions.FHIRFormatError; 046/** 047 * An order or request for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or "MedicationOrder" to generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow patterns. 048 */ 049@ResourceDef(name="MedicationRequest", profile="http://hl7.org/fhir/StructureDefinition/MedicationRequest") 050public class MedicationRequest extends DomainResource { 051 052 public enum MedicationRequestStatus { 053 /** 054 * The prescription is 'actionable', but not all actions that are implied by it have occurred yet. 055 */ 056 ACTIVE, 057 /** 058 * Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called "suspended". 059 */ 060 ONHOLD, 061 /** 062 * The prescription has been withdrawn. 063 */ 064 CANCELLED, 065 /** 066 * All actions that are implied by the prescription have occurred. 067 */ 068 COMPLETED, 069 /** 070 * The prescription was entered in error. 071 */ 072 ENTEREDINERROR, 073 /** 074 * Actions implied by the prescription are to be permanently halted, before all of them occurred. 075 */ 076 STOPPED, 077 /** 078 * The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and needs to be run through decision support process. 079 */ 080 DRAFT, 081 /** 082 * The authoring system does not know which of the status values currently applies for this request 083 */ 084 UNKNOWN, 085 /** 086 * added to help the parsers with the generic types 087 */ 088 NULL; 089 public static MedicationRequestStatus fromCode(String codeString) throws FHIRException { 090 if (codeString == null || "".equals(codeString)) 091 return null; 092 if ("active".equals(codeString)) 093 return ACTIVE; 094 if ("on-hold".equals(codeString)) 095 return ONHOLD; 096 if ("cancelled".equals(codeString)) 097 return CANCELLED; 098 if ("completed".equals(codeString)) 099 return COMPLETED; 100 if ("entered-in-error".equals(codeString)) 101 return ENTEREDINERROR; 102 if ("stopped".equals(codeString)) 103 return STOPPED; 104 if ("draft".equals(codeString)) 105 return DRAFT; 106 if ("unknown".equals(codeString)) 107 return UNKNOWN; 108 if (Configuration.isAcceptInvalidEnums()) 109 return null; 110 else 111 throw new FHIRException("Unknown MedicationRequestStatus code '"+codeString+"'"); 112 } 113 public String toCode() { 114 switch (this) { 115 case ACTIVE: return "active"; 116 case ONHOLD: return "on-hold"; 117 case CANCELLED: return "cancelled"; 118 case COMPLETED: return "completed"; 119 case ENTEREDINERROR: return "entered-in-error"; 120 case STOPPED: return "stopped"; 121 case DRAFT: return "draft"; 122 case UNKNOWN: return "unknown"; 123 default: return "?"; 124 } 125 } 126 public String getSystem() { 127 switch (this) { 128 case ACTIVE: return "http://hl7.org/fhir/medication-request-status"; 129 case ONHOLD: return "http://hl7.org/fhir/medication-request-status"; 130 case CANCELLED: return "http://hl7.org/fhir/medication-request-status"; 131 case COMPLETED: return "http://hl7.org/fhir/medication-request-status"; 132 case ENTEREDINERROR: return "http://hl7.org/fhir/medication-request-status"; 133 case STOPPED: return "http://hl7.org/fhir/medication-request-status"; 134 case DRAFT: return "http://hl7.org/fhir/medication-request-status"; 135 case UNKNOWN: return "http://hl7.org/fhir/medication-request-status"; 136 default: return "?"; 137 } 138 } 139 public String getDefinition() { 140 switch (this) { 141 case ACTIVE: return "The prescription is 'actionable', but not all actions that are implied by it have occurred yet."; 142 case ONHOLD: return "Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called \"suspended\"."; 143 case CANCELLED: return "The prescription has been withdrawn."; 144 case COMPLETED: return "All actions that are implied by the prescription have occurred."; 145 case ENTEREDINERROR: return "The prescription was entered in error."; 146 case STOPPED: return "Actions implied by the prescription are to be permanently halted, before all of them occurred."; 147 case DRAFT: return "The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and needs to be run through decision support process."; 148 case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request"; 149 default: return "?"; 150 } 151 } 152 public String getDisplay() { 153 switch (this) { 154 case ACTIVE: return "Active"; 155 case ONHOLD: return "On Hold"; 156 case CANCELLED: return "Cancelled"; 157 case COMPLETED: return "Completed"; 158 case ENTEREDINERROR: return "Entered In Error"; 159 case STOPPED: return "Stopped"; 160 case DRAFT: return "Draft"; 161 case UNKNOWN: return "Unknown"; 162 default: return "?"; 163 } 164 } 165 } 166 167 public static class MedicationRequestStatusEnumFactory implements EnumFactory<MedicationRequestStatus> { 168 public MedicationRequestStatus fromCode(String codeString) throws IllegalArgumentException { 169 if (codeString == null || "".equals(codeString)) 170 if (codeString == null || "".equals(codeString)) 171 return null; 172 if ("active".equals(codeString)) 173 return MedicationRequestStatus.ACTIVE; 174 if ("on-hold".equals(codeString)) 175 return MedicationRequestStatus.ONHOLD; 176 if ("cancelled".equals(codeString)) 177 return MedicationRequestStatus.CANCELLED; 178 if ("completed".equals(codeString)) 179 return MedicationRequestStatus.COMPLETED; 180 if ("entered-in-error".equals(codeString)) 181 return MedicationRequestStatus.ENTEREDINERROR; 182 if ("stopped".equals(codeString)) 183 return MedicationRequestStatus.STOPPED; 184 if ("draft".equals(codeString)) 185 return MedicationRequestStatus.DRAFT; 186 if ("unknown".equals(codeString)) 187 return MedicationRequestStatus.UNKNOWN; 188 throw new IllegalArgumentException("Unknown MedicationRequestStatus code '"+codeString+"'"); 189 } 190 public Enumeration<MedicationRequestStatus> fromType(Base code) throws FHIRException { 191 if (code == null) 192 return null; 193 if (code.isEmpty()) 194 return new Enumeration<MedicationRequestStatus>(this); 195 String codeString = ((PrimitiveType) code).asStringValue(); 196 if (codeString == null || "".equals(codeString)) 197 return null; 198 if ("active".equals(codeString)) 199 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.ACTIVE); 200 if ("on-hold".equals(codeString)) 201 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.ONHOLD); 202 if ("cancelled".equals(codeString)) 203 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.CANCELLED); 204 if ("completed".equals(codeString)) 205 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.COMPLETED); 206 if ("entered-in-error".equals(codeString)) 207 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.ENTEREDINERROR); 208 if ("stopped".equals(codeString)) 209 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.STOPPED); 210 if ("draft".equals(codeString)) 211 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.DRAFT); 212 if ("unknown".equals(codeString)) 213 return new Enumeration<MedicationRequestStatus>(this, MedicationRequestStatus.UNKNOWN); 214 throw new FHIRException("Unknown MedicationRequestStatus code '"+codeString+"'"); 215 } 216 public String toCode(MedicationRequestStatus code) { 217 if (code == MedicationRequestStatus.ACTIVE) 218 return "active"; 219 if (code == MedicationRequestStatus.ONHOLD) 220 return "on-hold"; 221 if (code == MedicationRequestStatus.CANCELLED) 222 return "cancelled"; 223 if (code == MedicationRequestStatus.COMPLETED) 224 return "completed"; 225 if (code == MedicationRequestStatus.ENTEREDINERROR) 226 return "entered-in-error"; 227 if (code == MedicationRequestStatus.STOPPED) 228 return "stopped"; 229 if (code == MedicationRequestStatus.DRAFT) 230 return "draft"; 231 if (code == MedicationRequestStatus.UNKNOWN) 232 return "unknown"; 233 return "?"; 234 } 235 public String toSystem(MedicationRequestStatus code) { 236 return code.getSystem(); 237 } 238 } 239 240 public enum MedicationRequestIntent { 241 /** 242 * The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act 243 */ 244 PROPOSAL, 245 /** 246 * The request represents an intension to ensure something occurs without providing an authorization for others to act 247 */ 248 PLAN, 249 /** 250 * The request represents a request/demand and authorization for action 251 */ 252 ORDER, 253 /** 254 * The request represents an instance for the particular order, for example a medication administration record. 255 */ 256 INSTANCEORDER, 257 /** 258 * added to help the parsers with the generic types 259 */ 260 NULL; 261 public static MedicationRequestIntent fromCode(String codeString) throws FHIRException { 262 if (codeString == null || "".equals(codeString)) 263 return null; 264 if ("proposal".equals(codeString)) 265 return PROPOSAL; 266 if ("plan".equals(codeString)) 267 return PLAN; 268 if ("order".equals(codeString)) 269 return ORDER; 270 if ("instance-order".equals(codeString)) 271 return INSTANCEORDER; 272 if (Configuration.isAcceptInvalidEnums()) 273 return null; 274 else 275 throw new FHIRException("Unknown MedicationRequestIntent code '"+codeString+"'"); 276 } 277 public String toCode() { 278 switch (this) { 279 case PROPOSAL: return "proposal"; 280 case PLAN: return "plan"; 281 case ORDER: return "order"; 282 case INSTANCEORDER: return "instance-order"; 283 default: return "?"; 284 } 285 } 286 public String getSystem() { 287 switch (this) { 288 case PROPOSAL: return "http://hl7.org/fhir/medication-request-intent"; 289 case PLAN: return "http://hl7.org/fhir/medication-request-intent"; 290 case ORDER: return "http://hl7.org/fhir/medication-request-intent"; 291 case INSTANCEORDER: return "http://hl7.org/fhir/medication-request-intent"; 292 default: return "?"; 293 } 294 } 295 public String getDefinition() { 296 switch (this) { 297 case PROPOSAL: return "The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act"; 298 case PLAN: return "The request represents an intension to ensure something occurs without providing an authorization for others to act"; 299 case ORDER: return "The request represents a request/demand and authorization for action"; 300 case INSTANCEORDER: return "The request represents an instance for the particular order, for example a medication administration record."; 301 default: return "?"; 302 } 303 } 304 public String getDisplay() { 305 switch (this) { 306 case PROPOSAL: return "Proposal"; 307 case PLAN: return "Plan"; 308 case ORDER: return "Order"; 309 case INSTANCEORDER: return "Instance Order"; 310 default: return "?"; 311 } 312 } 313 } 314 315 public static class MedicationRequestIntentEnumFactory implements EnumFactory<MedicationRequestIntent> { 316 public MedicationRequestIntent fromCode(String codeString) throws IllegalArgumentException { 317 if (codeString == null || "".equals(codeString)) 318 if (codeString == null || "".equals(codeString)) 319 return null; 320 if ("proposal".equals(codeString)) 321 return MedicationRequestIntent.PROPOSAL; 322 if ("plan".equals(codeString)) 323 return MedicationRequestIntent.PLAN; 324 if ("order".equals(codeString)) 325 return MedicationRequestIntent.ORDER; 326 if ("instance-order".equals(codeString)) 327 return MedicationRequestIntent.INSTANCEORDER; 328 throw new IllegalArgumentException("Unknown MedicationRequestIntent code '"+codeString+"'"); 329 } 330 public Enumeration<MedicationRequestIntent> fromType(Base code) throws FHIRException { 331 if (code == null) 332 return null; 333 if (code.isEmpty()) 334 return new Enumeration<MedicationRequestIntent>(this); 335 String codeString = ((PrimitiveType) code).asStringValue(); 336 if (codeString == null || "".equals(codeString)) 337 return null; 338 if ("proposal".equals(codeString)) 339 return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.PROPOSAL); 340 if ("plan".equals(codeString)) 341 return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.PLAN); 342 if ("order".equals(codeString)) 343 return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.ORDER); 344 if ("instance-order".equals(codeString)) 345 return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.INSTANCEORDER); 346 throw new FHIRException("Unknown MedicationRequestIntent code '"+codeString+"'"); 347 } 348 public String toCode(MedicationRequestIntent code) { 349 if (code == MedicationRequestIntent.PROPOSAL) 350 return "proposal"; 351 if (code == MedicationRequestIntent.PLAN) 352 return "plan"; 353 if (code == MedicationRequestIntent.ORDER) 354 return "order"; 355 if (code == MedicationRequestIntent.INSTANCEORDER) 356 return "instance-order"; 357 return "?"; 358 } 359 public String toSystem(MedicationRequestIntent code) { 360 return code.getSystem(); 361 } 362 } 363 364 public enum MedicationRequestPriority { 365 /** 366 * The order has a normal priority . 367 */ 368 ROUTINE, 369 /** 370 * The order should be urgently. 371 */ 372 URGENT, 373 /** 374 * The order is time-critical. 375 */ 376 STAT, 377 /** 378 * The order should be acted on as soon as possible. 379 */ 380 ASAP, 381 /** 382 * added to help the parsers with the generic types 383 */ 384 NULL; 385 public static MedicationRequestPriority fromCode(String codeString) throws FHIRException { 386 if (codeString == null || "".equals(codeString)) 387 return null; 388 if ("routine".equals(codeString)) 389 return ROUTINE; 390 if ("urgent".equals(codeString)) 391 return URGENT; 392 if ("stat".equals(codeString)) 393 return STAT; 394 if ("asap".equals(codeString)) 395 return ASAP; 396 if (Configuration.isAcceptInvalidEnums()) 397 return null; 398 else 399 throw new FHIRException("Unknown MedicationRequestPriority code '"+codeString+"'"); 400 } 401 public String toCode() { 402 switch (this) { 403 case ROUTINE: return "routine"; 404 case URGENT: return "urgent"; 405 case STAT: return "stat"; 406 case ASAP: return "asap"; 407 default: return "?"; 408 } 409 } 410 public String getSystem() { 411 switch (this) { 412 case ROUTINE: return "http://hl7.org/fhir/medication-request-priority"; 413 case URGENT: return "http://hl7.org/fhir/medication-request-priority"; 414 case STAT: return "http://hl7.org/fhir/medication-request-priority"; 415 case ASAP: return "http://hl7.org/fhir/medication-request-priority"; 416 default: return "?"; 417 } 418 } 419 public String getDefinition() { 420 switch (this) { 421 case ROUTINE: return "The order has a normal priority ."; 422 case URGENT: return "The order should be urgently."; 423 case STAT: return "The order is time-critical."; 424 case ASAP: return "The order should be acted on as soon as possible."; 425 default: return "?"; 426 } 427 } 428 public String getDisplay() { 429 switch (this) { 430 case ROUTINE: return "Routine"; 431 case URGENT: return "Urgent"; 432 case STAT: return "Stat"; 433 case ASAP: return "ASAP"; 434 default: return "?"; 435 } 436 } 437 } 438 439 public static class MedicationRequestPriorityEnumFactory implements EnumFactory<MedicationRequestPriority> { 440 public MedicationRequestPriority fromCode(String codeString) throws IllegalArgumentException { 441 if (codeString == null || "".equals(codeString)) 442 if (codeString == null || "".equals(codeString)) 443 return null; 444 if ("routine".equals(codeString)) 445 return MedicationRequestPriority.ROUTINE; 446 if ("urgent".equals(codeString)) 447 return MedicationRequestPriority.URGENT; 448 if ("stat".equals(codeString)) 449 return MedicationRequestPriority.STAT; 450 if ("asap".equals(codeString)) 451 return MedicationRequestPriority.ASAP; 452 throw new IllegalArgumentException("Unknown MedicationRequestPriority code '"+codeString+"'"); 453 } 454 public Enumeration<MedicationRequestPriority> fromType(Base code) throws FHIRException { 455 if (code == null) 456 return null; 457 if (code.isEmpty()) 458 return new Enumeration<MedicationRequestPriority>(this); 459 String codeString = ((PrimitiveType) code).asStringValue(); 460 if (codeString == null || "".equals(codeString)) 461 return null; 462 if ("routine".equals(codeString)) 463 return new Enumeration<MedicationRequestPriority>(this, MedicationRequestPriority.ROUTINE); 464 if ("urgent".equals(codeString)) 465 return new Enumeration<MedicationRequestPriority>(this, MedicationRequestPriority.URGENT); 466 if ("stat".equals(codeString)) 467 return new Enumeration<MedicationRequestPriority>(this, MedicationRequestPriority.STAT); 468 if ("asap".equals(codeString)) 469 return new Enumeration<MedicationRequestPriority>(this, MedicationRequestPriority.ASAP); 470 throw new FHIRException("Unknown MedicationRequestPriority code '"+codeString+"'"); 471 } 472 public String toCode(MedicationRequestPriority code) { 473 if (code == MedicationRequestPriority.ROUTINE) 474 return "routine"; 475 if (code == MedicationRequestPriority.URGENT) 476 return "urgent"; 477 if (code == MedicationRequestPriority.STAT) 478 return "stat"; 479 if (code == MedicationRequestPriority.ASAP) 480 return "asap"; 481 return "?"; 482 } 483 public String toSystem(MedicationRequestPriority code) { 484 return code.getSystem(); 485 } 486 } 487 488 @Block() 489 public static class MedicationRequestRequesterComponent extends BackboneElement implements IBaseBackboneElement { 490 /** 491 * The healthcare professional responsible for authorizing the initial prescription. 492 */ 493 @Child(name = "agent", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true) 494 @Description(shortDefinition="Who ordered the initial medication(s)", formalDefinition="The healthcare professional responsible for authorizing the initial prescription." ) 495 protected Reference agent; 496 497 /** 498 * The actual object that is the target of the reference (The healthcare professional responsible for authorizing the initial prescription.) 499 */ 500 protected Resource agentTarget; 501 502 /** 503 * The organization the device or practitioner was acting on behalf of. 504 */ 505 @Child(name = "onBehalfOf", type = {Organization.class}, order=2, min=0, max=1, modifier=false, summary=true) 506 @Description(shortDefinition="Organization agent is acting for", formalDefinition="The organization the device or practitioner was acting on behalf of." ) 507 protected Reference onBehalfOf; 508 509 /** 510 * The actual object that is the target of the reference (The organization the device or practitioner was acting on behalf of.) 511 */ 512 protected Organization onBehalfOfTarget; 513 514 private static final long serialVersionUID = -71453027L; 515 516 /** 517 * Constructor 518 */ 519 public MedicationRequestRequesterComponent() { 520 super(); 521 } 522 523 /** 524 * Constructor 525 */ 526 public MedicationRequestRequesterComponent(Reference agent) { 527 super(); 528 this.agent = agent; 529 } 530 531 /** 532 * @return {@link #agent} (The healthcare professional responsible for authorizing the initial prescription.) 533 */ 534 public Reference getAgent() { 535 if (this.agent == null) 536 if (Configuration.errorOnAutoCreate()) 537 throw new Error("Attempt to auto-create MedicationRequestRequesterComponent.agent"); 538 else if (Configuration.doAutoCreate()) 539 this.agent = new Reference(); // cc 540 return this.agent; 541 } 542 543 public boolean hasAgent() { 544 return this.agent != null && !this.agent.isEmpty(); 545 } 546 547 /** 548 * @param value {@link #agent} (The healthcare professional responsible for authorizing the initial prescription.) 549 */ 550 public MedicationRequestRequesterComponent setAgent(Reference value) { 551 this.agent = value; 552 return this; 553 } 554 555 /** 556 * @return {@link #agent} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The healthcare professional responsible for authorizing the initial prescription.) 557 */ 558 public Resource getAgentTarget() { 559 return this.agentTarget; 560 } 561 562 /** 563 * @param value {@link #agent} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The healthcare professional responsible for authorizing the initial prescription.) 564 */ 565 public MedicationRequestRequesterComponent setAgentTarget(Resource value) { 566 this.agentTarget = value; 567 return this; 568 } 569 570 /** 571 * @return {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.) 572 */ 573 public Reference getOnBehalfOf() { 574 if (this.onBehalfOf == null) 575 if (Configuration.errorOnAutoCreate()) 576 throw new Error("Attempt to auto-create MedicationRequestRequesterComponent.onBehalfOf"); 577 else if (Configuration.doAutoCreate()) 578 this.onBehalfOf = new Reference(); // cc 579 return this.onBehalfOf; 580 } 581 582 public boolean hasOnBehalfOf() { 583 return this.onBehalfOf != null && !this.onBehalfOf.isEmpty(); 584 } 585 586 /** 587 * @param value {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.) 588 */ 589 public MedicationRequestRequesterComponent setOnBehalfOf(Reference value) { 590 this.onBehalfOf = value; 591 return this; 592 } 593 594 /** 595 * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.) 596 */ 597 public Organization getOnBehalfOfTarget() { 598 if (this.onBehalfOfTarget == null) 599 if (Configuration.errorOnAutoCreate()) 600 throw new Error("Attempt to auto-create MedicationRequestRequesterComponent.onBehalfOf"); 601 else if (Configuration.doAutoCreate()) 602 this.onBehalfOfTarget = new Organization(); // aa 603 return this.onBehalfOfTarget; 604 } 605 606 /** 607 * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.) 608 */ 609 public MedicationRequestRequesterComponent setOnBehalfOfTarget(Organization value) { 610 this.onBehalfOfTarget = value; 611 return this; 612 } 613 614 protected void listChildren(List<Property> children) { 615 super.listChildren(children); 616 children.add(new Property("agent", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The healthcare professional responsible for authorizing the initial prescription.", 0, 1, agent)); 617 children.add(new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf)); 618 } 619 620 @Override 621 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 622 switch (_hash) { 623 case 92750597: /*agent*/ return new Property("agent", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The healthcare professional responsible for authorizing the initial prescription.", 0, 1, agent); 624 case -14402964: /*onBehalfOf*/ return new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf); 625 default: return super.getNamedProperty(_hash, _name, _checkValid); 626 } 627 628 } 629 630 @Override 631 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 632 switch (hash) { 633 case 92750597: /*agent*/ return this.agent == null ? new Base[0] : new Base[] {this.agent}; // Reference 634 case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference 635 default: return super.getProperty(hash, name, checkValid); 636 } 637 638 } 639 640 @Override 641 public Base setProperty(int hash, String name, Base value) throws FHIRException { 642 switch (hash) { 643 case 92750597: // agent 644 this.agent = castToReference(value); // Reference 645 return value; 646 case -14402964: // onBehalfOf 647 this.onBehalfOf = castToReference(value); // Reference 648 return value; 649 default: return super.setProperty(hash, name, value); 650 } 651 652 } 653 654 @Override 655 public Base setProperty(String name, Base value) throws FHIRException { 656 if (name.equals("agent")) { 657 this.agent = castToReference(value); // Reference 658 } else if (name.equals("onBehalfOf")) { 659 this.onBehalfOf = castToReference(value); // Reference 660 } else 661 return super.setProperty(name, value); 662 return value; 663 } 664 665 @Override 666 public Base makeProperty(int hash, String name) throws FHIRException { 667 switch (hash) { 668 case 92750597: return getAgent(); 669 case -14402964: return getOnBehalfOf(); 670 default: return super.makeProperty(hash, name); 671 } 672 673 } 674 675 @Override 676 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 677 switch (hash) { 678 case 92750597: /*agent*/ return new String[] {"Reference"}; 679 case -14402964: /*onBehalfOf*/ return new String[] {"Reference"}; 680 default: return super.getTypesForProperty(hash, name); 681 } 682 683 } 684 685 @Override 686 public Base addChild(String name) throws FHIRException { 687 if (name.equals("agent")) { 688 this.agent = new Reference(); 689 return this.agent; 690 } 691 else if (name.equals("onBehalfOf")) { 692 this.onBehalfOf = new Reference(); 693 return this.onBehalfOf; 694 } 695 else 696 return super.addChild(name); 697 } 698 699 public MedicationRequestRequesterComponent copy() { 700 MedicationRequestRequesterComponent dst = new MedicationRequestRequesterComponent(); 701 copyValues(dst); 702 dst.agent = agent == null ? null : agent.copy(); 703 dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy(); 704 return dst; 705 } 706 707 @Override 708 public boolean equalsDeep(Base other_) { 709 if (!super.equalsDeep(other_)) 710 return false; 711 if (!(other_ instanceof MedicationRequestRequesterComponent)) 712 return false; 713 MedicationRequestRequesterComponent o = (MedicationRequestRequesterComponent) other_; 714 return compareDeep(agent, o.agent, true) && compareDeep(onBehalfOf, o.onBehalfOf, true); 715 } 716 717 @Override 718 public boolean equalsShallow(Base other_) { 719 if (!super.equalsShallow(other_)) 720 return false; 721 if (!(other_ instanceof MedicationRequestRequesterComponent)) 722 return false; 723 MedicationRequestRequesterComponent o = (MedicationRequestRequesterComponent) other_; 724 return true; 725 } 726 727 public boolean isEmpty() { 728 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(agent, onBehalfOf); 729 } 730 731 public String fhirType() { 732 return "MedicationRequest.requester"; 733 734 } 735 736 } 737 738 @Block() 739 public static class MedicationRequestDispenseRequestComponent extends BackboneElement implements IBaseBackboneElement { 740 /** 741 * This indicates the validity period of a prescription (stale dating the Prescription). 742 */ 743 @Child(name = "validityPeriod", type = {Period.class}, order=1, min=0, max=1, modifier=false, summary=false) 744 @Description(shortDefinition="Time period supply is authorized for", formalDefinition="This indicates the validity period of a prescription (stale dating the Prescription)." ) 745 protected Period validityPeriod; 746 747 /** 748 * An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. 749 */ 750 @Child(name = "numberOfRepeatsAllowed", type = {PositiveIntType.class}, order=2, min=0, max=1, modifier=false, summary=false) 751 @Description(shortDefinition="Number of refills authorized", formalDefinition="An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets." ) 752 protected PositiveIntType numberOfRepeatsAllowed; 753 754 /** 755 * The amount that is to be dispensed for one fill. 756 */ 757 @Child(name = "quantity", type = {SimpleQuantity.class}, order=3, min=0, max=1, modifier=false, summary=false) 758 @Description(shortDefinition="Amount of medication to supply per dispense", formalDefinition="The amount that is to be dispensed for one fill." ) 759 protected SimpleQuantity quantity; 760 761 /** 762 * Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. 763 */ 764 @Child(name = "expectedSupplyDuration", type = {Duration.class}, order=4, min=0, max=1, modifier=false, summary=false) 765 @Description(shortDefinition="Number of days supply per dispense", formalDefinition="Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last." ) 766 protected Duration expectedSupplyDuration; 767 768 /** 769 * Indicates the intended dispensing Organization specified by the prescriber. 770 */ 771 @Child(name = "performer", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=false) 772 @Description(shortDefinition="Intended dispenser", formalDefinition="Indicates the intended dispensing Organization specified by the prescriber." ) 773 protected Reference performer; 774 775 /** 776 * The actual object that is the target of the reference (Indicates the intended dispensing Organization specified by the prescriber.) 777 */ 778 protected Organization performerTarget; 779 780 private static final long serialVersionUID = 280197622L; 781 782 /** 783 * Constructor 784 */ 785 public MedicationRequestDispenseRequestComponent() { 786 super(); 787 } 788 789 /** 790 * @return {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) 791 */ 792 public Period getValidityPeriod() { 793 if (this.validityPeriod == null) 794 if (Configuration.errorOnAutoCreate()) 795 throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.validityPeriod"); 796 else if (Configuration.doAutoCreate()) 797 this.validityPeriod = new Period(); // cc 798 return this.validityPeriod; 799 } 800 801 public boolean hasValidityPeriod() { 802 return this.validityPeriod != null && !this.validityPeriod.isEmpty(); 803 } 804 805 /** 806 * @param value {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) 807 */ 808 public MedicationRequestDispenseRequestComponent setValidityPeriod(Period value) { 809 this.validityPeriod = value; 810 return this; 811 } 812 813 /** 814 * @return {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value 815 */ 816 public PositiveIntType getNumberOfRepeatsAllowedElement() { 817 if (this.numberOfRepeatsAllowed == null) 818 if (Configuration.errorOnAutoCreate()) 819 throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.numberOfRepeatsAllowed"); 820 else if (Configuration.doAutoCreate()) 821 this.numberOfRepeatsAllowed = new PositiveIntType(); // bb 822 return this.numberOfRepeatsAllowed; 823 } 824 825 public boolean hasNumberOfRepeatsAllowedElement() { 826 return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); 827 } 828 829 public boolean hasNumberOfRepeatsAllowed() { 830 return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); 831 } 832 833 /** 834 * @param value {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value 835 */ 836 public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowedElement(PositiveIntType value) { 837 this.numberOfRepeatsAllowed = value; 838 return this; 839 } 840 841 /** 842 * @return An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. 843 */ 844 public int getNumberOfRepeatsAllowed() { 845 return this.numberOfRepeatsAllowed == null || this.numberOfRepeatsAllowed.isEmpty() ? 0 : this.numberOfRepeatsAllowed.getValue(); 846 } 847 848 /** 849 * @param value An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. 850 */ 851 public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowed(int value) { 852 if (this.numberOfRepeatsAllowed == null) 853 this.numberOfRepeatsAllowed = new PositiveIntType(); 854 this.numberOfRepeatsAllowed.setValue(value); 855 return this; 856 } 857 858 /** 859 * @return {@link #quantity} (The amount that is to be dispensed for one fill.) 860 */ 861 public SimpleQuantity getQuantity() { 862 if (this.quantity == null) 863 if (Configuration.errorOnAutoCreate()) 864 throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.quantity"); 865 else if (Configuration.doAutoCreate()) 866 this.quantity = new SimpleQuantity(); // cc 867 return this.quantity; 868 } 869 870 public boolean hasQuantity() { 871 return this.quantity != null && !this.quantity.isEmpty(); 872 } 873 874 /** 875 * @param value {@link #quantity} (The amount that is to be dispensed for one fill.) 876 */ 877 public MedicationRequestDispenseRequestComponent setQuantity(SimpleQuantity value) { 878 this.quantity = value; 879 return this; 880 } 881 882 /** 883 * @return {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) 884 */ 885 public Duration getExpectedSupplyDuration() { 886 if (this.expectedSupplyDuration == null) 887 if (Configuration.errorOnAutoCreate()) 888 throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.expectedSupplyDuration"); 889 else if (Configuration.doAutoCreate()) 890 this.expectedSupplyDuration = new Duration(); // cc 891 return this.expectedSupplyDuration; 892 } 893 894 public boolean hasExpectedSupplyDuration() { 895 return this.expectedSupplyDuration != null && !this.expectedSupplyDuration.isEmpty(); 896 } 897 898 /** 899 * @param value {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) 900 */ 901 public MedicationRequestDispenseRequestComponent setExpectedSupplyDuration(Duration value) { 902 this.expectedSupplyDuration = value; 903 return this; 904 } 905 906 /** 907 * @return {@link #performer} (Indicates the intended dispensing Organization specified by the prescriber.) 908 */ 909 public Reference getPerformer() { 910 if (this.performer == null) 911 if (Configuration.errorOnAutoCreate()) 912 throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.performer"); 913 else if (Configuration.doAutoCreate()) 914 this.performer = new Reference(); // cc 915 return this.performer; 916 } 917 918 public boolean hasPerformer() { 919 return this.performer != null && !this.performer.isEmpty(); 920 } 921 922 /** 923 * @param value {@link #performer} (Indicates the intended dispensing Organization specified by the prescriber.) 924 */ 925 public MedicationRequestDispenseRequestComponent setPerformer(Reference value) { 926 this.performer = value; 927 return this; 928 } 929 930 /** 931 * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates the intended dispensing Organization specified by the prescriber.) 932 */ 933 public Organization getPerformerTarget() { 934 if (this.performerTarget == null) 935 if (Configuration.errorOnAutoCreate()) 936 throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.performer"); 937 else if (Configuration.doAutoCreate()) 938 this.performerTarget = new Organization(); // aa 939 return this.performerTarget; 940 } 941 942 /** 943 * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates the intended dispensing Organization specified by the prescriber.) 944 */ 945 public MedicationRequestDispenseRequestComponent setPerformerTarget(Organization value) { 946 this.performerTarget = value; 947 return this; 948 } 949 950 protected void listChildren(List<Property> children) { 951 super.listChildren(children); 952 children.add(new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod)); 953 children.add(new Property("numberOfRepeatsAllowed", "positiveInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.", 0, 1, numberOfRepeatsAllowed)); 954 children.add(new Property("quantity", "SimpleQuantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity)); 955 children.add(new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration)); 956 children.add(new Property("performer", "Reference(Organization)", "Indicates the intended dispensing Organization specified by the prescriber.", 0, 1, performer)); 957 } 958 959 @Override 960 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 961 switch (_hash) { 962 case -1434195053: /*validityPeriod*/ return new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod); 963 case -239736976: /*numberOfRepeatsAllowed*/ return new Property("numberOfRepeatsAllowed", "positiveInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.", 0, 1, numberOfRepeatsAllowed); 964 case -1285004149: /*quantity*/ return new Property("quantity", "SimpleQuantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity); 965 case -1910182789: /*expectedSupplyDuration*/ return new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration); 966 case 481140686: /*performer*/ return new Property("performer", "Reference(Organization)", "Indicates the intended dispensing Organization specified by the prescriber.", 0, 1, performer); 967 default: return super.getNamedProperty(_hash, _name, _checkValid); 968 } 969 970 } 971 972 @Override 973 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 974 switch (hash) { 975 case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period 976 case -239736976: /*numberOfRepeatsAllowed*/ return this.numberOfRepeatsAllowed == null ? new Base[0] : new Base[] {this.numberOfRepeatsAllowed}; // PositiveIntType 977 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 978 case -1910182789: /*expectedSupplyDuration*/ return this.expectedSupplyDuration == null ? new Base[0] : new Base[] {this.expectedSupplyDuration}; // Duration 979 case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference 980 default: return super.getProperty(hash, name, checkValid); 981 } 982 983 } 984 985 @Override 986 public Base setProperty(int hash, String name, Base value) throws FHIRException { 987 switch (hash) { 988 case -1434195053: // validityPeriod 989 this.validityPeriod = castToPeriod(value); // Period 990 return value; 991 case -239736976: // numberOfRepeatsAllowed 992 this.numberOfRepeatsAllowed = castToPositiveInt(value); // PositiveIntType 993 return value; 994 case -1285004149: // quantity 995 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 996 return value; 997 case -1910182789: // expectedSupplyDuration 998 this.expectedSupplyDuration = castToDuration(value); // Duration 999 return value; 1000 case 481140686: // performer 1001 this.performer = castToReference(value); // Reference 1002 return value; 1003 default: return super.setProperty(hash, name, value); 1004 } 1005 1006 } 1007 1008 @Override 1009 public Base setProperty(String name, Base value) throws FHIRException { 1010 if (name.equals("validityPeriod")) { 1011 this.validityPeriod = castToPeriod(value); // Period 1012 } else if (name.equals("numberOfRepeatsAllowed")) { 1013 this.numberOfRepeatsAllowed = castToPositiveInt(value); // PositiveIntType 1014 } else if (name.equals("quantity")) { 1015 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 1016 } else if (name.equals("expectedSupplyDuration")) { 1017 this.expectedSupplyDuration = castToDuration(value); // Duration 1018 } else if (name.equals("performer")) { 1019 this.performer = castToReference(value); // Reference 1020 } else 1021 return super.setProperty(name, value); 1022 return value; 1023 } 1024 1025 @Override 1026 public Base makeProperty(int hash, String name) throws FHIRException { 1027 switch (hash) { 1028 case -1434195053: return getValidityPeriod(); 1029 case -239736976: return getNumberOfRepeatsAllowedElement(); 1030 case -1285004149: return getQuantity(); 1031 case -1910182789: return getExpectedSupplyDuration(); 1032 case 481140686: return getPerformer(); 1033 default: return super.makeProperty(hash, name); 1034 } 1035 1036 } 1037 1038 @Override 1039 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1040 switch (hash) { 1041 case -1434195053: /*validityPeriod*/ return new String[] {"Period"}; 1042 case -239736976: /*numberOfRepeatsAllowed*/ return new String[] {"positiveInt"}; 1043 case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"}; 1044 case -1910182789: /*expectedSupplyDuration*/ return new String[] {"Duration"}; 1045 case 481140686: /*performer*/ return new String[] {"Reference"}; 1046 default: return super.getTypesForProperty(hash, name); 1047 } 1048 1049 } 1050 1051 @Override 1052 public Base addChild(String name) throws FHIRException { 1053 if (name.equals("validityPeriod")) { 1054 this.validityPeriod = new Period(); 1055 return this.validityPeriod; 1056 } 1057 else if (name.equals("numberOfRepeatsAllowed")) { 1058 throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.numberOfRepeatsAllowed"); 1059 } 1060 else if (name.equals("quantity")) { 1061 this.quantity = new SimpleQuantity(); 1062 return this.quantity; 1063 } 1064 else if (name.equals("expectedSupplyDuration")) { 1065 this.expectedSupplyDuration = new Duration(); 1066 return this.expectedSupplyDuration; 1067 } 1068 else if (name.equals("performer")) { 1069 this.performer = new Reference(); 1070 return this.performer; 1071 } 1072 else 1073 return super.addChild(name); 1074 } 1075 1076 public MedicationRequestDispenseRequestComponent copy() { 1077 MedicationRequestDispenseRequestComponent dst = new MedicationRequestDispenseRequestComponent(); 1078 copyValues(dst); 1079 dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy(); 1080 dst.numberOfRepeatsAllowed = numberOfRepeatsAllowed == null ? null : numberOfRepeatsAllowed.copy(); 1081 dst.quantity = quantity == null ? null : quantity.copy(); 1082 dst.expectedSupplyDuration = expectedSupplyDuration == null ? null : expectedSupplyDuration.copy(); 1083 dst.performer = performer == null ? null : performer.copy(); 1084 return dst; 1085 } 1086 1087 @Override 1088 public boolean equalsDeep(Base other_) { 1089 if (!super.equalsDeep(other_)) 1090 return false; 1091 if (!(other_ instanceof MedicationRequestDispenseRequestComponent)) 1092 return false; 1093 MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_; 1094 return compareDeep(validityPeriod, o.validityPeriod, true) && compareDeep(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true) 1095 && compareDeep(quantity, o.quantity, true) && compareDeep(expectedSupplyDuration, o.expectedSupplyDuration, true) 1096 && compareDeep(performer, o.performer, true); 1097 } 1098 1099 @Override 1100 public boolean equalsShallow(Base other_) { 1101 if (!super.equalsShallow(other_)) 1102 return false; 1103 if (!(other_ instanceof MedicationRequestDispenseRequestComponent)) 1104 return false; 1105 MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_; 1106 return compareValues(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true); 1107 } 1108 1109 public boolean isEmpty() { 1110 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(validityPeriod, numberOfRepeatsAllowed 1111 , quantity, expectedSupplyDuration, performer); 1112 } 1113 1114 public String fhirType() { 1115 return "MedicationRequest.dispenseRequest"; 1116 1117 } 1118 1119 } 1120 1121 @Block() 1122 public static class MedicationRequestSubstitutionComponent extends BackboneElement implements IBaseBackboneElement { 1123 /** 1124 * True if the prescriber allows a different drug to be dispensed from what was prescribed. 1125 */ 1126 @Child(name = "allowed", type = {BooleanType.class}, order=1, min=1, max=1, modifier=true, summary=false) 1127 @Description(shortDefinition="Whether substitution is allowed or not", formalDefinition="True if the prescriber allows a different drug to be dispensed from what was prescribed." ) 1128 protected BooleanType allowed; 1129 1130 /** 1131 * Indicates the reason for the substitution, or why substitution must or must not be performed. 1132 */ 1133 @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false) 1134 @Description(shortDefinition="Why should (not) substitution be made", formalDefinition="Indicates the reason for the substitution, or why substitution must or must not be performed." ) 1135 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-SubstanceAdminSubstitutionReason") 1136 protected CodeableConcept reason; 1137 1138 private static final long serialVersionUID = -141547037L; 1139 1140 /** 1141 * Constructor 1142 */ 1143 public MedicationRequestSubstitutionComponent() { 1144 super(); 1145 } 1146 1147 /** 1148 * Constructor 1149 */ 1150 public MedicationRequestSubstitutionComponent(BooleanType allowed) { 1151 super(); 1152 this.allowed = allowed; 1153 } 1154 1155 /** 1156 * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.). This is the underlying object with id, value and extensions. The accessor "getAllowed" gives direct access to the value 1157 */ 1158 public BooleanType getAllowedElement() { 1159 if (this.allowed == null) 1160 if (Configuration.errorOnAutoCreate()) 1161 throw new Error("Attempt to auto-create MedicationRequestSubstitutionComponent.allowed"); 1162 else if (Configuration.doAutoCreate()) 1163 this.allowed = new BooleanType(); // bb 1164 return this.allowed; 1165 } 1166 1167 public boolean hasAllowedElement() { 1168 return this.allowed != null && !this.allowed.isEmpty(); 1169 } 1170 1171 public boolean hasAllowed() { 1172 return this.allowed != null && !this.allowed.isEmpty(); 1173 } 1174 1175 /** 1176 * @param value {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.). This is the underlying object with id, value and extensions. The accessor "getAllowed" gives direct access to the value 1177 */ 1178 public MedicationRequestSubstitutionComponent setAllowedElement(BooleanType value) { 1179 this.allowed = value; 1180 return this; 1181 } 1182 1183 /** 1184 * @return True if the prescriber allows a different drug to be dispensed from what was prescribed. 1185 */ 1186 public boolean getAllowed() { 1187 return this.allowed == null || this.allowed.isEmpty() ? false : this.allowed.getValue(); 1188 } 1189 1190 /** 1191 * @param value True if the prescriber allows a different drug to be dispensed from what was prescribed. 1192 */ 1193 public MedicationRequestSubstitutionComponent setAllowed(boolean value) { 1194 if (this.allowed == null) 1195 this.allowed = new BooleanType(); 1196 this.allowed.setValue(value); 1197 return this; 1198 } 1199 1200 /** 1201 * @return {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) 1202 */ 1203 public CodeableConcept getReason() { 1204 if (this.reason == null) 1205 if (Configuration.errorOnAutoCreate()) 1206 throw new Error("Attempt to auto-create MedicationRequestSubstitutionComponent.reason"); 1207 else if (Configuration.doAutoCreate()) 1208 this.reason = new CodeableConcept(); // cc 1209 return this.reason; 1210 } 1211 1212 public boolean hasReason() { 1213 return this.reason != null && !this.reason.isEmpty(); 1214 } 1215 1216 /** 1217 * @param value {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) 1218 */ 1219 public MedicationRequestSubstitutionComponent setReason(CodeableConcept value) { 1220 this.reason = value; 1221 return this; 1222 } 1223 1224 protected void listChildren(List<Property> children) { 1225 super.listChildren(children); 1226 children.add(new Property("allowed", "boolean", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed)); 1227 children.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason)); 1228 } 1229 1230 @Override 1231 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1232 switch (_hash) { 1233 case -911343192: /*allowed*/ return new Property("allowed", "boolean", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); 1234 case -934964668: /*reason*/ return new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason); 1235 default: return super.getNamedProperty(_hash, _name, _checkValid); 1236 } 1237 1238 } 1239 1240 @Override 1241 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1242 switch (hash) { 1243 case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // BooleanType 1244 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept 1245 default: return super.getProperty(hash, name, checkValid); 1246 } 1247 1248 } 1249 1250 @Override 1251 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1252 switch (hash) { 1253 case -911343192: // allowed 1254 this.allowed = castToBoolean(value); // BooleanType 1255 return value; 1256 case -934964668: // reason 1257 this.reason = castToCodeableConcept(value); // CodeableConcept 1258 return value; 1259 default: return super.setProperty(hash, name, value); 1260 } 1261 1262 } 1263 1264 @Override 1265 public Base setProperty(String name, Base value) throws FHIRException { 1266 if (name.equals("allowed")) { 1267 this.allowed = castToBoolean(value); // BooleanType 1268 } else if (name.equals("reason")) { 1269 this.reason = castToCodeableConcept(value); // CodeableConcept 1270 } else 1271 return super.setProperty(name, value); 1272 return value; 1273 } 1274 1275 @Override 1276 public Base makeProperty(int hash, String name) throws FHIRException { 1277 switch (hash) { 1278 case -911343192: return getAllowedElement(); 1279 case -934964668: return getReason(); 1280 default: return super.makeProperty(hash, name); 1281 } 1282 1283 } 1284 1285 @Override 1286 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1287 switch (hash) { 1288 case -911343192: /*allowed*/ return new String[] {"boolean"}; 1289 case -934964668: /*reason*/ return new String[] {"CodeableConcept"}; 1290 default: return super.getTypesForProperty(hash, name); 1291 } 1292 1293 } 1294 1295 @Override 1296 public Base addChild(String name) throws FHIRException { 1297 if (name.equals("allowed")) { 1298 throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.allowed"); 1299 } 1300 else if (name.equals("reason")) { 1301 this.reason = new CodeableConcept(); 1302 return this.reason; 1303 } 1304 else 1305 return super.addChild(name); 1306 } 1307 1308 public MedicationRequestSubstitutionComponent copy() { 1309 MedicationRequestSubstitutionComponent dst = new MedicationRequestSubstitutionComponent(); 1310 copyValues(dst); 1311 dst.allowed = allowed == null ? null : allowed.copy(); 1312 dst.reason = reason == null ? null : reason.copy(); 1313 return dst; 1314 } 1315 1316 @Override 1317 public boolean equalsDeep(Base other_) { 1318 if (!super.equalsDeep(other_)) 1319 return false; 1320 if (!(other_ instanceof MedicationRequestSubstitutionComponent)) 1321 return false; 1322 MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_; 1323 return compareDeep(allowed, o.allowed, true) && compareDeep(reason, o.reason, true); 1324 } 1325 1326 @Override 1327 public boolean equalsShallow(Base other_) { 1328 if (!super.equalsShallow(other_)) 1329 return false; 1330 if (!(other_ instanceof MedicationRequestSubstitutionComponent)) 1331 return false; 1332 MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_; 1333 return compareValues(allowed, o.allowed, true); 1334 } 1335 1336 public boolean isEmpty() { 1337 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(allowed, reason); 1338 } 1339 1340 public String fhirType() { 1341 return "MedicationRequest.substitution"; 1342 1343 } 1344 1345 } 1346 1347 /** 1348 * This records identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. For example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records must be tracked through an entire system. 1349 */ 1350 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1351 @Description(shortDefinition="External ids for this request", formalDefinition="This records identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. For example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records must be tracked through an entire system." ) 1352 protected List<Identifier> identifier; 1353 1354 /** 1355 * Protocol or definition followed by this request. 1356 */ 1357 @Child(name = "definition", type = {ActivityDefinition.class, PlanDefinition.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1358 @Description(shortDefinition="Protocol or definition", formalDefinition="Protocol or definition followed by this request." ) 1359 protected List<Reference> definition; 1360 /** 1361 * The actual objects that are the target of the reference (Protocol or definition followed by this request.) 1362 */ 1363 protected List<Resource> definitionTarget; 1364 1365 1366 /** 1367 * A plan or request that is fulfilled in whole or in part by this medication request. 1368 */ 1369 @Child(name = "basedOn", type = {CarePlan.class, MedicationRequest.class, ProcedureRequest.class, ReferralRequest.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1370 @Description(shortDefinition="What request fulfills", formalDefinition="A plan or request that is fulfilled in whole or in part by this medication request." ) 1371 protected List<Reference> basedOn; 1372 /** 1373 * The actual objects that are the target of the reference (A plan or request that is fulfilled in whole or in part by this medication request.) 1374 */ 1375 protected List<Resource> basedOnTarget; 1376 1377 1378 /** 1379 * A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription. 1380 */ 1381 @Child(name = "groupIdentifier", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true) 1382 @Description(shortDefinition="Composite request this is part of", formalDefinition="A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription." ) 1383 protected Identifier groupIdentifier; 1384 1385 /** 1386 * A code specifying the current state of the order. Generally this will be active or completed state. 1387 */ 1388 @Child(name = "status", type = {CodeType.class}, order=4, min=0, max=1, modifier=true, summary=true) 1389 @Description(shortDefinition="active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown", formalDefinition="A code specifying the current state of the order. Generally this will be active or completed state." ) 1390 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-request-status") 1391 protected Enumeration<MedicationRequestStatus> status; 1392 1393 /** 1394 * Whether the request is a proposal, plan, or an original order. 1395 */ 1396 @Child(name = "intent", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true) 1397 @Description(shortDefinition="proposal | plan | order | instance-order", formalDefinition="Whether the request is a proposal, plan, or an original order." ) 1398 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-request-intent") 1399 protected Enumeration<MedicationRequestIntent> intent; 1400 1401 /** 1402 * Indicates the type of medication order and where the medication is expected to be consumed or administered. 1403 */ 1404 @Child(name = "category", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false) 1405 @Description(shortDefinition="Type of medication usage", formalDefinition="Indicates the type of medication order and where the medication is expected to be consumed or administered." ) 1406 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-request-category") 1407 protected CodeableConcept category; 1408 1409 /** 1410 * Indicates how quickly the Medication Request should be addressed with respect to other requests. 1411 */ 1412 @Child(name = "priority", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true) 1413 @Description(shortDefinition="routine | urgent | stat | asap", formalDefinition="Indicates how quickly the Medication Request should be addressed with respect to other requests." ) 1414 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-request-priority") 1415 protected Enumeration<MedicationRequestPriority> priority; 1416 1417 /** 1418 * Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications. 1419 */ 1420 @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=8, min=1, max=1, modifier=false, summary=true) 1421 @Description(shortDefinition="Medication to be taken", formalDefinition="Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications." ) 1422 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes") 1423 protected Type medication; 1424 1425 /** 1426 * A link to a resource representing the person or set of individuals to whom the medication will be given. 1427 */ 1428 @Child(name = "subject", type = {Patient.class, Group.class}, order=9, min=1, max=1, modifier=false, summary=true) 1429 @Description(shortDefinition="Who or group medication request is for", formalDefinition="A link to a resource representing the person or set of individuals to whom the medication will be given." ) 1430 protected Reference subject; 1431 1432 /** 1433 * The actual object that is the target of the reference (A link to a resource representing the person or set of individuals to whom the medication will be given.) 1434 */ 1435 protected Resource subjectTarget; 1436 1437 /** 1438 * A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider. 1439 */ 1440 @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=10, min=0, max=1, modifier=false, summary=false) 1441 @Description(shortDefinition="Created during encounter/admission/stay", formalDefinition="A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider." ) 1442 protected Reference context; 1443 1444 /** 1445 * The actual object that is the target of the reference (A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.) 1446 */ 1447 protected Resource contextTarget; 1448 1449 /** 1450 * Include additional information (for example, patient height and weight) that supports the ordering of the medication. 1451 */ 1452 @Child(name = "supportingInformation", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1453 @Description(shortDefinition="Information to support ordering of the medication", formalDefinition="Include additional information (for example, patient height and weight) that supports the ordering of the medication." ) 1454 protected List<Reference> supportingInformation; 1455 /** 1456 * The actual objects that are the target of the reference (Include additional information (for example, patient height and weight) that supports the ordering of the medication.) 1457 */ 1458 protected List<Resource> supportingInformationTarget; 1459 1460 1461 /** 1462 * The date (and perhaps time) when the prescription was initially written or authored on. 1463 */ 1464 @Child(name = "authoredOn", type = {DateTimeType.class}, order=12, min=0, max=1, modifier=false, summary=true) 1465 @Description(shortDefinition="When request was initially authored", formalDefinition="The date (and perhaps time) when the prescription was initially written or authored on." ) 1466 protected DateTimeType authoredOn; 1467 1468 /** 1469 * The individual, organization or device that initiated the request and has responsibility for its activation. 1470 */ 1471 @Child(name = "requester", type = {}, order=13, min=0, max=1, modifier=false, summary=true) 1472 @Description(shortDefinition="Who/What requested the Request", formalDefinition="The individual, organization or device that initiated the request and has responsibility for its activation." ) 1473 protected MedicationRequestRequesterComponent requester; 1474 1475 /** 1476 * The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order. 1477 */ 1478 @Child(name = "recorder", type = {Practitioner.class}, order=14, min=0, max=1, modifier=false, summary=false) 1479 @Description(shortDefinition="Person who entered the request", formalDefinition="The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order." ) 1480 protected Reference recorder; 1481 1482 /** 1483 * The actual object that is the target of the reference (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) 1484 */ 1485 protected Practitioner recorderTarget; 1486 1487 /** 1488 * The reason or the indication for ordering the medication. 1489 */ 1490 @Child(name = "reasonCode", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1491 @Description(shortDefinition="Reason or indication for writing the prescription", formalDefinition="The reason or the indication for ordering the medication." ) 1492 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code") 1493 protected List<CodeableConcept> reasonCode; 1494 1495 /** 1496 * Condition or observation that supports why the medication was ordered. 1497 */ 1498 @Child(name = "reasonReference", type = {Condition.class, Observation.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1499 @Description(shortDefinition="Condition or Observation that supports why the prescription is being written", formalDefinition="Condition or observation that supports why the medication was ordered." ) 1500 protected List<Reference> reasonReference; 1501 /** 1502 * The actual objects that are the target of the reference (Condition or observation that supports why the medication was ordered.) 1503 */ 1504 protected List<Resource> reasonReferenceTarget; 1505 1506 1507 /** 1508 * Extra information about the prescription that could not be conveyed by the other attributes. 1509 */ 1510 @Child(name = "note", type = {Annotation.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1511 @Description(shortDefinition="Information about the prescription", formalDefinition="Extra information about the prescription that could not be conveyed by the other attributes." ) 1512 protected List<Annotation> note; 1513 1514 /** 1515 * Indicates how the medication is to be used by the patient. 1516 */ 1517 @Child(name = "dosageInstruction", type = {Dosage.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1518 @Description(shortDefinition="How the medication should be taken", formalDefinition="Indicates how the medication is to be used by the patient." ) 1519 protected List<Dosage> dosageInstruction; 1520 1521 /** 1522 * Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department. 1523 */ 1524 @Child(name = "dispenseRequest", type = {}, order=19, min=0, max=1, modifier=false, summary=false) 1525 @Description(shortDefinition="Medication supply authorization", formalDefinition="Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department." ) 1526 protected MedicationRequestDispenseRequestComponent dispenseRequest; 1527 1528 /** 1529 * Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done. 1530 */ 1531 @Child(name = "substitution", type = {}, order=20, min=0, max=1, modifier=false, summary=false) 1532 @Description(shortDefinition="Any restrictions on medication substitution", formalDefinition="Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done." ) 1533 protected MedicationRequestSubstitutionComponent substitution; 1534 1535 /** 1536 * A link to a resource representing an earlier order related order or prescription. 1537 */ 1538 @Child(name = "priorPrescription", type = {MedicationRequest.class}, order=21, min=0, max=1, modifier=false, summary=false) 1539 @Description(shortDefinition="An order/prescription that is being replaced", formalDefinition="A link to a resource representing an earlier order related order or prescription." ) 1540 protected Reference priorPrescription; 1541 1542 /** 1543 * The actual object that is the target of the reference (A link to a resource representing an earlier order related order or prescription.) 1544 */ 1545 protected MedicationRequest priorPrescriptionTarget; 1546 1547 /** 1548 * Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc. 1549 */ 1550 @Child(name = "detectedIssue", type = {DetectedIssue.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1551 @Description(shortDefinition="Clinical Issue with action", formalDefinition="Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc." ) 1552 protected List<Reference> detectedIssue; 1553 /** 1554 * The actual objects that are the target of the reference (Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.) 1555 */ 1556 protected List<DetectedIssue> detectedIssueTarget; 1557 1558 1559 /** 1560 * Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource. 1561 */ 1562 @Child(name = "eventHistory", type = {Provenance.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1563 @Description(shortDefinition="A list of events of interest in the lifecycle", formalDefinition="Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource." ) 1564 protected List<Reference> eventHistory; 1565 /** 1566 * The actual objects that are the target of the reference (Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.) 1567 */ 1568 protected List<Provenance> eventHistoryTarget; 1569 1570 1571 private static final long serialVersionUID = 299392400L; 1572 1573 /** 1574 * Constructor 1575 */ 1576 public MedicationRequest() { 1577 super(); 1578 } 1579 1580 /** 1581 * Constructor 1582 */ 1583 public MedicationRequest(Enumeration<MedicationRequestIntent> intent, Type medication, Reference subject) { 1584 super(); 1585 this.intent = intent; 1586 this.medication = medication; 1587 this.subject = subject; 1588 } 1589 1590 /** 1591 * @return {@link #identifier} (This records identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. For example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records must be tracked through an entire system.) 1592 */ 1593 public List<Identifier> getIdentifier() { 1594 if (this.identifier == null) 1595 this.identifier = new ArrayList<Identifier>(); 1596 return this.identifier; 1597 } 1598 1599 /** 1600 * @return Returns a reference to <code>this</code> for easy method chaining 1601 */ 1602 public MedicationRequest setIdentifier(List<Identifier> theIdentifier) { 1603 this.identifier = theIdentifier; 1604 return this; 1605 } 1606 1607 public boolean hasIdentifier() { 1608 if (this.identifier == null) 1609 return false; 1610 for (Identifier item : this.identifier) 1611 if (!item.isEmpty()) 1612 return true; 1613 return false; 1614 } 1615 1616 public Identifier addIdentifier() { //3 1617 Identifier t = new Identifier(); 1618 if (this.identifier == null) 1619 this.identifier = new ArrayList<Identifier>(); 1620 this.identifier.add(t); 1621 return t; 1622 } 1623 1624 public MedicationRequest addIdentifier(Identifier t) { //3 1625 if (t == null) 1626 return this; 1627 if (this.identifier == null) 1628 this.identifier = new ArrayList<Identifier>(); 1629 this.identifier.add(t); 1630 return this; 1631 } 1632 1633 /** 1634 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 1635 */ 1636 public Identifier getIdentifierFirstRep() { 1637 if (getIdentifier().isEmpty()) { 1638 addIdentifier(); 1639 } 1640 return getIdentifier().get(0); 1641 } 1642 1643 /** 1644 * @return {@link #definition} (Protocol or definition followed by this request.) 1645 */ 1646 public List<Reference> getDefinition() { 1647 if (this.definition == null) 1648 this.definition = new ArrayList<Reference>(); 1649 return this.definition; 1650 } 1651 1652 /** 1653 * @return Returns a reference to <code>this</code> for easy method chaining 1654 */ 1655 public MedicationRequest setDefinition(List<Reference> theDefinition) { 1656 this.definition = theDefinition; 1657 return this; 1658 } 1659 1660 public boolean hasDefinition() { 1661 if (this.definition == null) 1662 return false; 1663 for (Reference item : this.definition) 1664 if (!item.isEmpty()) 1665 return true; 1666 return false; 1667 } 1668 1669 public Reference addDefinition() { //3 1670 Reference t = new Reference(); 1671 if (this.definition == null) 1672 this.definition = new ArrayList<Reference>(); 1673 this.definition.add(t); 1674 return t; 1675 } 1676 1677 public MedicationRequest addDefinition(Reference t) { //3 1678 if (t == null) 1679 return this; 1680 if (this.definition == null) 1681 this.definition = new ArrayList<Reference>(); 1682 this.definition.add(t); 1683 return this; 1684 } 1685 1686 /** 1687 * @return The first repetition of repeating field {@link #definition}, creating it if it does not already exist 1688 */ 1689 public Reference getDefinitionFirstRep() { 1690 if (getDefinition().isEmpty()) { 1691 addDefinition(); 1692 } 1693 return getDefinition().get(0); 1694 } 1695 1696 /** 1697 * @deprecated Use Reference#setResource(IBaseResource) instead 1698 */ 1699 @Deprecated 1700 public List<Resource> getDefinitionTarget() { 1701 if (this.definitionTarget == null) 1702 this.definitionTarget = new ArrayList<Resource>(); 1703 return this.definitionTarget; 1704 } 1705 1706 /** 1707 * @return {@link #basedOn} (A plan or request that is fulfilled in whole or in part by this medication request.) 1708 */ 1709 public List<Reference> getBasedOn() { 1710 if (this.basedOn == null) 1711 this.basedOn = new ArrayList<Reference>(); 1712 return this.basedOn; 1713 } 1714 1715 /** 1716 * @return Returns a reference to <code>this</code> for easy method chaining 1717 */ 1718 public MedicationRequest setBasedOn(List<Reference> theBasedOn) { 1719 this.basedOn = theBasedOn; 1720 return this; 1721 } 1722 1723 public boolean hasBasedOn() { 1724 if (this.basedOn == null) 1725 return false; 1726 for (Reference item : this.basedOn) 1727 if (!item.isEmpty()) 1728 return true; 1729 return false; 1730 } 1731 1732 public Reference addBasedOn() { //3 1733 Reference t = new Reference(); 1734 if (this.basedOn == null) 1735 this.basedOn = new ArrayList<Reference>(); 1736 this.basedOn.add(t); 1737 return t; 1738 } 1739 1740 public MedicationRequest addBasedOn(Reference t) { //3 1741 if (t == null) 1742 return this; 1743 if (this.basedOn == null) 1744 this.basedOn = new ArrayList<Reference>(); 1745 this.basedOn.add(t); 1746 return this; 1747 } 1748 1749 /** 1750 * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist 1751 */ 1752 public Reference getBasedOnFirstRep() { 1753 if (getBasedOn().isEmpty()) { 1754 addBasedOn(); 1755 } 1756 return getBasedOn().get(0); 1757 } 1758 1759 /** 1760 * @deprecated Use Reference#setResource(IBaseResource) instead 1761 */ 1762 @Deprecated 1763 public List<Resource> getBasedOnTarget() { 1764 if (this.basedOnTarget == null) 1765 this.basedOnTarget = new ArrayList<Resource>(); 1766 return this.basedOnTarget; 1767 } 1768 1769 /** 1770 * @return {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.) 1771 */ 1772 public Identifier getGroupIdentifier() { 1773 if (this.groupIdentifier == null) 1774 if (Configuration.errorOnAutoCreate()) 1775 throw new Error("Attempt to auto-create MedicationRequest.groupIdentifier"); 1776 else if (Configuration.doAutoCreate()) 1777 this.groupIdentifier = new Identifier(); // cc 1778 return this.groupIdentifier; 1779 } 1780 1781 public boolean hasGroupIdentifier() { 1782 return this.groupIdentifier != null && !this.groupIdentifier.isEmpty(); 1783 } 1784 1785 /** 1786 * @param value {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.) 1787 */ 1788 public MedicationRequest setGroupIdentifier(Identifier value) { 1789 this.groupIdentifier = value; 1790 return this; 1791 } 1792 1793 /** 1794 * @return {@link #status} (A code specifying the current state of the order. Generally this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1795 */ 1796 public Enumeration<MedicationRequestStatus> getStatusElement() { 1797 if (this.status == null) 1798 if (Configuration.errorOnAutoCreate()) 1799 throw new Error("Attempt to auto-create MedicationRequest.status"); 1800 else if (Configuration.doAutoCreate()) 1801 this.status = new Enumeration<MedicationRequestStatus>(new MedicationRequestStatusEnumFactory()); // bb 1802 return this.status; 1803 } 1804 1805 public boolean hasStatusElement() { 1806 return this.status != null && !this.status.isEmpty(); 1807 } 1808 1809 public boolean hasStatus() { 1810 return this.status != null && !this.status.isEmpty(); 1811 } 1812 1813 /** 1814 * @param value {@link #status} (A code specifying the current state of the order. Generally this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1815 */ 1816 public MedicationRequest setStatusElement(Enumeration<MedicationRequestStatus> value) { 1817 this.status = value; 1818 return this; 1819 } 1820 1821 /** 1822 * @return A code specifying the current state of the order. Generally this will be active or completed state. 1823 */ 1824 public MedicationRequestStatus getStatus() { 1825 return this.status == null ? null : this.status.getValue(); 1826 } 1827 1828 /** 1829 * @param value A code specifying the current state of the order. Generally this will be active or completed state. 1830 */ 1831 public MedicationRequest setStatus(MedicationRequestStatus value) { 1832 if (value == null) 1833 this.status = null; 1834 else { 1835 if (this.status == null) 1836 this.status = new Enumeration<MedicationRequestStatus>(new MedicationRequestStatusEnumFactory()); 1837 this.status.setValue(value); 1838 } 1839 return this; 1840 } 1841 1842 /** 1843 * @return {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value 1844 */ 1845 public Enumeration<MedicationRequestIntent> getIntentElement() { 1846 if (this.intent == null) 1847 if (Configuration.errorOnAutoCreate()) 1848 throw new Error("Attempt to auto-create MedicationRequest.intent"); 1849 else if (Configuration.doAutoCreate()) 1850 this.intent = new Enumeration<MedicationRequestIntent>(new MedicationRequestIntentEnumFactory()); // bb 1851 return this.intent; 1852 } 1853 1854 public boolean hasIntentElement() { 1855 return this.intent != null && !this.intent.isEmpty(); 1856 } 1857 1858 public boolean hasIntent() { 1859 return this.intent != null && !this.intent.isEmpty(); 1860 } 1861 1862 /** 1863 * @param value {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value 1864 */ 1865 public MedicationRequest setIntentElement(Enumeration<MedicationRequestIntent> value) { 1866 this.intent = value; 1867 return this; 1868 } 1869 1870 /** 1871 * @return Whether the request is a proposal, plan, or an original order. 1872 */ 1873 public MedicationRequestIntent getIntent() { 1874 return this.intent == null ? null : this.intent.getValue(); 1875 } 1876 1877 /** 1878 * @param value Whether the request is a proposal, plan, or an original order. 1879 */ 1880 public MedicationRequest setIntent(MedicationRequestIntent value) { 1881 if (this.intent == null) 1882 this.intent = new Enumeration<MedicationRequestIntent>(new MedicationRequestIntentEnumFactory()); 1883 this.intent.setValue(value); 1884 return this; 1885 } 1886 1887 /** 1888 * @return {@link #category} (Indicates the type of medication order and where the medication is expected to be consumed or administered.) 1889 */ 1890 public CodeableConcept getCategory() { 1891 if (this.category == null) 1892 if (Configuration.errorOnAutoCreate()) 1893 throw new Error("Attempt to auto-create MedicationRequest.category"); 1894 else if (Configuration.doAutoCreate()) 1895 this.category = new CodeableConcept(); // cc 1896 return this.category; 1897 } 1898 1899 public boolean hasCategory() { 1900 return this.category != null && !this.category.isEmpty(); 1901 } 1902 1903 /** 1904 * @param value {@link #category} (Indicates the type of medication order and where the medication is expected to be consumed or administered.) 1905 */ 1906 public MedicationRequest setCategory(CodeableConcept value) { 1907 this.category = value; 1908 return this; 1909 } 1910 1911 /** 1912 * @return {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1913 */ 1914 public Enumeration<MedicationRequestPriority> getPriorityElement() { 1915 if (this.priority == null) 1916 if (Configuration.errorOnAutoCreate()) 1917 throw new Error("Attempt to auto-create MedicationRequest.priority"); 1918 else if (Configuration.doAutoCreate()) 1919 this.priority = new Enumeration<MedicationRequestPriority>(new MedicationRequestPriorityEnumFactory()); // bb 1920 return this.priority; 1921 } 1922 1923 public boolean hasPriorityElement() { 1924 return this.priority != null && !this.priority.isEmpty(); 1925 } 1926 1927 public boolean hasPriority() { 1928 return this.priority != null && !this.priority.isEmpty(); 1929 } 1930 1931 /** 1932 * @param value {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value 1933 */ 1934 public MedicationRequest setPriorityElement(Enumeration<MedicationRequestPriority> value) { 1935 this.priority = value; 1936 return this; 1937 } 1938 1939 /** 1940 * @return Indicates how quickly the Medication Request should be addressed with respect to other requests. 1941 */ 1942 public MedicationRequestPriority getPriority() { 1943 return this.priority == null ? null : this.priority.getValue(); 1944 } 1945 1946 /** 1947 * @param value Indicates how quickly the Medication Request should be addressed with respect to other requests. 1948 */ 1949 public MedicationRequest setPriority(MedicationRequestPriority value) { 1950 if (value == null) 1951 this.priority = null; 1952 else { 1953 if (this.priority == null) 1954 this.priority = new Enumeration<MedicationRequestPriority>(new MedicationRequestPriorityEnumFactory()); 1955 this.priority.setValue(value); 1956 } 1957 return this; 1958 } 1959 1960 /** 1961 * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 1962 */ 1963 public Type getMedication() { 1964 return this.medication; 1965 } 1966 1967 /** 1968 * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 1969 */ 1970 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 1971 if (this.medication == null) 1972 return null; 1973 if (!(this.medication instanceof CodeableConcept)) 1974 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); 1975 return (CodeableConcept) this.medication; 1976 } 1977 1978 public boolean hasMedicationCodeableConcept() { 1979 return this != null && this.medication instanceof CodeableConcept; 1980 } 1981 1982 /** 1983 * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 1984 */ 1985 public Reference getMedicationReference() throws FHIRException { 1986 if (this.medication == null) 1987 return null; 1988 if (!(this.medication instanceof Reference)) 1989 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); 1990 return (Reference) this.medication; 1991 } 1992 1993 public boolean hasMedicationReference() { 1994 return this != null && this.medication instanceof Reference; 1995 } 1996 1997 public boolean hasMedication() { 1998 return this.medication != null && !this.medication.isEmpty(); 1999 } 2000 2001 /** 2002 * @param value {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 2003 */ 2004 public MedicationRequest setMedication(Type value) throws FHIRFormatError { 2005 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 2006 throw new FHIRFormatError("Not the right type for MedicationRequest.medication[x]: "+value.fhirType()); 2007 this.medication = value; 2008 return this; 2009 } 2010 2011 /** 2012 * @return {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.) 2013 */ 2014 public Reference getSubject() { 2015 if (this.subject == null) 2016 if (Configuration.errorOnAutoCreate()) 2017 throw new Error("Attempt to auto-create MedicationRequest.subject"); 2018 else if (Configuration.doAutoCreate()) 2019 this.subject = new Reference(); // cc 2020 return this.subject; 2021 } 2022 2023 public boolean hasSubject() { 2024 return this.subject != null && !this.subject.isEmpty(); 2025 } 2026 2027 /** 2028 * @param value {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.) 2029 */ 2030 public MedicationRequest setSubject(Reference value) { 2031 this.subject = value; 2032 return this; 2033 } 2034 2035 /** 2036 * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to a resource representing the person or set of individuals to whom the medication will be given.) 2037 */ 2038 public Resource getSubjectTarget() { 2039 return this.subjectTarget; 2040 } 2041 2042 /** 2043 * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to a resource representing the person or set of individuals to whom the medication will be given.) 2044 */ 2045 public MedicationRequest setSubjectTarget(Resource value) { 2046 this.subjectTarget = value; 2047 return this; 2048 } 2049 2050 /** 2051 * @return {@link #context} (A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.) 2052 */ 2053 public Reference getContext() { 2054 if (this.context == null) 2055 if (Configuration.errorOnAutoCreate()) 2056 throw new Error("Attempt to auto-create MedicationRequest.context"); 2057 else if (Configuration.doAutoCreate()) 2058 this.context = new Reference(); // cc 2059 return this.context; 2060 } 2061 2062 public boolean hasContext() { 2063 return this.context != null && !this.context.isEmpty(); 2064 } 2065 2066 /** 2067 * @param value {@link #context} (A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.) 2068 */ 2069 public MedicationRequest setContext(Reference value) { 2070 this.context = value; 2071 return this; 2072 } 2073 2074 /** 2075 * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.) 2076 */ 2077 public Resource getContextTarget() { 2078 return this.contextTarget; 2079 } 2080 2081 /** 2082 * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.) 2083 */ 2084 public MedicationRequest setContextTarget(Resource value) { 2085 this.contextTarget = value; 2086 return this; 2087 } 2088 2089 /** 2090 * @return {@link #supportingInformation} (Include additional information (for example, patient height and weight) that supports the ordering of the medication.) 2091 */ 2092 public List<Reference> getSupportingInformation() { 2093 if (this.supportingInformation == null) 2094 this.supportingInformation = new ArrayList<Reference>(); 2095 return this.supportingInformation; 2096 } 2097 2098 /** 2099 * @return Returns a reference to <code>this</code> for easy method chaining 2100 */ 2101 public MedicationRequest setSupportingInformation(List<Reference> theSupportingInformation) { 2102 this.supportingInformation = theSupportingInformation; 2103 return this; 2104 } 2105 2106 public boolean hasSupportingInformation() { 2107 if (this.supportingInformation == null) 2108 return false; 2109 for (Reference item : this.supportingInformation) 2110 if (!item.isEmpty()) 2111 return true; 2112 return false; 2113 } 2114 2115 public Reference addSupportingInformation() { //3 2116 Reference t = new Reference(); 2117 if (this.supportingInformation == null) 2118 this.supportingInformation = new ArrayList<Reference>(); 2119 this.supportingInformation.add(t); 2120 return t; 2121 } 2122 2123 public MedicationRequest addSupportingInformation(Reference t) { //3 2124 if (t == null) 2125 return this; 2126 if (this.supportingInformation == null) 2127 this.supportingInformation = new ArrayList<Reference>(); 2128 this.supportingInformation.add(t); 2129 return this; 2130 } 2131 2132 /** 2133 * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist 2134 */ 2135 public Reference getSupportingInformationFirstRep() { 2136 if (getSupportingInformation().isEmpty()) { 2137 addSupportingInformation(); 2138 } 2139 return getSupportingInformation().get(0); 2140 } 2141 2142 /** 2143 * @deprecated Use Reference#setResource(IBaseResource) instead 2144 */ 2145 @Deprecated 2146 public List<Resource> getSupportingInformationTarget() { 2147 if (this.supportingInformationTarget == null) 2148 this.supportingInformationTarget = new ArrayList<Resource>(); 2149 return this.supportingInformationTarget; 2150 } 2151 2152 /** 2153 * @return {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value 2154 */ 2155 public DateTimeType getAuthoredOnElement() { 2156 if (this.authoredOn == null) 2157 if (Configuration.errorOnAutoCreate()) 2158 throw new Error("Attempt to auto-create MedicationRequest.authoredOn"); 2159 else if (Configuration.doAutoCreate()) 2160 this.authoredOn = new DateTimeType(); // bb 2161 return this.authoredOn; 2162 } 2163 2164 public boolean hasAuthoredOnElement() { 2165 return this.authoredOn != null && !this.authoredOn.isEmpty(); 2166 } 2167 2168 public boolean hasAuthoredOn() { 2169 return this.authoredOn != null && !this.authoredOn.isEmpty(); 2170 } 2171 2172 /** 2173 * @param value {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value 2174 */ 2175 public MedicationRequest setAuthoredOnElement(DateTimeType value) { 2176 this.authoredOn = value; 2177 return this; 2178 } 2179 2180 /** 2181 * @return The date (and perhaps time) when the prescription was initially written or authored on. 2182 */ 2183 public Date getAuthoredOn() { 2184 return this.authoredOn == null ? null : this.authoredOn.getValue(); 2185 } 2186 2187 /** 2188 * @param value The date (and perhaps time) when the prescription was initially written or authored on. 2189 */ 2190 public MedicationRequest setAuthoredOn(Date value) { 2191 if (value == null) 2192 this.authoredOn = null; 2193 else { 2194 if (this.authoredOn == null) 2195 this.authoredOn = new DateTimeType(); 2196 this.authoredOn.setValue(value); 2197 } 2198 return this; 2199 } 2200 2201 /** 2202 * @return {@link #requester} (The individual, organization or device that initiated the request and has responsibility for its activation.) 2203 */ 2204 public MedicationRequestRequesterComponent getRequester() { 2205 if (this.requester == null) 2206 if (Configuration.errorOnAutoCreate()) 2207 throw new Error("Attempt to auto-create MedicationRequest.requester"); 2208 else if (Configuration.doAutoCreate()) 2209 this.requester = new MedicationRequestRequesterComponent(); // cc 2210 return this.requester; 2211 } 2212 2213 public boolean hasRequester() { 2214 return this.requester != null && !this.requester.isEmpty(); 2215 } 2216 2217 /** 2218 * @param value {@link #requester} (The individual, organization or device that initiated the request and has responsibility for its activation.) 2219 */ 2220 public MedicationRequest setRequester(MedicationRequestRequesterComponent value) { 2221 this.requester = value; 2222 return this; 2223 } 2224 2225 /** 2226 * @return {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) 2227 */ 2228 public Reference getRecorder() { 2229 if (this.recorder == null) 2230 if (Configuration.errorOnAutoCreate()) 2231 throw new Error("Attempt to auto-create MedicationRequest.recorder"); 2232 else if (Configuration.doAutoCreate()) 2233 this.recorder = new Reference(); // cc 2234 return this.recorder; 2235 } 2236 2237 public boolean hasRecorder() { 2238 return this.recorder != null && !this.recorder.isEmpty(); 2239 } 2240 2241 /** 2242 * @param value {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) 2243 */ 2244 public MedicationRequest setRecorder(Reference value) { 2245 this.recorder = value; 2246 return this; 2247 } 2248 2249 /** 2250 * @return {@link #recorder} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) 2251 */ 2252 public Practitioner getRecorderTarget() { 2253 if (this.recorderTarget == null) 2254 if (Configuration.errorOnAutoCreate()) 2255 throw new Error("Attempt to auto-create MedicationRequest.recorder"); 2256 else if (Configuration.doAutoCreate()) 2257 this.recorderTarget = new Practitioner(); // aa 2258 return this.recorderTarget; 2259 } 2260 2261 /** 2262 * @param value {@link #recorder} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) 2263 */ 2264 public MedicationRequest setRecorderTarget(Practitioner value) { 2265 this.recorderTarget = value; 2266 return this; 2267 } 2268 2269 /** 2270 * @return {@link #reasonCode} (The reason or the indication for ordering the medication.) 2271 */ 2272 public List<CodeableConcept> getReasonCode() { 2273 if (this.reasonCode == null) 2274 this.reasonCode = new ArrayList<CodeableConcept>(); 2275 return this.reasonCode; 2276 } 2277 2278 /** 2279 * @return Returns a reference to <code>this</code> for easy method chaining 2280 */ 2281 public MedicationRequest setReasonCode(List<CodeableConcept> theReasonCode) { 2282 this.reasonCode = theReasonCode; 2283 return this; 2284 } 2285 2286 public boolean hasReasonCode() { 2287 if (this.reasonCode == null) 2288 return false; 2289 for (CodeableConcept item : this.reasonCode) 2290 if (!item.isEmpty()) 2291 return true; 2292 return false; 2293 } 2294 2295 public CodeableConcept addReasonCode() { //3 2296 CodeableConcept t = new CodeableConcept(); 2297 if (this.reasonCode == null) 2298 this.reasonCode = new ArrayList<CodeableConcept>(); 2299 this.reasonCode.add(t); 2300 return t; 2301 } 2302 2303 public MedicationRequest addReasonCode(CodeableConcept t) { //3 2304 if (t == null) 2305 return this; 2306 if (this.reasonCode == null) 2307 this.reasonCode = new ArrayList<CodeableConcept>(); 2308 this.reasonCode.add(t); 2309 return this; 2310 } 2311 2312 /** 2313 * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist 2314 */ 2315 public CodeableConcept getReasonCodeFirstRep() { 2316 if (getReasonCode().isEmpty()) { 2317 addReasonCode(); 2318 } 2319 return getReasonCode().get(0); 2320 } 2321 2322 /** 2323 * @return {@link #reasonReference} (Condition or observation that supports why the medication was ordered.) 2324 */ 2325 public List<Reference> getReasonReference() { 2326 if (this.reasonReference == null) 2327 this.reasonReference = new ArrayList<Reference>(); 2328 return this.reasonReference; 2329 } 2330 2331 /** 2332 * @return Returns a reference to <code>this</code> for easy method chaining 2333 */ 2334 public MedicationRequest setReasonReference(List<Reference> theReasonReference) { 2335 this.reasonReference = theReasonReference; 2336 return this; 2337 } 2338 2339 public boolean hasReasonReference() { 2340 if (this.reasonReference == null) 2341 return false; 2342 for (Reference item : this.reasonReference) 2343 if (!item.isEmpty()) 2344 return true; 2345 return false; 2346 } 2347 2348 public Reference addReasonReference() { //3 2349 Reference t = new Reference(); 2350 if (this.reasonReference == null) 2351 this.reasonReference = new ArrayList<Reference>(); 2352 this.reasonReference.add(t); 2353 return t; 2354 } 2355 2356 public MedicationRequest addReasonReference(Reference t) { //3 2357 if (t == null) 2358 return this; 2359 if (this.reasonReference == null) 2360 this.reasonReference = new ArrayList<Reference>(); 2361 this.reasonReference.add(t); 2362 return this; 2363 } 2364 2365 /** 2366 * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist 2367 */ 2368 public Reference getReasonReferenceFirstRep() { 2369 if (getReasonReference().isEmpty()) { 2370 addReasonReference(); 2371 } 2372 return getReasonReference().get(0); 2373 } 2374 2375 /** 2376 * @deprecated Use Reference#setResource(IBaseResource) instead 2377 */ 2378 @Deprecated 2379 public List<Resource> getReasonReferenceTarget() { 2380 if (this.reasonReferenceTarget == null) 2381 this.reasonReferenceTarget = new ArrayList<Resource>(); 2382 return this.reasonReferenceTarget; 2383 } 2384 2385 /** 2386 * @return {@link #note} (Extra information about the prescription that could not be conveyed by the other attributes.) 2387 */ 2388 public List<Annotation> getNote() { 2389 if (this.note == null) 2390 this.note = new ArrayList<Annotation>(); 2391 return this.note; 2392 } 2393 2394 /** 2395 * @return Returns a reference to <code>this</code> for easy method chaining 2396 */ 2397 public MedicationRequest setNote(List<Annotation> theNote) { 2398 this.note = theNote; 2399 return this; 2400 } 2401 2402 public boolean hasNote() { 2403 if (this.note == null) 2404 return false; 2405 for (Annotation item : this.note) 2406 if (!item.isEmpty()) 2407 return true; 2408 return false; 2409 } 2410 2411 public Annotation addNote() { //3 2412 Annotation t = new Annotation(); 2413 if (this.note == null) 2414 this.note = new ArrayList<Annotation>(); 2415 this.note.add(t); 2416 return t; 2417 } 2418 2419 public MedicationRequest addNote(Annotation t) { //3 2420 if (t == null) 2421 return this; 2422 if (this.note == null) 2423 this.note = new ArrayList<Annotation>(); 2424 this.note.add(t); 2425 return this; 2426 } 2427 2428 /** 2429 * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist 2430 */ 2431 public Annotation getNoteFirstRep() { 2432 if (getNote().isEmpty()) { 2433 addNote(); 2434 } 2435 return getNote().get(0); 2436 } 2437 2438 /** 2439 * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient.) 2440 */ 2441 public List<Dosage> getDosageInstruction() { 2442 if (this.dosageInstruction == null) 2443 this.dosageInstruction = new ArrayList<Dosage>(); 2444 return this.dosageInstruction; 2445 } 2446 2447 /** 2448 * @return Returns a reference to <code>this</code> for easy method chaining 2449 */ 2450 public MedicationRequest setDosageInstruction(List<Dosage> theDosageInstruction) { 2451 this.dosageInstruction = theDosageInstruction; 2452 return this; 2453 } 2454 2455 public boolean hasDosageInstruction() { 2456 if (this.dosageInstruction == null) 2457 return false; 2458 for (Dosage item : this.dosageInstruction) 2459 if (!item.isEmpty()) 2460 return true; 2461 return false; 2462 } 2463 2464 public Dosage addDosageInstruction() { //3 2465 Dosage t = new Dosage(); 2466 if (this.dosageInstruction == null) 2467 this.dosageInstruction = new ArrayList<Dosage>(); 2468 this.dosageInstruction.add(t); 2469 return t; 2470 } 2471 2472 public MedicationRequest addDosageInstruction(Dosage t) { //3 2473 if (t == null) 2474 return this; 2475 if (this.dosageInstruction == null) 2476 this.dosageInstruction = new ArrayList<Dosage>(); 2477 this.dosageInstruction.add(t); 2478 return this; 2479 } 2480 2481 /** 2482 * @return The first repetition of repeating field {@link #dosageInstruction}, creating it if it does not already exist 2483 */ 2484 public Dosage getDosageInstructionFirstRep() { 2485 if (getDosageInstruction().isEmpty()) { 2486 addDosageInstruction(); 2487 } 2488 return getDosageInstruction().get(0); 2489 } 2490 2491 /** 2492 * @return {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) 2493 */ 2494 public MedicationRequestDispenseRequestComponent getDispenseRequest() { 2495 if (this.dispenseRequest == null) 2496 if (Configuration.errorOnAutoCreate()) 2497 throw new Error("Attempt to auto-create MedicationRequest.dispenseRequest"); 2498 else if (Configuration.doAutoCreate()) 2499 this.dispenseRequest = new MedicationRequestDispenseRequestComponent(); // cc 2500 return this.dispenseRequest; 2501 } 2502 2503 public boolean hasDispenseRequest() { 2504 return this.dispenseRequest != null && !this.dispenseRequest.isEmpty(); 2505 } 2506 2507 /** 2508 * @param value {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) 2509 */ 2510 public MedicationRequest setDispenseRequest(MedicationRequestDispenseRequestComponent value) { 2511 this.dispenseRequest = value; 2512 return this; 2513 } 2514 2515 /** 2516 * @return {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.) 2517 */ 2518 public MedicationRequestSubstitutionComponent getSubstitution() { 2519 if (this.substitution == null) 2520 if (Configuration.errorOnAutoCreate()) 2521 throw new Error("Attempt to auto-create MedicationRequest.substitution"); 2522 else if (Configuration.doAutoCreate()) 2523 this.substitution = new MedicationRequestSubstitutionComponent(); // cc 2524 return this.substitution; 2525 } 2526 2527 public boolean hasSubstitution() { 2528 return this.substitution != null && !this.substitution.isEmpty(); 2529 } 2530 2531 /** 2532 * @param value {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.) 2533 */ 2534 public MedicationRequest setSubstitution(MedicationRequestSubstitutionComponent value) { 2535 this.substitution = value; 2536 return this; 2537 } 2538 2539 /** 2540 * @return {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.) 2541 */ 2542 public Reference getPriorPrescription() { 2543 if (this.priorPrescription == null) 2544 if (Configuration.errorOnAutoCreate()) 2545 throw new Error("Attempt to auto-create MedicationRequest.priorPrescription"); 2546 else if (Configuration.doAutoCreate()) 2547 this.priorPrescription = new Reference(); // cc 2548 return this.priorPrescription; 2549 } 2550 2551 public boolean hasPriorPrescription() { 2552 return this.priorPrescription != null && !this.priorPrescription.isEmpty(); 2553 } 2554 2555 /** 2556 * @param value {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.) 2557 */ 2558 public MedicationRequest setPriorPrescription(Reference value) { 2559 this.priorPrescription = value; 2560 return this; 2561 } 2562 2563 /** 2564 * @return {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order related order or prescription.) 2565 */ 2566 public MedicationRequest getPriorPrescriptionTarget() { 2567 if (this.priorPrescriptionTarget == null) 2568 if (Configuration.errorOnAutoCreate()) 2569 throw new Error("Attempt to auto-create MedicationRequest.priorPrescription"); 2570 else if (Configuration.doAutoCreate()) 2571 this.priorPrescriptionTarget = new MedicationRequest(); // aa 2572 return this.priorPrescriptionTarget; 2573 } 2574 2575 /** 2576 * @param value {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order related order or prescription.) 2577 */ 2578 public MedicationRequest setPriorPrescriptionTarget(MedicationRequest value) { 2579 this.priorPrescriptionTarget = value; 2580 return this; 2581 } 2582 2583 /** 2584 * @return {@link #detectedIssue} (Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.) 2585 */ 2586 public List<Reference> getDetectedIssue() { 2587 if (this.detectedIssue == null) 2588 this.detectedIssue = new ArrayList<Reference>(); 2589 return this.detectedIssue; 2590 } 2591 2592 /** 2593 * @return Returns a reference to <code>this</code> for easy method chaining 2594 */ 2595 public MedicationRequest setDetectedIssue(List<Reference> theDetectedIssue) { 2596 this.detectedIssue = theDetectedIssue; 2597 return this; 2598 } 2599 2600 public boolean hasDetectedIssue() { 2601 if (this.detectedIssue == null) 2602 return false; 2603 for (Reference item : this.detectedIssue) 2604 if (!item.isEmpty()) 2605 return true; 2606 return false; 2607 } 2608 2609 public Reference addDetectedIssue() { //3 2610 Reference t = new Reference(); 2611 if (this.detectedIssue == null) 2612 this.detectedIssue = new ArrayList<Reference>(); 2613 this.detectedIssue.add(t); 2614 return t; 2615 } 2616 2617 public MedicationRequest addDetectedIssue(Reference t) { //3 2618 if (t == null) 2619 return this; 2620 if (this.detectedIssue == null) 2621 this.detectedIssue = new ArrayList<Reference>(); 2622 this.detectedIssue.add(t); 2623 return this; 2624 } 2625 2626 /** 2627 * @return The first repetition of repeating field {@link #detectedIssue}, creating it if it does not already exist 2628 */ 2629 public Reference getDetectedIssueFirstRep() { 2630 if (getDetectedIssue().isEmpty()) { 2631 addDetectedIssue(); 2632 } 2633 return getDetectedIssue().get(0); 2634 } 2635 2636 /** 2637 * @deprecated Use Reference#setResource(IBaseResource) instead 2638 */ 2639 @Deprecated 2640 public List<DetectedIssue> getDetectedIssueTarget() { 2641 if (this.detectedIssueTarget == null) 2642 this.detectedIssueTarget = new ArrayList<DetectedIssue>(); 2643 return this.detectedIssueTarget; 2644 } 2645 2646 /** 2647 * @deprecated Use Reference#setResource(IBaseResource) instead 2648 */ 2649 @Deprecated 2650 public DetectedIssue addDetectedIssueTarget() { 2651 DetectedIssue r = new DetectedIssue(); 2652 if (this.detectedIssueTarget == null) 2653 this.detectedIssueTarget = new ArrayList<DetectedIssue>(); 2654 this.detectedIssueTarget.add(r); 2655 return r; 2656 } 2657 2658 /** 2659 * @return {@link #eventHistory} (Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.) 2660 */ 2661 public List<Reference> getEventHistory() { 2662 if (this.eventHistory == null) 2663 this.eventHistory = new ArrayList<Reference>(); 2664 return this.eventHistory; 2665 } 2666 2667 /** 2668 * @return Returns a reference to <code>this</code> for easy method chaining 2669 */ 2670 public MedicationRequest setEventHistory(List<Reference> theEventHistory) { 2671 this.eventHistory = theEventHistory; 2672 return this; 2673 } 2674 2675 public boolean hasEventHistory() { 2676 if (this.eventHistory == null) 2677 return false; 2678 for (Reference item : this.eventHistory) 2679 if (!item.isEmpty()) 2680 return true; 2681 return false; 2682 } 2683 2684 public Reference addEventHistory() { //3 2685 Reference t = new Reference(); 2686 if (this.eventHistory == null) 2687 this.eventHistory = new ArrayList<Reference>(); 2688 this.eventHistory.add(t); 2689 return t; 2690 } 2691 2692 public MedicationRequest addEventHistory(Reference t) { //3 2693 if (t == null) 2694 return this; 2695 if (this.eventHistory == null) 2696 this.eventHistory = new ArrayList<Reference>(); 2697 this.eventHistory.add(t); 2698 return this; 2699 } 2700 2701 /** 2702 * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist 2703 */ 2704 public Reference getEventHistoryFirstRep() { 2705 if (getEventHistory().isEmpty()) { 2706 addEventHistory(); 2707 } 2708 return getEventHistory().get(0); 2709 } 2710 2711 /** 2712 * @deprecated Use Reference#setResource(IBaseResource) instead 2713 */ 2714 @Deprecated 2715 public List<Provenance> getEventHistoryTarget() { 2716 if (this.eventHistoryTarget == null) 2717 this.eventHistoryTarget = new ArrayList<Provenance>(); 2718 return this.eventHistoryTarget; 2719 } 2720 2721 /** 2722 * @deprecated Use Reference#setResource(IBaseResource) instead 2723 */ 2724 @Deprecated 2725 public Provenance addEventHistoryTarget() { 2726 Provenance r = new Provenance(); 2727 if (this.eventHistoryTarget == null) 2728 this.eventHistoryTarget = new ArrayList<Provenance>(); 2729 this.eventHistoryTarget.add(r); 2730 return r; 2731 } 2732 2733 protected void listChildren(List<Property> children) { 2734 super.listChildren(children); 2735 children.add(new Property("identifier", "Identifier", "This records identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. For example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records must be tracked through an entire system.", 0, java.lang.Integer.MAX_VALUE, identifier)); 2736 children.add(new Property("definition", "Reference(ActivityDefinition|PlanDefinition)", "Protocol or definition followed by this request.", 0, java.lang.Integer.MAX_VALUE, definition)); 2737 children.add(new Property("basedOn", "Reference(CarePlan|MedicationRequest|ProcedureRequest|ReferralRequest)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn)); 2738 children.add(new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier)); 2739 children.add(new Property("status", "code", "A code specifying the current state of the order. Generally this will be active or completed state.", 0, 1, status)); 2740 children.add(new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent)); 2741 children.add(new Property("category", "CodeableConcept", "Indicates the type of medication order and where the medication is expected to be consumed or administered.", 0, 1, category)); 2742 children.add(new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority)); 2743 children.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication)); 2744 children.add(new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject)); 2745 children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.", 0, 1, context)); 2746 children.add(new Property("supportingInformation", "Reference(Any)", "Include additional information (for example, patient height and weight) that supports the ordering of the medication.", 0, java.lang.Integer.MAX_VALUE, supportingInformation)); 2747 children.add(new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn)); 2748 children.add(new Property("requester", "", "The individual, organization or device that initiated the request and has responsibility for its activation.", 0, 1, requester)); 2749 children.add(new Property("recorder", "Reference(Practitioner)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder)); 2750 children.add(new Property("reasonCode", "CodeableConcept", "The reason or the indication for ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reasonCode)); 2751 children.add(new Property("reasonReference", "Reference(Condition|Observation)", "Condition or observation that supports why the medication was ordered.", 0, java.lang.Integer.MAX_VALUE, reasonReference)); 2752 children.add(new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); 2753 children.add(new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction)); 2754 children.add(new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest)); 2755 children.add(new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution)); 2756 children.add(new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription)); 2757 children.add(new Property("detectedIssue", "Reference(DetectedIssue)", "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.", 0, java.lang.Integer.MAX_VALUE, detectedIssue)); 2758 children.add(new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory)); 2759 } 2760 2761 @Override 2762 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2763 switch (_hash) { 2764 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "This records identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. For example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records must be tracked through an entire system.", 0, java.lang.Integer.MAX_VALUE, identifier); 2765 case -1014418093: /*definition*/ return new Property("definition", "Reference(ActivityDefinition|PlanDefinition)", "Protocol or definition followed by this request.", 0, java.lang.Integer.MAX_VALUE, definition); 2766 case -332612366: /*basedOn*/ return new Property("basedOn", "Reference(CarePlan|MedicationRequest|ProcedureRequest|ReferralRequest)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn); 2767 case -445338488: /*groupIdentifier*/ return new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier); 2768 case -892481550: /*status*/ return new Property("status", "code", "A code specifying the current state of the order. Generally this will be active or completed state.", 0, 1, status); 2769 case -1183762788: /*intent*/ return new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent); 2770 case 50511102: /*category*/ return new Property("category", "CodeableConcept", "Indicates the type of medication order and where the medication is expected to be consumed or administered.", 0, 1, category); 2771 case -1165461084: /*priority*/ return new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority); 2772 case 1458402129: /*medication[x]*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2773 case 1998965455: /*medication*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2774 case -209845038: /*medicationCodeableConcept*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2775 case 2104315196: /*medicationReference*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2776 case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject); 2777 case 951530927: /*context*/ return new Property("context", "Reference(Encounter|EpisodeOfCare)", "A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.", 0, 1, context); 2778 case -1248768647: /*supportingInformation*/ return new Property("supportingInformation", "Reference(Any)", "Include additional information (for example, patient height and weight) that supports the ordering of the medication.", 0, java.lang.Integer.MAX_VALUE, supportingInformation); 2779 case -1500852503: /*authoredOn*/ return new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn); 2780 case 693933948: /*requester*/ return new Property("requester", "", "The individual, organization or device that initiated the request and has responsibility for its activation.", 0, 1, requester); 2781 case -799233858: /*recorder*/ return new Property("recorder", "Reference(Practitioner)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder); 2782 case 722137681: /*reasonCode*/ return new Property("reasonCode", "CodeableConcept", "The reason or the indication for ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reasonCode); 2783 case -1146218137: /*reasonReference*/ return new Property("reasonReference", "Reference(Condition|Observation)", "Condition or observation that supports why the medication was ordered.", 0, java.lang.Integer.MAX_VALUE, reasonReference); 2784 case 3387378: /*note*/ return new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note); 2785 case -1201373865: /*dosageInstruction*/ return new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction); 2786 case 824620658: /*dispenseRequest*/ return new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest); 2787 case 826147581: /*substitution*/ return new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution); 2788 case -486355964: /*priorPrescription*/ return new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription); 2789 case 51602295: /*detectedIssue*/ return new Property("detectedIssue", "Reference(DetectedIssue)", "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.", 0, java.lang.Integer.MAX_VALUE, detectedIssue); 2790 case 1835190426: /*eventHistory*/ return new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory); 2791 default: return super.getNamedProperty(_hash, _name, _checkValid); 2792 } 2793 2794 } 2795 2796 @Override 2797 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2798 switch (hash) { 2799 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 2800 case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : this.definition.toArray(new Base[this.definition.size()]); // Reference 2801 case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference 2802 case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier 2803 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationRequestStatus> 2804 case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<MedicationRequestIntent> 2805 case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept 2806 case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<MedicationRequestPriority> 2807 case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type 2808 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 2809 case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference 2810 case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference 2811 case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType 2812 case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // MedicationRequestRequesterComponent 2813 case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference 2814 case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept 2815 case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference 2816 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 2817 case -1201373865: /*dosageInstruction*/ return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // Dosage 2818 case 824620658: /*dispenseRequest*/ return this.dispenseRequest == null ? new Base[0] : new Base[] {this.dispenseRequest}; // MedicationRequestDispenseRequestComponent 2819 case 826147581: /*substitution*/ return this.substitution == null ? new Base[0] : new Base[] {this.substitution}; // MedicationRequestSubstitutionComponent 2820 case -486355964: /*priorPrescription*/ return this.priorPrescription == null ? new Base[0] : new Base[] {this.priorPrescription}; // Reference 2821 case 51602295: /*detectedIssue*/ return this.detectedIssue == null ? new Base[0] : this.detectedIssue.toArray(new Base[this.detectedIssue.size()]); // Reference 2822 case 1835190426: /*eventHistory*/ return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference 2823 default: return super.getProperty(hash, name, checkValid); 2824 } 2825 2826 } 2827 2828 @Override 2829 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2830 switch (hash) { 2831 case -1618432855: // identifier 2832 this.getIdentifier().add(castToIdentifier(value)); // Identifier 2833 return value; 2834 case -1014418093: // definition 2835 this.getDefinition().add(castToReference(value)); // Reference 2836 return value; 2837 case -332612366: // basedOn 2838 this.getBasedOn().add(castToReference(value)); // Reference 2839 return value; 2840 case -445338488: // groupIdentifier 2841 this.groupIdentifier = castToIdentifier(value); // Identifier 2842 return value; 2843 case -892481550: // status 2844 value = new MedicationRequestStatusEnumFactory().fromType(castToCode(value)); 2845 this.status = (Enumeration) value; // Enumeration<MedicationRequestStatus> 2846 return value; 2847 case -1183762788: // intent 2848 value = new MedicationRequestIntentEnumFactory().fromType(castToCode(value)); 2849 this.intent = (Enumeration) value; // Enumeration<MedicationRequestIntent> 2850 return value; 2851 case 50511102: // category 2852 this.category = castToCodeableConcept(value); // CodeableConcept 2853 return value; 2854 case -1165461084: // priority 2855 value = new MedicationRequestPriorityEnumFactory().fromType(castToCode(value)); 2856 this.priority = (Enumeration) value; // Enumeration<MedicationRequestPriority> 2857 return value; 2858 case 1998965455: // medication 2859 this.medication = castToType(value); // Type 2860 return value; 2861 case -1867885268: // subject 2862 this.subject = castToReference(value); // Reference 2863 return value; 2864 case 951530927: // context 2865 this.context = castToReference(value); // Reference 2866 return value; 2867 case -1248768647: // supportingInformation 2868 this.getSupportingInformation().add(castToReference(value)); // Reference 2869 return value; 2870 case -1500852503: // authoredOn 2871 this.authoredOn = castToDateTime(value); // DateTimeType 2872 return value; 2873 case 693933948: // requester 2874 this.requester = (MedicationRequestRequesterComponent) value; // MedicationRequestRequesterComponent 2875 return value; 2876 case -799233858: // recorder 2877 this.recorder = castToReference(value); // Reference 2878 return value; 2879 case 722137681: // reasonCode 2880 this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept 2881 return value; 2882 case -1146218137: // reasonReference 2883 this.getReasonReference().add(castToReference(value)); // Reference 2884 return value; 2885 case 3387378: // note 2886 this.getNote().add(castToAnnotation(value)); // Annotation 2887 return value; 2888 case -1201373865: // dosageInstruction 2889 this.getDosageInstruction().add(castToDosage(value)); // Dosage 2890 return value; 2891 case 824620658: // dispenseRequest 2892 this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent 2893 return value; 2894 case 826147581: // substitution 2895 this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent 2896 return value; 2897 case -486355964: // priorPrescription 2898 this.priorPrescription = castToReference(value); // Reference 2899 return value; 2900 case 51602295: // detectedIssue 2901 this.getDetectedIssue().add(castToReference(value)); // Reference 2902 return value; 2903 case 1835190426: // eventHistory 2904 this.getEventHistory().add(castToReference(value)); // Reference 2905 return value; 2906 default: return super.setProperty(hash, name, value); 2907 } 2908 2909 } 2910 2911 @Override 2912 public Base setProperty(String name, Base value) throws FHIRException { 2913 if (name.equals("identifier")) { 2914 this.getIdentifier().add(castToIdentifier(value)); 2915 } else if (name.equals("definition")) { 2916 this.getDefinition().add(castToReference(value)); 2917 } else if (name.equals("basedOn")) { 2918 this.getBasedOn().add(castToReference(value)); 2919 } else if (name.equals("groupIdentifier")) { 2920 this.groupIdentifier = castToIdentifier(value); // Identifier 2921 } else if (name.equals("status")) { 2922 value = new MedicationRequestStatusEnumFactory().fromType(castToCode(value)); 2923 this.status = (Enumeration) value; // Enumeration<MedicationRequestStatus> 2924 } else if (name.equals("intent")) { 2925 value = new MedicationRequestIntentEnumFactory().fromType(castToCode(value)); 2926 this.intent = (Enumeration) value; // Enumeration<MedicationRequestIntent> 2927 } else if (name.equals("category")) { 2928 this.category = castToCodeableConcept(value); // CodeableConcept 2929 } else if (name.equals("priority")) { 2930 value = new MedicationRequestPriorityEnumFactory().fromType(castToCode(value)); 2931 this.priority = (Enumeration) value; // Enumeration<MedicationRequestPriority> 2932 } else if (name.equals("medication[x]")) { 2933 this.medication = castToType(value); // Type 2934 } else if (name.equals("subject")) { 2935 this.subject = castToReference(value); // Reference 2936 } else if (name.equals("context")) { 2937 this.context = castToReference(value); // Reference 2938 } else if (name.equals("supportingInformation")) { 2939 this.getSupportingInformation().add(castToReference(value)); 2940 } else if (name.equals("authoredOn")) { 2941 this.authoredOn = castToDateTime(value); // DateTimeType 2942 } else if (name.equals("requester")) { 2943 this.requester = (MedicationRequestRequesterComponent) value; // MedicationRequestRequesterComponent 2944 } else if (name.equals("recorder")) { 2945 this.recorder = castToReference(value); // Reference 2946 } else if (name.equals("reasonCode")) { 2947 this.getReasonCode().add(castToCodeableConcept(value)); 2948 } else if (name.equals("reasonReference")) { 2949 this.getReasonReference().add(castToReference(value)); 2950 } else if (name.equals("note")) { 2951 this.getNote().add(castToAnnotation(value)); 2952 } else if (name.equals("dosageInstruction")) { 2953 this.getDosageInstruction().add(castToDosage(value)); 2954 } else if (name.equals("dispenseRequest")) { 2955 this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent 2956 } else if (name.equals("substitution")) { 2957 this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent 2958 } else if (name.equals("priorPrescription")) { 2959 this.priorPrescription = castToReference(value); // Reference 2960 } else if (name.equals("detectedIssue")) { 2961 this.getDetectedIssue().add(castToReference(value)); 2962 } else if (name.equals("eventHistory")) { 2963 this.getEventHistory().add(castToReference(value)); 2964 } else 2965 return super.setProperty(name, value); 2966 return value; 2967 } 2968 2969 @Override 2970 public Base makeProperty(int hash, String name) throws FHIRException { 2971 switch (hash) { 2972 case -1618432855: return addIdentifier(); 2973 case -1014418093: return addDefinition(); 2974 case -332612366: return addBasedOn(); 2975 case -445338488: return getGroupIdentifier(); 2976 case -892481550: return getStatusElement(); 2977 case -1183762788: return getIntentElement(); 2978 case 50511102: return getCategory(); 2979 case -1165461084: return getPriorityElement(); 2980 case 1458402129: return getMedication(); 2981 case 1998965455: return getMedication(); 2982 case -1867885268: return getSubject(); 2983 case 951530927: return getContext(); 2984 case -1248768647: return addSupportingInformation(); 2985 case -1500852503: return getAuthoredOnElement(); 2986 case 693933948: return getRequester(); 2987 case -799233858: return getRecorder(); 2988 case 722137681: return addReasonCode(); 2989 case -1146218137: return addReasonReference(); 2990 case 3387378: return addNote(); 2991 case -1201373865: return addDosageInstruction(); 2992 case 824620658: return getDispenseRequest(); 2993 case 826147581: return getSubstitution(); 2994 case -486355964: return getPriorPrescription(); 2995 case 51602295: return addDetectedIssue(); 2996 case 1835190426: return addEventHistory(); 2997 default: return super.makeProperty(hash, name); 2998 } 2999 3000 } 3001 3002 @Override 3003 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 3004 switch (hash) { 3005 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 3006 case -1014418093: /*definition*/ return new String[] {"Reference"}; 3007 case -332612366: /*basedOn*/ return new String[] {"Reference"}; 3008 case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"}; 3009 case -892481550: /*status*/ return new String[] {"code"}; 3010 case -1183762788: /*intent*/ return new String[] {"code"}; 3011 case 50511102: /*category*/ return new String[] {"CodeableConcept"}; 3012 case -1165461084: /*priority*/ return new String[] {"code"}; 3013 case 1998965455: /*medication*/ return new String[] {"CodeableConcept", "Reference"}; 3014 case -1867885268: /*subject*/ return new String[] {"Reference"}; 3015 case 951530927: /*context*/ return new String[] {"Reference"}; 3016 case -1248768647: /*supportingInformation*/ return new String[] {"Reference"}; 3017 case -1500852503: /*authoredOn*/ return new String[] {"dateTime"}; 3018 case 693933948: /*requester*/ return new String[] {}; 3019 case -799233858: /*recorder*/ return new String[] {"Reference"}; 3020 case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"}; 3021 case -1146218137: /*reasonReference*/ return new String[] {"Reference"}; 3022 case 3387378: /*note*/ return new String[] {"Annotation"}; 3023 case -1201373865: /*dosageInstruction*/ return new String[] {"Dosage"}; 3024 case 824620658: /*dispenseRequest*/ return new String[] {}; 3025 case 826147581: /*substitution*/ return new String[] {}; 3026 case -486355964: /*priorPrescription*/ return new String[] {"Reference"}; 3027 case 51602295: /*detectedIssue*/ return new String[] {"Reference"}; 3028 case 1835190426: /*eventHistory*/ return new String[] {"Reference"}; 3029 default: return super.getTypesForProperty(hash, name); 3030 } 3031 3032 } 3033 3034 @Override 3035 public Base addChild(String name) throws FHIRException { 3036 if (name.equals("identifier")) { 3037 return addIdentifier(); 3038 } 3039 else if (name.equals("definition")) { 3040 return addDefinition(); 3041 } 3042 else if (name.equals("basedOn")) { 3043 return addBasedOn(); 3044 } 3045 else if (name.equals("groupIdentifier")) { 3046 this.groupIdentifier = new Identifier(); 3047 return this.groupIdentifier; 3048 } 3049 else if (name.equals("status")) { 3050 throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.status"); 3051 } 3052 else if (name.equals("intent")) { 3053 throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.intent"); 3054 } 3055 else if (name.equals("category")) { 3056 this.category = new CodeableConcept(); 3057 return this.category; 3058 } 3059 else if (name.equals("priority")) { 3060 throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.priority"); 3061 } 3062 else if (name.equals("medicationCodeableConcept")) { 3063 this.medication = new CodeableConcept(); 3064 return this.medication; 3065 } 3066 else if (name.equals("medicationReference")) { 3067 this.medication = new Reference(); 3068 return this.medication; 3069 } 3070 else if (name.equals("subject")) { 3071 this.subject = new Reference(); 3072 return this.subject; 3073 } 3074 else if (name.equals("context")) { 3075 this.context = new Reference(); 3076 return this.context; 3077 } 3078 else if (name.equals("supportingInformation")) { 3079 return addSupportingInformation(); 3080 } 3081 else if (name.equals("authoredOn")) { 3082 throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.authoredOn"); 3083 } 3084 else if (name.equals("requester")) { 3085 this.requester = new MedicationRequestRequesterComponent(); 3086 return this.requester; 3087 } 3088 else if (name.equals("recorder")) { 3089 this.recorder = new Reference(); 3090 return this.recorder; 3091 } 3092 else if (name.equals("reasonCode")) { 3093 return addReasonCode(); 3094 } 3095 else if (name.equals("reasonReference")) { 3096 return addReasonReference(); 3097 } 3098 else if (name.equals("note")) { 3099 return addNote(); 3100 } 3101 else if (name.equals("dosageInstruction")) { 3102 return addDosageInstruction(); 3103 } 3104 else if (name.equals("dispenseRequest")) { 3105 this.dispenseRequest = new MedicationRequestDispenseRequestComponent(); 3106 return this.dispenseRequest; 3107 } 3108 else if (name.equals("substitution")) { 3109 this.substitution = new MedicationRequestSubstitutionComponent(); 3110 return this.substitution; 3111 } 3112 else if (name.equals("priorPrescription")) { 3113 this.priorPrescription = new Reference(); 3114 return this.priorPrescription; 3115 } 3116 else if (name.equals("detectedIssue")) { 3117 return addDetectedIssue(); 3118 } 3119 else if (name.equals("eventHistory")) { 3120 return addEventHistory(); 3121 } 3122 else 3123 return super.addChild(name); 3124 } 3125 3126 public String fhirType() { 3127 return "MedicationRequest"; 3128 3129 } 3130 3131 public MedicationRequest copy() { 3132 MedicationRequest dst = new MedicationRequest(); 3133 copyValues(dst); 3134 if (identifier != null) { 3135 dst.identifier = new ArrayList<Identifier>(); 3136 for (Identifier i : identifier) 3137 dst.identifier.add(i.copy()); 3138 }; 3139 if (definition != null) { 3140 dst.definition = new ArrayList<Reference>(); 3141 for (Reference i : definition) 3142 dst.definition.add(i.copy()); 3143 }; 3144 if (basedOn != null) { 3145 dst.basedOn = new ArrayList<Reference>(); 3146 for (Reference i : basedOn) 3147 dst.basedOn.add(i.copy()); 3148 }; 3149 dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy(); 3150 dst.status = status == null ? null : status.copy(); 3151 dst.intent = intent == null ? null : intent.copy(); 3152 dst.category = category == null ? null : category.copy(); 3153 dst.priority = priority == null ? null : priority.copy(); 3154 dst.medication = medication == null ? null : medication.copy(); 3155 dst.subject = subject == null ? null : subject.copy(); 3156 dst.context = context == null ? null : context.copy(); 3157 if (supportingInformation != null) { 3158 dst.supportingInformation = new ArrayList<Reference>(); 3159 for (Reference i : supportingInformation) 3160 dst.supportingInformation.add(i.copy()); 3161 }; 3162 dst.authoredOn = authoredOn == null ? null : authoredOn.copy(); 3163 dst.requester = requester == null ? null : requester.copy(); 3164 dst.recorder = recorder == null ? null : recorder.copy(); 3165 if (reasonCode != null) { 3166 dst.reasonCode = new ArrayList<CodeableConcept>(); 3167 for (CodeableConcept i : reasonCode) 3168 dst.reasonCode.add(i.copy()); 3169 }; 3170 if (reasonReference != null) { 3171 dst.reasonReference = new ArrayList<Reference>(); 3172 for (Reference i : reasonReference) 3173 dst.reasonReference.add(i.copy()); 3174 }; 3175 if (note != null) { 3176 dst.note = new ArrayList<Annotation>(); 3177 for (Annotation i : note) 3178 dst.note.add(i.copy()); 3179 }; 3180 if (dosageInstruction != null) { 3181 dst.dosageInstruction = new ArrayList<Dosage>(); 3182 for (Dosage i : dosageInstruction) 3183 dst.dosageInstruction.add(i.copy()); 3184 }; 3185 dst.dispenseRequest = dispenseRequest == null ? null : dispenseRequest.copy(); 3186 dst.substitution = substitution == null ? null : substitution.copy(); 3187 dst.priorPrescription = priorPrescription == null ? null : priorPrescription.copy(); 3188 if (detectedIssue != null) { 3189 dst.detectedIssue = new ArrayList<Reference>(); 3190 for (Reference i : detectedIssue) 3191 dst.detectedIssue.add(i.copy()); 3192 }; 3193 if (eventHistory != null) { 3194 dst.eventHistory = new ArrayList<Reference>(); 3195 for (Reference i : eventHistory) 3196 dst.eventHistory.add(i.copy()); 3197 }; 3198 return dst; 3199 } 3200 3201 protected MedicationRequest typedCopy() { 3202 return copy(); 3203 } 3204 3205 @Override 3206 public boolean equalsDeep(Base other_) { 3207 if (!super.equalsDeep(other_)) 3208 return false; 3209 if (!(other_ instanceof MedicationRequest)) 3210 return false; 3211 MedicationRequest o = (MedicationRequest) other_; 3212 return compareDeep(identifier, o.identifier, true) && compareDeep(definition, o.definition, true) 3213 && compareDeep(basedOn, o.basedOn, true) && compareDeep(groupIdentifier, o.groupIdentifier, true) 3214 && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true) && compareDeep(category, o.category, true) 3215 && compareDeep(priority, o.priority, true) && compareDeep(medication, o.medication, true) && compareDeep(subject, o.subject, true) 3216 && compareDeep(context, o.context, true) && compareDeep(supportingInformation, o.supportingInformation, true) 3217 && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true) && compareDeep(recorder, o.recorder, true) 3218 && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true) 3219 && compareDeep(note, o.note, true) && compareDeep(dosageInstruction, o.dosageInstruction, true) 3220 && compareDeep(dispenseRequest, o.dispenseRequest, true) && compareDeep(substitution, o.substitution, true) 3221 && compareDeep(priorPrescription, o.priorPrescription, true) && compareDeep(detectedIssue, o.detectedIssue, true) 3222 && compareDeep(eventHistory, o.eventHistory, true); 3223 } 3224 3225 @Override 3226 public boolean equalsShallow(Base other_) { 3227 if (!super.equalsShallow(other_)) 3228 return false; 3229 if (!(other_ instanceof MedicationRequest)) 3230 return false; 3231 MedicationRequest o = (MedicationRequest) other_; 3232 return compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true) 3233 && compareValues(authoredOn, o.authoredOn, true); 3234 } 3235 3236 public boolean isEmpty() { 3237 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definition, basedOn 3238 , groupIdentifier, status, intent, category, priority, medication, subject, context 3239 , supportingInformation, authoredOn, requester, recorder, reasonCode, reasonReference 3240 , note, dosageInstruction, dispenseRequest, substitution, priorPrescription, detectedIssue 3241 , eventHistory); 3242 } 3243 3244 @Override 3245 public ResourceType getResourceType() { 3246 return ResourceType.MedicationRequest; 3247 } 3248 3249 /** 3250 * Search parameter: <b>requester</b> 3251 * <p> 3252 * Description: <b>Returns prescriptions prescribed by this prescriber</b><br> 3253 * Type: <b>reference</b><br> 3254 * Path: <b>MedicationRequest.requester.agent</b><br> 3255 * </p> 3256 */ 3257 @SearchParamDefinition(name="requester", path="MedicationRequest.requester.agent", description="Returns prescriptions prescribed by this prescriber", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } ) 3258 public static final String SP_REQUESTER = "requester"; 3259 /** 3260 * <b>Fluent Client</b> search parameter constant for <b>requester</b> 3261 * <p> 3262 * Description: <b>Returns prescriptions prescribed by this prescriber</b><br> 3263 * Type: <b>reference</b><br> 3264 * Path: <b>MedicationRequest.requester.agent</b><br> 3265 * </p> 3266 */ 3267 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER); 3268 3269/** 3270 * Constant for fluent queries to be used to add include statements. Specifies 3271 * the path value of "<b>MedicationRequest:requester</b>". 3272 */ 3273 public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("MedicationRequest:requester").toLocked(); 3274 3275 /** 3276 * Search parameter: <b>date</b> 3277 * <p> 3278 * Description: <b>Returns medication request to be administered on a specific date</b><br> 3279 * Type: <b>date</b><br> 3280 * Path: <b>MedicationRequest.dosageInstruction.timing.event</b><br> 3281 * </p> 3282 */ 3283 @SearchParamDefinition(name="date", path="MedicationRequest.dosageInstruction.timing.event", description="Returns medication request to be administered on a specific date", type="date" ) 3284 public static final String SP_DATE = "date"; 3285 /** 3286 * <b>Fluent Client</b> search parameter constant for <b>date</b> 3287 * <p> 3288 * Description: <b>Returns medication request to be administered on a specific date</b><br> 3289 * Type: <b>date</b><br> 3290 * Path: <b>MedicationRequest.dosageInstruction.timing.event</b><br> 3291 * </p> 3292 */ 3293 public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE); 3294 3295 /** 3296 * Search parameter: <b>identifier</b> 3297 * <p> 3298 * Description: <b>Return prescriptions with this external identifier</b><br> 3299 * Type: <b>token</b><br> 3300 * Path: <b>MedicationRequest.identifier</b><br> 3301 * </p> 3302 */ 3303 @SearchParamDefinition(name="identifier", path="MedicationRequest.identifier", description="Return prescriptions with this external identifier", type="token" ) 3304 public static final String SP_IDENTIFIER = "identifier"; 3305 /** 3306 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 3307 * <p> 3308 * Description: <b>Return prescriptions with this external identifier</b><br> 3309 * Type: <b>token</b><br> 3310 * Path: <b>MedicationRequest.identifier</b><br> 3311 * </p> 3312 */ 3313 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 3314 3315 /** 3316 * Search parameter: <b>intended-dispenser</b> 3317 * <p> 3318 * Description: <b>Returns prescriptions intended to be dispensed by this Organization</b><br> 3319 * Type: <b>reference</b><br> 3320 * Path: <b>MedicationRequest.dispenseRequest.performer</b><br> 3321 * </p> 3322 */ 3323 @SearchParamDefinition(name="intended-dispenser", path="MedicationRequest.dispenseRequest.performer", description="Returns prescriptions intended to be dispensed by this Organization", type="reference", target={Organization.class } ) 3324 public static final String SP_INTENDED_DISPENSER = "intended-dispenser"; 3325 /** 3326 * <b>Fluent Client</b> search parameter constant for <b>intended-dispenser</b> 3327 * <p> 3328 * Description: <b>Returns prescriptions intended to be dispensed by this Organization</b><br> 3329 * Type: <b>reference</b><br> 3330 * Path: <b>MedicationRequest.dispenseRequest.performer</b><br> 3331 * </p> 3332 */ 3333 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INTENDED_DISPENSER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INTENDED_DISPENSER); 3334 3335/** 3336 * Constant for fluent queries to be used to add include statements. Specifies 3337 * the path value of "<b>MedicationRequest:intended-dispenser</b>". 3338 */ 3339 public static final ca.uhn.fhir.model.api.Include INCLUDE_INTENDED_DISPENSER = new ca.uhn.fhir.model.api.Include("MedicationRequest:intended-dispenser").toLocked(); 3340 3341 /** 3342 * Search parameter: <b>authoredon</b> 3343 * <p> 3344 * Description: <b>Return prescriptions written on this date</b><br> 3345 * Type: <b>date</b><br> 3346 * Path: <b>MedicationRequest.authoredOn</b><br> 3347 * </p> 3348 */ 3349 @SearchParamDefinition(name="authoredon", path="MedicationRequest.authoredOn", description="Return prescriptions written on this date", type="date" ) 3350 public static final String SP_AUTHOREDON = "authoredon"; 3351 /** 3352 * <b>Fluent Client</b> search parameter constant for <b>authoredon</b> 3353 * <p> 3354 * Description: <b>Return prescriptions written on this date</b><br> 3355 * Type: <b>date</b><br> 3356 * Path: <b>MedicationRequest.authoredOn</b><br> 3357 * </p> 3358 */ 3359 public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHOREDON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHOREDON); 3360 3361 /** 3362 * Search parameter: <b>code</b> 3363 * <p> 3364 * Description: <b>Return prescriptions of this medication code</b><br> 3365 * Type: <b>token</b><br> 3366 * Path: <b>MedicationRequest.medicationCodeableConcept</b><br> 3367 * </p> 3368 */ 3369 @SearchParamDefinition(name="code", path="MedicationRequest.medication.as(CodeableConcept)", description="Return prescriptions of this medication code", type="token" ) 3370 public static final String SP_CODE = "code"; 3371 /** 3372 * <b>Fluent Client</b> search parameter constant for <b>code</b> 3373 * <p> 3374 * Description: <b>Return prescriptions of this medication code</b><br> 3375 * Type: <b>token</b><br> 3376 * Path: <b>MedicationRequest.medicationCodeableConcept</b><br> 3377 * </p> 3378 */ 3379 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 3380 3381 /** 3382 * Search parameter: <b>subject</b> 3383 * <p> 3384 * Description: <b>The identity of a patient to list orders for</b><br> 3385 * Type: <b>reference</b><br> 3386 * Path: <b>MedicationRequest.subject</b><br> 3387 * </p> 3388 */ 3389 @SearchParamDefinition(name="subject", path="MedicationRequest.subject", description="The identity of a patient to list orders for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } ) 3390 public static final String SP_SUBJECT = "subject"; 3391 /** 3392 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 3393 * <p> 3394 * Description: <b>The identity of a patient to list orders for</b><br> 3395 * Type: <b>reference</b><br> 3396 * Path: <b>MedicationRequest.subject</b><br> 3397 * </p> 3398 */ 3399 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 3400 3401/** 3402 * Constant for fluent queries to be used to add include statements. Specifies 3403 * the path value of "<b>MedicationRequest:subject</b>". 3404 */ 3405 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicationRequest:subject").toLocked(); 3406 3407 /** 3408 * Search parameter: <b>medication</b> 3409 * <p> 3410 * Description: <b>Return prescriptions of this medication reference</b><br> 3411 * Type: <b>reference</b><br> 3412 * Path: <b>MedicationRequest.medicationReference</b><br> 3413 * </p> 3414 */ 3415 @SearchParamDefinition(name="medication", path="MedicationRequest.medication.as(Reference)", description="Return prescriptions of this medication reference", type="reference", target={Medication.class } ) 3416 public static final String SP_MEDICATION = "medication"; 3417 /** 3418 * <b>Fluent Client</b> search parameter constant for <b>medication</b> 3419 * <p> 3420 * Description: <b>Return prescriptions of this medication reference</b><br> 3421 * Type: <b>reference</b><br> 3422 * Path: <b>MedicationRequest.medicationReference</b><br> 3423 * </p> 3424 */ 3425 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION); 3426 3427/** 3428 * Constant for fluent queries to be used to add include statements. Specifies 3429 * the path value of "<b>MedicationRequest:medication</b>". 3430 */ 3431 public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationRequest:medication").toLocked(); 3432 3433 /** 3434 * Search parameter: <b>priority</b> 3435 * <p> 3436 * Description: <b>Returns prescriptions with different priorities</b><br> 3437 * Type: <b>token</b><br> 3438 * Path: <b>MedicationRequest.priority</b><br> 3439 * </p> 3440 */ 3441 @SearchParamDefinition(name="priority", path="MedicationRequest.priority", description="Returns prescriptions with different priorities", type="token" ) 3442 public static final String SP_PRIORITY = "priority"; 3443 /** 3444 * <b>Fluent Client</b> search parameter constant for <b>priority</b> 3445 * <p> 3446 * Description: <b>Returns prescriptions with different priorities</b><br> 3447 * Type: <b>token</b><br> 3448 * Path: <b>MedicationRequest.priority</b><br> 3449 * </p> 3450 */ 3451 public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY); 3452 3453 /** 3454 * Search parameter: <b>intent</b> 3455 * <p> 3456 * Description: <b>Returns prescriptions with different intents</b><br> 3457 * Type: <b>token</b><br> 3458 * Path: <b>MedicationRequest.intent</b><br> 3459 * </p> 3460 */ 3461 @SearchParamDefinition(name="intent", path="MedicationRequest.intent", description="Returns prescriptions with different intents", type="token" ) 3462 public static final String SP_INTENT = "intent"; 3463 /** 3464 * <b>Fluent Client</b> search parameter constant for <b>intent</b> 3465 * <p> 3466 * Description: <b>Returns prescriptions with different intents</b><br> 3467 * Type: <b>token</b><br> 3468 * Path: <b>MedicationRequest.intent</b><br> 3469 * </p> 3470 */ 3471 public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT); 3472 3473 /** 3474 * Search parameter: <b>patient</b> 3475 * <p> 3476 * Description: <b>Returns prescriptions for a specific patient</b><br> 3477 * Type: <b>reference</b><br> 3478 * Path: <b>MedicationRequest.subject</b><br> 3479 * </p> 3480 */ 3481 @SearchParamDefinition(name="patient", path="MedicationRequest.subject", description="Returns prescriptions for a specific patient", type="reference", target={Patient.class } ) 3482 public static final String SP_PATIENT = "patient"; 3483 /** 3484 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 3485 * <p> 3486 * Description: <b>Returns prescriptions for a specific patient</b><br> 3487 * Type: <b>reference</b><br> 3488 * Path: <b>MedicationRequest.subject</b><br> 3489 * </p> 3490 */ 3491 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 3492 3493/** 3494 * Constant for fluent queries to be used to add include statements. Specifies 3495 * the path value of "<b>MedicationRequest:patient</b>". 3496 */ 3497 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationRequest:patient").toLocked(); 3498 3499 /** 3500 * Search parameter: <b>context</b> 3501 * <p> 3502 * Description: <b>Return prescriptions with this encounter or episode of care identifier</b><br> 3503 * Type: <b>reference</b><br> 3504 * Path: <b>MedicationRequest.context</b><br> 3505 * </p> 3506 */ 3507 @SearchParamDefinition(name="context", path="MedicationRequest.context", description="Return prescriptions with this encounter or episode of care identifier", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class, EpisodeOfCare.class } ) 3508 public static final String SP_CONTEXT = "context"; 3509 /** 3510 * <b>Fluent Client</b> search parameter constant for <b>context</b> 3511 * <p> 3512 * Description: <b>Return prescriptions with this encounter or episode of care identifier</b><br> 3513 * Type: <b>reference</b><br> 3514 * Path: <b>MedicationRequest.context</b><br> 3515 * </p> 3516 */ 3517 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT); 3518 3519/** 3520 * Constant for fluent queries to be used to add include statements. Specifies 3521 * the path value of "<b>MedicationRequest:context</b>". 3522 */ 3523 public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("MedicationRequest:context").toLocked(); 3524 3525 /** 3526 * Search parameter: <b>category</b> 3527 * <p> 3528 * Description: <b>Returns prescriptions with different categories</b><br> 3529 * Type: <b>token</b><br> 3530 * Path: <b>MedicationRequest.category</b><br> 3531 * </p> 3532 */ 3533 @SearchParamDefinition(name="category", path="MedicationRequest.category", description="Returns prescriptions with different categories", type="token" ) 3534 public static final String SP_CATEGORY = "category"; 3535 /** 3536 * <b>Fluent Client</b> search parameter constant for <b>category</b> 3537 * <p> 3538 * Description: <b>Returns prescriptions with different categories</b><br> 3539 * Type: <b>token</b><br> 3540 * Path: <b>MedicationRequest.category</b><br> 3541 * </p> 3542 */ 3543 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY); 3544 3545 /** 3546 * Search parameter: <b>status</b> 3547 * <p> 3548 * Description: <b>Status of the prescription</b><br> 3549 * Type: <b>token</b><br> 3550 * Path: <b>MedicationRequest.status</b><br> 3551 * </p> 3552 */ 3553 @SearchParamDefinition(name="status", path="MedicationRequest.status", description="Status of the prescription", type="token" ) 3554 public static final String SP_STATUS = "status"; 3555 /** 3556 * <b>Fluent Client</b> search parameter constant for <b>status</b> 3557 * <p> 3558 * Description: <b>Status of the prescription</b><br> 3559 * Type: <b>token</b><br> 3560 * Path: <b>MedicationRequest.status</b><br> 3561 * </p> 3562 */ 3563 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 3564 3565 3566} 3567