001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * Indicates that a medication product is to be or has been dispensed for a named person/patient. This includes a description of the medication product (supply) provided and the instructions for administering the medication. The medication dispense is the result of a pharmacy system responding to a medication order. 047 */ 048@ResourceDef(name="MedicationDispense", profile="http://hl7.org/fhir/Profile/MedicationDispense") 049public class MedicationDispense extends DomainResource { 050 051 public enum MedicationDispenseStatus { 052 /** 053 * The core event has not started yet, but some staging activities have begun (e.g. initial compounding or packaging of medication). Preparation stages may be tracked for billing purposes. 054 */ 055 PREPARATION, 056 /** 057 * The dispensed product is ready for pickup. 058 */ 059 INPROGRESS, 060 /** 061 * The dispensed product was not and will never be picked up by the patient. 062 */ 063 CANCELLED, 064 /** 065 * The dispense process is paused while waiting for an external event to reactivate the dispense. For example, new stock has arrived or the prescriber has called. 066 */ 067 ONHOLD, 068 /** 069 * The dispensed product has been picked up. 070 */ 071 COMPLETED, 072 /** 073 * The dispense was entered in error and therefore nullified. 074 */ 075 ENTEREDINERROR, 076 /** 077 * Actions implied by the dispense have been permanently halted, before all of them occurred. 078 */ 079 STOPPED, 080 /** 081 * The authoring system does not know which of the status values applies for this medication dispense. Note: this concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just now known which one. 082 */ 083 UNKNOWN, 084 /** 085 * added to help the parsers with the generic types 086 */ 087 NULL; 088 public static MedicationDispenseStatus fromCode(String codeString) throws FHIRException { 089 if (codeString == null || "".equals(codeString)) 090 return null; 091 if ("preparation".equals(codeString)) 092 return PREPARATION; 093 if ("in-progress".equals(codeString)) 094 return INPROGRESS; 095 if ("cancelled".equals(codeString)) 096 return CANCELLED; 097 if ("on-hold".equals(codeString)) 098 return ONHOLD; 099 if ("completed".equals(codeString)) 100 return COMPLETED; 101 if ("entered-in-error".equals(codeString)) 102 return ENTEREDINERROR; 103 if ("stopped".equals(codeString)) 104 return STOPPED; 105 if ("unknown".equals(codeString)) 106 return UNKNOWN; 107 if (Configuration.isAcceptInvalidEnums()) 108 return null; 109 else 110 throw new FHIRException("Unknown MedicationDispenseStatus code '"+codeString+"'"); 111 } 112 public String toCode() { 113 switch (this) { 114 case PREPARATION: return "preparation"; 115 case INPROGRESS: return "in-progress"; 116 case CANCELLED: return "cancelled"; 117 case ONHOLD: return "on-hold"; 118 case COMPLETED: return "completed"; 119 case ENTEREDINERROR: return "entered-in-error"; 120 case STOPPED: return "stopped"; 121 case UNKNOWN: return "unknown"; 122 default: return "?"; 123 } 124 } 125 public String getSystem() { 126 switch (this) { 127 case PREPARATION: return "http://hl7.org/fhir/medication-dispense-status"; 128 case INPROGRESS: return "http://hl7.org/fhir/medication-dispense-status"; 129 case CANCELLED: return "http://hl7.org/fhir/medication-dispense-status"; 130 case ONHOLD: return "http://hl7.org/fhir/medication-dispense-status"; 131 case COMPLETED: return "http://hl7.org/fhir/medication-dispense-status"; 132 case ENTEREDINERROR: return "http://hl7.org/fhir/medication-dispense-status"; 133 case STOPPED: return "http://hl7.org/fhir/medication-dispense-status"; 134 case UNKNOWN: return "http://hl7.org/fhir/medication-dispense-status"; 135 default: return "?"; 136 } 137 } 138 public String getDefinition() { 139 switch (this) { 140 case PREPARATION: return "The core event has not started yet, but some staging activities have begun (e.g. initial compounding or packaging of medication). Preparation stages may be tracked for billing purposes."; 141 case INPROGRESS: return "The dispensed product is ready for pickup."; 142 case CANCELLED: return "The dispensed product was not and will never be picked up by the patient."; 143 case ONHOLD: return "The dispense process is paused while waiting for an external event to reactivate the dispense. For example, new stock has arrived or the prescriber has called."; 144 case COMPLETED: return "The dispensed product has been picked up."; 145 case ENTEREDINERROR: return "The dispense was entered in error and therefore nullified."; 146 case STOPPED: return "Actions implied by the dispense have been permanently halted, before all of them occurred."; 147 case UNKNOWN: return "The authoring system does not know which of the status values applies for this medication dispense. Note: this concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just now known which one."; 148 default: return "?"; 149 } 150 } 151 public String getDisplay() { 152 switch (this) { 153 case PREPARATION: return "Preparation"; 154 case INPROGRESS: return "In Progress"; 155 case CANCELLED: return "Cancelled"; 156 case ONHOLD: return "On Hold"; 157 case COMPLETED: return "Completed"; 158 case ENTEREDINERROR: return "Entered in-Error"; 159 case STOPPED: return "Stopped"; 160 case UNKNOWN: return "Unknown"; 161 default: return "?"; 162 } 163 } 164 } 165 166 public static class MedicationDispenseStatusEnumFactory implements EnumFactory<MedicationDispenseStatus> { 167 public MedicationDispenseStatus fromCode(String codeString) throws IllegalArgumentException { 168 if (codeString == null || "".equals(codeString)) 169 if (codeString == null || "".equals(codeString)) 170 return null; 171 if ("preparation".equals(codeString)) 172 return MedicationDispenseStatus.PREPARATION; 173 if ("in-progress".equals(codeString)) 174 return MedicationDispenseStatus.INPROGRESS; 175 if ("cancelled".equals(codeString)) 176 return MedicationDispenseStatus.CANCELLED; 177 if ("on-hold".equals(codeString)) 178 return MedicationDispenseStatus.ONHOLD; 179 if ("completed".equals(codeString)) 180 return MedicationDispenseStatus.COMPLETED; 181 if ("entered-in-error".equals(codeString)) 182 return MedicationDispenseStatus.ENTEREDINERROR; 183 if ("stopped".equals(codeString)) 184 return MedicationDispenseStatus.STOPPED; 185 if ("unknown".equals(codeString)) 186 return MedicationDispenseStatus.UNKNOWN; 187 throw new IllegalArgumentException("Unknown MedicationDispenseStatus code '"+codeString+"'"); 188 } 189 public Enumeration<MedicationDispenseStatus> fromType(Base code) throws FHIRException { 190 if (code == null) 191 return null; 192 if (code.isEmpty()) 193 return new Enumeration<MedicationDispenseStatus>(this); 194 String codeString = ((PrimitiveType) code).asStringValue(); 195 if (codeString == null || "".equals(codeString)) 196 return null; 197 if ("preparation".equals(codeString)) 198 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.PREPARATION); 199 if ("in-progress".equals(codeString)) 200 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.INPROGRESS); 201 if ("cancelled".equals(codeString)) 202 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.CANCELLED); 203 if ("on-hold".equals(codeString)) 204 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.ONHOLD); 205 if ("completed".equals(codeString)) 206 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.COMPLETED); 207 if ("entered-in-error".equals(codeString)) 208 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.ENTEREDINERROR); 209 if ("stopped".equals(codeString)) 210 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.STOPPED); 211 if ("unknown".equals(codeString)) 212 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.UNKNOWN); 213 throw new FHIRException("Unknown MedicationDispenseStatus code '"+codeString+"'"); 214 } 215 public String toCode(MedicationDispenseStatus code) { 216 if (code == MedicationDispenseStatus.PREPARATION) 217 return "preparation"; 218 if (code == MedicationDispenseStatus.INPROGRESS) 219 return "in-progress"; 220 if (code == MedicationDispenseStatus.CANCELLED) 221 return "cancelled"; 222 if (code == MedicationDispenseStatus.ONHOLD) 223 return "on-hold"; 224 if (code == MedicationDispenseStatus.COMPLETED) 225 return "completed"; 226 if (code == MedicationDispenseStatus.ENTEREDINERROR) 227 return "entered-in-error"; 228 if (code == MedicationDispenseStatus.STOPPED) 229 return "stopped"; 230 if (code == MedicationDispenseStatus.UNKNOWN) 231 return "unknown"; 232 return "?"; 233 } 234 public String toSystem(MedicationDispenseStatus code) { 235 return code.getSystem(); 236 } 237 } 238 239 @Block() 240 public static class MedicationDispensePerformerComponent extends BackboneElement implements IBaseBackboneElement { 241 /** 242 * Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker. 243 */ 244 @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false) 245 @Description(shortDefinition="Who performed the dispense and what they did", formalDefinition="Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker." ) 246 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/med-dispense-perform-function") 247 protected CodeableConcept function; 248 249 /** 250 * The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication. 251 */ 252 @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, Device.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false) 253 @Description(shortDefinition="Individual who was performing", formalDefinition="The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication." ) 254 protected Reference actor; 255 256 /** 257 * The actual object that is the target of the reference (The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication.) 258 */ 259 protected Resource actorTarget; 260 261 private static final long serialVersionUID = 1424001049L; 262 263 /** 264 * Constructor 265 */ 266 public MedicationDispensePerformerComponent() { 267 super(); 268 } 269 270 /** 271 * Constructor 272 */ 273 public MedicationDispensePerformerComponent(Reference actor) { 274 super(); 275 this.actor = actor; 276 } 277 278 /** 279 * @return {@link #function} (Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.) 280 */ 281 public CodeableConcept getFunction() { 282 if (this.function == null) 283 if (Configuration.errorOnAutoCreate()) 284 throw new Error("Attempt to auto-create MedicationDispensePerformerComponent.function"); 285 else if (Configuration.doAutoCreate()) 286 this.function = new CodeableConcept(); // cc 287 return this.function; 288 } 289 290 public boolean hasFunction() { 291 return this.function != null && !this.function.isEmpty(); 292 } 293 294 /** 295 * @param value {@link #function} (Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.) 296 */ 297 public MedicationDispensePerformerComponent setFunction(CodeableConcept value) { 298 this.function = value; 299 return this; 300 } 301 302 /** 303 * @return {@link #actor} (The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication.) 304 */ 305 public Reference getActor() { 306 if (this.actor == null) 307 if (Configuration.errorOnAutoCreate()) 308 throw new Error("Attempt to auto-create MedicationDispensePerformerComponent.actor"); 309 else if (Configuration.doAutoCreate()) 310 this.actor = new Reference(); // cc 311 return this.actor; 312 } 313 314 public boolean hasActor() { 315 return this.actor != null && !this.actor.isEmpty(); 316 } 317 318 /** 319 * @param value {@link #actor} (The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication.) 320 */ 321 public MedicationDispensePerformerComponent setActor(Reference value) { 322 this.actor = value; 323 return this; 324 } 325 326 /** 327 * @return {@link #actor} 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 device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication.) 328 */ 329 public Resource getActorTarget() { 330 return this.actorTarget; 331 } 332 333 /** 334 * @param value {@link #actor} 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 device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication.) 335 */ 336 public MedicationDispensePerformerComponent setActorTarget(Resource value) { 337 this.actorTarget = value; 338 return this; 339 } 340 341 protected void listChildren(List<Property> children) { 342 super.listChildren(children); 343 children.add(new Property("function", "CodeableConcept", "Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.", 0, 1, function)); 344 children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson)", "The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication.", 0, 1, actor)); 345 } 346 347 @Override 348 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 349 switch (_hash) { 350 case 1380938712: /*function*/ return new Property("function", "CodeableConcept", "Distinguishes the type of performer in the dispense. For example, date enterer, packager, final checker.", 0, 1, function); 351 case 92645877: /*actor*/ return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson)", "The device, practitioner, etc. who performed the action. It should be assumed that the actor is the dispenser of the medication.", 0, 1, actor); 352 default: return super.getNamedProperty(_hash, _name, _checkValid); 353 } 354 355 } 356 357 @Override 358 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 359 switch (hash) { 360 case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept 361 case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference 362 default: return super.getProperty(hash, name, checkValid); 363 } 364 365 } 366 367 @Override 368 public Base setProperty(int hash, String name, Base value) throws FHIRException { 369 switch (hash) { 370 case 1380938712: // function 371 this.function = castToCodeableConcept(value); // CodeableConcept 372 return value; 373 case 92645877: // actor 374 this.actor = castToReference(value); // Reference 375 return value; 376 default: return super.setProperty(hash, name, value); 377 } 378 379 } 380 381 @Override 382 public Base setProperty(String name, Base value) throws FHIRException { 383 if (name.equals("function")) { 384 this.function = castToCodeableConcept(value); // CodeableConcept 385 } else if (name.equals("actor")) { 386 this.actor = castToReference(value); // Reference 387 } else 388 return super.setProperty(name, value); 389 return value; 390 } 391 392 @Override 393 public Base makeProperty(int hash, String name) throws FHIRException { 394 switch (hash) { 395 case 1380938712: return getFunction(); 396 case 92645877: return getActor(); 397 default: return super.makeProperty(hash, name); 398 } 399 400 } 401 402 @Override 403 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 404 switch (hash) { 405 case 1380938712: /*function*/ return new String[] {"CodeableConcept"}; 406 case 92645877: /*actor*/ return new String[] {"Reference"}; 407 default: return super.getTypesForProperty(hash, name); 408 } 409 410 } 411 412 @Override 413 public Base addChild(String name) throws FHIRException { 414 if (name.equals("function")) { 415 this.function = new CodeableConcept(); 416 return this.function; 417 } 418 else if (name.equals("actor")) { 419 this.actor = new Reference(); 420 return this.actor; 421 } 422 else 423 return super.addChild(name); 424 } 425 426 public MedicationDispensePerformerComponent copy() { 427 MedicationDispensePerformerComponent dst = new MedicationDispensePerformerComponent(); 428 copyValues(dst); 429 dst.function = function == null ? null : function.copy(); 430 dst.actor = actor == null ? null : actor.copy(); 431 return dst; 432 } 433 434 @Override 435 public boolean equalsDeep(Base other_) { 436 if (!super.equalsDeep(other_)) 437 return false; 438 if (!(other_ instanceof MedicationDispensePerformerComponent)) 439 return false; 440 MedicationDispensePerformerComponent o = (MedicationDispensePerformerComponent) other_; 441 return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true); 442 } 443 444 @Override 445 public boolean equalsShallow(Base other_) { 446 if (!super.equalsShallow(other_)) 447 return false; 448 if (!(other_ instanceof MedicationDispensePerformerComponent)) 449 return false; 450 MedicationDispensePerformerComponent o = (MedicationDispensePerformerComponent) other_; 451 return true; 452 } 453 454 public boolean isEmpty() { 455 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor); 456 } 457 458 public String fhirType() { 459 return "MedicationDispense.performer"; 460 461 } 462 463 } 464 465 @Block() 466 public static class MedicationDispenseSubstitutionComponent extends BackboneElement implements IBaseBackboneElement { 467 /** 468 * True if the dispenser dispensed a different drug or product from what was prescribed. 469 */ 470 @Child(name = "wasSubstituted", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=false) 471 @Description(shortDefinition="Whether a substitution was or was not performed on the dispense", formalDefinition="True if the dispenser dispensed a different drug or product from what was prescribed." ) 472 protected BooleanType wasSubstituted; 473 474 /** 475 * A code signifying whether a different drug was dispensed from what was prescribed. 476 */ 477 @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false) 478 @Description(shortDefinition="Code signifying whether a different drug was dispensed from what was prescribed", formalDefinition="A code signifying whether a different drug was dispensed from what was prescribed." ) 479 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActSubstanceAdminSubstitutionCode") 480 protected CodeableConcept type; 481 482 /** 483 * Indicates the reason for the substitution (or lack of substitution) from what was prescribed. 484 */ 485 @Child(name = "reason", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 486 @Description(shortDefinition="Why was substitution made", formalDefinition="Indicates the reason for the substitution (or lack of substitution) from what was prescribed." ) 487 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-SubstanceAdminSubstitutionReason") 488 protected List<CodeableConcept> reason; 489 490 /** 491 * The person or organization that has primary responsibility for the substitution. 492 */ 493 @Child(name = "responsibleParty", type = {Practitioner.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 494 @Description(shortDefinition="Who is responsible for the substitution", formalDefinition="The person or organization that has primary responsibility for the substitution." ) 495 protected List<Reference> responsibleParty; 496 /** 497 * The actual objects that are the target of the reference (The person or organization that has primary responsibility for the substitution.) 498 */ 499 protected List<Practitioner> responsiblePartyTarget; 500 501 502 private static final long serialVersionUID = -728152257L; 503 504 /** 505 * Constructor 506 */ 507 public MedicationDispenseSubstitutionComponent() { 508 super(); 509 } 510 511 /** 512 * Constructor 513 */ 514 public MedicationDispenseSubstitutionComponent(BooleanType wasSubstituted) { 515 super(); 516 this.wasSubstituted = wasSubstituted; 517 } 518 519 /** 520 * @return {@link #wasSubstituted} (True if the dispenser dispensed a different drug or product from what was prescribed.). This is the underlying object with id, value and extensions. The accessor "getWasSubstituted" gives direct access to the value 521 */ 522 public BooleanType getWasSubstitutedElement() { 523 if (this.wasSubstituted == null) 524 if (Configuration.errorOnAutoCreate()) 525 throw new Error("Attempt to auto-create MedicationDispenseSubstitutionComponent.wasSubstituted"); 526 else if (Configuration.doAutoCreate()) 527 this.wasSubstituted = new BooleanType(); // bb 528 return this.wasSubstituted; 529 } 530 531 public boolean hasWasSubstitutedElement() { 532 return this.wasSubstituted != null && !this.wasSubstituted.isEmpty(); 533 } 534 535 public boolean hasWasSubstituted() { 536 return this.wasSubstituted != null && !this.wasSubstituted.isEmpty(); 537 } 538 539 /** 540 * @param value {@link #wasSubstituted} (True if the dispenser dispensed a different drug or product from what was prescribed.). This is the underlying object with id, value and extensions. The accessor "getWasSubstituted" gives direct access to the value 541 */ 542 public MedicationDispenseSubstitutionComponent setWasSubstitutedElement(BooleanType value) { 543 this.wasSubstituted = value; 544 return this; 545 } 546 547 /** 548 * @return True if the dispenser dispensed a different drug or product from what was prescribed. 549 */ 550 public boolean getWasSubstituted() { 551 return this.wasSubstituted == null || this.wasSubstituted.isEmpty() ? false : this.wasSubstituted.getValue(); 552 } 553 554 /** 555 * @param value True if the dispenser dispensed a different drug or product from what was prescribed. 556 */ 557 public MedicationDispenseSubstitutionComponent setWasSubstituted(boolean value) { 558 if (this.wasSubstituted == null) 559 this.wasSubstituted = new BooleanType(); 560 this.wasSubstituted.setValue(value); 561 return this; 562 } 563 564 /** 565 * @return {@link #type} (A code signifying whether a different drug was dispensed from what was prescribed.) 566 */ 567 public CodeableConcept getType() { 568 if (this.type == null) 569 if (Configuration.errorOnAutoCreate()) 570 throw new Error("Attempt to auto-create MedicationDispenseSubstitutionComponent.type"); 571 else if (Configuration.doAutoCreate()) 572 this.type = new CodeableConcept(); // cc 573 return this.type; 574 } 575 576 public boolean hasType() { 577 return this.type != null && !this.type.isEmpty(); 578 } 579 580 /** 581 * @param value {@link #type} (A code signifying whether a different drug was dispensed from what was prescribed.) 582 */ 583 public MedicationDispenseSubstitutionComponent setType(CodeableConcept value) { 584 this.type = value; 585 return this; 586 } 587 588 /** 589 * @return {@link #reason} (Indicates the reason for the substitution (or lack of substitution) from what was prescribed.) 590 */ 591 public List<CodeableConcept> getReason() { 592 if (this.reason == null) 593 this.reason = new ArrayList<CodeableConcept>(); 594 return this.reason; 595 } 596 597 /** 598 * @return Returns a reference to <code>this</code> for easy method chaining 599 */ 600 public MedicationDispenseSubstitutionComponent setReason(List<CodeableConcept> theReason) { 601 this.reason = theReason; 602 return this; 603 } 604 605 public boolean hasReason() { 606 if (this.reason == null) 607 return false; 608 for (CodeableConcept item : this.reason) 609 if (!item.isEmpty()) 610 return true; 611 return false; 612 } 613 614 public CodeableConcept addReason() { //3 615 CodeableConcept t = new CodeableConcept(); 616 if (this.reason == null) 617 this.reason = new ArrayList<CodeableConcept>(); 618 this.reason.add(t); 619 return t; 620 } 621 622 public MedicationDispenseSubstitutionComponent addReason(CodeableConcept t) { //3 623 if (t == null) 624 return this; 625 if (this.reason == null) 626 this.reason = new ArrayList<CodeableConcept>(); 627 this.reason.add(t); 628 return this; 629 } 630 631 /** 632 * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist 633 */ 634 public CodeableConcept getReasonFirstRep() { 635 if (getReason().isEmpty()) { 636 addReason(); 637 } 638 return getReason().get(0); 639 } 640 641 /** 642 * @return {@link #responsibleParty} (The person or organization that has primary responsibility for the substitution.) 643 */ 644 public List<Reference> getResponsibleParty() { 645 if (this.responsibleParty == null) 646 this.responsibleParty = new ArrayList<Reference>(); 647 return this.responsibleParty; 648 } 649 650 /** 651 * @return Returns a reference to <code>this</code> for easy method chaining 652 */ 653 public MedicationDispenseSubstitutionComponent setResponsibleParty(List<Reference> theResponsibleParty) { 654 this.responsibleParty = theResponsibleParty; 655 return this; 656 } 657 658 public boolean hasResponsibleParty() { 659 if (this.responsibleParty == null) 660 return false; 661 for (Reference item : this.responsibleParty) 662 if (!item.isEmpty()) 663 return true; 664 return false; 665 } 666 667 public Reference addResponsibleParty() { //3 668 Reference t = new Reference(); 669 if (this.responsibleParty == null) 670 this.responsibleParty = new ArrayList<Reference>(); 671 this.responsibleParty.add(t); 672 return t; 673 } 674 675 public MedicationDispenseSubstitutionComponent addResponsibleParty(Reference t) { //3 676 if (t == null) 677 return this; 678 if (this.responsibleParty == null) 679 this.responsibleParty = new ArrayList<Reference>(); 680 this.responsibleParty.add(t); 681 return this; 682 } 683 684 /** 685 * @return The first repetition of repeating field {@link #responsibleParty}, creating it if it does not already exist 686 */ 687 public Reference getResponsiblePartyFirstRep() { 688 if (getResponsibleParty().isEmpty()) { 689 addResponsibleParty(); 690 } 691 return getResponsibleParty().get(0); 692 } 693 694 /** 695 * @deprecated Use Reference#setResource(IBaseResource) instead 696 */ 697 @Deprecated 698 public List<Practitioner> getResponsiblePartyTarget() { 699 if (this.responsiblePartyTarget == null) 700 this.responsiblePartyTarget = new ArrayList<Practitioner>(); 701 return this.responsiblePartyTarget; 702 } 703 704 /** 705 * @deprecated Use Reference#setResource(IBaseResource) instead 706 */ 707 @Deprecated 708 public Practitioner addResponsiblePartyTarget() { 709 Practitioner r = new Practitioner(); 710 if (this.responsiblePartyTarget == null) 711 this.responsiblePartyTarget = new ArrayList<Practitioner>(); 712 this.responsiblePartyTarget.add(r); 713 return r; 714 } 715 716 protected void listChildren(List<Property> children) { 717 super.listChildren(children); 718 children.add(new Property("wasSubstituted", "boolean", "True if the dispenser dispensed a different drug or product from what was prescribed.", 0, 1, wasSubstituted)); 719 children.add(new Property("type", "CodeableConcept", "A code signifying whether a different drug was dispensed from what was prescribed.", 0, 1, type)); 720 children.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution (or lack of substitution) from what was prescribed.", 0, java.lang.Integer.MAX_VALUE, reason)); 721 children.add(new Property("responsibleParty", "Reference(Practitioner)", "The person or organization that has primary responsibility for the substitution.", 0, java.lang.Integer.MAX_VALUE, responsibleParty)); 722 } 723 724 @Override 725 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 726 switch (_hash) { 727 case -592113567: /*wasSubstituted*/ return new Property("wasSubstituted", "boolean", "True if the dispenser dispensed a different drug or product from what was prescribed.", 0, 1, wasSubstituted); 728 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "A code signifying whether a different drug was dispensed from what was prescribed.", 0, 1, type); 729 case -934964668: /*reason*/ return new Property("reason", "CodeableConcept", "Indicates the reason for the substitution (or lack of substitution) from what was prescribed.", 0, java.lang.Integer.MAX_VALUE, reason); 730 case 1511509392: /*responsibleParty*/ return new Property("responsibleParty", "Reference(Practitioner)", "The person or organization that has primary responsibility for the substitution.", 0, java.lang.Integer.MAX_VALUE, responsibleParty); 731 default: return super.getNamedProperty(_hash, _name, _checkValid); 732 } 733 734 } 735 736 @Override 737 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 738 switch (hash) { 739 case -592113567: /*wasSubstituted*/ return this.wasSubstituted == null ? new Base[0] : new Base[] {this.wasSubstituted}; // BooleanType 740 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 741 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept 742 case 1511509392: /*responsibleParty*/ return this.responsibleParty == null ? new Base[0] : this.responsibleParty.toArray(new Base[this.responsibleParty.size()]); // Reference 743 default: return super.getProperty(hash, name, checkValid); 744 } 745 746 } 747 748 @Override 749 public Base setProperty(int hash, String name, Base value) throws FHIRException { 750 switch (hash) { 751 case -592113567: // wasSubstituted 752 this.wasSubstituted = castToBoolean(value); // BooleanType 753 return value; 754 case 3575610: // type 755 this.type = castToCodeableConcept(value); // CodeableConcept 756 return value; 757 case -934964668: // reason 758 this.getReason().add(castToCodeableConcept(value)); // CodeableConcept 759 return value; 760 case 1511509392: // responsibleParty 761 this.getResponsibleParty().add(castToReference(value)); // Reference 762 return value; 763 default: return super.setProperty(hash, name, value); 764 } 765 766 } 767 768 @Override 769 public Base setProperty(String name, Base value) throws FHIRException { 770 if (name.equals("wasSubstituted")) { 771 this.wasSubstituted = castToBoolean(value); // BooleanType 772 } else if (name.equals("type")) { 773 this.type = castToCodeableConcept(value); // CodeableConcept 774 } else if (name.equals("reason")) { 775 this.getReason().add(castToCodeableConcept(value)); 776 } else if (name.equals("responsibleParty")) { 777 this.getResponsibleParty().add(castToReference(value)); 778 } else 779 return super.setProperty(name, value); 780 return value; 781 } 782 783 @Override 784 public Base makeProperty(int hash, String name) throws FHIRException { 785 switch (hash) { 786 case -592113567: return getWasSubstitutedElement(); 787 case 3575610: return getType(); 788 case -934964668: return addReason(); 789 case 1511509392: return addResponsibleParty(); 790 default: return super.makeProperty(hash, name); 791 } 792 793 } 794 795 @Override 796 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 797 switch (hash) { 798 case -592113567: /*wasSubstituted*/ return new String[] {"boolean"}; 799 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 800 case -934964668: /*reason*/ return new String[] {"CodeableConcept"}; 801 case 1511509392: /*responsibleParty*/ return new String[] {"Reference"}; 802 default: return super.getTypesForProperty(hash, name); 803 } 804 805 } 806 807 @Override 808 public Base addChild(String name) throws FHIRException { 809 if (name.equals("wasSubstituted")) { 810 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.wasSubstituted"); 811 } 812 else if (name.equals("type")) { 813 this.type = new CodeableConcept(); 814 return this.type; 815 } 816 else if (name.equals("reason")) { 817 return addReason(); 818 } 819 else if (name.equals("responsibleParty")) { 820 return addResponsibleParty(); 821 } 822 else 823 return super.addChild(name); 824 } 825 826 public MedicationDispenseSubstitutionComponent copy() { 827 MedicationDispenseSubstitutionComponent dst = new MedicationDispenseSubstitutionComponent(); 828 copyValues(dst); 829 dst.wasSubstituted = wasSubstituted == null ? null : wasSubstituted.copy(); 830 dst.type = type == null ? null : type.copy(); 831 if (reason != null) { 832 dst.reason = new ArrayList<CodeableConcept>(); 833 for (CodeableConcept i : reason) 834 dst.reason.add(i.copy()); 835 }; 836 if (responsibleParty != null) { 837 dst.responsibleParty = new ArrayList<Reference>(); 838 for (Reference i : responsibleParty) 839 dst.responsibleParty.add(i.copy()); 840 }; 841 return dst; 842 } 843 844 @Override 845 public boolean equalsDeep(Base other_) { 846 if (!super.equalsDeep(other_)) 847 return false; 848 if (!(other_ instanceof MedicationDispenseSubstitutionComponent)) 849 return false; 850 MedicationDispenseSubstitutionComponent o = (MedicationDispenseSubstitutionComponent) other_; 851 return compareDeep(wasSubstituted, o.wasSubstituted, true) && compareDeep(type, o.type, true) && compareDeep(reason, o.reason, true) 852 && compareDeep(responsibleParty, o.responsibleParty, true); 853 } 854 855 @Override 856 public boolean equalsShallow(Base other_) { 857 if (!super.equalsShallow(other_)) 858 return false; 859 if (!(other_ instanceof MedicationDispenseSubstitutionComponent)) 860 return false; 861 MedicationDispenseSubstitutionComponent o = (MedicationDispenseSubstitutionComponent) other_; 862 return compareValues(wasSubstituted, o.wasSubstituted, true); 863 } 864 865 public boolean isEmpty() { 866 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(wasSubstituted, type, reason 867 , responsibleParty); 868 } 869 870 public String fhirType() { 871 return "MedicationDispense.substitution"; 872 873 } 874 875 } 876 877 /** 878 * Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR. 879 */ 880 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 881 @Description(shortDefinition="External identifier", formalDefinition="Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR." ) 882 protected List<Identifier> identifier; 883 884 /** 885 * The procedure that trigger the dispense. 886 */ 887 @Child(name = "partOf", type = {Procedure.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 888 @Description(shortDefinition="Event that dispense is part of", formalDefinition="The procedure that trigger the dispense." ) 889 protected List<Reference> partOf; 890 /** 891 * The actual objects that are the target of the reference (The procedure that trigger the dispense.) 892 */ 893 protected List<Procedure> partOfTarget; 894 895 896 /** 897 * A code specifying the state of the set of dispense events. 898 */ 899 @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true) 900 @Description(shortDefinition="preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | unknown", formalDefinition="A code specifying the state of the set of dispense events." ) 901 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-dispense-status") 902 protected Enumeration<MedicationDispenseStatus> status; 903 904 /** 905 * Indicates the type of medication dispense and where the medication is expected to be consumed or administered. 906 */ 907 @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false) 908 @Description(shortDefinition="Type of medication dispense", formalDefinition="Indicates the type of medication dispense and where the medication is expected to be consumed or administered." ) 909 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-dispense-category") 910 protected CodeableConcept category; 911 912 /** 913 * Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications. 914 */ 915 @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=4, min=1, max=1, modifier=false, summary=true) 916 @Description(shortDefinition="What medication was supplied", formalDefinition="Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications." ) 917 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes") 918 protected Type medication; 919 920 /** 921 * A link to a resource representing the person or the group to whom the medication will be given. 922 */ 923 @Child(name = "subject", type = {Patient.class, Group.class}, order=5, min=0, max=1, modifier=false, summary=true) 924 @Description(shortDefinition="Who the dispense is for", formalDefinition="A link to a resource representing the person or the group to whom the medication will be given." ) 925 protected Reference subject; 926 927 /** 928 * The actual object that is the target of the reference (A link to a resource representing the person or the group to whom the medication will be given.) 929 */ 930 protected Resource subjectTarget; 931 932 /** 933 * The encounter or episode of care that establishes the context for this event. 934 */ 935 @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=6, min=0, max=1, modifier=false, summary=false) 936 @Description(shortDefinition="Encounter / Episode associated with event", formalDefinition="The encounter or episode of care that establishes the context for this event." ) 937 protected Reference context; 938 939 /** 940 * The actual object that is the target of the reference (The encounter or episode of care that establishes the context for this event.) 941 */ 942 protected Resource contextTarget; 943 944 /** 945 * Additional information that supports the medication being dispensed. 946 */ 947 @Child(name = "supportingInformation", type = {Reference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 948 @Description(shortDefinition="Information that supports the dispensing of the medication", formalDefinition="Additional information that supports the medication being dispensed." ) 949 protected List<Reference> supportingInformation; 950 /** 951 * The actual objects that are the target of the reference (Additional information that supports the medication being dispensed.) 952 */ 953 protected List<Resource> supportingInformationTarget; 954 955 956 /** 957 * Indicates who or what performed the event. 958 */ 959 @Child(name = "performer", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 960 @Description(shortDefinition="Who performed event", formalDefinition="Indicates who or what performed the event." ) 961 protected List<MedicationDispensePerformerComponent> performer; 962 963 /** 964 * The principal physical location where the dispense was performed. 965 */ 966 @Child(name = "location", type = {Location.class}, order=9, min=0, max=1, modifier=false, summary=false) 967 @Description(shortDefinition="Where the dispense occurred", formalDefinition="The principal physical location where the dispense was performed." ) 968 protected Reference location; 969 970 /** 971 * The actual object that is the target of the reference (The principal physical location where the dispense was performed.) 972 */ 973 protected Location locationTarget; 974 975 /** 976 * Indicates the medication order that is being dispensed against. 977 */ 978 @Child(name = "authorizingPrescription", type = {MedicationRequest.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 979 @Description(shortDefinition="Medication order that authorizes the dispense", formalDefinition="Indicates the medication order that is being dispensed against." ) 980 protected List<Reference> authorizingPrescription; 981 /** 982 * The actual objects that are the target of the reference (Indicates the medication order that is being dispensed against.) 983 */ 984 protected List<MedicationRequest> authorizingPrescriptionTarget; 985 986 987 /** 988 * Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc. 989 */ 990 @Child(name = "type", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false) 991 @Description(shortDefinition="Trial fill, partial fill, emergency fill, etc.", formalDefinition="Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc." ) 992 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActPharmacySupplyType") 993 protected CodeableConcept type; 994 995 /** 996 * The amount of medication that has been dispensed. Includes unit of measure. 997 */ 998 @Child(name = "quantity", type = {SimpleQuantity.class}, order=12, min=0, max=1, modifier=false, summary=false) 999 @Description(shortDefinition="Amount dispensed", formalDefinition="The amount of medication that has been dispensed. Includes unit of measure." ) 1000 protected SimpleQuantity quantity; 1001 1002 /** 1003 * The amount of medication expressed as a timing amount. 1004 */ 1005 @Child(name = "daysSupply", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=false) 1006 @Description(shortDefinition="Amount of medication expressed as a timing amount", formalDefinition="The amount of medication expressed as a timing amount." ) 1007 protected SimpleQuantity daysSupply; 1008 1009 /** 1010 * The time when the dispensed product was packaged and reviewed. 1011 */ 1012 @Child(name = "whenPrepared", type = {DateTimeType.class}, order=14, min=0, max=1, modifier=false, summary=true) 1013 @Description(shortDefinition="When product was packaged and reviewed", formalDefinition="The time when the dispensed product was packaged and reviewed." ) 1014 protected DateTimeType whenPrepared; 1015 1016 /** 1017 * The time the dispensed product was provided to the patient or their representative. 1018 */ 1019 @Child(name = "whenHandedOver", type = {DateTimeType.class}, order=15, min=0, max=1, modifier=false, summary=false) 1020 @Description(shortDefinition="When product was given out", formalDefinition="The time the dispensed product was provided to the patient or their representative." ) 1021 protected DateTimeType whenHandedOver; 1022 1023 /** 1024 * Identification of the facility/location where the medication was shipped to, as part of the dispense event. 1025 */ 1026 @Child(name = "destination", type = {Location.class}, order=16, min=0, max=1, modifier=false, summary=false) 1027 @Description(shortDefinition="Where the medication was sent", formalDefinition="Identification of the facility/location where the medication was shipped to, as part of the dispense event." ) 1028 protected Reference destination; 1029 1030 /** 1031 * The actual object that is the target of the reference (Identification of the facility/location where the medication was shipped to, as part of the dispense event.) 1032 */ 1033 protected Location destinationTarget; 1034 1035 /** 1036 * Identifies the person who picked up the medication. This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional. 1037 */ 1038 @Child(name = "receiver", type = {Patient.class, Practitioner.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1039 @Description(shortDefinition="Who collected the medication", formalDefinition="Identifies the person who picked up the medication. This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional." ) 1040 protected List<Reference> receiver; 1041 /** 1042 * The actual objects that are the target of the reference (Identifies the person who picked up the medication. This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional.) 1043 */ 1044 protected List<Resource> receiverTarget; 1045 1046 1047 /** 1048 * Extra information about the dispense that could not be conveyed in the other attributes. 1049 */ 1050 @Child(name = "note", type = {Annotation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1051 @Description(shortDefinition="Information about the dispense", formalDefinition="Extra information about the dispense that could not be conveyed in the other attributes." ) 1052 protected List<Annotation> note; 1053 1054 /** 1055 * Indicates how the medication is to be used by the patient. 1056 */ 1057 @Child(name = "dosageInstruction", type = {Dosage.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1058 @Description(shortDefinition="How the medication is to be used by the patient or administered by the caregiver", formalDefinition="Indicates how the medication is to be used by the patient." ) 1059 protected List<Dosage> dosageInstruction; 1060 1061 /** 1062 * Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen. This block explains what substitution did or did not happen and why. If nothing is specified, substitution was not done. 1063 */ 1064 @Child(name = "substitution", type = {}, order=20, min=0, max=1, modifier=false, summary=false) 1065 @Description(shortDefinition="Whether a substitution was performed on the dispense", formalDefinition="Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen. This block explains what substitution did or did not happen and why. If nothing is specified, substitution was not done." ) 1066 protected MedicationDispenseSubstitutionComponent substitution; 1067 1068 /** 1069 * 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. 1070 */ 1071 @Child(name = "detectedIssue", type = {DetectedIssue.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1072 @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." ) 1073 protected List<Reference> detectedIssue; 1074 /** 1075 * 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.) 1076 */ 1077 protected List<DetectedIssue> detectedIssueTarget; 1078 1079 1080 /** 1081 * Indicates the reason why a dispense was not performed. 1082 */ 1083 @Child(name = "statusReason", type = {CodeableConcept.class, DetectedIssue.class}, order=22, min=0, max=1, modifier=false, summary=false) 1084 @Description(shortDefinition="Why a dispense was not performed", formalDefinition="Indicates the reason why a dispense was not performed." ) 1085 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/med-dispense-status-reason") 1086 protected Type statusReason; 1087 1088 /** 1089 * A summary of the events of interest that have occurred, such as when the dispense was verified. 1090 */ 1091 @Child(name = "eventHistory", type = {Provenance.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1092 @Description(shortDefinition="A list of relevant lifecycle events", formalDefinition="A summary of the events of interest that have occurred, such as when the dispense was verified." ) 1093 protected List<Reference> eventHistory; 1094 /** 1095 * The actual objects that are the target of the reference (A summary of the events of interest that have occurred, such as when the dispense was verified.) 1096 */ 1097 protected List<Provenance> eventHistoryTarget; 1098 1099 1100 private static final long serialVersionUID = -1232014790L; 1101 1102 /** 1103 * Constructor 1104 */ 1105 public MedicationDispense() { 1106 super(); 1107 } 1108 1109 /** 1110 * Constructor 1111 */ 1112 public MedicationDispense(Enumeration<MedicationDispenseStatus> status, Type medication) { 1113 super(); 1114 this.status = status; 1115 this.medication = medication; 1116 } 1117 1118 /** 1119 * @return {@link #identifier} (Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.) 1120 */ 1121 public List<Identifier> getIdentifier() { 1122 if (this.identifier == null) 1123 this.identifier = new ArrayList<Identifier>(); 1124 return this.identifier; 1125 } 1126 1127 /** 1128 * @return Returns a reference to <code>this</code> for easy method chaining 1129 */ 1130 public MedicationDispense setIdentifier(List<Identifier> theIdentifier) { 1131 this.identifier = theIdentifier; 1132 return this; 1133 } 1134 1135 public boolean hasIdentifier() { 1136 if (this.identifier == null) 1137 return false; 1138 for (Identifier item : this.identifier) 1139 if (!item.isEmpty()) 1140 return true; 1141 return false; 1142 } 1143 1144 public Identifier addIdentifier() { //3 1145 Identifier t = new Identifier(); 1146 if (this.identifier == null) 1147 this.identifier = new ArrayList<Identifier>(); 1148 this.identifier.add(t); 1149 return t; 1150 } 1151 1152 public MedicationDispense addIdentifier(Identifier t) { //3 1153 if (t == null) 1154 return this; 1155 if (this.identifier == null) 1156 this.identifier = new ArrayList<Identifier>(); 1157 this.identifier.add(t); 1158 return this; 1159 } 1160 1161 /** 1162 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 1163 */ 1164 public Identifier getIdentifierFirstRep() { 1165 if (getIdentifier().isEmpty()) { 1166 addIdentifier(); 1167 } 1168 return getIdentifier().get(0); 1169 } 1170 1171 /** 1172 * @return {@link #partOf} (The procedure that trigger the dispense.) 1173 */ 1174 public List<Reference> getPartOf() { 1175 if (this.partOf == null) 1176 this.partOf = new ArrayList<Reference>(); 1177 return this.partOf; 1178 } 1179 1180 /** 1181 * @return Returns a reference to <code>this</code> for easy method chaining 1182 */ 1183 public MedicationDispense setPartOf(List<Reference> thePartOf) { 1184 this.partOf = thePartOf; 1185 return this; 1186 } 1187 1188 public boolean hasPartOf() { 1189 if (this.partOf == null) 1190 return false; 1191 for (Reference item : this.partOf) 1192 if (!item.isEmpty()) 1193 return true; 1194 return false; 1195 } 1196 1197 public Reference addPartOf() { //3 1198 Reference t = new Reference(); 1199 if (this.partOf == null) 1200 this.partOf = new ArrayList<Reference>(); 1201 this.partOf.add(t); 1202 return t; 1203 } 1204 1205 public MedicationDispense addPartOf(Reference t) { //3 1206 if (t == null) 1207 return this; 1208 if (this.partOf == null) 1209 this.partOf = new ArrayList<Reference>(); 1210 this.partOf.add(t); 1211 return this; 1212 } 1213 1214 /** 1215 * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist 1216 */ 1217 public Reference getPartOfFirstRep() { 1218 if (getPartOf().isEmpty()) { 1219 addPartOf(); 1220 } 1221 return getPartOf().get(0); 1222 } 1223 1224 /** 1225 * @deprecated Use Reference#setResource(IBaseResource) instead 1226 */ 1227 @Deprecated 1228 public List<Procedure> getPartOfTarget() { 1229 if (this.partOfTarget == null) 1230 this.partOfTarget = new ArrayList<Procedure>(); 1231 return this.partOfTarget; 1232 } 1233 1234 /** 1235 * @deprecated Use Reference#setResource(IBaseResource) instead 1236 */ 1237 @Deprecated 1238 public Procedure addPartOfTarget() { 1239 Procedure r = new Procedure(); 1240 if (this.partOfTarget == null) 1241 this.partOfTarget = new ArrayList<Procedure>(); 1242 this.partOfTarget.add(r); 1243 return r; 1244 } 1245 1246 /** 1247 * @return {@link #status} (A code specifying the state of the set of dispense events.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1248 */ 1249 public Enumeration<MedicationDispenseStatus> getStatusElement() { 1250 if (this.status == null) 1251 if (Configuration.errorOnAutoCreate()) 1252 throw new Error("Attempt to auto-create MedicationDispense.status"); 1253 else if (Configuration.doAutoCreate()) 1254 this.status = new Enumeration<MedicationDispenseStatus>(new MedicationDispenseStatusEnumFactory()); // bb 1255 return this.status; 1256 } 1257 1258 public boolean hasStatusElement() { 1259 return this.status != null && !this.status.isEmpty(); 1260 } 1261 1262 public boolean hasStatus() { 1263 return this.status != null && !this.status.isEmpty(); 1264 } 1265 1266 /** 1267 * @param value {@link #status} (A code specifying the state of the set of dispense events.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1268 */ 1269 public MedicationDispense setStatusElement(Enumeration<MedicationDispenseStatus> value) { 1270 this.status = value; 1271 return this; 1272 } 1273 1274 /** 1275 * @return A code specifying the state of the set of dispense events. 1276 */ 1277 public MedicationDispenseStatus getStatus() { 1278 return this.status == null ? null : this.status.getValue(); 1279 } 1280 1281 /** 1282 * @param value A code specifying the state of the set of dispense events. 1283 */ 1284 public MedicationDispense setStatus(MedicationDispenseStatus value) { 1285 if (this.status == null) 1286 this.status = new Enumeration<MedicationDispenseStatus>(new MedicationDispenseStatusEnumFactory()); 1287 this.status.setValue(value); 1288 return this; 1289 } 1290 1291 /** 1292 * @return {@link #category} (Indicates the type of medication dispense and where the medication is expected to be consumed or administered.) 1293 */ 1294 public CodeableConcept getCategory() { 1295 if (this.category == null) 1296 if (Configuration.errorOnAutoCreate()) 1297 throw new Error("Attempt to auto-create MedicationDispense.category"); 1298 else if (Configuration.doAutoCreate()) 1299 this.category = new CodeableConcept(); // cc 1300 return this.category; 1301 } 1302 1303 public boolean hasCategory() { 1304 return this.category != null && !this.category.isEmpty(); 1305 } 1306 1307 /** 1308 * @param value {@link #category} (Indicates the type of medication dispense and where the medication is expected to be consumed or administered.) 1309 */ 1310 public MedicationDispense setCategory(CodeableConcept value) { 1311 this.category = value; 1312 return this; 1313 } 1314 1315 /** 1316 * @return {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1317 */ 1318 public Type getMedication() { 1319 return this.medication; 1320 } 1321 1322 /** 1323 * @return {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1324 */ 1325 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 1326 if (this.medication == null) 1327 return null; 1328 if (!(this.medication instanceof CodeableConcept)) 1329 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); 1330 return (CodeableConcept) this.medication; 1331 } 1332 1333 public boolean hasMedicationCodeableConcept() { 1334 return this != null && this.medication instanceof CodeableConcept; 1335 } 1336 1337 /** 1338 * @return {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1339 */ 1340 public Reference getMedicationReference() throws FHIRException { 1341 if (this.medication == null) 1342 return null; 1343 if (!(this.medication instanceof Reference)) 1344 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); 1345 return (Reference) this.medication; 1346 } 1347 1348 public boolean hasMedicationReference() { 1349 return this != null && this.medication instanceof Reference; 1350 } 1351 1352 public boolean hasMedication() { 1353 return this.medication != null && !this.medication.isEmpty(); 1354 } 1355 1356 /** 1357 * @param value {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1358 */ 1359 public MedicationDispense setMedication(Type value) { 1360 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 1361 throw new Error("Not the right type for MedicationDispense.medication[x]: "+value.fhirType()); 1362 this.medication = value; 1363 return this; 1364 } 1365 1366 /** 1367 * @return {@link #subject} (A link to a resource representing the person or the group to whom the medication will be given.) 1368 */ 1369 public Reference getSubject() { 1370 if (this.subject == null) 1371 if (Configuration.errorOnAutoCreate()) 1372 throw new Error("Attempt to auto-create MedicationDispense.subject"); 1373 else if (Configuration.doAutoCreate()) 1374 this.subject = new Reference(); // cc 1375 return this.subject; 1376 } 1377 1378 public boolean hasSubject() { 1379 return this.subject != null && !this.subject.isEmpty(); 1380 } 1381 1382 /** 1383 * @param value {@link #subject} (A link to a resource representing the person or the group to whom the medication will be given.) 1384 */ 1385 public MedicationDispense setSubject(Reference value) { 1386 this.subject = value; 1387 return this; 1388 } 1389 1390 /** 1391 * @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 the group to whom the medication will be given.) 1392 */ 1393 public Resource getSubjectTarget() { 1394 return this.subjectTarget; 1395 } 1396 1397 /** 1398 * @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 the group to whom the medication will be given.) 1399 */ 1400 public MedicationDispense setSubjectTarget(Resource value) { 1401 this.subjectTarget = value; 1402 return this; 1403 } 1404 1405 /** 1406 * @return {@link #context} (The encounter or episode of care that establishes the context for this event.) 1407 */ 1408 public Reference getContext() { 1409 if (this.context == null) 1410 if (Configuration.errorOnAutoCreate()) 1411 throw new Error("Attempt to auto-create MedicationDispense.context"); 1412 else if (Configuration.doAutoCreate()) 1413 this.context = new Reference(); // cc 1414 return this.context; 1415 } 1416 1417 public boolean hasContext() { 1418 return this.context != null && !this.context.isEmpty(); 1419 } 1420 1421 /** 1422 * @param value {@link #context} (The encounter or episode of care that establishes the context for this event.) 1423 */ 1424 public MedicationDispense setContext(Reference value) { 1425 this.context = value; 1426 return this; 1427 } 1428 1429 /** 1430 * @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. (The encounter or episode of care that establishes the context for this event.) 1431 */ 1432 public Resource getContextTarget() { 1433 return this.contextTarget; 1434 } 1435 1436 /** 1437 * @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. (The encounter or episode of care that establishes the context for this event.) 1438 */ 1439 public MedicationDispense setContextTarget(Resource value) { 1440 this.contextTarget = value; 1441 return this; 1442 } 1443 1444 /** 1445 * @return {@link #supportingInformation} (Additional information that supports the medication being dispensed.) 1446 */ 1447 public List<Reference> getSupportingInformation() { 1448 if (this.supportingInformation == null) 1449 this.supportingInformation = new ArrayList<Reference>(); 1450 return this.supportingInformation; 1451 } 1452 1453 /** 1454 * @return Returns a reference to <code>this</code> for easy method chaining 1455 */ 1456 public MedicationDispense setSupportingInformation(List<Reference> theSupportingInformation) { 1457 this.supportingInformation = theSupportingInformation; 1458 return this; 1459 } 1460 1461 public boolean hasSupportingInformation() { 1462 if (this.supportingInformation == null) 1463 return false; 1464 for (Reference item : this.supportingInformation) 1465 if (!item.isEmpty()) 1466 return true; 1467 return false; 1468 } 1469 1470 public Reference addSupportingInformation() { //3 1471 Reference t = new Reference(); 1472 if (this.supportingInformation == null) 1473 this.supportingInformation = new ArrayList<Reference>(); 1474 this.supportingInformation.add(t); 1475 return t; 1476 } 1477 1478 public MedicationDispense addSupportingInformation(Reference t) { //3 1479 if (t == null) 1480 return this; 1481 if (this.supportingInformation == null) 1482 this.supportingInformation = new ArrayList<Reference>(); 1483 this.supportingInformation.add(t); 1484 return this; 1485 } 1486 1487 /** 1488 * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist 1489 */ 1490 public Reference getSupportingInformationFirstRep() { 1491 if (getSupportingInformation().isEmpty()) { 1492 addSupportingInformation(); 1493 } 1494 return getSupportingInformation().get(0); 1495 } 1496 1497 /** 1498 * @deprecated Use Reference#setResource(IBaseResource) instead 1499 */ 1500 @Deprecated 1501 public List<Resource> getSupportingInformationTarget() { 1502 if (this.supportingInformationTarget == null) 1503 this.supportingInformationTarget = new ArrayList<Resource>(); 1504 return this.supportingInformationTarget; 1505 } 1506 1507 /** 1508 * @return {@link #performer} (Indicates who or what performed the event.) 1509 */ 1510 public List<MedicationDispensePerformerComponent> getPerformer() { 1511 if (this.performer == null) 1512 this.performer = new ArrayList<MedicationDispensePerformerComponent>(); 1513 return this.performer; 1514 } 1515 1516 /** 1517 * @return Returns a reference to <code>this</code> for easy method chaining 1518 */ 1519 public MedicationDispense setPerformer(List<MedicationDispensePerformerComponent> thePerformer) { 1520 this.performer = thePerformer; 1521 return this; 1522 } 1523 1524 public boolean hasPerformer() { 1525 if (this.performer == null) 1526 return false; 1527 for (MedicationDispensePerformerComponent item : this.performer) 1528 if (!item.isEmpty()) 1529 return true; 1530 return false; 1531 } 1532 1533 public MedicationDispensePerformerComponent addPerformer() { //3 1534 MedicationDispensePerformerComponent t = new MedicationDispensePerformerComponent(); 1535 if (this.performer == null) 1536 this.performer = new ArrayList<MedicationDispensePerformerComponent>(); 1537 this.performer.add(t); 1538 return t; 1539 } 1540 1541 public MedicationDispense addPerformer(MedicationDispensePerformerComponent t) { //3 1542 if (t == null) 1543 return this; 1544 if (this.performer == null) 1545 this.performer = new ArrayList<MedicationDispensePerformerComponent>(); 1546 this.performer.add(t); 1547 return this; 1548 } 1549 1550 /** 1551 * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist 1552 */ 1553 public MedicationDispensePerformerComponent getPerformerFirstRep() { 1554 if (getPerformer().isEmpty()) { 1555 addPerformer(); 1556 } 1557 return getPerformer().get(0); 1558 } 1559 1560 /** 1561 * @return {@link #location} (The principal physical location where the dispense was performed.) 1562 */ 1563 public Reference getLocation() { 1564 if (this.location == null) 1565 if (Configuration.errorOnAutoCreate()) 1566 throw new Error("Attempt to auto-create MedicationDispense.location"); 1567 else if (Configuration.doAutoCreate()) 1568 this.location = new Reference(); // cc 1569 return this.location; 1570 } 1571 1572 public boolean hasLocation() { 1573 return this.location != null && !this.location.isEmpty(); 1574 } 1575 1576 /** 1577 * @param value {@link #location} (The principal physical location where the dispense was performed.) 1578 */ 1579 public MedicationDispense setLocation(Reference value) { 1580 this.location = value; 1581 return this; 1582 } 1583 1584 /** 1585 * @return {@link #location} 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 principal physical location where the dispense was performed.) 1586 */ 1587 public Location getLocationTarget() { 1588 if (this.locationTarget == null) 1589 if (Configuration.errorOnAutoCreate()) 1590 throw new Error("Attempt to auto-create MedicationDispense.location"); 1591 else if (Configuration.doAutoCreate()) 1592 this.locationTarget = new Location(); // aa 1593 return this.locationTarget; 1594 } 1595 1596 /** 1597 * @param value {@link #location} 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 principal physical location where the dispense was performed.) 1598 */ 1599 public MedicationDispense setLocationTarget(Location value) { 1600 this.locationTarget = value; 1601 return this; 1602 } 1603 1604 /** 1605 * @return {@link #authorizingPrescription} (Indicates the medication order that is being dispensed against.) 1606 */ 1607 public List<Reference> getAuthorizingPrescription() { 1608 if (this.authorizingPrescription == null) 1609 this.authorizingPrescription = new ArrayList<Reference>(); 1610 return this.authorizingPrescription; 1611 } 1612 1613 /** 1614 * @return Returns a reference to <code>this</code> for easy method chaining 1615 */ 1616 public MedicationDispense setAuthorizingPrescription(List<Reference> theAuthorizingPrescription) { 1617 this.authorizingPrescription = theAuthorizingPrescription; 1618 return this; 1619 } 1620 1621 public boolean hasAuthorizingPrescription() { 1622 if (this.authorizingPrescription == null) 1623 return false; 1624 for (Reference item : this.authorizingPrescription) 1625 if (!item.isEmpty()) 1626 return true; 1627 return false; 1628 } 1629 1630 public Reference addAuthorizingPrescription() { //3 1631 Reference t = new Reference(); 1632 if (this.authorizingPrescription == null) 1633 this.authorizingPrescription = new ArrayList<Reference>(); 1634 this.authorizingPrescription.add(t); 1635 return t; 1636 } 1637 1638 public MedicationDispense addAuthorizingPrescription(Reference t) { //3 1639 if (t == null) 1640 return this; 1641 if (this.authorizingPrescription == null) 1642 this.authorizingPrescription = new ArrayList<Reference>(); 1643 this.authorizingPrescription.add(t); 1644 return this; 1645 } 1646 1647 /** 1648 * @return The first repetition of repeating field {@link #authorizingPrescription}, creating it if it does not already exist 1649 */ 1650 public Reference getAuthorizingPrescriptionFirstRep() { 1651 if (getAuthorizingPrescription().isEmpty()) { 1652 addAuthorizingPrescription(); 1653 } 1654 return getAuthorizingPrescription().get(0); 1655 } 1656 1657 /** 1658 * @deprecated Use Reference#setResource(IBaseResource) instead 1659 */ 1660 @Deprecated 1661 public List<MedicationRequest> getAuthorizingPrescriptionTarget() { 1662 if (this.authorizingPrescriptionTarget == null) 1663 this.authorizingPrescriptionTarget = new ArrayList<MedicationRequest>(); 1664 return this.authorizingPrescriptionTarget; 1665 } 1666 1667 /** 1668 * @deprecated Use Reference#setResource(IBaseResource) instead 1669 */ 1670 @Deprecated 1671 public MedicationRequest addAuthorizingPrescriptionTarget() { 1672 MedicationRequest r = new MedicationRequest(); 1673 if (this.authorizingPrescriptionTarget == null) 1674 this.authorizingPrescriptionTarget = new ArrayList<MedicationRequest>(); 1675 this.authorizingPrescriptionTarget.add(r); 1676 return r; 1677 } 1678 1679 /** 1680 * @return {@link #type} (Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.) 1681 */ 1682 public CodeableConcept getType() { 1683 if (this.type == null) 1684 if (Configuration.errorOnAutoCreate()) 1685 throw new Error("Attempt to auto-create MedicationDispense.type"); 1686 else if (Configuration.doAutoCreate()) 1687 this.type = new CodeableConcept(); // cc 1688 return this.type; 1689 } 1690 1691 public boolean hasType() { 1692 return this.type != null && !this.type.isEmpty(); 1693 } 1694 1695 /** 1696 * @param value {@link #type} (Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.) 1697 */ 1698 public MedicationDispense setType(CodeableConcept value) { 1699 this.type = value; 1700 return this; 1701 } 1702 1703 /** 1704 * @return {@link #quantity} (The amount of medication that has been dispensed. Includes unit of measure.) 1705 */ 1706 public SimpleQuantity getQuantity() { 1707 if (this.quantity == null) 1708 if (Configuration.errorOnAutoCreate()) 1709 throw new Error("Attempt to auto-create MedicationDispense.quantity"); 1710 else if (Configuration.doAutoCreate()) 1711 this.quantity = new SimpleQuantity(); // cc 1712 return this.quantity; 1713 } 1714 1715 public boolean hasQuantity() { 1716 return this.quantity != null && !this.quantity.isEmpty(); 1717 } 1718 1719 /** 1720 * @param value {@link #quantity} (The amount of medication that has been dispensed. Includes unit of measure.) 1721 */ 1722 public MedicationDispense setQuantity(SimpleQuantity value) { 1723 this.quantity = value; 1724 return this; 1725 } 1726 1727 /** 1728 * @return {@link #daysSupply} (The amount of medication expressed as a timing amount.) 1729 */ 1730 public SimpleQuantity getDaysSupply() { 1731 if (this.daysSupply == null) 1732 if (Configuration.errorOnAutoCreate()) 1733 throw new Error("Attempt to auto-create MedicationDispense.daysSupply"); 1734 else if (Configuration.doAutoCreate()) 1735 this.daysSupply = new SimpleQuantity(); // cc 1736 return this.daysSupply; 1737 } 1738 1739 public boolean hasDaysSupply() { 1740 return this.daysSupply != null && !this.daysSupply.isEmpty(); 1741 } 1742 1743 /** 1744 * @param value {@link #daysSupply} (The amount of medication expressed as a timing amount.) 1745 */ 1746 public MedicationDispense setDaysSupply(SimpleQuantity value) { 1747 this.daysSupply = value; 1748 return this; 1749 } 1750 1751 /** 1752 * @return {@link #whenPrepared} (The time when the dispensed product was packaged and reviewed.). This is the underlying object with id, value and extensions. The accessor "getWhenPrepared" gives direct access to the value 1753 */ 1754 public DateTimeType getWhenPreparedElement() { 1755 if (this.whenPrepared == null) 1756 if (Configuration.errorOnAutoCreate()) 1757 throw new Error("Attempt to auto-create MedicationDispense.whenPrepared"); 1758 else if (Configuration.doAutoCreate()) 1759 this.whenPrepared = new DateTimeType(); // bb 1760 return this.whenPrepared; 1761 } 1762 1763 public boolean hasWhenPreparedElement() { 1764 return this.whenPrepared != null && !this.whenPrepared.isEmpty(); 1765 } 1766 1767 public boolean hasWhenPrepared() { 1768 return this.whenPrepared != null && !this.whenPrepared.isEmpty(); 1769 } 1770 1771 /** 1772 * @param value {@link #whenPrepared} (The time when the dispensed product was packaged and reviewed.). This is the underlying object with id, value and extensions. The accessor "getWhenPrepared" gives direct access to the value 1773 */ 1774 public MedicationDispense setWhenPreparedElement(DateTimeType value) { 1775 this.whenPrepared = value; 1776 return this; 1777 } 1778 1779 /** 1780 * @return The time when the dispensed product was packaged and reviewed. 1781 */ 1782 public Date getWhenPrepared() { 1783 return this.whenPrepared == null ? null : this.whenPrepared.getValue(); 1784 } 1785 1786 /** 1787 * @param value The time when the dispensed product was packaged and reviewed. 1788 */ 1789 public MedicationDispense setWhenPrepared(Date value) { 1790 if (value == null) 1791 this.whenPrepared = null; 1792 else { 1793 if (this.whenPrepared == null) 1794 this.whenPrepared = new DateTimeType(); 1795 this.whenPrepared.setValue(value); 1796 } 1797 return this; 1798 } 1799 1800 /** 1801 * @return {@link #whenHandedOver} (The time the dispensed product was provided to the patient or their representative.). This is the underlying object with id, value and extensions. The accessor "getWhenHandedOver" gives direct access to the value 1802 */ 1803 public DateTimeType getWhenHandedOverElement() { 1804 if (this.whenHandedOver == null) 1805 if (Configuration.errorOnAutoCreate()) 1806 throw new Error("Attempt to auto-create MedicationDispense.whenHandedOver"); 1807 else if (Configuration.doAutoCreate()) 1808 this.whenHandedOver = new DateTimeType(); // bb 1809 return this.whenHandedOver; 1810 } 1811 1812 public boolean hasWhenHandedOverElement() { 1813 return this.whenHandedOver != null && !this.whenHandedOver.isEmpty(); 1814 } 1815 1816 public boolean hasWhenHandedOver() { 1817 return this.whenHandedOver != null && !this.whenHandedOver.isEmpty(); 1818 } 1819 1820 /** 1821 * @param value {@link #whenHandedOver} (The time the dispensed product was provided to the patient or their representative.). This is the underlying object with id, value and extensions. The accessor "getWhenHandedOver" gives direct access to the value 1822 */ 1823 public MedicationDispense setWhenHandedOverElement(DateTimeType value) { 1824 this.whenHandedOver = value; 1825 return this; 1826 } 1827 1828 /** 1829 * @return The time the dispensed product was provided to the patient or their representative. 1830 */ 1831 public Date getWhenHandedOver() { 1832 return this.whenHandedOver == null ? null : this.whenHandedOver.getValue(); 1833 } 1834 1835 /** 1836 * @param value The time the dispensed product was provided to the patient or their representative. 1837 */ 1838 public MedicationDispense setWhenHandedOver(Date value) { 1839 if (value == null) 1840 this.whenHandedOver = null; 1841 else { 1842 if (this.whenHandedOver == null) 1843 this.whenHandedOver = new DateTimeType(); 1844 this.whenHandedOver.setValue(value); 1845 } 1846 return this; 1847 } 1848 1849 /** 1850 * @return {@link #destination} (Identification of the facility/location where the medication was shipped to, as part of the dispense event.) 1851 */ 1852 public Reference getDestination() { 1853 if (this.destination == null) 1854 if (Configuration.errorOnAutoCreate()) 1855 throw new Error("Attempt to auto-create MedicationDispense.destination"); 1856 else if (Configuration.doAutoCreate()) 1857 this.destination = new Reference(); // cc 1858 return this.destination; 1859 } 1860 1861 public boolean hasDestination() { 1862 return this.destination != null && !this.destination.isEmpty(); 1863 } 1864 1865 /** 1866 * @param value {@link #destination} (Identification of the facility/location where the medication was shipped to, as part of the dispense event.) 1867 */ 1868 public MedicationDispense setDestination(Reference value) { 1869 this.destination = value; 1870 return this; 1871 } 1872 1873 /** 1874 * @return {@link #destination} 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. (Identification of the facility/location where the medication was shipped to, as part of the dispense event.) 1875 */ 1876 public Location getDestinationTarget() { 1877 if (this.destinationTarget == null) 1878 if (Configuration.errorOnAutoCreate()) 1879 throw new Error("Attempt to auto-create MedicationDispense.destination"); 1880 else if (Configuration.doAutoCreate()) 1881 this.destinationTarget = new Location(); // aa 1882 return this.destinationTarget; 1883 } 1884 1885 /** 1886 * @param value {@link #destination} 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. (Identification of the facility/location where the medication was shipped to, as part of the dispense event.) 1887 */ 1888 public MedicationDispense setDestinationTarget(Location value) { 1889 this.destinationTarget = value; 1890 return this; 1891 } 1892 1893 /** 1894 * @return {@link #receiver} (Identifies the person who picked up the medication. This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional.) 1895 */ 1896 public List<Reference> getReceiver() { 1897 if (this.receiver == null) 1898 this.receiver = new ArrayList<Reference>(); 1899 return this.receiver; 1900 } 1901 1902 /** 1903 * @return Returns a reference to <code>this</code> for easy method chaining 1904 */ 1905 public MedicationDispense setReceiver(List<Reference> theReceiver) { 1906 this.receiver = theReceiver; 1907 return this; 1908 } 1909 1910 public boolean hasReceiver() { 1911 if (this.receiver == null) 1912 return false; 1913 for (Reference item : this.receiver) 1914 if (!item.isEmpty()) 1915 return true; 1916 return false; 1917 } 1918 1919 public Reference addReceiver() { //3 1920 Reference t = new Reference(); 1921 if (this.receiver == null) 1922 this.receiver = new ArrayList<Reference>(); 1923 this.receiver.add(t); 1924 return t; 1925 } 1926 1927 public MedicationDispense addReceiver(Reference t) { //3 1928 if (t == null) 1929 return this; 1930 if (this.receiver == null) 1931 this.receiver = new ArrayList<Reference>(); 1932 this.receiver.add(t); 1933 return this; 1934 } 1935 1936 /** 1937 * @return The first repetition of repeating field {@link #receiver}, creating it if it does not already exist 1938 */ 1939 public Reference getReceiverFirstRep() { 1940 if (getReceiver().isEmpty()) { 1941 addReceiver(); 1942 } 1943 return getReceiver().get(0); 1944 } 1945 1946 /** 1947 * @deprecated Use Reference#setResource(IBaseResource) instead 1948 */ 1949 @Deprecated 1950 public List<Resource> getReceiverTarget() { 1951 if (this.receiverTarget == null) 1952 this.receiverTarget = new ArrayList<Resource>(); 1953 return this.receiverTarget; 1954 } 1955 1956 /** 1957 * @return {@link #note} (Extra information about the dispense that could not be conveyed in the other attributes.) 1958 */ 1959 public List<Annotation> getNote() { 1960 if (this.note == null) 1961 this.note = new ArrayList<Annotation>(); 1962 return this.note; 1963 } 1964 1965 /** 1966 * @return Returns a reference to <code>this</code> for easy method chaining 1967 */ 1968 public MedicationDispense setNote(List<Annotation> theNote) { 1969 this.note = theNote; 1970 return this; 1971 } 1972 1973 public boolean hasNote() { 1974 if (this.note == null) 1975 return false; 1976 for (Annotation item : this.note) 1977 if (!item.isEmpty()) 1978 return true; 1979 return false; 1980 } 1981 1982 public Annotation addNote() { //3 1983 Annotation t = new Annotation(); 1984 if (this.note == null) 1985 this.note = new ArrayList<Annotation>(); 1986 this.note.add(t); 1987 return t; 1988 } 1989 1990 public MedicationDispense addNote(Annotation t) { //3 1991 if (t == null) 1992 return this; 1993 if (this.note == null) 1994 this.note = new ArrayList<Annotation>(); 1995 this.note.add(t); 1996 return this; 1997 } 1998 1999 /** 2000 * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist 2001 */ 2002 public Annotation getNoteFirstRep() { 2003 if (getNote().isEmpty()) { 2004 addNote(); 2005 } 2006 return getNote().get(0); 2007 } 2008 2009 /** 2010 * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient.) 2011 */ 2012 public List<Dosage> getDosageInstruction() { 2013 if (this.dosageInstruction == null) 2014 this.dosageInstruction = new ArrayList<Dosage>(); 2015 return this.dosageInstruction; 2016 } 2017 2018 /** 2019 * @return Returns a reference to <code>this</code> for easy method chaining 2020 */ 2021 public MedicationDispense setDosageInstruction(List<Dosage> theDosageInstruction) { 2022 this.dosageInstruction = theDosageInstruction; 2023 return this; 2024 } 2025 2026 public boolean hasDosageInstruction() { 2027 if (this.dosageInstruction == null) 2028 return false; 2029 for (Dosage item : this.dosageInstruction) 2030 if (!item.isEmpty()) 2031 return true; 2032 return false; 2033 } 2034 2035 public Dosage addDosageInstruction() { //3 2036 Dosage t = new Dosage(); 2037 if (this.dosageInstruction == null) 2038 this.dosageInstruction = new ArrayList<Dosage>(); 2039 this.dosageInstruction.add(t); 2040 return t; 2041 } 2042 2043 public MedicationDispense addDosageInstruction(Dosage t) { //3 2044 if (t == null) 2045 return this; 2046 if (this.dosageInstruction == null) 2047 this.dosageInstruction = new ArrayList<Dosage>(); 2048 this.dosageInstruction.add(t); 2049 return this; 2050 } 2051 2052 /** 2053 * @return The first repetition of repeating field {@link #dosageInstruction}, creating it if it does not already exist 2054 */ 2055 public Dosage getDosageInstructionFirstRep() { 2056 if (getDosageInstruction().isEmpty()) { 2057 addDosageInstruction(); 2058 } 2059 return getDosageInstruction().get(0); 2060 } 2061 2062 /** 2063 * @return {@link #substitution} (Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen. This block explains what substitution did or did not happen and why. If nothing is specified, substitution was not done.) 2064 */ 2065 public MedicationDispenseSubstitutionComponent getSubstitution() { 2066 if (this.substitution == null) 2067 if (Configuration.errorOnAutoCreate()) 2068 throw new Error("Attempt to auto-create MedicationDispense.substitution"); 2069 else if (Configuration.doAutoCreate()) 2070 this.substitution = new MedicationDispenseSubstitutionComponent(); // cc 2071 return this.substitution; 2072 } 2073 2074 public boolean hasSubstitution() { 2075 return this.substitution != null && !this.substitution.isEmpty(); 2076 } 2077 2078 /** 2079 * @param value {@link #substitution} (Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen. This block explains what substitution did or did not happen and why. If nothing is specified, substitution was not done.) 2080 */ 2081 public MedicationDispense setSubstitution(MedicationDispenseSubstitutionComponent value) { 2082 this.substitution = value; 2083 return this; 2084 } 2085 2086 /** 2087 * @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.) 2088 */ 2089 public List<Reference> getDetectedIssue() { 2090 if (this.detectedIssue == null) 2091 this.detectedIssue = new ArrayList<Reference>(); 2092 return this.detectedIssue; 2093 } 2094 2095 /** 2096 * @return Returns a reference to <code>this</code> for easy method chaining 2097 */ 2098 public MedicationDispense setDetectedIssue(List<Reference> theDetectedIssue) { 2099 this.detectedIssue = theDetectedIssue; 2100 return this; 2101 } 2102 2103 public boolean hasDetectedIssue() { 2104 if (this.detectedIssue == null) 2105 return false; 2106 for (Reference item : this.detectedIssue) 2107 if (!item.isEmpty()) 2108 return true; 2109 return false; 2110 } 2111 2112 public Reference addDetectedIssue() { //3 2113 Reference t = new Reference(); 2114 if (this.detectedIssue == null) 2115 this.detectedIssue = new ArrayList<Reference>(); 2116 this.detectedIssue.add(t); 2117 return t; 2118 } 2119 2120 public MedicationDispense addDetectedIssue(Reference t) { //3 2121 if (t == null) 2122 return this; 2123 if (this.detectedIssue == null) 2124 this.detectedIssue = new ArrayList<Reference>(); 2125 this.detectedIssue.add(t); 2126 return this; 2127 } 2128 2129 /** 2130 * @return The first repetition of repeating field {@link #detectedIssue}, creating it if it does not already exist 2131 */ 2132 public Reference getDetectedIssueFirstRep() { 2133 if (getDetectedIssue().isEmpty()) { 2134 addDetectedIssue(); 2135 } 2136 return getDetectedIssue().get(0); 2137 } 2138 2139 /** 2140 * @deprecated Use Reference#setResource(IBaseResource) instead 2141 */ 2142 @Deprecated 2143 public List<DetectedIssue> getDetectedIssueTarget() { 2144 if (this.detectedIssueTarget == null) 2145 this.detectedIssueTarget = new ArrayList<DetectedIssue>(); 2146 return this.detectedIssueTarget; 2147 } 2148 2149 /** 2150 * @deprecated Use Reference#setResource(IBaseResource) instead 2151 */ 2152 @Deprecated 2153 public DetectedIssue addDetectedIssueTarget() { 2154 DetectedIssue r = new DetectedIssue(); 2155 if (this.detectedIssueTarget == null) 2156 this.detectedIssueTarget = new ArrayList<DetectedIssue>(); 2157 this.detectedIssueTarget.add(r); 2158 return r; 2159 } 2160 2161 /** 2162 * @return {@link #statusReason} (Indicates the reason why a dispense was not performed.) 2163 */ 2164 public Type getStatusReason() { 2165 return this.statusReason; 2166 } 2167 2168 /** 2169 * @return {@link #statusReason} (Indicates the reason why a dispense was not performed.) 2170 */ 2171 public CodeableConcept getStatusReasonCodeableConcept() throws FHIRException { 2172 if (this.statusReason == null) 2173 return null; 2174 if (!(this.statusReason instanceof CodeableConcept)) 2175 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.statusReason.getClass().getName()+" was encountered"); 2176 return (CodeableConcept) this.statusReason; 2177 } 2178 2179 public boolean hasStatusReasonCodeableConcept() { 2180 return this != null && this.statusReason instanceof CodeableConcept; 2181 } 2182 2183 /** 2184 * @return {@link #statusReason} (Indicates the reason why a dispense was not performed.) 2185 */ 2186 public Reference getStatusReasonReference() throws FHIRException { 2187 if (this.statusReason == null) 2188 return null; 2189 if (!(this.statusReason instanceof Reference)) 2190 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.statusReason.getClass().getName()+" was encountered"); 2191 return (Reference) this.statusReason; 2192 } 2193 2194 public boolean hasStatusReasonReference() { 2195 return this != null && this.statusReason instanceof Reference; 2196 } 2197 2198 public boolean hasStatusReason() { 2199 return this.statusReason != null && !this.statusReason.isEmpty(); 2200 } 2201 2202 /** 2203 * @param value {@link #statusReason} (Indicates the reason why a dispense was not performed.) 2204 */ 2205 public MedicationDispense setStatusReason(Type value) { 2206 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 2207 throw new Error("Not the right type for MedicationDispense.statusReason[x]: "+value.fhirType()); 2208 this.statusReason = value; 2209 return this; 2210 } 2211 2212 /** 2213 * @return {@link #eventHistory} (A summary of the events of interest that have occurred, such as when the dispense was verified.) 2214 */ 2215 public List<Reference> getEventHistory() { 2216 if (this.eventHistory == null) 2217 this.eventHistory = new ArrayList<Reference>(); 2218 return this.eventHistory; 2219 } 2220 2221 /** 2222 * @return Returns a reference to <code>this</code> for easy method chaining 2223 */ 2224 public MedicationDispense setEventHistory(List<Reference> theEventHistory) { 2225 this.eventHistory = theEventHistory; 2226 return this; 2227 } 2228 2229 public boolean hasEventHistory() { 2230 if (this.eventHistory == null) 2231 return false; 2232 for (Reference item : this.eventHistory) 2233 if (!item.isEmpty()) 2234 return true; 2235 return false; 2236 } 2237 2238 public Reference addEventHistory() { //3 2239 Reference t = new Reference(); 2240 if (this.eventHistory == null) 2241 this.eventHistory = new ArrayList<Reference>(); 2242 this.eventHistory.add(t); 2243 return t; 2244 } 2245 2246 public MedicationDispense addEventHistory(Reference t) { //3 2247 if (t == null) 2248 return this; 2249 if (this.eventHistory == null) 2250 this.eventHistory = new ArrayList<Reference>(); 2251 this.eventHistory.add(t); 2252 return this; 2253 } 2254 2255 /** 2256 * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist 2257 */ 2258 public Reference getEventHistoryFirstRep() { 2259 if (getEventHistory().isEmpty()) { 2260 addEventHistory(); 2261 } 2262 return getEventHistory().get(0); 2263 } 2264 2265 /** 2266 * @deprecated Use Reference#setResource(IBaseResource) instead 2267 */ 2268 @Deprecated 2269 public List<Provenance> getEventHistoryTarget() { 2270 if (this.eventHistoryTarget == null) 2271 this.eventHistoryTarget = new ArrayList<Provenance>(); 2272 return this.eventHistoryTarget; 2273 } 2274 2275 /** 2276 * @deprecated Use Reference#setResource(IBaseResource) instead 2277 */ 2278 @Deprecated 2279 public Provenance addEventHistoryTarget() { 2280 Provenance r = new Provenance(); 2281 if (this.eventHistoryTarget == null) 2282 this.eventHistoryTarget = new ArrayList<Provenance>(); 2283 this.eventHistoryTarget.add(r); 2284 return r; 2285 } 2286 2287 protected void listChildren(List<Property> children) { 2288 super.listChildren(children); 2289 children.add(new Property("identifier", "Identifier", "Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier)); 2290 children.add(new Property("partOf", "Reference(Procedure)", "The procedure that trigger the dispense.", 0, java.lang.Integer.MAX_VALUE, partOf)); 2291 children.add(new Property("status", "code", "A code specifying the state of the set of dispense events.", 0, 1, status)); 2292 children.add(new Property("category", "CodeableConcept", "Indicates the type of medication dispense and where the medication is expected to be consumed or administered.", 0, 1, category)); 2293 children.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication)); 2294 children.add(new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or the group to whom the medication will be given.", 0, 1, subject)); 2295 children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care that establishes the context for this event.", 0, 1, context)); 2296 children.add(new Property("supportingInformation", "Reference(Any)", "Additional information that supports the medication being dispensed.", 0, java.lang.Integer.MAX_VALUE, supportingInformation)); 2297 children.add(new Property("performer", "", "Indicates who or what performed the event.", 0, java.lang.Integer.MAX_VALUE, performer)); 2298 children.add(new Property("location", "Reference(Location)", "The principal physical location where the dispense was performed.", 0, 1, location)); 2299 children.add(new Property("authorizingPrescription", "Reference(MedicationRequest)", "Indicates the medication order that is being dispensed against.", 0, java.lang.Integer.MAX_VALUE, authorizingPrescription)); 2300 children.add(new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.", 0, 1, type)); 2301 children.add(new Property("quantity", "SimpleQuantity", "The amount of medication that has been dispensed. Includes unit of measure.", 0, 1, quantity)); 2302 children.add(new Property("daysSupply", "SimpleQuantity", "The amount of medication expressed as a timing amount.", 0, 1, daysSupply)); 2303 children.add(new Property("whenPrepared", "dateTime", "The time when the dispensed product was packaged and reviewed.", 0, 1, whenPrepared)); 2304 children.add(new Property("whenHandedOver", "dateTime", "The time the dispensed product was provided to the patient or their representative.", 0, 1, whenHandedOver)); 2305 children.add(new Property("destination", "Reference(Location)", "Identification of the facility/location where the medication was shipped to, as part of the dispense event.", 0, 1, destination)); 2306 children.add(new Property("receiver", "Reference(Patient|Practitioner)", "Identifies the person who picked up the medication. This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional.", 0, java.lang.Integer.MAX_VALUE, receiver)); 2307 children.add(new Property("note", "Annotation", "Extra information about the dispense that could not be conveyed in the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); 2308 children.add(new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction)); 2309 children.add(new Property("substitution", "", "Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen. This block explains what substitution did or did not happen and why. If nothing is specified, substitution was not done.", 0, 1, substitution)); 2310 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)); 2311 children.add(new Property("statusReason[x]", "CodeableConcept|Reference(DetectedIssue)", "Indicates the reason why a dispense was not performed.", 0, 1, statusReason)); 2312 children.add(new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the dispense was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory)); 2313 } 2314 2315 @Override 2316 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2317 switch (_hash) { 2318 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier); 2319 case -995410646: /*partOf*/ return new Property("partOf", "Reference(Procedure)", "The procedure that trigger the dispense.", 0, java.lang.Integer.MAX_VALUE, partOf); 2320 case -892481550: /*status*/ return new Property("status", "code", "A code specifying the state of the set of dispense events.", 0, 1, status); 2321 case 50511102: /*category*/ return new Property("category", "CodeableConcept", "Indicates the type of medication dispense and where the medication is expected to be consumed or administered.", 0, 1, category); 2322 case 1458402129: /*medication[x]*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2323 case 1998965455: /*medication*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2324 case -209845038: /*medicationCodeableConcept*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2325 case 2104315196: /*medicationReference*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); 2326 case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or the group to whom the medication will be given.", 0, 1, subject); 2327 case 951530927: /*context*/ return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care that establishes the context for this event.", 0, 1, context); 2328 case -1248768647: /*supportingInformation*/ return new Property("supportingInformation", "Reference(Any)", "Additional information that supports the medication being dispensed.", 0, java.lang.Integer.MAX_VALUE, supportingInformation); 2329 case 481140686: /*performer*/ return new Property("performer", "", "Indicates who or what performed the event.", 0, java.lang.Integer.MAX_VALUE, performer); 2330 case 1901043637: /*location*/ return new Property("location", "Reference(Location)", "The principal physical location where the dispense was performed.", 0, 1, location); 2331 case -1237557856: /*authorizingPrescription*/ return new Property("authorizingPrescription", "Reference(MedicationRequest)", "Indicates the medication order that is being dispensed against.", 0, java.lang.Integer.MAX_VALUE, authorizingPrescription); 2332 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.", 0, 1, type); 2333 case -1285004149: /*quantity*/ return new Property("quantity", "SimpleQuantity", "The amount of medication that has been dispensed. Includes unit of measure.", 0, 1, quantity); 2334 case 197175334: /*daysSupply*/ return new Property("daysSupply", "SimpleQuantity", "The amount of medication expressed as a timing amount.", 0, 1, daysSupply); 2335 case -562837097: /*whenPrepared*/ return new Property("whenPrepared", "dateTime", "The time when the dispensed product was packaged and reviewed.", 0, 1, whenPrepared); 2336 case -940241380: /*whenHandedOver*/ return new Property("whenHandedOver", "dateTime", "The time the dispensed product was provided to the patient or their representative.", 0, 1, whenHandedOver); 2337 case -1429847026: /*destination*/ return new Property("destination", "Reference(Location)", "Identification of the facility/location where the medication was shipped to, as part of the dispense event.", 0, 1, destination); 2338 case -808719889: /*receiver*/ return new Property("receiver", "Reference(Patient|Practitioner)", "Identifies the person who picked up the medication. This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional.", 0, java.lang.Integer.MAX_VALUE, receiver); 2339 case 3387378: /*note*/ return new Property("note", "Annotation", "Extra information about the dispense that could not be conveyed in the other attributes.", 0, java.lang.Integer.MAX_VALUE, note); 2340 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); 2341 case 826147581: /*substitution*/ return new Property("substitution", "", "Indicates whether or not substitution was made as part of the dispense. In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen. This block explains what substitution did or did not happen and why. If nothing is specified, substitution was not done.", 0, 1, substitution); 2342 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); 2343 case -1421632534: /*statusReason[x]*/ return new Property("statusReason[x]", "CodeableConcept|Reference(DetectedIssue)", "Indicates the reason why a dispense was not performed.", 0, 1, statusReason); 2344 case 2051346646: /*statusReason*/ return new Property("statusReason[x]", "CodeableConcept|Reference(DetectedIssue)", "Indicates the reason why a dispense was not performed.", 0, 1, statusReason); 2345 case 2082934763: /*statusReasonCodeableConcept*/ return new Property("statusReason[x]", "CodeableConcept|Reference(DetectedIssue)", "Indicates the reason why a dispense was not performed.", 0, 1, statusReason); 2346 case 1344200469: /*statusReasonReference*/ return new Property("statusReason[x]", "CodeableConcept|Reference(DetectedIssue)", "Indicates the reason why a dispense was not performed.", 0, 1, statusReason); 2347 case 1835190426: /*eventHistory*/ return new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the dispense was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory); 2348 default: return super.getNamedProperty(_hash, _name, _checkValid); 2349 } 2350 2351 } 2352 2353 @Override 2354 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2355 switch (hash) { 2356 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 2357 case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference 2358 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationDispenseStatus> 2359 case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept 2360 case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type 2361 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 2362 case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference 2363 case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference 2364 case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // MedicationDispensePerformerComponent 2365 case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference 2366 case -1237557856: /*authorizingPrescription*/ return this.authorizingPrescription == null ? new Base[0] : this.authorizingPrescription.toArray(new Base[this.authorizingPrescription.size()]); // Reference 2367 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 2368 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 2369 case 197175334: /*daysSupply*/ return this.daysSupply == null ? new Base[0] : new Base[] {this.daysSupply}; // SimpleQuantity 2370 case -562837097: /*whenPrepared*/ return this.whenPrepared == null ? new Base[0] : new Base[] {this.whenPrepared}; // DateTimeType 2371 case -940241380: /*whenHandedOver*/ return this.whenHandedOver == null ? new Base[0] : new Base[] {this.whenHandedOver}; // DateTimeType 2372 case -1429847026: /*destination*/ return this.destination == null ? new Base[0] : new Base[] {this.destination}; // Reference 2373 case -808719889: /*receiver*/ return this.receiver == null ? new Base[0] : this.receiver.toArray(new Base[this.receiver.size()]); // Reference 2374 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 2375 case -1201373865: /*dosageInstruction*/ return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // Dosage 2376 case 826147581: /*substitution*/ return this.substitution == null ? new Base[0] : new Base[] {this.substitution}; // MedicationDispenseSubstitutionComponent 2377 case 51602295: /*detectedIssue*/ return this.detectedIssue == null ? new Base[0] : this.detectedIssue.toArray(new Base[this.detectedIssue.size()]); // Reference 2378 case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // Type 2379 case 1835190426: /*eventHistory*/ return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference 2380 default: return super.getProperty(hash, name, checkValid); 2381 } 2382 2383 } 2384 2385 @Override 2386 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2387 switch (hash) { 2388 case -1618432855: // identifier 2389 this.getIdentifier().add(castToIdentifier(value)); // Identifier 2390 return value; 2391 case -995410646: // partOf 2392 this.getPartOf().add(castToReference(value)); // Reference 2393 return value; 2394 case -892481550: // status 2395 value = new MedicationDispenseStatusEnumFactory().fromType(castToCode(value)); 2396 this.status = (Enumeration) value; // Enumeration<MedicationDispenseStatus> 2397 return value; 2398 case 50511102: // category 2399 this.category = castToCodeableConcept(value); // CodeableConcept 2400 return value; 2401 case 1998965455: // medication 2402 this.medication = castToType(value); // Type 2403 return value; 2404 case -1867885268: // subject 2405 this.subject = castToReference(value); // Reference 2406 return value; 2407 case 951530927: // context 2408 this.context = castToReference(value); // Reference 2409 return value; 2410 case -1248768647: // supportingInformation 2411 this.getSupportingInformation().add(castToReference(value)); // Reference 2412 return value; 2413 case 481140686: // performer 2414 this.getPerformer().add((MedicationDispensePerformerComponent) value); // MedicationDispensePerformerComponent 2415 return value; 2416 case 1901043637: // location 2417 this.location = castToReference(value); // Reference 2418 return value; 2419 case -1237557856: // authorizingPrescription 2420 this.getAuthorizingPrescription().add(castToReference(value)); // Reference 2421 return value; 2422 case 3575610: // type 2423 this.type = castToCodeableConcept(value); // CodeableConcept 2424 return value; 2425 case -1285004149: // quantity 2426 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 2427 return value; 2428 case 197175334: // daysSupply 2429 this.daysSupply = castToSimpleQuantity(value); // SimpleQuantity 2430 return value; 2431 case -562837097: // whenPrepared 2432 this.whenPrepared = castToDateTime(value); // DateTimeType 2433 return value; 2434 case -940241380: // whenHandedOver 2435 this.whenHandedOver = castToDateTime(value); // DateTimeType 2436 return value; 2437 case -1429847026: // destination 2438 this.destination = castToReference(value); // Reference 2439 return value; 2440 case -808719889: // receiver 2441 this.getReceiver().add(castToReference(value)); // Reference 2442 return value; 2443 case 3387378: // note 2444 this.getNote().add(castToAnnotation(value)); // Annotation 2445 return value; 2446 case -1201373865: // dosageInstruction 2447 this.getDosageInstruction().add(castToDosage(value)); // Dosage 2448 return value; 2449 case 826147581: // substitution 2450 this.substitution = (MedicationDispenseSubstitutionComponent) value; // MedicationDispenseSubstitutionComponent 2451 return value; 2452 case 51602295: // detectedIssue 2453 this.getDetectedIssue().add(castToReference(value)); // Reference 2454 return value; 2455 case 2051346646: // statusReason 2456 this.statusReason = castToType(value); // Type 2457 return value; 2458 case 1835190426: // eventHistory 2459 this.getEventHistory().add(castToReference(value)); // Reference 2460 return value; 2461 default: return super.setProperty(hash, name, value); 2462 } 2463 2464 } 2465 2466 @Override 2467 public Base setProperty(String name, Base value) throws FHIRException { 2468 if (name.equals("identifier")) { 2469 this.getIdentifier().add(castToIdentifier(value)); 2470 } else if (name.equals("partOf")) { 2471 this.getPartOf().add(castToReference(value)); 2472 } else if (name.equals("status")) { 2473 value = new MedicationDispenseStatusEnumFactory().fromType(castToCode(value)); 2474 this.status = (Enumeration) value; // Enumeration<MedicationDispenseStatus> 2475 } else if (name.equals("category")) { 2476 this.category = castToCodeableConcept(value); // CodeableConcept 2477 } else if (name.equals("medication[x]")) { 2478 this.medication = castToType(value); // Type 2479 } else if (name.equals("subject")) { 2480 this.subject = castToReference(value); // Reference 2481 } else if (name.equals("context")) { 2482 this.context = castToReference(value); // Reference 2483 } else if (name.equals("supportingInformation")) { 2484 this.getSupportingInformation().add(castToReference(value)); 2485 } else if (name.equals("performer")) { 2486 this.getPerformer().add((MedicationDispensePerformerComponent) value); 2487 } else if (name.equals("location")) { 2488 this.location = castToReference(value); // Reference 2489 } else if (name.equals("authorizingPrescription")) { 2490 this.getAuthorizingPrescription().add(castToReference(value)); 2491 } else if (name.equals("type")) { 2492 this.type = castToCodeableConcept(value); // CodeableConcept 2493 } else if (name.equals("quantity")) { 2494 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 2495 } else if (name.equals("daysSupply")) { 2496 this.daysSupply = castToSimpleQuantity(value); // SimpleQuantity 2497 } else if (name.equals("whenPrepared")) { 2498 this.whenPrepared = castToDateTime(value); // DateTimeType 2499 } else if (name.equals("whenHandedOver")) { 2500 this.whenHandedOver = castToDateTime(value); // DateTimeType 2501 } else if (name.equals("destination")) { 2502 this.destination = castToReference(value); // Reference 2503 } else if (name.equals("receiver")) { 2504 this.getReceiver().add(castToReference(value)); 2505 } else if (name.equals("note")) { 2506 this.getNote().add(castToAnnotation(value)); 2507 } else if (name.equals("dosageInstruction")) { 2508 this.getDosageInstruction().add(castToDosage(value)); 2509 } else if (name.equals("substitution")) { 2510 this.substitution = (MedicationDispenseSubstitutionComponent) value; // MedicationDispenseSubstitutionComponent 2511 } else if (name.equals("detectedIssue")) { 2512 this.getDetectedIssue().add(castToReference(value)); 2513 } else if (name.equals("statusReason[x]")) { 2514 this.statusReason = castToType(value); // Type 2515 } else if (name.equals("eventHistory")) { 2516 this.getEventHistory().add(castToReference(value)); 2517 } else 2518 return super.setProperty(name, value); 2519 return value; 2520 } 2521 2522 @Override 2523 public Base makeProperty(int hash, String name) throws FHIRException { 2524 switch (hash) { 2525 case -1618432855: return addIdentifier(); 2526 case -995410646: return addPartOf(); 2527 case -892481550: return getStatusElement(); 2528 case 50511102: return getCategory(); 2529 case 1458402129: return getMedication(); 2530 case 1998965455: return getMedication(); 2531 case -1867885268: return getSubject(); 2532 case 951530927: return getContext(); 2533 case -1248768647: return addSupportingInformation(); 2534 case 481140686: return addPerformer(); 2535 case 1901043637: return getLocation(); 2536 case -1237557856: return addAuthorizingPrescription(); 2537 case 3575610: return getType(); 2538 case -1285004149: return getQuantity(); 2539 case 197175334: return getDaysSupply(); 2540 case -562837097: return getWhenPreparedElement(); 2541 case -940241380: return getWhenHandedOverElement(); 2542 case -1429847026: return getDestination(); 2543 case -808719889: return addReceiver(); 2544 case 3387378: return addNote(); 2545 case -1201373865: return addDosageInstruction(); 2546 case 826147581: return getSubstitution(); 2547 case 51602295: return addDetectedIssue(); 2548 case -1421632534: return getStatusReason(); 2549 case 2051346646: return getStatusReason(); 2550 case 1835190426: return addEventHistory(); 2551 default: return super.makeProperty(hash, name); 2552 } 2553 2554 } 2555 2556 @Override 2557 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2558 switch (hash) { 2559 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 2560 case -995410646: /*partOf*/ return new String[] {"Reference"}; 2561 case -892481550: /*status*/ return new String[] {"code"}; 2562 case 50511102: /*category*/ return new String[] {"CodeableConcept"}; 2563 case 1998965455: /*medication*/ return new String[] {"CodeableConcept", "Reference"}; 2564 case -1867885268: /*subject*/ return new String[] {"Reference"}; 2565 case 951530927: /*context*/ return new String[] {"Reference"}; 2566 case -1248768647: /*supportingInformation*/ return new String[] {"Reference"}; 2567 case 481140686: /*performer*/ return new String[] {}; 2568 case 1901043637: /*location*/ return new String[] {"Reference"}; 2569 case -1237557856: /*authorizingPrescription*/ return new String[] {"Reference"}; 2570 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 2571 case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"}; 2572 case 197175334: /*daysSupply*/ return new String[] {"SimpleQuantity"}; 2573 case -562837097: /*whenPrepared*/ return new String[] {"dateTime"}; 2574 case -940241380: /*whenHandedOver*/ return new String[] {"dateTime"}; 2575 case -1429847026: /*destination*/ return new String[] {"Reference"}; 2576 case -808719889: /*receiver*/ return new String[] {"Reference"}; 2577 case 3387378: /*note*/ return new String[] {"Annotation"}; 2578 case -1201373865: /*dosageInstruction*/ return new String[] {"Dosage"}; 2579 case 826147581: /*substitution*/ return new String[] {}; 2580 case 51602295: /*detectedIssue*/ return new String[] {"Reference"}; 2581 case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept", "Reference"}; 2582 case 1835190426: /*eventHistory*/ return new String[] {"Reference"}; 2583 default: return super.getTypesForProperty(hash, name); 2584 } 2585 2586 } 2587 2588 @Override 2589 public Base addChild(String name) throws FHIRException { 2590 if (name.equals("identifier")) { 2591 return addIdentifier(); 2592 } 2593 else if (name.equals("partOf")) { 2594 return addPartOf(); 2595 } 2596 else if (name.equals("status")) { 2597 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.status"); 2598 } 2599 else if (name.equals("category")) { 2600 this.category = new CodeableConcept(); 2601 return this.category; 2602 } 2603 else if (name.equals("medicationCodeableConcept")) { 2604 this.medication = new CodeableConcept(); 2605 return this.medication; 2606 } 2607 else if (name.equals("medicationReference")) { 2608 this.medication = new Reference(); 2609 return this.medication; 2610 } 2611 else if (name.equals("subject")) { 2612 this.subject = new Reference(); 2613 return this.subject; 2614 } 2615 else if (name.equals("context")) { 2616 this.context = new Reference(); 2617 return this.context; 2618 } 2619 else if (name.equals("supportingInformation")) { 2620 return addSupportingInformation(); 2621 } 2622 else if (name.equals("performer")) { 2623 return addPerformer(); 2624 } 2625 else if (name.equals("location")) { 2626 this.location = new Reference(); 2627 return this.location; 2628 } 2629 else if (name.equals("authorizingPrescription")) { 2630 return addAuthorizingPrescription(); 2631 } 2632 else if (name.equals("type")) { 2633 this.type = new CodeableConcept(); 2634 return this.type; 2635 } 2636 else if (name.equals("quantity")) { 2637 this.quantity = new SimpleQuantity(); 2638 return this.quantity; 2639 } 2640 else if (name.equals("daysSupply")) { 2641 this.daysSupply = new SimpleQuantity(); 2642 return this.daysSupply; 2643 } 2644 else if (name.equals("whenPrepared")) { 2645 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.whenPrepared"); 2646 } 2647 else if (name.equals("whenHandedOver")) { 2648 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.whenHandedOver"); 2649 } 2650 else if (name.equals("destination")) { 2651 this.destination = new Reference(); 2652 return this.destination; 2653 } 2654 else if (name.equals("receiver")) { 2655 return addReceiver(); 2656 } 2657 else if (name.equals("note")) { 2658 return addNote(); 2659 } 2660 else if (name.equals("dosageInstruction")) { 2661 return addDosageInstruction(); 2662 } 2663 else if (name.equals("substitution")) { 2664 this.substitution = new MedicationDispenseSubstitutionComponent(); 2665 return this.substitution; 2666 } 2667 else if (name.equals("detectedIssue")) { 2668 return addDetectedIssue(); 2669 } 2670 else if (name.equals("statusReasonCodeableConcept")) { 2671 this.statusReason = new CodeableConcept(); 2672 return this.statusReason; 2673 } 2674 else if (name.equals("statusReasonReference")) { 2675 this.statusReason = new Reference(); 2676 return this.statusReason; 2677 } 2678 else if (name.equals("eventHistory")) { 2679 return addEventHistory(); 2680 } 2681 else 2682 return super.addChild(name); 2683 } 2684 2685 public String fhirType() { 2686 return "MedicationDispense"; 2687 2688 } 2689 2690 public MedicationDispense copy() { 2691 MedicationDispense dst = new MedicationDispense(); 2692 copyValues(dst); 2693 if (identifier != null) { 2694 dst.identifier = new ArrayList<Identifier>(); 2695 for (Identifier i : identifier) 2696 dst.identifier.add(i.copy()); 2697 }; 2698 if (partOf != null) { 2699 dst.partOf = new ArrayList<Reference>(); 2700 for (Reference i : partOf) 2701 dst.partOf.add(i.copy()); 2702 }; 2703 dst.status = status == null ? null : status.copy(); 2704 dst.category = category == null ? null : category.copy(); 2705 dst.medication = medication == null ? null : medication.copy(); 2706 dst.subject = subject == null ? null : subject.copy(); 2707 dst.context = context == null ? null : context.copy(); 2708 if (supportingInformation != null) { 2709 dst.supportingInformation = new ArrayList<Reference>(); 2710 for (Reference i : supportingInformation) 2711 dst.supportingInformation.add(i.copy()); 2712 }; 2713 if (performer != null) { 2714 dst.performer = new ArrayList<MedicationDispensePerformerComponent>(); 2715 for (MedicationDispensePerformerComponent i : performer) 2716 dst.performer.add(i.copy()); 2717 }; 2718 dst.location = location == null ? null : location.copy(); 2719 if (authorizingPrescription != null) { 2720 dst.authorizingPrescription = new ArrayList<Reference>(); 2721 for (Reference i : authorizingPrescription) 2722 dst.authorizingPrescription.add(i.copy()); 2723 }; 2724 dst.type = type == null ? null : type.copy(); 2725 dst.quantity = quantity == null ? null : quantity.copy(); 2726 dst.daysSupply = daysSupply == null ? null : daysSupply.copy(); 2727 dst.whenPrepared = whenPrepared == null ? null : whenPrepared.copy(); 2728 dst.whenHandedOver = whenHandedOver == null ? null : whenHandedOver.copy(); 2729 dst.destination = destination == null ? null : destination.copy(); 2730 if (receiver != null) { 2731 dst.receiver = new ArrayList<Reference>(); 2732 for (Reference i : receiver) 2733 dst.receiver.add(i.copy()); 2734 }; 2735 if (note != null) { 2736 dst.note = new ArrayList<Annotation>(); 2737 for (Annotation i : note) 2738 dst.note.add(i.copy()); 2739 }; 2740 if (dosageInstruction != null) { 2741 dst.dosageInstruction = new ArrayList<Dosage>(); 2742 for (Dosage i : dosageInstruction) 2743 dst.dosageInstruction.add(i.copy()); 2744 }; 2745 dst.substitution = substitution == null ? null : substitution.copy(); 2746 if (detectedIssue != null) { 2747 dst.detectedIssue = new ArrayList<Reference>(); 2748 for (Reference i : detectedIssue) 2749 dst.detectedIssue.add(i.copy()); 2750 }; 2751 dst.statusReason = statusReason == null ? null : statusReason.copy(); 2752 if (eventHistory != null) { 2753 dst.eventHistory = new ArrayList<Reference>(); 2754 for (Reference i : eventHistory) 2755 dst.eventHistory.add(i.copy()); 2756 }; 2757 return dst; 2758 } 2759 2760 protected MedicationDispense typedCopy() { 2761 return copy(); 2762 } 2763 2764 @Override 2765 public boolean equalsDeep(Base other_) { 2766 if (!super.equalsDeep(other_)) 2767 return false; 2768 if (!(other_ instanceof MedicationDispense)) 2769 return false; 2770 MedicationDispense o = (MedicationDispense) other_; 2771 return compareDeep(identifier, o.identifier, true) && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true) 2772 && compareDeep(category, o.category, true) && compareDeep(medication, o.medication, true) && compareDeep(subject, o.subject, true) 2773 && compareDeep(context, o.context, true) && compareDeep(supportingInformation, o.supportingInformation, true) 2774 && compareDeep(performer, o.performer, true) && compareDeep(location, o.location, true) && compareDeep(authorizingPrescription, o.authorizingPrescription, true) 2775 && compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true) && compareDeep(daysSupply, o.daysSupply, true) 2776 && compareDeep(whenPrepared, o.whenPrepared, true) && compareDeep(whenHandedOver, o.whenHandedOver, true) 2777 && compareDeep(destination, o.destination, true) && compareDeep(receiver, o.receiver, true) && compareDeep(note, o.note, true) 2778 && compareDeep(dosageInstruction, o.dosageInstruction, true) && compareDeep(substitution, o.substitution, true) 2779 && compareDeep(detectedIssue, o.detectedIssue, true) && compareDeep(statusReason, o.statusReason, true) 2780 && compareDeep(eventHistory, o.eventHistory, true); 2781 } 2782 2783 @Override 2784 public boolean equalsShallow(Base other_) { 2785 if (!super.equalsShallow(other_)) 2786 return false; 2787 if (!(other_ instanceof MedicationDispense)) 2788 return false; 2789 MedicationDispense o = (MedicationDispense) other_; 2790 return compareValues(status, o.status, true) && compareValues(whenPrepared, o.whenPrepared, true) && compareValues(whenHandedOver, o.whenHandedOver, true) 2791 ; 2792 } 2793 2794 public boolean isEmpty() { 2795 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, partOf, status 2796 , category, medication, subject, context, supportingInformation, performer, location 2797 , authorizingPrescription, type, quantity, daysSupply, whenPrepared, whenHandedOver 2798 , destination, receiver, note, dosageInstruction, substitution, detectedIssue, statusReason 2799 , eventHistory); 2800 } 2801 2802 @Override 2803 public ResourceType getResourceType() { 2804 return ResourceType.MedicationDispense; 2805 } 2806 2807 /** 2808 * Search parameter: <b>identifier</b> 2809 * <p> 2810 * Description: <b>Returns dispenses with this external identifier</b><br> 2811 * Type: <b>token</b><br> 2812 * Path: <b>MedicationDispense.identifier</b><br> 2813 * </p> 2814 */ 2815 @SearchParamDefinition(name="identifier", path="MedicationDispense.identifier", description="Returns dispenses with this external identifier", type="token" ) 2816 public static final String SP_IDENTIFIER = "identifier"; 2817 /** 2818 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 2819 * <p> 2820 * Description: <b>Returns dispenses with this external identifier</b><br> 2821 * Type: <b>token</b><br> 2822 * Path: <b>MedicationDispense.identifier</b><br> 2823 * </p> 2824 */ 2825 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 2826 2827 /** 2828 * Search parameter: <b>performer</b> 2829 * <p> 2830 * Description: <b>Returns dispenses performed by a specific individual</b><br> 2831 * Type: <b>reference</b><br> 2832 * Path: <b>MedicationDispense.performer.actor</b><br> 2833 * </p> 2834 */ 2835 @SearchParamDefinition(name="performer", path="MedicationDispense.performer.actor", description="Returns dispenses performed by a specific individual", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } ) 2836 public static final String SP_PERFORMER = "performer"; 2837 /** 2838 * <b>Fluent Client</b> search parameter constant for <b>performer</b> 2839 * <p> 2840 * Description: <b>Returns dispenses performed by a specific individual</b><br> 2841 * Type: <b>reference</b><br> 2842 * Path: <b>MedicationDispense.performer.actor</b><br> 2843 * </p> 2844 */ 2845 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER); 2846 2847/** 2848 * Constant for fluent queries to be used to add include statements. Specifies 2849 * the path value of "<b>MedicationDispense:performer</b>". 2850 */ 2851 public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("MedicationDispense:performer").toLocked(); 2852 2853 /** 2854 * Search parameter: <b>code</b> 2855 * <p> 2856 * Description: <b>Returns dispenses of this medicine code</b><br> 2857 * Type: <b>token</b><br> 2858 * Path: <b>MedicationDispense.medicationCodeableConcept</b><br> 2859 * </p> 2860 */ 2861 @SearchParamDefinition(name="code", path="MedicationDispense.medication.as(CodeableConcept)", description="Returns dispenses of this medicine code", type="token" ) 2862 public static final String SP_CODE = "code"; 2863 /** 2864 * <b>Fluent Client</b> search parameter constant for <b>code</b> 2865 * <p> 2866 * Description: <b>Returns dispenses of this medicine code</b><br> 2867 * Type: <b>token</b><br> 2868 * Path: <b>MedicationDispense.medicationCodeableConcept</b><br> 2869 * </p> 2870 */ 2871 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 2872 2873 /** 2874 * Search parameter: <b>receiver</b> 2875 * <p> 2876 * Description: <b>The identity of a receiver to list dispenses for</b><br> 2877 * Type: <b>reference</b><br> 2878 * Path: <b>MedicationDispense.receiver</b><br> 2879 * </p> 2880 */ 2881 @SearchParamDefinition(name="receiver", path="MedicationDispense.receiver", description="The identity of a receiver to list dispenses for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Patient.class, Practitioner.class } ) 2882 public static final String SP_RECEIVER = "receiver"; 2883 /** 2884 * <b>Fluent Client</b> search parameter constant for <b>receiver</b> 2885 * <p> 2886 * Description: <b>The identity of a receiver to list dispenses for</b><br> 2887 * Type: <b>reference</b><br> 2888 * Path: <b>MedicationDispense.receiver</b><br> 2889 * </p> 2890 */ 2891 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECEIVER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECEIVER); 2892 2893/** 2894 * Constant for fluent queries to be used to add include statements. Specifies 2895 * the path value of "<b>MedicationDispense:receiver</b>". 2896 */ 2897 public static final ca.uhn.fhir.model.api.Include INCLUDE_RECEIVER = new ca.uhn.fhir.model.api.Include("MedicationDispense:receiver").toLocked(); 2898 2899 /** 2900 * Search parameter: <b>subject</b> 2901 * <p> 2902 * Description: <b>The identity of a patient for whom to list dispenses</b><br> 2903 * Type: <b>reference</b><br> 2904 * Path: <b>MedicationDispense.subject</b><br> 2905 * </p> 2906 */ 2907 @SearchParamDefinition(name="subject", path="MedicationDispense.subject", description="The identity of a patient for whom to list dispenses", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } ) 2908 public static final String SP_SUBJECT = "subject"; 2909 /** 2910 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 2911 * <p> 2912 * Description: <b>The identity of a patient for whom to list dispenses</b><br> 2913 * Type: <b>reference</b><br> 2914 * Path: <b>MedicationDispense.subject</b><br> 2915 * </p> 2916 */ 2917 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 2918 2919/** 2920 * Constant for fluent queries to be used to add include statements. Specifies 2921 * the path value of "<b>MedicationDispense:subject</b>". 2922 */ 2923 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicationDispense:subject").toLocked(); 2924 2925 /** 2926 * Search parameter: <b>destination</b> 2927 * <p> 2928 * Description: <b>Returns dispenses that should be sent to a specific destination</b><br> 2929 * Type: <b>reference</b><br> 2930 * Path: <b>MedicationDispense.destination</b><br> 2931 * </p> 2932 */ 2933 @SearchParamDefinition(name="destination", path="MedicationDispense.destination", description="Returns dispenses that should be sent to a specific destination", type="reference", target={Location.class } ) 2934 public static final String SP_DESTINATION = "destination"; 2935 /** 2936 * <b>Fluent Client</b> search parameter constant for <b>destination</b> 2937 * <p> 2938 * Description: <b>Returns dispenses that should be sent to a specific destination</b><br> 2939 * Type: <b>reference</b><br> 2940 * Path: <b>MedicationDispense.destination</b><br> 2941 * </p> 2942 */ 2943 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DESTINATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DESTINATION); 2944 2945/** 2946 * Constant for fluent queries to be used to add include statements. Specifies 2947 * the path value of "<b>MedicationDispense:destination</b>". 2948 */ 2949 public static final ca.uhn.fhir.model.api.Include INCLUDE_DESTINATION = new ca.uhn.fhir.model.api.Include("MedicationDispense:destination").toLocked(); 2950 2951 /** 2952 * Search parameter: <b>medication</b> 2953 * <p> 2954 * Description: <b>Returns dispenses of this medicine resource</b><br> 2955 * Type: <b>reference</b><br> 2956 * Path: <b>MedicationDispense.medicationReference</b><br> 2957 * </p> 2958 */ 2959 @SearchParamDefinition(name="medication", path="MedicationDispense.medication.as(Reference)", description="Returns dispenses of this medicine resource", type="reference", target={Medication.class } ) 2960 public static final String SP_MEDICATION = "medication"; 2961 /** 2962 * <b>Fluent Client</b> search parameter constant for <b>medication</b> 2963 * <p> 2964 * Description: <b>Returns dispenses of this medicine resource</b><br> 2965 * Type: <b>reference</b><br> 2966 * Path: <b>MedicationDispense.medicationReference</b><br> 2967 * </p> 2968 */ 2969 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION); 2970 2971/** 2972 * Constant for fluent queries to be used to add include statements. Specifies 2973 * the path value of "<b>MedicationDispense:medication</b>". 2974 */ 2975 public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationDispense:medication").toLocked(); 2976 2977 /** 2978 * Search parameter: <b>responsibleparty</b> 2979 * <p> 2980 * Description: <b>Returns dispenses with the specified responsible party</b><br> 2981 * Type: <b>reference</b><br> 2982 * Path: <b>MedicationDispense.substitution.responsibleParty</b><br> 2983 * </p> 2984 */ 2985 @SearchParamDefinition(name="responsibleparty", path="MedicationDispense.substitution.responsibleParty", description="Returns dispenses with the specified responsible party", type="reference", target={Practitioner.class } ) 2986 public static final String SP_RESPONSIBLEPARTY = "responsibleparty"; 2987 /** 2988 * <b>Fluent Client</b> search parameter constant for <b>responsibleparty</b> 2989 * <p> 2990 * Description: <b>Returns dispenses with the specified responsible party</b><br> 2991 * Type: <b>reference</b><br> 2992 * Path: <b>MedicationDispense.substitution.responsibleParty</b><br> 2993 * </p> 2994 */ 2995 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESPONSIBLEPARTY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESPONSIBLEPARTY); 2996 2997/** 2998 * Constant for fluent queries to be used to add include statements. Specifies 2999 * the path value of "<b>MedicationDispense:responsibleparty</b>". 3000 */ 3001 public static final ca.uhn.fhir.model.api.Include INCLUDE_RESPONSIBLEPARTY = new ca.uhn.fhir.model.api.Include("MedicationDispense:responsibleparty").toLocked(); 3002 3003 /** 3004 * Search parameter: <b>type</b> 3005 * <p> 3006 * Description: <b>Returns dispenses of a specific type</b><br> 3007 * Type: <b>token</b><br> 3008 * Path: <b>MedicationDispense.type</b><br> 3009 * </p> 3010 */ 3011 @SearchParamDefinition(name="type", path="MedicationDispense.type", description="Returns dispenses of a specific type", type="token" ) 3012 public static final String SP_TYPE = "type"; 3013 /** 3014 * <b>Fluent Client</b> search parameter constant for <b>type</b> 3015 * <p> 3016 * Description: <b>Returns dispenses of a specific type</b><br> 3017 * Type: <b>token</b><br> 3018 * Path: <b>MedicationDispense.type</b><br> 3019 * </p> 3020 */ 3021 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE); 3022 3023 /** 3024 * Search parameter: <b>whenhandedover</b> 3025 * <p> 3026 * Description: <b>Returns dispenses handed over on this date</b><br> 3027 * Type: <b>date</b><br> 3028 * Path: <b>MedicationDispense.whenHandedOver</b><br> 3029 * </p> 3030 */ 3031 @SearchParamDefinition(name="whenhandedover", path="MedicationDispense.whenHandedOver", description="Returns dispenses handed over on this date", type="date" ) 3032 public static final String SP_WHENHANDEDOVER = "whenhandedover"; 3033 /** 3034 * <b>Fluent Client</b> search parameter constant for <b>whenhandedover</b> 3035 * <p> 3036 * Description: <b>Returns dispenses handed over on this date</b><br> 3037 * Type: <b>date</b><br> 3038 * Path: <b>MedicationDispense.whenHandedOver</b><br> 3039 * </p> 3040 */ 3041 public static final ca.uhn.fhir.rest.gclient.DateClientParam WHENHANDEDOVER = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHENHANDEDOVER); 3042 3043 /** 3044 * Search parameter: <b>whenprepared</b> 3045 * <p> 3046 * Description: <b>Returns dispenses prepared on this date</b><br> 3047 * Type: <b>date</b><br> 3048 * Path: <b>MedicationDispense.whenPrepared</b><br> 3049 * </p> 3050 */ 3051 @SearchParamDefinition(name="whenprepared", path="MedicationDispense.whenPrepared", description="Returns dispenses prepared on this date", type="date" ) 3052 public static final String SP_WHENPREPARED = "whenprepared"; 3053 /** 3054 * <b>Fluent Client</b> search parameter constant for <b>whenprepared</b> 3055 * <p> 3056 * Description: <b>Returns dispenses prepared on this date</b><br> 3057 * Type: <b>date</b><br> 3058 * Path: <b>MedicationDispense.whenPrepared</b><br> 3059 * </p> 3060 */ 3061 public static final ca.uhn.fhir.rest.gclient.DateClientParam WHENPREPARED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHENPREPARED); 3062 3063 /** 3064 * Search parameter: <b>prescription</b> 3065 * <p> 3066 * Description: <b>The identity of a prescription to list dispenses from</b><br> 3067 * Type: <b>reference</b><br> 3068 * Path: <b>MedicationDispense.authorizingPrescription</b><br> 3069 * </p> 3070 */ 3071 @SearchParamDefinition(name="prescription", path="MedicationDispense.authorizingPrescription", description="The identity of a prescription to list dispenses from", type="reference", target={MedicationRequest.class } ) 3072 public static final String SP_PRESCRIPTION = "prescription"; 3073 /** 3074 * <b>Fluent Client</b> search parameter constant for <b>prescription</b> 3075 * <p> 3076 * Description: <b>The identity of a prescription to list dispenses from</b><br> 3077 * Type: <b>reference</b><br> 3078 * Path: <b>MedicationDispense.authorizingPrescription</b><br> 3079 * </p> 3080 */ 3081 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRESCRIPTION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRESCRIPTION); 3082 3083/** 3084 * Constant for fluent queries to be used to add include statements. Specifies 3085 * the path value of "<b>MedicationDispense:prescription</b>". 3086 */ 3087 public static final ca.uhn.fhir.model.api.Include INCLUDE_PRESCRIPTION = new ca.uhn.fhir.model.api.Include("MedicationDispense:prescription").toLocked(); 3088 3089 /** 3090 * Search parameter: <b>patient</b> 3091 * <p> 3092 * Description: <b>The identity of a patient to list dispenses for</b><br> 3093 * Type: <b>reference</b><br> 3094 * Path: <b>MedicationDispense.subject</b><br> 3095 * </p> 3096 */ 3097 @SearchParamDefinition(name="patient", path="MedicationDispense.subject", description="The identity of a patient to list dispenses for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } ) 3098 public static final String SP_PATIENT = "patient"; 3099 /** 3100 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 3101 * <p> 3102 * Description: <b>The identity of a patient to list dispenses for</b><br> 3103 * Type: <b>reference</b><br> 3104 * Path: <b>MedicationDispense.subject</b><br> 3105 * </p> 3106 */ 3107 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 3108 3109/** 3110 * Constant for fluent queries to be used to add include statements. Specifies 3111 * the path value of "<b>MedicationDispense:patient</b>". 3112 */ 3113 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationDispense:patient").toLocked(); 3114 3115 /** 3116 * Search parameter: <b>context</b> 3117 * <p> 3118 * Description: <b>Returns dispenses with a specific context (episode or episode of care)</b><br> 3119 * Type: <b>reference</b><br> 3120 * Path: <b>MedicationDispense.context</b><br> 3121 * </p> 3122 */ 3123 @SearchParamDefinition(name="context", path="MedicationDispense.context", description="Returns dispenses with a specific context (episode or episode of care)", type="reference", target={Encounter.class, EpisodeOfCare.class } ) 3124 public static final String SP_CONTEXT = "context"; 3125 /** 3126 * <b>Fluent Client</b> search parameter constant for <b>context</b> 3127 * <p> 3128 * Description: <b>Returns dispenses with a specific context (episode or episode of care)</b><br> 3129 * Type: <b>reference</b><br> 3130 * Path: <b>MedicationDispense.context</b><br> 3131 * </p> 3132 */ 3133 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT); 3134 3135/** 3136 * Constant for fluent queries to be used to add include statements. Specifies 3137 * the path value of "<b>MedicationDispense:context</b>". 3138 */ 3139 public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("MedicationDispense:context").toLocked(); 3140 3141 /** 3142 * Search parameter: <b>status</b> 3143 * <p> 3144 * Description: <b>Returns dispenses with a specified dispense status</b><br> 3145 * Type: <b>token</b><br> 3146 * Path: <b>MedicationDispense.status</b><br> 3147 * </p> 3148 */ 3149 @SearchParamDefinition(name="status", path="MedicationDispense.status", description="Returns dispenses with a specified dispense status", type="token" ) 3150 public static final String SP_STATUS = "status"; 3151 /** 3152 * <b>Fluent Client</b> search parameter constant for <b>status</b> 3153 * <p> 3154 * Description: <b>Returns dispenses with a specified dispense status</b><br> 3155 * Type: <b>token</b><br> 3156 * Path: <b>MedicationDispense.status</b><br> 3157 * </p> 3158 */ 3159 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 3160 3161 3162} 3163