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