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