001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import ca.uhn.fhir.model.api.annotation.Block; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.ResourceDef; 044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 045import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 046import org.hl7.fhir.exceptions.FHIRException; 047import org.hl7.fhir.utilities.Utilities; 048/** 049 * A record of a medication that is being consumed by a patient. A MedicationStatement may indicate that the patient may be taking the medication now, or has taken the medication in the past or will be taking the medication in the future. The source of this information can be the patient, significant other (such as a family member or spouse), or a clinician. A common scenario where this information is captured is during the history taking process during a patient visit or stay. The medication information may come from e.g. the patient's memory, from a prescription bottle, or from a list of medications the patient, clinician or other party maintains 050 051The primary difference between a medication statement and a medication administration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication. A medication statement is often, if not always, less specific. There is no required date/time when the medication was administered, in fact we only know that a source has reported the patient is taking this medication, where details such as time, quantity, or rate or even medication product may be incomplete or missing or less precise. As stated earlier, the medication statement information may come from the patient's memory, from a prescription bottle or from a list of medications the patient, clinician or other party maintains. Medication administration is more formal and is not missing detailed information. 052 */ 053@ResourceDef(name="MedicationStatement", profile="http://hl7.org/fhir/Profile/MedicationStatement") 054public class MedicationStatement extends DomainResource { 055 056 public enum MedicationStatementStatus { 057 /** 058 * The medication is still being taken. 059 */ 060 ACTIVE, 061 /** 062 * The medication is no longer being taken. 063 */ 064 COMPLETED, 065 /** 066 * The statement was entered in error. 067 */ 068 ENTEREDINERROR, 069 /** 070 * The medication may be taken at some time in the future. 071 */ 072 INTENDED, 073 /** 074 * added to help the parsers 075 */ 076 NULL; 077 public static MedicationStatementStatus fromCode(String codeString) throws FHIRException { 078 if (codeString == null || "".equals(codeString)) 079 return null; 080 if ("active".equals(codeString)) 081 return ACTIVE; 082 if ("completed".equals(codeString)) 083 return COMPLETED; 084 if ("entered-in-error".equals(codeString)) 085 return ENTEREDINERROR; 086 if ("intended".equals(codeString)) 087 return INTENDED; 088 throw new FHIRException("Unknown MedicationStatementStatus code '"+codeString+"'"); 089 } 090 public String toCode() { 091 switch (this) { 092 case ACTIVE: return "active"; 093 case COMPLETED: return "completed"; 094 case ENTEREDINERROR: return "entered-in-error"; 095 case INTENDED: return "intended"; 096 case NULL: return null; 097 default: return "?"; 098 } 099 } 100 public String getSystem() { 101 switch (this) { 102 case ACTIVE: return "http://hl7.org/fhir/medication-statement-status"; 103 case COMPLETED: return "http://hl7.org/fhir/medication-statement-status"; 104 case ENTEREDINERROR: return "http://hl7.org/fhir/medication-statement-status"; 105 case INTENDED: return "http://hl7.org/fhir/medication-statement-status"; 106 case NULL: return null; 107 default: return "?"; 108 } 109 } 110 public String getDefinition() { 111 switch (this) { 112 case ACTIVE: return "The medication is still being taken."; 113 case COMPLETED: return "The medication is no longer being taken."; 114 case ENTEREDINERROR: return "The statement was entered in error."; 115 case INTENDED: return "The medication may be taken at some time in the future."; 116 case NULL: return null; 117 default: return "?"; 118 } 119 } 120 public String getDisplay() { 121 switch (this) { 122 case ACTIVE: return "Active"; 123 case COMPLETED: return "Completed"; 124 case ENTEREDINERROR: return "Entered in Error"; 125 case INTENDED: return "Intended"; 126 case NULL: return null; 127 default: return "?"; 128 } 129 } 130 } 131 132 public static class MedicationStatementStatusEnumFactory implements EnumFactory<MedicationStatementStatus> { 133 public MedicationStatementStatus fromCode(String codeString) throws IllegalArgumentException { 134 if (codeString == null || "".equals(codeString)) 135 if (codeString == null || "".equals(codeString)) 136 return null; 137 if ("active".equals(codeString)) 138 return MedicationStatementStatus.ACTIVE; 139 if ("completed".equals(codeString)) 140 return MedicationStatementStatus.COMPLETED; 141 if ("entered-in-error".equals(codeString)) 142 return MedicationStatementStatus.ENTEREDINERROR; 143 if ("intended".equals(codeString)) 144 return MedicationStatementStatus.INTENDED; 145 throw new IllegalArgumentException("Unknown MedicationStatementStatus code '"+codeString+"'"); 146 } 147 public Enumeration<MedicationStatementStatus> fromType(Base code) throws FHIRException { 148 if (code == null || code.isEmpty()) 149 return null; 150 String codeString = ((PrimitiveType) code).asStringValue(); 151 if (codeString == null || "".equals(codeString)) 152 return null; 153 if ("active".equals(codeString)) 154 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.ACTIVE); 155 if ("completed".equals(codeString)) 156 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.COMPLETED); 157 if ("entered-in-error".equals(codeString)) 158 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.ENTEREDINERROR); 159 if ("intended".equals(codeString)) 160 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.INTENDED); 161 throw new FHIRException("Unknown MedicationStatementStatus code '"+codeString+"'"); 162 } 163 public String toCode(MedicationStatementStatus code) { 164 if (code == MedicationStatementStatus.ACTIVE) 165 return "active"; 166 if (code == MedicationStatementStatus.COMPLETED) 167 return "completed"; 168 if (code == MedicationStatementStatus.ENTEREDINERROR) 169 return "entered-in-error"; 170 if (code == MedicationStatementStatus.INTENDED) 171 return "intended"; 172 return "?"; 173 } 174 } 175 176 @Block() 177 public static class MedicationStatementDosageComponent extends BackboneElement implements IBaseBackboneElement { 178 /** 179 * Free text dosage information as reported about a patient's medication use. When coded dosage information is present, the free text may still be present for display to humans. 180 */ 181 @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 182 @Description(shortDefinition="Reported dosage information", formalDefinition="Free text dosage information as reported about a patient's medication use. When coded dosage information is present, the free text may still be present for display to humans." ) 183 protected StringType text; 184 185 /** 186 * The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013". 187 */ 188 @Child(name = "timing", type = {Timing.class}, order=2, min=0, max=1, modifier=false, summary=true) 189 @Description(shortDefinition="When/how often was medication taken", formalDefinition="The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\"." ) 190 protected Timing timing; 191 192 /** 193 * Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 194 195Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule. 196 */ 197 @Child(name = "asNeeded", type = {BooleanType.class, CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 198 @Description(shortDefinition="Take \"as needed\" (for x)", formalDefinition="Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). \n\nSpecifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule." ) 199 protected Type asNeeded; 200 201 /** 202 * A coded specification of or a reference to the anatomic site where the medication first enters the body. 203 */ 204 @Child(name = "site", type = {CodeableConcept.class, BodySite.class}, order=4, min=0, max=1, modifier=false, summary=true) 205 @Description(shortDefinition="Where (on body) medication is/was administered", formalDefinition="A coded specification of or a reference to the anatomic site where the medication first enters the body." ) 206 protected Type site; 207 208 /** 209 * A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject. 210 */ 211 @Child(name = "route", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true) 212 @Description(shortDefinition="How the medication entered the body", formalDefinition="A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject." ) 213 protected CodeableConcept route; 214 215 /** 216 * 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. 217 */ 218 @Child(name = "method", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 219 @Description(shortDefinition="Technique used to administer medication", 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." ) 220 protected CodeableConcept method; 221 222 /** 223 * The amount of therapeutic or other substance given at one administration event. 224 */ 225 @Child(name = "quantity", type = {SimpleQuantity.class, Range.class}, order=7, min=0, max=1, modifier=false, summary=true) 226 @Description(shortDefinition="Amount administered in one dose", formalDefinition="The amount of therapeutic or other substance given at one administration event." ) 227 protected Type quantity; 228 229 /** 230 * 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. 231 */ 232 @Child(name = "rate", type = {Ratio.class, Range.class}, order=8, min=0, max=1, modifier=false, summary=true) 233 @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." ) 234 protected Type rate; 235 236 /** 237 * The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours. 238 */ 239 @Child(name = "maxDosePerPeriod", type = {Ratio.class}, order=9, min=0, max=1, modifier=false, summary=true) 240 @Description(shortDefinition="Maximum dose that was consumed per unit of time", formalDefinition="The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours." ) 241 protected Ratio maxDosePerPeriod; 242 243 private static final long serialVersionUID = 246880733L; 244 245 /* 246 * Constructor 247 */ 248 public MedicationStatementDosageComponent() { 249 super(); 250 } 251 252 /** 253 * @return {@link #text} (Free text dosage information as reported about a patient's medication use. When coded dosage information is present, the free text may still be present for display to humans.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 254 */ 255 public StringType getTextElement() { 256 if (this.text == null) 257 if (Configuration.errorOnAutoCreate()) 258 throw new Error("Attempt to auto-create MedicationStatementDosageComponent.text"); 259 else if (Configuration.doAutoCreate()) 260 this.text = new StringType(); // bb 261 return this.text; 262 } 263 264 public boolean hasTextElement() { 265 return this.text != null && !this.text.isEmpty(); 266 } 267 268 public boolean hasText() { 269 return this.text != null && !this.text.isEmpty(); 270 } 271 272 /** 273 * @param value {@link #text} (Free text dosage information as reported about a patient's medication use. When coded dosage information is present, the free text may still be present for display to humans.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 274 */ 275 public MedicationStatementDosageComponent setTextElement(StringType value) { 276 this.text = value; 277 return this; 278 } 279 280 /** 281 * @return Free text dosage information as reported about a patient's medication use. When coded dosage information is present, the free text may still be present for display to humans. 282 */ 283 public String getText() { 284 return this.text == null ? null : this.text.getValue(); 285 } 286 287 /** 288 * @param value Free text dosage information as reported about a patient's medication use. When coded dosage information is present, the free text may still be present for display to humans. 289 */ 290 public MedicationStatementDosageComponent setText(String value) { 291 if (Utilities.noString(value)) 292 this.text = null; 293 else { 294 if (this.text == null) 295 this.text = new StringType(); 296 this.text.setValue(value); 297 } 298 return this; 299 } 300 301 /** 302 * @return {@link #timing} (The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 303 */ 304 public Timing getTiming() { 305 if (this.timing == null) 306 if (Configuration.errorOnAutoCreate()) 307 throw new Error("Attempt to auto-create MedicationStatementDosageComponent.timing"); 308 else if (Configuration.doAutoCreate()) 309 this.timing = new Timing(); // cc 310 return this.timing; 311 } 312 313 public boolean hasTiming() { 314 return this.timing != null && !this.timing.isEmpty(); 315 } 316 317 /** 318 * @param value {@link #timing} (The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".) 319 */ 320 public MedicationStatementDosageComponent setTiming(Timing value) { 321 this.timing = value; 322 return this; 323 } 324 325 /** 326 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 327 328Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 329 */ 330 public Type getAsNeeded() { 331 return this.asNeeded; 332 } 333 334 /** 335 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 336 337Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 338 */ 339 public BooleanType getAsNeededBooleanType() throws FHIRException { 340 if (!(this.asNeeded instanceof BooleanType)) 341 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 342 return (BooleanType) this.asNeeded; 343 } 344 345 public boolean hasAsNeededBooleanType() { 346 return this.asNeeded instanceof BooleanType; 347 } 348 349 /** 350 * @return {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 351 352Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 353 */ 354 public CodeableConcept getAsNeededCodeableConcept() throws FHIRException { 355 if (!(this.asNeeded instanceof CodeableConcept)) 356 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.asNeeded.getClass().getName()+" was encountered"); 357 return (CodeableConcept) this.asNeeded; 358 } 359 360 public boolean hasAsNeededCodeableConcept() { 361 return this.asNeeded instanceof CodeableConcept; 362 } 363 364 public boolean hasAsNeeded() { 365 return this.asNeeded != null && !this.asNeeded.isEmpty(); 366 } 367 368 /** 369 * @param value {@link #asNeeded} (Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). 370 371Specifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.) 372 */ 373 public MedicationStatementDosageComponent setAsNeeded(Type value) { 374 this.asNeeded = value; 375 return this; 376 } 377 378 /** 379 * @return {@link #site} (A coded specification of or a reference to the anatomic site where the medication first enters the body.) 380 */ 381 public Type getSite() { 382 return this.site; 383 } 384 385 /** 386 * @return {@link #site} (A coded specification of or a reference to the anatomic site where the medication first enters the body.) 387 */ 388 public CodeableConcept getSiteCodeableConcept() throws FHIRException { 389 if (!(this.site instanceof CodeableConcept)) 390 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.site.getClass().getName()+" was encountered"); 391 return (CodeableConcept) this.site; 392 } 393 394 public boolean hasSiteCodeableConcept() { 395 return this.site instanceof CodeableConcept; 396 } 397 398 /** 399 * @return {@link #site} (A coded specification of or a reference to the anatomic site where the medication first enters the body.) 400 */ 401 public Reference getSiteReference() throws FHIRException { 402 if (!(this.site instanceof Reference)) 403 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.site.getClass().getName()+" was encountered"); 404 return (Reference) this.site; 405 } 406 407 public boolean hasSiteReference() { 408 return this.site instanceof Reference; 409 } 410 411 public boolean hasSite() { 412 return this.site != null && !this.site.isEmpty(); 413 } 414 415 /** 416 * @param value {@link #site} (A coded specification of or a reference to the anatomic site where the medication first enters the body.) 417 */ 418 public MedicationStatementDosageComponent setSite(Type value) { 419 this.site = value; 420 return this; 421 } 422 423 /** 424 * @return {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.) 425 */ 426 public CodeableConcept getRoute() { 427 if (this.route == null) 428 if (Configuration.errorOnAutoCreate()) 429 throw new Error("Attempt to auto-create MedicationStatementDosageComponent.route"); 430 else if (Configuration.doAutoCreate()) 431 this.route = new CodeableConcept(); // cc 432 return this.route; 433 } 434 435 public boolean hasRoute() { 436 return this.route != null && !this.route.isEmpty(); 437 } 438 439 /** 440 * @param value {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.) 441 */ 442 public MedicationStatementDosageComponent setRoute(CodeableConcept value) { 443 this.route = value; 444 return this; 445 } 446 447 /** 448 * @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.) 449 */ 450 public CodeableConcept getMethod() { 451 if (this.method == null) 452 if (Configuration.errorOnAutoCreate()) 453 throw new Error("Attempt to auto-create MedicationStatementDosageComponent.method"); 454 else if (Configuration.doAutoCreate()) 455 this.method = new CodeableConcept(); // cc 456 return this.method; 457 } 458 459 public boolean hasMethod() { 460 return this.method != null && !this.method.isEmpty(); 461 } 462 463 /** 464 * @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.) 465 */ 466 public MedicationStatementDosageComponent setMethod(CodeableConcept value) { 467 this.method = value; 468 return this; 469 } 470 471 /** 472 * @return {@link #quantity} (The amount of therapeutic or other substance given at one administration event.) 473 */ 474 public Type getQuantity() { 475 return this.quantity; 476 } 477 478 /** 479 * @return {@link #quantity} (The amount of therapeutic or other substance given at one administration event.) 480 */ 481 public SimpleQuantity getQuantitySimpleQuantity() throws FHIRException { 482 if (!(this.quantity instanceof SimpleQuantity)) 483 throw new FHIRException("Type mismatch: the type SimpleQuantity was expected, but "+this.quantity.getClass().getName()+" was encountered"); 484 return (SimpleQuantity) this.quantity; 485 } 486 487 public boolean hasQuantitySimpleQuantity() { 488 return this.quantity instanceof SimpleQuantity; 489 } 490 491 /** 492 * @return {@link #quantity} (The amount of therapeutic or other substance given at one administration event.) 493 */ 494 public Range getQuantityRange() throws FHIRException { 495 if (!(this.quantity instanceof Range)) 496 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.quantity.getClass().getName()+" was encountered"); 497 return (Range) this.quantity; 498 } 499 500 public boolean hasQuantityRange() { 501 return this.quantity instanceof Range; 502 } 503 504 public boolean hasQuantity() { 505 return this.quantity != null && !this.quantity.isEmpty(); 506 } 507 508 /** 509 * @param value {@link #quantity} (The amount of therapeutic or other substance given at one administration event.) 510 */ 511 public MedicationStatementDosageComponent setQuantity(Type value) { 512 this.quantity = value; 513 return this; 514 } 515 516 /** 517 * @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.) 518 */ 519 public Type getRate() { 520 return this.rate; 521 } 522 523 /** 524 * @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.) 525 */ 526 public Ratio getRateRatio() throws FHIRException { 527 if (!(this.rate instanceof Ratio)) 528 throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered"); 529 return (Ratio) this.rate; 530 } 531 532 public boolean hasRateRatio() { 533 return this.rate instanceof Ratio; 534 } 535 536 /** 537 * @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.) 538 */ 539 public Range getRateRange() throws FHIRException { 540 if (!(this.rate instanceof Range)) 541 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.rate.getClass().getName()+" was encountered"); 542 return (Range) this.rate; 543 } 544 545 public boolean hasRateRange() { 546 return this.rate instanceof Range; 547 } 548 549 public boolean hasRate() { 550 return this.rate != null && !this.rate.isEmpty(); 551 } 552 553 /** 554 * @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.) 555 */ 556 public MedicationStatementDosageComponent setRate(Type value) { 557 this.rate = value; 558 return this; 559 } 560 561 /** 562 * @return {@link #maxDosePerPeriod} (The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours.) 563 */ 564 public Ratio getMaxDosePerPeriod() { 565 if (this.maxDosePerPeriod == null) 566 if (Configuration.errorOnAutoCreate()) 567 throw new Error("Attempt to auto-create MedicationStatementDosageComponent.maxDosePerPeriod"); 568 else if (Configuration.doAutoCreate()) 569 this.maxDosePerPeriod = new Ratio(); // cc 570 return this.maxDosePerPeriod; 571 } 572 573 public boolean hasMaxDosePerPeriod() { 574 return this.maxDosePerPeriod != null && !this.maxDosePerPeriod.isEmpty(); 575 } 576 577 /** 578 * @param value {@link #maxDosePerPeriod} (The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours.) 579 */ 580 public MedicationStatementDosageComponent setMaxDosePerPeriod(Ratio value) { 581 this.maxDosePerPeriod = value; 582 return this; 583 } 584 585 protected void listChildren(List<Property> childrenList) { 586 super.listChildren(childrenList); 587 childrenList.add(new Property("text", "string", "Free text dosage information as reported about a patient's medication use. When coded dosage information is present, the free text may still be present for display to humans.", 0, java.lang.Integer.MAX_VALUE, text)); 588 childrenList.add(new Property("timing", "Timing", "The timing schedule for giving the medication to the patient. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, java.lang.Integer.MAX_VALUE, timing)); 589 childrenList.add(new Property("asNeeded[x]", "boolean|CodeableConcept", "Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept). \n\nSpecifically if 'boolean' datatype is selected, then the following logic applies: If set to True, this indicates that the medication is only taken when needed, within the specified schedule.", 0, java.lang.Integer.MAX_VALUE, asNeeded)); 590 childrenList.add(new Property("site[x]", "CodeableConcept|Reference(BodySite)", "A coded specification of or a reference to the anatomic site where the medication first enters the body.", 0, java.lang.Integer.MAX_VALUE, site)); 591 childrenList.add(new Property("route", "CodeableConcept", "A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.", 0, java.lang.Integer.MAX_VALUE, route)); 592 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)); 593 childrenList.add(new Property("quantity[x]", "SimpleQuantity|Range", "The amount of therapeutic or other substance given at one administration event.", 0, java.lang.Integer.MAX_VALUE, quantity)); 594 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)); 595 childrenList.add(new Property("maxDosePerPeriod", "Ratio", "The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. For example, 1000mg in 24 hours.", 0, java.lang.Integer.MAX_VALUE, maxDosePerPeriod)); 596 } 597 598 @Override 599 public void setProperty(String name, Base value) throws FHIRException { 600 if (name.equals("text")) 601 this.text = castToString(value); // StringType 602 else if (name.equals("timing")) 603 this.timing = castToTiming(value); // Timing 604 else if (name.equals("asNeeded[x]")) 605 this.asNeeded = (Type) value; // Type 606 else if (name.equals("site[x]")) 607 this.site = (Type) value; // Type 608 else if (name.equals("route")) 609 this.route = castToCodeableConcept(value); // CodeableConcept 610 else if (name.equals("method")) 611 this.method = castToCodeableConcept(value); // CodeableConcept 612 else if (name.equals("quantity[x]")) 613 this.quantity = (Type) value; // Type 614 else if (name.equals("rate[x]")) 615 this.rate = (Type) value; // Type 616 else if (name.equals("maxDosePerPeriod")) 617 this.maxDosePerPeriod = castToRatio(value); // Ratio 618 else 619 super.setProperty(name, value); 620 } 621 622 @Override 623 public Base addChild(String name) throws FHIRException { 624 if (name.equals("text")) { 625 throw new FHIRException("Cannot call addChild on a primitive type MedicationStatement.text"); 626 } 627 else if (name.equals("timing")) { 628 this.timing = new Timing(); 629 return this.timing; 630 } 631 else if (name.equals("asNeededBoolean")) { 632 this.asNeeded = new BooleanType(); 633 return this.asNeeded; 634 } 635 else if (name.equals("asNeededCodeableConcept")) { 636 this.asNeeded = new CodeableConcept(); 637 return this.asNeeded; 638 } 639 else if (name.equals("siteCodeableConcept")) { 640 this.site = new CodeableConcept(); 641 return this.site; 642 } 643 else if (name.equals("siteReference")) { 644 this.site = new Reference(); 645 return this.site; 646 } 647 else if (name.equals("route")) { 648 this.route = new CodeableConcept(); 649 return this.route; 650 } 651 else if (name.equals("method")) { 652 this.method = new CodeableConcept(); 653 return this.method; 654 } 655 else if (name.equals("quantitySimpleQuantity")) { 656 this.quantity = new SimpleQuantity(); 657 return this.quantity; 658 } 659 else if (name.equals("quantityRange")) { 660 this.quantity = new Range(); 661 return this.quantity; 662 } 663 else if (name.equals("rateRatio")) { 664 this.rate = new Ratio(); 665 return this.rate; 666 } 667 else if (name.equals("rateRange")) { 668 this.rate = new Range(); 669 return this.rate; 670 } 671 else if (name.equals("maxDosePerPeriod")) { 672 this.maxDosePerPeriod = new Ratio(); 673 return this.maxDosePerPeriod; 674 } 675 else 676 return super.addChild(name); 677 } 678 679 public MedicationStatementDosageComponent copy() { 680 MedicationStatementDosageComponent dst = new MedicationStatementDosageComponent(); 681 copyValues(dst); 682 dst.text = text == null ? null : text.copy(); 683 dst.timing = timing == null ? null : timing.copy(); 684 dst.asNeeded = asNeeded == null ? null : asNeeded.copy(); 685 dst.site = site == null ? null : site.copy(); 686 dst.route = route == null ? null : route.copy(); 687 dst.method = method == null ? null : method.copy(); 688 dst.quantity = quantity == null ? null : quantity.copy(); 689 dst.rate = rate == null ? null : rate.copy(); 690 dst.maxDosePerPeriod = maxDosePerPeriod == null ? null : maxDosePerPeriod.copy(); 691 return dst; 692 } 693 694 @Override 695 public boolean equalsDeep(Base other) { 696 if (!super.equalsDeep(other)) 697 return false; 698 if (!(other instanceof MedicationStatementDosageComponent)) 699 return false; 700 MedicationStatementDosageComponent o = (MedicationStatementDosageComponent) other; 701 return compareDeep(text, o.text, true) && compareDeep(timing, o.timing, true) && compareDeep(asNeeded, o.asNeeded, true) 702 && compareDeep(site, o.site, true) && compareDeep(route, o.route, true) && compareDeep(method, o.method, true) 703 && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true) && compareDeep(maxDosePerPeriod, o.maxDosePerPeriod, true) 704 ; 705 } 706 707 @Override 708 public boolean equalsShallow(Base other) { 709 if (!super.equalsShallow(other)) 710 return false; 711 if (!(other instanceof MedicationStatementDosageComponent)) 712 return false; 713 MedicationStatementDosageComponent o = (MedicationStatementDosageComponent) other; 714 return compareValues(text, o.text, true); 715 } 716 717 public boolean isEmpty() { 718 return super.isEmpty() && (text == null || text.isEmpty()) && (timing == null || timing.isEmpty()) 719 && (asNeeded == null || asNeeded.isEmpty()) && (site == null || site.isEmpty()) && (route == null || route.isEmpty()) 720 && (method == null || method.isEmpty()) && (quantity == null || quantity.isEmpty()) && (rate == null || rate.isEmpty()) 721 && (maxDosePerPeriod == null || maxDosePerPeriod.isEmpty()); 722 } 723 724 public String fhirType() { 725 return "MedicationStatement.dosage"; 726 727 } 728 729 } 730 731 /** 732 * 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. 733 */ 734 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 735 @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." ) 736 protected List<Identifier> identifier; 737 738 /** 739 * The person or animal who is/was taking the medication. 740 */ 741 @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true) 742 @Description(shortDefinition="Who is/was taking the medication", formalDefinition="The person or animal who is/was taking the medication." ) 743 protected Reference patient; 744 745 /** 746 * The actual object that is the target of the reference (The person or animal who is/was taking the medication.) 747 */ 748 protected Patient patientTarget; 749 750 /** 751 * The person who provided the information about the taking of this medication. 752 */ 753 @Child(name = "informationSource", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=true) 754 @Description(shortDefinition="", formalDefinition="The person who provided the information about the taking of this medication." ) 755 protected Reference informationSource; 756 757 /** 758 * The actual object that is the target of the reference (The person who provided the information about the taking of this medication.) 759 */ 760 protected Resource informationSourceTarget; 761 762 /** 763 * The date when the medication statement was asserted by the information source. 764 */ 765 @Child(name = "dateAsserted", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true) 766 @Description(shortDefinition="When the statement was asserted?", formalDefinition="The date when the medication statement was asserted by the information source." ) 767 protected DateTimeType dateAsserted; 768 769 /** 770 * A code representing the patient or other source's judgment about the state of the medication used that this statement is about. Generally this will be active or completed. 771 */ 772 @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true) 773 @Description(shortDefinition="active | completed | entered-in-error | intended", formalDefinition="A code representing the patient or other source's judgment about the state of the medication used that this statement is about. Generally this will be active or completed." ) 774 protected Enumeration<MedicationStatementStatus> status; 775 776 /** 777 * Set this to true if the record is saying that the medication was NOT taken. 778 */ 779 @Child(name = "wasNotTaken", type = {BooleanType.class}, order=5, min=0, max=1, modifier=true, summary=true) 780 @Description(shortDefinition="True if medication is/was not being taken", formalDefinition="Set this to true if the record is saying that the medication was NOT taken." ) 781 protected BooleanType wasNotTaken; 782 783 /** 784 * A code indicating why the medication was not taken. 785 */ 786 @Child(name = "reasonNotTaken", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 787 @Description(shortDefinition="True if asserting medication was not given", formalDefinition="A code indicating why the medication was not taken." ) 788 protected List<CodeableConcept> reasonNotTaken; 789 790 /** 791 * A reason for why the medication is being/was taken. 792 */ 793 @Child(name = "reasonForUse", type = {CodeableConcept.class, Condition.class}, order=7, min=0, max=1, modifier=false, summary=true) 794 @Description(shortDefinition="", formalDefinition="A reason for why the medication is being/was taken." ) 795 protected Type reasonForUse; 796 797 /** 798 * The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true). 799 */ 800 @Child(name = "effective", type = {DateTimeType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=true) 801 @Description(shortDefinition="Over what period was medication consumed?", formalDefinition="The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true)." ) 802 protected Type effective; 803 804 /** 805 * Provides extra information about the medication statement that is not conveyed by the other attributes. 806 */ 807 @Child(name = "note", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true) 808 @Description(shortDefinition="Further information about the statement", formalDefinition="Provides extra information about the medication statement that is not conveyed by the other attributes." ) 809 protected StringType note; 810 811 /** 812 * Allows linking the MedicationStatement to the underlying MedicationOrder, or to other information that supports the MedicationStatement. 813 */ 814 @Child(name = "supportingInformation", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 815 @Description(shortDefinition="Additional supporting information", formalDefinition="Allows linking the MedicationStatement to the underlying MedicationOrder, or to other information that supports the MedicationStatement." ) 816 protected List<Reference> supportingInformation; 817 /** 818 * The actual objects that are the target of the reference (Allows linking the MedicationStatement to the underlying MedicationOrder, or to other information that supports the MedicationStatement.) 819 */ 820 protected List<Resource> supportingInformationTarget; 821 822 823 /** 824 * Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications. 825 */ 826 @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=11, min=1, max=1, modifier=false, summary=true) 827 @Description(shortDefinition="What medication was taken", formalDefinition="Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications." ) 828 protected Type medication; 829 830 /** 831 * Indicates how the medication is/was used by the patient. 832 */ 833 @Child(name = "dosage", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 834 @Description(shortDefinition="Details of how medication was taken", formalDefinition="Indicates how the medication is/was used by the patient." ) 835 protected List<MedicationStatementDosageComponent> dosage; 836 837 private static final long serialVersionUID = 55795672L; 838 839 /* 840 * Constructor 841 */ 842 public MedicationStatement() { 843 super(); 844 } 845 846 /* 847 * Constructor 848 */ 849 public MedicationStatement(Reference patient, Enumeration<MedicationStatementStatus> status, Type medication) { 850 super(); 851 this.patient = patient; 852 this.status = status; 853 this.medication = medication; 854 } 855 856 /** 857 * @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.) 858 */ 859 public List<Identifier> getIdentifier() { 860 if (this.identifier == null) 861 this.identifier = new ArrayList<Identifier>(); 862 return this.identifier; 863 } 864 865 public boolean hasIdentifier() { 866 if (this.identifier == null) 867 return false; 868 for (Identifier item : this.identifier) 869 if (!item.isEmpty()) 870 return true; 871 return false; 872 } 873 874 /** 875 * @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.) 876 */ 877 // syntactic sugar 878 public Identifier addIdentifier() { //3 879 Identifier t = new Identifier(); 880 if (this.identifier == null) 881 this.identifier = new ArrayList<Identifier>(); 882 this.identifier.add(t); 883 return t; 884 } 885 886 // syntactic sugar 887 public MedicationStatement addIdentifier(Identifier t) { //3 888 if (t == null) 889 return this; 890 if (this.identifier == null) 891 this.identifier = new ArrayList<Identifier>(); 892 this.identifier.add(t); 893 return this; 894 } 895 896 /** 897 * @return {@link #patient} (The person or animal who is/was taking the medication.) 898 */ 899 public Reference getPatient() { 900 if (this.patient == null) 901 if (Configuration.errorOnAutoCreate()) 902 throw new Error("Attempt to auto-create MedicationStatement.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 who is/was taking the medication.) 914 */ 915 public MedicationStatement 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 who is/was taking the medication.) 922 */ 923 public Patient getPatientTarget() { 924 if (this.patientTarget == null) 925 if (Configuration.errorOnAutoCreate()) 926 throw new Error("Attempt to auto-create MedicationStatement.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 who is/was taking the medication.) 934 */ 935 public MedicationStatement setPatientTarget(Patient value) { 936 this.patientTarget = value; 937 return this; 938 } 939 940 /** 941 * @return {@link #informationSource} (The person who provided the information about the taking of this medication.) 942 */ 943 public Reference getInformationSource() { 944 if (this.informationSource == null) 945 if (Configuration.errorOnAutoCreate()) 946 throw new Error("Attempt to auto-create MedicationStatement.informationSource"); 947 else if (Configuration.doAutoCreate()) 948 this.informationSource = new Reference(); // cc 949 return this.informationSource; 950 } 951 952 public boolean hasInformationSource() { 953 return this.informationSource != null && !this.informationSource.isEmpty(); 954 } 955 956 /** 957 * @param value {@link #informationSource} (The person who provided the information about the taking of this medication.) 958 */ 959 public MedicationStatement setInformationSource(Reference value) { 960 this.informationSource = value; 961 return this; 962 } 963 964 /** 965 * @return {@link #informationSource} 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 who provided the information about the taking of this medication.) 966 */ 967 public Resource getInformationSourceTarget() { 968 return this.informationSourceTarget; 969 } 970 971 /** 972 * @param value {@link #informationSource} 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 who provided the information about the taking of this medication.) 973 */ 974 public MedicationStatement setInformationSourceTarget(Resource value) { 975 this.informationSourceTarget = value; 976 return this; 977 } 978 979 /** 980 * @return {@link #dateAsserted} (The date when the medication statement was asserted by the information source.). This is the underlying object with id, value and extensions. The accessor "getDateAsserted" gives direct access to the value 981 */ 982 public DateTimeType getDateAssertedElement() { 983 if (this.dateAsserted == null) 984 if (Configuration.errorOnAutoCreate()) 985 throw new Error("Attempt to auto-create MedicationStatement.dateAsserted"); 986 else if (Configuration.doAutoCreate()) 987 this.dateAsserted = new DateTimeType(); // bb 988 return this.dateAsserted; 989 } 990 991 public boolean hasDateAssertedElement() { 992 return this.dateAsserted != null && !this.dateAsserted.isEmpty(); 993 } 994 995 public boolean hasDateAsserted() { 996 return this.dateAsserted != null && !this.dateAsserted.isEmpty(); 997 } 998 999 /** 1000 * @param value {@link #dateAsserted} (The date when the medication statement was asserted by the information source.). This is the underlying object with id, value and extensions. The accessor "getDateAsserted" gives direct access to the value 1001 */ 1002 public MedicationStatement setDateAssertedElement(DateTimeType value) { 1003 this.dateAsserted = value; 1004 return this; 1005 } 1006 1007 /** 1008 * @return The date when the medication statement was asserted by the information source. 1009 */ 1010 public Date getDateAsserted() { 1011 return this.dateAsserted == null ? null : this.dateAsserted.getValue(); 1012 } 1013 1014 /** 1015 * @param value The date when the medication statement was asserted by the information source. 1016 */ 1017 public MedicationStatement setDateAsserted(Date value) { 1018 if (value == null) 1019 this.dateAsserted = null; 1020 else { 1021 if (this.dateAsserted == null) 1022 this.dateAsserted = new DateTimeType(); 1023 this.dateAsserted.setValue(value); 1024 } 1025 return this; 1026 } 1027 1028 /** 1029 * @return {@link #status} (A code representing the patient or other source's judgment about the state of the medication used that this statement is about. Generally this will be active or completed.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1030 */ 1031 public Enumeration<MedicationStatementStatus> getStatusElement() { 1032 if (this.status == null) 1033 if (Configuration.errorOnAutoCreate()) 1034 throw new Error("Attempt to auto-create MedicationStatement.status"); 1035 else if (Configuration.doAutoCreate()) 1036 this.status = new Enumeration<MedicationStatementStatus>(new MedicationStatementStatusEnumFactory()); // bb 1037 return this.status; 1038 } 1039 1040 public boolean hasStatusElement() { 1041 return this.status != null && !this.status.isEmpty(); 1042 } 1043 1044 public boolean hasStatus() { 1045 return this.status != null && !this.status.isEmpty(); 1046 } 1047 1048 /** 1049 * @param value {@link #status} (A code representing the patient or other source's judgment about the state of the medication used that this statement is about. Generally this will be active or completed.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1050 */ 1051 public MedicationStatement setStatusElement(Enumeration<MedicationStatementStatus> value) { 1052 this.status = value; 1053 return this; 1054 } 1055 1056 /** 1057 * @return A code representing the patient or other source's judgment about the state of the medication used that this statement is about. Generally this will be active or completed. 1058 */ 1059 public MedicationStatementStatus getStatus() { 1060 return this.status == null ? null : this.status.getValue(); 1061 } 1062 1063 /** 1064 * @param value A code representing the patient or other source's judgment about the state of the medication used that this statement is about. Generally this will be active or completed. 1065 */ 1066 public MedicationStatement setStatus(MedicationStatementStatus value) { 1067 if (this.status == null) 1068 this.status = new Enumeration<MedicationStatementStatus>(new MedicationStatementStatusEnumFactory()); 1069 this.status.setValue(value); 1070 return this; 1071 } 1072 1073 /** 1074 * @return {@link #wasNotTaken} (Set this to true if the record is saying that the medication was NOT taken.). This is the underlying object with id, value and extensions. The accessor "getWasNotTaken" gives direct access to the value 1075 */ 1076 public BooleanType getWasNotTakenElement() { 1077 if (this.wasNotTaken == null) 1078 if (Configuration.errorOnAutoCreate()) 1079 throw new Error("Attempt to auto-create MedicationStatement.wasNotTaken"); 1080 else if (Configuration.doAutoCreate()) 1081 this.wasNotTaken = new BooleanType(); // bb 1082 return this.wasNotTaken; 1083 } 1084 1085 public boolean hasWasNotTakenElement() { 1086 return this.wasNotTaken != null && !this.wasNotTaken.isEmpty(); 1087 } 1088 1089 public boolean hasWasNotTaken() { 1090 return this.wasNotTaken != null && !this.wasNotTaken.isEmpty(); 1091 } 1092 1093 /** 1094 * @param value {@link #wasNotTaken} (Set this to true if the record is saying that the medication was NOT taken.). This is the underlying object with id, value and extensions. The accessor "getWasNotTaken" gives direct access to the value 1095 */ 1096 public MedicationStatement setWasNotTakenElement(BooleanType value) { 1097 this.wasNotTaken = value; 1098 return this; 1099 } 1100 1101 /** 1102 * @return Set this to true if the record is saying that the medication was NOT taken. 1103 */ 1104 public boolean getWasNotTaken() { 1105 return this.wasNotTaken == null || this.wasNotTaken.isEmpty() ? false : this.wasNotTaken.getValue(); 1106 } 1107 1108 /** 1109 * @param value Set this to true if the record is saying that the medication was NOT taken. 1110 */ 1111 public MedicationStatement setWasNotTaken(boolean value) { 1112 if (this.wasNotTaken == null) 1113 this.wasNotTaken = new BooleanType(); 1114 this.wasNotTaken.setValue(value); 1115 return this; 1116 } 1117 1118 /** 1119 * @return {@link #reasonNotTaken} (A code indicating why the medication was not taken.) 1120 */ 1121 public List<CodeableConcept> getReasonNotTaken() { 1122 if (this.reasonNotTaken == null) 1123 this.reasonNotTaken = new ArrayList<CodeableConcept>(); 1124 return this.reasonNotTaken; 1125 } 1126 1127 public boolean hasReasonNotTaken() { 1128 if (this.reasonNotTaken == null) 1129 return false; 1130 for (CodeableConcept item : this.reasonNotTaken) 1131 if (!item.isEmpty()) 1132 return true; 1133 return false; 1134 } 1135 1136 /** 1137 * @return {@link #reasonNotTaken} (A code indicating why the medication was not taken.) 1138 */ 1139 // syntactic sugar 1140 public CodeableConcept addReasonNotTaken() { //3 1141 CodeableConcept t = new CodeableConcept(); 1142 if (this.reasonNotTaken == null) 1143 this.reasonNotTaken = new ArrayList<CodeableConcept>(); 1144 this.reasonNotTaken.add(t); 1145 return t; 1146 } 1147 1148 // syntactic sugar 1149 public MedicationStatement addReasonNotTaken(CodeableConcept t) { //3 1150 if (t == null) 1151 return this; 1152 if (this.reasonNotTaken == null) 1153 this.reasonNotTaken = new ArrayList<CodeableConcept>(); 1154 this.reasonNotTaken.add(t); 1155 return this; 1156 } 1157 1158 /** 1159 * @return {@link #reasonForUse} (A reason for why the medication is being/was taken.) 1160 */ 1161 public Type getReasonForUse() { 1162 return this.reasonForUse; 1163 } 1164 1165 /** 1166 * @return {@link #reasonForUse} (A reason for why the medication is being/was taken.) 1167 */ 1168 public CodeableConcept getReasonForUseCodeableConcept() throws FHIRException { 1169 if (!(this.reasonForUse instanceof CodeableConcept)) 1170 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reasonForUse.getClass().getName()+" was encountered"); 1171 return (CodeableConcept) this.reasonForUse; 1172 } 1173 1174 public boolean hasReasonForUseCodeableConcept() { 1175 return this.reasonForUse instanceof CodeableConcept; 1176 } 1177 1178 /** 1179 * @return {@link #reasonForUse} (A reason for why the medication is being/was taken.) 1180 */ 1181 public Reference getReasonForUseReference() throws FHIRException { 1182 if (!(this.reasonForUse instanceof Reference)) 1183 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reasonForUse.getClass().getName()+" was encountered"); 1184 return (Reference) this.reasonForUse; 1185 } 1186 1187 public boolean hasReasonForUseReference() { 1188 return this.reasonForUse instanceof Reference; 1189 } 1190 1191 public boolean hasReasonForUse() { 1192 return this.reasonForUse != null && !this.reasonForUse.isEmpty(); 1193 } 1194 1195 /** 1196 * @param value {@link #reasonForUse} (A reason for why the medication is being/was taken.) 1197 */ 1198 public MedicationStatement setReasonForUse(Type value) { 1199 this.reasonForUse = value; 1200 return this; 1201 } 1202 1203 /** 1204 * @return {@link #effective} (The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true).) 1205 */ 1206 public Type getEffective() { 1207 return this.effective; 1208 } 1209 1210 /** 1211 * @return {@link #effective} (The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true).) 1212 */ 1213 public DateTimeType getEffectiveDateTimeType() throws FHIRException { 1214 if (!(this.effective instanceof DateTimeType)) 1215 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effective.getClass().getName()+" was encountered"); 1216 return (DateTimeType) this.effective; 1217 } 1218 1219 public boolean hasEffectiveDateTimeType() { 1220 return this.effective instanceof DateTimeType; 1221 } 1222 1223 /** 1224 * @return {@link #effective} (The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true).) 1225 */ 1226 public Period getEffectivePeriod() throws FHIRException { 1227 if (!(this.effective instanceof Period)) 1228 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effective.getClass().getName()+" was encountered"); 1229 return (Period) this.effective; 1230 } 1231 1232 public boolean hasEffectivePeriod() { 1233 return this.effective instanceof Period; 1234 } 1235 1236 public boolean hasEffective() { 1237 return this.effective != null && !this.effective.isEmpty(); 1238 } 1239 1240 /** 1241 * @param value {@link #effective} (The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true).) 1242 */ 1243 public MedicationStatement setEffective(Type value) { 1244 this.effective = value; 1245 return this; 1246 } 1247 1248 /** 1249 * @return {@link #note} (Provides extra information about the medication statement that is not conveyed by the other attributes.). This is the underlying object with id, value and extensions. The accessor "getNote" gives direct access to the value 1250 */ 1251 public StringType getNoteElement() { 1252 if (this.note == null) 1253 if (Configuration.errorOnAutoCreate()) 1254 throw new Error("Attempt to auto-create MedicationStatement.note"); 1255 else if (Configuration.doAutoCreate()) 1256 this.note = new StringType(); // bb 1257 return this.note; 1258 } 1259 1260 public boolean hasNoteElement() { 1261 return this.note != null && !this.note.isEmpty(); 1262 } 1263 1264 public boolean hasNote() { 1265 return this.note != null && !this.note.isEmpty(); 1266 } 1267 1268 /** 1269 * @param value {@link #note} (Provides extra information about the medication statement that is not conveyed by the other attributes.). This is the underlying object with id, value and extensions. The accessor "getNote" gives direct access to the value 1270 */ 1271 public MedicationStatement setNoteElement(StringType value) { 1272 this.note = value; 1273 return this; 1274 } 1275 1276 /** 1277 * @return Provides extra information about the medication statement that is not conveyed by the other attributes. 1278 */ 1279 public String getNote() { 1280 return this.note == null ? null : this.note.getValue(); 1281 } 1282 1283 /** 1284 * @param value Provides extra information about the medication statement that is not conveyed by the other attributes. 1285 */ 1286 public MedicationStatement setNote(String value) { 1287 if (Utilities.noString(value)) 1288 this.note = null; 1289 else { 1290 if (this.note == null) 1291 this.note = new StringType(); 1292 this.note.setValue(value); 1293 } 1294 return this; 1295 } 1296 1297 /** 1298 * @return {@link #supportingInformation} (Allows linking the MedicationStatement to the underlying MedicationOrder, or to other information that supports the MedicationStatement.) 1299 */ 1300 public List<Reference> getSupportingInformation() { 1301 if (this.supportingInformation == null) 1302 this.supportingInformation = new ArrayList<Reference>(); 1303 return this.supportingInformation; 1304 } 1305 1306 public boolean hasSupportingInformation() { 1307 if (this.supportingInformation == null) 1308 return false; 1309 for (Reference item : this.supportingInformation) 1310 if (!item.isEmpty()) 1311 return true; 1312 return false; 1313 } 1314 1315 /** 1316 * @return {@link #supportingInformation} (Allows linking the MedicationStatement to the underlying MedicationOrder, or to other information that supports the MedicationStatement.) 1317 */ 1318 // syntactic sugar 1319 public Reference addSupportingInformation() { //3 1320 Reference t = new Reference(); 1321 if (this.supportingInformation == null) 1322 this.supportingInformation = new ArrayList<Reference>(); 1323 this.supportingInformation.add(t); 1324 return t; 1325 } 1326 1327 // syntactic sugar 1328 public MedicationStatement addSupportingInformation(Reference t) { //3 1329 if (t == null) 1330 return this; 1331 if (this.supportingInformation == null) 1332 this.supportingInformation = new ArrayList<Reference>(); 1333 this.supportingInformation.add(t); 1334 return this; 1335 } 1336 1337 /** 1338 * @return {@link #supportingInformation} (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. Allows linking the MedicationStatement to the underlying MedicationOrder, or to other information that supports the MedicationStatement.) 1339 */ 1340 public List<Resource> getSupportingInformationTarget() { 1341 if (this.supportingInformationTarget == null) 1342 this.supportingInformationTarget = new ArrayList<Resource>(); 1343 return this.supportingInformationTarget; 1344 } 1345 1346 /** 1347 * @return {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1348 */ 1349 public Type getMedication() { 1350 return this.medication; 1351 } 1352 1353 /** 1354 * @return {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1355 */ 1356 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 1357 if (!(this.medication instanceof CodeableConcept)) 1358 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); 1359 return (CodeableConcept) this.medication; 1360 } 1361 1362 public boolean hasMedicationCodeableConcept() { 1363 return this.medication instanceof CodeableConcept; 1364 } 1365 1366 /** 1367 * @return {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1368 */ 1369 public Reference getMedicationReference() throws FHIRException { 1370 if (!(this.medication instanceof Reference)) 1371 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); 1372 return (Reference) this.medication; 1373 } 1374 1375 public boolean hasMedicationReference() { 1376 return this.medication instanceof Reference; 1377 } 1378 1379 public boolean hasMedication() { 1380 return this.medication != null && !this.medication.isEmpty(); 1381 } 1382 1383 /** 1384 * @param value {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.) 1385 */ 1386 public MedicationStatement setMedication(Type value) { 1387 this.medication = value; 1388 return this; 1389 } 1390 1391 /** 1392 * @return {@link #dosage} (Indicates how the medication is/was used by the patient.) 1393 */ 1394 public List<MedicationStatementDosageComponent> getDosage() { 1395 if (this.dosage == null) 1396 this.dosage = new ArrayList<MedicationStatementDosageComponent>(); 1397 return this.dosage; 1398 } 1399 1400 public boolean hasDosage() { 1401 if (this.dosage == null) 1402 return false; 1403 for (MedicationStatementDosageComponent item : this.dosage) 1404 if (!item.isEmpty()) 1405 return true; 1406 return false; 1407 } 1408 1409 /** 1410 * @return {@link #dosage} (Indicates how the medication is/was used by the patient.) 1411 */ 1412 // syntactic sugar 1413 public MedicationStatementDosageComponent addDosage() { //3 1414 MedicationStatementDosageComponent t = new MedicationStatementDosageComponent(); 1415 if (this.dosage == null) 1416 this.dosage = new ArrayList<MedicationStatementDosageComponent>(); 1417 this.dosage.add(t); 1418 return t; 1419 } 1420 1421 // syntactic sugar 1422 public MedicationStatement addDosage(MedicationStatementDosageComponent t) { //3 1423 if (t == null) 1424 return this; 1425 if (this.dosage == null) 1426 this.dosage = new ArrayList<MedicationStatementDosageComponent>(); 1427 this.dosage.add(t); 1428 return this; 1429 } 1430 1431 protected void listChildren(List<Property> childrenList) { 1432 super.listChildren(childrenList); 1433 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)); 1434 childrenList.add(new Property("patient", "Reference(Patient)", "The person or animal who is/was taking the medication.", 0, java.lang.Integer.MAX_VALUE, patient)); 1435 childrenList.add(new Property("informationSource", "Reference(Patient|Practitioner|RelatedPerson)", "The person who provided the information about the taking of this medication.", 0, java.lang.Integer.MAX_VALUE, informationSource)); 1436 childrenList.add(new Property("dateAsserted", "dateTime", "The date when the medication statement was asserted by the information source.", 0, java.lang.Integer.MAX_VALUE, dateAsserted)); 1437 childrenList.add(new Property("status", "code", "A code representing the patient or other source's judgment about the state of the medication used that this statement is about. Generally this will be active or completed.", 0, java.lang.Integer.MAX_VALUE, status)); 1438 childrenList.add(new Property("wasNotTaken", "boolean", "Set this to true if the record is saying that the medication was NOT taken.", 0, java.lang.Integer.MAX_VALUE, wasNotTaken)); 1439 childrenList.add(new Property("reasonNotTaken", "CodeableConcept", "A code indicating why the medication was not taken.", 0, java.lang.Integer.MAX_VALUE, reasonNotTaken)); 1440 childrenList.add(new Property("reasonForUse[x]", "CodeableConcept|Reference(Condition)", "A reason for why the medication is being/was taken.", 0, java.lang.Integer.MAX_VALUE, reasonForUse)); 1441 childrenList.add(new Property("effective[x]", "dateTime|Period", "The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true).", 0, java.lang.Integer.MAX_VALUE, effective)); 1442 childrenList.add(new Property("note", "string", "Provides extra information about the medication statement that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); 1443 childrenList.add(new Property("supportingInformation", "Reference(Any)", "Allows linking the MedicationStatement to the underlying MedicationOrder, or to other information that supports the MedicationStatement.", 0, java.lang.Integer.MAX_VALUE, supportingInformation)); 1444 childrenList.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, java.lang.Integer.MAX_VALUE, medication)); 1445 childrenList.add(new Property("dosage", "", "Indicates how the medication is/was used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosage)); 1446 } 1447 1448 @Override 1449 public void setProperty(String name, Base value) throws FHIRException { 1450 if (name.equals("identifier")) 1451 this.getIdentifier().add(castToIdentifier(value)); 1452 else if (name.equals("patient")) 1453 this.patient = castToReference(value); // Reference 1454 else if (name.equals("informationSource")) 1455 this.informationSource = castToReference(value); // Reference 1456 else if (name.equals("dateAsserted")) 1457 this.dateAsserted = castToDateTime(value); // DateTimeType 1458 else if (name.equals("status")) 1459 this.status = new MedicationStatementStatusEnumFactory().fromType(value); // Enumeration<MedicationStatementStatus> 1460 else if (name.equals("wasNotTaken")) 1461 this.wasNotTaken = castToBoolean(value); // BooleanType 1462 else if (name.equals("reasonNotTaken")) 1463 this.getReasonNotTaken().add(castToCodeableConcept(value)); 1464 else if (name.equals("reasonForUse[x]")) 1465 this.reasonForUse = (Type) value; // Type 1466 else if (name.equals("effective[x]")) 1467 this.effective = (Type) value; // Type 1468 else if (name.equals("note")) 1469 this.note = castToString(value); // StringType 1470 else if (name.equals("supportingInformation")) 1471 this.getSupportingInformation().add(castToReference(value)); 1472 else if (name.equals("medication[x]")) 1473 this.medication = (Type) value; // Type 1474 else if (name.equals("dosage")) 1475 this.getDosage().add((MedicationStatementDosageComponent) value); 1476 else 1477 super.setProperty(name, value); 1478 } 1479 1480 @Override 1481 public Base addChild(String name) throws FHIRException { 1482 if (name.equals("identifier")) { 1483 return addIdentifier(); 1484 } 1485 else if (name.equals("patient")) { 1486 this.patient = new Reference(); 1487 return this.patient; 1488 } 1489 else if (name.equals("informationSource")) { 1490 this.informationSource = new Reference(); 1491 return this.informationSource; 1492 } 1493 else if (name.equals("dateAsserted")) { 1494 throw new FHIRException("Cannot call addChild on a primitive type MedicationStatement.dateAsserted"); 1495 } 1496 else if (name.equals("status")) { 1497 throw new FHIRException("Cannot call addChild on a primitive type MedicationStatement.status"); 1498 } 1499 else if (name.equals("wasNotTaken")) { 1500 throw new FHIRException("Cannot call addChild on a primitive type MedicationStatement.wasNotTaken"); 1501 } 1502 else if (name.equals("reasonNotTaken")) { 1503 return addReasonNotTaken(); 1504 } 1505 else if (name.equals("reasonForUseCodeableConcept")) { 1506 this.reasonForUse = new CodeableConcept(); 1507 return this.reasonForUse; 1508 } 1509 else if (name.equals("reasonForUseReference")) { 1510 this.reasonForUse = new Reference(); 1511 return this.reasonForUse; 1512 } 1513 else if (name.equals("effectiveDateTime")) { 1514 this.effective = new DateTimeType(); 1515 return this.effective; 1516 } 1517 else if (name.equals("effectivePeriod")) { 1518 this.effective = new Period(); 1519 return this.effective; 1520 } 1521 else if (name.equals("note")) { 1522 throw new FHIRException("Cannot call addChild on a primitive type MedicationStatement.note"); 1523 } 1524 else if (name.equals("supportingInformation")) { 1525 return addSupportingInformation(); 1526 } 1527 else if (name.equals("medicationCodeableConcept")) { 1528 this.medication = new CodeableConcept(); 1529 return this.medication; 1530 } 1531 else if (name.equals("medicationReference")) { 1532 this.medication = new Reference(); 1533 return this.medication; 1534 } 1535 else if (name.equals("dosage")) { 1536 return addDosage(); 1537 } 1538 else 1539 return super.addChild(name); 1540 } 1541 1542 public String fhirType() { 1543 return "MedicationStatement"; 1544 1545 } 1546 1547 public MedicationStatement copy() { 1548 MedicationStatement dst = new MedicationStatement(); 1549 copyValues(dst); 1550 if (identifier != null) { 1551 dst.identifier = new ArrayList<Identifier>(); 1552 for (Identifier i : identifier) 1553 dst.identifier.add(i.copy()); 1554 }; 1555 dst.patient = patient == null ? null : patient.copy(); 1556 dst.informationSource = informationSource == null ? null : informationSource.copy(); 1557 dst.dateAsserted = dateAsserted == null ? null : dateAsserted.copy(); 1558 dst.status = status == null ? null : status.copy(); 1559 dst.wasNotTaken = wasNotTaken == null ? null : wasNotTaken.copy(); 1560 if (reasonNotTaken != null) { 1561 dst.reasonNotTaken = new ArrayList<CodeableConcept>(); 1562 for (CodeableConcept i : reasonNotTaken) 1563 dst.reasonNotTaken.add(i.copy()); 1564 }; 1565 dst.reasonForUse = reasonForUse == null ? null : reasonForUse.copy(); 1566 dst.effective = effective == null ? null : effective.copy(); 1567 dst.note = note == null ? null : note.copy(); 1568 if (supportingInformation != null) { 1569 dst.supportingInformation = new ArrayList<Reference>(); 1570 for (Reference i : supportingInformation) 1571 dst.supportingInformation.add(i.copy()); 1572 }; 1573 dst.medication = medication == null ? null : medication.copy(); 1574 if (dosage != null) { 1575 dst.dosage = new ArrayList<MedicationStatementDosageComponent>(); 1576 for (MedicationStatementDosageComponent i : dosage) 1577 dst.dosage.add(i.copy()); 1578 }; 1579 return dst; 1580 } 1581 1582 protected MedicationStatement typedCopy() { 1583 return copy(); 1584 } 1585 1586 @Override 1587 public boolean equalsDeep(Base other) { 1588 if (!super.equalsDeep(other)) 1589 return false; 1590 if (!(other instanceof MedicationStatement)) 1591 return false; 1592 MedicationStatement o = (MedicationStatement) other; 1593 return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(informationSource, o.informationSource, true) 1594 && compareDeep(dateAsserted, o.dateAsserted, true) && compareDeep(status, o.status, true) && compareDeep(wasNotTaken, o.wasNotTaken, true) 1595 && compareDeep(reasonNotTaken, o.reasonNotTaken, true) && compareDeep(reasonForUse, o.reasonForUse, true) 1596 && compareDeep(effective, o.effective, true) && compareDeep(note, o.note, true) && compareDeep(supportingInformation, o.supportingInformation, true) 1597 && compareDeep(medication, o.medication, true) && compareDeep(dosage, o.dosage, true); 1598 } 1599 1600 @Override 1601 public boolean equalsShallow(Base other) { 1602 if (!super.equalsShallow(other)) 1603 return false; 1604 if (!(other instanceof MedicationStatement)) 1605 return false; 1606 MedicationStatement o = (MedicationStatement) other; 1607 return compareValues(dateAsserted, o.dateAsserted, true) && compareValues(status, o.status, true) && compareValues(wasNotTaken, o.wasNotTaken, true) 1608 && compareValues(note, o.note, true); 1609 } 1610 1611 public boolean isEmpty() { 1612 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty()) 1613 && (informationSource == null || informationSource.isEmpty()) && (dateAsserted == null || dateAsserted.isEmpty()) 1614 && (status == null || status.isEmpty()) && (wasNotTaken == null || wasNotTaken.isEmpty()) 1615 && (reasonNotTaken == null || reasonNotTaken.isEmpty()) && (reasonForUse == null || reasonForUse.isEmpty()) 1616 && (effective == null || effective.isEmpty()) && (note == null || note.isEmpty()) && (supportingInformation == null || supportingInformation.isEmpty()) 1617 && (medication == null || medication.isEmpty()) && (dosage == null || dosage.isEmpty()); 1618 } 1619 1620 @Override 1621 public ResourceType getResourceType() { 1622 return ResourceType.MedicationStatement; 1623 } 1624 1625 @SearchParamDefinition(name="identifier", path="MedicationStatement.identifier", description="Return statements with this external identifier", type="token" ) 1626 public static final String SP_IDENTIFIER = "identifier"; 1627 @SearchParamDefinition(name="code", path="MedicationStatement.medicationCodeableConcept", description="Return administrations of this medication code", type="token" ) 1628 public static final String SP_CODE = "code"; 1629 @SearchParamDefinition(name="patient", path="MedicationStatement.patient", description="The identity of a patient to list statements for", type="reference" ) 1630 public static final String SP_PATIENT = "patient"; 1631 @SearchParamDefinition(name="medication", path="MedicationStatement.medicationReference", description="Return administrations of this medication reference", type="reference" ) 1632 public static final String SP_MEDICATION = "medication"; 1633 @SearchParamDefinition(name="source", path="MedicationStatement.informationSource", description="Who the information in the statement came from", type="reference" ) 1634 public static final String SP_SOURCE = "source"; 1635 @SearchParamDefinition(name="effectivedate", path="MedicationStatement.effective[x]", description="Date when patient was taking (or not taking) the medication", type="date" ) 1636 public static final String SP_EFFECTIVEDATE = "effectivedate"; 1637 @SearchParamDefinition(name="status", path="MedicationStatement.status", description="Return statements that match the given status", type="token" ) 1638 public static final String SP_STATUS = "status"; 1639 1640}