001package org.hl7.fhir.dstu2016may.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 036import java.util.ArrayList; 037import java.util.List; 038 039import org.hl7.fhir.exceptions.FHIRException; 040import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 041import org.hl7.fhir.utilities.Utilities; 042 043import ca.uhn.fhir.model.api.annotation.Block; 044import ca.uhn.fhir.model.api.annotation.Child; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.ResourceDef; 047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 048/** 049 * Describes the event of a patient consuming or otherwise being administered a medication. This may be as simple as swallowing a tablet or it may be a long running infusion. Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner. 050 */ 051@ResourceDef(name="MedicationAdministration", profile="http://hl7.org/fhir/Profile/MedicationAdministration") 052public class MedicationAdministration extends DomainResource { 053 054 public enum MedicationAdministrationStatus { 055 /** 056 * The administration has started but has not yet completed. 057 */ 058 INPROGRESS, 059 /** 060 * Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called "suspended". 061 */ 062 ONHOLD, 063 /** 064 * All actions that are implied by the administration have occurred. 065 */ 066 COMPLETED, 067 /** 068 * The administration was entered in error and therefore nullified. 069 */ 070 ENTEREDINERROR, 071 /** 072 * Actions implied by the administration have been permanently halted, before all of them occurred. 073 */ 074 STOPPED, 075 /** 076 * added to help the parsers 077 */ 078 NULL; 079 public static MedicationAdministrationStatus fromCode(String codeString) throws FHIRException { 080 if (codeString == null || "".equals(codeString)) 081 return null; 082 if ("in-progress".equals(codeString)) 083 return INPROGRESS; 084 if ("on-hold".equals(codeString)) 085 return ONHOLD; 086 if ("completed".equals(codeString)) 087 return COMPLETED; 088 if ("entered-in-error".equals(codeString)) 089 return ENTEREDINERROR; 090 if ("stopped".equals(codeString)) 091 return STOPPED; 092 throw new FHIRException("Unknown MedicationAdministrationStatus code '"+codeString+"'"); 093 } 094 public String toCode() { 095 switch (this) { 096 case INPROGRESS: return "in-progress"; 097 case ONHOLD: return "on-hold"; 098 case COMPLETED: return "completed"; 099 case ENTEREDINERROR: return "entered-in-error"; 100 case STOPPED: return "stopped"; 101 case NULL: return null; 102 default: return "?"; 103 } 104 } 105 public String getSystem() { 106 switch (this) { 107 case INPROGRESS: return "http://hl7.org/fhir/medication-admin-status"; 108 case ONHOLD: return "http://hl7.org/fhir/medication-admin-status"; 109 case COMPLETED: return "http://hl7.org/fhir/medication-admin-status"; 110 case ENTEREDINERROR: return "http://hl7.org/fhir/medication-admin-status"; 111 case STOPPED: return "http://hl7.org/fhir/medication-admin-status"; 112 case NULL: return null; 113 default: return "?"; 114 } 115 } 116 public String getDefinition() { 117 switch (this) { 118 case INPROGRESS: return "The administration has started but has not yet completed."; 119 case ONHOLD: return "Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called \"suspended\"."; 120 case COMPLETED: return "All actions that are implied by the administration have occurred."; 121 case ENTEREDINERROR: return "The administration was entered in error and therefore nullified."; 122 case STOPPED: return "Actions implied by the administration have been permanently halted, before all of them occurred."; 123 case NULL: return null; 124 default: return "?"; 125 } 126 } 127 public String getDisplay() { 128 switch (this) { 129 case INPROGRESS: return "In Progress"; 130 case ONHOLD: return "On Hold"; 131 case COMPLETED: return "Completed"; 132 case ENTEREDINERROR: return "Entered in Error"; 133 case STOPPED: return "Stopped"; 134 case NULL: return null; 135 default: return "?"; 136 } 137 } 138 } 139 140 public static class MedicationAdministrationStatusEnumFactory implements EnumFactory<MedicationAdministrationStatus> { 141 public MedicationAdministrationStatus fromCode(String codeString) throws IllegalArgumentException { 142 if (codeString == null || "".equals(codeString)) 143 if (codeString == null || "".equals(codeString)) 144 return null; 145 if ("in-progress".equals(codeString)) 146 return MedicationAdministrationStatus.INPROGRESS; 147 if ("on-hold".equals(codeString)) 148 return MedicationAdministrationStatus.ONHOLD; 149 if ("completed".equals(codeString)) 150 return MedicationAdministrationStatus.COMPLETED; 151 if ("entered-in-error".equals(codeString)) 152 return MedicationAdministrationStatus.ENTEREDINERROR; 153 if ("stopped".equals(codeString)) 154 return MedicationAdministrationStatus.STOPPED; 155 throw new IllegalArgumentException("Unknown MedicationAdministrationStatus code '"+codeString+"'"); 156 } 157 public Enumeration<MedicationAdministrationStatus> fromType(Base code) throws FHIRException { 158 if (code == null || code.isEmpty()) 159 return null; 160 String codeString = ((PrimitiveType) code).asStringValue(); 161 if (codeString == null || "".equals(codeString)) 162 return null; 163 if ("in-progress".equals(codeString)) 164 return new Enumeration<MedicationAdministrationStatus>(this, MedicationAdministrationStatus.INPROGRESS); 165 if ("on-hold".equals(codeString)) 166 return new Enumeration<MedicationAdministrationStatus>(this, MedicationAdministrationStatus.ONHOLD); 167 if ("completed".equals(codeString)) 168 return new Enumeration<MedicationAdministrationStatus>(this, MedicationAdministrationStatus.COMPLETED); 169 if ("entered-in-error".equals(codeString)) 170 return new Enumeration<MedicationAdministrationStatus>(this, MedicationAdministrationStatus.ENTEREDINERROR); 171 if ("stopped".equals(codeString)) 172 return new Enumeration<MedicationAdministrationStatus>(this, MedicationAdministrationStatus.STOPPED); 173 throw new FHIRException("Unknown MedicationAdministrationStatus code '"+codeString+"'"); 174 } 175 public String toCode(MedicationAdministrationStatus code) { 176 if (code == MedicationAdministrationStatus.INPROGRESS) 177 return "in-progress"; 178 if (code == MedicationAdministrationStatus.ONHOLD) 179 return "on-hold"; 180 if (code == MedicationAdministrationStatus.COMPLETED) 181 return "completed"; 182 if (code == MedicationAdministrationStatus.ENTEREDINERROR) 183 return "entered-in-error"; 184 if (code == MedicationAdministrationStatus.STOPPED) 185 return "stopped"; 186 return "?"; 187 } 188 public String toSystem(MedicationAdministrationStatus code) { 189 return code.getSystem(); 190 } 191 } 192 193 @Block() 194 public static class MedicationAdministrationDosageComponent extends BackboneElement implements IBaseBackboneElement { 195 /** 196 * Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. 197 */ 198 @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 199 @Description(shortDefinition="Free text dosage instructions e.g. SIG", formalDefinition="Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication." ) 200 protected StringType text; 201 202 /** 203 * A coded specification of the anatomic site where the medication first entered the body. For example, "left arm". 204 */ 205 @Child(name = "site", type = {CodeableConcept.class, BodySite.class}, order=2, min=0, max=1, modifier=false, summary=true) 206 @Description(shortDefinition="Body site administered to", formalDefinition="A coded specification of the anatomic site where the medication first entered the body. For example, \"left arm\"." ) 207 protected Type site; 208 209 /** 210 * A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient. For example, topical, intravenous, etc. 211 */ 212 @Child(name = "route", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 213 @Description(shortDefinition="Path of substance into body", formalDefinition="A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient. For example, topical, intravenous, etc." ) 214 protected CodeableConcept route; 215 216 /** 217 * A coded value indicating the method by which the medication is intended to be or was introduced into or on the body. This attribute will most often NOT be populated. It is most commonly used for injections. For example, Slow Push, Deep IV. 218 */ 219 @Child(name = "method", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 220 @Description(shortDefinition="How drug was administered", formalDefinition="A coded value indicating the method by which the medication is intended to be or was introduced into or on the body. This attribute will most often NOT be populated. It is most commonly used for injections. For example, Slow Push, Deep IV." ) 221 protected CodeableConcept method; 222 223 /** 224 * The amount of the medication given at one administration event. Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection. 225 */ 226 @Child(name = "quantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=true) 227 @Description(shortDefinition="Amount administered in one dose", formalDefinition="The amount of the medication given at one administration event. Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection." ) 228 protected SimpleQuantity quantity; 229 230 /** 231 * 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. 232 */ 233 @Child(name = "rate", type = {Ratio.class, Range.class}, order=6, min=0, max=1, modifier=false, summary=true) 234 @Description(shortDefinition="Dose quantity 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." ) 235 protected Type rate; 236 237 private static final long serialVersionUID = -1772198879L; 238 239 /** 240 * Constructor 241 */ 242 public MedicationAdministrationDosageComponent() { 243 super(); 244 } 245 246 /** 247 * @return {@link #text} (Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 248 */ 249 public StringType getTextElement() { 250 if (this.text == null) 251 if (Configuration.errorOnAutoCreate()) 252 throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.text"); 253 else if (Configuration.doAutoCreate()) 254 this.text = new StringType(); // bb 255 return this.text; 256 } 257 258 public boolean hasTextElement() { 259 return this.text != null && !this.text.isEmpty(); 260 } 261 262 public boolean hasText() { 263 return this.text != null && !this.text.isEmpty(); 264 } 265 266 /** 267 * @param value {@link #text} (Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 268 */ 269 public MedicationAdministrationDosageComponent setTextElement(StringType value) { 270 this.text = value; 271 return this; 272 } 273 274 /** 275 * @return Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. 276 */ 277 public String getText() { 278 return this.text == null ? null : this.text.getValue(); 279 } 280 281 /** 282 * @param value Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. 283 */ 284 public MedicationAdministrationDosageComponent setText(String value) { 285 if (Utilities.noString(value)) 286 this.text = null; 287 else { 288 if (this.text == null) 289 this.text = new StringType(); 290 this.text.setValue(value); 291 } 292 return this; 293 } 294 295 /** 296 * @return {@link #site} (A coded specification of the anatomic site where the medication first entered the body. For example, "left arm".) 297 */ 298 public Type getSite() { 299 return this.site; 300 } 301 302 /** 303 * @return {@link #site} (A coded specification of the anatomic site where the medication first entered the body. For example, "left arm".) 304 */ 305 public CodeableConcept getSiteCodeableConcept() throws FHIRException { 306 if (!(this.site instanceof CodeableConcept)) 307 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.site.getClass().getName()+" was encountered"); 308 return (CodeableConcept) this.site; 309 } 310 311 public boolean hasSiteCodeableConcept() { 312 return this.site instanceof CodeableConcept; 313 } 314 315 /** 316 * @return {@link #site} (A coded specification of the anatomic site where the medication first entered the body. For example, "left arm".) 317 */ 318 public Reference getSiteReference() throws FHIRException { 319 if (!(this.site instanceof Reference)) 320 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.site.getClass().getName()+" was encountered"); 321 return (Reference) this.site; 322 } 323 324 public boolean hasSiteReference() { 325 return this.site instanceof Reference; 326 } 327 328 public boolean hasSite() { 329 return this.site != null && !this.site.isEmpty(); 330 } 331 332 /** 333 * @param value {@link #site} (A coded specification of the anatomic site where the medication first entered the body. For example, "left arm".) 334 */ 335 public MedicationAdministrationDosageComponent setSite(Type value) { 336 this.site = value; 337 return this; 338 } 339 340 /** 341 * @return {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient. For example, topical, intravenous, etc.) 342 */ 343 public CodeableConcept getRoute() { 344 if (this.route == null) 345 if (Configuration.errorOnAutoCreate()) 346 throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.route"); 347 else if (Configuration.doAutoCreate()) 348 this.route = new CodeableConcept(); // cc 349 return this.route; 350 } 351 352 public boolean hasRoute() { 353 return this.route != null && !this.route.isEmpty(); 354 } 355 356 /** 357 * @param value {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient. For example, topical, intravenous, etc.) 358 */ 359 public MedicationAdministrationDosageComponent setRoute(CodeableConcept value) { 360 this.route = value; 361 return this; 362 } 363 364 /** 365 * @return {@link #method} (A coded value indicating the method by which the medication is intended to be or was introduced into or on the body. This attribute will most often NOT be populated. It is most commonly used for injections. For example, Slow Push, Deep IV.) 366 */ 367 public CodeableConcept getMethod() { 368 if (this.method == null) 369 if (Configuration.errorOnAutoCreate()) 370 throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.method"); 371 else if (Configuration.doAutoCreate()) 372 this.method = new CodeableConcept(); // cc 373 return this.method; 374 } 375 376 public boolean hasMethod() { 377 return this.method != null && !this.method.isEmpty(); 378 } 379 380 /** 381 * @param value {@link #method} (A coded value indicating the method by which the medication is intended to be or was introduced into or on the body. This attribute will most often NOT be populated. It is most commonly used for injections. For example, Slow Push, Deep IV.) 382 */ 383 public MedicationAdministrationDosageComponent setMethod(CodeableConcept value) { 384 this.method = value; 385 return this; 386 } 387 388 /** 389 * @return {@link #quantity} (The amount of the medication given at one administration event. Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.) 390 */ 391 public SimpleQuantity getQuantity() { 392 if (this.quantity == null) 393 if (Configuration.errorOnAutoCreate()) 394 throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.quantity"); 395 else if (Configuration.doAutoCreate()) 396 this.quantity = new SimpleQuantity(); // cc 397 return this.quantity; 398 } 399 400 public boolean hasQuantity() { 401 return this.quantity != null && !this.quantity.isEmpty(); 402 } 403 404 /** 405 * @param value {@link #quantity} (The amount of the medication given at one administration event. Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.) 406 */ 407 public MedicationAdministrationDosageComponent setQuantity(SimpleQuantity value) { 408 this.quantity = value; 409 return this; 410 } 411 412 /** 413 * @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.) 414 */ 415 public Type getRate() { 416 return this.rate; 417 } 418 419 /** 420 * @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.) 421 */ 422 public Ratio getRateRatio() throws FHIRException { 423 if (!(this.rate instanceof Ratio)) 424 throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered"); 425 return (Ratio) this.rate; 426 } 427 428 public boolean hasRateRatio() { 429 return this.rate instanceof Ratio; 430 } 431 432 /** 433 * @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.) 434 */ 435 public Range getRateRange() throws FHIRException { 436 if (!(this.rate instanceof Range)) 437 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.rate.getClass().getName()+" was encountered"); 438 return (Range) this.rate; 439 } 440 441 public boolean hasRateRange() { 442 return this.rate instanceof Range; 443 } 444 445 public boolean hasRate() { 446 return this.rate != null && !this.rate.isEmpty(); 447 } 448 449 /** 450 * @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.) 451 */ 452 public MedicationAdministrationDosageComponent setRate(Type value) { 453 this.rate = value; 454 return this; 455 } 456 457 protected void listChildren(List<Property> childrenList) { 458 super.listChildren(childrenList); 459 childrenList.add(new Property("text", "string", "Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.", 0, java.lang.Integer.MAX_VALUE, text)); 460 childrenList.add(new Property("site[x]", "CodeableConcept|Reference(BodySite)", "A coded specification of the anatomic site where the medication first entered the body. For example, \"left arm\".", 0, java.lang.Integer.MAX_VALUE, site)); 461 childrenList.add(new Property("route", "CodeableConcept", "A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient. For example, topical, intravenous, etc.", 0, java.lang.Integer.MAX_VALUE, route)); 462 childrenList.add(new Property("method", "CodeableConcept", "A coded value indicating the method by which the medication is intended to be or was introduced into or on the body. This attribute will most often NOT be populated. It is most commonly used for injections. For example, Slow Push, Deep IV.", 0, java.lang.Integer.MAX_VALUE, method)); 463 childrenList.add(new Property("quantity", "SimpleQuantity", "The amount of the medication given at one administration event. Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.", 0, java.lang.Integer.MAX_VALUE, quantity)); 464 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)); 465 } 466 467 @Override 468 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 469 switch (hash) { 470 case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType 471 case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // Type 472 case 108704329: /*route*/ return this.route == null ? new Base[0] : new Base[] {this.route}; // CodeableConcept 473 case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept 474 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 475 case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // Type 476 default: return super.getProperty(hash, name, checkValid); 477 } 478 479 } 480 481 @Override 482 public void setProperty(int hash, String name, Base value) throws FHIRException { 483 switch (hash) { 484 case 3556653: // text 485 this.text = castToString(value); // StringType 486 break; 487 case 3530567: // site 488 this.site = (Type) value; // Type 489 break; 490 case 108704329: // route 491 this.route = castToCodeableConcept(value); // CodeableConcept 492 break; 493 case -1077554975: // method 494 this.method = castToCodeableConcept(value); // CodeableConcept 495 break; 496 case -1285004149: // quantity 497 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 498 break; 499 case 3493088: // rate 500 this.rate = (Type) value; // Type 501 break; 502 default: super.setProperty(hash, name, value); 503 } 504 505 } 506 507 @Override 508 public void setProperty(String name, Base value) throws FHIRException { 509 if (name.equals("text")) 510 this.text = castToString(value); // StringType 511 else if (name.equals("site[x]")) 512 this.site = (Type) value; // Type 513 else if (name.equals("route")) 514 this.route = castToCodeableConcept(value); // CodeableConcept 515 else if (name.equals("method")) 516 this.method = castToCodeableConcept(value); // CodeableConcept 517 else if (name.equals("quantity")) 518 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 519 else if (name.equals("rate[x]")) 520 this.rate = (Type) value; // Type 521 else 522 super.setProperty(name, value); 523 } 524 525 @Override 526 public Base makeProperty(int hash, String name) throws FHIRException { 527 switch (hash) { 528 case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType 529 case 2099997657: return getSite(); // Type 530 case 108704329: return getRoute(); // CodeableConcept 531 case -1077554975: return getMethod(); // CodeableConcept 532 case -1285004149: return getQuantity(); // SimpleQuantity 533 case 983460768: return getRate(); // Type 534 default: return super.makeProperty(hash, name); 535 } 536 537 } 538 539 @Override 540 public Base addChild(String name) throws FHIRException { 541 if (name.equals("text")) { 542 throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.text"); 543 } 544 else if (name.equals("siteCodeableConcept")) { 545 this.site = new CodeableConcept(); 546 return this.site; 547 } 548 else if (name.equals("siteReference")) { 549 this.site = new Reference(); 550 return this.site; 551 } 552 else if (name.equals("route")) { 553 this.route = new CodeableConcept(); 554 return this.route; 555 } 556 else if (name.equals("method")) { 557 this.method = new CodeableConcept(); 558 return this.method; 559 } 560 else if (name.equals("quantity")) { 561 this.quantity = new SimpleQuantity(); 562 return this.quantity; 563 } 564 else if (name.equals("rateRatio")) { 565 this.rate = new Ratio(); 566 return this.rate; 567 } 568 else if (name.equals("rateRange")) { 569 this.rate = new Range(); 570 return this.rate; 571 } 572 else 573 return super.addChild(name); 574 } 575 576 public MedicationAdministrationDosageComponent copy() { 577 MedicationAdministrationDosageComponent dst = new MedicationAdministrationDosageComponent(); 578 copyValues(dst); 579 dst.text = text == null ? null : text.copy(); 580 dst.site = site == null ? null : site.copy(); 581 dst.route = route == null ? null : route.copy(); 582 dst.method = method == null ? null : method.copy(); 583 dst.quantity = quantity == null ? null : quantity.copy(); 584 dst.rate = rate == null ? null : rate.copy(); 585 return dst; 586 } 587 588 @Override 589 public boolean equalsDeep(Base other) { 590 if (!super.equalsDeep(other)) 591 return false; 592 if (!(other instanceof MedicationAdministrationDosageComponent)) 593 return false; 594 MedicationAdministrationDosageComponent o = (MedicationAdministrationDosageComponent) other; 595 return compareDeep(text, o.text, true) && compareDeep(site, o.site, true) && compareDeep(route, o.route, true) 596 && compareDeep(method, o.method, true) && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true) 597 ; 598 } 599 600 @Override 601 public boolean equalsShallow(Base other) { 602 if (!super.equalsShallow(other)) 603 return false; 604 if (!(other instanceof MedicationAdministrationDosageComponent)) 605 return false; 606 MedicationAdministrationDosageComponent o = (MedicationAdministrationDosageComponent) other; 607 return compareValues(text, o.text, true); 608 } 609 610 public boolean isEmpty() { 611 return super.isEmpty() && (text == null || text.isEmpty()) && (site == null || site.isEmpty()) 612 && (route == null || route.isEmpty()) && (method == null || method.isEmpty()) && (quantity == null || quantity.isEmpty()) 613 && (rate == null || rate.isEmpty()); 614 } 615 616 public String fhirType() { 617 return "MedicationAdministration.dosage"; 618 619 } 620 621 } 622 623 /** 624 * External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource. The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event. Particularly important if these records have to be updated. 625 */ 626 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 627 @Description(shortDefinition="External identifier", formalDefinition="External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource. The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event. Particularly important if these records have to be updated." ) 628 protected List<Identifier> identifier; 629 630 /** 631 * Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way. 632 */ 633 @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 634 @Description(shortDefinition="in-progress | on-hold | completed | entered-in-error | stopped", formalDefinition="Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way." ) 635 protected Enumeration<MedicationAdministrationStatus> status; 636 637 /** 638 * Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications. 639 */ 640 @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=2, min=1, max=1, modifier=false, summary=true) 641 @Description(shortDefinition="What was administered", formalDefinition="Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications." ) 642 protected Type medication; 643 644 /** 645 * The person or animal receiving the medication. 646 */ 647 @Child(name = "patient", type = {Patient.class}, order=3, min=1, max=1, modifier=false, summary=true) 648 @Description(shortDefinition="Who received medication", formalDefinition="The person or animal receiving the medication." ) 649 protected Reference patient; 650 651 /** 652 * The actual object that is the target of the reference (The person or animal receiving the medication.) 653 */ 654 protected Patient patientTarget; 655 656 /** 657 * The visit, admission or other contact between patient and health care provider the medication administration was performed as part of. 658 */ 659 @Child(name = "encounter", type = {Encounter.class}, order=4, min=0, max=1, modifier=false, summary=true) 660 @Description(shortDefinition="Encounter administered as part of", formalDefinition="The visit, admission or other contact between patient and health care provider the medication administration was performed as part of." ) 661 protected Reference encounter; 662 663 /** 664 * The actual object that is the target of the reference (The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.) 665 */ 666 protected Encounter encounterTarget; 667 668 /** 669 * A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate. 670 */ 671 @Child(name = "effectiveTime", type = {DateTimeType.class, Period.class}, order=5, min=1, max=1, modifier=false, summary=true) 672 @Description(shortDefinition="Start and end time of administration", formalDefinition="A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate." ) 673 protected Type effectiveTime; 674 675 /** 676 * The individual who was responsible for giving the medication to the patient. 677 */ 678 @Child(name = "practitioner", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=6, min=0, max=1, modifier=false, summary=true) 679 @Description(shortDefinition="Who administered substance", formalDefinition="The individual who was responsible for giving the medication to the patient." ) 680 protected Reference practitioner; 681 682 /** 683 * The actual object that is the target of the reference (The individual who was responsible for giving the medication to the patient.) 684 */ 685 protected Resource practitionerTarget; 686 687 /** 688 * The original request, instruction or authority to perform the administration. 689 */ 690 @Child(name = "prescription", type = {MedicationOrder.class}, order=7, min=0, max=1, modifier=false, summary=true) 691 @Description(shortDefinition="Order administration performed against", formalDefinition="The original request, instruction or authority to perform the administration." ) 692 protected Reference prescription; 693 694 /** 695 * The actual object that is the target of the reference (The original request, instruction or authority to perform the administration.) 696 */ 697 protected MedicationOrder prescriptionTarget; 698 699 /** 700 * Set this to true if the record is saying that the medication was NOT administered. 701 */ 702 @Child(name = "wasNotGiven", type = {BooleanType.class}, order=8, min=0, max=1, modifier=true, summary=true) 703 @Description(shortDefinition="True if medication not administered", formalDefinition="Set this to true if the record is saying that the medication was NOT administered." ) 704 protected BooleanType wasNotGiven; 705 706 /** 707 * A code indicating why the administration was not performed. 708 */ 709 @Child(name = "reasonNotGiven", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 710 @Description(shortDefinition="Reason administration not performed", formalDefinition="A code indicating why the administration was not performed." ) 711 protected List<CodeableConcept> reasonNotGiven; 712 713 /** 714 * A code indicating why the medication was given. 715 */ 716 @Child(name = "reasonGiven", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 717 @Description(shortDefinition="Reason administration performed", formalDefinition="A code indicating why the medication was given." ) 718 protected List<CodeableConcept> reasonGiven; 719 720 /** 721 * The device used in administering the medication to the patient. For example, a particular infusion pump. 722 */ 723 @Child(name = "device", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 724 @Description(shortDefinition="Device used to administer", formalDefinition="The device used in administering the medication to the patient. For example, a particular infusion pump." ) 725 protected List<Reference> device; 726 /** 727 * The actual objects that are the target of the reference (The device used in administering the medication to the patient. For example, a particular infusion pump.) 728 */ 729 protected List<Device> deviceTarget; 730 731 732 /** 733 * Extra information about the medication administration that is not conveyed by the other attributes. 734 */ 735 @Child(name = "note", type = {Annotation.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 736 @Description(shortDefinition="Information about the administration", formalDefinition="Extra information about the medication administration that is not conveyed by the other attributes." ) 737 protected List<Annotation> note; 738 739 /** 740 * Describes the medication dosage information details e.g. dose, rate, site, route, etc. 741 */ 742 @Child(name = "dosage", type = {}, order=13, min=0, max=1, modifier=false, summary=true) 743 @Description(shortDefinition="Details of how medication was taken", formalDefinition="Describes the medication dosage information details e.g. dose, rate, site, route, etc." ) 744 protected MedicationAdministrationDosageComponent dosage; 745 746 private static final long serialVersionUID = 1357790003L; 747 748 /** 749 * Constructor 750 */ 751 public MedicationAdministration() { 752 super(); 753 } 754 755 /** 756 * Constructor 757 */ 758 public MedicationAdministration(Enumeration<MedicationAdministrationStatus> status, Type medication, Reference patient, Type effectiveTime) { 759 super(); 760 this.status = status; 761 this.medication = medication; 762 this.patient = patient; 763 this.effectiveTime = effectiveTime; 764 } 765 766 /** 767 * @return {@link #identifier} (External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource. The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event. Particularly important if these records have to be updated.) 768 */ 769 public List<Identifier> getIdentifier() { 770 if (this.identifier == null) 771 this.identifier = new ArrayList<Identifier>(); 772 return this.identifier; 773 } 774 775 public boolean hasIdentifier() { 776 if (this.identifier == null) 777 return false; 778 for (Identifier item : this.identifier) 779 if (!item.isEmpty()) 780 return true; 781 return false; 782 } 783 784 /** 785 * @return {@link #identifier} (External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource. The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event. Particularly important if these records have to be updated.) 786 */ 787 // syntactic sugar 788 public Identifier addIdentifier() { //3 789 Identifier t = new Identifier(); 790 if (this.identifier == null) 791 this.identifier = new ArrayList<Identifier>(); 792 this.identifier.add(t); 793 return t; 794 } 795 796 // syntactic sugar 797 public MedicationAdministration addIdentifier(Identifier t) { //3 798 if (t == null) 799 return this; 800 if (this.identifier == null) 801 this.identifier = new ArrayList<Identifier>(); 802 this.identifier.add(t); 803 return this; 804 } 805 806 /** 807 * @return {@link #status} (Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 808 */ 809 public Enumeration<MedicationAdministrationStatus> getStatusElement() { 810 if (this.status == null) 811 if (Configuration.errorOnAutoCreate()) 812 throw new Error("Attempt to auto-create MedicationAdministration.status"); 813 else if (Configuration.doAutoCreate()) 814 this.status = new Enumeration<MedicationAdministrationStatus>(new MedicationAdministrationStatusEnumFactory()); // bb 815 return this.status; 816 } 817 818 public boolean hasStatusElement() { 819 return this.status != null && !this.status.isEmpty(); 820 } 821 822 public boolean hasStatus() { 823 return this.status != null && !this.status.isEmpty(); 824 } 825 826 /** 827 * @param value {@link #status} (Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 828 */ 829 public MedicationAdministration setStatusElement(Enumeration<MedicationAdministrationStatus> value) { 830 this.status = value; 831 return this; 832 } 833 834 /** 835 * @return Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way. 836 */ 837 public MedicationAdministrationStatus getStatus() { 838 return this.status == null ? null : this.status.getValue(); 839 } 840 841 /** 842 * @param value Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way. 843 */ 844 public MedicationAdministration setStatus(MedicationAdministrationStatus value) { 845 if (this.status == null) 846 this.status = new Enumeration<MedicationAdministrationStatus>(new MedicationAdministrationStatusEnumFactory()); 847 this.status.setValue(value); 848 return this; 849 } 850 851 /** 852 * @return {@link #medication} (Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 853 */ 854 public Type getMedication() { 855 return this.medication; 856 } 857 858 /** 859 * @return {@link #medication} (Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 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 that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 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 that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 890 */ 891 public MedicationAdministration setMedication(Type value) { 892 this.medication = value; 893 return this; 894 } 895 896 /** 897 * @return {@link #patient} (The person or animal receiving the medication.) 898 */ 899 public Reference getPatient() { 900 if (this.patient == null) 901 if (Configuration.errorOnAutoCreate()) 902 throw new Error("Attempt to auto-create MedicationAdministration.patient"); 903 else if (Configuration.doAutoCreate()) 904 this.patient = new Reference(); // cc 905 return this.patient; 906 } 907 908 public boolean hasPatient() { 909 return this.patient != null && !this.patient.isEmpty(); 910 } 911 912 /** 913 * @param value {@link #patient} (The person or animal receiving the medication.) 914 */ 915 public MedicationAdministration setPatient(Reference value) { 916 this.patient = value; 917 return this; 918 } 919 920 /** 921 * @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. (The person or animal receiving the medication.) 922 */ 923 public Patient getPatientTarget() { 924 if (this.patientTarget == null) 925 if (Configuration.errorOnAutoCreate()) 926 throw new Error("Attempt to auto-create MedicationAdministration.patient"); 927 else if (Configuration.doAutoCreate()) 928 this.patientTarget = new Patient(); // aa 929 return this.patientTarget; 930 } 931 932 /** 933 * @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. (The person or animal receiving the medication.) 934 */ 935 public MedicationAdministration setPatientTarget(Patient value) { 936 this.patientTarget = value; 937 return this; 938 } 939 940 /** 941 * @return {@link #encounter} (The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.) 942 */ 943 public Reference getEncounter() { 944 if (this.encounter == null) 945 if (Configuration.errorOnAutoCreate()) 946 throw new Error("Attempt to auto-create MedicationAdministration.encounter"); 947 else if (Configuration.doAutoCreate()) 948 this.encounter = new Reference(); // cc 949 return this.encounter; 950 } 951 952 public boolean hasEncounter() { 953 return this.encounter != null && !this.encounter.isEmpty(); 954 } 955 956 /** 957 * @param value {@link #encounter} (The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.) 958 */ 959 public MedicationAdministration setEncounter(Reference value) { 960 this.encounter = value; 961 return this; 962 } 963 964 /** 965 * @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. (The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.) 966 */ 967 public Encounter getEncounterTarget() { 968 if (this.encounterTarget == null) 969 if (Configuration.errorOnAutoCreate()) 970 throw new Error("Attempt to auto-create MedicationAdministration.encounter"); 971 else if (Configuration.doAutoCreate()) 972 this.encounterTarget = new Encounter(); // aa 973 return this.encounterTarget; 974 } 975 976 /** 977 * @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. (The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.) 978 */ 979 public MedicationAdministration setEncounterTarget(Encounter value) { 980 this.encounterTarget = value; 981 return this; 982 } 983 984 /** 985 * @return {@link #effectiveTime} (A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.) 986 */ 987 public Type getEffectiveTime() { 988 return this.effectiveTime; 989 } 990 991 /** 992 * @return {@link #effectiveTime} (A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.) 993 */ 994 public DateTimeType getEffectiveTimeDateTimeType() throws FHIRException { 995 if (!(this.effectiveTime instanceof DateTimeType)) 996 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effectiveTime.getClass().getName()+" was encountered"); 997 return (DateTimeType) this.effectiveTime; 998 } 999 1000 public boolean hasEffectiveTimeDateTimeType() { 1001 return this.effectiveTime instanceof DateTimeType; 1002 } 1003 1004 /** 1005 * @return {@link #effectiveTime} (A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.) 1006 */ 1007 public Period getEffectiveTimePeriod() throws FHIRException { 1008 if (!(this.effectiveTime instanceof Period)) 1009 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effectiveTime.getClass().getName()+" was encountered"); 1010 return (Period) this.effectiveTime; 1011 } 1012 1013 public boolean hasEffectiveTimePeriod() { 1014 return this.effectiveTime instanceof Period; 1015 } 1016 1017 public boolean hasEffectiveTime() { 1018 return this.effectiveTime != null && !this.effectiveTime.isEmpty(); 1019 } 1020 1021 /** 1022 * @param value {@link #effectiveTime} (A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.) 1023 */ 1024 public MedicationAdministration setEffectiveTime(Type value) { 1025 this.effectiveTime = value; 1026 return this; 1027 } 1028 1029 /** 1030 * @return {@link #practitioner} (The individual who was responsible for giving the medication to the patient.) 1031 */ 1032 public Reference getPractitioner() { 1033 if (this.practitioner == null) 1034 if (Configuration.errorOnAutoCreate()) 1035 throw new Error("Attempt to auto-create MedicationAdministration.practitioner"); 1036 else if (Configuration.doAutoCreate()) 1037 this.practitioner = new Reference(); // cc 1038 return this.practitioner; 1039 } 1040 1041 public boolean hasPractitioner() { 1042 return this.practitioner != null && !this.practitioner.isEmpty(); 1043 } 1044 1045 /** 1046 * @param value {@link #practitioner} (The individual who was responsible for giving the medication to the patient.) 1047 */ 1048 public MedicationAdministration setPractitioner(Reference value) { 1049 this.practitioner = value; 1050 return this; 1051 } 1052 1053 /** 1054 * @return {@link #practitioner} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The individual who was responsible for giving the medication to the patient.) 1055 */ 1056 public Resource getPractitionerTarget() { 1057 return this.practitionerTarget; 1058 } 1059 1060 /** 1061 * @param value {@link #practitioner} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The individual who was responsible for giving the medication to the patient.) 1062 */ 1063 public MedicationAdministration setPractitionerTarget(Resource value) { 1064 this.practitionerTarget = value; 1065 return this; 1066 } 1067 1068 /** 1069 * @return {@link #prescription} (The original request, instruction or authority to perform the administration.) 1070 */ 1071 public Reference getPrescription() { 1072 if (this.prescription == null) 1073 if (Configuration.errorOnAutoCreate()) 1074 throw new Error("Attempt to auto-create MedicationAdministration.prescription"); 1075 else if (Configuration.doAutoCreate()) 1076 this.prescription = new Reference(); // cc 1077 return this.prescription; 1078 } 1079 1080 public boolean hasPrescription() { 1081 return this.prescription != null && !this.prescription.isEmpty(); 1082 } 1083 1084 /** 1085 * @param value {@link #prescription} (The original request, instruction or authority to perform the administration.) 1086 */ 1087 public MedicationAdministration setPrescription(Reference value) { 1088 this.prescription = value; 1089 return this; 1090 } 1091 1092 /** 1093 * @return {@link #prescription} 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 original request, instruction or authority to perform the administration.) 1094 */ 1095 public MedicationOrder getPrescriptionTarget() { 1096 if (this.prescriptionTarget == null) 1097 if (Configuration.errorOnAutoCreate()) 1098 throw new Error("Attempt to auto-create MedicationAdministration.prescription"); 1099 else if (Configuration.doAutoCreate()) 1100 this.prescriptionTarget = new MedicationOrder(); // aa 1101 return this.prescriptionTarget; 1102 } 1103 1104 /** 1105 * @param value {@link #prescription} 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 original request, instruction or authority to perform the administration.) 1106 */ 1107 public MedicationAdministration setPrescriptionTarget(MedicationOrder value) { 1108 this.prescriptionTarget = value; 1109 return this; 1110 } 1111 1112 /** 1113 * @return {@link #wasNotGiven} (Set this to true if the record is saying that the medication was NOT administered.). This is the underlying object with id, value and extensions. The accessor "getWasNotGiven" gives direct access to the value 1114 */ 1115 public BooleanType getWasNotGivenElement() { 1116 if (this.wasNotGiven == null) 1117 if (Configuration.errorOnAutoCreate()) 1118 throw new Error("Attempt to auto-create MedicationAdministration.wasNotGiven"); 1119 else if (Configuration.doAutoCreate()) 1120 this.wasNotGiven = new BooleanType(); // bb 1121 return this.wasNotGiven; 1122 } 1123 1124 public boolean hasWasNotGivenElement() { 1125 return this.wasNotGiven != null && !this.wasNotGiven.isEmpty(); 1126 } 1127 1128 public boolean hasWasNotGiven() { 1129 return this.wasNotGiven != null && !this.wasNotGiven.isEmpty(); 1130 } 1131 1132 /** 1133 * @param value {@link #wasNotGiven} (Set this to true if the record is saying that the medication was NOT administered.). This is the underlying object with id, value and extensions. The accessor "getWasNotGiven" gives direct access to the value 1134 */ 1135 public MedicationAdministration setWasNotGivenElement(BooleanType value) { 1136 this.wasNotGiven = value; 1137 return this; 1138 } 1139 1140 /** 1141 * @return Set this to true if the record is saying that the medication was NOT administered. 1142 */ 1143 public boolean getWasNotGiven() { 1144 return this.wasNotGiven == null || this.wasNotGiven.isEmpty() ? false : this.wasNotGiven.getValue(); 1145 } 1146 1147 /** 1148 * @param value Set this to true if the record is saying that the medication was NOT administered. 1149 */ 1150 public MedicationAdministration setWasNotGiven(boolean value) { 1151 if (this.wasNotGiven == null) 1152 this.wasNotGiven = new BooleanType(); 1153 this.wasNotGiven.setValue(value); 1154 return this; 1155 } 1156 1157 /** 1158 * @return {@link #reasonNotGiven} (A code indicating why the administration was not performed.) 1159 */ 1160 public List<CodeableConcept> getReasonNotGiven() { 1161 if (this.reasonNotGiven == null) 1162 this.reasonNotGiven = new ArrayList<CodeableConcept>(); 1163 return this.reasonNotGiven; 1164 } 1165 1166 public boolean hasReasonNotGiven() { 1167 if (this.reasonNotGiven == null) 1168 return false; 1169 for (CodeableConcept item : this.reasonNotGiven) 1170 if (!item.isEmpty()) 1171 return true; 1172 return false; 1173 } 1174 1175 /** 1176 * @return {@link #reasonNotGiven} (A code indicating why the administration was not performed.) 1177 */ 1178 // syntactic sugar 1179 public CodeableConcept addReasonNotGiven() { //3 1180 CodeableConcept t = new CodeableConcept(); 1181 if (this.reasonNotGiven == null) 1182 this.reasonNotGiven = new ArrayList<CodeableConcept>(); 1183 this.reasonNotGiven.add(t); 1184 return t; 1185 } 1186 1187 // syntactic sugar 1188 public MedicationAdministration addReasonNotGiven(CodeableConcept t) { //3 1189 if (t == null) 1190 return this; 1191 if (this.reasonNotGiven == null) 1192 this.reasonNotGiven = new ArrayList<CodeableConcept>(); 1193 this.reasonNotGiven.add(t); 1194 return this; 1195 } 1196 1197 /** 1198 * @return {@link #reasonGiven} (A code indicating why the medication was given.) 1199 */ 1200 public List<CodeableConcept> getReasonGiven() { 1201 if (this.reasonGiven == null) 1202 this.reasonGiven = new ArrayList<CodeableConcept>(); 1203 return this.reasonGiven; 1204 } 1205 1206 public boolean hasReasonGiven() { 1207 if (this.reasonGiven == null) 1208 return false; 1209 for (CodeableConcept item : this.reasonGiven) 1210 if (!item.isEmpty()) 1211 return true; 1212 return false; 1213 } 1214 1215 /** 1216 * @return {@link #reasonGiven} (A code indicating why the medication was given.) 1217 */ 1218 // syntactic sugar 1219 public CodeableConcept addReasonGiven() { //3 1220 CodeableConcept t = new CodeableConcept(); 1221 if (this.reasonGiven == null) 1222 this.reasonGiven = new ArrayList<CodeableConcept>(); 1223 this.reasonGiven.add(t); 1224 return t; 1225 } 1226 1227 // syntactic sugar 1228 public MedicationAdministration addReasonGiven(CodeableConcept t) { //3 1229 if (t == null) 1230 return this; 1231 if (this.reasonGiven == null) 1232 this.reasonGiven = new ArrayList<CodeableConcept>(); 1233 this.reasonGiven.add(t); 1234 return this; 1235 } 1236 1237 /** 1238 * @return {@link #device} (The device used in administering the medication to the patient. For example, a particular infusion pump.) 1239 */ 1240 public List<Reference> getDevice() { 1241 if (this.device == null) 1242 this.device = new ArrayList<Reference>(); 1243 return this.device; 1244 } 1245 1246 public boolean hasDevice() { 1247 if (this.device == null) 1248 return false; 1249 for (Reference item : this.device) 1250 if (!item.isEmpty()) 1251 return true; 1252 return false; 1253 } 1254 1255 /** 1256 * @return {@link #device} (The device used in administering the medication to the patient. For example, a particular infusion pump.) 1257 */ 1258 // syntactic sugar 1259 public Reference addDevice() { //3 1260 Reference t = new Reference(); 1261 if (this.device == null) 1262 this.device = new ArrayList<Reference>(); 1263 this.device.add(t); 1264 return t; 1265 } 1266 1267 // syntactic sugar 1268 public MedicationAdministration addDevice(Reference t) { //3 1269 if (t == null) 1270 return this; 1271 if (this.device == null) 1272 this.device = new ArrayList<Reference>(); 1273 this.device.add(t); 1274 return this; 1275 } 1276 1277 /** 1278 * @return {@link #device} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The device used in administering the medication to the patient. For example, a particular infusion pump.) 1279 */ 1280 public List<Device> getDeviceTarget() { 1281 if (this.deviceTarget == null) 1282 this.deviceTarget = new ArrayList<Device>(); 1283 return this.deviceTarget; 1284 } 1285 1286 // syntactic sugar 1287 /** 1288 * @return {@link #device} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The device used in administering the medication to the patient. For example, a particular infusion pump.) 1289 */ 1290 public Device addDeviceTarget() { 1291 Device r = new Device(); 1292 if (this.deviceTarget == null) 1293 this.deviceTarget = new ArrayList<Device>(); 1294 this.deviceTarget.add(r); 1295 return r; 1296 } 1297 1298 /** 1299 * @return {@link #note} (Extra information about the medication administration that is not conveyed by the other attributes.) 1300 */ 1301 public List<Annotation> getNote() { 1302 if (this.note == null) 1303 this.note = new ArrayList<Annotation>(); 1304 return this.note; 1305 } 1306 1307 public boolean hasNote() { 1308 if (this.note == null) 1309 return false; 1310 for (Annotation item : this.note) 1311 if (!item.isEmpty()) 1312 return true; 1313 return false; 1314 } 1315 1316 /** 1317 * @return {@link #note} (Extra information about the medication administration that is not conveyed by the other attributes.) 1318 */ 1319 // syntactic sugar 1320 public Annotation addNote() { //3 1321 Annotation t = new Annotation(); 1322 if (this.note == null) 1323 this.note = new ArrayList<Annotation>(); 1324 this.note.add(t); 1325 return t; 1326 } 1327 1328 // syntactic sugar 1329 public MedicationAdministration addNote(Annotation t) { //3 1330 if (t == null) 1331 return this; 1332 if (this.note == null) 1333 this.note = new ArrayList<Annotation>(); 1334 this.note.add(t); 1335 return this; 1336 } 1337 1338 /** 1339 * @return {@link #dosage} (Describes the medication dosage information details e.g. dose, rate, site, route, etc.) 1340 */ 1341 public MedicationAdministrationDosageComponent getDosage() { 1342 if (this.dosage == null) 1343 if (Configuration.errorOnAutoCreate()) 1344 throw new Error("Attempt to auto-create MedicationAdministration.dosage"); 1345 else if (Configuration.doAutoCreate()) 1346 this.dosage = new MedicationAdministrationDosageComponent(); // cc 1347 return this.dosage; 1348 } 1349 1350 public boolean hasDosage() { 1351 return this.dosage != null && !this.dosage.isEmpty(); 1352 } 1353 1354 /** 1355 * @param value {@link #dosage} (Describes the medication dosage information details e.g. dose, rate, site, route, etc.) 1356 */ 1357 public MedicationAdministration setDosage(MedicationAdministrationDosageComponent value) { 1358 this.dosage = value; 1359 return this; 1360 } 1361 1362 protected void listChildren(List<Property> childrenList) { 1363 super.listChildren(childrenList); 1364 childrenList.add(new Property("identifier", "Identifier", "External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource. The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event. Particularly important if these records have to be updated.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1365 childrenList.add(new Property("status", "code", "Will generally be set to show that the administration has been completed. For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way.", 0, java.lang.Integer.MAX_VALUE, status)); 1366 childrenList.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, java.lang.Integer.MAX_VALUE, medication)); 1367 childrenList.add(new Property("patient", "Reference(Patient)", "The person or animal receiving the medication.", 0, java.lang.Integer.MAX_VALUE, patient)); 1368 childrenList.add(new Property("encounter", "Reference(Encounter)", "The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.", 0, java.lang.Integer.MAX_VALUE, encounter)); 1369 childrenList.add(new Property("effectiveTime[x]", "dateTime|Period", "A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.", 0, java.lang.Integer.MAX_VALUE, effectiveTime)); 1370 childrenList.add(new Property("practitioner", "Reference(Practitioner|Patient|RelatedPerson)", "The individual who was responsible for giving the medication to the patient.", 0, java.lang.Integer.MAX_VALUE, practitioner)); 1371 childrenList.add(new Property("prescription", "Reference(MedicationOrder)", "The original request, instruction or authority to perform the administration.", 0, java.lang.Integer.MAX_VALUE, prescription)); 1372 childrenList.add(new Property("wasNotGiven", "boolean", "Set this to true if the record is saying that the medication was NOT administered.", 0, java.lang.Integer.MAX_VALUE, wasNotGiven)); 1373 childrenList.add(new Property("reasonNotGiven", "CodeableConcept", "A code indicating why the administration was not performed.", 0, java.lang.Integer.MAX_VALUE, reasonNotGiven)); 1374 childrenList.add(new Property("reasonGiven", "CodeableConcept", "A code indicating why the medication was given.", 0, java.lang.Integer.MAX_VALUE, reasonGiven)); 1375 childrenList.add(new Property("device", "Reference(Device)", "The device used in administering the medication to the patient. For example, a particular infusion pump.", 0, java.lang.Integer.MAX_VALUE, device)); 1376 childrenList.add(new Property("note", "Annotation", "Extra information about the medication administration that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); 1377 childrenList.add(new Property("dosage", "", "Describes the medication dosage information details e.g. dose, rate, site, route, etc.", 0, java.lang.Integer.MAX_VALUE, dosage)); 1378 } 1379 1380 @Override 1381 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1382 switch (hash) { 1383 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1384 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationAdministrationStatus> 1385 case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type 1386 case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference 1387 case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference 1388 case -929905388: /*effectiveTime*/ return this.effectiveTime == null ? new Base[0] : new Base[] {this.effectiveTime}; // Type 1389 case 574573338: /*practitioner*/ return this.practitioner == null ? new Base[0] : new Base[] {this.practitioner}; // Reference 1390 case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference 1391 case -1050911117: /*wasNotGiven*/ return this.wasNotGiven == null ? new Base[0] : new Base[] {this.wasNotGiven}; // BooleanType 1392 case 2101123790: /*reasonNotGiven*/ return this.reasonNotGiven == null ? new Base[0] : this.reasonNotGiven.toArray(new Base[this.reasonNotGiven.size()]); // CodeableConcept 1393 case 914964377: /*reasonGiven*/ return this.reasonGiven == null ? new Base[0] : this.reasonGiven.toArray(new Base[this.reasonGiven.size()]); // CodeableConcept 1394 case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // Reference 1395 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 1396 case -1326018889: /*dosage*/ return this.dosage == null ? new Base[0] : new Base[] {this.dosage}; // MedicationAdministrationDosageComponent 1397 default: return super.getProperty(hash, name, checkValid); 1398 } 1399 1400 } 1401 1402 @Override 1403 public void setProperty(int hash, String name, Base value) throws FHIRException { 1404 switch (hash) { 1405 case -1618432855: // identifier 1406 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1407 break; 1408 case -892481550: // status 1409 this.status = new MedicationAdministrationStatusEnumFactory().fromType(value); // Enumeration<MedicationAdministrationStatus> 1410 break; 1411 case 1998965455: // medication 1412 this.medication = (Type) value; // Type 1413 break; 1414 case -791418107: // patient 1415 this.patient = castToReference(value); // Reference 1416 break; 1417 case 1524132147: // encounter 1418 this.encounter = castToReference(value); // Reference 1419 break; 1420 case -929905388: // effectiveTime 1421 this.effectiveTime = (Type) value; // Type 1422 break; 1423 case 574573338: // practitioner 1424 this.practitioner = castToReference(value); // Reference 1425 break; 1426 case 460301338: // prescription 1427 this.prescription = castToReference(value); // Reference 1428 break; 1429 case -1050911117: // wasNotGiven 1430 this.wasNotGiven = castToBoolean(value); // BooleanType 1431 break; 1432 case 2101123790: // reasonNotGiven 1433 this.getReasonNotGiven().add(castToCodeableConcept(value)); // CodeableConcept 1434 break; 1435 case 914964377: // reasonGiven 1436 this.getReasonGiven().add(castToCodeableConcept(value)); // CodeableConcept 1437 break; 1438 case -1335157162: // device 1439 this.getDevice().add(castToReference(value)); // Reference 1440 break; 1441 case 3387378: // note 1442 this.getNote().add(castToAnnotation(value)); // Annotation 1443 break; 1444 case -1326018889: // dosage 1445 this.dosage = (MedicationAdministrationDosageComponent) value; // MedicationAdministrationDosageComponent 1446 break; 1447 default: super.setProperty(hash, name, value); 1448 } 1449 1450 } 1451 1452 @Override 1453 public void setProperty(String name, Base value) throws FHIRException { 1454 if (name.equals("identifier")) 1455 this.getIdentifier().add(castToIdentifier(value)); 1456 else if (name.equals("status")) 1457 this.status = new MedicationAdministrationStatusEnumFactory().fromType(value); // Enumeration<MedicationAdministrationStatus> 1458 else if (name.equals("medication[x]")) 1459 this.medication = (Type) value; // Type 1460 else if (name.equals("patient")) 1461 this.patient = castToReference(value); // Reference 1462 else if (name.equals("encounter")) 1463 this.encounter = castToReference(value); // Reference 1464 else if (name.equals("effectiveTime[x]")) 1465 this.effectiveTime = (Type) value; // Type 1466 else if (name.equals("practitioner")) 1467 this.practitioner = castToReference(value); // Reference 1468 else if (name.equals("prescription")) 1469 this.prescription = castToReference(value); // Reference 1470 else if (name.equals("wasNotGiven")) 1471 this.wasNotGiven = castToBoolean(value); // BooleanType 1472 else if (name.equals("reasonNotGiven")) 1473 this.getReasonNotGiven().add(castToCodeableConcept(value)); 1474 else if (name.equals("reasonGiven")) 1475 this.getReasonGiven().add(castToCodeableConcept(value)); 1476 else if (name.equals("device")) 1477 this.getDevice().add(castToReference(value)); 1478 else if (name.equals("note")) 1479 this.getNote().add(castToAnnotation(value)); 1480 else if (name.equals("dosage")) 1481 this.dosage = (MedicationAdministrationDosageComponent) value; // MedicationAdministrationDosageComponent 1482 else 1483 super.setProperty(name, value); 1484 } 1485 1486 @Override 1487 public Base makeProperty(int hash, String name) throws FHIRException { 1488 switch (hash) { 1489 case -1618432855: return addIdentifier(); // Identifier 1490 case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<MedicationAdministrationStatus> 1491 case 1458402129: return getMedication(); // Type 1492 case -791418107: return getPatient(); // Reference 1493 case 1524132147: return getEncounter(); // Reference 1494 case -272263444: return getEffectiveTime(); // Type 1495 case 574573338: return getPractitioner(); // Reference 1496 case 460301338: return getPrescription(); // Reference 1497 case -1050911117: throw new FHIRException("Cannot make property wasNotGiven as it is not a complex type"); // BooleanType 1498 case 2101123790: return addReasonNotGiven(); // CodeableConcept 1499 case 914964377: return addReasonGiven(); // CodeableConcept 1500 case -1335157162: return addDevice(); // Reference 1501 case 3387378: return addNote(); // Annotation 1502 case -1326018889: return getDosage(); // MedicationAdministrationDosageComponent 1503 default: return super.makeProperty(hash, name); 1504 } 1505 1506 } 1507 1508 @Override 1509 public Base addChild(String name) throws FHIRException { 1510 if (name.equals("identifier")) { 1511 return addIdentifier(); 1512 } 1513 else if (name.equals("status")) { 1514 throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.status"); 1515 } 1516 else if (name.equals("medicationCodeableConcept")) { 1517 this.medication = new CodeableConcept(); 1518 return this.medication; 1519 } 1520 else if (name.equals("medicationReference")) { 1521 this.medication = new Reference(); 1522 return this.medication; 1523 } 1524 else if (name.equals("patient")) { 1525 this.patient = new Reference(); 1526 return this.patient; 1527 } 1528 else if (name.equals("encounter")) { 1529 this.encounter = new Reference(); 1530 return this.encounter; 1531 } 1532 else if (name.equals("effectiveTimeDateTime")) { 1533 this.effectiveTime = new DateTimeType(); 1534 return this.effectiveTime; 1535 } 1536 else if (name.equals("effectiveTimePeriod")) { 1537 this.effectiveTime = new Period(); 1538 return this.effectiveTime; 1539 } 1540 else if (name.equals("practitioner")) { 1541 this.practitioner = new Reference(); 1542 return this.practitioner; 1543 } 1544 else if (name.equals("prescription")) { 1545 this.prescription = new Reference(); 1546 return this.prescription; 1547 } 1548 else if (name.equals("wasNotGiven")) { 1549 throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.wasNotGiven"); 1550 } 1551 else if (name.equals("reasonNotGiven")) { 1552 return addReasonNotGiven(); 1553 } 1554 else if (name.equals("reasonGiven")) { 1555 return addReasonGiven(); 1556 } 1557 else if (name.equals("device")) { 1558 return addDevice(); 1559 } 1560 else if (name.equals("note")) { 1561 return addNote(); 1562 } 1563 else if (name.equals("dosage")) { 1564 this.dosage = new MedicationAdministrationDosageComponent(); 1565 return this.dosage; 1566 } 1567 else 1568 return super.addChild(name); 1569 } 1570 1571 public String fhirType() { 1572 return "MedicationAdministration"; 1573 1574 } 1575 1576 public MedicationAdministration copy() { 1577 MedicationAdministration dst = new MedicationAdministration(); 1578 copyValues(dst); 1579 if (identifier != null) { 1580 dst.identifier = new ArrayList<Identifier>(); 1581 for (Identifier i : identifier) 1582 dst.identifier.add(i.copy()); 1583 }; 1584 dst.status = status == null ? null : status.copy(); 1585 dst.medication = medication == null ? null : medication.copy(); 1586 dst.patient = patient == null ? null : patient.copy(); 1587 dst.encounter = encounter == null ? null : encounter.copy(); 1588 dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy(); 1589 dst.practitioner = practitioner == null ? null : practitioner.copy(); 1590 dst.prescription = prescription == null ? null : prescription.copy(); 1591 dst.wasNotGiven = wasNotGiven == null ? null : wasNotGiven.copy(); 1592 if (reasonNotGiven != null) { 1593 dst.reasonNotGiven = new ArrayList<CodeableConcept>(); 1594 for (CodeableConcept i : reasonNotGiven) 1595 dst.reasonNotGiven.add(i.copy()); 1596 }; 1597 if (reasonGiven != null) { 1598 dst.reasonGiven = new ArrayList<CodeableConcept>(); 1599 for (CodeableConcept i : reasonGiven) 1600 dst.reasonGiven.add(i.copy()); 1601 }; 1602 if (device != null) { 1603 dst.device = new ArrayList<Reference>(); 1604 for (Reference i : device) 1605 dst.device.add(i.copy()); 1606 }; 1607 if (note != null) { 1608 dst.note = new ArrayList<Annotation>(); 1609 for (Annotation i : note) 1610 dst.note.add(i.copy()); 1611 }; 1612 dst.dosage = dosage == null ? null : dosage.copy(); 1613 return dst; 1614 } 1615 1616 protected MedicationAdministration typedCopy() { 1617 return copy(); 1618 } 1619 1620 @Override 1621 public boolean equalsDeep(Base other) { 1622 if (!super.equalsDeep(other)) 1623 return false; 1624 if (!(other instanceof MedicationAdministration)) 1625 return false; 1626 MedicationAdministration o = (MedicationAdministration) other; 1627 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(medication, o.medication, true) 1628 && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true) && compareDeep(effectiveTime, o.effectiveTime, true) 1629 && compareDeep(practitioner, o.practitioner, true) && compareDeep(prescription, o.prescription, true) 1630 && compareDeep(wasNotGiven, o.wasNotGiven, true) && compareDeep(reasonNotGiven, o.reasonNotGiven, true) 1631 && compareDeep(reasonGiven, o.reasonGiven, true) && compareDeep(device, o.device, true) && compareDeep(note, o.note, true) 1632 && compareDeep(dosage, o.dosage, true); 1633 } 1634 1635 @Override 1636 public boolean equalsShallow(Base other) { 1637 if (!super.equalsShallow(other)) 1638 return false; 1639 if (!(other instanceof MedicationAdministration)) 1640 return false; 1641 MedicationAdministration o = (MedicationAdministration) other; 1642 return compareValues(status, o.status, true) && compareValues(wasNotGiven, o.wasNotGiven, true); 1643 } 1644 1645 public boolean isEmpty() { 1646 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 1647 && (medication == null || medication.isEmpty()) && (patient == null || patient.isEmpty()) 1648 && (encounter == null || encounter.isEmpty()) && (effectiveTime == null || effectiveTime.isEmpty()) 1649 && (practitioner == null || practitioner.isEmpty()) && (prescription == null || prescription.isEmpty()) 1650 && (wasNotGiven == null || wasNotGiven.isEmpty()) && (reasonNotGiven == null || reasonNotGiven.isEmpty()) 1651 && (reasonGiven == null || reasonGiven.isEmpty()) && (device == null || device.isEmpty()) 1652 && (note == null || note.isEmpty()) && (dosage == null || dosage.isEmpty()); 1653 } 1654 1655 @Override 1656 public ResourceType getResourceType() { 1657 return ResourceType.MedicationAdministration; 1658 } 1659 1660 /** 1661 * Search parameter: <b>medication</b> 1662 * <p> 1663 * Description: <b>Return administrations of this medication resource</b><br> 1664 * Type: <b>reference</b><br> 1665 * Path: <b>MedicationAdministration.medicationReference</b><br> 1666 * </p> 1667 */ 1668 @SearchParamDefinition(name="medication", path="MedicationAdministration.medication.as(Reference)", description="Return administrations of this medication resource", type="reference" ) 1669 public static final String SP_MEDICATION = "medication"; 1670 /** 1671 * <b>Fluent Client</b> search parameter constant for <b>medication</b> 1672 * <p> 1673 * Description: <b>Return administrations of this medication resource</b><br> 1674 * Type: <b>reference</b><br> 1675 * Path: <b>MedicationAdministration.medicationReference</b><br> 1676 * </p> 1677 */ 1678 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION); 1679 1680/** 1681 * Constant for fluent queries to be used to add include statements. Specifies 1682 * the path value of "<b>MedicationAdministration:medication</b>". 1683 */ 1684 public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationAdministration:medication").toLocked(); 1685 1686 /** 1687 * Search parameter: <b>effectivetime</b> 1688 * <p> 1689 * Description: <b>Date administration happened (or did not happen)</b><br> 1690 * Type: <b>date</b><br> 1691 * Path: <b>MedicationAdministration.effectiveTime[x]</b><br> 1692 * </p> 1693 */ 1694 @SearchParamDefinition(name="effectivetime", path="MedicationAdministration.effectiveTime", description="Date administration happened (or did not happen)", type="date" ) 1695 public static final String SP_EFFECTIVETIME = "effectivetime"; 1696 /** 1697 * <b>Fluent Client</b> search parameter constant for <b>effectivetime</b> 1698 * <p> 1699 * Description: <b>Date administration happened (or did not happen)</b><br> 1700 * Type: <b>date</b><br> 1701 * Path: <b>MedicationAdministration.effectiveTime[x]</b><br> 1702 * </p> 1703 */ 1704 public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVETIME); 1705 1706 /** 1707 * Search parameter: <b>patient</b> 1708 * <p> 1709 * Description: <b>The identity of a patient to list administrations for</b><br> 1710 * Type: <b>reference</b><br> 1711 * Path: <b>MedicationAdministration.patient</b><br> 1712 * </p> 1713 */ 1714 @SearchParamDefinition(name="patient", path="MedicationAdministration.patient", description="The identity of a patient to list administrations for", type="reference" ) 1715 public static final String SP_PATIENT = "patient"; 1716 /** 1717 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 1718 * <p> 1719 * Description: <b>The identity of a patient to list administrations for</b><br> 1720 * Type: <b>reference</b><br> 1721 * Path: <b>MedicationAdministration.patient</b><br> 1722 * </p> 1723 */ 1724 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 1725 1726/** 1727 * Constant for fluent queries to be used to add include statements. Specifies 1728 * the path value of "<b>MedicationAdministration:patient</b>". 1729 */ 1730 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationAdministration:patient").toLocked(); 1731 1732 /** 1733 * Search parameter: <b>practitioner</b> 1734 * <p> 1735 * Description: <b>Who administered substance</b><br> 1736 * Type: <b>reference</b><br> 1737 * Path: <b>MedicationAdministration.practitioner</b><br> 1738 * </p> 1739 */ 1740 @SearchParamDefinition(name="practitioner", path="MedicationAdministration.practitioner", description="Who administered substance", type="reference" ) 1741 public static final String SP_PRACTITIONER = "practitioner"; 1742 /** 1743 * <b>Fluent Client</b> search parameter constant for <b>practitioner</b> 1744 * <p> 1745 * Description: <b>Who administered substance</b><br> 1746 * Type: <b>reference</b><br> 1747 * Path: <b>MedicationAdministration.practitioner</b><br> 1748 * </p> 1749 */ 1750 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER); 1751 1752/** 1753 * Constant for fluent queries to be used to add include statements. Specifies 1754 * the path value of "<b>MedicationAdministration:practitioner</b>". 1755 */ 1756 public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("MedicationAdministration:practitioner").toLocked(); 1757 1758 /** 1759 * Search parameter: <b>status</b> 1760 * <p> 1761 * Description: <b>MedicationAdministration event status (for example one of active/paused/completed/nullified)</b><br> 1762 * Type: <b>token</b><br> 1763 * Path: <b>MedicationAdministration.status</b><br> 1764 * </p> 1765 */ 1766 @SearchParamDefinition(name="status", path="MedicationAdministration.status", description="MedicationAdministration event status (for example one of active/paused/completed/nullified)", type="token" ) 1767 public static final String SP_STATUS = "status"; 1768 /** 1769 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1770 * <p> 1771 * Description: <b>MedicationAdministration event status (for example one of active/paused/completed/nullified)</b><br> 1772 * Type: <b>token</b><br> 1773 * Path: <b>MedicationAdministration.status</b><br> 1774 * </p> 1775 */ 1776 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1777 1778 /** 1779 * Search parameter: <b>prescription</b> 1780 * <p> 1781 * Description: <b>The identity of a prescription to list administrations from</b><br> 1782 * Type: <b>reference</b><br> 1783 * Path: <b>MedicationAdministration.prescription</b><br> 1784 * </p> 1785 */ 1786 @SearchParamDefinition(name="prescription", path="MedicationAdministration.prescription", description="The identity of a prescription to list administrations from", type="reference" ) 1787 public static final String SP_PRESCRIPTION = "prescription"; 1788 /** 1789 * <b>Fluent Client</b> search parameter constant for <b>prescription</b> 1790 * <p> 1791 * Description: <b>The identity of a prescription to list administrations from</b><br> 1792 * Type: <b>reference</b><br> 1793 * Path: <b>MedicationAdministration.prescription</b><br> 1794 * </p> 1795 */ 1796 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRESCRIPTION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRESCRIPTION); 1797 1798/** 1799 * Constant for fluent queries to be used to add include statements. Specifies 1800 * the path value of "<b>MedicationAdministration:prescription</b>". 1801 */ 1802 public static final ca.uhn.fhir.model.api.Include INCLUDE_PRESCRIPTION = new ca.uhn.fhir.model.api.Include("MedicationAdministration:prescription").toLocked(); 1803 1804 /** 1805 * Search parameter: <b>device</b> 1806 * <p> 1807 * Description: <b>Return administrations with this administration device identity</b><br> 1808 * Type: <b>reference</b><br> 1809 * Path: <b>MedicationAdministration.device</b><br> 1810 * </p> 1811 */ 1812 @SearchParamDefinition(name="device", path="MedicationAdministration.device", description="Return administrations with this administration device identity", type="reference" ) 1813 public static final String SP_DEVICE = "device"; 1814 /** 1815 * <b>Fluent Client</b> search parameter constant for <b>device</b> 1816 * <p> 1817 * Description: <b>Return administrations with this administration device identity</b><br> 1818 * Type: <b>reference</b><br> 1819 * Path: <b>MedicationAdministration.device</b><br> 1820 * </p> 1821 */ 1822 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE); 1823 1824/** 1825 * Constant for fluent queries to be used to add include statements. Specifies 1826 * the path value of "<b>MedicationAdministration:device</b>". 1827 */ 1828 public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("MedicationAdministration:device").toLocked(); 1829 1830 /** 1831 * Search parameter: <b>code</b> 1832 * <p> 1833 * Description: <b>Return administrations of this medication code</b><br> 1834 * Type: <b>token</b><br> 1835 * Path: <b>MedicationAdministration.medicationCodeableConcept</b><br> 1836 * </p> 1837 */ 1838 @SearchParamDefinition(name="code", path="MedicationAdministration.medication.as(CodeableConcept)", description="Return administrations of this medication code", type="token" ) 1839 public static final String SP_CODE = "code"; 1840 /** 1841 * <b>Fluent Client</b> search parameter constant for <b>code</b> 1842 * <p> 1843 * Description: <b>Return administrations of this medication code</b><br> 1844 * Type: <b>token</b><br> 1845 * Path: <b>MedicationAdministration.medicationCodeableConcept</b><br> 1846 * </p> 1847 */ 1848 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 1849 1850 /** 1851 * Search parameter: <b>encounter</b> 1852 * <p> 1853 * Description: <b>Return administrations that share this encounter</b><br> 1854 * Type: <b>reference</b><br> 1855 * Path: <b>MedicationAdministration.encounter</b><br> 1856 * </p> 1857 */ 1858 @SearchParamDefinition(name="encounter", path="MedicationAdministration.encounter", description="Return administrations that share this encounter", type="reference" ) 1859 public static final String SP_ENCOUNTER = "encounter"; 1860 /** 1861 * <b>Fluent Client</b> search parameter constant for <b>encounter</b> 1862 * <p> 1863 * Description: <b>Return administrations that share this encounter</b><br> 1864 * Type: <b>reference</b><br> 1865 * Path: <b>MedicationAdministration.encounter</b><br> 1866 * </p> 1867 */ 1868 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER); 1869 1870/** 1871 * Constant for fluent queries to be used to add include statements. Specifies 1872 * the path value of "<b>MedicationAdministration:encounter</b>". 1873 */ 1874 public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("MedicationAdministration:encounter").toLocked(); 1875 1876 /** 1877 * Search parameter: <b>identifier</b> 1878 * <p> 1879 * Description: <b>Return administrations with this external identifier</b><br> 1880 * Type: <b>token</b><br> 1881 * Path: <b>MedicationAdministration.identifier</b><br> 1882 * </p> 1883 */ 1884 @SearchParamDefinition(name="identifier", path="MedicationAdministration.identifier", description="Return administrations with this external identifier", type="token" ) 1885 public static final String SP_IDENTIFIER = "identifier"; 1886 /** 1887 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1888 * <p> 1889 * Description: <b>Return administrations with this external identifier</b><br> 1890 * Type: <b>token</b><br> 1891 * Path: <b>MedicationAdministration.identifier</b><br> 1892 * </p> 1893 */ 1894 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1895 1896 /** 1897 * Search parameter: <b>wasnotgiven</b> 1898 * <p> 1899 * Description: <b>Administrations that were not made</b><br> 1900 * Type: <b>token</b><br> 1901 * Path: <b>MedicationAdministration.wasNotGiven</b><br> 1902 * </p> 1903 */ 1904 @SearchParamDefinition(name="wasnotgiven", path="MedicationAdministration.wasNotGiven", description="Administrations that were not made", type="token" ) 1905 public static final String SP_WASNOTGIVEN = "wasnotgiven"; 1906 /** 1907 * <b>Fluent Client</b> search parameter constant for <b>wasnotgiven</b> 1908 * <p> 1909 * Description: <b>Administrations that were not made</b><br> 1910 * Type: <b>token</b><br> 1911 * Path: <b>MedicationAdministration.wasNotGiven</b><br> 1912 * </p> 1913 */ 1914 public static final ca.uhn.fhir.rest.gclient.TokenClientParam WASNOTGIVEN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_WASNOTGIVEN); 1915 1916 1917}