001package org.hl7.fhir.dstu2016may.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 8, 2016 03:05+1000 for FHIR v1.4.0 033import java.util.ArrayList; 034import java.util.Date; 035import java.util.List; 036 037import org.hl7.fhir.exceptions.FHIRException; 038import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 039import org.hl7.fhir.utilities.Utilities; 040 041import ca.uhn.fhir.model.api.annotation.Block; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.Description; 044import ca.uhn.fhir.model.api.annotation.ResourceDef; 045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 046/** 047 * 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. 048 */ 049@ResourceDef(name="MedicationDispense", profile="http://hl7.org/fhir/Profile/MedicationDispense") 050public class MedicationDispense extends DomainResource { 051 052 public enum MedicationDispenseStatus { 053 /** 054 * The dispense has started but has not yet completed. 055 */ 056 INPROGRESS, 057 /** 058 * Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called "suspended" 059 */ 060 ONHOLD, 061 /** 062 * All actions that are implied by the dispense have occurred. 063 */ 064 COMPLETED, 065 /** 066 * The dispense was entered in error and therefore nullified. 067 */ 068 ENTEREDINERROR, 069 /** 070 * Actions implied by the dispense have been permanently halted, before all of them occurred. 071 */ 072 STOPPED, 073 /** 074 * added to help the parsers 075 */ 076 NULL; 077 public static MedicationDispenseStatus fromCode(String codeString) throws FHIRException { 078 if (codeString == null || "".equals(codeString)) 079 return null; 080 if ("in-progress".equals(codeString)) 081 return INPROGRESS; 082 if ("on-hold".equals(codeString)) 083 return ONHOLD; 084 if ("completed".equals(codeString)) 085 return COMPLETED; 086 if ("entered-in-error".equals(codeString)) 087 return ENTEREDINERROR; 088 if ("stopped".equals(codeString)) 089 return STOPPED; 090 throw new FHIRException("Unknown MedicationDispenseStatus code '"+codeString+"'"); 091 } 092 public String toCode() { 093 switch (this) { 094 case INPROGRESS: return "in-progress"; 095 case ONHOLD: return "on-hold"; 096 case COMPLETED: return "completed"; 097 case ENTEREDINERROR: return "entered-in-error"; 098 case STOPPED: return "stopped"; 099 default: return "?"; 100 } 101 } 102 public String getSystem() { 103 switch (this) { 104 case INPROGRESS: return "http://hl7.org/fhir/medication-dispense-status"; 105 case ONHOLD: return "http://hl7.org/fhir/medication-dispense-status"; 106 case COMPLETED: return "http://hl7.org/fhir/medication-dispense-status"; 107 case ENTEREDINERROR: return "http://hl7.org/fhir/medication-dispense-status"; 108 case STOPPED: return "http://hl7.org/fhir/medication-dispense-status"; 109 default: return "?"; 110 } 111 } 112 public String getDefinition() { 113 switch (this) { 114 case INPROGRESS: return "The dispense has started but has not yet completed."; 115 case ONHOLD: return "Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called \"suspended\""; 116 case COMPLETED: return "All actions that are implied by the dispense have occurred."; 117 case ENTEREDINERROR: return "The dispense was entered in error and therefore nullified."; 118 case STOPPED: return "Actions implied by the dispense have been permanently halted, before all of them occurred."; 119 default: return "?"; 120 } 121 } 122 public String getDisplay() { 123 switch (this) { 124 case INPROGRESS: return "In Progress"; 125 case ONHOLD: return "On Hold"; 126 case COMPLETED: return "Completed"; 127 case ENTEREDINERROR: return "Entered in-Error"; 128 case STOPPED: return "Stopped"; 129 default: return "?"; 130 } 131 } 132 } 133 134 public static class MedicationDispenseStatusEnumFactory implements EnumFactory<MedicationDispenseStatus> { 135 public MedicationDispenseStatus fromCode(String codeString) throws IllegalArgumentException { 136 if (codeString == null || "".equals(codeString)) 137 if (codeString == null || "".equals(codeString)) 138 return null; 139 if ("in-progress".equals(codeString)) 140 return MedicationDispenseStatus.INPROGRESS; 141 if ("on-hold".equals(codeString)) 142 return MedicationDispenseStatus.ONHOLD; 143 if ("completed".equals(codeString)) 144 return MedicationDispenseStatus.COMPLETED; 145 if ("entered-in-error".equals(codeString)) 146 return MedicationDispenseStatus.ENTEREDINERROR; 147 if ("stopped".equals(codeString)) 148 return MedicationDispenseStatus.STOPPED; 149 throw new IllegalArgumentException("Unknown MedicationDispenseStatus code '"+codeString+"'"); 150 } 151 public Enumeration<MedicationDispenseStatus> fromType(Base code) throws FHIRException { 152 if (code == null || code.isEmpty()) 153 return null; 154 String codeString = ((PrimitiveType) code).asStringValue(); 155 if (codeString == null || "".equals(codeString)) 156 return null; 157 if ("in-progress".equals(codeString)) 158 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.INPROGRESS); 159 if ("on-hold".equals(codeString)) 160 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.ONHOLD); 161 if ("completed".equals(codeString)) 162 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.COMPLETED); 163 if ("entered-in-error".equals(codeString)) 164 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.ENTEREDINERROR); 165 if ("stopped".equals(codeString)) 166 return new Enumeration<MedicationDispenseStatus>(this, MedicationDispenseStatus.STOPPED); 167 throw new FHIRException("Unknown MedicationDispenseStatus code '"+codeString+"'"); 168 } 169 public String toCode(MedicationDispenseStatus code) { 170 if (code == MedicationDispenseStatus.INPROGRESS) 171 return "in-progress"; 172 if (code == MedicationDispenseStatus.ONHOLD) 173 return "on-hold"; 174 if (code == MedicationDispenseStatus.COMPLETED) 175 return "completed"; 176 if (code == MedicationDispenseStatus.ENTEREDINERROR) 177 return "entered-in-error"; 178 if (code == MedicationDispenseStatus.STOPPED) 179 return "stopped"; 180 return "?"; 181 } 182 public String toSystem(MedicationDispenseStatus code) { 183 return code.getSystem(); 184 } 185 } 186 187 @Block() 188 public static class MedicationDispenseDosageInstructionComponent extends BackboneElement implements IBaseBackboneElement { 189 /** 190 * Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. 191 */ 192 @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 193 @Description(shortDefinition="Free text dosage instructions e.g. SIG", formalDefinition="Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication." ) 194 protected StringType text; 195 196 /** 197 * Additional instructions such as "Swallow with plenty of water" which may or may not be coded. 198 */ 199 @Child(name = "additionalInstructions", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 200 @Description(shortDefinition="E.g. \"Take with food\"", formalDefinition="Additional instructions such as \"Swallow with plenty of water\" which may or may not be coded." ) 201 protected CodeableConcept additionalInstructions; 202 203 /** 204 * The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions. For example, "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013". 205 */ 206 @Child(name = "timing", type = {Timing.class}, order=3, min=0, max=1, modifier=false, summary=true) 207 @Description(shortDefinition="When medication should be administered", formalDefinition="The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions. For example, \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\"." ) 208 protected Timing timing; 209 210 /** 211 * Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 212 213Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule. 214 */ 215 @Child(name = "asNeeded", type = {BooleanType.class, CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 216 @Description(shortDefinition="Take \"as needed\" f(or x)", formalDefinition="Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). \n\nSpecifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule." ) 217 protected Type asNeeded; 218 219 /** 220 * A coded specification of the anatomic site where the medication first enters the body. 221 */ 222 @Child(name = "site", type = {CodeableConcept.class, BodySite.class}, order=5, min=0, max=1, modifier=false, summary=true) 223 @Description(shortDefinition="Body site to administer to", formalDefinition="A coded specification of the anatomic site where the medication first enters the body." ) 224 protected Type site; 225 226 /** 227 * A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject. 228 */ 229 @Child(name = "route", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 230 @Description(shortDefinition="How drug should enter body", formalDefinition="A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject." ) 231 protected CodeableConcept route; 232 233 /** 234 * A coded value indicating the method by which the medication is intended to be or was introduced into or on the body. 235 */ 236 @Child(name = "method", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true) 237 @Description(shortDefinition="Technique for administering medication", formalDefinition="A coded value indicating the method by which the medication is intended to be or was introduced into or on the body." ) 238 protected CodeableConcept method; 239 240 /** 241 * The amount of therapeutic or other substance given at one administration event. 242 */ 243 @Child(name = "dose", type = {Range.class, SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=true) 244 @Description(shortDefinition="Amount of medication per dose", formalDefinition="The amount of therapeutic or other substance given at one administration event." ) 245 protected Type dose; 246 247 /** 248 * Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr. May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours. Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours. 249 */ 250 @Child(name = "rate", type = {Ratio.class, Range.class}, order=9, min=0, max=1, modifier=false, summary=true) 251 @Description(shortDefinition="Amount of medication per unit of time", formalDefinition="Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr. May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours. Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours." ) 252 protected Type rate; 253 254 /** 255 * The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time, e.g. 1000mg in 24 hours. 256 */ 257 @Child(name = "maxDosePerPeriod", type = {Ratio.class}, order=10, min=0, max=1, modifier=false, summary=true) 258 @Description(shortDefinition="Upper limit on medication per unit of time", formalDefinition="The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time, e.g. 1000mg in 24 hours." ) 259 protected Ratio maxDosePerPeriod; 260 261 private static final long serialVersionUID = -1470136646L; 262 263 /** 264 * Constructor 265 */ 266 public MedicationDispenseDosageInstructionComponent() { 267 super(); 268 } 269 270 /** 271 * @return {@link #text} (Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 272 */ 273 public StringType getTextElement() { 274 if (this.text == null) 275 if (Configuration.errorOnAutoCreate()) 276 throw new Error("Attempt to auto-create MedicationDispenseDosageInstructionComponent.text"); 277 else if (Configuration.doAutoCreate()) 278 this.text = new StringType(); // bb 279 return this.text; 280 } 281 282 public boolean hasTextElement() { 283 return this.text != null && !this.text.isEmpty(); 284 } 285 286 public boolean hasText() { 287 return this.text != null && !this.text.isEmpty(); 288 } 289 290 /** 291 * @param value {@link #text} (Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 292 */ 293 public MedicationDispenseDosageInstructionComponent setTextElement(StringType value) { 294 this.text = value; 295 return this; 296 } 297 298 /** 299 * @return Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. 300 */ 301 public String getText() { 302 return this.text == null ? null : this.text.getValue(); 303 } 304 305 /** 306 * @param value Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. 307 */ 308 public MedicationDispenseDosageInstructionComponent setText(String value) { 309 if (Utilities.noString(value)) 310 this.text = null; 311 else { 312 if (this.text == null) 313 this.text = new StringType(); 314 this.text.setValue(value); 315 } 316 return this; 317 } 318 319 /** 320 * @return {@link #additionalInstructions} (Additional instructions such as "Swallow with plenty of water" which may or may not be coded.) 321 */ 322 public CodeableConcept getAdditionalInstructions() { 323 if (this.additionalInstructions == null) 324 if (Configuration.errorOnAutoCreate()) 325 throw new Error("Attempt to auto-create MedicationDispenseDosageInstructionComponent.additionalInstructions"); 326 else if (Configuration.doAutoCreate()) 327 this.additionalInstructions = new CodeableConcept(); // cc 328 return this.additionalInstructions; 329 } 330 331 public boolean hasAdditionalInstructions() { 332 return this.additionalInstructions != null && !this.additionalInstructions.isEmpty(); 333 } 334 335 /** 336 * @param value {@link #additionalInstructions} (Additional instructions such as "Swallow with plenty of water" which may or may not be coded.) 337 */ 338 public MedicationDispenseDosageInstructionComponent setAdditionalInstructions(CodeableConcept value) { 339 this.additionalInstructions = value; 340 return this; 341 } 342 343 /** 344 * @return {@link #timing} (The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions. For example, "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 345 */ 346 public Timing getTiming() { 347 if (this.timing == null) 348 if (Configuration.errorOnAutoCreate()) 349 throw new Error("Attempt to auto-create MedicationDispenseDosageInstructionComponent.timing"); 350 else if (Configuration.doAutoCreate()) 351 this.timing = new Timing(); // cc 352 return this.timing; 353 } 354 355 public boolean hasTiming() { 356 return this.timing != null && !this.timing.isEmpty(); 357 } 358 359 /** 360 * @param value {@link #timing} (The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions. For example, "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 361 */ 362 public MedicationDispenseDosageInstructionComponent setTiming(Timing value) { 363 this.timing = value; 364 return this; 365 } 366 367 /** 368 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 369 370Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 371 */ 372 public Type getAsNeeded() { 373 return this.asNeeded; 374 } 375 376 /** 377 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 378 379Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 380 */ 381 public BooleanType getAsNeededBooleanType() throws FHIRException { 382 if (!(this.asNeeded instanceof BooleanType)) 383 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 384 return (BooleanType) this.asNeeded; 385 } 386 387 public boolean hasAsNeededBooleanType() { 388 return this.asNeeded instanceof BooleanType; 389 } 390 391 /** 392 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 393 394Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 395 */ 396 public CodeableConcept getAsNeededCodeableConcept() throws FHIRException { 397 if (!(this.asNeeded instanceof CodeableConcept)) 398 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 399 return (CodeableConcept) this.asNeeded; 400 } 401 402 public boolean hasAsNeededCodeableConcept() { 403 return this.asNeeded instanceof CodeableConcept; 404 } 405 406 public boolean hasAsNeeded() { 407 return this.asNeeded != null && !this.asNeeded.isEmpty(); 408 } 409 410 /** 411 * @param value {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 412 413Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 414 */ 415 public MedicationDispenseDosageInstructionComponent setAsNeeded(Type value) { 416 this.asNeeded = value; 417 return this; 418 } 419 420 /** 421 * @return {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 422 */ 423 public Type getSite() { 424 return this.site; 425 } 426 427 /** 428 * @return {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 429 */ 430 public CodeableConcept getSiteCodeableConcept() throws FHIRException { 431 if (!(this.site instanceof CodeableConcept)) 432 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.site.getClass().getName()+" was encountered"); 433 return (CodeableConcept) this.site; 434 } 435 436 public boolean hasSiteCodeableConcept() { 437 return this.site instanceof CodeableConcept; 438 } 439 440 /** 441 * @return {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 442 */ 443 public Reference getSiteReference() throws FHIRException { 444 if (!(this.site instanceof Reference)) 445 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.site.getClass().getName()+" was encountered"); 446 return (Reference) this.site; 447 } 448 449 public boolean hasSiteReference() { 450 return this.site instanceof Reference; 451 } 452 453 public boolean hasSite() { 454 return this.site != null && !this.site.isEmpty(); 455 } 456 457 /** 458 * @param value {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 459 */ 460 public MedicationDispenseDosageInstructionComponent setSite(Type value) { 461 this.site = value; 462 return this; 463 } 464 465 /** 466 * @return {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.) 467 */ 468 public CodeableConcept getRoute() { 469 if (this.route == null) 470 if (Configuration.errorOnAutoCreate()) 471 throw new Error("Attempt to auto-create MedicationDispenseDosageInstructionComponent.route"); 472 else if (Configuration.doAutoCreate()) 473 this.route = new CodeableConcept(); // cc 474 return this.route; 475 } 476 477 public boolean hasRoute() { 478 return this.route != null && !this.route.isEmpty(); 479 } 480 481 /** 482 * @param value {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.) 483 */ 484 public MedicationDispenseDosageInstructionComponent setRoute(CodeableConcept value) { 485 this.route = value; 486 return this; 487 } 488 489 /** 490 * @return {@link #method} (A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.) 491 */ 492 public CodeableConcept getMethod() { 493 if (this.method == null) 494 if (Configuration.errorOnAutoCreate()) 495 throw new Error("Attempt to auto-create MedicationDispenseDosageInstructionComponent.method"); 496 else if (Configuration.doAutoCreate()) 497 this.method = new CodeableConcept(); // cc 498 return this.method; 499 } 500 501 public boolean hasMethod() { 502 return this.method != null && !this.method.isEmpty(); 503 } 504 505 /** 506 * @param value {@link #method} (A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.) 507 */ 508 public MedicationDispenseDosageInstructionComponent setMethod(CodeableConcept value) { 509 this.method = value; 510 return this; 511 } 512 513 /** 514 * @return {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 515 */ 516 public Type getDose() { 517 return this.dose; 518 } 519 520 /** 521 * @return {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 522 */ 523 public Range getDoseRange() throws FHIRException { 524 if (!(this.dose instanceof Range)) 525 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.dose.getClass().getName()+" was encountered"); 526 return (Range) this.dose; 527 } 528 529 public boolean hasDoseRange() { 530 return this.dose instanceof Range; 531 } 532 533 /** 534 * @return {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 535 */ 536 public SimpleQuantity getDoseSimpleQuantity() throws FHIRException { 537 if (!(this.dose instanceof SimpleQuantity)) 538 throw new FHIRException("Type mismatch: the type SimpleQuantity was expected, but "+this.dose.getClass().getName()+" was encountered"); 539 return (SimpleQuantity) this.dose; 540 } 541 542 public boolean hasDoseSimpleQuantity() { 543 return this.dose instanceof SimpleQuantity; 544 } 545 546 public boolean hasDose() { 547 return this.dose != null && !this.dose.isEmpty(); 548 } 549 550 /** 551 * @param value {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 552 */ 553 public MedicationDispenseDosageInstructionComponent setDose(Type value) { 554 this.dose = value; 555 return this; 556 } 557 558 /** 559 * @return {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr. May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours. Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.) 560 */ 561 public Type getRate() { 562 return this.rate; 563 } 564 565 /** 566 * @return {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr. May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours. Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.) 567 */ 568 public Ratio getRateRatio() throws FHIRException { 569 if (!(this.rate instanceof Ratio)) 570 throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered"); 571 return (Ratio) this.rate; 572 } 573 574 public boolean hasRateRatio() { 575 return this.rate instanceof Ratio; 576 } 577 578 /** 579 * @return {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr. May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours. Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.) 580 */ 581 public Range getRateRange() throws FHIRException { 582 if (!(this.rate instanceof Range)) 583 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.rate.getClass().getName()+" was encountered"); 584 return (Range) this.rate; 585 } 586 587 public boolean hasRateRange() { 588 return this.rate instanceof Range; 589 } 590 591 public boolean hasRate() { 592 return this.rate != null && !this.rate.isEmpty(); 593 } 594 595 /** 596 * @param value {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr. May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours. Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.) 597 */ 598 public MedicationDispenseDosageInstructionComponent setRate(Type value) { 599 this.rate = value; 600 return this; 601 } 602 603 /** 604 * @return {@link #maxDosePerPeriod} (The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time, e.g. 1000mg in 24 hours.) 605 */ 606 public Ratio getMaxDosePerPeriod() { 607 if (this.maxDosePerPeriod == null) 608 if (Configuration.errorOnAutoCreate()) 609 throw new Error("Attempt to auto-create MedicationDispenseDosageInstructionComponent.maxDosePerPeriod"); 610 else if (Configuration.doAutoCreate()) 611 this.maxDosePerPeriod = new Ratio(); // cc 612 return this.maxDosePerPeriod; 613 } 614 615 public boolean hasMaxDosePerPeriod() { 616 return this.maxDosePerPeriod != null && !this.maxDosePerPeriod.isEmpty(); 617 } 618 619 /** 620 * @param value {@link #maxDosePerPeriod} (The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time, e.g. 1000mg in 24 hours.) 621 */ 622 public MedicationDispenseDosageInstructionComponent setMaxDosePerPeriod(Ratio value) { 623 this.maxDosePerPeriod = value; 624 return this; 625 } 626 627 protected void listChildren(List<Property> childrenList) { 628 super.listChildren(childrenList); 629 childrenList.add(new Property("text", "string", "Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.", 0, java.lang.Integer.MAX_VALUE, text)); 630 childrenList.add(new Property("additionalInstructions", "CodeableConcept", "Additional instructions such as \"Swallow with plenty of water\" which may or may not be coded.", 0, java.lang.Integer.MAX_VALUE, additionalInstructions)); 631 childrenList.add(new Property("timing", "Timing", "The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions. For example, \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, java.lang.Integer.MAX_VALUE, timing)); 632 childrenList.add(new Property("asNeeded[x]", "boolean|CodeableConcept", "Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). \n\nSpecifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.", 0, java.lang.Integer.MAX_VALUE, asNeeded)); 633 childrenList.add(new Property("site[x]", "CodeableConcept|Reference(BodySite)", "A coded specification of the anatomic site where the medication first enters the body.", 0, java.lang.Integer.MAX_VALUE, site)); 634 childrenList.add(new Property("route", "CodeableConcept", "A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.", 0, java.lang.Integer.MAX_VALUE, route)); 635 childrenList.add(new Property("method", "CodeableConcept", "A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.", 0, java.lang.Integer.MAX_VALUE, method)); 636 childrenList.add(new Property("dose[x]", "Range|SimpleQuantity", "The amount of therapeutic or other substance given at one administration event.", 0, java.lang.Integer.MAX_VALUE, dose)); 637 childrenList.add(new Property("rate[x]", "Ratio|Range", "Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr. May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours. Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.", 0, java.lang.Integer.MAX_VALUE, rate)); 638 childrenList.add(new Property("maxDosePerPeriod", "Ratio", "The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time, e.g. 1000mg in 24 hours.", 0, java.lang.Integer.MAX_VALUE, maxDosePerPeriod)); 639 } 640 641 @Override 642 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 643 switch (hash) { 644 case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType 645 case -1206718612: /*additionalInstructions*/ return this.additionalInstructions == null ? new Base[0] : new Base[] {this.additionalInstructions}; // CodeableConcept 646 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Timing 647 case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // Type 648 case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // Type 649 case 108704329: /*route*/ return this.route == null ? new Base[0] : new Base[] {this.route}; // CodeableConcept 650 case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept 651 case 3089437: /*dose*/ return this.dose == null ? new Base[0] : new Base[] {this.dose}; // Type 652 case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // Type 653 case 1506263709: /*maxDosePerPeriod*/ return this.maxDosePerPeriod == null ? new Base[0] : new Base[] {this.maxDosePerPeriod}; // Ratio 654 default: return super.getProperty(hash, name, checkValid); 655 } 656 657 } 658 659 @Override 660 public void setProperty(int hash, String name, Base value) throws FHIRException { 661 switch (hash) { 662 case 3556653: // text 663 this.text = castToString(value); // StringType 664 break; 665 case -1206718612: // additionalInstructions 666 this.additionalInstructions = castToCodeableConcept(value); // CodeableConcept 667 break; 668 case -873664438: // timing 669 this.timing = castToTiming(value); // Timing 670 break; 671 case -1432923513: // asNeeded 672 this.asNeeded = (Type) value; // Type 673 break; 674 case 3530567: // site 675 this.site = (Type) value; // Type 676 break; 677 case 108704329: // route 678 this.route = castToCodeableConcept(value); // CodeableConcept 679 break; 680 case -1077554975: // method 681 this.method = castToCodeableConcept(value); // CodeableConcept 682 break; 683 case 3089437: // dose 684 this.dose = (Type) value; // Type 685 break; 686 case 3493088: // rate 687 this.rate = (Type) value; // Type 688 break; 689 case 1506263709: // maxDosePerPeriod 690 this.maxDosePerPeriod = castToRatio(value); // Ratio 691 break; 692 default: super.setProperty(hash, name, value); 693 } 694 695 } 696 697 @Override 698 public void setProperty(String name, Base value) throws FHIRException { 699 if (name.equals("text")) 700 this.text = castToString(value); // StringType 701 else if (name.equals("additionalInstructions")) 702 this.additionalInstructions = castToCodeableConcept(value); // CodeableConcept 703 else if (name.equals("timing")) 704 this.timing = castToTiming(value); // Timing 705 else if (name.equals("asNeeded[x]")) 706 this.asNeeded = (Type) value; // Type 707 else if (name.equals("site[x]")) 708 this.site = (Type) value; // Type 709 else if (name.equals("route")) 710 this.route = castToCodeableConcept(value); // CodeableConcept 711 else if (name.equals("method")) 712 this.method = castToCodeableConcept(value); // CodeableConcept 713 else if (name.equals("dose[x]")) 714 this.dose = (Type) value; // Type 715 else if (name.equals("rate[x]")) 716 this.rate = (Type) value; // Type 717 else if (name.equals("maxDosePerPeriod")) 718 this.maxDosePerPeriod = castToRatio(value); // Ratio 719 else 720 super.setProperty(name, value); 721 } 722 723 @Override 724 public Base makeProperty(int hash, String name) throws FHIRException { 725 switch (hash) { 726 case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType 727 case -1206718612: return getAdditionalInstructions(); // CodeableConcept 728 case -873664438: return getTiming(); // Timing 729 case -544329575: return getAsNeeded(); // Type 730 case 2099997657: return getSite(); // Type 731 case 108704329: return getRoute(); // CodeableConcept 732 case -1077554975: return getMethod(); // CodeableConcept 733 case 1843195715: return getDose(); // Type 734 case 983460768: return getRate(); // Type 735 case 1506263709: return getMaxDosePerPeriod(); // Ratio 736 default: return super.makeProperty(hash, name); 737 } 738 739 } 740 741 @Override 742 public Base addChild(String name) throws FHIRException { 743 if (name.equals("text")) { 744 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.text"); 745 } 746 else if (name.equals("additionalInstructions")) { 747 this.additionalInstructions = new CodeableConcept(); 748 return this.additionalInstructions; 749 } 750 else if (name.equals("timing")) { 751 this.timing = new Timing(); 752 return this.timing; 753 } 754 else if (name.equals("asNeededBoolean")) { 755 this.asNeeded = new BooleanType(); 756 return this.asNeeded; 757 } 758 else if (name.equals("asNeededCodeableConcept")) { 759 this.asNeeded = new CodeableConcept(); 760 return this.asNeeded; 761 } 762 else if (name.equals("siteCodeableConcept")) { 763 this.site = new CodeableConcept(); 764 return this.site; 765 } 766 else if (name.equals("siteReference")) { 767 this.site = new Reference(); 768 return this.site; 769 } 770 else if (name.equals("route")) { 771 this.route = new CodeableConcept(); 772 return this.route; 773 } 774 else if (name.equals("method")) { 775 this.method = new CodeableConcept(); 776 return this.method; 777 } 778 else if (name.equals("doseRange")) { 779 this.dose = new Range(); 780 return this.dose; 781 } 782 else if (name.equals("doseSimpleQuantity")) { 783 this.dose = new SimpleQuantity(); 784 return this.dose; 785 } 786 else if (name.equals("rateRatio")) { 787 this.rate = new Ratio(); 788 return this.rate; 789 } 790 else if (name.equals("rateRange")) { 791 this.rate = new Range(); 792 return this.rate; 793 } 794 else if (name.equals("maxDosePerPeriod")) { 795 this.maxDosePerPeriod = new Ratio(); 796 return this.maxDosePerPeriod; 797 } 798 else 799 return super.addChild(name); 800 } 801 802 public MedicationDispenseDosageInstructionComponent copy() { 803 MedicationDispenseDosageInstructionComponent dst = new MedicationDispenseDosageInstructionComponent(); 804 copyValues(dst); 805 dst.text = text == null ? null : text.copy(); 806 dst.additionalInstructions = additionalInstructions == null ? null : additionalInstructions.copy(); 807 dst.timing = timing == null ? null : timing.copy(); 808 dst.asNeeded = asNeeded == null ? null : asNeeded.copy(); 809 dst.site = site == null ? null : site.copy(); 810 dst.route = route == null ? null : route.copy(); 811 dst.method = method == null ? null : method.copy(); 812 dst.dose = dose == null ? null : dose.copy(); 813 dst.rate = rate == null ? null : rate.copy(); 814 dst.maxDosePerPeriod = maxDosePerPeriod == null ? null : maxDosePerPeriod.copy(); 815 return dst; 816 } 817 818 @Override 819 public boolean equalsDeep(Base other) { 820 if (!super.equalsDeep(other)) 821 return false; 822 if (!(other instanceof MedicationDispenseDosageInstructionComponent)) 823 return false; 824 MedicationDispenseDosageInstructionComponent o = (MedicationDispenseDosageInstructionComponent) other; 825 return compareDeep(text, o.text, true) && compareDeep(additionalInstructions, o.additionalInstructions, true) 826 && compareDeep(timing, o.timing, true) && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(site, o.site, true) 827 && compareDeep(route, o.route, true) && compareDeep(method, o.method, true) && compareDeep(dose, o.dose, true) 828 && compareDeep(rate, o.rate, true) && compareDeep(maxDosePerPeriod, o.maxDosePerPeriod, true); 829 } 830 831 @Override 832 public boolean equalsShallow(Base other) { 833 if (!super.equalsShallow(other)) 834 return false; 835 if (!(other instanceof MedicationDispenseDosageInstructionComponent)) 836 return false; 837 MedicationDispenseDosageInstructionComponent o = (MedicationDispenseDosageInstructionComponent) other; 838 return compareValues(text, o.text, true); 839 } 840 841 public boolean isEmpty() { 842 return super.isEmpty() && (text == null || text.isEmpty()) && (additionalInstructions == null || additionalInstructions.isEmpty()) 843 && (timing == null || timing.isEmpty()) && (asNeeded == null || asNeeded.isEmpty()) && (site == null || site.isEmpty()) 844 && (route == null || route.isEmpty()) && (method == null || method.isEmpty()) && (dose == null || dose.isEmpty()) 845 && (rate == null || rate.isEmpty()) && (maxDosePerPeriod == null || maxDosePerPeriod.isEmpty()) 846 ; 847 } 848 849 public String fhirType() { 850 return "MedicationDispense.dosageInstruction"; 851 852 } 853 854 } 855 856 @Block() 857 public static class MedicationDispenseSubstitutionComponent extends BackboneElement implements IBaseBackboneElement { 858 /** 859 * A code signifying whether a different drug was dispensed from what was prescribed. 860 */ 861 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 862 @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." ) 863 protected CodeableConcept type; 864 865 /** 866 * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed. 867 */ 868 @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 869 @Description(shortDefinition="Why was substitution made", formalDefinition="Indicates the reason for the substitution of (or lack of substitution) from what was prescribed." ) 870 protected List<CodeableConcept> reason; 871 872 /** 873 * The person or organization that has primary responsibility for the substitution. 874 */ 875 @Child(name = "responsibleParty", type = {Practitioner.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 876 @Description(shortDefinition="Who is responsible for the substitution", formalDefinition="The person or organization that has primary responsibility for the substitution." ) 877 protected List<Reference> responsibleParty; 878 /** 879 * The actual objects that are the target of the reference (The person or organization that has primary responsibility for the substitution.) 880 */ 881 protected List<Practitioner> responsiblePartyTarget; 882 883 884 private static final long serialVersionUID = 1218245830L; 885 886 /** 887 * Constructor 888 */ 889 public MedicationDispenseSubstitutionComponent() { 890 super(); 891 } 892 893 /** 894 * Constructor 895 */ 896 public MedicationDispenseSubstitutionComponent(CodeableConcept type) { 897 super(); 898 this.type = type; 899 } 900 901 /** 902 * @return {@link #type} (A code signifying whether a different drug was dispensed from what was prescribed.) 903 */ 904 public CodeableConcept getType() { 905 if (this.type == null) 906 if (Configuration.errorOnAutoCreate()) 907 throw new Error("Attempt to auto-create MedicationDispenseSubstitutionComponent.type"); 908 else if (Configuration.doAutoCreate()) 909 this.type = new CodeableConcept(); // cc 910 return this.type; 911 } 912 913 public boolean hasType() { 914 return this.type != null && !this.type.isEmpty(); 915 } 916 917 /** 918 * @param value {@link #type} (A code signifying whether a different drug was dispensed from what was prescribed.) 919 */ 920 public MedicationDispenseSubstitutionComponent setType(CodeableConcept value) { 921 this.type = value; 922 return this; 923 } 924 925 /** 926 * @return {@link #reason} (Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.) 927 */ 928 public List<CodeableConcept> getReason() { 929 if (this.reason == null) 930 this.reason = new ArrayList<CodeableConcept>(); 931 return this.reason; 932 } 933 934 public boolean hasReason() { 935 if (this.reason == null) 936 return false; 937 for (CodeableConcept item : this.reason) 938 if (!item.isEmpty()) 939 return true; 940 return false; 941 } 942 943 /** 944 * @return {@link #reason} (Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.) 945 */ 946 // syntactic sugar 947 public CodeableConcept addReason() { //3 948 CodeableConcept t = new CodeableConcept(); 949 if (this.reason == null) 950 this.reason = new ArrayList<CodeableConcept>(); 951 this.reason.add(t); 952 return t; 953 } 954 955 // syntactic sugar 956 public MedicationDispenseSubstitutionComponent addReason(CodeableConcept t) { //3 957 if (t == null) 958 return this; 959 if (this.reason == null) 960 this.reason = new ArrayList<CodeableConcept>(); 961 this.reason.add(t); 962 return this; 963 } 964 965 /** 966 * @return {@link #responsibleParty} (The person or organization that has primary responsibility for the substitution.) 967 */ 968 public List<Reference> getResponsibleParty() { 969 if (this.responsibleParty == null) 970 this.responsibleParty = new ArrayList<Reference>(); 971 return this.responsibleParty; 972 } 973 974 public boolean hasResponsibleParty() { 975 if (this.responsibleParty == null) 976 return false; 977 for (Reference item : this.responsibleParty) 978 if (!item.isEmpty()) 979 return true; 980 return false; 981 } 982 983 /** 984 * @return {@link #responsibleParty} (The person or organization that has primary responsibility for the substitution.) 985 */ 986 // syntactic sugar 987 public Reference addResponsibleParty() { //3 988 Reference t = new Reference(); 989 if (this.responsibleParty == null) 990 this.responsibleParty = new ArrayList<Reference>(); 991 this.responsibleParty.add(t); 992 return t; 993 } 994 995 // syntactic sugar 996 public MedicationDispenseSubstitutionComponent addResponsibleParty(Reference t) { //3 997 if (t == null) 998 return this; 999 if (this.responsibleParty == null) 1000 this.responsibleParty = new ArrayList<Reference>(); 1001 this.responsibleParty.add(t); 1002 return this; 1003 } 1004 1005 /** 1006 * @return {@link #responsibleParty} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The person or organization that has primary responsibility for the substitution.) 1007 */ 1008 public List<Practitioner> getResponsiblePartyTarget() { 1009 if (this.responsiblePartyTarget == null) 1010 this.responsiblePartyTarget = new ArrayList<Practitioner>(); 1011 return this.responsiblePartyTarget; 1012 } 1013 1014 // syntactic sugar 1015 /** 1016 * @return {@link #responsibleParty} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The person or organization that has primary responsibility for the substitution.) 1017 */ 1018 public Practitioner addResponsiblePartyTarget() { 1019 Practitioner r = new Practitioner(); 1020 if (this.responsiblePartyTarget == null) 1021 this.responsiblePartyTarget = new ArrayList<Practitioner>(); 1022 this.responsiblePartyTarget.add(r); 1023 return r; 1024 } 1025 1026 protected void listChildren(List<Property> childrenList) { 1027 super.listChildren(childrenList); 1028 childrenList.add(new Property("type", "CodeableConcept", "A code signifying whether a different drug was dispensed from what was prescribed.", 0, java.lang.Integer.MAX_VALUE, type)); 1029 childrenList.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.", 0, java.lang.Integer.MAX_VALUE, reason)); 1030 childrenList.add(new Property("responsibleParty", "Reference(Practitioner)", "The person or organization that has primary responsibility for the substitution.", 0, java.lang.Integer.MAX_VALUE, responsibleParty)); 1031 } 1032 1033 @Override 1034 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1035 switch (hash) { 1036 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1037 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept 1038 case 1511509392: /*responsibleParty*/ return this.responsibleParty == null ? new Base[0] : this.responsibleParty.toArray(new Base[this.responsibleParty.size()]); // Reference 1039 default: return super.getProperty(hash, name, checkValid); 1040 } 1041 1042 } 1043 1044 @Override 1045 public void setProperty(int hash, String name, Base value) throws FHIRException { 1046 switch (hash) { 1047 case 3575610: // type 1048 this.type = castToCodeableConcept(value); // CodeableConcept 1049 break; 1050 case -934964668: // reason 1051 this.getReason().add(castToCodeableConcept(value)); // CodeableConcept 1052 break; 1053 case 1511509392: // responsibleParty 1054 this.getResponsibleParty().add(castToReference(value)); // Reference 1055 break; 1056 default: super.setProperty(hash, name, value); 1057 } 1058 1059 } 1060 1061 @Override 1062 public void setProperty(String name, Base value) throws FHIRException { 1063 if (name.equals("type")) 1064 this.type = castToCodeableConcept(value); // CodeableConcept 1065 else if (name.equals("reason")) 1066 this.getReason().add(castToCodeableConcept(value)); 1067 else if (name.equals("responsibleParty")) 1068 this.getResponsibleParty().add(castToReference(value)); 1069 else 1070 super.setProperty(name, value); 1071 } 1072 1073 @Override 1074 public Base makeProperty(int hash, String name) throws FHIRException { 1075 switch (hash) { 1076 case 3575610: return getType(); // CodeableConcept 1077 case -934964668: return addReason(); // CodeableConcept 1078 case 1511509392: return addResponsibleParty(); // Reference 1079 default: return super.makeProperty(hash, name); 1080 } 1081 1082 } 1083 1084 @Override 1085 public Base addChild(String name) throws FHIRException { 1086 if (name.equals("type")) { 1087 this.type = new CodeableConcept(); 1088 return this.type; 1089 } 1090 else if (name.equals("reason")) { 1091 return addReason(); 1092 } 1093 else if (name.equals("responsibleParty")) { 1094 return addResponsibleParty(); 1095 } 1096 else 1097 return super.addChild(name); 1098 } 1099 1100 public MedicationDispenseSubstitutionComponent copy() { 1101 MedicationDispenseSubstitutionComponent dst = new MedicationDispenseSubstitutionComponent(); 1102 copyValues(dst); 1103 dst.type = type == null ? null : type.copy(); 1104 if (reason != null) { 1105 dst.reason = new ArrayList<CodeableConcept>(); 1106 for (CodeableConcept i : reason) 1107 dst.reason.add(i.copy()); 1108 }; 1109 if (responsibleParty != null) { 1110 dst.responsibleParty = new ArrayList<Reference>(); 1111 for (Reference i : responsibleParty) 1112 dst.responsibleParty.add(i.copy()); 1113 }; 1114 return dst; 1115 } 1116 1117 @Override 1118 public boolean equalsDeep(Base other) { 1119 if (!super.equalsDeep(other)) 1120 return false; 1121 if (!(other instanceof MedicationDispenseSubstitutionComponent)) 1122 return false; 1123 MedicationDispenseSubstitutionComponent o = (MedicationDispenseSubstitutionComponent) other; 1124 return compareDeep(type, o.type, true) && compareDeep(reason, o.reason, true) && compareDeep(responsibleParty, o.responsibleParty, true) 1125 ; 1126 } 1127 1128 @Override 1129 public boolean equalsShallow(Base other) { 1130 if (!super.equalsShallow(other)) 1131 return false; 1132 if (!(other instanceof MedicationDispenseSubstitutionComponent)) 1133 return false; 1134 MedicationDispenseSubstitutionComponent o = (MedicationDispenseSubstitutionComponent) other; 1135 return true; 1136 } 1137 1138 public boolean isEmpty() { 1139 return super.isEmpty() && (type == null || type.isEmpty()) && (reason == null || reason.isEmpty()) 1140 && (responsibleParty == null || responsibleParty.isEmpty()); 1141 } 1142 1143 public String fhirType() { 1144 return "MedicationDispense.substitution"; 1145 1146 } 1147 1148 } 1149 1150 /** 1151 * Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR. 1152 */ 1153 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true) 1154 @Description(shortDefinition="External identifier", formalDefinition="Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR." ) 1155 protected Identifier identifier; 1156 1157 /** 1158 * A code specifying the state of the set of dispense events. 1159 */ 1160 @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true) 1161 @Description(shortDefinition="in-progress | on-hold | completed | entered-in-error | stopped", formalDefinition="A code specifying the state of the set of dispense events." ) 1162 protected Enumeration<MedicationDispenseStatus> status; 1163 1164 /** 1165 * 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. 1166 */ 1167 @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=2, min=1, max=1, modifier=false, summary=true) 1168 @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." ) 1169 protected Type medication; 1170 1171 /** 1172 * A link to a resource representing the person to whom the medication will be given. 1173 */ 1174 @Child(name = "patient", type = {Patient.class}, order=3, min=0, max=1, modifier=false, summary=true) 1175 @Description(shortDefinition="Who the dispense is for", formalDefinition="A link to a resource representing the person to whom the medication will be given." ) 1176 protected Reference patient; 1177 1178 /** 1179 * The actual object that is the target of the reference (A link to a resource representing the person to whom the medication will be given.) 1180 */ 1181 protected Patient patientTarget; 1182 1183 /** 1184 * The individual responsible for dispensing the medication. 1185 */ 1186 @Child(name = "dispenser", type = {Practitioner.class}, order=4, min=0, max=1, modifier=false, summary=true) 1187 @Description(shortDefinition="Practitioner responsible for dispensing medication", formalDefinition="The individual responsible for dispensing the medication." ) 1188 protected Reference dispenser; 1189 1190 /** 1191 * The actual object that is the target of the reference (The individual responsible for dispensing the medication.) 1192 */ 1193 protected Practitioner dispenserTarget; 1194 1195 /** 1196 * Indicates the medication order that is being dispensed against. 1197 */ 1198 @Child(name = "authorizingPrescription", type = {MedicationOrder.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1199 @Description(shortDefinition="Medication order that authorizes the dispense", formalDefinition="Indicates the medication order that is being dispensed against." ) 1200 protected List<Reference> authorizingPrescription; 1201 /** 1202 * The actual objects that are the target of the reference (Indicates the medication order that is being dispensed against.) 1203 */ 1204 protected List<MedicationOrder> authorizingPrescriptionTarget; 1205 1206 1207 /** 1208 * Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc. 1209 */ 1210 @Child(name = "type", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 1211 @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." ) 1212 protected CodeableConcept type; 1213 1214 /** 1215 * The amount of medication that has been dispensed. Includes unit of measure. 1216 */ 1217 @Child(name = "quantity", type = {SimpleQuantity.class}, order=7, min=0, max=1, modifier=false, summary=true) 1218 @Description(shortDefinition="Amount dispensed", formalDefinition="The amount of medication that has been dispensed. Includes unit of measure." ) 1219 protected SimpleQuantity quantity; 1220 1221 /** 1222 * The amount of medication expressed as a timing amount. 1223 */ 1224 @Child(name = "daysSupply", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=true) 1225 @Description(shortDefinition="Amount of medication expressed as a timing amount", formalDefinition="The amount of medication expressed as a timing amount." ) 1226 protected SimpleQuantity daysSupply; 1227 1228 /** 1229 * The time when the dispensed product was packaged and reviewed. 1230 */ 1231 @Child(name = "whenPrepared", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true) 1232 @Description(shortDefinition="Dispense processing time", formalDefinition="The time when the dispensed product was packaged and reviewed." ) 1233 protected DateTimeType whenPrepared; 1234 1235 /** 1236 * The time the dispensed product was provided to the patient or their representative. 1237 */ 1238 @Child(name = "whenHandedOver", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=true) 1239 @Description(shortDefinition="When product was given out", formalDefinition="The time the dispensed product was provided to the patient or their representative." ) 1240 protected DateTimeType whenHandedOver; 1241 1242 /** 1243 * Identification of the facility/location where the medication was shipped to, as part of the dispense event. 1244 */ 1245 @Child(name = "destination", type = {Location.class}, order=11, min=0, max=1, modifier=false, summary=true) 1246 @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." ) 1247 protected Reference destination; 1248 1249 /** 1250 * 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.) 1251 */ 1252 protected Location destinationTarget; 1253 1254 /** 1255 * 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. 1256 */ 1257 @Child(name = "receiver", type = {Patient.class, Practitioner.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1258 @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." ) 1259 protected List<Reference> receiver; 1260 /** 1261 * 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.) 1262 */ 1263 protected List<Resource> receiverTarget; 1264 1265 1266 /** 1267 * Extra information about the dispense that could not be conveyed in the other attributes. 1268 */ 1269 @Child(name = "note", type = {Annotation.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1270 @Description(shortDefinition="Information about the dispense", formalDefinition="Extra information about the dispense that could not be conveyed in the other attributes." ) 1271 protected List<Annotation> note; 1272 1273 /** 1274 * Indicates how the medication is to be used by the patient. The pharmacist reviews the medication order prior to dispense and updates the dosageInstruction based on the actual product being dispensed. 1275 */ 1276 @Child(name = "dosageInstruction", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1277 @Description(shortDefinition="Medicine administration instructions to the patient/caregiver", formalDefinition="Indicates how the medication is to be used by the patient. The pharmacist reviews the medication order prior to dispense and updates the dosageInstruction based on the actual product being dispensed." ) 1278 protected List<MedicationDispenseDosageInstructionComponent> dosageInstruction; 1279 1280 /** 1281 * 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. 1282 */ 1283 @Child(name = "substitution", type = {}, order=15, min=0, max=1, modifier=false, summary=true) 1284 @Description(shortDefinition="Deals with substitution of one medicine for another", 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." ) 1285 protected MedicationDispenseSubstitutionComponent substitution; 1286 1287 private static final long serialVersionUID = -634238241L; 1288 1289 /** 1290 * Constructor 1291 */ 1292 public MedicationDispense() { 1293 super(); 1294 } 1295 1296 /** 1297 * Constructor 1298 */ 1299 public MedicationDispense(Type medication) { 1300 super(); 1301 this.medication = medication; 1302 } 1303 1304 /** 1305 * @return {@link #identifier} (Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.) 1306 */ 1307 public Identifier getIdentifier() { 1308 if (this.identifier == null) 1309 if (Configuration.errorOnAutoCreate()) 1310 throw new Error("Attempt to auto-create MedicationDispense.identifier"); 1311 else if (Configuration.doAutoCreate()) 1312 this.identifier = new Identifier(); // cc 1313 return this.identifier; 1314 } 1315 1316 public boolean hasIdentifier() { 1317 return this.identifier != null && !this.identifier.isEmpty(); 1318 } 1319 1320 /** 1321 * @param value {@link #identifier} (Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.) 1322 */ 1323 public MedicationDispense setIdentifier(Identifier value) { 1324 this.identifier = value; 1325 return this; 1326 } 1327 1328 /** 1329 * @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 1330 */ 1331 public Enumeration<MedicationDispenseStatus> getStatusElement() { 1332 if (this.status == null) 1333 if (Configuration.errorOnAutoCreate()) 1334 throw new Error("Attempt to auto-create MedicationDispense.status"); 1335 else if (Configuration.doAutoCreate()) 1336 this.status = new Enumeration<MedicationDispenseStatus>(new MedicationDispenseStatusEnumFactory()); // bb 1337 return this.status; 1338 } 1339 1340 public boolean hasStatusElement() { 1341 return this.status != null && !this.status.isEmpty(); 1342 } 1343 1344 public boolean hasStatus() { 1345 return this.status != null && !this.status.isEmpty(); 1346 } 1347 1348 /** 1349 * @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 1350 */ 1351 public MedicationDispense setStatusElement(Enumeration<MedicationDispenseStatus> value) { 1352 this.status = value; 1353 return this; 1354 } 1355 1356 /** 1357 * @return A code specifying the state of the set of dispense events. 1358 */ 1359 public MedicationDispenseStatus getStatus() { 1360 return this.status == null ? null : this.status.getValue(); 1361 } 1362 1363 /** 1364 * @param value A code specifying the state of the set of dispense events. 1365 */ 1366 public MedicationDispense setStatus(MedicationDispenseStatus value) { 1367 if (value == null) 1368 this.status = null; 1369 else { 1370 if (this.status == null) 1371 this.status = new Enumeration<MedicationDispenseStatus>(new MedicationDispenseStatusEnumFactory()); 1372 this.status.setValue(value); 1373 } 1374 return this; 1375 } 1376 1377 /** 1378 * @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.) 1379 */ 1380 public Type getMedication() { 1381 return this.medication; 1382 } 1383 1384 /** 1385 * @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.) 1386 */ 1387 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 1388 if (!(this.medication instanceof CodeableConcept)) 1389 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); 1390 return (CodeableConcept) this.medication; 1391 } 1392 1393 public boolean hasMedicationCodeableConcept() { 1394 return this.medication instanceof CodeableConcept; 1395 } 1396 1397 /** 1398 * @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.) 1399 */ 1400 public Reference getMedicationReference() throws FHIRException { 1401 if (!(this.medication instanceof Reference)) 1402 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); 1403 return (Reference) this.medication; 1404 } 1405 1406 public boolean hasMedicationReference() { 1407 return this.medication instanceof Reference; 1408 } 1409 1410 public boolean hasMedication() { 1411 return this.medication != null && !this.medication.isEmpty(); 1412 } 1413 1414 /** 1415 * @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.) 1416 */ 1417 public MedicationDispense setMedication(Type value) { 1418 this.medication = value; 1419 return this; 1420 } 1421 1422 /** 1423 * @return {@link #patient} (A link to a resource representing the person to whom the medication will be given.) 1424 */ 1425 public Reference getPatient() { 1426 if (this.patient == null) 1427 if (Configuration.errorOnAutoCreate()) 1428 throw new Error("Attempt to auto-create MedicationDispense.patient"); 1429 else if (Configuration.doAutoCreate()) 1430 this.patient = new Reference(); // cc 1431 return this.patient; 1432 } 1433 1434 public boolean hasPatient() { 1435 return this.patient != null && !this.patient.isEmpty(); 1436 } 1437 1438 /** 1439 * @param value {@link #patient} (A link to a resource representing the person to whom the medication will be given.) 1440 */ 1441 public MedicationDispense setPatient(Reference value) { 1442 this.patient = value; 1443 return this; 1444 } 1445 1446 /** 1447 * @return {@link #patient} 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 to whom the medication will be given.) 1448 */ 1449 public Patient getPatientTarget() { 1450 if (this.patientTarget == null) 1451 if (Configuration.errorOnAutoCreate()) 1452 throw new Error("Attempt to auto-create MedicationDispense.patient"); 1453 else if (Configuration.doAutoCreate()) 1454 this.patientTarget = new Patient(); // aa 1455 return this.patientTarget; 1456 } 1457 1458 /** 1459 * @param value {@link #patient} 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 to whom the medication will be given.) 1460 */ 1461 public MedicationDispense setPatientTarget(Patient value) { 1462 this.patientTarget = value; 1463 return this; 1464 } 1465 1466 /** 1467 * @return {@link #dispenser} (The individual responsible for dispensing the medication.) 1468 */ 1469 public Reference getDispenser() { 1470 if (this.dispenser == null) 1471 if (Configuration.errorOnAutoCreate()) 1472 throw new Error("Attempt to auto-create MedicationDispense.dispenser"); 1473 else if (Configuration.doAutoCreate()) 1474 this.dispenser = new Reference(); // cc 1475 return this.dispenser; 1476 } 1477 1478 public boolean hasDispenser() { 1479 return this.dispenser != null && !this.dispenser.isEmpty(); 1480 } 1481 1482 /** 1483 * @param value {@link #dispenser} (The individual responsible for dispensing the medication.) 1484 */ 1485 public MedicationDispense setDispenser(Reference value) { 1486 this.dispenser = value; 1487 return this; 1488 } 1489 1490 /** 1491 * @return {@link #dispenser} 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 individual responsible for dispensing the medication.) 1492 */ 1493 public Practitioner getDispenserTarget() { 1494 if (this.dispenserTarget == null) 1495 if (Configuration.errorOnAutoCreate()) 1496 throw new Error("Attempt to auto-create MedicationDispense.dispenser"); 1497 else if (Configuration.doAutoCreate()) 1498 this.dispenserTarget = new Practitioner(); // aa 1499 return this.dispenserTarget; 1500 } 1501 1502 /** 1503 * @param value {@link #dispenser} 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 individual responsible for dispensing the medication.) 1504 */ 1505 public MedicationDispense setDispenserTarget(Practitioner value) { 1506 this.dispenserTarget = value; 1507 return this; 1508 } 1509 1510 /** 1511 * @return {@link #authorizingPrescription} (Indicates the medication order that is being dispensed against.) 1512 */ 1513 public List<Reference> getAuthorizingPrescription() { 1514 if (this.authorizingPrescription == null) 1515 this.authorizingPrescription = new ArrayList<Reference>(); 1516 return this.authorizingPrescription; 1517 } 1518 1519 public boolean hasAuthorizingPrescription() { 1520 if (this.authorizingPrescription == null) 1521 return false; 1522 for (Reference item : this.authorizingPrescription) 1523 if (!item.isEmpty()) 1524 return true; 1525 return false; 1526 } 1527 1528 /** 1529 * @return {@link #authorizingPrescription} (Indicates the medication order that is being dispensed against.) 1530 */ 1531 // syntactic sugar 1532 public Reference addAuthorizingPrescription() { //3 1533 Reference t = new Reference(); 1534 if (this.authorizingPrescription == null) 1535 this.authorizingPrescription = new ArrayList<Reference>(); 1536 this.authorizingPrescription.add(t); 1537 return t; 1538 } 1539 1540 // syntactic sugar 1541 public MedicationDispense addAuthorizingPrescription(Reference t) { //3 1542 if (t == null) 1543 return this; 1544 if (this.authorizingPrescription == null) 1545 this.authorizingPrescription = new ArrayList<Reference>(); 1546 this.authorizingPrescription.add(t); 1547 return this; 1548 } 1549 1550 /** 1551 * @return {@link #authorizingPrescription} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Indicates the medication order that is being dispensed against.) 1552 */ 1553 public List<MedicationOrder> getAuthorizingPrescriptionTarget() { 1554 if (this.authorizingPrescriptionTarget == null) 1555 this.authorizingPrescriptionTarget = new ArrayList<MedicationOrder>(); 1556 return this.authorizingPrescriptionTarget; 1557 } 1558 1559 // syntactic sugar 1560 /** 1561 * @return {@link #authorizingPrescription} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Indicates the medication order that is being dispensed against.) 1562 */ 1563 public MedicationOrder addAuthorizingPrescriptionTarget() { 1564 MedicationOrder r = new MedicationOrder(); 1565 if (this.authorizingPrescriptionTarget == null) 1566 this.authorizingPrescriptionTarget = new ArrayList<MedicationOrder>(); 1567 this.authorizingPrescriptionTarget.add(r); 1568 return r; 1569 } 1570 1571 /** 1572 * @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.) 1573 */ 1574 public CodeableConcept getType() { 1575 if (this.type == null) 1576 if (Configuration.errorOnAutoCreate()) 1577 throw new Error("Attempt to auto-create MedicationDispense.type"); 1578 else if (Configuration.doAutoCreate()) 1579 this.type = new CodeableConcept(); // cc 1580 return this.type; 1581 } 1582 1583 public boolean hasType() { 1584 return this.type != null && !this.type.isEmpty(); 1585 } 1586 1587 /** 1588 * @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.) 1589 */ 1590 public MedicationDispense setType(CodeableConcept value) { 1591 this.type = value; 1592 return this; 1593 } 1594 1595 /** 1596 * @return {@link #quantity} (The amount of medication that has been dispensed. Includes unit of measure.) 1597 */ 1598 public SimpleQuantity getQuantity() { 1599 if (this.quantity == null) 1600 if (Configuration.errorOnAutoCreate()) 1601 throw new Error("Attempt to auto-create MedicationDispense.quantity"); 1602 else if (Configuration.doAutoCreate()) 1603 this.quantity = new SimpleQuantity(); // cc 1604 return this.quantity; 1605 } 1606 1607 public boolean hasQuantity() { 1608 return this.quantity != null && !this.quantity.isEmpty(); 1609 } 1610 1611 /** 1612 * @param value {@link #quantity} (The amount of medication that has been dispensed. Includes unit of measure.) 1613 */ 1614 public MedicationDispense setQuantity(SimpleQuantity value) { 1615 this.quantity = value; 1616 return this; 1617 } 1618 1619 /** 1620 * @return {@link #daysSupply} (The amount of medication expressed as a timing amount.) 1621 */ 1622 public SimpleQuantity getDaysSupply() { 1623 if (this.daysSupply == null) 1624 if (Configuration.errorOnAutoCreate()) 1625 throw new Error("Attempt to auto-create MedicationDispense.daysSupply"); 1626 else if (Configuration.doAutoCreate()) 1627 this.daysSupply = new SimpleQuantity(); // cc 1628 return this.daysSupply; 1629 } 1630 1631 public boolean hasDaysSupply() { 1632 return this.daysSupply != null && !this.daysSupply.isEmpty(); 1633 } 1634 1635 /** 1636 * @param value {@link #daysSupply} (The amount of medication expressed as a timing amount.) 1637 */ 1638 public MedicationDispense setDaysSupply(SimpleQuantity value) { 1639 this.daysSupply = value; 1640 return this; 1641 } 1642 1643 /** 1644 * @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 1645 */ 1646 public DateTimeType getWhenPreparedElement() { 1647 if (this.whenPrepared == null) 1648 if (Configuration.errorOnAutoCreate()) 1649 throw new Error("Attempt to auto-create MedicationDispense.whenPrepared"); 1650 else if (Configuration.doAutoCreate()) 1651 this.whenPrepared = new DateTimeType(); // bb 1652 return this.whenPrepared; 1653 } 1654 1655 public boolean hasWhenPreparedElement() { 1656 return this.whenPrepared != null && !this.whenPrepared.isEmpty(); 1657 } 1658 1659 public boolean hasWhenPrepared() { 1660 return this.whenPrepared != null && !this.whenPrepared.isEmpty(); 1661 } 1662 1663 /** 1664 * @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 1665 */ 1666 public MedicationDispense setWhenPreparedElement(DateTimeType value) { 1667 this.whenPrepared = value; 1668 return this; 1669 } 1670 1671 /** 1672 * @return The time when the dispensed product was packaged and reviewed. 1673 */ 1674 public Date getWhenPrepared() { 1675 return this.whenPrepared == null ? null : this.whenPrepared.getValue(); 1676 } 1677 1678 /** 1679 * @param value The time when the dispensed product was packaged and reviewed. 1680 */ 1681 public MedicationDispense setWhenPrepared(Date value) { 1682 if (value == null) 1683 this.whenPrepared = null; 1684 else { 1685 if (this.whenPrepared == null) 1686 this.whenPrepared = new DateTimeType(); 1687 this.whenPrepared.setValue(value); 1688 } 1689 return this; 1690 } 1691 1692 /** 1693 * @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 1694 */ 1695 public DateTimeType getWhenHandedOverElement() { 1696 if (this.whenHandedOver == null) 1697 if (Configuration.errorOnAutoCreate()) 1698 throw new Error("Attempt to auto-create MedicationDispense.whenHandedOver"); 1699 else if (Configuration.doAutoCreate()) 1700 this.whenHandedOver = new DateTimeType(); // bb 1701 return this.whenHandedOver; 1702 } 1703 1704 public boolean hasWhenHandedOverElement() { 1705 return this.whenHandedOver != null && !this.whenHandedOver.isEmpty(); 1706 } 1707 1708 public boolean hasWhenHandedOver() { 1709 return this.whenHandedOver != null && !this.whenHandedOver.isEmpty(); 1710 } 1711 1712 /** 1713 * @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 1714 */ 1715 public MedicationDispense setWhenHandedOverElement(DateTimeType value) { 1716 this.whenHandedOver = value; 1717 return this; 1718 } 1719 1720 /** 1721 * @return The time the dispensed product was provided to the patient or their representative. 1722 */ 1723 public Date getWhenHandedOver() { 1724 return this.whenHandedOver == null ? null : this.whenHandedOver.getValue(); 1725 } 1726 1727 /** 1728 * @param value The time the dispensed product was provided to the patient or their representative. 1729 */ 1730 public MedicationDispense setWhenHandedOver(Date value) { 1731 if (value == null) 1732 this.whenHandedOver = null; 1733 else { 1734 if (this.whenHandedOver == null) 1735 this.whenHandedOver = new DateTimeType(); 1736 this.whenHandedOver.setValue(value); 1737 } 1738 return this; 1739 } 1740 1741 /** 1742 * @return {@link #destination} (Identification of the facility/location where the medication was shipped to, as part of the dispense event.) 1743 */ 1744 public Reference getDestination() { 1745 if (this.destination == null) 1746 if (Configuration.errorOnAutoCreate()) 1747 throw new Error("Attempt to auto-create MedicationDispense.destination"); 1748 else if (Configuration.doAutoCreate()) 1749 this.destination = new Reference(); // cc 1750 return this.destination; 1751 } 1752 1753 public boolean hasDestination() { 1754 return this.destination != null && !this.destination.isEmpty(); 1755 } 1756 1757 /** 1758 * @param value {@link #destination} (Identification of the facility/location where the medication was shipped to, as part of the dispense event.) 1759 */ 1760 public MedicationDispense setDestination(Reference value) { 1761 this.destination = value; 1762 return this; 1763 } 1764 1765 /** 1766 * @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.) 1767 */ 1768 public Location getDestinationTarget() { 1769 if (this.destinationTarget == null) 1770 if (Configuration.errorOnAutoCreate()) 1771 throw new Error("Attempt to auto-create MedicationDispense.destination"); 1772 else if (Configuration.doAutoCreate()) 1773 this.destinationTarget = new Location(); // aa 1774 return this.destinationTarget; 1775 } 1776 1777 /** 1778 * @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.) 1779 */ 1780 public MedicationDispense setDestinationTarget(Location value) { 1781 this.destinationTarget = value; 1782 return this; 1783 } 1784 1785 /** 1786 * @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.) 1787 */ 1788 public List<Reference> getReceiver() { 1789 if (this.receiver == null) 1790 this.receiver = new ArrayList<Reference>(); 1791 return this.receiver; 1792 } 1793 1794 public boolean hasReceiver() { 1795 if (this.receiver == null) 1796 return false; 1797 for (Reference item : this.receiver) 1798 if (!item.isEmpty()) 1799 return true; 1800 return false; 1801 } 1802 1803 /** 1804 * @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.) 1805 */ 1806 // syntactic sugar 1807 public Reference addReceiver() { //3 1808 Reference t = new Reference(); 1809 if (this.receiver == null) 1810 this.receiver = new ArrayList<Reference>(); 1811 this.receiver.add(t); 1812 return t; 1813 } 1814 1815 // syntactic sugar 1816 public MedicationDispense addReceiver(Reference t) { //3 1817 if (t == null) 1818 return this; 1819 if (this.receiver == null) 1820 this.receiver = new ArrayList<Reference>(); 1821 this.receiver.add(t); 1822 return this; 1823 } 1824 1825 /** 1826 * @return {@link #receiver} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. 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.) 1827 */ 1828 public List<Resource> getReceiverTarget() { 1829 if (this.receiverTarget == null) 1830 this.receiverTarget = new ArrayList<Resource>(); 1831 return this.receiverTarget; 1832 } 1833 1834 /** 1835 * @return {@link #note} (Extra information about the dispense that could not be conveyed in the other attributes.) 1836 */ 1837 public List<Annotation> getNote() { 1838 if (this.note == null) 1839 this.note = new ArrayList<Annotation>(); 1840 return this.note; 1841 } 1842 1843 public boolean hasNote() { 1844 if (this.note == null) 1845 return false; 1846 for (Annotation item : this.note) 1847 if (!item.isEmpty()) 1848 return true; 1849 return false; 1850 } 1851 1852 /** 1853 * @return {@link #note} (Extra information about the dispense that could not be conveyed in the other attributes.) 1854 */ 1855 // syntactic sugar 1856 public Annotation addNote() { //3 1857 Annotation t = new Annotation(); 1858 if (this.note == null) 1859 this.note = new ArrayList<Annotation>(); 1860 this.note.add(t); 1861 return t; 1862 } 1863 1864 // syntactic sugar 1865 public MedicationDispense addNote(Annotation t) { //3 1866 if (t == null) 1867 return this; 1868 if (this.note == null) 1869 this.note = new ArrayList<Annotation>(); 1870 this.note.add(t); 1871 return this; 1872 } 1873 1874 /** 1875 * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient. The pharmacist reviews the medication order prior to dispense and updates the dosageInstruction based on the actual product being dispensed.) 1876 */ 1877 public List<MedicationDispenseDosageInstructionComponent> getDosageInstruction() { 1878 if (this.dosageInstruction == null) 1879 this.dosageInstruction = new ArrayList<MedicationDispenseDosageInstructionComponent>(); 1880 return this.dosageInstruction; 1881 } 1882 1883 public boolean hasDosageInstruction() { 1884 if (this.dosageInstruction == null) 1885 return false; 1886 for (MedicationDispenseDosageInstructionComponent item : this.dosageInstruction) 1887 if (!item.isEmpty()) 1888 return true; 1889 return false; 1890 } 1891 1892 /** 1893 * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient. The pharmacist reviews the medication order prior to dispense and updates the dosageInstruction based on the actual product being dispensed.) 1894 */ 1895 // syntactic sugar 1896 public MedicationDispenseDosageInstructionComponent addDosageInstruction() { //3 1897 MedicationDispenseDosageInstructionComponent t = new MedicationDispenseDosageInstructionComponent(); 1898 if (this.dosageInstruction == null) 1899 this.dosageInstruction = new ArrayList<MedicationDispenseDosageInstructionComponent>(); 1900 this.dosageInstruction.add(t); 1901 return t; 1902 } 1903 1904 // syntactic sugar 1905 public MedicationDispense addDosageInstruction(MedicationDispenseDosageInstructionComponent t) { //3 1906 if (t == null) 1907 return this; 1908 if (this.dosageInstruction == null) 1909 this.dosageInstruction = new ArrayList<MedicationDispenseDosageInstructionComponent>(); 1910 this.dosageInstruction.add(t); 1911 return this; 1912 } 1913 1914 /** 1915 * @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.) 1916 */ 1917 public MedicationDispenseSubstitutionComponent getSubstitution() { 1918 if (this.substitution == null) 1919 if (Configuration.errorOnAutoCreate()) 1920 throw new Error("Attempt to auto-create MedicationDispense.substitution"); 1921 else if (Configuration.doAutoCreate()) 1922 this.substitution = new MedicationDispenseSubstitutionComponent(); // cc 1923 return this.substitution; 1924 } 1925 1926 public boolean hasSubstitution() { 1927 return this.substitution != null && !this.substitution.isEmpty(); 1928 } 1929 1930 /** 1931 * @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.) 1932 */ 1933 public MedicationDispense setSubstitution(MedicationDispenseSubstitutionComponent value) { 1934 this.substitution = value; 1935 return this; 1936 } 1937 1938 protected void listChildren(List<Property> childrenList) { 1939 super.listChildren(childrenList); 1940 childrenList.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)); 1941 childrenList.add(new Property("status", "code", "A code specifying the state of the set of dispense events.", 0, java.lang.Integer.MAX_VALUE, status)); 1942 childrenList.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, java.lang.Integer.MAX_VALUE, medication)); 1943 childrenList.add(new Property("patient", "Reference(Patient)", "A link to a resource representing the person to whom the medication will be given.", 0, java.lang.Integer.MAX_VALUE, patient)); 1944 childrenList.add(new Property("dispenser", "Reference(Practitioner)", "The individual responsible for dispensing the medication.", 0, java.lang.Integer.MAX_VALUE, dispenser)); 1945 childrenList.add(new Property("authorizingPrescription", "Reference(MedicationOrder)", "Indicates the medication order that is being dispensed against.", 0, java.lang.Integer.MAX_VALUE, authorizingPrescription)); 1946 childrenList.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, java.lang.Integer.MAX_VALUE, type)); 1947 childrenList.add(new Property("quantity", "SimpleQuantity", "The amount of medication that has been dispensed. Includes unit of measure.", 0, java.lang.Integer.MAX_VALUE, quantity)); 1948 childrenList.add(new Property("daysSupply", "SimpleQuantity", "The amount of medication expressed as a timing amount.", 0, java.lang.Integer.MAX_VALUE, daysSupply)); 1949 childrenList.add(new Property("whenPrepared", "dateTime", "The time when the dispensed product was packaged and reviewed.", 0, java.lang.Integer.MAX_VALUE, whenPrepared)); 1950 childrenList.add(new Property("whenHandedOver", "dateTime", "The time the dispensed product was provided to the patient or their representative.", 0, java.lang.Integer.MAX_VALUE, whenHandedOver)); 1951 childrenList.add(new Property("destination", "Reference(Location)", "Identification of the facility/location where the medication was shipped to, as part of the dispense event.", 0, java.lang.Integer.MAX_VALUE, destination)); 1952 childrenList.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)); 1953 childrenList.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)); 1954 childrenList.add(new Property("dosageInstruction", "", "Indicates how the medication is to be used by the patient. The pharmacist reviews the medication order prior to dispense and updates the dosageInstruction based on the actual product being dispensed.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction)); 1955 childrenList.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.", 0, java.lang.Integer.MAX_VALUE, substitution)); 1956 } 1957 1958 @Override 1959 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1960 switch (hash) { 1961 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier 1962 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationDispenseStatus> 1963 case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type 1964 case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference 1965 case 241511093: /*dispenser*/ return this.dispenser == null ? new Base[0] : new Base[] {this.dispenser}; // Reference 1966 case -1237557856: /*authorizingPrescription*/ return this.authorizingPrescription == null ? new Base[0] : this.authorizingPrescription.toArray(new Base[this.authorizingPrescription.size()]); // Reference 1967 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1968 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 1969 case 197175334: /*daysSupply*/ return this.daysSupply == null ? new Base[0] : new Base[] {this.daysSupply}; // SimpleQuantity 1970 case -562837097: /*whenPrepared*/ return this.whenPrepared == null ? new Base[0] : new Base[] {this.whenPrepared}; // DateTimeType 1971 case -940241380: /*whenHandedOver*/ return this.whenHandedOver == null ? new Base[0] : new Base[] {this.whenHandedOver}; // DateTimeType 1972 case -1429847026: /*destination*/ return this.destination == null ? new Base[0] : new Base[] {this.destination}; // Reference 1973 case -808719889: /*receiver*/ return this.receiver == null ? new Base[0] : this.receiver.toArray(new Base[this.receiver.size()]); // Reference 1974 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 1975 case -1201373865: /*dosageInstruction*/ return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // MedicationDispenseDosageInstructionComponent 1976 case 826147581: /*substitution*/ return this.substitution == null ? new Base[0] : new Base[] {this.substitution}; // MedicationDispenseSubstitutionComponent 1977 default: return super.getProperty(hash, name, checkValid); 1978 } 1979 1980 } 1981 1982 @Override 1983 public void setProperty(int hash, String name, Base value) throws FHIRException { 1984 switch (hash) { 1985 case -1618432855: // identifier 1986 this.identifier = castToIdentifier(value); // Identifier 1987 break; 1988 case -892481550: // status 1989 this.status = new MedicationDispenseStatusEnumFactory().fromType(value); // Enumeration<MedicationDispenseStatus> 1990 break; 1991 case 1998965455: // medication 1992 this.medication = (Type) value; // Type 1993 break; 1994 case -791418107: // patient 1995 this.patient = castToReference(value); // Reference 1996 break; 1997 case 241511093: // dispenser 1998 this.dispenser = castToReference(value); // Reference 1999 break; 2000 case -1237557856: // authorizingPrescription 2001 this.getAuthorizingPrescription().add(castToReference(value)); // Reference 2002 break; 2003 case 3575610: // type 2004 this.type = castToCodeableConcept(value); // CodeableConcept 2005 break; 2006 case -1285004149: // quantity 2007 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 2008 break; 2009 case 197175334: // daysSupply 2010 this.daysSupply = castToSimpleQuantity(value); // SimpleQuantity 2011 break; 2012 case -562837097: // whenPrepared 2013 this.whenPrepared = castToDateTime(value); // DateTimeType 2014 break; 2015 case -940241380: // whenHandedOver 2016 this.whenHandedOver = castToDateTime(value); // DateTimeType 2017 break; 2018 case -1429847026: // destination 2019 this.destination = castToReference(value); // Reference 2020 break; 2021 case -808719889: // receiver 2022 this.getReceiver().add(castToReference(value)); // Reference 2023 break; 2024 case 3387378: // note 2025 this.getNote().add(castToAnnotation(value)); // Annotation 2026 break; 2027 case -1201373865: // dosageInstruction 2028 this.getDosageInstruction().add((MedicationDispenseDosageInstructionComponent) value); // MedicationDispenseDosageInstructionComponent 2029 break; 2030 case 826147581: // substitution 2031 this.substitution = (MedicationDispenseSubstitutionComponent) value; // MedicationDispenseSubstitutionComponent 2032 break; 2033 default: super.setProperty(hash, name, value); 2034 } 2035 2036 } 2037 2038 @Override 2039 public void setProperty(String name, Base value) throws FHIRException { 2040 if (name.equals("identifier")) 2041 this.identifier = castToIdentifier(value); // Identifier 2042 else if (name.equals("status")) 2043 this.status = new MedicationDispenseStatusEnumFactory().fromType(value); // Enumeration<MedicationDispenseStatus> 2044 else if (name.equals("medication[x]")) 2045 this.medication = (Type) value; // Type 2046 else if (name.equals("patient")) 2047 this.patient = castToReference(value); // Reference 2048 else if (name.equals("dispenser")) 2049 this.dispenser = castToReference(value); // Reference 2050 else if (name.equals("authorizingPrescription")) 2051 this.getAuthorizingPrescription().add(castToReference(value)); 2052 else if (name.equals("type")) 2053 this.type = castToCodeableConcept(value); // CodeableConcept 2054 else if (name.equals("quantity")) 2055 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 2056 else if (name.equals("daysSupply")) 2057 this.daysSupply = castToSimpleQuantity(value); // SimpleQuantity 2058 else if (name.equals("whenPrepared")) 2059 this.whenPrepared = castToDateTime(value); // DateTimeType 2060 else if (name.equals("whenHandedOver")) 2061 this.whenHandedOver = castToDateTime(value); // DateTimeType 2062 else if (name.equals("destination")) 2063 this.destination = castToReference(value); // Reference 2064 else if (name.equals("receiver")) 2065 this.getReceiver().add(castToReference(value)); 2066 else if (name.equals("note")) 2067 this.getNote().add(castToAnnotation(value)); 2068 else if (name.equals("dosageInstruction")) 2069 this.getDosageInstruction().add((MedicationDispenseDosageInstructionComponent) value); 2070 else if (name.equals("substitution")) 2071 this.substitution = (MedicationDispenseSubstitutionComponent) value; // MedicationDispenseSubstitutionComponent 2072 else 2073 super.setProperty(name, value); 2074 } 2075 2076 @Override 2077 public Base makeProperty(int hash, String name) throws FHIRException { 2078 switch (hash) { 2079 case -1618432855: return getIdentifier(); // Identifier 2080 case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<MedicationDispenseStatus> 2081 case 1458402129: return getMedication(); // Type 2082 case -791418107: return getPatient(); // Reference 2083 case 241511093: return getDispenser(); // Reference 2084 case -1237557856: return addAuthorizingPrescription(); // Reference 2085 case 3575610: return getType(); // CodeableConcept 2086 case -1285004149: return getQuantity(); // SimpleQuantity 2087 case 197175334: return getDaysSupply(); // SimpleQuantity 2088 case -562837097: throw new FHIRException("Cannot make property whenPrepared as it is not a complex type"); // DateTimeType 2089 case -940241380: throw new FHIRException("Cannot make property whenHandedOver as it is not a complex type"); // DateTimeType 2090 case -1429847026: return getDestination(); // Reference 2091 case -808719889: return addReceiver(); // Reference 2092 case 3387378: return addNote(); // Annotation 2093 case -1201373865: return addDosageInstruction(); // MedicationDispenseDosageInstructionComponent 2094 case 826147581: return getSubstitution(); // MedicationDispenseSubstitutionComponent 2095 default: return super.makeProperty(hash, name); 2096 } 2097 2098 } 2099 2100 @Override 2101 public Base addChild(String name) throws FHIRException { 2102 if (name.equals("identifier")) { 2103 this.identifier = new Identifier(); 2104 return this.identifier; 2105 } 2106 else if (name.equals("status")) { 2107 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.status"); 2108 } 2109 else if (name.equals("medicationCodeableConcept")) { 2110 this.medication = new CodeableConcept(); 2111 return this.medication; 2112 } 2113 else if (name.equals("medicationReference")) { 2114 this.medication = new Reference(); 2115 return this.medication; 2116 } 2117 else if (name.equals("patient")) { 2118 this.patient = new Reference(); 2119 return this.patient; 2120 } 2121 else if (name.equals("dispenser")) { 2122 this.dispenser = new Reference(); 2123 return this.dispenser; 2124 } 2125 else if (name.equals("authorizingPrescription")) { 2126 return addAuthorizingPrescription(); 2127 } 2128 else if (name.equals("type")) { 2129 this.type = new CodeableConcept(); 2130 return this.type; 2131 } 2132 else if (name.equals("quantity")) { 2133 this.quantity = new SimpleQuantity(); 2134 return this.quantity; 2135 } 2136 else if (name.equals("daysSupply")) { 2137 this.daysSupply = new SimpleQuantity(); 2138 return this.daysSupply; 2139 } 2140 else if (name.equals("whenPrepared")) { 2141 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.whenPrepared"); 2142 } 2143 else if (name.equals("whenHandedOver")) { 2144 throw new FHIRException("Cannot call addChild on a primitive type MedicationDispense.whenHandedOver"); 2145 } 2146 else if (name.equals("destination")) { 2147 this.destination = new Reference(); 2148 return this.destination; 2149 } 2150 else if (name.equals("receiver")) { 2151 return addReceiver(); 2152 } 2153 else if (name.equals("note")) { 2154 return addNote(); 2155 } 2156 else if (name.equals("dosageInstruction")) { 2157 return addDosageInstruction(); 2158 } 2159 else if (name.equals("substitution")) { 2160 this.substitution = new MedicationDispenseSubstitutionComponent(); 2161 return this.substitution; 2162 } 2163 else 2164 return super.addChild(name); 2165 } 2166 2167 public String fhirType() { 2168 return "MedicationDispense"; 2169 2170 } 2171 2172 public MedicationDispense copy() { 2173 MedicationDispense dst = new MedicationDispense(); 2174 copyValues(dst); 2175 dst.identifier = identifier == null ? null : identifier.copy(); 2176 dst.status = status == null ? null : status.copy(); 2177 dst.medication = medication == null ? null : medication.copy(); 2178 dst.patient = patient == null ? null : patient.copy(); 2179 dst.dispenser = dispenser == null ? null : dispenser.copy(); 2180 if (authorizingPrescription != null) { 2181 dst.authorizingPrescription = new ArrayList<Reference>(); 2182 for (Reference i : authorizingPrescription) 2183 dst.authorizingPrescription.add(i.copy()); 2184 }; 2185 dst.type = type == null ? null : type.copy(); 2186 dst.quantity = quantity == null ? null : quantity.copy(); 2187 dst.daysSupply = daysSupply == null ? null : daysSupply.copy(); 2188 dst.whenPrepared = whenPrepared == null ? null : whenPrepared.copy(); 2189 dst.whenHandedOver = whenHandedOver == null ? null : whenHandedOver.copy(); 2190 dst.destination = destination == null ? null : destination.copy(); 2191 if (receiver != null) { 2192 dst.receiver = new ArrayList<Reference>(); 2193 for (Reference i : receiver) 2194 dst.receiver.add(i.copy()); 2195 }; 2196 if (note != null) { 2197 dst.note = new ArrayList<Annotation>(); 2198 for (Annotation i : note) 2199 dst.note.add(i.copy()); 2200 }; 2201 if (dosageInstruction != null) { 2202 dst.dosageInstruction = new ArrayList<MedicationDispenseDosageInstructionComponent>(); 2203 for (MedicationDispenseDosageInstructionComponent i : dosageInstruction) 2204 dst.dosageInstruction.add(i.copy()); 2205 }; 2206 dst.substitution = substitution == null ? null : substitution.copy(); 2207 return dst; 2208 } 2209 2210 protected MedicationDispense typedCopy() { 2211 return copy(); 2212 } 2213 2214 @Override 2215 public boolean equalsDeep(Base other) { 2216 if (!super.equalsDeep(other)) 2217 return false; 2218 if (!(other instanceof MedicationDispense)) 2219 return false; 2220 MedicationDispense o = (MedicationDispense) other; 2221 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(medication, o.medication, true) 2222 && compareDeep(patient, o.patient, true) && compareDeep(dispenser, o.dispenser, true) && compareDeep(authorizingPrescription, o.authorizingPrescription, true) 2223 && compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true) && compareDeep(daysSupply, o.daysSupply, true) 2224 && compareDeep(whenPrepared, o.whenPrepared, true) && compareDeep(whenHandedOver, o.whenHandedOver, true) 2225 && compareDeep(destination, o.destination, true) && compareDeep(receiver, o.receiver, true) && compareDeep(note, o.note, true) 2226 && compareDeep(dosageInstruction, o.dosageInstruction, true) && compareDeep(substitution, o.substitution, true) 2227 ; 2228 } 2229 2230 @Override 2231 public boolean equalsShallow(Base other) { 2232 if (!super.equalsShallow(other)) 2233 return false; 2234 if (!(other instanceof MedicationDispense)) 2235 return false; 2236 MedicationDispense o = (MedicationDispense) other; 2237 return compareValues(status, o.status, true) && compareValues(whenPrepared, o.whenPrepared, true) && compareValues(whenHandedOver, o.whenHandedOver, true) 2238 ; 2239 } 2240 2241 public boolean isEmpty() { 2242 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 2243 && (medication == null || medication.isEmpty()) && (patient == null || patient.isEmpty()) 2244 && (dispenser == null || dispenser.isEmpty()) && (authorizingPrescription == null || authorizingPrescription.isEmpty()) 2245 && (type == null || type.isEmpty()) && (quantity == null || quantity.isEmpty()) && (daysSupply == null || daysSupply.isEmpty()) 2246 && (whenPrepared == null || whenPrepared.isEmpty()) && (whenHandedOver == null || whenHandedOver.isEmpty()) 2247 && (destination == null || destination.isEmpty()) && (receiver == null || receiver.isEmpty()) 2248 && (note == null || note.isEmpty()) && (dosageInstruction == null || dosageInstruction.isEmpty()) 2249 && (substitution == null || substitution.isEmpty()); 2250 } 2251 2252 @Override 2253 public ResourceType getResourceType() { 2254 return ResourceType.MedicationDispense; 2255 } 2256 2257 /** 2258 * Search parameter: <b>medication</b> 2259 * <p> 2260 * Description: <b>Return dispenses of this medicine resource</b><br> 2261 * Type: <b>reference</b><br> 2262 * Path: <b>MedicationDispense.medicationReference</b><br> 2263 * </p> 2264 */ 2265 @SearchParamDefinition(name="medication", path="MedicationDispense.medication.as(Reference)", description="Return dispenses of this medicine resource", type="reference" ) 2266 public static final String SP_MEDICATION = "medication"; 2267 /** 2268 * <b>Fluent Client</b> search parameter constant for <b>medication</b> 2269 * <p> 2270 * Description: <b>Return dispenses of this medicine resource</b><br> 2271 * Type: <b>reference</b><br> 2272 * Path: <b>MedicationDispense.medicationReference</b><br> 2273 * </p> 2274 */ 2275 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION); 2276 2277/** 2278 * Constant for fluent queries to be used to add include statements. Specifies 2279 * the path value of "<b>MedicationDispense:medication</b>". 2280 */ 2281 public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationDispense:medication").toLocked(); 2282 2283 /** 2284 * Search parameter: <b>patient</b> 2285 * <p> 2286 * Description: <b>The identity of a patient to list dispenses for</b><br> 2287 * Type: <b>reference</b><br> 2288 * Path: <b>MedicationDispense.patient</b><br> 2289 * </p> 2290 */ 2291 @SearchParamDefinition(name="patient", path="MedicationDispense.patient", description="The identity of a patient to list dispenses for", type="reference" ) 2292 public static final String SP_PATIENT = "patient"; 2293 /** 2294 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 2295 * <p> 2296 * Description: <b>The identity of a patient to list dispenses for</b><br> 2297 * Type: <b>reference</b><br> 2298 * Path: <b>MedicationDispense.patient</b><br> 2299 * </p> 2300 */ 2301 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 2302 2303/** 2304 * Constant for fluent queries to be used to add include statements. Specifies 2305 * the path value of "<b>MedicationDispense:patient</b>". 2306 */ 2307 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationDispense:patient").toLocked(); 2308 2309 /** 2310 * Search parameter: <b>receiver</b> 2311 * <p> 2312 * Description: <b>Who collected the medication</b><br> 2313 * Type: <b>reference</b><br> 2314 * Path: <b>MedicationDispense.receiver</b><br> 2315 * </p> 2316 */ 2317 @SearchParamDefinition(name="receiver", path="MedicationDispense.receiver", description="Who collected the medication", type="reference" ) 2318 public static final String SP_RECEIVER = "receiver"; 2319 /** 2320 * <b>Fluent Client</b> search parameter constant for <b>receiver</b> 2321 * <p> 2322 * Description: <b>Who collected the medication</b><br> 2323 * Type: <b>reference</b><br> 2324 * Path: <b>MedicationDispense.receiver</b><br> 2325 * </p> 2326 */ 2327 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECEIVER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECEIVER); 2328 2329/** 2330 * Constant for fluent queries to be used to add include statements. Specifies 2331 * the path value of "<b>MedicationDispense:receiver</b>". 2332 */ 2333 public static final ca.uhn.fhir.model.api.Include INCLUDE_RECEIVER = new ca.uhn.fhir.model.api.Include("MedicationDispense:receiver").toLocked(); 2334 2335 /** 2336 * Search parameter: <b>status</b> 2337 * <p> 2338 * Description: <b>Status of the dispense</b><br> 2339 * Type: <b>token</b><br> 2340 * Path: <b>MedicationDispense.status</b><br> 2341 * </p> 2342 */ 2343 @SearchParamDefinition(name="status", path="MedicationDispense.status", description="Status of the dispense", type="token" ) 2344 public static final String SP_STATUS = "status"; 2345 /** 2346 * <b>Fluent Client</b> search parameter constant for <b>status</b> 2347 * <p> 2348 * Description: <b>Status of the dispense</b><br> 2349 * Type: <b>token</b><br> 2350 * Path: <b>MedicationDispense.status</b><br> 2351 * </p> 2352 */ 2353 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 2354 2355 /** 2356 * Search parameter: <b>prescription</b> 2357 * <p> 2358 * Description: <b>The identity of a prescription to list dispenses from</b><br> 2359 * Type: <b>reference</b><br> 2360 * Path: <b>MedicationDispense.authorizingPrescription</b><br> 2361 * </p> 2362 */ 2363 @SearchParamDefinition(name="prescription", path="MedicationDispense.authorizingPrescription", description="The identity of a prescription to list dispenses from", type="reference" ) 2364 public static final String SP_PRESCRIPTION = "prescription"; 2365 /** 2366 * <b>Fluent Client</b> search parameter constant for <b>prescription</b> 2367 * <p> 2368 * Description: <b>The identity of a prescription to list dispenses from</b><br> 2369 * Type: <b>reference</b><br> 2370 * Path: <b>MedicationDispense.authorizingPrescription</b><br> 2371 * </p> 2372 */ 2373 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRESCRIPTION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRESCRIPTION); 2374 2375/** 2376 * Constant for fluent queries to be used to add include statements. Specifies 2377 * the path value of "<b>MedicationDispense:prescription</b>". 2378 */ 2379 public static final ca.uhn.fhir.model.api.Include INCLUDE_PRESCRIPTION = new ca.uhn.fhir.model.api.Include("MedicationDispense:prescription").toLocked(); 2380 2381 /** 2382 * Search parameter: <b>responsibleparty</b> 2383 * <p> 2384 * Description: <b>Return all dispenses with the specified responsible party</b><br> 2385 * Type: <b>reference</b><br> 2386 * Path: <b>MedicationDispense.substitution.responsibleParty</b><br> 2387 * </p> 2388 */ 2389 @SearchParamDefinition(name="responsibleparty", path="MedicationDispense.substitution.responsibleParty", description="Return all dispenses with the specified responsible party", type="reference" ) 2390 public static final String SP_RESPONSIBLEPARTY = "responsibleparty"; 2391 /** 2392 * <b>Fluent Client</b> search parameter constant for <b>responsibleparty</b> 2393 * <p> 2394 * Description: <b>Return all dispenses with the specified responsible party</b><br> 2395 * Type: <b>reference</b><br> 2396 * Path: <b>MedicationDispense.substitution.responsibleParty</b><br> 2397 * </p> 2398 */ 2399 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESPONSIBLEPARTY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESPONSIBLEPARTY); 2400 2401/** 2402 * Constant for fluent queries to be used to add include statements. Specifies 2403 * the path value of "<b>MedicationDispense:responsibleparty</b>". 2404 */ 2405 public static final ca.uhn.fhir.model.api.Include INCLUDE_RESPONSIBLEPARTY = new ca.uhn.fhir.model.api.Include("MedicationDispense:responsibleparty").toLocked(); 2406 2407 /** 2408 * Search parameter: <b>dispenser</b> 2409 * <p> 2410 * Description: <b>Return all dispenses performed by a specific individual</b><br> 2411 * Type: <b>reference</b><br> 2412 * Path: <b>MedicationDispense.dispenser</b><br> 2413 * </p> 2414 */ 2415 @SearchParamDefinition(name="dispenser", path="MedicationDispense.dispenser", description="Return all dispenses performed by a specific individual", type="reference" ) 2416 public static final String SP_DISPENSER = "dispenser"; 2417 /** 2418 * <b>Fluent Client</b> search parameter constant for <b>dispenser</b> 2419 * <p> 2420 * Description: <b>Return all dispenses performed by a specific individual</b><br> 2421 * Type: <b>reference</b><br> 2422 * Path: <b>MedicationDispense.dispenser</b><br> 2423 * </p> 2424 */ 2425 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DISPENSER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DISPENSER); 2426 2427/** 2428 * Constant for fluent queries to be used to add include statements. Specifies 2429 * the path value of "<b>MedicationDispense:dispenser</b>". 2430 */ 2431 public static final ca.uhn.fhir.model.api.Include INCLUDE_DISPENSER = new ca.uhn.fhir.model.api.Include("MedicationDispense:dispenser").toLocked(); 2432 2433 /** 2434 * Search parameter: <b>code</b> 2435 * <p> 2436 * Description: <b>Return dispenses of this medicine code</b><br> 2437 * Type: <b>token</b><br> 2438 * Path: <b>MedicationDispense.medicationCodeableConcept</b><br> 2439 * </p> 2440 */ 2441 @SearchParamDefinition(name="code", path="MedicationDispense.medication.as(CodeableConcept)", description="Return dispenses of this medicine code", type="token" ) 2442 public static final String SP_CODE = "code"; 2443 /** 2444 * <b>Fluent Client</b> search parameter constant for <b>code</b> 2445 * <p> 2446 * Description: <b>Return dispenses of this medicine code</b><br> 2447 * Type: <b>token</b><br> 2448 * Path: <b>MedicationDispense.medicationCodeableConcept</b><br> 2449 * </p> 2450 */ 2451 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 2452 2453 /** 2454 * Search parameter: <b>type</b> 2455 * <p> 2456 * Description: <b>Return all dispenses of a specific type</b><br> 2457 * Type: <b>token</b><br> 2458 * Path: <b>MedicationDispense.type</b><br> 2459 * </p> 2460 */ 2461 @SearchParamDefinition(name="type", path="MedicationDispense.type", description="Return all dispenses of a specific type", type="token" ) 2462 public static final String SP_TYPE = "type"; 2463 /** 2464 * <b>Fluent Client</b> search parameter constant for <b>type</b> 2465 * <p> 2466 * Description: <b>Return all dispenses of a specific type</b><br> 2467 * Type: <b>token</b><br> 2468 * Path: <b>MedicationDispense.type</b><br> 2469 * </p> 2470 */ 2471 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE); 2472 2473 /** 2474 * Search parameter: <b>identifier</b> 2475 * <p> 2476 * Description: <b>Return dispenses with this external identifier</b><br> 2477 * Type: <b>token</b><br> 2478 * Path: <b>MedicationDispense.identifier</b><br> 2479 * </p> 2480 */ 2481 @SearchParamDefinition(name="identifier", path="MedicationDispense.identifier", description="Return dispenses with this external identifier", type="token" ) 2482 public static final String SP_IDENTIFIER = "identifier"; 2483 /** 2484 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 2485 * <p> 2486 * Description: <b>Return dispenses with this external identifier</b><br> 2487 * Type: <b>token</b><br> 2488 * Path: <b>MedicationDispense.identifier</b><br> 2489 * </p> 2490 */ 2491 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 2492 2493 /** 2494 * Search parameter: <b>whenprepared</b> 2495 * <p> 2496 * Description: <b>Date when medication prepared</b><br> 2497 * Type: <b>date</b><br> 2498 * Path: <b>MedicationDispense.whenPrepared</b><br> 2499 * </p> 2500 */ 2501 @SearchParamDefinition(name="whenprepared", path="MedicationDispense.whenPrepared", description="Date when medication prepared", type="date" ) 2502 public static final String SP_WHENPREPARED = "whenprepared"; 2503 /** 2504 * <b>Fluent Client</b> search parameter constant for <b>whenprepared</b> 2505 * <p> 2506 * Description: <b>Date when medication prepared</b><br> 2507 * Type: <b>date</b><br> 2508 * Path: <b>MedicationDispense.whenPrepared</b><br> 2509 * </p> 2510 */ 2511 public static final ca.uhn.fhir.rest.gclient.DateClientParam WHENPREPARED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHENPREPARED); 2512 2513 /** 2514 * Search parameter: <b>whenhandedover</b> 2515 * <p> 2516 * Description: <b>Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting)</b><br> 2517 * Type: <b>date</b><br> 2518 * Path: <b>MedicationDispense.whenHandedOver</b><br> 2519 * </p> 2520 */ 2521 @SearchParamDefinition(name="whenhandedover", path="MedicationDispense.whenHandedOver", description="Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting)", type="date" ) 2522 public static final String SP_WHENHANDEDOVER = "whenhandedover"; 2523 /** 2524 * <b>Fluent Client</b> search parameter constant for <b>whenhandedover</b> 2525 * <p> 2526 * Description: <b>Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting)</b><br> 2527 * Type: <b>date</b><br> 2528 * Path: <b>MedicationDispense.whenHandedOver</b><br> 2529 * </p> 2530 */ 2531 public static final ca.uhn.fhir.rest.gclient.DateClientParam WHENHANDEDOVER = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHENHANDEDOVER); 2532 2533 /** 2534 * Search parameter: <b>destination</b> 2535 * <p> 2536 * Description: <b>Return dispenses that should be sent to a specific destination</b><br> 2537 * Type: <b>reference</b><br> 2538 * Path: <b>MedicationDispense.destination</b><br> 2539 * </p> 2540 */ 2541 @SearchParamDefinition(name="destination", path="MedicationDispense.destination", description="Return dispenses that should be sent to a specific destination", type="reference" ) 2542 public static final String SP_DESTINATION = "destination"; 2543 /** 2544 * <b>Fluent Client</b> search parameter constant for <b>destination</b> 2545 * <p> 2546 * Description: <b>Return dispenses that should be sent to a specific destination</b><br> 2547 * Type: <b>reference</b><br> 2548 * Path: <b>MedicationDispense.destination</b><br> 2549 * </p> 2550 */ 2551 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DESTINATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DESTINATION); 2552 2553/** 2554 * Constant for fluent queries to be used to add include statements. Specifies 2555 * the path value of "<b>MedicationDispense:destination</b>". 2556 */ 2557 public static final ca.uhn.fhir.model.api.Include INCLUDE_DESTINATION = new ca.uhn.fhir.model.api.Include("MedicationDispense:destination").toLocked(); 2558 2559 2560} 2561