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