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