
001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 033import java.util.ArrayList; 034import java.util.Date; 035import java.util.List; 036 037import org.hl7.fhir.exceptions.FHIRException; 038 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.Description; 041import ca.uhn.fhir.model.api.annotation.ResourceDef; 042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 043 044/** 045 * A record of a medication that is being consumed by a patient. A 046 * MedicationStatement may indicate that the patient may be taking the 047 * medication now or has taken the medication in the past or will be taking the 048 * medication in the future. The source of this information can be the patient, 049 * significant other (such as a family member or spouse), or a clinician. A 050 * common scenario where this information is captured is during the history 051 * taking process during a patient visit or stay. The medication information may 052 * come from sources such as the patient's memory, from a prescription bottle, 053 * or from a list of medications the patient, clinician or other party 054 * maintains. 055 * 056 * The primary difference between a medication statement and a medication 057 * administration is that the medication administration has complete 058 * administration information and is based on actual administration information 059 * from the person who administered the medication. A medication statement is 060 * often, if not always, less specific. There is no required date/time when the 061 * medication was administered, in fact we only know that a source has reported 062 * the patient is taking this medication, where details such as time, quantity, 063 * or rate or even medication product may be incomplete or missing or less 064 * precise. As stated earlier, the medication statement information may come 065 * from the patient's memory, from a prescription bottle or from a list of 066 * medications the patient, clinician or other party maintains. Medication 067 * administration is more formal and is not missing detailed information. 068 */ 069@ResourceDef(name = "MedicationStatement", profile = "http://hl7.org/fhir/StructureDefinition/MedicationStatement") 070public class MedicationStatement extends DomainResource { 071 072 public enum MedicationStatementStatus { 073 /** 074 * The medication is still being taken. 075 */ 076 ACTIVE, 077 /** 078 * The medication is no longer being taken. 079 */ 080 COMPLETED, 081 /** 082 * Some of the actions that are implied by the medication statement may have 083 * occurred. For example, the patient may have taken some of the medication. 084 * Clinical decision support systems should take this status into account. 085 */ 086 ENTEREDINERROR, 087 /** 088 * The medication may be taken at some time in the future. 089 */ 090 INTENDED, 091 /** 092 * Actions implied by the statement have been permanently halted, before all of 093 * them occurred. This should not be used if the statement was entered in error. 094 */ 095 STOPPED, 096 /** 097 * Actions implied by the statement have been temporarily halted, but are 098 * expected to continue later. May also be called 'suspended'. 099 */ 100 ONHOLD, 101 /** 102 * The state of the medication use is not currently known. 103 */ 104 UNKNOWN, 105 /** 106 * The medication was not consumed by the patient 107 */ 108 NOTTAKEN, 109 /** 110 * added to help the parsers with the generic types 111 */ 112 NULL; 113 114 public static MedicationStatementStatus fromCode(String codeString) throws FHIRException { 115 if (codeString == null || "".equals(codeString)) 116 return null; 117 if ("active".equals(codeString)) 118 return ACTIVE; 119 if ("completed".equals(codeString)) 120 return COMPLETED; 121 if ("entered-in-error".equals(codeString)) 122 return ENTEREDINERROR; 123 if ("intended".equals(codeString)) 124 return INTENDED; 125 if ("stopped".equals(codeString)) 126 return STOPPED; 127 if ("on-hold".equals(codeString)) 128 return ONHOLD; 129 if ("unknown".equals(codeString)) 130 return UNKNOWN; 131 if ("not-taken".equals(codeString)) 132 return NOTTAKEN; 133 if (Configuration.isAcceptInvalidEnums()) 134 return null; 135 else 136 throw new FHIRException("Unknown MedicationStatementStatus code '" + codeString + "'"); 137 } 138 139 public String toCode() { 140 switch (this) { 141 case ACTIVE: 142 return "active"; 143 case COMPLETED: 144 return "completed"; 145 case ENTEREDINERROR: 146 return "entered-in-error"; 147 case INTENDED: 148 return "intended"; 149 case STOPPED: 150 return "stopped"; 151 case ONHOLD: 152 return "on-hold"; 153 case UNKNOWN: 154 return "unknown"; 155 case NOTTAKEN: 156 return "not-taken"; 157 case NULL: 158 return null; 159 default: 160 return "?"; 161 } 162 } 163 164 public String getSystem() { 165 switch (this) { 166 case ACTIVE: 167 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 168 case COMPLETED: 169 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 170 case ENTEREDINERROR: 171 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 172 case INTENDED: 173 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 174 case STOPPED: 175 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 176 case ONHOLD: 177 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 178 case UNKNOWN: 179 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 180 case NOTTAKEN: 181 return "http://hl7.org/fhir/CodeSystem/medication-statement-status"; 182 case NULL: 183 return null; 184 default: 185 return "?"; 186 } 187 } 188 189 public String getDefinition() { 190 switch (this) { 191 case ACTIVE: 192 return "The medication is still being taken."; 193 case COMPLETED: 194 return "The medication is no longer being taken."; 195 case ENTEREDINERROR: 196 return "Some of the actions that are implied by the medication statement may have occurred. For example, the patient may have taken some of the medication. Clinical decision support systems should take this status into account."; 197 case INTENDED: 198 return "The medication may be taken at some time in the future."; 199 case STOPPED: 200 return "Actions implied by the statement have been permanently halted, before all of them occurred. This should not be used if the statement was entered in error."; 201 case ONHOLD: 202 return "Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called 'suspended'."; 203 case UNKNOWN: 204 return "The state of the medication use is not currently known."; 205 case NOTTAKEN: 206 return "The medication was not consumed by the patient"; 207 case NULL: 208 return null; 209 default: 210 return "?"; 211 } 212 } 213 214 public String getDisplay() { 215 switch (this) { 216 case ACTIVE: 217 return "Active"; 218 case COMPLETED: 219 return "Completed"; 220 case ENTEREDINERROR: 221 return "Entered in Error"; 222 case INTENDED: 223 return "Intended"; 224 case STOPPED: 225 return "Stopped"; 226 case ONHOLD: 227 return "On Hold"; 228 case UNKNOWN: 229 return "Unknown"; 230 case NOTTAKEN: 231 return "Not Taken"; 232 case NULL: 233 return null; 234 default: 235 return "?"; 236 } 237 } 238 } 239 240 public static class MedicationStatementStatusEnumFactory implements EnumFactory<MedicationStatementStatus> { 241 public MedicationStatementStatus fromCode(String codeString) throws IllegalArgumentException { 242 if (codeString == null || "".equals(codeString)) 243 if (codeString == null || "".equals(codeString)) 244 return null; 245 if ("active".equals(codeString)) 246 return MedicationStatementStatus.ACTIVE; 247 if ("completed".equals(codeString)) 248 return MedicationStatementStatus.COMPLETED; 249 if ("entered-in-error".equals(codeString)) 250 return MedicationStatementStatus.ENTEREDINERROR; 251 if ("intended".equals(codeString)) 252 return MedicationStatementStatus.INTENDED; 253 if ("stopped".equals(codeString)) 254 return MedicationStatementStatus.STOPPED; 255 if ("on-hold".equals(codeString)) 256 return MedicationStatementStatus.ONHOLD; 257 if ("unknown".equals(codeString)) 258 return MedicationStatementStatus.UNKNOWN; 259 if ("not-taken".equals(codeString)) 260 return MedicationStatementStatus.NOTTAKEN; 261 throw new IllegalArgumentException("Unknown MedicationStatementStatus code '" + codeString + "'"); 262 } 263 264 public Enumeration<MedicationStatementStatus> fromType(PrimitiveType<?> code) throws FHIRException { 265 if (code == null) 266 return null; 267 if (code.isEmpty()) 268 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.NULL, code); 269 String codeString = code.asStringValue(); 270 if (codeString == null || "".equals(codeString)) 271 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.NULL, code); 272 if ("active".equals(codeString)) 273 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.ACTIVE, code); 274 if ("completed".equals(codeString)) 275 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.COMPLETED, code); 276 if ("entered-in-error".equals(codeString)) 277 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.ENTEREDINERROR, code); 278 if ("intended".equals(codeString)) 279 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.INTENDED, code); 280 if ("stopped".equals(codeString)) 281 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.STOPPED, code); 282 if ("on-hold".equals(codeString)) 283 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.ONHOLD, code); 284 if ("unknown".equals(codeString)) 285 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.UNKNOWN, code); 286 if ("not-taken".equals(codeString)) 287 return new Enumeration<MedicationStatementStatus>(this, MedicationStatementStatus.NOTTAKEN, code); 288 throw new FHIRException("Unknown MedicationStatementStatus code '" + codeString + "'"); 289 } 290 291 public String toCode(MedicationStatementStatus code) { 292 if (code == MedicationStatementStatus.NULL) 293 return null; 294 if (code == MedicationStatementStatus.ACTIVE) 295 return "active"; 296 if (code == MedicationStatementStatus.COMPLETED) 297 return "completed"; 298 if (code == MedicationStatementStatus.ENTEREDINERROR) 299 return "entered-in-error"; 300 if (code == MedicationStatementStatus.INTENDED) 301 return "intended"; 302 if (code == MedicationStatementStatus.STOPPED) 303 return "stopped"; 304 if (code == MedicationStatementStatus.ONHOLD) 305 return "on-hold"; 306 if (code == MedicationStatementStatus.UNKNOWN) 307 return "unknown"; 308 if (code == MedicationStatementStatus.NOTTAKEN) 309 return "not-taken"; 310 return "?"; 311 } 312 313 public String toSystem(MedicationStatementStatus code) { 314 return code.getSystem(); 315 } 316 } 317 318 /** 319 * Identifiers associated with this Medication Statement that are defined by 320 * business processes and/or used to refer to it when a direct URL reference to 321 * the resource itself is not appropriate. They are business identifiers 322 * assigned to this resource by the performer or other systems and remain 323 * constant as the resource is updated and propagates from server to server. 324 */ 325 @Child(name = "identifier", type = { 326 Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 327 @Description(shortDefinition = "External identifier", formalDefinition = "Identifiers associated with this Medication Statement that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.") 328 protected List<Identifier> identifier; 329 330 /** 331 * A plan, proposal or order that is fulfilled in whole or in part by this 332 * event. 333 */ 334 @Child(name = "basedOn", type = { MedicationRequest.class, CarePlan.class, 335 ServiceRequest.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 336 @Description(shortDefinition = "Fulfils plan, proposal or order", formalDefinition = "A plan, proposal or order that is fulfilled in whole or in part by this event.") 337 protected List<Reference> basedOn; 338 /** 339 * The actual objects that are the target of the reference (A plan, proposal or 340 * order that is fulfilled in whole or in part by this event.) 341 */ 342 protected List<Resource> basedOnTarget; 343 344 /** 345 * A larger event of which this particular event is a component or step. 346 */ 347 @Child(name = "partOf", type = { MedicationAdministration.class, MedicationDispense.class, MedicationStatement.class, 348 Procedure.class, 349 Observation.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 350 @Description(shortDefinition = "Part of referenced event", formalDefinition = "A larger event of which this particular event is a component or step.") 351 protected List<Reference> partOf; 352 /** 353 * The actual objects that are the target of the reference (A larger event of 354 * which this particular event is a component or step.) 355 */ 356 protected List<Resource> partOfTarget; 357 358 /** 359 * A code representing the patient or other source's judgment about the state of 360 * the medication used that this statement is about. Generally, this will be 361 * active or completed. 362 */ 363 @Child(name = "status", type = { CodeType.class }, order = 3, min = 1, max = 1, modifier = true, summary = true) 364 @Description(shortDefinition = "active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken", 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.") 365 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medication-statement-status") 366 protected Enumeration<MedicationStatementStatus> status; 367 368 /** 369 * Captures the reason for the current state of the MedicationStatement. 370 */ 371 @Child(name = "statusReason", type = { 372 CodeableConcept.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 373 @Description(shortDefinition = "Reason for current status", formalDefinition = "Captures the reason for the current state of the MedicationStatement.") 374 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/reason-medication-status-codes") 375 protected List<CodeableConcept> statusReason; 376 377 /** 378 * Indicates where the medication is expected to be consumed or administered. 379 */ 380 @Child(name = "category", type = { 381 CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 382 @Description(shortDefinition = "Type of medication usage", formalDefinition = "Indicates where the medication is expected to be consumed or administered.") 383 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medication-statement-category") 384 protected CodeableConcept category; 385 386 /** 387 * Identifies the medication being administered. This is either a link to a 388 * resource representing the details of the medication or a simple attribute 389 * carrying a code that identifies the medication from a known list of 390 * medications. 391 */ 392 @Child(name = "medication", type = { CodeableConcept.class, 393 Medication.class }, order = 6, min = 1, max = 1, modifier = false, summary = true) 394 @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.") 395 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medication-codes") 396 protected Type medication; 397 398 /** 399 * The person, animal or group who is/was taking the medication. 400 */ 401 @Child(name = "subject", type = { Patient.class, 402 Group.class }, order = 7, min = 1, max = 1, modifier = false, summary = true) 403 @Description(shortDefinition = "Who is/was taking the medication", formalDefinition = "The person, animal or group who is/was taking the medication.") 404 protected Reference subject; 405 406 /** 407 * The actual object that is the target of the reference (The person, animal or 408 * group who is/was taking the medication.) 409 */ 410 protected Resource subjectTarget; 411 412 /** 413 * The encounter or episode of care that establishes the context for this 414 * MedicationStatement. 415 */ 416 @Child(name = "context", type = { Encounter.class, 417 EpisodeOfCare.class }, order = 8, min = 0, max = 1, modifier = false, summary = true) 418 @Description(shortDefinition = "Encounter / Episode associated with MedicationStatement", formalDefinition = "The encounter or episode of care that establishes the context for this MedicationStatement.") 419 protected Reference context; 420 421 /** 422 * The actual object that is the target of the reference (The encounter or 423 * episode of care that establishes the context for this MedicationStatement.) 424 */ 425 protected Resource contextTarget; 426 427 /** 428 * The interval of time during which it is being asserted that the patient 429 * is/was/will be taking the medication (or was not taking, when the 430 * MedicationStatement.taken element is No). 431 */ 432 @Child(name = "effective", type = { DateTimeType.class, 433 Period.class }, order = 9, min = 0, max = 1, modifier = false, summary = true) 434 @Description(shortDefinition = "The date/time or interval when the medication is/was/will be taken", formalDefinition = "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationStatement.taken element is No).") 435 protected Type effective; 436 437 /** 438 * The date when the medication statement was asserted by the information 439 * source. 440 */ 441 @Child(name = "dateAsserted", type = { 442 DateTimeType.class }, order = 10, min = 0, max = 1, modifier = false, summary = true) 443 @Description(shortDefinition = "When the statement was asserted?", formalDefinition = "The date when the medication statement was asserted by the information source.") 444 protected DateTimeType dateAsserted; 445 446 /** 447 * The person or organization that provided the information about the taking of 448 * this medication. Note: Use derivedFrom when a MedicationStatement is derived 449 * from other resources, e.g. Claim or MedicationRequest. 450 */ 451 @Child(name = "informationSource", type = { Patient.class, Practitioner.class, PractitionerRole.class, 452 RelatedPerson.class, Organization.class }, order = 11, min = 0, max = 1, modifier = false, summary = false) 453 @Description(shortDefinition = "Person or organization that provided the information about the taking of this medication", formalDefinition = "The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationStatement is derived from other resources, e.g. Claim or MedicationRequest.") 454 protected Reference informationSource; 455 456 /** 457 * The actual object that is the target of the reference (The person or 458 * organization that provided the information about the taking of this 459 * medication. Note: Use derivedFrom when a MedicationStatement is derived from 460 * other resources, e.g. Claim or MedicationRequest.) 461 */ 462 protected Resource informationSourceTarget; 463 464 /** 465 * Allows linking the MedicationStatement to the underlying MedicationRequest, 466 * or to other information that supports or is used to derive the 467 * MedicationStatement. 468 */ 469 @Child(name = "derivedFrom", type = { 470 Reference.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 471 @Description(shortDefinition = "Additional supporting information", formalDefinition = "Allows linking the MedicationStatement to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationStatement.") 472 protected List<Reference> derivedFrom; 473 /** 474 * The actual objects that are the target of the reference (Allows linking the 475 * MedicationStatement to the underlying MedicationRequest, or to other 476 * information that supports or is used to derive the MedicationStatement.) 477 */ 478 protected List<Resource> derivedFromTarget; 479 480 /** 481 * A reason for why the medication is being/was taken. 482 */ 483 @Child(name = "reasonCode", type = { 484 CodeableConcept.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 485 @Description(shortDefinition = "Reason for why the medication is being/was taken", formalDefinition = "A reason for why the medication is being/was taken.") 486 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-code") 487 protected List<CodeableConcept> reasonCode; 488 489 /** 490 * Condition or observation that supports why the medication is being/was taken. 491 */ 492 @Child(name = "reasonReference", type = { Condition.class, Observation.class, 493 DiagnosticReport.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 494 @Description(shortDefinition = "Condition or observation that supports why the medication is being/was taken", formalDefinition = "Condition or observation that supports why the medication is being/was taken.") 495 protected List<Reference> reasonReference; 496 /** 497 * The actual objects that are the target of the reference (Condition or 498 * observation that supports why the medication is being/was taken.) 499 */ 500 protected List<Resource> reasonReferenceTarget; 501 502 /** 503 * Provides extra information about the medication statement that is not 504 * conveyed by the other attributes. 505 */ 506 @Child(name = "note", type = { 507 Annotation.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 508 @Description(shortDefinition = "Further information about the statement", formalDefinition = "Provides extra information about the medication statement that is not conveyed by the other attributes.") 509 protected List<Annotation> note; 510 511 /** 512 * Indicates how the medication is/was or should be taken by the patient. 513 */ 514 @Child(name = "dosage", type = { 515 Dosage.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 516 @Description(shortDefinition = "Details of how medication is/was taken or should be taken", formalDefinition = "Indicates how the medication is/was or should be taken by the patient.") 517 protected List<Dosage> dosage; 518 519 private static final long serialVersionUID = 1912813418L; 520 521 /** 522 * Constructor 523 */ 524 public MedicationStatement() { 525 super(); 526 } 527 528 /** 529 * Constructor 530 */ 531 public MedicationStatement(Enumeration<MedicationStatementStatus> status, Type medication, Reference subject) { 532 super(); 533 this.status = status; 534 this.medication = medication; 535 this.subject = subject; 536 } 537 538 /** 539 * @return {@link #identifier} (Identifiers associated with this Medication 540 * Statement that are defined by business processes and/or used to refer 541 * to it when a direct URL reference to the resource itself is not 542 * appropriate. They are business identifiers assigned to this resource 543 * by the performer or other systems and remain constant as the resource 544 * is updated and propagates from server to server.) 545 */ 546 public List<Identifier> getIdentifier() { 547 if (this.identifier == null) 548 this.identifier = new ArrayList<Identifier>(); 549 return this.identifier; 550 } 551 552 /** 553 * @return Returns a reference to <code>this</code> for easy method chaining 554 */ 555 public MedicationStatement setIdentifier(List<Identifier> theIdentifier) { 556 this.identifier = theIdentifier; 557 return this; 558 } 559 560 public boolean hasIdentifier() { 561 if (this.identifier == null) 562 return false; 563 for (Identifier item : this.identifier) 564 if (!item.isEmpty()) 565 return true; 566 return false; 567 } 568 569 public Identifier addIdentifier() { // 3 570 Identifier t = new Identifier(); 571 if (this.identifier == null) 572 this.identifier = new ArrayList<Identifier>(); 573 this.identifier.add(t); 574 return t; 575 } 576 577 public MedicationStatement addIdentifier(Identifier t) { // 3 578 if (t == null) 579 return this; 580 if (this.identifier == null) 581 this.identifier = new ArrayList<Identifier>(); 582 this.identifier.add(t); 583 return this; 584 } 585 586 /** 587 * @return The first repetition of repeating field {@link #identifier}, creating 588 * it if it does not already exist 589 */ 590 public Identifier getIdentifierFirstRep() { 591 if (getIdentifier().isEmpty()) { 592 addIdentifier(); 593 } 594 return getIdentifier().get(0); 595 } 596 597 /** 598 * @return {@link #basedOn} (A plan, proposal or order that is fulfilled in 599 * whole or in part by this event.) 600 */ 601 public List<Reference> getBasedOn() { 602 if (this.basedOn == null) 603 this.basedOn = new ArrayList<Reference>(); 604 return this.basedOn; 605 } 606 607 /** 608 * @return Returns a reference to <code>this</code> for easy method chaining 609 */ 610 public MedicationStatement setBasedOn(List<Reference> theBasedOn) { 611 this.basedOn = theBasedOn; 612 return this; 613 } 614 615 public boolean hasBasedOn() { 616 if (this.basedOn == null) 617 return false; 618 for (Reference item : this.basedOn) 619 if (!item.isEmpty()) 620 return true; 621 return false; 622 } 623 624 public Reference addBasedOn() { // 3 625 Reference t = new Reference(); 626 if (this.basedOn == null) 627 this.basedOn = new ArrayList<Reference>(); 628 this.basedOn.add(t); 629 return t; 630 } 631 632 public MedicationStatement addBasedOn(Reference t) { // 3 633 if (t == null) 634 return this; 635 if (this.basedOn == null) 636 this.basedOn = new ArrayList<Reference>(); 637 this.basedOn.add(t); 638 return this; 639 } 640 641 /** 642 * @return The first repetition of repeating field {@link #basedOn}, creating it 643 * if it does not already exist 644 */ 645 public Reference getBasedOnFirstRep() { 646 if (getBasedOn().isEmpty()) { 647 addBasedOn(); 648 } 649 return getBasedOn().get(0); 650 } 651 652 /** 653 * @return {@link #partOf} (A larger event of which this particular event is a 654 * component or step.) 655 */ 656 public List<Reference> getPartOf() { 657 if (this.partOf == null) 658 this.partOf = new ArrayList<Reference>(); 659 return this.partOf; 660 } 661 662 /** 663 * @return Returns a reference to <code>this</code> for easy method chaining 664 */ 665 public MedicationStatement setPartOf(List<Reference> thePartOf) { 666 this.partOf = thePartOf; 667 return this; 668 } 669 670 public boolean hasPartOf() { 671 if (this.partOf == null) 672 return false; 673 for (Reference item : this.partOf) 674 if (!item.isEmpty()) 675 return true; 676 return false; 677 } 678 679 public Reference addPartOf() { // 3 680 Reference t = new Reference(); 681 if (this.partOf == null) 682 this.partOf = new ArrayList<Reference>(); 683 this.partOf.add(t); 684 return t; 685 } 686 687 public MedicationStatement addPartOf(Reference t) { // 3 688 if (t == null) 689 return this; 690 if (this.partOf == null) 691 this.partOf = new ArrayList<Reference>(); 692 this.partOf.add(t); 693 return this; 694 } 695 696 /** 697 * @return The first repetition of repeating field {@link #partOf}, creating it 698 * if it does not already exist 699 */ 700 public Reference getPartOfFirstRep() { 701 if (getPartOf().isEmpty()) { 702 addPartOf(); 703 } 704 return getPartOf().get(0); 705 } 706 707 /** 708 * @return {@link #status} (A code representing the patient or other source's 709 * judgment about the state of the medication used that this statement 710 * is about. Generally, this will be active or completed.). This is the 711 * underlying object with id, value and extensions. The accessor 712 * "getStatus" gives direct access to the value 713 */ 714 public Enumeration<MedicationStatementStatus> getStatusElement() { 715 if (this.status == null) 716 if (Configuration.errorOnAutoCreate()) 717 throw new Error("Attempt to auto-create MedicationStatement.status"); 718 else if (Configuration.doAutoCreate()) 719 this.status = new Enumeration<MedicationStatementStatus>(new MedicationStatementStatusEnumFactory()); // bb 720 return this.status; 721 } 722 723 public boolean hasStatusElement() { 724 return this.status != null && !this.status.isEmpty(); 725 } 726 727 public boolean hasStatus() { 728 return this.status != null && !this.status.isEmpty(); 729 } 730 731 /** 732 * @param value {@link #status} (A code representing the patient or other 733 * source's judgment about the state of the medication used that 734 * this statement is about. Generally, this will be active or 735 * completed.). This is the underlying object with id, value and 736 * extensions. The accessor "getStatus" gives direct access to the 737 * value 738 */ 739 public MedicationStatement setStatusElement(Enumeration<MedicationStatementStatus> value) { 740 this.status = value; 741 return this; 742 } 743 744 /** 745 * @return A code representing the patient or other source's judgment about the 746 * state of the medication used that this statement is about. Generally, 747 * this will be active or completed. 748 */ 749 public MedicationStatementStatus getStatus() { 750 return this.status == null ? null : this.status.getValue(); 751 } 752 753 /** 754 * @param value A code representing the patient or other source's judgment about 755 * the state of the medication used that this statement is about. 756 * Generally, this will be active or completed. 757 */ 758 public MedicationStatement setStatus(MedicationStatementStatus value) { 759 if (this.status == null) 760 this.status = new Enumeration<MedicationStatementStatus>(new MedicationStatementStatusEnumFactory()); 761 this.status.setValue(value); 762 return this; 763 } 764 765 /** 766 * @return {@link #statusReason} (Captures the reason for the current state of 767 * the MedicationStatement.) 768 */ 769 public List<CodeableConcept> getStatusReason() { 770 if (this.statusReason == null) 771 this.statusReason = new ArrayList<CodeableConcept>(); 772 return this.statusReason; 773 } 774 775 /** 776 * @return Returns a reference to <code>this</code> for easy method chaining 777 */ 778 public MedicationStatement setStatusReason(List<CodeableConcept> theStatusReason) { 779 this.statusReason = theStatusReason; 780 return this; 781 } 782 783 public boolean hasStatusReason() { 784 if (this.statusReason == null) 785 return false; 786 for (CodeableConcept item : this.statusReason) 787 if (!item.isEmpty()) 788 return true; 789 return false; 790 } 791 792 public CodeableConcept addStatusReason() { // 3 793 CodeableConcept t = new CodeableConcept(); 794 if (this.statusReason == null) 795 this.statusReason = new ArrayList<CodeableConcept>(); 796 this.statusReason.add(t); 797 return t; 798 } 799 800 public MedicationStatement addStatusReason(CodeableConcept t) { // 3 801 if (t == null) 802 return this; 803 if (this.statusReason == null) 804 this.statusReason = new ArrayList<CodeableConcept>(); 805 this.statusReason.add(t); 806 return this; 807 } 808 809 /** 810 * @return The first repetition of repeating field {@link #statusReason}, 811 * creating it if it does not already exist 812 */ 813 public CodeableConcept getStatusReasonFirstRep() { 814 if (getStatusReason().isEmpty()) { 815 addStatusReason(); 816 } 817 return getStatusReason().get(0); 818 } 819 820 /** 821 * @return {@link #category} (Indicates where the medication is expected to be 822 * consumed or administered.) 823 */ 824 public CodeableConcept getCategory() { 825 if (this.category == null) 826 if (Configuration.errorOnAutoCreate()) 827 throw new Error("Attempt to auto-create MedicationStatement.category"); 828 else if (Configuration.doAutoCreate()) 829 this.category = new CodeableConcept(); // cc 830 return this.category; 831 } 832 833 public boolean hasCategory() { 834 return this.category != null && !this.category.isEmpty(); 835 } 836 837 /** 838 * @param value {@link #category} (Indicates where the medication is expected to 839 * be consumed or administered.) 840 */ 841 public MedicationStatement setCategory(CodeableConcept value) { 842 this.category = value; 843 return this; 844 } 845 846 /** 847 * @return {@link #medication} (Identifies the medication being administered. 848 * This is either a link to a resource representing the details of the 849 * medication or a simple attribute carrying a code that identifies the 850 * medication from a known list of medications.) 851 */ 852 public Type getMedication() { 853 return this.medication; 854 } 855 856 /** 857 * @return {@link #medication} (Identifies the medication being administered. 858 * This is either a link to a resource representing the details of the 859 * medication or a simple attribute carrying a code that identifies the 860 * medication from a known list of medications.) 861 */ 862 public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 863 if (this.medication == null) 864 this.medication = new CodeableConcept(); 865 if (!(this.medication instanceof CodeableConcept)) 866 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but " 867 + this.medication.getClass().getName() + " was encountered"); 868 return (CodeableConcept) this.medication; 869 } 870 871 public boolean hasMedicationCodeableConcept() { 872 return this.medication instanceof CodeableConcept; 873 } 874 875 /** 876 * @return {@link #medication} (Identifies the medication being administered. 877 * This is either a link to a resource representing the details of the 878 * medication or a simple attribute carrying a code that identifies the 879 * medication from a known list of medications.) 880 */ 881 public Reference getMedicationReference() throws FHIRException { 882 if (this.medication == null) 883 this.medication = new Reference(); 884 if (!(this.medication instanceof Reference)) 885 throw new FHIRException("Type mismatch: the type Reference was expected, but " 886 + this.medication.getClass().getName() + " was encountered"); 887 return (Reference) this.medication; 888 } 889 890 public boolean hasMedicationReference() { 891 return this.medication instanceof Reference; 892 } 893 894 public boolean hasMedication() { 895 return this.medication != null && !this.medication.isEmpty(); 896 } 897 898 /** 899 * @param value {@link #medication} (Identifies the medication being 900 * administered. This is either a link to a resource representing 901 * the details of the medication or a simple attribute carrying a 902 * code that identifies the medication from a known list of 903 * medications.) 904 */ 905 public MedicationStatement setMedication(Type value) { 906 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 907 throw new Error("Not the right type for MedicationStatement.medication[x]: " + value.fhirType()); 908 this.medication = value; 909 return this; 910 } 911 912 /** 913 * @return {@link #subject} (The person, animal or group who is/was taking the 914 * medication.) 915 */ 916 public Reference getSubject() { 917 if (this.subject == null) 918 if (Configuration.errorOnAutoCreate()) 919 throw new Error("Attempt to auto-create MedicationStatement.subject"); 920 else if (Configuration.doAutoCreate()) 921 this.subject = new Reference(); // cc 922 return this.subject; 923 } 924 925 public boolean hasSubject() { 926 return this.subject != null && !this.subject.isEmpty(); 927 } 928 929 /** 930 * @param value {@link #subject} (The person, animal or group who is/was taking 931 * the medication.) 932 */ 933 public MedicationStatement setSubject(Reference value) { 934 this.subject = value; 935 return this; 936 } 937 938 /** 939 * @return {@link #subject} The actual object that is the target of the 940 * reference. The reference library doesn't populate this, but you can 941 * use it to hold the resource if you resolve it. (The person, animal or 942 * group who is/was taking the medication.) 943 */ 944 public Resource getSubjectTarget() { 945 return this.subjectTarget; 946 } 947 948 /** 949 * @param value {@link #subject} The actual object that is the target of the 950 * reference. The reference library doesn't use these, but you can 951 * use it to hold the resource if you resolve it. (The person, 952 * animal or group who is/was taking the medication.) 953 */ 954 public MedicationStatement setSubjectTarget(Resource value) { 955 this.subjectTarget = value; 956 return this; 957 } 958 959 /** 960 * @return {@link #context} (The encounter or episode of care that establishes 961 * the context for this MedicationStatement.) 962 */ 963 public Reference getContext() { 964 if (this.context == null) 965 if (Configuration.errorOnAutoCreate()) 966 throw new Error("Attempt to auto-create MedicationStatement.context"); 967 else if (Configuration.doAutoCreate()) 968 this.context = new Reference(); // cc 969 return this.context; 970 } 971 972 public boolean hasContext() { 973 return this.context != null && !this.context.isEmpty(); 974 } 975 976 /** 977 * @param value {@link #context} (The encounter or episode of care that 978 * establishes the context for this MedicationStatement.) 979 */ 980 public MedicationStatement setContext(Reference value) { 981 this.context = value; 982 return this; 983 } 984 985 /** 986 * @return {@link #context} The actual object that is the target of the 987 * reference. The reference library doesn't populate this, but you can 988 * use it to hold the resource if you resolve it. (The encounter or 989 * episode of care that establishes the context for this 990 * MedicationStatement.) 991 */ 992 public Resource getContextTarget() { 993 return this.contextTarget; 994 } 995 996 /** 997 * @param value {@link #context} The actual object that is the target of the 998 * reference. The reference library doesn't use these, but you can 999 * use it to hold the resource if you resolve it. (The encounter or 1000 * episode of care that establishes the context for this 1001 * MedicationStatement.) 1002 */ 1003 public MedicationStatement setContextTarget(Resource value) { 1004 this.contextTarget = value; 1005 return this; 1006 } 1007 1008 /** 1009 * @return {@link #effective} (The interval of time during which it is being 1010 * asserted that the patient is/was/will be taking the medication (or 1011 * was not taking, when the MedicationStatement.taken element is No).) 1012 */ 1013 public Type getEffective() { 1014 return this.effective; 1015 } 1016 1017 /** 1018 * @return {@link #effective} (The interval of time during which it is being 1019 * asserted that the patient is/was/will be taking the medication (or 1020 * was not taking, when the MedicationStatement.taken element is No).) 1021 */ 1022 public DateTimeType getEffectiveDateTimeType() throws FHIRException { 1023 if (this.effective == null) 1024 this.effective = new DateTimeType(); 1025 if (!(this.effective instanceof DateTimeType)) 1026 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but " 1027 + this.effective.getClass().getName() + " was encountered"); 1028 return (DateTimeType) this.effective; 1029 } 1030 1031 public boolean hasEffectiveDateTimeType() { 1032 return this.effective instanceof DateTimeType; 1033 } 1034 1035 /** 1036 * @return {@link #effective} (The interval of time during which it is being 1037 * asserted that the patient is/was/will be taking the medication (or 1038 * was not taking, when the MedicationStatement.taken element is No).) 1039 */ 1040 public Period getEffectivePeriod() throws FHIRException { 1041 if (this.effective == null) 1042 this.effective = new Period(); 1043 if (!(this.effective instanceof Period)) 1044 throw new FHIRException("Type mismatch: the type Period was expected, but " + this.effective.getClass().getName() 1045 + " was encountered"); 1046 return (Period) this.effective; 1047 } 1048 1049 public boolean hasEffectivePeriod() { 1050 return this.effective instanceof Period; 1051 } 1052 1053 public boolean hasEffective() { 1054 return this.effective != null && !this.effective.isEmpty(); 1055 } 1056 1057 /** 1058 * @param value {@link #effective} (The interval of time during which it is 1059 * being asserted that the patient is/was/will be taking the 1060 * medication (or was not taking, when the 1061 * MedicationStatement.taken element is No).) 1062 */ 1063 public MedicationStatement setEffective(Type value) { 1064 if (value != null && !(value instanceof DateTimeType || value instanceof Period)) 1065 throw new Error("Not the right type for MedicationStatement.effective[x]: " + value.fhirType()); 1066 this.effective = value; 1067 return this; 1068 } 1069 1070 /** 1071 * @return {@link #dateAsserted} (The date when the medication statement was 1072 * asserted by the information source.). This is the underlying object 1073 * with id, value and extensions. The accessor "getDateAsserted" gives 1074 * direct access to the value 1075 */ 1076 public DateTimeType getDateAssertedElement() { 1077 if (this.dateAsserted == null) 1078 if (Configuration.errorOnAutoCreate()) 1079 throw new Error("Attempt to auto-create MedicationStatement.dateAsserted"); 1080 else if (Configuration.doAutoCreate()) 1081 this.dateAsserted = new DateTimeType(); // bb 1082 return this.dateAsserted; 1083 } 1084 1085 public boolean hasDateAssertedElement() { 1086 return this.dateAsserted != null && !this.dateAsserted.isEmpty(); 1087 } 1088 1089 public boolean hasDateAsserted() { 1090 return this.dateAsserted != null && !this.dateAsserted.isEmpty(); 1091 } 1092 1093 /** 1094 * @param value {@link #dateAsserted} (The date when the medication statement 1095 * was asserted by the information source.). This is the underlying 1096 * object with id, value and extensions. The accessor 1097 * "getDateAsserted" gives direct access to the value 1098 */ 1099 public MedicationStatement setDateAssertedElement(DateTimeType value) { 1100 this.dateAsserted = value; 1101 return this; 1102 } 1103 1104 /** 1105 * @return The date when the medication statement was asserted by the 1106 * information source. 1107 */ 1108 public Date getDateAsserted() { 1109 return this.dateAsserted == null ? null : this.dateAsserted.getValue(); 1110 } 1111 1112 /** 1113 * @param value The date when the medication statement was asserted by the 1114 * information source. 1115 */ 1116 public MedicationStatement setDateAsserted(Date value) { 1117 if (value == null) 1118 this.dateAsserted = null; 1119 else { 1120 if (this.dateAsserted == null) 1121 this.dateAsserted = new DateTimeType(); 1122 this.dateAsserted.setValue(value); 1123 } 1124 return this; 1125 } 1126 1127 /** 1128 * @return {@link #informationSource} (The person or organization that provided 1129 * the information about the taking of this medication. Note: Use 1130 * derivedFrom when a MedicationStatement is derived from other 1131 * resources, e.g. Claim or MedicationRequest.) 1132 */ 1133 public Reference getInformationSource() { 1134 if (this.informationSource == null) 1135 if (Configuration.errorOnAutoCreate()) 1136 throw new Error("Attempt to auto-create MedicationStatement.informationSource"); 1137 else if (Configuration.doAutoCreate()) 1138 this.informationSource = new Reference(); // cc 1139 return this.informationSource; 1140 } 1141 1142 public boolean hasInformationSource() { 1143 return this.informationSource != null && !this.informationSource.isEmpty(); 1144 } 1145 1146 /** 1147 * @param value {@link #informationSource} (The person or organization that 1148 * provided the information about the taking of this medication. 1149 * Note: Use derivedFrom when a MedicationStatement is derived from 1150 * other resources, e.g. Claim or MedicationRequest.) 1151 */ 1152 public MedicationStatement setInformationSource(Reference value) { 1153 this.informationSource = value; 1154 return this; 1155 } 1156 1157 /** 1158 * @return {@link #informationSource} The actual object that is the target of 1159 * the reference. The reference library doesn't populate this, but you 1160 * can use it to hold the resource if you resolve it. (The person or 1161 * organization that provided the information about the taking of this 1162 * medication. Note: Use derivedFrom when a MedicationStatement is 1163 * derived from other resources, e.g. Claim or MedicationRequest.) 1164 */ 1165 public Resource getInformationSourceTarget() { 1166 return this.informationSourceTarget; 1167 } 1168 1169 /** 1170 * @param value {@link #informationSource} The actual object that is the target 1171 * of the reference. The reference library doesn't use these, but 1172 * you can use it to hold the resource if you resolve it. (The 1173 * person or organization that provided the information about the 1174 * taking of this medication. Note: Use derivedFrom when a 1175 * MedicationStatement is derived from other resources, e.g. Claim 1176 * or MedicationRequest.) 1177 */ 1178 public MedicationStatement setInformationSourceTarget(Resource value) { 1179 this.informationSourceTarget = value; 1180 return this; 1181 } 1182 1183 /** 1184 * @return {@link #derivedFrom} (Allows linking the MedicationStatement to the 1185 * underlying MedicationRequest, or to other information that supports 1186 * or is used to derive the MedicationStatement.) 1187 */ 1188 public List<Reference> getDerivedFrom() { 1189 if (this.derivedFrom == null) 1190 this.derivedFrom = new ArrayList<Reference>(); 1191 return this.derivedFrom; 1192 } 1193 1194 /** 1195 * @return Returns a reference to <code>this</code> for easy method chaining 1196 */ 1197 public MedicationStatement setDerivedFrom(List<Reference> theDerivedFrom) { 1198 this.derivedFrom = theDerivedFrom; 1199 return this; 1200 } 1201 1202 public boolean hasDerivedFrom() { 1203 if (this.derivedFrom == null) 1204 return false; 1205 for (Reference item : this.derivedFrom) 1206 if (!item.isEmpty()) 1207 return true; 1208 return false; 1209 } 1210 1211 public Reference addDerivedFrom() { // 3 1212 Reference t = new Reference(); 1213 if (this.derivedFrom == null) 1214 this.derivedFrom = new ArrayList<Reference>(); 1215 this.derivedFrom.add(t); 1216 return t; 1217 } 1218 1219 public MedicationStatement addDerivedFrom(Reference t) { // 3 1220 if (t == null) 1221 return this; 1222 if (this.derivedFrom == null) 1223 this.derivedFrom = new ArrayList<Reference>(); 1224 this.derivedFrom.add(t); 1225 return this; 1226 } 1227 1228 /** 1229 * @return The first repetition of repeating field {@link #derivedFrom}, 1230 * creating it if it does not already exist 1231 */ 1232 public Reference getDerivedFromFirstRep() { 1233 if (getDerivedFrom().isEmpty()) { 1234 addDerivedFrom(); 1235 } 1236 return getDerivedFrom().get(0); 1237 } 1238 1239 /** 1240 * @return {@link #reasonCode} (A reason for why the medication is being/was 1241 * taken.) 1242 */ 1243 public List<CodeableConcept> getReasonCode() { 1244 if (this.reasonCode == null) 1245 this.reasonCode = new ArrayList<CodeableConcept>(); 1246 return this.reasonCode; 1247 } 1248 1249 /** 1250 * @return Returns a reference to <code>this</code> for easy method chaining 1251 */ 1252 public MedicationStatement setReasonCode(List<CodeableConcept> theReasonCode) { 1253 this.reasonCode = theReasonCode; 1254 return this; 1255 } 1256 1257 public boolean hasReasonCode() { 1258 if (this.reasonCode == null) 1259 return false; 1260 for (CodeableConcept item : this.reasonCode) 1261 if (!item.isEmpty()) 1262 return true; 1263 return false; 1264 } 1265 1266 public CodeableConcept addReasonCode() { // 3 1267 CodeableConcept t = new CodeableConcept(); 1268 if (this.reasonCode == null) 1269 this.reasonCode = new ArrayList<CodeableConcept>(); 1270 this.reasonCode.add(t); 1271 return t; 1272 } 1273 1274 public MedicationStatement addReasonCode(CodeableConcept t) { // 3 1275 if (t == null) 1276 return this; 1277 if (this.reasonCode == null) 1278 this.reasonCode = new ArrayList<CodeableConcept>(); 1279 this.reasonCode.add(t); 1280 return this; 1281 } 1282 1283 /** 1284 * @return The first repetition of repeating field {@link #reasonCode}, creating 1285 * it if it does not already exist 1286 */ 1287 public CodeableConcept getReasonCodeFirstRep() { 1288 if (getReasonCode().isEmpty()) { 1289 addReasonCode(); 1290 } 1291 return getReasonCode().get(0); 1292 } 1293 1294 /** 1295 * @return {@link #reasonReference} (Condition or observation that supports why 1296 * the medication is being/was taken.) 1297 */ 1298 public List<Reference> getReasonReference() { 1299 if (this.reasonReference == null) 1300 this.reasonReference = new ArrayList<Reference>(); 1301 return this.reasonReference; 1302 } 1303 1304 /** 1305 * @return Returns a reference to <code>this</code> for easy method chaining 1306 */ 1307 public MedicationStatement setReasonReference(List<Reference> theReasonReference) { 1308 this.reasonReference = theReasonReference; 1309 return this; 1310 } 1311 1312 public boolean hasReasonReference() { 1313 if (this.reasonReference == null) 1314 return false; 1315 for (Reference item : this.reasonReference) 1316 if (!item.isEmpty()) 1317 return true; 1318 return false; 1319 } 1320 1321 public Reference addReasonReference() { // 3 1322 Reference t = new Reference(); 1323 if (this.reasonReference == null) 1324 this.reasonReference = new ArrayList<Reference>(); 1325 this.reasonReference.add(t); 1326 return t; 1327 } 1328 1329 public MedicationStatement addReasonReference(Reference t) { // 3 1330 if (t == null) 1331 return this; 1332 if (this.reasonReference == null) 1333 this.reasonReference = new ArrayList<Reference>(); 1334 this.reasonReference.add(t); 1335 return this; 1336 } 1337 1338 /** 1339 * @return The first repetition of repeating field {@link #reasonReference}, 1340 * creating it if it does not already exist 1341 */ 1342 public Reference getReasonReferenceFirstRep() { 1343 if (getReasonReference().isEmpty()) { 1344 addReasonReference(); 1345 } 1346 return getReasonReference().get(0); 1347 } 1348 1349 /** 1350 * @return {@link #note} (Provides extra information about the medication 1351 * statement that is not conveyed by the other attributes.) 1352 */ 1353 public List<Annotation> getNote() { 1354 if (this.note == null) 1355 this.note = new ArrayList<Annotation>(); 1356 return this.note; 1357 } 1358 1359 /** 1360 * @return Returns a reference to <code>this</code> for easy method chaining 1361 */ 1362 public MedicationStatement setNote(List<Annotation> theNote) { 1363 this.note = theNote; 1364 return this; 1365 } 1366 1367 public boolean hasNote() { 1368 if (this.note == null) 1369 return false; 1370 for (Annotation item : this.note) 1371 if (!item.isEmpty()) 1372 return true; 1373 return false; 1374 } 1375 1376 public Annotation addNote() { // 3 1377 Annotation t = new Annotation(); 1378 if (this.note == null) 1379 this.note = new ArrayList<Annotation>(); 1380 this.note.add(t); 1381 return t; 1382 } 1383 1384 public MedicationStatement addNote(Annotation t) { // 3 1385 if (t == null) 1386 return this; 1387 if (this.note == null) 1388 this.note = new ArrayList<Annotation>(); 1389 this.note.add(t); 1390 return this; 1391 } 1392 1393 /** 1394 * @return The first repetition of repeating field {@link #note}, creating it if 1395 * it does not already exist 1396 */ 1397 public Annotation getNoteFirstRep() { 1398 if (getNote().isEmpty()) { 1399 addNote(); 1400 } 1401 return getNote().get(0); 1402 } 1403 1404 /** 1405 * @return {@link #dosage} (Indicates how the medication is/was or should be 1406 * taken by the patient.) 1407 */ 1408 public List<Dosage> getDosage() { 1409 if (this.dosage == null) 1410 this.dosage = new ArrayList<Dosage>(); 1411 return this.dosage; 1412 } 1413 1414 /** 1415 * @return Returns a reference to <code>this</code> for easy method chaining 1416 */ 1417 public MedicationStatement setDosage(List<Dosage> theDosage) { 1418 this.dosage = theDosage; 1419 return this; 1420 } 1421 1422 public boolean hasDosage() { 1423 if (this.dosage == null) 1424 return false; 1425 for (Dosage item : this.dosage) 1426 if (!item.isEmpty()) 1427 return true; 1428 return false; 1429 } 1430 1431 public Dosage addDosage() { // 3 1432 Dosage t = new Dosage(); 1433 if (this.dosage == null) 1434 this.dosage = new ArrayList<Dosage>(); 1435 this.dosage.add(t); 1436 return t; 1437 } 1438 1439 public MedicationStatement addDosage(Dosage t) { // 3 1440 if (t == null) 1441 return this; 1442 if (this.dosage == null) 1443 this.dosage = new ArrayList<Dosage>(); 1444 this.dosage.add(t); 1445 return this; 1446 } 1447 1448 /** 1449 * @return The first repetition of repeating field {@link #dosage}, creating it 1450 * if it does not already exist 1451 */ 1452 public Dosage getDosageFirstRep() { 1453 if (getDosage().isEmpty()) { 1454 addDosage(); 1455 } 1456 return getDosage().get(0); 1457 } 1458 1459 protected void listChildren(List<Property> children) { 1460 super.listChildren(children); 1461 children.add(new Property("identifier", "Identifier", 1462 "Identifiers associated with this Medication Statement that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 1463 0, java.lang.Integer.MAX_VALUE, identifier)); 1464 children.add(new Property("basedOn", "Reference(MedicationRequest|CarePlan|ServiceRequest)", 1465 "A plan, proposal or order that is fulfilled in whole or in part by this event.", 0, 1466 java.lang.Integer.MAX_VALUE, basedOn)); 1467 children.add(new Property("partOf", 1468 "Reference(MedicationAdministration|MedicationDispense|MedicationStatement|Procedure|Observation)", 1469 "A larger event of which this particular event is a component or step.", 0, java.lang.Integer.MAX_VALUE, 1470 partOf)); 1471 children.add(new Property("status", "code", 1472 "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.", 1473 0, 1, status)); 1474 children.add(new Property("statusReason", "CodeableConcept", 1475 "Captures the reason for the current state of the MedicationStatement.", 0, java.lang.Integer.MAX_VALUE, 1476 statusReason)); 1477 children.add(new Property("category", "CodeableConcept", 1478 "Indicates where the medication is expected to be consumed or administered.", 0, 1, category)); 1479 children.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", 1480 "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.", 1481 0, 1, medication)); 1482 children.add(new Property("subject", "Reference(Patient|Group)", 1483 "The person, animal or group who is/was taking the medication.", 0, 1, subject)); 1484 children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", 1485 "The encounter or episode of care that establishes the context for this MedicationStatement.", 0, 1, context)); 1486 children.add(new Property("effective[x]", "dateTime|Period", 1487 "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationStatement.taken element is No).", 1488 0, 1, effective)); 1489 children.add(new Property("dateAsserted", "dateTime", 1490 "The date when the medication statement was asserted by the information source.", 0, 1, dateAsserted)); 1491 children.add(new Property("informationSource", 1492 "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", 1493 "The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationStatement is derived from other resources, e.g. Claim or MedicationRequest.", 1494 0, 1, informationSource)); 1495 children.add(new Property("derivedFrom", "Reference(Any)", 1496 "Allows linking the MedicationStatement to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationStatement.", 1497 0, java.lang.Integer.MAX_VALUE, derivedFrom)); 1498 children.add(new Property("reasonCode", "CodeableConcept", "A reason for why the medication is being/was taken.", 0, 1499 java.lang.Integer.MAX_VALUE, reasonCode)); 1500 children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport)", 1501 "Condition or observation that supports why the medication is being/was taken.", 0, java.lang.Integer.MAX_VALUE, 1502 reasonReference)); 1503 children.add(new Property("note", "Annotation", 1504 "Provides extra information about the medication statement that is not conveyed by the other attributes.", 0, 1505 java.lang.Integer.MAX_VALUE, note)); 1506 children 1507 .add(new Property("dosage", "Dosage", "Indicates how the medication is/was or should be taken by the patient.", 1508 0, java.lang.Integer.MAX_VALUE, dosage)); 1509 } 1510 1511 @Override 1512 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1513 switch (_hash) { 1514 case -1618432855: 1515 /* identifier */ return new Property("identifier", "Identifier", 1516 "Identifiers associated with this Medication Statement that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 1517 0, java.lang.Integer.MAX_VALUE, identifier); 1518 case -332612366: 1519 /* basedOn */ return new Property("basedOn", "Reference(MedicationRequest|CarePlan|ServiceRequest)", 1520 "A plan, proposal or order that is fulfilled in whole or in part by this event.", 0, 1521 java.lang.Integer.MAX_VALUE, basedOn); 1522 case -995410646: 1523 /* partOf */ return new Property("partOf", 1524 "Reference(MedicationAdministration|MedicationDispense|MedicationStatement|Procedure|Observation)", 1525 "A larger event of which this particular event is a component or step.", 0, java.lang.Integer.MAX_VALUE, 1526 partOf); 1527 case -892481550: 1528 /* status */ return new Property("status", "code", 1529 "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.", 1530 0, 1, status); 1531 case 2051346646: 1532 /* statusReason */ return new Property("statusReason", "CodeableConcept", 1533 "Captures the reason for the current state of the MedicationStatement.", 0, java.lang.Integer.MAX_VALUE, 1534 statusReason); 1535 case 50511102: 1536 /* category */ return new Property("category", "CodeableConcept", 1537 "Indicates where the medication is expected to be consumed or administered.", 0, 1, category); 1538 case 1458402129: 1539 /* medication[x] */ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", 1540 "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.", 1541 0, 1, medication); 1542 case 1998965455: 1543 /* medication */ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", 1544 "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.", 1545 0, 1, medication); 1546 case -209845038: 1547 /* medicationCodeableConcept */ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", 1548 "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.", 1549 0, 1, medication); 1550 case 2104315196: 1551 /* medicationReference */ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", 1552 "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.", 1553 0, 1, medication); 1554 case -1867885268: 1555 /* subject */ return new Property("subject", "Reference(Patient|Group)", 1556 "The person, animal or group who is/was taking the medication.", 0, 1, subject); 1557 case 951530927: 1558 /* context */ return new Property("context", "Reference(Encounter|EpisodeOfCare)", 1559 "The encounter or episode of care that establishes the context for this MedicationStatement.", 0, 1, context); 1560 case 247104889: 1561 /* effective[x] */ return new Property("effective[x]", "dateTime|Period", 1562 "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationStatement.taken element is No).", 1563 0, 1, effective); 1564 case -1468651097: 1565 /* effective */ return new Property("effective[x]", "dateTime|Period", 1566 "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationStatement.taken element is No).", 1567 0, 1, effective); 1568 case -275306910: 1569 /* effectiveDateTime */ return new Property("effective[x]", "dateTime|Period", 1570 "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationStatement.taken element is No).", 1571 0, 1, effective); 1572 case -403934648: 1573 /* effectivePeriod */ return new Property("effective[x]", "dateTime|Period", 1574 "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationStatement.taken element is No).", 1575 0, 1, effective); 1576 case -1980855245: 1577 /* dateAsserted */ return new Property("dateAsserted", "dateTime", 1578 "The date when the medication statement was asserted by the information source.", 0, 1, dateAsserted); 1579 case -2123220889: 1580 /* informationSource */ return new Property("informationSource", 1581 "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", 1582 "The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationStatement is derived from other resources, e.g. Claim or MedicationRequest.", 1583 0, 1, informationSource); 1584 case 1077922663: 1585 /* derivedFrom */ return new Property("derivedFrom", "Reference(Any)", 1586 "Allows linking the MedicationStatement to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationStatement.", 1587 0, java.lang.Integer.MAX_VALUE, derivedFrom); 1588 case 722137681: 1589 /* reasonCode */ return new Property("reasonCode", "CodeableConcept", 1590 "A reason for why the medication is being/was taken.", 0, java.lang.Integer.MAX_VALUE, reasonCode); 1591 case -1146218137: 1592 /* reasonReference */ return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport)", 1593 "Condition or observation that supports why the medication is being/was taken.", 0, 1594 java.lang.Integer.MAX_VALUE, reasonReference); 1595 case 3387378: 1596 /* note */ return new Property("note", "Annotation", 1597 "Provides extra information about the medication statement that is not conveyed by the other attributes.", 0, 1598 java.lang.Integer.MAX_VALUE, note); 1599 case -1326018889: 1600 /* dosage */ return new Property("dosage", "Dosage", 1601 "Indicates how the medication is/was or should be taken by the patient.", 0, java.lang.Integer.MAX_VALUE, 1602 dosage); 1603 default: 1604 return super.getNamedProperty(_hash, _name, _checkValid); 1605 } 1606 1607 } 1608 1609 @Override 1610 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1611 switch (hash) { 1612 case -1618432855: 1613 /* identifier */ return this.identifier == null ? new Base[0] 1614 : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1615 case -332612366: 1616 /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference 1617 case -995410646: 1618 /* partOf */ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference 1619 case -892481550: 1620 /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<MedicationStatementStatus> 1621 case 2051346646: 1622 /* statusReason */ return this.statusReason == null ? new Base[0] 1623 : this.statusReason.toArray(new Base[this.statusReason.size()]); // CodeableConcept 1624 case 50511102: 1625 /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept 1626 case 1998965455: 1627 /* medication */ return this.medication == null ? new Base[0] : new Base[] { this.medication }; // Type 1628 case -1867885268: 1629 /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference 1630 case 951530927: 1631 /* context */ return this.context == null ? new Base[0] : new Base[] { this.context }; // Reference 1632 case -1468651097: 1633 /* effective */ return this.effective == null ? new Base[0] : new Base[] { this.effective }; // Type 1634 case -1980855245: 1635 /* dateAsserted */ return this.dateAsserted == null ? new Base[0] : new Base[] { this.dateAsserted }; // DateTimeType 1636 case -2123220889: 1637 /* informationSource */ return this.informationSource == null ? new Base[0] 1638 : new Base[] { this.informationSource }; // Reference 1639 case 1077922663: 1640 /* derivedFrom */ return this.derivedFrom == null ? new Base[0] 1641 : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // Reference 1642 case 722137681: 1643 /* reasonCode */ return this.reasonCode == null ? new Base[0] 1644 : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept 1645 case -1146218137: 1646 /* reasonReference */ return this.reasonReference == null ? new Base[0] 1647 : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference 1648 case 3387378: 1649 /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 1650 case -1326018889: 1651 /* dosage */ return this.dosage == null ? new Base[0] : this.dosage.toArray(new Base[this.dosage.size()]); // Dosage 1652 default: 1653 return super.getProperty(hash, name, checkValid); 1654 } 1655 1656 } 1657 1658 @Override 1659 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1660 switch (hash) { 1661 case -1618432855: // identifier 1662 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1663 return value; 1664 case -332612366: // basedOn 1665 this.getBasedOn().add(castToReference(value)); // Reference 1666 return value; 1667 case -995410646: // partOf 1668 this.getPartOf().add(castToReference(value)); // Reference 1669 return value; 1670 case -892481550: // status 1671 value = new MedicationStatementStatusEnumFactory().fromType(castToCode(value)); 1672 this.status = (Enumeration) value; // Enumeration<MedicationStatementStatus> 1673 return value; 1674 case 2051346646: // statusReason 1675 this.getStatusReason().add(castToCodeableConcept(value)); // CodeableConcept 1676 return value; 1677 case 50511102: // category 1678 this.category = castToCodeableConcept(value); // CodeableConcept 1679 return value; 1680 case 1998965455: // medication 1681 this.medication = castToType(value); // Type 1682 return value; 1683 case -1867885268: // subject 1684 this.subject = castToReference(value); // Reference 1685 return value; 1686 case 951530927: // context 1687 this.context = castToReference(value); // Reference 1688 return value; 1689 case -1468651097: // effective 1690 this.effective = castToType(value); // Type 1691 return value; 1692 case -1980855245: // dateAsserted 1693 this.dateAsserted = castToDateTime(value); // DateTimeType 1694 return value; 1695 case -2123220889: // informationSource 1696 this.informationSource = castToReference(value); // Reference 1697 return value; 1698 case 1077922663: // derivedFrom 1699 this.getDerivedFrom().add(castToReference(value)); // Reference 1700 return value; 1701 case 722137681: // reasonCode 1702 this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept 1703 return value; 1704 case -1146218137: // reasonReference 1705 this.getReasonReference().add(castToReference(value)); // Reference 1706 return value; 1707 case 3387378: // note 1708 this.getNote().add(castToAnnotation(value)); // Annotation 1709 return value; 1710 case -1326018889: // dosage 1711 this.getDosage().add(castToDosage(value)); // Dosage 1712 return value; 1713 default: 1714 return super.setProperty(hash, name, value); 1715 } 1716 1717 } 1718 1719 @Override 1720 public Base setProperty(String name, Base value) throws FHIRException { 1721 if (name.equals("identifier")) { 1722 this.getIdentifier().add(castToIdentifier(value)); 1723 } else if (name.equals("basedOn")) { 1724 this.getBasedOn().add(castToReference(value)); 1725 } else if (name.equals("partOf")) { 1726 this.getPartOf().add(castToReference(value)); 1727 } else if (name.equals("status")) { 1728 value = new MedicationStatementStatusEnumFactory().fromType(castToCode(value)); 1729 this.status = (Enumeration) value; // Enumeration<MedicationStatementStatus> 1730 } else if (name.equals("statusReason")) { 1731 this.getStatusReason().add(castToCodeableConcept(value)); 1732 } else if (name.equals("category")) { 1733 this.category = castToCodeableConcept(value); // CodeableConcept 1734 } else if (name.equals("medication[x]")) { 1735 this.medication = castToType(value); // Type 1736 } else if (name.equals("subject")) { 1737 this.subject = castToReference(value); // Reference 1738 } else if (name.equals("context")) { 1739 this.context = castToReference(value); // Reference 1740 } else if (name.equals("effective[x]")) { 1741 this.effective = castToType(value); // Type 1742 } else if (name.equals("dateAsserted")) { 1743 this.dateAsserted = castToDateTime(value); // DateTimeType 1744 } else if (name.equals("informationSource")) { 1745 this.informationSource = castToReference(value); // Reference 1746 } else if (name.equals("derivedFrom")) { 1747 this.getDerivedFrom().add(castToReference(value)); 1748 } else if (name.equals("reasonCode")) { 1749 this.getReasonCode().add(castToCodeableConcept(value)); 1750 } else if (name.equals("reasonReference")) { 1751 this.getReasonReference().add(castToReference(value)); 1752 } else if (name.equals("note")) { 1753 this.getNote().add(castToAnnotation(value)); 1754 } else if (name.equals("dosage")) { 1755 this.getDosage().add(castToDosage(value)); 1756 } else 1757 return super.setProperty(name, value); 1758 return value; 1759 } 1760 1761 @Override 1762 public void removeChild(String name, Base value) throws FHIRException { 1763 if (name.equals("identifier")) { 1764 this.getIdentifier().remove(castToIdentifier(value)); 1765 } else if (name.equals("basedOn")) { 1766 this.getBasedOn().remove(castToReference(value)); 1767 } else if (name.equals("partOf")) { 1768 this.getPartOf().remove(castToReference(value)); 1769 } else if (name.equals("status")) { 1770 this.status = null; 1771 } else if (name.equals("statusReason")) { 1772 this.getStatusReason().remove(castToCodeableConcept(value)); 1773 } else if (name.equals("category")) { 1774 this.category = null; 1775 } else if (name.equals("medication[x]")) { 1776 this.medication = null; 1777 } else if (name.equals("subject")) { 1778 this.subject = null; 1779 } else if (name.equals("context")) { 1780 this.context = null; 1781 } else if (name.equals("effective[x]")) { 1782 this.effective = null; 1783 } else if (name.equals("dateAsserted")) { 1784 this.dateAsserted = null; 1785 } else if (name.equals("informationSource")) { 1786 this.informationSource = null; 1787 } else if (name.equals("derivedFrom")) { 1788 this.getDerivedFrom().remove(castToReference(value)); 1789 } else if (name.equals("reasonCode")) { 1790 this.getReasonCode().remove(castToCodeableConcept(value)); 1791 } else if (name.equals("reasonReference")) { 1792 this.getReasonReference().remove(castToReference(value)); 1793 } else if (name.equals("note")) { 1794 this.getNote().remove(castToAnnotation(value)); 1795 } else if (name.equals("dosage")) { 1796 this.getDosage().remove(castToDosage(value)); 1797 } else 1798 super.removeChild(name, value); 1799 1800 } 1801 1802 @Override 1803 public Base makeProperty(int hash, String name) throws FHIRException { 1804 switch (hash) { 1805 case -1618432855: 1806 return addIdentifier(); 1807 case -332612366: 1808 return addBasedOn(); 1809 case -995410646: 1810 return addPartOf(); 1811 case -892481550: 1812 return getStatusElement(); 1813 case 2051346646: 1814 return addStatusReason(); 1815 case 50511102: 1816 return getCategory(); 1817 case 1458402129: 1818 return getMedication(); 1819 case 1998965455: 1820 return getMedication(); 1821 case -1867885268: 1822 return getSubject(); 1823 case 951530927: 1824 return getContext(); 1825 case 247104889: 1826 return getEffective(); 1827 case -1468651097: 1828 return getEffective(); 1829 case -1980855245: 1830 return getDateAssertedElement(); 1831 case -2123220889: 1832 return getInformationSource(); 1833 case 1077922663: 1834 return addDerivedFrom(); 1835 case 722137681: 1836 return addReasonCode(); 1837 case -1146218137: 1838 return addReasonReference(); 1839 case 3387378: 1840 return addNote(); 1841 case -1326018889: 1842 return addDosage(); 1843 default: 1844 return super.makeProperty(hash, name); 1845 } 1846 1847 } 1848 1849 @Override 1850 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1851 switch (hash) { 1852 case -1618432855: 1853 /* identifier */ return new String[] { "Identifier" }; 1854 case -332612366: 1855 /* basedOn */ return new String[] { "Reference" }; 1856 case -995410646: 1857 /* partOf */ return new String[] { "Reference" }; 1858 case -892481550: 1859 /* status */ return new String[] { "code" }; 1860 case 2051346646: 1861 /* statusReason */ return new String[] { "CodeableConcept" }; 1862 case 50511102: 1863 /* category */ return new String[] { "CodeableConcept" }; 1864 case 1998965455: 1865 /* medication */ return new String[] { "CodeableConcept", "Reference" }; 1866 case -1867885268: 1867 /* subject */ return new String[] { "Reference" }; 1868 case 951530927: 1869 /* context */ return new String[] { "Reference" }; 1870 case -1468651097: 1871 /* effective */ return new String[] { "dateTime", "Period" }; 1872 case -1980855245: 1873 /* dateAsserted */ return new String[] { "dateTime" }; 1874 case -2123220889: 1875 /* informationSource */ return new String[] { "Reference" }; 1876 case 1077922663: 1877 /* derivedFrom */ return new String[] { "Reference" }; 1878 case 722137681: 1879 /* reasonCode */ return new String[] { "CodeableConcept" }; 1880 case -1146218137: 1881 /* reasonReference */ return new String[] { "Reference" }; 1882 case 3387378: 1883 /* note */ return new String[] { "Annotation" }; 1884 case -1326018889: 1885 /* dosage */ return new String[] { "Dosage" }; 1886 default: 1887 return super.getTypesForProperty(hash, name); 1888 } 1889 1890 } 1891 1892 @Override 1893 public Base addChild(String name) throws FHIRException { 1894 if (name.equals("identifier")) { 1895 return addIdentifier(); 1896 } else if (name.equals("basedOn")) { 1897 return addBasedOn(); 1898 } else if (name.equals("partOf")) { 1899 return addPartOf(); 1900 } else if (name.equals("status")) { 1901 throw new FHIRException("Cannot call addChild on a singleton property MedicationStatement.status"); 1902 } else if (name.equals("statusReason")) { 1903 return addStatusReason(); 1904 } else if (name.equals("category")) { 1905 this.category = new CodeableConcept(); 1906 return this.category; 1907 } else if (name.equals("medicationCodeableConcept")) { 1908 this.medication = new CodeableConcept(); 1909 return this.medication; 1910 } else if (name.equals("medicationReference")) { 1911 this.medication = new Reference(); 1912 return this.medication; 1913 } else if (name.equals("subject")) { 1914 this.subject = new Reference(); 1915 return this.subject; 1916 } else if (name.equals("context")) { 1917 this.context = new Reference(); 1918 return this.context; 1919 } else if (name.equals("effectiveDateTime")) { 1920 this.effective = new DateTimeType(); 1921 return this.effective; 1922 } else if (name.equals("effectivePeriod")) { 1923 this.effective = new Period(); 1924 return this.effective; 1925 } else if (name.equals("dateAsserted")) { 1926 throw new FHIRException("Cannot call addChild on a singleton property MedicationStatement.dateAsserted"); 1927 } else if (name.equals("informationSource")) { 1928 this.informationSource = new Reference(); 1929 return this.informationSource; 1930 } else if (name.equals("derivedFrom")) { 1931 return addDerivedFrom(); 1932 } else if (name.equals("reasonCode")) { 1933 return addReasonCode(); 1934 } else if (name.equals("reasonReference")) { 1935 return addReasonReference(); 1936 } else if (name.equals("note")) { 1937 return addNote(); 1938 } else if (name.equals("dosage")) { 1939 return addDosage(); 1940 } else 1941 return super.addChild(name); 1942 } 1943 1944 public String fhirType() { 1945 return "MedicationStatement"; 1946 1947 } 1948 1949 public MedicationStatement copy() { 1950 MedicationStatement dst = new MedicationStatement(); 1951 copyValues(dst); 1952 return dst; 1953 } 1954 1955 public void copyValues(MedicationStatement dst) { 1956 super.copyValues(dst); 1957 if (identifier != null) { 1958 dst.identifier = new ArrayList<Identifier>(); 1959 for (Identifier i : identifier) 1960 dst.identifier.add(i.copy()); 1961 } 1962 ; 1963 if (basedOn != null) { 1964 dst.basedOn = new ArrayList<Reference>(); 1965 for (Reference i : basedOn) 1966 dst.basedOn.add(i.copy()); 1967 } 1968 ; 1969 if (partOf != null) { 1970 dst.partOf = new ArrayList<Reference>(); 1971 for (Reference i : partOf) 1972 dst.partOf.add(i.copy()); 1973 } 1974 ; 1975 dst.status = status == null ? null : status.copy(); 1976 if (statusReason != null) { 1977 dst.statusReason = new ArrayList<CodeableConcept>(); 1978 for (CodeableConcept i : statusReason) 1979 dst.statusReason.add(i.copy()); 1980 } 1981 ; 1982 dst.category = category == null ? null : category.copy(); 1983 dst.medication = medication == null ? null : medication.copy(); 1984 dst.subject = subject == null ? null : subject.copy(); 1985 dst.context = context == null ? null : context.copy(); 1986 dst.effective = effective == null ? null : effective.copy(); 1987 dst.dateAsserted = dateAsserted == null ? null : dateAsserted.copy(); 1988 dst.informationSource = informationSource == null ? null : informationSource.copy(); 1989 if (derivedFrom != null) { 1990 dst.derivedFrom = new ArrayList<Reference>(); 1991 for (Reference i : derivedFrom) 1992 dst.derivedFrom.add(i.copy()); 1993 } 1994 ; 1995 if (reasonCode != null) { 1996 dst.reasonCode = new ArrayList<CodeableConcept>(); 1997 for (CodeableConcept i : reasonCode) 1998 dst.reasonCode.add(i.copy()); 1999 } 2000 ; 2001 if (reasonReference != null) { 2002 dst.reasonReference = new ArrayList<Reference>(); 2003 for (Reference i : reasonReference) 2004 dst.reasonReference.add(i.copy()); 2005 } 2006 ; 2007 if (note != null) { 2008 dst.note = new ArrayList<Annotation>(); 2009 for (Annotation i : note) 2010 dst.note.add(i.copy()); 2011 } 2012 ; 2013 if (dosage != null) { 2014 dst.dosage = new ArrayList<Dosage>(); 2015 for (Dosage i : dosage) 2016 dst.dosage.add(i.copy()); 2017 } 2018 ; 2019 } 2020 2021 protected MedicationStatement typedCopy() { 2022 return copy(); 2023 } 2024 2025 @Override 2026 public boolean equalsDeep(Base other_) { 2027 if (!super.equalsDeep(other_)) 2028 return false; 2029 if (!(other_ instanceof MedicationStatement)) 2030 return false; 2031 MedicationStatement o = (MedicationStatement) other_; 2032 return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) 2033 && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true) 2034 && compareDeep(statusReason, o.statusReason, true) && compareDeep(category, o.category, true) 2035 && compareDeep(medication, o.medication, true) && compareDeep(subject, o.subject, true) 2036 && compareDeep(context, o.context, true) && compareDeep(effective, o.effective, true) 2037 && compareDeep(dateAsserted, o.dateAsserted, true) && compareDeep(informationSource, o.informationSource, true) 2038 && compareDeep(derivedFrom, o.derivedFrom, true) && compareDeep(reasonCode, o.reasonCode, true) 2039 && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(note, o.note, true) 2040 && compareDeep(dosage, o.dosage, true); 2041 } 2042 2043 @Override 2044 public boolean equalsShallow(Base other_) { 2045 if (!super.equalsShallow(other_)) 2046 return false; 2047 if (!(other_ instanceof MedicationStatement)) 2048 return false; 2049 MedicationStatement o = (MedicationStatement) other_; 2050 return compareValues(status, o.status, true) && compareValues(dateAsserted, o.dateAsserted, true); 2051 } 2052 2053 public boolean isEmpty() { 2054 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, partOf, status, statusReason, 2055 category, medication, subject, context, effective, dateAsserted, informationSource, derivedFrom, reasonCode, 2056 reasonReference, note, dosage); 2057 } 2058 2059 @Override 2060 public ResourceType getResourceType() { 2061 return ResourceType.MedicationStatement; 2062 } 2063 2064 /** 2065 * Search parameter: <b>identifier</b> 2066 * <p> 2067 * Description: <b>Return statements with this external identifier</b><br> 2068 * Type: <b>token</b><br> 2069 * Path: <b>MedicationStatement.identifier</b><br> 2070 * </p> 2071 */ 2072 @SearchParamDefinition(name = "identifier", path = "MedicationStatement.identifier", description = "Return statements with this external identifier", type = "token") 2073 public static final String SP_IDENTIFIER = "identifier"; 2074 /** 2075 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 2076 * <p> 2077 * Description: <b>Return statements with this external identifier</b><br> 2078 * Type: <b>token</b><br> 2079 * Path: <b>MedicationStatement.identifier</b><br> 2080 * </p> 2081 */ 2082 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam( 2083 SP_IDENTIFIER); 2084 2085 /** 2086 * Search parameter: <b>effective</b> 2087 * <p> 2088 * Description: <b>Date when patient was taking (or not taking) the 2089 * medication</b><br> 2090 * Type: <b>date</b><br> 2091 * Path: <b>MedicationStatement.effective[x]</b><br> 2092 * </p> 2093 */ 2094 @SearchParamDefinition(name = "effective", path = "MedicationStatement.effective", description = "Date when patient was taking (or not taking) the medication", type = "date") 2095 public static final String SP_EFFECTIVE = "effective"; 2096 /** 2097 * <b>Fluent Client</b> search parameter constant for <b>effective</b> 2098 * <p> 2099 * Description: <b>Date when patient was taking (or not taking) the 2100 * medication</b><br> 2101 * Type: <b>date</b><br> 2102 * Path: <b>MedicationStatement.effective[x]</b><br> 2103 * </p> 2104 */ 2105 public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam( 2106 SP_EFFECTIVE); 2107 2108 /** 2109 * Search parameter: <b>code</b> 2110 * <p> 2111 * Description: <b>Return statements of this medication code</b><br> 2112 * Type: <b>token</b><br> 2113 * Path: <b>MedicationStatement.medicationCodeableConcept</b><br> 2114 * </p> 2115 */ 2116 @SearchParamDefinition(name = "code", path = "(MedicationStatement.medication as CodeableConcept)", description = "Return statements of this medication code", type = "token") 2117 public static final String SP_CODE = "code"; 2118 /** 2119 * <b>Fluent Client</b> search parameter constant for <b>code</b> 2120 * <p> 2121 * Description: <b>Return statements of this medication code</b><br> 2122 * Type: <b>token</b><br> 2123 * Path: <b>MedicationStatement.medicationCodeableConcept</b><br> 2124 * </p> 2125 */ 2126 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam( 2127 SP_CODE); 2128 2129 /** 2130 * Search parameter: <b>subject</b> 2131 * <p> 2132 * Description: <b>The identity of a patient, animal or group to list statements 2133 * for</b><br> 2134 * Type: <b>reference</b><br> 2135 * Path: <b>MedicationStatement.subject</b><br> 2136 * </p> 2137 */ 2138 @SearchParamDefinition(name = "subject", path = "MedicationStatement.subject", description = "The identity of a patient, animal or group to list statements for", type = "reference", providesMembershipIn = { 2139 @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Group.class, Patient.class }) 2140 public static final String SP_SUBJECT = "subject"; 2141 /** 2142 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 2143 * <p> 2144 * Description: <b>The identity of a patient, animal or group to list statements 2145 * for</b><br> 2146 * Type: <b>reference</b><br> 2147 * Path: <b>MedicationStatement.subject</b><br> 2148 * </p> 2149 */ 2150 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2151 SP_SUBJECT); 2152 2153 /** 2154 * Constant for fluent queries to be used to add include statements. Specifies 2155 * the path value of "<b>MedicationStatement:subject</b>". 2156 */ 2157 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include( 2158 "MedicationStatement:subject").toLocked(); 2159 2160 /** 2161 * Search parameter: <b>patient</b> 2162 * <p> 2163 * Description: <b>Returns statements for a specific patient.</b><br> 2164 * Type: <b>reference</b><br> 2165 * Path: <b>MedicationStatement.subject</b><br> 2166 * </p> 2167 */ 2168 @SearchParamDefinition(name = "patient", path = "MedicationStatement.subject.where(resolve() is Patient)", description = "Returns statements for a specific patient.", type = "reference", target = { 2169 Patient.class }) 2170 public static final String SP_PATIENT = "patient"; 2171 /** 2172 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 2173 * <p> 2174 * Description: <b>Returns statements for a specific patient.</b><br> 2175 * Type: <b>reference</b><br> 2176 * Path: <b>MedicationStatement.subject</b><br> 2177 * </p> 2178 */ 2179 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2180 SP_PATIENT); 2181 2182 /** 2183 * Constant for fluent queries to be used to add include statements. Specifies 2184 * the path value of "<b>MedicationStatement:patient</b>". 2185 */ 2186 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include( 2187 "MedicationStatement:patient").toLocked(); 2188 2189 /** 2190 * Search parameter: <b>context</b> 2191 * <p> 2192 * Description: <b>Returns statements for a specific context (episode or episode 2193 * of Care).</b><br> 2194 * Type: <b>reference</b><br> 2195 * Path: <b>MedicationStatement.context</b><br> 2196 * </p> 2197 */ 2198 @SearchParamDefinition(name = "context", path = "MedicationStatement.context", description = "Returns statements for a specific context (episode or episode of Care).", type = "reference", target = { 2199 Encounter.class, EpisodeOfCare.class }) 2200 public static final String SP_CONTEXT = "context"; 2201 /** 2202 * <b>Fluent Client</b> search parameter constant for <b>context</b> 2203 * <p> 2204 * Description: <b>Returns statements for a specific context (episode or episode 2205 * of Care).</b><br> 2206 * Type: <b>reference</b><br> 2207 * Path: <b>MedicationStatement.context</b><br> 2208 * </p> 2209 */ 2210 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2211 SP_CONTEXT); 2212 2213 /** 2214 * Constant for fluent queries to be used to add include statements. Specifies 2215 * the path value of "<b>MedicationStatement:context</b>". 2216 */ 2217 public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include( 2218 "MedicationStatement:context").toLocked(); 2219 2220 /** 2221 * Search parameter: <b>medication</b> 2222 * <p> 2223 * Description: <b>Return statements of this medication reference</b><br> 2224 * Type: <b>reference</b><br> 2225 * Path: <b>MedicationStatement.medicationReference</b><br> 2226 * </p> 2227 */ 2228 @SearchParamDefinition(name = "medication", path = "(MedicationStatement.medication as Reference)", description = "Return statements of this medication reference", type = "reference", target = { 2229 Medication.class }) 2230 public static final String SP_MEDICATION = "medication"; 2231 /** 2232 * <b>Fluent Client</b> search parameter constant for <b>medication</b> 2233 * <p> 2234 * Description: <b>Return statements of this medication reference</b><br> 2235 * Type: <b>reference</b><br> 2236 * Path: <b>MedicationStatement.medicationReference</b><br> 2237 * </p> 2238 */ 2239 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2240 SP_MEDICATION); 2241 2242 /** 2243 * Constant for fluent queries to be used to add include statements. Specifies 2244 * the path value of "<b>MedicationStatement:medication</b>". 2245 */ 2246 public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include( 2247 "MedicationStatement:medication").toLocked(); 2248 2249 /** 2250 * Search parameter: <b>part-of</b> 2251 * <p> 2252 * Description: <b>Returns statements that are part of another event.</b><br> 2253 * Type: <b>reference</b><br> 2254 * Path: <b>MedicationStatement.partOf</b><br> 2255 * </p> 2256 */ 2257 @SearchParamDefinition(name = "part-of", path = "MedicationStatement.partOf", description = "Returns statements that are part of another event.", type = "reference", target = { 2258 MedicationAdministration.class, MedicationDispense.class, MedicationStatement.class, Observation.class, 2259 Procedure.class }) 2260 public static final String SP_PART_OF = "part-of"; 2261 /** 2262 * <b>Fluent Client</b> search parameter constant for <b>part-of</b> 2263 * <p> 2264 * Description: <b>Returns statements that are part of another event.</b><br> 2265 * Type: <b>reference</b><br> 2266 * Path: <b>MedicationStatement.partOf</b><br> 2267 * </p> 2268 */ 2269 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2270 SP_PART_OF); 2271 2272 /** 2273 * Constant for fluent queries to be used to add include statements. Specifies 2274 * the path value of "<b>MedicationStatement:part-of</b>". 2275 */ 2276 public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include( 2277 "MedicationStatement:part-of").toLocked(); 2278 2279 /** 2280 * Search parameter: <b>source</b> 2281 * <p> 2282 * Description: <b>Who or where the information in the statement came 2283 * from</b><br> 2284 * Type: <b>reference</b><br> 2285 * Path: <b>MedicationStatement.informationSource</b><br> 2286 * </p> 2287 */ 2288 @SearchParamDefinition(name = "source", path = "MedicationStatement.informationSource", description = "Who or where the information in the statement came from", type = "reference", providesMembershipIn = { 2289 @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"), 2290 @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Organization.class, 2291 Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class }) 2292 public static final String SP_SOURCE = "source"; 2293 /** 2294 * <b>Fluent Client</b> search parameter constant for <b>source</b> 2295 * <p> 2296 * Description: <b>Who or where the information in the statement came 2297 * from</b><br> 2298 * Type: <b>reference</b><br> 2299 * Path: <b>MedicationStatement.informationSource</b><br> 2300 * </p> 2301 */ 2302 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2303 SP_SOURCE); 2304 2305 /** 2306 * Constant for fluent queries to be used to add include statements. Specifies 2307 * the path value of "<b>MedicationStatement:source</b>". 2308 */ 2309 public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include( 2310 "MedicationStatement:source").toLocked(); 2311 2312 /** 2313 * Search parameter: <b>category</b> 2314 * <p> 2315 * Description: <b>Returns statements of this category of 2316 * medicationstatement</b><br> 2317 * Type: <b>token</b><br> 2318 * Path: <b>MedicationStatement.category</b><br> 2319 * </p> 2320 */ 2321 @SearchParamDefinition(name = "category", path = "MedicationStatement.category", description = "Returns statements of this category of medicationstatement", type = "token") 2322 public static final String SP_CATEGORY = "category"; 2323 /** 2324 * <b>Fluent Client</b> search parameter constant for <b>category</b> 2325 * <p> 2326 * Description: <b>Returns statements of this category of 2327 * medicationstatement</b><br> 2328 * Type: <b>token</b><br> 2329 * Path: <b>MedicationStatement.category</b><br> 2330 * </p> 2331 */ 2332 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam( 2333 SP_CATEGORY); 2334 2335 /** 2336 * Search parameter: <b>status</b> 2337 * <p> 2338 * Description: <b>Return statements that match the given status</b><br> 2339 * Type: <b>token</b><br> 2340 * Path: <b>MedicationStatement.status</b><br> 2341 * </p> 2342 */ 2343 @SearchParamDefinition(name = "status", path = "MedicationStatement.status", description = "Return statements that match the given status", type = "token") 2344 public static final String SP_STATUS = "status"; 2345 /** 2346 * <b>Fluent Client</b> search parameter constant for <b>status</b> 2347 * <p> 2348 * Description: <b>Return statements that match the given status</b><br> 2349 * Type: <b>token</b><br> 2350 * Path: <b>MedicationStatement.status</b><br> 2351 * </p> 2352 */ 2353 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam( 2354 SP_STATUS); 2355 2356}