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