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