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