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