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