001package org.hl7.fhir.dstu2016may.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 042import org.hl7.fhir.utilities.Utilities; 043 044import ca.uhn.fhir.model.api.annotation.Block; 045import ca.uhn.fhir.model.api.annotation.Child; 046import ca.uhn.fhir.model.api.annotation.Description; 047import ca.uhn.fhir.model.api.annotation.ResourceDef; 048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 049/** 050 * An order for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called "MedicationOrder" rather than "MedicationPrescription" to generalize the use across inpatient and outpatient settings as well as for care plans, etc. 051 */ 052@ResourceDef(name="MedicationOrder", profile="http://hl7.org/fhir/Profile/MedicationOrder") 053public class MedicationOrder extends DomainResource { 054 055 public enum MedicationOrderStatus { 056 /** 057 * The prescription is 'actionable', but not all actions that are implied by it have occurred yet. 058 */ 059 ACTIVE, 060 /** 061 * Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called "suspended". 062 */ 063 ONHOLD, 064 /** 065 * All actions that are implied by the prescription have occurred. 066 */ 067 COMPLETED, 068 /** 069 * The prescription was entered in error. 070 */ 071 ENTEREDINERROR, 072 /** 073 * Actions implied by the prescription are to be permanently halted, before all of them occurred. 074 */ 075 STOPPED, 076 /** 077 * The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and needs to be run through decision support process. 078 */ 079 DRAFT, 080 /** 081 * added to help the parsers 082 */ 083 NULL; 084 public static MedicationOrderStatus fromCode(String codeString) throws FHIRException { 085 if (codeString == null || "".equals(codeString)) 086 return null; 087 if ("active".equals(codeString)) 088 return ACTIVE; 089 if ("on-hold".equals(codeString)) 090 return ONHOLD; 091 if ("completed".equals(codeString)) 092 return COMPLETED; 093 if ("entered-in-error".equals(codeString)) 094 return ENTEREDINERROR; 095 if ("stopped".equals(codeString)) 096 return STOPPED; 097 if ("draft".equals(codeString)) 098 return DRAFT; 099 throw new FHIRException("Unknown MedicationOrderStatus code '"+codeString+"'"); 100 } 101 public String toCode() { 102 switch (this) { 103 case ACTIVE: return "active"; 104 case ONHOLD: return "on-hold"; 105 case COMPLETED: return "completed"; 106 case ENTEREDINERROR: return "entered-in-error"; 107 case STOPPED: return "stopped"; 108 case DRAFT: return "draft"; 109 case NULL: return null; 110 default: return "?"; 111 } 112 } 113 public String getSystem() { 114 switch (this) { 115 case ACTIVE: return "http://hl7.org/fhir/medication-order-status"; 116 case ONHOLD: return "http://hl7.org/fhir/medication-order-status"; 117 case COMPLETED: return "http://hl7.org/fhir/medication-order-status"; 118 case ENTEREDINERROR: return "http://hl7.org/fhir/medication-order-status"; 119 case STOPPED: return "http://hl7.org/fhir/medication-order-status"; 120 case DRAFT: return "http://hl7.org/fhir/medication-order-status"; 121 case NULL: return null; 122 default: return "?"; 123 } 124 } 125 public String getDefinition() { 126 switch (this) { 127 case ACTIVE: return "The prescription is 'actionable', but not all actions that are implied by it have occurred yet."; 128 case ONHOLD: return "Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called \"suspended\"."; 129 case COMPLETED: return "All actions that are implied by the prescription have occurred."; 130 case ENTEREDINERROR: return "The prescription was entered in error."; 131 case STOPPED: return "Actions implied by the prescription are to be permanently halted, before all of them occurred."; 132 case DRAFT: return "The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and needs to be run through decision support process."; 133 case NULL: return null; 134 default: return "?"; 135 } 136 } 137 public String getDisplay() { 138 switch (this) { 139 case ACTIVE: return "Active"; 140 case ONHOLD: return "On Hold"; 141 case COMPLETED: return "Completed"; 142 case ENTEREDINERROR: return "Entered In Error"; 143 case STOPPED: return "Stopped"; 144 case DRAFT: return "Draft"; 145 case NULL: return null; 146 default: return "?"; 147 } 148 } 149 } 150 151 public static class MedicationOrderStatusEnumFactory implements EnumFactory<MedicationOrderStatus> { 152 public MedicationOrderStatus fromCode(String codeString) throws IllegalArgumentException { 153 if (codeString == null || "".equals(codeString)) 154 if (codeString == null || "".equals(codeString)) 155 return null; 156 if ("active".equals(codeString)) 157 return MedicationOrderStatus.ACTIVE; 158 if ("on-hold".equals(codeString)) 159 return MedicationOrderStatus.ONHOLD; 160 if ("completed".equals(codeString)) 161 return MedicationOrderStatus.COMPLETED; 162 if ("entered-in-error".equals(codeString)) 163 return MedicationOrderStatus.ENTEREDINERROR; 164 if ("stopped".equals(codeString)) 165 return MedicationOrderStatus.STOPPED; 166 if ("draft".equals(codeString)) 167 return MedicationOrderStatus.DRAFT; 168 throw new IllegalArgumentException("Unknown MedicationOrderStatus code '"+codeString+"'"); 169 } 170 public Enumeration<MedicationOrderStatus> fromType(Base code) throws FHIRException { 171 if (code == null || code.isEmpty()) 172 return null; 173 String codeString = ((PrimitiveType) code).asStringValue(); 174 if (codeString == null || "".equals(codeString)) 175 return null; 176 if ("active".equals(codeString)) 177 return new Enumeration<MedicationOrderStatus>(this, MedicationOrderStatus.ACTIVE); 178 if ("on-hold".equals(codeString)) 179 return new Enumeration<MedicationOrderStatus>(this, MedicationOrderStatus.ONHOLD); 180 if ("completed".equals(codeString)) 181 return new Enumeration<MedicationOrderStatus>(this, MedicationOrderStatus.COMPLETED); 182 if ("entered-in-error".equals(codeString)) 183 return new Enumeration<MedicationOrderStatus>(this, MedicationOrderStatus.ENTEREDINERROR); 184 if ("stopped".equals(codeString)) 185 return new Enumeration<MedicationOrderStatus>(this, MedicationOrderStatus.STOPPED); 186 if ("draft".equals(codeString)) 187 return new Enumeration<MedicationOrderStatus>(this, MedicationOrderStatus.DRAFT); 188 throw new FHIRException("Unknown MedicationOrderStatus code '"+codeString+"'"); 189 } 190 public String toCode(MedicationOrderStatus code) { 191 if (code == MedicationOrderStatus.ACTIVE) 192 return "active"; 193 if (code == MedicationOrderStatus.ONHOLD) 194 return "on-hold"; 195 if (code == MedicationOrderStatus.COMPLETED) 196 return "completed"; 197 if (code == MedicationOrderStatus.ENTEREDINERROR) 198 return "entered-in-error"; 199 if (code == MedicationOrderStatus.STOPPED) 200 return "stopped"; 201 if (code == MedicationOrderStatus.DRAFT) 202 return "draft"; 203 return "?"; 204 } 205 public String toSystem(MedicationOrderStatus code) { 206 return code.getSystem(); 207 } 208 } 209 210 @Block() 211 public static class MedicationOrderDosageInstructionComponent extends BackboneElement implements IBaseBackboneElement { 212 /** 213 * Free text dosage instructions can be used for cases where the instructions are too complex to code. The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated. If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing. 214 */ 215 @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 216 @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. The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated. If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing." ) 217 protected StringType text; 218 219 /** 220 * Additional instructions such as "Swallow with plenty of water" which may or may not be coded. 221 */ 222 @Child(name = "additionalInstructions", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 223 @Description(shortDefinition="Supplemental instructions - e.g. \"with meals\"", formalDefinition="Additional instructions such as \"Swallow with plenty of water\" which may or may not be coded." ) 224 protected CodeableConcept additionalInstructions; 225 226 /** 227 * 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". 228 */ 229 @Child(name = "timing", type = {Timing.class}, order=3, min=0, max=1, modifier=false, summary=true) 230 @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\"." ) 231 protected Timing timing; 232 233 /** 234 * 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). 235 */ 236 @Child(name = "asNeeded", type = {BooleanType.class, CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 237 @Description(shortDefinition="Take \"as needed\" (for 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)." ) 238 protected Type asNeeded; 239 240 /** 241 * A coded specification of the anatomic site where the medication first enters the body. 242 */ 243 @Child(name = "site", type = {CodeableConcept.class, BodySite.class}, order=5, min=0, max=1, modifier=false, summary=true) 244 @Description(shortDefinition="Body site to administer to", formalDefinition="A coded specification of the anatomic site where the medication first enters the body." ) 245 protected Type site; 246 247 /** 248 * A code specifying the route or physiological path of administration of a therapeutic agent into or onto a patient's body. 249 */ 250 @Child(name = "route", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 251 @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 patient's body." ) 252 protected CodeableConcept route; 253 254 /** 255 * A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. For examples, Slow Push; Deep IV. 256 */ 257 @Child(name = "method", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true) 258 @Description(shortDefinition="Technique for administering medication", formalDefinition="A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. For examples, Slow Push; Deep IV." ) 259 protected CodeableConcept method; 260 261 /** 262 * The amount of therapeutic or other substance given at one administration event. 263 */ 264 @Child(name = "dose", type = {Range.class, SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=true) 265 @Description(shortDefinition="Amount of medication per dose", formalDefinition="The amount of therapeutic or other substance given at one administration event." ) 266 protected Type dose; 267 268 /** 269 * 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. 270 */ 271 @Child(name = "rate", type = {Ratio.class, Range.class, SimpleQuantity.class}, order=9, min=0, max=1, modifier=false, summary=true) 272 @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." ) 273 protected Type rate; 274 275 /** 276 * The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours. 277 */ 278 @Child(name = "maxDosePerPeriod", type = {Ratio.class}, order=10, min=0, max=1, modifier=false, summary=true) 279 @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. For example, 1000mg in 24 hours." ) 280 protected Ratio maxDosePerPeriod; 281 282 private static final long serialVersionUID = -1470136646L; 283 284 /** 285 * Constructor 286 */ 287 public MedicationOrderDosageInstructionComponent() { 288 super(); 289 } 290 291 /** 292 * @return {@link #text} (Free text dosage instructions can be used for cases where the instructions are too complex to code. The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated. If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 293 */ 294 public StringType getTextElement() { 295 if (this.text == null) 296 if (Configuration.errorOnAutoCreate()) 297 throw new Error("Attempt to auto-create MedicationOrderDosageInstructionComponent.text"); 298 else if (Configuration.doAutoCreate()) 299 this.text = new StringType(); // bb 300 return this.text; 301 } 302 303 public boolean hasTextElement() { 304 return this.text != null && !this.text.isEmpty(); 305 } 306 307 public boolean hasText() { 308 return this.text != null && !this.text.isEmpty(); 309 } 310 311 /** 312 * @param value {@link #text} (Free text dosage instructions can be used for cases where the instructions are too complex to code. The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated. If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 313 */ 314 public MedicationOrderDosageInstructionComponent setTextElement(StringType value) { 315 this.text = value; 316 return this; 317 } 318 319 /** 320 * @return Free text dosage instructions can be used for cases where the instructions are too complex to code. The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated. If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing. 321 */ 322 public String getText() { 323 return this.text == null ? null : this.text.getValue(); 324 } 325 326 /** 327 * @param value Free text dosage instructions can be used for cases where the instructions are too complex to code. The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated. If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing. 328 */ 329 public MedicationOrderDosageInstructionComponent setText(String value) { 330 if (Utilities.noString(value)) 331 this.text = null; 332 else { 333 if (this.text == null) 334 this.text = new StringType(); 335 this.text.setValue(value); 336 } 337 return this; 338 } 339 340 /** 341 * @return {@link #additionalInstructions} (Additional instructions such as "Swallow with plenty of water" which may or may not be coded.) 342 */ 343 public CodeableConcept getAdditionalInstructions() { 344 if (this.additionalInstructions == null) 345 if (Configuration.errorOnAutoCreate()) 346 throw new Error("Attempt to auto-create MedicationOrderDosageInstructionComponent.additionalInstructions"); 347 else if (Configuration.doAutoCreate()) 348 this.additionalInstructions = new CodeableConcept(); // cc 349 return this.additionalInstructions; 350 } 351 352 public boolean hasAdditionalInstructions() { 353 return this.additionalInstructions != null && !this.additionalInstructions.isEmpty(); 354 } 355 356 /** 357 * @param value {@link #additionalInstructions} (Additional instructions such as "Swallow with plenty of water" which may or may not be coded.) 358 */ 359 public MedicationOrderDosageInstructionComponent setAdditionalInstructions(CodeableConcept value) { 360 this.additionalInstructions = value; 361 return this; 362 } 363 364 /** 365 * @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".) 366 */ 367 public Timing getTiming() { 368 if (this.timing == null) 369 if (Configuration.errorOnAutoCreate()) 370 throw new Error("Attempt to auto-create MedicationOrderDosageInstructionComponent.timing"); 371 else if (Configuration.doAutoCreate()) 372 this.timing = new Timing(); // cc 373 return this.timing; 374 } 375 376 public boolean hasTiming() { 377 return this.timing != null && !this.timing.isEmpty(); 378 } 379 380 /** 381 * @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".) 382 */ 383 public MedicationOrderDosageInstructionComponent setTiming(Timing value) { 384 this.timing = value; 385 return this; 386 } 387 388 /** 389 * @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).) 390 */ 391 public Type getAsNeeded() { 392 return this.asNeeded; 393 } 394 395 /** 396 * @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).) 397 */ 398 public BooleanType getAsNeededBooleanType() throws FHIRException { 399 if (!(this.asNeeded instanceof BooleanType)) 400 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 401 return (BooleanType) this.asNeeded; 402 } 403 404 public boolean hasAsNeededBooleanType() { 405 return this.asNeeded instanceof BooleanType; 406 } 407 408 /** 409 * @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).) 410 */ 411 public CodeableConcept getAsNeededCodeableConcept() throws FHIRException { 412 if (!(this.asNeeded instanceof CodeableConcept)) 413 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 414 return (CodeableConcept) this.asNeeded; 415 } 416 417 public boolean hasAsNeededCodeableConcept() { 418 return this.asNeeded instanceof CodeableConcept; 419 } 420 421 public boolean hasAsNeeded() { 422 return this.asNeeded != null && !this.asNeeded.isEmpty(); 423 } 424 425 /** 426 * @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).) 427 */ 428 public MedicationOrderDosageInstructionComponent setAsNeeded(Type value) { 429 this.asNeeded = value; 430 return this; 431 } 432 433 /** 434 * @return {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 435 */ 436 public Type getSite() { 437 return this.site; 438 } 439 440 /** 441 * @return {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 442 */ 443 public CodeableConcept getSiteCodeableConcept() throws FHIRException { 444 if (!(this.site instanceof CodeableConcept)) 445 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.site.getClass().getName()+" was encountered"); 446 return (CodeableConcept) this.site; 447 } 448 449 public boolean hasSiteCodeableConcept() { 450 return this.site instanceof CodeableConcept; 451 } 452 453 /** 454 * @return {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 455 */ 456 public Reference getSiteReference() throws FHIRException { 457 if (!(this.site instanceof Reference)) 458 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.site.getClass().getName()+" was encountered"); 459 return (Reference) this.site; 460 } 461 462 public boolean hasSiteReference() { 463 return this.site instanceof Reference; 464 } 465 466 public boolean hasSite() { 467 return this.site != null && !this.site.isEmpty(); 468 } 469 470 /** 471 * @param value {@link #site} (A coded specification of the anatomic site where the medication first enters the body.) 472 */ 473 public MedicationOrderDosageInstructionComponent setSite(Type value) { 474 this.site = value; 475 return this; 476 } 477 478 /** 479 * @return {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto a patient's body.) 480 */ 481 public CodeableConcept getRoute() { 482 if (this.route == null) 483 if (Configuration.errorOnAutoCreate()) 484 throw new Error("Attempt to auto-create MedicationOrderDosageInstructionComponent.route"); 485 else if (Configuration.doAutoCreate()) 486 this.route = new CodeableConcept(); // cc 487 return this.route; 488 } 489 490 public boolean hasRoute() { 491 return this.route != null && !this.route.isEmpty(); 492 } 493 494 /** 495 * @param value {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto a patient's body.) 496 */ 497 public MedicationOrderDosageInstructionComponent setRoute(CodeableConcept value) { 498 this.route = value; 499 return this; 500 } 501 502 /** 503 * @return {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. For examples, Slow Push; Deep IV.) 504 */ 505 public CodeableConcept getMethod() { 506 if (this.method == null) 507 if (Configuration.errorOnAutoCreate()) 508 throw new Error("Attempt to auto-create MedicationOrderDosageInstructionComponent.method"); 509 else if (Configuration.doAutoCreate()) 510 this.method = new CodeableConcept(); // cc 511 return this.method; 512 } 513 514 public boolean hasMethod() { 515 return this.method != null && !this.method.isEmpty(); 516 } 517 518 /** 519 * @param value {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. For examples, Slow Push; Deep IV.) 520 */ 521 public MedicationOrderDosageInstructionComponent setMethod(CodeableConcept value) { 522 this.method = value; 523 return this; 524 } 525 526 /** 527 * @return {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 528 */ 529 public Type getDose() { 530 return this.dose; 531 } 532 533 /** 534 * @return {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 535 */ 536 public Range getDoseRange() throws FHIRException { 537 if (!(this.dose instanceof Range)) 538 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.dose.getClass().getName()+" was encountered"); 539 return (Range) this.dose; 540 } 541 542 public boolean hasDoseRange() { 543 return this.dose instanceof Range; 544 } 545 546 /** 547 * @return {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 548 */ 549 public SimpleQuantity getDoseSimpleQuantity() throws FHIRException { 550 if (!(this.dose instanceof SimpleQuantity)) 551 throw new FHIRException("Type mismatch: the type SimpleQuantity was expected, but "+this.dose.getClass().getName()+" was encountered"); 552 return (SimpleQuantity) this.dose; 553 } 554 555 public boolean hasDoseSimpleQuantity() { 556 return this.dose instanceof SimpleQuantity; 557 } 558 559 public boolean hasDose() { 560 return this.dose != null && !this.dose.isEmpty(); 561 } 562 563 /** 564 * @param value {@link #dose} (The amount of therapeutic or other substance given at one administration event.) 565 */ 566 public MedicationOrderDosageInstructionComponent setDose(Type value) { 567 this.dose = value; 568 return this; 569 } 570 571 /** 572 * @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.) 573 */ 574 public Type getRate() { 575 return this.rate; 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 Ratio getRateRatio() throws FHIRException { 582 if (!(this.rate instanceof Ratio)) 583 throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered"); 584 return (Ratio) this.rate; 585 } 586 587 public boolean hasRateRatio() { 588 return this.rate instanceof Ratio; 589 } 590 591 /** 592 * @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.) 593 */ 594 public Range getRateRange() throws FHIRException { 595 if (!(this.rate instanceof Range)) 596 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.rate.getClass().getName()+" was encountered"); 597 return (Range) this.rate; 598 } 599 600 public boolean hasRateRange() { 601 return this.rate instanceof Range; 602 } 603 604 /** 605 * @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.) 606 */ 607 public SimpleQuantity getRateSimpleQuantity() throws FHIRException { 608 if (!(this.rate instanceof SimpleQuantity)) 609 throw new FHIRException("Type mismatch: the type SimpleQuantity was expected, but "+this.rate.getClass().getName()+" was encountered"); 610 return (SimpleQuantity) this.rate; 611 } 612 613 public boolean hasRateSimpleQuantity() { 614 return this.rate instanceof SimpleQuantity; 615 } 616 617 public boolean hasRate() { 618 return this.rate != null && !this.rate.isEmpty(); 619 } 620 621 /** 622 * @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.) 623 */ 624 public MedicationOrderDosageInstructionComponent setRate(Type value) { 625 this.rate = value; 626 return this; 627 } 628 629 /** 630 * @return {@link #maxDosePerPeriod} (The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours.) 631 */ 632 public Ratio getMaxDosePerPeriod() { 633 if (this.maxDosePerPeriod == null) 634 if (Configuration.errorOnAutoCreate()) 635 throw new Error("Attempt to auto-create MedicationOrderDosageInstructionComponent.maxDosePerPeriod"); 636 else if (Configuration.doAutoCreate()) 637 this.maxDosePerPeriod = new Ratio(); // cc 638 return this.maxDosePerPeriod; 639 } 640 641 public boolean hasMaxDosePerPeriod() { 642 return this.maxDosePerPeriod != null && !this.maxDosePerPeriod.isEmpty(); 643 } 644 645 /** 646 * @param value {@link #maxDosePerPeriod} (The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours.) 647 */ 648 public MedicationOrderDosageInstructionComponent setMaxDosePerPeriod(Ratio value) { 649 this.maxDosePerPeriod = value; 650 return this; 651 } 652 653 protected void listChildren(List<Property> childrenList) { 654 super.listChildren(childrenList); 655 childrenList.add(new Property("text", "string", "Free text dosage instructions can be used for cases where the instructions are too complex to code. The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated. If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing.", 0, java.lang.Integer.MAX_VALUE, text)); 656 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)); 657 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)); 658 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).", 0, java.lang.Integer.MAX_VALUE, asNeeded)); 659 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)); 660 childrenList.add(new Property("route", "CodeableConcept", "A code specifying the route or physiological path of administration of a therapeutic agent into or onto a patient's body.", 0, java.lang.Integer.MAX_VALUE, route)); 661 childrenList.add(new Property("method", "CodeableConcept", "A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. For examples, Slow Push; Deep IV.", 0, java.lang.Integer.MAX_VALUE, method)); 662 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)); 663 childrenList.add(new Property("rate[x]", "Ratio|Range|SimpleQuantity", "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)); 664 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. For example, 1000mg in 24 hours.", 0, java.lang.Integer.MAX_VALUE, maxDosePerPeriod)); 665 } 666 667 @Override 668 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 669 switch (hash) { 670 case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType 671 case -1206718612: /*additionalInstructions*/ return this.additionalInstructions == null ? new Base[0] : new Base[] {this.additionalInstructions}; // CodeableConcept 672 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Timing 673 case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // Type 674 case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // Type 675 case 108704329: /*route*/ return this.route == null ? new Base[0] : new Base[] {this.route}; // CodeableConcept 676 case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept 677 case 3089437: /*dose*/ return this.dose == null ? new Base[0] : new Base[] {this.dose}; // Type 678 case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // Type 679 case 1506263709: /*maxDosePerPeriod*/ return this.maxDosePerPeriod == null ? new Base[0] : new Base[] {this.maxDosePerPeriod}; // Ratio 680 default: return super.getProperty(hash, name, checkValid); 681 } 682 683 } 684 685 @Override 686 public void setProperty(int hash, String name, Base value) throws FHIRException { 687 switch (hash) { 688 case 3556653: // text 689 this.text = castToString(value); // StringType 690 break; 691 case -1206718612: // additionalInstructions 692 this.additionalInstructions = castToCodeableConcept(value); // CodeableConcept 693 break; 694 case -873664438: // timing 695 this.timing = castToTiming(value); // Timing 696 break; 697 case -1432923513: // asNeeded 698 this.asNeeded = (Type) value; // Type 699 break; 700 case 3530567: // site 701 this.site = (Type) value; // Type 702 break; 703 case 108704329: // route 704 this.route = castToCodeableConcept(value); // CodeableConcept 705 break; 706 case -1077554975: // method 707 this.method = castToCodeableConcept(value); // CodeableConcept 708 break; 709 case 3089437: // dose 710 this.dose = (Type) value; // Type 711 break; 712 case 3493088: // rate 713 this.rate = (Type) value; // Type 714 break; 715 case 1506263709: // maxDosePerPeriod 716 this.maxDosePerPeriod = castToRatio(value); // Ratio 717 break; 718 default: super.setProperty(hash, name, value); 719 } 720 721 } 722 723 @Override 724 public void setProperty(String name, Base value) throws FHIRException { 725 if (name.equals("text")) 726 this.text = castToString(value); // StringType 727 else if (name.equals("additionalInstructions")) 728 this.additionalInstructions = castToCodeableConcept(value); // CodeableConcept 729 else if (name.equals("timing")) 730 this.timing = castToTiming(value); // Timing 731 else if (name.equals("asNeeded[x]")) 732 this.asNeeded = (Type) value; // Type 733 else if (name.equals("site[x]")) 734 this.site = (Type) value; // Type 735 else if (name.equals("route")) 736 this.route = castToCodeableConcept(value); // CodeableConcept 737 else if (name.equals("method")) 738 this.method = castToCodeableConcept(value); // CodeableConcept 739 else if (name.equals("dose[x]")) 740 this.dose = (Type) value; // Type 741 else if (name.equals("rate[x]")) 742 this.rate = (Type) value; // Type 743 else if (name.equals("maxDosePerPeriod")) 744 this.maxDosePerPeriod = castToRatio(value); // Ratio 745 else 746 super.setProperty(name, value); 747 } 748 749 @Override 750 public Base makeProperty(int hash, String name) throws FHIRException { 751 switch (hash) { 752 case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType 753 case -1206718612: return getAdditionalInstructions(); // CodeableConcept 754 case -873664438: return getTiming(); // Timing 755 case -544329575: return getAsNeeded(); // Type 756 case 2099997657: return getSite(); // Type 757 case 108704329: return getRoute(); // CodeableConcept 758 case -1077554975: return getMethod(); // CodeableConcept 759 case 1843195715: return getDose(); // Type 760 case 983460768: return getRate(); // Type 761 case 1506263709: return getMaxDosePerPeriod(); // Ratio 762 default: return super.makeProperty(hash, name); 763 } 764 765 } 766 767 @Override 768 public Base addChild(String name) throws FHIRException { 769 if (name.equals("text")) { 770 throw new FHIRException("Cannot call addChild on a primitive type MedicationOrder.text"); 771 } 772 else if (name.equals("additionalInstructions")) { 773 this.additionalInstructions = new CodeableConcept(); 774 return this.additionalInstructions; 775 } 776 else if (name.equals("timing")) { 777 this.timing = new Timing(); 778 return this.timing; 779 } 780 else if (name.equals("asNeededBoolean")) { 781 this.asNeeded = new BooleanType(); 782 return this.asNeeded; 783 } 784 else if (name.equals("asNeededCodeableConcept")) { 785 this.asNeeded = new CodeableConcept(); 786 return this.asNeeded; 787 } 788 else if (name.equals("siteCodeableConcept")) { 789 this.site = new CodeableConcept(); 790 return this.site; 791 } 792 else if (name.equals("siteReference")) { 793 this.site = new Reference(); 794 return this.site; 795 } 796 else if (name.equals("route")) { 797 this.route = new CodeableConcept(); 798 return this.route; 799 } 800 else if (name.equals("method")) { 801 this.method = new CodeableConcept(); 802 return this.method; 803 } 804 else if (name.equals("doseRange")) { 805 this.dose = new Range(); 806 return this.dose; 807 } 808 else if (name.equals("doseSimpleQuantity")) { 809 this.dose = new SimpleQuantity(); 810 return this.dose; 811 } 812 else if (name.equals("rateRatio")) { 813 this.rate = new Ratio(); 814 return this.rate; 815 } 816 else if (name.equals("rateRange")) { 817 this.rate = new Range(); 818 return this.rate; 819 } 820 else if (name.equals("rateSimpleQuantity")) { 821 this.rate = new SimpleQuantity(); 822 return this.rate; 823 } 824 else if (name.equals("maxDosePerPeriod")) { 825 this.maxDosePerPeriod = new Ratio(); 826 return this.maxDosePerPeriod; 827 } 828 else 829 return super.addChild(name); 830 } 831 832 public MedicationOrderDosageInstructionComponent copy() { 833 MedicationOrderDosageInstructionComponent dst = new MedicationOrderDosageInstructionComponent(); 834 copyValues(dst); 835 dst.text = text == null ? null : text.copy(); 836 dst.additionalInstructions = additionalInstructions == null ? null : additionalInstructions.copy(); 837 dst.timing = timing == null ? null : timing.copy(); 838 dst.asNeeded = asNeeded == null ? null : asNeeded.copy(); 839 dst.site = site == null ? null : site.copy(); 840 dst.route = route == null ? null : route.copy(); 841 dst.method = method == null ? null : method.copy(); 842 dst.dose = dose == null ? null : dose.copy(); 843 dst.rate = rate == null ? null : rate.copy(); 844 dst.maxDosePerPeriod = maxDosePerPeriod == null ? null : maxDosePerPeriod.copy(); 845 return dst; 846 } 847 848 @Override 849 public boolean equalsDeep(Base other) { 850 if (!super.equalsDeep(other)) 851 return false; 852 if (!(other instanceof MedicationOrderDosageInstructionComponent)) 853 return false; 854 MedicationOrderDosageInstructionComponent o = (MedicationOrderDosageInstructionComponent) other; 855 return compareDeep(text, o.text, true) && compareDeep(additionalInstructions, o.additionalInstructions, true) 856 && compareDeep(timing, o.timing, true) && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(site, o.site, true) 857 && compareDeep(route, o.route, true) && compareDeep(method, o.method, true) && compareDeep(dose, o.dose, true) 858 && compareDeep(rate, o.rate, true) && compareDeep(maxDosePerPeriod, o.maxDosePerPeriod, true); 859 } 860 861 @Override 862 public boolean equalsShallow(Base other) { 863 if (!super.equalsShallow(other)) 864 return false; 865 if (!(other instanceof MedicationOrderDosageInstructionComponent)) 866 return false; 867 MedicationOrderDosageInstructionComponent o = (MedicationOrderDosageInstructionComponent) other; 868 return compareValues(text, o.text, true); 869 } 870 871 public boolean isEmpty() { 872 return super.isEmpty() && (text == null || text.isEmpty()) && (additionalInstructions == null || additionalInstructions.isEmpty()) 873 && (timing == null || timing.isEmpty()) && (asNeeded == null || asNeeded.isEmpty()) && (site == null || site.isEmpty()) 874 && (route == null || route.isEmpty()) && (method == null || method.isEmpty()) && (dose == null || dose.isEmpty()) 875 && (rate == null || rate.isEmpty()) && (maxDosePerPeriod == null || maxDosePerPeriod.isEmpty()) 876 ; 877 } 878 879 public String fhirType() { 880 return "MedicationOrder.dosageInstruction"; 881 882 } 883 884 } 885 886 @Block() 887 public static class MedicationOrderDispenseRequestComponent extends BackboneElement implements IBaseBackboneElement { 888 /** 889 * Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications. 890 */ 891 @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=1, min=0, max=1, modifier=false, summary=true) 892 @Description(shortDefinition="Product to be supplied", formalDefinition="Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications." ) 893 protected Type medication; 894 895 /** 896 * This indicates the validity period of a prescription (stale dating the Prescription). 897 */ 898 @Child(name = "validityPeriod", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true) 899 @Description(shortDefinition="Time period supply is authorized for", formalDefinition="This indicates the validity period of a prescription (stale dating the Prescription)." ) 900 protected Period validityPeriod; 901 902 /** 903 * An integer indicating the number of additional times (aka refills or repeats) the patient can receive the prescribed medication. Usage Notes: This integer does NOT include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. 904 */ 905 @Child(name = "numberOfRepeatsAllowed", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true) 906 @Description(shortDefinition="Number of refills authorized", formalDefinition="An integer indicating the number of additional times (aka refills or repeats) the patient can receive the prescribed medication. Usage Notes: This integer does NOT include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets." ) 907 protected PositiveIntType numberOfRepeatsAllowed; 908 909 /** 910 * The amount that is to be dispensed for one fill. 911 */ 912 @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=true) 913 @Description(shortDefinition="Amount of medication to supply per dispense", formalDefinition="The amount that is to be dispensed for one fill." ) 914 protected SimpleQuantity quantity; 915 916 /** 917 * Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. 918 */ 919 @Child(name = "expectedSupplyDuration", type = {Duration.class}, order=5, min=0, max=1, modifier=false, summary=true) 920 @Description(shortDefinition="Number of days supply per dispense", formalDefinition="Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last." ) 921 protected Duration expectedSupplyDuration; 922 923 private static final long serialVersionUID = -1690502728L; 924 925 /** 926 * Constructor 927 */ 928 public MedicationOrderDispenseRequestComponent() { 929 super(); 930 } 931 932 /** 933 * @return {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 934 */ 935 public Type getMedication() { 936 return this.medication; 937 } 938 939 /** 940 * @return {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 941 */ 942 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 943 if (!(this.medication instanceof CodeableConcept)) 944 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); 945 return (CodeableConcept) this.medication; 946 } 947 948 public boolean hasMedicationCodeableConcept() { 949 return this.medication instanceof CodeableConcept; 950 } 951 952 /** 953 * @return {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 954 */ 955 public Reference getMedicationReference() throws FHIRException { 956 if (!(this.medication instanceof Reference)) 957 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); 958 return (Reference) this.medication; 959 } 960 961 public boolean hasMedicationReference() { 962 return this.medication instanceof Reference; 963 } 964 965 public boolean hasMedication() { 966 return this.medication != null && !this.medication.isEmpty(); 967 } 968 969 /** 970 * @param value {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 971 */ 972 public MedicationOrderDispenseRequestComponent setMedication(Type value) { 973 this.medication = value; 974 return this; 975 } 976 977 /** 978 * @return {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) 979 */ 980 public Period getValidityPeriod() { 981 if (this.validityPeriod == null) 982 if (Configuration.errorOnAutoCreate()) 983 throw new Error("Attempt to auto-create MedicationOrderDispenseRequestComponent.validityPeriod"); 984 else if (Configuration.doAutoCreate()) 985 this.validityPeriod = new Period(); // cc 986 return this.validityPeriod; 987 } 988 989 public boolean hasValidityPeriod() { 990 return this.validityPeriod != null && !this.validityPeriod.isEmpty(); 991 } 992 993 /** 994 * @param value {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) 995 */ 996 public MedicationOrderDispenseRequestComponent setValidityPeriod(Period value) { 997 this.validityPeriod = value; 998 return this; 999 } 1000 1001 /** 1002 * @return {@link #numberOfRepeatsAllowed} (An integer indicating the number of additional times (aka refills or repeats) the patient can receive the prescribed medication. Usage Notes: This integer does NOT include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value 1003 */ 1004 public PositiveIntType getNumberOfRepeatsAllowedElement() { 1005 if (this.numberOfRepeatsAllowed == null) 1006 if (Configuration.errorOnAutoCreate()) 1007 throw new Error("Attempt to auto-create MedicationOrderDispenseRequestComponent.numberOfRepeatsAllowed"); 1008 else if (Configuration.doAutoCreate()) 1009 this.numberOfRepeatsAllowed = new PositiveIntType(); // bb 1010 return this.numberOfRepeatsAllowed; 1011 } 1012 1013 public boolean hasNumberOfRepeatsAllowedElement() { 1014 return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); 1015 } 1016 1017 public boolean hasNumberOfRepeatsAllowed() { 1018 return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); 1019 } 1020 1021 /** 1022 * @param value {@link #numberOfRepeatsAllowed} (An integer indicating the number of additional times (aka refills or repeats) the patient can receive the prescribed medication. Usage Notes: This integer does NOT include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value 1023 */ 1024 public MedicationOrderDispenseRequestComponent setNumberOfRepeatsAllowedElement(PositiveIntType value) { 1025 this.numberOfRepeatsAllowed = value; 1026 return this; 1027 } 1028 1029 /** 1030 * @return An integer indicating the number of additional times (aka refills or repeats) the patient can receive the prescribed medication. Usage Notes: This integer does NOT include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. 1031 */ 1032 public int getNumberOfRepeatsAllowed() { 1033 return this.numberOfRepeatsAllowed == null || this.numberOfRepeatsAllowed.isEmpty() ? 0 : this.numberOfRepeatsAllowed.getValue(); 1034 } 1035 1036 /** 1037 * @param value An integer indicating the number of additional times (aka refills or repeats) the patient can receive the prescribed medication. Usage Notes: This integer does NOT include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. 1038 */ 1039 public MedicationOrderDispenseRequestComponent setNumberOfRepeatsAllowed(int value) { 1040 if (this.numberOfRepeatsAllowed == null) 1041 this.numberOfRepeatsAllowed = new PositiveIntType(); 1042 this.numberOfRepeatsAllowed.setValue(value); 1043 return this; 1044 } 1045 1046 /** 1047 * @return {@link #quantity} (The amount that is to be dispensed for one fill.) 1048 */ 1049 public SimpleQuantity getQuantity() { 1050 if (this.quantity == null) 1051 if (Configuration.errorOnAutoCreate()) 1052 throw new Error("Attempt to auto-create MedicationOrderDispenseRequestComponent.quantity"); 1053 else if (Configuration.doAutoCreate()) 1054 this.quantity = new SimpleQuantity(); // cc 1055 return this.quantity; 1056 } 1057 1058 public boolean hasQuantity() { 1059 return this.quantity != null && !this.quantity.isEmpty(); 1060 } 1061 1062 /** 1063 * @param value {@link #quantity} (The amount that is to be dispensed for one fill.) 1064 */ 1065 public MedicationOrderDispenseRequestComponent setQuantity(SimpleQuantity value) { 1066 this.quantity = value; 1067 return this; 1068 } 1069 1070 /** 1071 * @return {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) 1072 */ 1073 public Duration getExpectedSupplyDuration() { 1074 if (this.expectedSupplyDuration == null) 1075 if (Configuration.errorOnAutoCreate()) 1076 throw new Error("Attempt to auto-create MedicationOrderDispenseRequestComponent.expectedSupplyDuration"); 1077 else if (Configuration.doAutoCreate()) 1078 this.expectedSupplyDuration = new Duration(); // cc 1079 return this.expectedSupplyDuration; 1080 } 1081 1082 public boolean hasExpectedSupplyDuration() { 1083 return this.expectedSupplyDuration != null && !this.expectedSupplyDuration.isEmpty(); 1084 } 1085 1086 /** 1087 * @param value {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) 1088 */ 1089 public MedicationOrderDispenseRequestComponent setExpectedSupplyDuration(Duration value) { 1090 this.expectedSupplyDuration = value; 1091 return this; 1092 } 1093 1094 protected void listChildren(List<Property> childrenList) { 1095 super.listChildren(childrenList); 1096 childrenList.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, java.lang.Integer.MAX_VALUE, medication)); 1097 childrenList.add(new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, java.lang.Integer.MAX_VALUE, validityPeriod)); 1098 childrenList.add(new Property("numberOfRepeatsAllowed", "positiveInt", "An integer indicating the number of additional times (aka refills or repeats) the patient can receive the prescribed medication. Usage Notes: This integer does NOT include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.", 0, java.lang.Integer.MAX_VALUE, numberOfRepeatsAllowed)); 1099 childrenList.add(new Property("quantity", "SimpleQuantity", "The amount that is to be dispensed for one fill.", 0, java.lang.Integer.MAX_VALUE, quantity)); 1100 childrenList.add(new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, java.lang.Integer.MAX_VALUE, expectedSupplyDuration)); 1101 } 1102 1103 @Override 1104 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1105 switch (hash) { 1106 case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type 1107 case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period 1108 case -239736976: /*numberOfRepeatsAllowed*/ return this.numberOfRepeatsAllowed == null ? new Base[0] : new Base[] {this.numberOfRepeatsAllowed}; // PositiveIntType 1109 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 1110 case -1910182789: /*expectedSupplyDuration*/ return this.expectedSupplyDuration == null ? new Base[0] : new Base[] {this.expectedSupplyDuration}; // Duration 1111 default: return super.getProperty(hash, name, checkValid); 1112 } 1113 1114 } 1115 1116 @Override 1117 public void setProperty(int hash, String name, Base value) throws FHIRException { 1118 switch (hash) { 1119 case 1998965455: // medication 1120 this.medication = (Type) value; // Type 1121 break; 1122 case -1434195053: // validityPeriod 1123 this.validityPeriod = castToPeriod(value); // Period 1124 break; 1125 case -239736976: // numberOfRepeatsAllowed 1126 this.numberOfRepeatsAllowed = castToPositiveInt(value); // PositiveIntType 1127 break; 1128 case -1285004149: // quantity 1129 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 1130 break; 1131 case -1910182789: // expectedSupplyDuration 1132 this.expectedSupplyDuration = castToDuration(value); // Duration 1133 break; 1134 default: super.setProperty(hash, name, value); 1135 } 1136 1137 } 1138 1139 @Override 1140 public void setProperty(String name, Base value) throws FHIRException { 1141 if (name.equals("medication[x]")) 1142 this.medication = (Type) value; // Type 1143 else if (name.equals("validityPeriod")) 1144 this.validityPeriod = castToPeriod(value); // Period 1145 else if (name.equals("numberOfRepeatsAllowed")) 1146 this.numberOfRepeatsAllowed = castToPositiveInt(value); // PositiveIntType 1147 else if (name.equals("quantity")) 1148 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 1149 else if (name.equals("expectedSupplyDuration")) 1150 this.expectedSupplyDuration = castToDuration(value); // Duration 1151 else 1152 super.setProperty(name, value); 1153 } 1154 1155 @Override 1156 public Base makeProperty(int hash, String name) throws FHIRException { 1157 switch (hash) { 1158 case 1458402129: return getMedication(); // Type 1159 case -1434195053: return getValidityPeriod(); // Period 1160 case -239736976: throw new FHIRException("Cannot make property numberOfRepeatsAllowed as it is not a complex type"); // PositiveIntType 1161 case -1285004149: return getQuantity(); // SimpleQuantity 1162 case -1910182789: return getExpectedSupplyDuration(); // Duration 1163 default: return super.makeProperty(hash, name); 1164 } 1165 1166 } 1167 1168 @Override 1169 public Base addChild(String name) throws FHIRException { 1170 if (name.equals("medicationCodeableConcept")) { 1171 this.medication = new CodeableConcept(); 1172 return this.medication; 1173 } 1174 else if (name.equals("medicationReference")) { 1175 this.medication = new Reference(); 1176 return this.medication; 1177 } 1178 else if (name.equals("validityPeriod")) { 1179 this.validityPeriod = new Period(); 1180 return this.validityPeriod; 1181 } 1182 else if (name.equals("numberOfRepeatsAllowed")) { 1183 throw new FHIRException("Cannot call addChild on a primitive type MedicationOrder.numberOfRepeatsAllowed"); 1184 } 1185 else if (name.equals("quantity")) { 1186 this.quantity = new SimpleQuantity(); 1187 return this.quantity; 1188 } 1189 else if (name.equals("expectedSupplyDuration")) { 1190 this.expectedSupplyDuration = new Duration(); 1191 return this.expectedSupplyDuration; 1192 } 1193 else 1194 return super.addChild(name); 1195 } 1196 1197 public MedicationOrderDispenseRequestComponent copy() { 1198 MedicationOrderDispenseRequestComponent dst = new MedicationOrderDispenseRequestComponent(); 1199 copyValues(dst); 1200 dst.medication = medication == null ? null : medication.copy(); 1201 dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy(); 1202 dst.numberOfRepeatsAllowed = numberOfRepeatsAllowed == null ? null : numberOfRepeatsAllowed.copy(); 1203 dst.quantity = quantity == null ? null : quantity.copy(); 1204 dst.expectedSupplyDuration = expectedSupplyDuration == null ? null : expectedSupplyDuration.copy(); 1205 return dst; 1206 } 1207 1208 @Override 1209 public boolean equalsDeep(Base other) { 1210 if (!super.equalsDeep(other)) 1211 return false; 1212 if (!(other instanceof MedicationOrderDispenseRequestComponent)) 1213 return false; 1214 MedicationOrderDispenseRequestComponent o = (MedicationOrderDispenseRequestComponent) other; 1215 return compareDeep(medication, o.medication, true) && compareDeep(validityPeriod, o.validityPeriod, true) 1216 && compareDeep(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true) && compareDeep(quantity, o.quantity, true) 1217 && compareDeep(expectedSupplyDuration, o.expectedSupplyDuration, true); 1218 } 1219 1220 @Override 1221 public boolean equalsShallow(Base other) { 1222 if (!super.equalsShallow(other)) 1223 return false; 1224 if (!(other instanceof MedicationOrderDispenseRequestComponent)) 1225 return false; 1226 MedicationOrderDispenseRequestComponent o = (MedicationOrderDispenseRequestComponent) other; 1227 return compareValues(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true); 1228 } 1229 1230 public boolean isEmpty() { 1231 return super.isEmpty() && (medication == null || medication.isEmpty()) && (validityPeriod == null || validityPeriod.isEmpty()) 1232 && (numberOfRepeatsAllowed == null || numberOfRepeatsAllowed.isEmpty()) && (quantity == null || quantity.isEmpty()) 1233 && (expectedSupplyDuration == null || expectedSupplyDuration.isEmpty()); 1234 } 1235 1236 public String fhirType() { 1237 return "MedicationOrder.dispenseRequest"; 1238 1239 } 1240 1241 } 1242 1243 @Block() 1244 public static class MedicationOrderSubstitutionComponent extends BackboneElement implements IBaseBackboneElement { 1245 /** 1246 * A code signifying whether a different drug should be dispensed from what was prescribed. 1247 */ 1248 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 1249 @Description(shortDefinition="generic | formulary +", formalDefinition="A code signifying whether a different drug should be dispensed from what was prescribed." ) 1250 protected CodeableConcept type; 1251 1252 /** 1253 * Indicates the reason for the substitution, or why substitution must or must not be performed. 1254 */ 1255 @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 1256 @Description(shortDefinition="Why should (not) substitution be made", formalDefinition="Indicates the reason for the substitution, or why substitution must or must not be performed." ) 1257 protected CodeableConcept reason; 1258 1259 private static final long serialVersionUID = 1693602518L; 1260 1261 /** 1262 * Constructor 1263 */ 1264 public MedicationOrderSubstitutionComponent() { 1265 super(); 1266 } 1267 1268 /** 1269 * Constructor 1270 */ 1271 public MedicationOrderSubstitutionComponent(CodeableConcept type) { 1272 super(); 1273 this.type = type; 1274 } 1275 1276 /** 1277 * @return {@link #type} (A code signifying whether a different drug should be dispensed from what was prescribed.) 1278 */ 1279 public CodeableConcept getType() { 1280 if (this.type == null) 1281 if (Configuration.errorOnAutoCreate()) 1282 throw new Error("Attempt to auto-create MedicationOrderSubstitutionComponent.type"); 1283 else if (Configuration.doAutoCreate()) 1284 this.type = new CodeableConcept(); // cc 1285 return this.type; 1286 } 1287 1288 public boolean hasType() { 1289 return this.type != null && !this.type.isEmpty(); 1290 } 1291 1292 /** 1293 * @param value {@link #type} (A code signifying whether a different drug should be dispensed from what was prescribed.) 1294 */ 1295 public MedicationOrderSubstitutionComponent setType(CodeableConcept value) { 1296 this.type = value; 1297 return this; 1298 } 1299 1300 /** 1301 * @return {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) 1302 */ 1303 public CodeableConcept getReason() { 1304 if (this.reason == null) 1305 if (Configuration.errorOnAutoCreate()) 1306 throw new Error("Attempt to auto-create MedicationOrderSubstitutionComponent.reason"); 1307 else if (Configuration.doAutoCreate()) 1308 this.reason = new CodeableConcept(); // cc 1309 return this.reason; 1310 } 1311 1312 public boolean hasReason() { 1313 return this.reason != null && !this.reason.isEmpty(); 1314 } 1315 1316 /** 1317 * @param value {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) 1318 */ 1319 public MedicationOrderSubstitutionComponent setReason(CodeableConcept value) { 1320 this.reason = value; 1321 return this; 1322 } 1323 1324 protected void listChildren(List<Property> childrenList) { 1325 super.listChildren(childrenList); 1326 childrenList.add(new Property("type", "CodeableConcept", "A code signifying whether a different drug should be dispensed from what was prescribed.", 0, java.lang.Integer.MAX_VALUE, type)); 1327 childrenList.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, java.lang.Integer.MAX_VALUE, reason)); 1328 } 1329 1330 @Override 1331 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1332 switch (hash) { 1333 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1334 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept 1335 default: return super.getProperty(hash, name, checkValid); 1336 } 1337 1338 } 1339 1340 @Override 1341 public void setProperty(int hash, String name, Base value) throws FHIRException { 1342 switch (hash) { 1343 case 3575610: // type 1344 this.type = castToCodeableConcept(value); // CodeableConcept 1345 break; 1346 case -934964668: // reason 1347 this.reason = castToCodeableConcept(value); // CodeableConcept 1348 break; 1349 default: super.setProperty(hash, name, value); 1350 } 1351 1352 } 1353 1354 @Override 1355 public void setProperty(String name, Base value) throws FHIRException { 1356 if (name.equals("type")) 1357 this.type = castToCodeableConcept(value); // CodeableConcept 1358 else if (name.equals("reason")) 1359 this.reason = castToCodeableConcept(value); // CodeableConcept 1360 else 1361 super.setProperty(name, value); 1362 } 1363 1364 @Override 1365 public Base makeProperty(int hash, String name) throws FHIRException { 1366 switch (hash) { 1367 case 3575610: return getType(); // CodeableConcept 1368 case -934964668: return getReason(); // CodeableConcept 1369 default: return super.makeProperty(hash, name); 1370 } 1371 1372 } 1373 1374 @Override 1375 public Base addChild(String name) throws FHIRException { 1376 if (name.equals("type")) { 1377 this.type = new CodeableConcept(); 1378 return this.type; 1379 } 1380 else if (name.equals("reason")) { 1381 this.reason = new CodeableConcept(); 1382 return this.reason; 1383 } 1384 else 1385 return super.addChild(name); 1386 } 1387 1388 public MedicationOrderSubstitutionComponent copy() { 1389 MedicationOrderSubstitutionComponent dst = new MedicationOrderSubstitutionComponent(); 1390 copyValues(dst); 1391 dst.type = type == null ? null : type.copy(); 1392 dst.reason = reason == null ? null : reason.copy(); 1393 return dst; 1394 } 1395 1396 @Override 1397 public boolean equalsDeep(Base other) { 1398 if (!super.equalsDeep(other)) 1399 return false; 1400 if (!(other instanceof MedicationOrderSubstitutionComponent)) 1401 return false; 1402 MedicationOrderSubstitutionComponent o = (MedicationOrderSubstitutionComponent) other; 1403 return compareDeep(type, o.type, true) && compareDeep(reason, o.reason, true); 1404 } 1405 1406 @Override 1407 public boolean equalsShallow(Base other) { 1408 if (!super.equalsShallow(other)) 1409 return false; 1410 if (!(other instanceof MedicationOrderSubstitutionComponent)) 1411 return false; 1412 MedicationOrderSubstitutionComponent o = (MedicationOrderSubstitutionComponent) other; 1413 return true; 1414 } 1415 1416 public boolean isEmpty() { 1417 return super.isEmpty() && (type == null || type.isEmpty()) && (reason == null || reason.isEmpty()) 1418 ; 1419 } 1420 1421 public String fhirType() { 1422 return "MedicationOrder.substitution"; 1423 1424 } 1425 1426 } 1427 1428 /** 1429 * External identifier - one that would be used by another non-FHIR system - for example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records have to be tracked through an entire system. 1430 */ 1431 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1432 @Description(shortDefinition="External identifier", formalDefinition="External identifier - one that would be used by another non-FHIR system - for example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records have to be tracked through an entire system." ) 1433 protected List<Identifier> identifier; 1434 1435 /** 1436 * A code specifying the state of the order. Generally this will be active or completed state. 1437 */ 1438 @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true) 1439 @Description(shortDefinition="active | on-hold | completed | entered-in-error | stopped | draft", formalDefinition="A code specifying the state of the order. Generally this will be active or completed state." ) 1440 protected Enumeration<MedicationOrderStatus> status; 1441 1442 /** 1443 * Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications. 1444 */ 1445 @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=2, min=1, max=1, modifier=false, summary=true) 1446 @Description(shortDefinition="Medication to be taken", formalDefinition="Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications." ) 1447 protected Type medication; 1448 1449 /** 1450 * A link to a resource representing the person to whom the medication will be given. 1451 */ 1452 @Child(name = "patient", type = {Patient.class}, order=3, min=0, max=1, modifier=false, summary=true) 1453 @Description(shortDefinition="Who prescription is for", formalDefinition="A link to a resource representing the person to whom the medication will be given." ) 1454 protected Reference patient; 1455 1456 /** 1457 * 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.) 1458 */ 1459 protected Patient patientTarget; 1460 1461 /** 1462 * A link to a resource that identifies the particular occurrence of contact between patient and health care provider. 1463 */ 1464 @Child(name = "encounter", type = {Encounter.class}, order=4, min=0, max=1, modifier=false, summary=true) 1465 @Description(shortDefinition="Created during encounter/admission/stay", formalDefinition="A link to a resource that identifies the particular occurrence of contact between patient and health care provider." ) 1466 protected Reference encounter; 1467 1468 /** 1469 * The actual object that is the target of the reference (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.) 1470 */ 1471 protected Encounter encounterTarget; 1472 1473 /** 1474 * The date (and perhaps time) when the prescription was written. 1475 */ 1476 @Child(name = "dateWritten", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true) 1477 @Description(shortDefinition="When prescription was authorized", formalDefinition="The date (and perhaps time) when the prescription was written." ) 1478 protected DateTimeType dateWritten; 1479 1480 /** 1481 * The healthcare professional responsible for authorizing the prescription. 1482 */ 1483 @Child(name = "prescriber", type = {Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true) 1484 @Description(shortDefinition="Who ordered the medication(s)", formalDefinition="The healthcare professional responsible for authorizing the prescription." ) 1485 protected Reference prescriber; 1486 1487 /** 1488 * The actual object that is the target of the reference (The healthcare professional responsible for authorizing the prescription.) 1489 */ 1490 protected Practitioner prescriberTarget; 1491 1492 /** 1493 * Can be the reason or the indication for writing the prescription. 1494 */ 1495 @Child(name = "reasonCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1496 @Description(shortDefinition="Reason or indication for writing the prescription", formalDefinition="Can be the reason or the indication for writing the prescription." ) 1497 protected List<CodeableConcept> reasonCode; 1498 1499 /** 1500 * Condition that supports why the prescription is being written. 1501 */ 1502 @Child(name = "reasonReference", type = {Condition.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1503 @Description(shortDefinition="Condition that supports why the prescription is being written", formalDefinition="Condition that supports why the prescription is being written." ) 1504 protected List<Reference> reasonReference; 1505 /** 1506 * The actual objects that are the target of the reference (Condition that supports why the prescription is being written.) 1507 */ 1508 protected List<Condition> reasonReferenceTarget; 1509 1510 1511 /** 1512 * The date (and perhaps time) when the prescription was stopped. 1513 */ 1514 @Child(name = "dateEnded", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true) 1515 @Description(shortDefinition="When prescription was stopped", formalDefinition="The date (and perhaps time) when the prescription was stopped." ) 1516 protected DateTimeType dateEnded; 1517 1518 /** 1519 * The reason why the prescription was stopped, if it was. 1520 */ 1521 @Child(name = "reasonEnded", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true) 1522 @Description(shortDefinition="Why prescription was stopped", formalDefinition="The reason why the prescription was stopped, if it was." ) 1523 protected CodeableConcept reasonEnded; 1524 1525 /** 1526 * Extra information about the prescription that could not be conveyed by the other attributes. 1527 */ 1528 @Child(name = "note", type = {Annotation.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1529 @Description(shortDefinition="Information about the prescription", formalDefinition="Extra information about the prescription that could not be conveyed by the other attributes." ) 1530 protected List<Annotation> note; 1531 1532 /** 1533 * Indicates how the medication is to be used by the patient. 1534 */ 1535 @Child(name = "dosageInstruction", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1536 @Description(shortDefinition="How medication should be taken", formalDefinition="Indicates how the medication is to be used by the patient." ) 1537 protected List<MedicationOrderDosageInstructionComponent> dosageInstruction; 1538 1539 /** 1540 * Indicates the specific details for the dispense or medication supply part of a medication order (also known as a Medication Prescription). Note that this information is NOT always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department. 1541 */ 1542 @Child(name = "dispenseRequest", type = {}, order=13, min=0, max=1, modifier=false, summary=true) 1543 @Description(shortDefinition="Medication supply authorization", formalDefinition="Indicates the specific details for the dispense or medication supply part of a medication order (also known as a Medication Prescription). Note that this information is NOT always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department." ) 1544 protected MedicationOrderDispenseRequestComponent dispenseRequest; 1545 1546 /** 1547 * Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen, and in others it does not matter. This block explains the prescriber's intent. If nothing is specified substitution may be done. 1548 */ 1549 @Child(name = "substitution", type = {}, order=14, min=0, max=1, modifier=false, summary=true) 1550 @Description(shortDefinition="Any restrictions on medication substitution", formalDefinition="Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen, and in others it does not matter. This block explains the prescriber's intent. If nothing is specified substitution may be done." ) 1551 protected MedicationOrderSubstitutionComponent substitution; 1552 1553 /** 1554 * A link to a resource representing an earlier order or prescription that this order supersedes. 1555 */ 1556 @Child(name = "priorPrescription", type = {MedicationOrder.class}, order=15, min=0, max=1, modifier=false, summary=true) 1557 @Description(shortDefinition="An order/prescription that this supersedes", formalDefinition="A link to a resource representing an earlier order or prescription that this order supersedes." ) 1558 protected Reference priorPrescription; 1559 1560 /** 1561 * The actual object that is the target of the reference (A link to a resource representing an earlier order or prescription that this order supersedes.) 1562 */ 1563 protected MedicationOrder priorPrescriptionTarget; 1564 1565 private static final long serialVersionUID = -1031457736L; 1566 1567 /** 1568 * Constructor 1569 */ 1570 public MedicationOrder() { 1571 super(); 1572 } 1573 1574 /** 1575 * Constructor 1576 */ 1577 public MedicationOrder(Type medication) { 1578 super(); 1579 this.medication = medication; 1580 } 1581 1582 /** 1583 * @return {@link #identifier} (External identifier - one that would be used by another non-FHIR system - for example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records have to be tracked through an entire system.) 1584 */ 1585 public List<Identifier> getIdentifier() { 1586 if (this.identifier == null) 1587 this.identifier = new ArrayList<Identifier>(); 1588 return this.identifier; 1589 } 1590 1591 public boolean hasIdentifier() { 1592 if (this.identifier == null) 1593 return false; 1594 for (Identifier item : this.identifier) 1595 if (!item.isEmpty()) 1596 return true; 1597 return false; 1598 } 1599 1600 /** 1601 * @return {@link #identifier} (External identifier - one that would be used by another non-FHIR system - for example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records have to be tracked through an entire system.) 1602 */ 1603 // syntactic sugar 1604 public Identifier addIdentifier() { //3 1605 Identifier t = new Identifier(); 1606 if (this.identifier == null) 1607 this.identifier = new ArrayList<Identifier>(); 1608 this.identifier.add(t); 1609 return t; 1610 } 1611 1612 // syntactic sugar 1613 public MedicationOrder addIdentifier(Identifier t) { //3 1614 if (t == null) 1615 return this; 1616 if (this.identifier == null) 1617 this.identifier = new ArrayList<Identifier>(); 1618 this.identifier.add(t); 1619 return this; 1620 } 1621 1622 /** 1623 * @return {@link #status} (A code specifying the state of the order. Generally this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1624 */ 1625 public Enumeration<MedicationOrderStatus> getStatusElement() { 1626 if (this.status == null) 1627 if (Configuration.errorOnAutoCreate()) 1628 throw new Error("Attempt to auto-create MedicationOrder.status"); 1629 else if (Configuration.doAutoCreate()) 1630 this.status = new Enumeration<MedicationOrderStatus>(new MedicationOrderStatusEnumFactory()); // bb 1631 return this.status; 1632 } 1633 1634 public boolean hasStatusElement() { 1635 return this.status != null && !this.status.isEmpty(); 1636 } 1637 1638 public boolean hasStatus() { 1639 return this.status != null && !this.status.isEmpty(); 1640 } 1641 1642 /** 1643 * @param value {@link #status} (A code specifying the state of the order. Generally this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1644 */ 1645 public MedicationOrder setStatusElement(Enumeration<MedicationOrderStatus> value) { 1646 this.status = value; 1647 return this; 1648 } 1649 1650 /** 1651 * @return A code specifying the state of the order. Generally this will be active or completed state. 1652 */ 1653 public MedicationOrderStatus getStatus() { 1654 return this.status == null ? null : this.status.getValue(); 1655 } 1656 1657 /** 1658 * @param value A code specifying the state of the order. Generally this will be active or completed state. 1659 */ 1660 public MedicationOrder setStatus(MedicationOrderStatus value) { 1661 if (value == null) 1662 this.status = null; 1663 else { 1664 if (this.status == null) 1665 this.status = new Enumeration<MedicationOrderStatus>(new MedicationOrderStatusEnumFactory()); 1666 this.status.setValue(value); 1667 } 1668 return this; 1669 } 1670 1671 /** 1672 * @return {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 1673 */ 1674 public Type getMedication() { 1675 return this.medication; 1676 } 1677 1678 /** 1679 * @return {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 1680 */ 1681 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 1682 if (!(this.medication instanceof CodeableConcept)) 1683 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); 1684 return (CodeableConcept) this.medication; 1685 } 1686 1687 public boolean hasMedicationCodeableConcept() { 1688 return this.medication instanceof CodeableConcept; 1689 } 1690 1691 /** 1692 * @return {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 1693 */ 1694 public Reference getMedicationReference() throws FHIRException { 1695 if (!(this.medication instanceof Reference)) 1696 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); 1697 return (Reference) this.medication; 1698 } 1699 1700 public boolean hasMedicationReference() { 1701 return this.medication instanceof Reference; 1702 } 1703 1704 public boolean hasMedication() { 1705 return this.medication != null && !this.medication.isEmpty(); 1706 } 1707 1708 /** 1709 * @param value {@link #medication} (Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) 1710 */ 1711 public MedicationOrder setMedication(Type value) { 1712 this.medication = value; 1713 return this; 1714 } 1715 1716 /** 1717 * @return {@link #patient} (A link to a resource representing the person to whom the medication will be given.) 1718 */ 1719 public Reference getPatient() { 1720 if (this.patient == null) 1721 if (Configuration.errorOnAutoCreate()) 1722 throw new Error("Attempt to auto-create MedicationOrder.patient"); 1723 else if (Configuration.doAutoCreate()) 1724 this.patient = new Reference(); // cc 1725 return this.patient; 1726 } 1727 1728 public boolean hasPatient() { 1729 return this.patient != null && !this.patient.isEmpty(); 1730 } 1731 1732 /** 1733 * @param value {@link #patient} (A link to a resource representing the person to whom the medication will be given.) 1734 */ 1735 public MedicationOrder setPatient(Reference value) { 1736 this.patient = value; 1737 return this; 1738 } 1739 1740 /** 1741 * @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.) 1742 */ 1743 public Patient getPatientTarget() { 1744 if (this.patientTarget == null) 1745 if (Configuration.errorOnAutoCreate()) 1746 throw new Error("Attempt to auto-create MedicationOrder.patient"); 1747 else if (Configuration.doAutoCreate()) 1748 this.patientTarget = new Patient(); // aa 1749 return this.patientTarget; 1750 } 1751 1752 /** 1753 * @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.) 1754 */ 1755 public MedicationOrder setPatientTarget(Patient value) { 1756 this.patientTarget = value; 1757 return this; 1758 } 1759 1760 /** 1761 * @return {@link #encounter} (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.) 1762 */ 1763 public Reference getEncounter() { 1764 if (this.encounter == null) 1765 if (Configuration.errorOnAutoCreate()) 1766 throw new Error("Attempt to auto-create MedicationOrder.encounter"); 1767 else if (Configuration.doAutoCreate()) 1768 this.encounter = new Reference(); // cc 1769 return this.encounter; 1770 } 1771 1772 public boolean hasEncounter() { 1773 return this.encounter != null && !this.encounter.isEmpty(); 1774 } 1775 1776 /** 1777 * @param value {@link #encounter} (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.) 1778 */ 1779 public MedicationOrder setEncounter(Reference value) { 1780 this.encounter = value; 1781 return this; 1782 } 1783 1784 /** 1785 * @return {@link #encounter} 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 that identifies the particular occurrence of contact between patient and health care provider.) 1786 */ 1787 public Encounter getEncounterTarget() { 1788 if (this.encounterTarget == null) 1789 if (Configuration.errorOnAutoCreate()) 1790 throw new Error("Attempt to auto-create MedicationOrder.encounter"); 1791 else if (Configuration.doAutoCreate()) 1792 this.encounterTarget = new Encounter(); // aa 1793 return this.encounterTarget; 1794 } 1795 1796 /** 1797 * @param value {@link #encounter} 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 that identifies the particular occurrence of contact between patient and health care provider.) 1798 */ 1799 public MedicationOrder setEncounterTarget(Encounter value) { 1800 this.encounterTarget = value; 1801 return this; 1802 } 1803 1804 /** 1805 * @return {@link #dateWritten} (The date (and perhaps time) when the prescription was written.). This is the underlying object with id, value and extensions. The accessor "getDateWritten" gives direct access to the value 1806 */ 1807 public DateTimeType getDateWrittenElement() { 1808 if (this.dateWritten == null) 1809 if (Configuration.errorOnAutoCreate()) 1810 throw new Error("Attempt to auto-create MedicationOrder.dateWritten"); 1811 else if (Configuration.doAutoCreate()) 1812 this.dateWritten = new DateTimeType(); // bb 1813 return this.dateWritten; 1814 } 1815 1816 public boolean hasDateWrittenElement() { 1817 return this.dateWritten != null && !this.dateWritten.isEmpty(); 1818 } 1819 1820 public boolean hasDateWritten() { 1821 return this.dateWritten != null && !this.dateWritten.isEmpty(); 1822 } 1823 1824 /** 1825 * @param value {@link #dateWritten} (The date (and perhaps time) when the prescription was written.). This is the underlying object with id, value and extensions. The accessor "getDateWritten" gives direct access to the value 1826 */ 1827 public MedicationOrder setDateWrittenElement(DateTimeType value) { 1828 this.dateWritten = value; 1829 return this; 1830 } 1831 1832 /** 1833 * @return The date (and perhaps time) when the prescription was written. 1834 */ 1835 public Date getDateWritten() { 1836 return this.dateWritten == null ? null : this.dateWritten.getValue(); 1837 } 1838 1839 /** 1840 * @param value The date (and perhaps time) when the prescription was written. 1841 */ 1842 public MedicationOrder setDateWritten(Date value) { 1843 if (value == null) 1844 this.dateWritten = null; 1845 else { 1846 if (this.dateWritten == null) 1847 this.dateWritten = new DateTimeType(); 1848 this.dateWritten.setValue(value); 1849 } 1850 return this; 1851 } 1852 1853 /** 1854 * @return {@link #prescriber} (The healthcare professional responsible for authorizing the prescription.) 1855 */ 1856 public Reference getPrescriber() { 1857 if (this.prescriber == null) 1858 if (Configuration.errorOnAutoCreate()) 1859 throw new Error("Attempt to auto-create MedicationOrder.prescriber"); 1860 else if (Configuration.doAutoCreate()) 1861 this.prescriber = new Reference(); // cc 1862 return this.prescriber; 1863 } 1864 1865 public boolean hasPrescriber() { 1866 return this.prescriber != null && !this.prescriber.isEmpty(); 1867 } 1868 1869 /** 1870 * @param value {@link #prescriber} (The healthcare professional responsible for authorizing the prescription.) 1871 */ 1872 public MedicationOrder setPrescriber(Reference value) { 1873 this.prescriber = value; 1874 return this; 1875 } 1876 1877 /** 1878 * @return {@link #prescriber} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The healthcare professional responsible for authorizing the prescription.) 1879 */ 1880 public Practitioner getPrescriberTarget() { 1881 if (this.prescriberTarget == null) 1882 if (Configuration.errorOnAutoCreate()) 1883 throw new Error("Attempt to auto-create MedicationOrder.prescriber"); 1884 else if (Configuration.doAutoCreate()) 1885 this.prescriberTarget = new Practitioner(); // aa 1886 return this.prescriberTarget; 1887 } 1888 1889 /** 1890 * @param value {@link #prescriber} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The healthcare professional responsible for authorizing the prescription.) 1891 */ 1892 public MedicationOrder setPrescriberTarget(Practitioner value) { 1893 this.prescriberTarget = value; 1894 return this; 1895 } 1896 1897 /** 1898 * @return {@link #reasonCode} (Can be the reason or the indication for writing the prescription.) 1899 */ 1900 public List<CodeableConcept> getReasonCode() { 1901 if (this.reasonCode == null) 1902 this.reasonCode = new ArrayList<CodeableConcept>(); 1903 return this.reasonCode; 1904 } 1905 1906 public boolean hasReasonCode() { 1907 if (this.reasonCode == null) 1908 return false; 1909 for (CodeableConcept item : this.reasonCode) 1910 if (!item.isEmpty()) 1911 return true; 1912 return false; 1913 } 1914 1915 /** 1916 * @return {@link #reasonCode} (Can be the reason or the indication for writing the prescription.) 1917 */ 1918 // syntactic sugar 1919 public CodeableConcept addReasonCode() { //3 1920 CodeableConcept t = new CodeableConcept(); 1921 if (this.reasonCode == null) 1922 this.reasonCode = new ArrayList<CodeableConcept>(); 1923 this.reasonCode.add(t); 1924 return t; 1925 } 1926 1927 // syntactic sugar 1928 public MedicationOrder addReasonCode(CodeableConcept t) { //3 1929 if (t == null) 1930 return this; 1931 if (this.reasonCode == null) 1932 this.reasonCode = new ArrayList<CodeableConcept>(); 1933 this.reasonCode.add(t); 1934 return this; 1935 } 1936 1937 /** 1938 * @return {@link #reasonReference} (Condition that supports why the prescription is being written.) 1939 */ 1940 public List<Reference> getReasonReference() { 1941 if (this.reasonReference == null) 1942 this.reasonReference = new ArrayList<Reference>(); 1943 return this.reasonReference; 1944 } 1945 1946 public boolean hasReasonReference() { 1947 if (this.reasonReference == null) 1948 return false; 1949 for (Reference item : this.reasonReference) 1950 if (!item.isEmpty()) 1951 return true; 1952 return false; 1953 } 1954 1955 /** 1956 * @return {@link #reasonReference} (Condition that supports why the prescription is being written.) 1957 */ 1958 // syntactic sugar 1959 public Reference addReasonReference() { //3 1960 Reference t = new Reference(); 1961 if (this.reasonReference == null) 1962 this.reasonReference = new ArrayList<Reference>(); 1963 this.reasonReference.add(t); 1964 return t; 1965 } 1966 1967 // syntactic sugar 1968 public MedicationOrder addReasonReference(Reference t) { //3 1969 if (t == null) 1970 return this; 1971 if (this.reasonReference == null) 1972 this.reasonReference = new ArrayList<Reference>(); 1973 this.reasonReference.add(t); 1974 return this; 1975 } 1976 1977 /** 1978 * @return {@link #reasonReference} (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. Condition that supports why the prescription is being written.) 1979 */ 1980 public List<Condition> getReasonReferenceTarget() { 1981 if (this.reasonReferenceTarget == null) 1982 this.reasonReferenceTarget = new ArrayList<Condition>(); 1983 return this.reasonReferenceTarget; 1984 } 1985 1986 // syntactic sugar 1987 /** 1988 * @return {@link #reasonReference} (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. Condition that supports why the prescription is being written.) 1989 */ 1990 public Condition addReasonReferenceTarget() { 1991 Condition r = new Condition(); 1992 if (this.reasonReferenceTarget == null) 1993 this.reasonReferenceTarget = new ArrayList<Condition>(); 1994 this.reasonReferenceTarget.add(r); 1995 return r; 1996 } 1997 1998 /** 1999 * @return {@link #dateEnded} (The date (and perhaps time) when the prescription was stopped.). This is the underlying object with id, value and extensions. The accessor "getDateEnded" gives direct access to the value 2000 */ 2001 public DateTimeType getDateEndedElement() { 2002 if (this.dateEnded == null) 2003 if (Configuration.errorOnAutoCreate()) 2004 throw new Error("Attempt to auto-create MedicationOrder.dateEnded"); 2005 else if (Configuration.doAutoCreate()) 2006 this.dateEnded = new DateTimeType(); // bb 2007 return this.dateEnded; 2008 } 2009 2010 public boolean hasDateEndedElement() { 2011 return this.dateEnded != null && !this.dateEnded.isEmpty(); 2012 } 2013 2014 public boolean hasDateEnded() { 2015 return this.dateEnded != null && !this.dateEnded.isEmpty(); 2016 } 2017 2018 /** 2019 * @param value {@link #dateEnded} (The date (and perhaps time) when the prescription was stopped.). This is the underlying object with id, value and extensions. The accessor "getDateEnded" gives direct access to the value 2020 */ 2021 public MedicationOrder setDateEndedElement(DateTimeType value) { 2022 this.dateEnded = value; 2023 return this; 2024 } 2025 2026 /** 2027 * @return The date (and perhaps time) when the prescription was stopped. 2028 */ 2029 public Date getDateEnded() { 2030 return this.dateEnded == null ? null : this.dateEnded.getValue(); 2031 } 2032 2033 /** 2034 * @param value The date (and perhaps time) when the prescription was stopped. 2035 */ 2036 public MedicationOrder setDateEnded(Date value) { 2037 if (value == null) 2038 this.dateEnded = null; 2039 else { 2040 if (this.dateEnded == null) 2041 this.dateEnded = new DateTimeType(); 2042 this.dateEnded.setValue(value); 2043 } 2044 return this; 2045 } 2046 2047 /** 2048 * @return {@link #reasonEnded} (The reason why the prescription was stopped, if it was.) 2049 */ 2050 public CodeableConcept getReasonEnded() { 2051 if (this.reasonEnded == null) 2052 if (Configuration.errorOnAutoCreate()) 2053 throw new Error("Attempt to auto-create MedicationOrder.reasonEnded"); 2054 else if (Configuration.doAutoCreate()) 2055 this.reasonEnded = new CodeableConcept(); // cc 2056 return this.reasonEnded; 2057 } 2058 2059 public boolean hasReasonEnded() { 2060 return this.reasonEnded != null && !this.reasonEnded.isEmpty(); 2061 } 2062 2063 /** 2064 * @param value {@link #reasonEnded} (The reason why the prescription was stopped, if it was.) 2065 */ 2066 public MedicationOrder setReasonEnded(CodeableConcept value) { 2067 this.reasonEnded = value; 2068 return this; 2069 } 2070 2071 /** 2072 * @return {@link #note} (Extra information about the prescription that could not be conveyed by the other attributes.) 2073 */ 2074 public List<Annotation> getNote() { 2075 if (this.note == null) 2076 this.note = new ArrayList<Annotation>(); 2077 return this.note; 2078 } 2079 2080 public boolean hasNote() { 2081 if (this.note == null) 2082 return false; 2083 for (Annotation item : this.note) 2084 if (!item.isEmpty()) 2085 return true; 2086 return false; 2087 } 2088 2089 /** 2090 * @return {@link #note} (Extra information about the prescription that could not be conveyed by the other attributes.) 2091 */ 2092 // syntactic sugar 2093 public Annotation addNote() { //3 2094 Annotation t = new Annotation(); 2095 if (this.note == null) 2096 this.note = new ArrayList<Annotation>(); 2097 this.note.add(t); 2098 return t; 2099 } 2100 2101 // syntactic sugar 2102 public MedicationOrder addNote(Annotation t) { //3 2103 if (t == null) 2104 return this; 2105 if (this.note == null) 2106 this.note = new ArrayList<Annotation>(); 2107 this.note.add(t); 2108 return this; 2109 } 2110 2111 /** 2112 * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient.) 2113 */ 2114 public List<MedicationOrderDosageInstructionComponent> getDosageInstruction() { 2115 if (this.dosageInstruction == null) 2116 this.dosageInstruction = new ArrayList<MedicationOrderDosageInstructionComponent>(); 2117 return this.dosageInstruction; 2118 } 2119 2120 public boolean hasDosageInstruction() { 2121 if (this.dosageInstruction == null) 2122 return false; 2123 for (MedicationOrderDosageInstructionComponent item : this.dosageInstruction) 2124 if (!item.isEmpty()) 2125 return true; 2126 return false; 2127 } 2128 2129 /** 2130 * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient.) 2131 */ 2132 // syntactic sugar 2133 public MedicationOrderDosageInstructionComponent addDosageInstruction() { //3 2134 MedicationOrderDosageInstructionComponent t = new MedicationOrderDosageInstructionComponent(); 2135 if (this.dosageInstruction == null) 2136 this.dosageInstruction = new ArrayList<MedicationOrderDosageInstructionComponent>(); 2137 this.dosageInstruction.add(t); 2138 return t; 2139 } 2140 2141 // syntactic sugar 2142 public MedicationOrder addDosageInstruction(MedicationOrderDosageInstructionComponent t) { //3 2143 if (t == null) 2144 return this; 2145 if (this.dosageInstruction == null) 2146 this.dosageInstruction = new ArrayList<MedicationOrderDosageInstructionComponent>(); 2147 this.dosageInstruction.add(t); 2148 return this; 2149 } 2150 2151 /** 2152 * @return {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication order (also known as a Medication Prescription). Note that this information is NOT always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) 2153 */ 2154 public MedicationOrderDispenseRequestComponent getDispenseRequest() { 2155 if (this.dispenseRequest == null) 2156 if (Configuration.errorOnAutoCreate()) 2157 throw new Error("Attempt to auto-create MedicationOrder.dispenseRequest"); 2158 else if (Configuration.doAutoCreate()) 2159 this.dispenseRequest = new MedicationOrderDispenseRequestComponent(); // cc 2160 return this.dispenseRequest; 2161 } 2162 2163 public boolean hasDispenseRequest() { 2164 return this.dispenseRequest != null && !this.dispenseRequest.isEmpty(); 2165 } 2166 2167 /** 2168 * @param value {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication order (also known as a Medication Prescription). Note that this information is NOT always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) 2169 */ 2170 public MedicationOrder setDispenseRequest(MedicationOrderDispenseRequestComponent value) { 2171 this.dispenseRequest = value; 2172 return this; 2173 } 2174 2175 /** 2176 * @return {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen, and in others it does not matter. This block explains the prescriber's intent. If nothing is specified substitution may be done.) 2177 */ 2178 public MedicationOrderSubstitutionComponent getSubstitution() { 2179 if (this.substitution == null) 2180 if (Configuration.errorOnAutoCreate()) 2181 throw new Error("Attempt to auto-create MedicationOrder.substitution"); 2182 else if (Configuration.doAutoCreate()) 2183 this.substitution = new MedicationOrderSubstitutionComponent(); // cc 2184 return this.substitution; 2185 } 2186 2187 public boolean hasSubstitution() { 2188 return this.substitution != null && !this.substitution.isEmpty(); 2189 } 2190 2191 /** 2192 * @param value {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen, and in others it does not matter. This block explains the prescriber's intent. If nothing is specified substitution may be done.) 2193 */ 2194 public MedicationOrder setSubstitution(MedicationOrderSubstitutionComponent value) { 2195 this.substitution = value; 2196 return this; 2197 } 2198 2199 /** 2200 * @return {@link #priorPrescription} (A link to a resource representing an earlier order or prescription that this order supersedes.) 2201 */ 2202 public Reference getPriorPrescription() { 2203 if (this.priorPrescription == null) 2204 if (Configuration.errorOnAutoCreate()) 2205 throw new Error("Attempt to auto-create MedicationOrder.priorPrescription"); 2206 else if (Configuration.doAutoCreate()) 2207 this.priorPrescription = new Reference(); // cc 2208 return this.priorPrescription; 2209 } 2210 2211 public boolean hasPriorPrescription() { 2212 return this.priorPrescription != null && !this.priorPrescription.isEmpty(); 2213 } 2214 2215 /** 2216 * @param value {@link #priorPrescription} (A link to a resource representing an earlier order or prescription that this order supersedes.) 2217 */ 2218 public MedicationOrder setPriorPrescription(Reference value) { 2219 this.priorPrescription = value; 2220 return this; 2221 } 2222 2223 /** 2224 * @return {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order or prescription that this order supersedes.) 2225 */ 2226 public MedicationOrder getPriorPrescriptionTarget() { 2227 if (this.priorPrescriptionTarget == null) 2228 if (Configuration.errorOnAutoCreate()) 2229 throw new Error("Attempt to auto-create MedicationOrder.priorPrescription"); 2230 else if (Configuration.doAutoCreate()) 2231 this.priorPrescriptionTarget = new MedicationOrder(); // aa 2232 return this.priorPrescriptionTarget; 2233 } 2234 2235 /** 2236 * @param value {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order or prescription that this order supersedes.) 2237 */ 2238 public MedicationOrder setPriorPrescriptionTarget(MedicationOrder value) { 2239 this.priorPrescriptionTarget = value; 2240 return this; 2241 } 2242 2243 protected void listChildren(List<Property> childrenList) { 2244 super.listChildren(childrenList); 2245 childrenList.add(new Property("identifier", "Identifier", "External identifier - one that would be used by another non-FHIR system - for example a re-imbursement system might issue its own id for each prescription that is created. This is particularly important where FHIR only provides part of an entire workflow process where records have to be tracked through an entire system.", 0, java.lang.Integer.MAX_VALUE, identifier)); 2246 childrenList.add(new Property("status", "code", "A code specifying the state of the order. Generally this will be active or completed state.", 0, java.lang.Integer.MAX_VALUE, status)); 2247 childrenList.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, java.lang.Integer.MAX_VALUE, medication)); 2248 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)); 2249 childrenList.add(new Property("encounter", "Reference(Encounter)", "A link to a resource that identifies the particular occurrence of contact between patient and health care provider.", 0, java.lang.Integer.MAX_VALUE, encounter)); 2250 childrenList.add(new Property("dateWritten", "dateTime", "The date (and perhaps time) when the prescription was written.", 0, java.lang.Integer.MAX_VALUE, dateWritten)); 2251 childrenList.add(new Property("prescriber", "Reference(Practitioner)", "The healthcare professional responsible for authorizing the prescription.", 0, java.lang.Integer.MAX_VALUE, prescriber)); 2252 childrenList.add(new Property("reasonCode", "CodeableConcept", "Can be the reason or the indication for writing the prescription.", 0, java.lang.Integer.MAX_VALUE, reasonCode)); 2253 childrenList.add(new Property("reasonReference", "Reference(Condition)", "Condition that supports why the prescription is being written.", 0, java.lang.Integer.MAX_VALUE, reasonReference)); 2254 childrenList.add(new Property("dateEnded", "dateTime", "The date (and perhaps time) when the prescription was stopped.", 0, java.lang.Integer.MAX_VALUE, dateEnded)); 2255 childrenList.add(new Property("reasonEnded", "CodeableConcept", "The reason why the prescription was stopped, if it was.", 0, java.lang.Integer.MAX_VALUE, reasonEnded)); 2256 childrenList.add(new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); 2257 childrenList.add(new Property("dosageInstruction", "", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction)); 2258 childrenList.add(new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication order (also known as a Medication Prescription). Note that this information is NOT always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, java.lang.Integer.MAX_VALUE, dispenseRequest)); 2259 childrenList.add(new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen, and in others it does not matter. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, java.lang.Integer.MAX_VALUE, substitution)); 2260 childrenList.add(new Property("priorPrescription", "Reference(MedicationOrder)", "A link to a resource representing an earlier order or prescription that this order supersedes.", 0, java.lang.Integer.MAX_VALUE, priorPrescription)); 2261 } 2262 2263 @Override 2264 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2265 switch (hash) { 2266 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 2267 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationOrderStatus> 2268 case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type 2269 case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference 2270 case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference 2271 case -1496880759: /*dateWritten*/ return this.dateWritten == null ? new Base[0] : new Base[] {this.dateWritten}; // DateTimeType 2272 case 1430631077: /*prescriber*/ return this.prescriber == null ? new Base[0] : new Base[] {this.prescriber}; // Reference 2273 case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept 2274 case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference 2275 case -273053780: /*dateEnded*/ return this.dateEnded == null ? new Base[0] : new Base[] {this.dateEnded}; // DateTimeType 2276 case 913248982: /*reasonEnded*/ return this.reasonEnded == null ? new Base[0] : new Base[] {this.reasonEnded}; // CodeableConcept 2277 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 2278 case -1201373865: /*dosageInstruction*/ return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // MedicationOrderDosageInstructionComponent 2279 case 824620658: /*dispenseRequest*/ return this.dispenseRequest == null ? new Base[0] : new Base[] {this.dispenseRequest}; // MedicationOrderDispenseRequestComponent 2280 case 826147581: /*substitution*/ return this.substitution == null ? new Base[0] : new Base[] {this.substitution}; // MedicationOrderSubstitutionComponent 2281 case -486355964: /*priorPrescription*/ return this.priorPrescription == null ? new Base[0] : new Base[] {this.priorPrescription}; // Reference 2282 default: return super.getProperty(hash, name, checkValid); 2283 } 2284 2285 } 2286 2287 @Override 2288 public void setProperty(int hash, String name, Base value) throws FHIRException { 2289 switch (hash) { 2290 case -1618432855: // identifier 2291 this.getIdentifier().add(castToIdentifier(value)); // Identifier 2292 break; 2293 case -892481550: // status 2294 this.status = new MedicationOrderStatusEnumFactory().fromType(value); // Enumeration<MedicationOrderStatus> 2295 break; 2296 case 1998965455: // medication 2297 this.medication = (Type) value; // Type 2298 break; 2299 case -791418107: // patient 2300 this.patient = castToReference(value); // Reference 2301 break; 2302 case 1524132147: // encounter 2303 this.encounter = castToReference(value); // Reference 2304 break; 2305 case -1496880759: // dateWritten 2306 this.dateWritten = castToDateTime(value); // DateTimeType 2307 break; 2308 case 1430631077: // prescriber 2309 this.prescriber = castToReference(value); // Reference 2310 break; 2311 case 722137681: // reasonCode 2312 this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept 2313 break; 2314 case -1146218137: // reasonReference 2315 this.getReasonReference().add(castToReference(value)); // Reference 2316 break; 2317 case -273053780: // dateEnded 2318 this.dateEnded = castToDateTime(value); // DateTimeType 2319 break; 2320 case 913248982: // reasonEnded 2321 this.reasonEnded = castToCodeableConcept(value); // CodeableConcept 2322 break; 2323 case 3387378: // note 2324 this.getNote().add(castToAnnotation(value)); // Annotation 2325 break; 2326 case -1201373865: // dosageInstruction 2327 this.getDosageInstruction().add((MedicationOrderDosageInstructionComponent) value); // MedicationOrderDosageInstructionComponent 2328 break; 2329 case 824620658: // dispenseRequest 2330 this.dispenseRequest = (MedicationOrderDispenseRequestComponent) value; // MedicationOrderDispenseRequestComponent 2331 break; 2332 case 826147581: // substitution 2333 this.substitution = (MedicationOrderSubstitutionComponent) value; // MedicationOrderSubstitutionComponent 2334 break; 2335 case -486355964: // priorPrescription 2336 this.priorPrescription = castToReference(value); // Reference 2337 break; 2338 default: super.setProperty(hash, name, value); 2339 } 2340 2341 } 2342 2343 @Override 2344 public void setProperty(String name, Base value) throws FHIRException { 2345 if (name.equals("identifier")) 2346 this.getIdentifier().add(castToIdentifier(value)); 2347 else if (name.equals("status")) 2348 this.status = new MedicationOrderStatusEnumFactory().fromType(value); // Enumeration<MedicationOrderStatus> 2349 else if (name.equals("medication[x]")) 2350 this.medication = (Type) value; // Type 2351 else if (name.equals("patient")) 2352 this.patient = castToReference(value); // Reference 2353 else if (name.equals("encounter")) 2354 this.encounter = castToReference(value); // Reference 2355 else if (name.equals("dateWritten")) 2356 this.dateWritten = castToDateTime(value); // DateTimeType 2357 else if (name.equals("prescriber")) 2358 this.prescriber = castToReference(value); // Reference 2359 else if (name.equals("reasonCode")) 2360 this.getReasonCode().add(castToCodeableConcept(value)); 2361 else if (name.equals("reasonReference")) 2362 this.getReasonReference().add(castToReference(value)); 2363 else if (name.equals("dateEnded")) 2364 this.dateEnded = castToDateTime(value); // DateTimeType 2365 else if (name.equals("reasonEnded")) 2366 this.reasonEnded = castToCodeableConcept(value); // CodeableConcept 2367 else if (name.equals("note")) 2368 this.getNote().add(castToAnnotation(value)); 2369 else if (name.equals("dosageInstruction")) 2370 this.getDosageInstruction().add((MedicationOrderDosageInstructionComponent) value); 2371 else if (name.equals("dispenseRequest")) 2372 this.dispenseRequest = (MedicationOrderDispenseRequestComponent) value; // MedicationOrderDispenseRequestComponent 2373 else if (name.equals("substitution")) 2374 this.substitution = (MedicationOrderSubstitutionComponent) value; // MedicationOrderSubstitutionComponent 2375 else if (name.equals("priorPrescription")) 2376 this.priorPrescription = castToReference(value); // Reference 2377 else 2378 super.setProperty(name, value); 2379 } 2380 2381 @Override 2382 public Base makeProperty(int hash, String name) throws FHIRException { 2383 switch (hash) { 2384 case -1618432855: return addIdentifier(); // Identifier 2385 case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<MedicationOrderStatus> 2386 case 1458402129: return getMedication(); // Type 2387 case -791418107: return getPatient(); // Reference 2388 case 1524132147: return getEncounter(); // Reference 2389 case -1496880759: throw new FHIRException("Cannot make property dateWritten as it is not a complex type"); // DateTimeType 2390 case 1430631077: return getPrescriber(); // Reference 2391 case 722137681: return addReasonCode(); // CodeableConcept 2392 case -1146218137: return addReasonReference(); // Reference 2393 case -273053780: throw new FHIRException("Cannot make property dateEnded as it is not a complex type"); // DateTimeType 2394 case 913248982: return getReasonEnded(); // CodeableConcept 2395 case 3387378: return addNote(); // Annotation 2396 case -1201373865: return addDosageInstruction(); // MedicationOrderDosageInstructionComponent 2397 case 824620658: return getDispenseRequest(); // MedicationOrderDispenseRequestComponent 2398 case 826147581: return getSubstitution(); // MedicationOrderSubstitutionComponent 2399 case -486355964: return getPriorPrescription(); // Reference 2400 default: return super.makeProperty(hash, name); 2401 } 2402 2403 } 2404 2405 @Override 2406 public Base addChild(String name) throws FHIRException { 2407 if (name.equals("identifier")) { 2408 return addIdentifier(); 2409 } 2410 else if (name.equals("status")) { 2411 throw new FHIRException("Cannot call addChild on a primitive type MedicationOrder.status"); 2412 } 2413 else if (name.equals("medicationCodeableConcept")) { 2414 this.medication = new CodeableConcept(); 2415 return this.medication; 2416 } 2417 else if (name.equals("medicationReference")) { 2418 this.medication = new Reference(); 2419 return this.medication; 2420 } 2421 else if (name.equals("patient")) { 2422 this.patient = new Reference(); 2423 return this.patient; 2424 } 2425 else if (name.equals("encounter")) { 2426 this.encounter = new Reference(); 2427 return this.encounter; 2428 } 2429 else if (name.equals("dateWritten")) { 2430 throw new FHIRException("Cannot call addChild on a primitive type MedicationOrder.dateWritten"); 2431 } 2432 else if (name.equals("prescriber")) { 2433 this.prescriber = new Reference(); 2434 return this.prescriber; 2435 } 2436 else if (name.equals("reasonCode")) { 2437 return addReasonCode(); 2438 } 2439 else if (name.equals("reasonReference")) { 2440 return addReasonReference(); 2441 } 2442 else if (name.equals("dateEnded")) { 2443 throw new FHIRException("Cannot call addChild on a primitive type MedicationOrder.dateEnded"); 2444 } 2445 else if (name.equals("reasonEnded")) { 2446 this.reasonEnded = new CodeableConcept(); 2447 return this.reasonEnded; 2448 } 2449 else if (name.equals("note")) { 2450 return addNote(); 2451 } 2452 else if (name.equals("dosageInstruction")) { 2453 return addDosageInstruction(); 2454 } 2455 else if (name.equals("dispenseRequest")) { 2456 this.dispenseRequest = new MedicationOrderDispenseRequestComponent(); 2457 return this.dispenseRequest; 2458 } 2459 else if (name.equals("substitution")) { 2460 this.substitution = new MedicationOrderSubstitutionComponent(); 2461 return this.substitution; 2462 } 2463 else if (name.equals("priorPrescription")) { 2464 this.priorPrescription = new Reference(); 2465 return this.priorPrescription; 2466 } 2467 else 2468 return super.addChild(name); 2469 } 2470 2471 public String fhirType() { 2472 return "MedicationOrder"; 2473 2474 } 2475 2476 public MedicationOrder copy() { 2477 MedicationOrder dst = new MedicationOrder(); 2478 copyValues(dst); 2479 if (identifier != null) { 2480 dst.identifier = new ArrayList<Identifier>(); 2481 for (Identifier i : identifier) 2482 dst.identifier.add(i.copy()); 2483 }; 2484 dst.status = status == null ? null : status.copy(); 2485 dst.medication = medication == null ? null : medication.copy(); 2486 dst.patient = patient == null ? null : patient.copy(); 2487 dst.encounter = encounter == null ? null : encounter.copy(); 2488 dst.dateWritten = dateWritten == null ? null : dateWritten.copy(); 2489 dst.prescriber = prescriber == null ? null : prescriber.copy(); 2490 if (reasonCode != null) { 2491 dst.reasonCode = new ArrayList<CodeableConcept>(); 2492 for (CodeableConcept i : reasonCode) 2493 dst.reasonCode.add(i.copy()); 2494 }; 2495 if (reasonReference != null) { 2496 dst.reasonReference = new ArrayList<Reference>(); 2497 for (Reference i : reasonReference) 2498 dst.reasonReference.add(i.copy()); 2499 }; 2500 dst.dateEnded = dateEnded == null ? null : dateEnded.copy(); 2501 dst.reasonEnded = reasonEnded == null ? null : reasonEnded.copy(); 2502 if (note != null) { 2503 dst.note = new ArrayList<Annotation>(); 2504 for (Annotation i : note) 2505 dst.note.add(i.copy()); 2506 }; 2507 if (dosageInstruction != null) { 2508 dst.dosageInstruction = new ArrayList<MedicationOrderDosageInstructionComponent>(); 2509 for (MedicationOrderDosageInstructionComponent i : dosageInstruction) 2510 dst.dosageInstruction.add(i.copy()); 2511 }; 2512 dst.dispenseRequest = dispenseRequest == null ? null : dispenseRequest.copy(); 2513 dst.substitution = substitution == null ? null : substitution.copy(); 2514 dst.priorPrescription = priorPrescription == null ? null : priorPrescription.copy(); 2515 return dst; 2516 } 2517 2518 protected MedicationOrder typedCopy() { 2519 return copy(); 2520 } 2521 2522 @Override 2523 public boolean equalsDeep(Base other) { 2524 if (!super.equalsDeep(other)) 2525 return false; 2526 if (!(other instanceof MedicationOrder)) 2527 return false; 2528 MedicationOrder o = (MedicationOrder) other; 2529 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(medication, o.medication, true) 2530 && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true) && compareDeep(dateWritten, o.dateWritten, true) 2531 && compareDeep(prescriber, o.prescriber, true) && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true) 2532 && compareDeep(dateEnded, o.dateEnded, true) && compareDeep(reasonEnded, o.reasonEnded, true) && compareDeep(note, o.note, true) 2533 && compareDeep(dosageInstruction, o.dosageInstruction, true) && compareDeep(dispenseRequest, o.dispenseRequest, true) 2534 && compareDeep(substitution, o.substitution, true) && compareDeep(priorPrescription, o.priorPrescription, true) 2535 ; 2536 } 2537 2538 @Override 2539 public boolean equalsShallow(Base other) { 2540 if (!super.equalsShallow(other)) 2541 return false; 2542 if (!(other instanceof MedicationOrder)) 2543 return false; 2544 MedicationOrder o = (MedicationOrder) other; 2545 return compareValues(status, o.status, true) && compareValues(dateWritten, o.dateWritten, true) && compareValues(dateEnded, o.dateEnded, true) 2546 ; 2547 } 2548 2549 public boolean isEmpty() { 2550 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 2551 && (medication == null || medication.isEmpty()) && (patient == null || patient.isEmpty()) 2552 && (encounter == null || encounter.isEmpty()) && (dateWritten == null || dateWritten.isEmpty()) 2553 && (prescriber == null || prescriber.isEmpty()) && (reasonCode == null || reasonCode.isEmpty()) 2554 && (reasonReference == null || reasonReference.isEmpty()) && (dateEnded == null || dateEnded.isEmpty()) 2555 && (reasonEnded == null || reasonEnded.isEmpty()) && (note == null || note.isEmpty()) && (dosageInstruction == null || dosageInstruction.isEmpty()) 2556 && (dispenseRequest == null || dispenseRequest.isEmpty()) && (substitution == null || substitution.isEmpty()) 2557 && (priorPrescription == null || priorPrescription.isEmpty()); 2558 } 2559 2560 @Override 2561 public ResourceType getResourceType() { 2562 return ResourceType.MedicationOrder; 2563 } 2564 2565 /** 2566 * Search parameter: <b>medication</b> 2567 * <p> 2568 * Description: <b>Return administrations of this medication reference</b><br> 2569 * Type: <b>reference</b><br> 2570 * Path: <b>MedicationOrder.medicationReference</b><br> 2571 * </p> 2572 */ 2573 @SearchParamDefinition(name="medication", path="MedicationOrder.medication.as(Reference)", description="Return administrations of this medication reference", type="reference" ) 2574 public static final String SP_MEDICATION = "medication"; 2575 /** 2576 * <b>Fluent Client</b> search parameter constant for <b>medication</b> 2577 * <p> 2578 * Description: <b>Return administrations of this medication reference</b><br> 2579 * Type: <b>reference</b><br> 2580 * Path: <b>MedicationOrder.medicationReference</b><br> 2581 * </p> 2582 */ 2583 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION); 2584 2585/** 2586 * Constant for fluent queries to be used to add include statements. Specifies 2587 * the path value of "<b>MedicationOrder:medication</b>". 2588 */ 2589 public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationOrder:medication").toLocked(); 2590 2591 /** 2592 * Search parameter: <b>datewritten</b> 2593 * <p> 2594 * Description: <b>Return prescriptions written on this date</b><br> 2595 * Type: <b>date</b><br> 2596 * Path: <b>MedicationOrder.dateWritten</b><br> 2597 * </p> 2598 */ 2599 @SearchParamDefinition(name="datewritten", path="MedicationOrder.dateWritten", description="Return prescriptions written on this date", type="date" ) 2600 public static final String SP_DATEWRITTEN = "datewritten"; 2601 /** 2602 * <b>Fluent Client</b> search parameter constant for <b>datewritten</b> 2603 * <p> 2604 * Description: <b>Return prescriptions written on this date</b><br> 2605 * Type: <b>date</b><br> 2606 * Path: <b>MedicationOrder.dateWritten</b><br> 2607 * </p> 2608 */ 2609 public static final ca.uhn.fhir.rest.gclient.DateClientParam DATEWRITTEN = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATEWRITTEN); 2610 2611 /** 2612 * Search parameter: <b>patient</b> 2613 * <p> 2614 * Description: <b>The identity of a patient to list orders for</b><br> 2615 * Type: <b>reference</b><br> 2616 * Path: <b>MedicationOrder.patient</b><br> 2617 * </p> 2618 */ 2619 @SearchParamDefinition(name="patient", path="MedicationOrder.patient", description="The identity of a patient to list orders for", type="reference" ) 2620 public static final String SP_PATIENT = "patient"; 2621 /** 2622 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 2623 * <p> 2624 * Description: <b>The identity of a patient to list orders for</b><br> 2625 * Type: <b>reference</b><br> 2626 * Path: <b>MedicationOrder.patient</b><br> 2627 * </p> 2628 */ 2629 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 2630 2631/** 2632 * Constant for fluent queries to be used to add include statements. Specifies 2633 * the path value of "<b>MedicationOrder:patient</b>". 2634 */ 2635 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationOrder:patient").toLocked(); 2636 2637 /** 2638 * Search parameter: <b>status</b> 2639 * <p> 2640 * Description: <b>Status of the prescription</b><br> 2641 * Type: <b>token</b><br> 2642 * Path: <b>MedicationOrder.status</b><br> 2643 * </p> 2644 */ 2645 @SearchParamDefinition(name="status", path="MedicationOrder.status", description="Status of the prescription", type="token" ) 2646 public static final String SP_STATUS = "status"; 2647 /** 2648 * <b>Fluent Client</b> search parameter constant for <b>status</b> 2649 * <p> 2650 * Description: <b>Status of the prescription</b><br> 2651 * Type: <b>token</b><br> 2652 * Path: <b>MedicationOrder.status</b><br> 2653 * </p> 2654 */ 2655 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 2656 2657 /** 2658 * Search parameter: <b>prescriber</b> 2659 * <p> 2660 * Description: <b>Who ordered the medication(s)</b><br> 2661 * Type: <b>reference</b><br> 2662 * Path: <b>MedicationOrder.prescriber</b><br> 2663 * </p> 2664 */ 2665 @SearchParamDefinition(name="prescriber", path="MedicationOrder.prescriber", description="Who ordered the medication(s)", type="reference" ) 2666 public static final String SP_PRESCRIBER = "prescriber"; 2667 /** 2668 * <b>Fluent Client</b> search parameter constant for <b>prescriber</b> 2669 * <p> 2670 * Description: <b>Who ordered the medication(s)</b><br> 2671 * Type: <b>reference</b><br> 2672 * Path: <b>MedicationOrder.prescriber</b><br> 2673 * </p> 2674 */ 2675 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRESCRIBER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRESCRIBER); 2676 2677/** 2678 * Constant for fluent queries to be used to add include statements. Specifies 2679 * the path value of "<b>MedicationOrder:prescriber</b>". 2680 */ 2681 public static final ca.uhn.fhir.model.api.Include INCLUDE_PRESCRIBER = new ca.uhn.fhir.model.api.Include("MedicationOrder:prescriber").toLocked(); 2682 2683 /** 2684 * Search parameter: <b>code</b> 2685 * <p> 2686 * Description: <b>Return administrations of this medication code</b><br> 2687 * Type: <b>token</b><br> 2688 * Path: <b>MedicationOrder.medicationCodeableConcept</b><br> 2689 * </p> 2690 */ 2691 @SearchParamDefinition(name="code", path="MedicationOrder.medication.as(CodeableConcept)", description="Return administrations of this medication code", type="token" ) 2692 public static final String SP_CODE = "code"; 2693 /** 2694 * <b>Fluent Client</b> search parameter constant for <b>code</b> 2695 * <p> 2696 * Description: <b>Return administrations of this medication code</b><br> 2697 * Type: <b>token</b><br> 2698 * Path: <b>MedicationOrder.medicationCodeableConcept</b><br> 2699 * </p> 2700 */ 2701 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 2702 2703 /** 2704 * Search parameter: <b>encounter</b> 2705 * <p> 2706 * Description: <b>Return prescriptions with this encounter identifier</b><br> 2707 * Type: <b>reference</b><br> 2708 * Path: <b>MedicationOrder.encounter</b><br> 2709 * </p> 2710 */ 2711 @SearchParamDefinition(name="encounter", path="MedicationOrder.encounter", description="Return prescriptions with this encounter identifier", type="reference" ) 2712 public static final String SP_ENCOUNTER = "encounter"; 2713 /** 2714 * <b>Fluent Client</b> search parameter constant for <b>encounter</b> 2715 * <p> 2716 * Description: <b>Return prescriptions with this encounter identifier</b><br> 2717 * Type: <b>reference</b><br> 2718 * Path: <b>MedicationOrder.encounter</b><br> 2719 * </p> 2720 */ 2721 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER); 2722 2723/** 2724 * Constant for fluent queries to be used to add include statements. Specifies 2725 * the path value of "<b>MedicationOrder:encounter</b>". 2726 */ 2727 public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("MedicationOrder:encounter").toLocked(); 2728 2729 /** 2730 * Search parameter: <b>identifier</b> 2731 * <p> 2732 * Description: <b>Return prescriptions with this external identifier</b><br> 2733 * Type: <b>token</b><br> 2734 * Path: <b>MedicationOrder.identifier</b><br> 2735 * </p> 2736 */ 2737 @SearchParamDefinition(name="identifier", path="MedicationOrder.identifier", description="Return prescriptions with this external identifier", type="token" ) 2738 public static final String SP_IDENTIFIER = "identifier"; 2739 /** 2740 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 2741 * <p> 2742 * Description: <b>Return prescriptions with this external identifier</b><br> 2743 * Type: <b>token</b><br> 2744 * Path: <b>MedicationOrder.identifier</b><br> 2745 * </p> 2746 */ 2747 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 2748 2749 2750}