001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.
052 */
053@ResourceDef(name="MedicationAdministration", profile="http://hl7.org/fhir/StructureDefinition/MedicationAdministration")
054public class MedicationAdministration extends DomainResource {
055
056    public enum MedicationAdministrationStatusCodes {
057        /**
058         * The administration has started but has not yet completed.
059         */
060        INPROGRESS, 
061        /**
062         * The administration was terminated prior to any impact on the subject (though preparatory actions may have been taken)
063         */
064        NOTDONE, 
065        /**
066         * Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called 'suspended'.
067         */
068        ONHOLD, 
069        /**
070         * All actions that are implied by the administration have occurred.
071         */
072        COMPLETED, 
073        /**
074         * The administration was entered in error and therefore nullified.
075         */
076        ENTEREDINERROR, 
077        /**
078         * Actions implied by the administration have been permanently halted, before all of them occurred.
079         */
080        STOPPED, 
081        /**
082         * The authoring system does not know which of the status values currently applies for this request. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, it's just not known which one.
083         */
084        UNKNOWN, 
085        /**
086         * added to help the parsers with the generic types
087         */
088        NULL;
089        public static MedicationAdministrationStatusCodes fromCode(String codeString) throws FHIRException {
090            if (codeString == null || "".equals(codeString))
091                return null;
092        if ("in-progress".equals(codeString))
093          return INPROGRESS;
094        if ("not-done".equals(codeString))
095          return NOTDONE;
096        if ("on-hold".equals(codeString))
097          return ONHOLD;
098        if ("completed".equals(codeString))
099          return COMPLETED;
100        if ("entered-in-error".equals(codeString))
101          return ENTEREDINERROR;
102        if ("stopped".equals(codeString))
103          return STOPPED;
104        if ("unknown".equals(codeString))
105          return UNKNOWN;
106        if (Configuration.isAcceptInvalidEnums())
107          return null;
108        else
109          throw new FHIRException("Unknown MedicationAdministrationStatusCodes code '"+codeString+"'");
110        }
111        public String toCode() {
112          switch (this) {
113            case INPROGRESS: return "in-progress";
114            case NOTDONE: return "not-done";
115            case ONHOLD: return "on-hold";
116            case COMPLETED: return "completed";
117            case ENTEREDINERROR: return "entered-in-error";
118            case STOPPED: return "stopped";
119            case UNKNOWN: return "unknown";
120            default: return "?";
121          }
122        }
123        public String getSystem() {
124          switch (this) {
125            case INPROGRESS: return "http://hl7.org/fhir/CodeSystem/medication-admin-status";
126            case NOTDONE: return "http://hl7.org/fhir/CodeSystem/medication-admin-status";
127            case ONHOLD: return "http://hl7.org/fhir/CodeSystem/medication-admin-status";
128            case COMPLETED: return "http://hl7.org/fhir/CodeSystem/medication-admin-status";
129            case ENTEREDINERROR: return "http://hl7.org/fhir/CodeSystem/medication-admin-status";
130            case STOPPED: return "http://hl7.org/fhir/CodeSystem/medication-admin-status";
131            case UNKNOWN: return "http://hl7.org/fhir/CodeSystem/medication-admin-status";
132            default: return "?";
133          }
134        }
135        public String getDefinition() {
136          switch (this) {
137            case INPROGRESS: return "The administration has started but has not yet completed.";
138            case NOTDONE: return "The administration was terminated prior to any impact on the subject (though preparatory actions may have been taken)";
139            case ONHOLD: return "Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called 'suspended'.";
140            case COMPLETED: return "All actions that are implied by the administration have occurred.";
141            case ENTEREDINERROR: return "The administration was entered in error and therefore nullified.";
142            case STOPPED: return "Actions implied by the administration have been permanently halted, before all of them occurred.";
143            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, it's just not known which one.";
144            default: return "?";
145          }
146        }
147        public String getDisplay() {
148          switch (this) {
149            case INPROGRESS: return "In Progress";
150            case NOTDONE: return "Not Done";
151            case ONHOLD: return "On Hold";
152            case COMPLETED: return "Completed";
153            case ENTEREDINERROR: return "Entered in Error";
154            case STOPPED: return "Stopped";
155            case UNKNOWN: return "Unknown";
156            default: return "?";
157          }
158        }
159    }
160
161  public static class MedicationAdministrationStatusCodesEnumFactory implements EnumFactory<MedicationAdministrationStatusCodes> {
162    public MedicationAdministrationStatusCodes fromCode(String codeString) throws IllegalArgumentException {
163      if (codeString == null || "".equals(codeString))
164            if (codeString == null || "".equals(codeString))
165                return null;
166        if ("in-progress".equals(codeString))
167          return MedicationAdministrationStatusCodes.INPROGRESS;
168        if ("not-done".equals(codeString))
169          return MedicationAdministrationStatusCodes.NOTDONE;
170        if ("on-hold".equals(codeString))
171          return MedicationAdministrationStatusCodes.ONHOLD;
172        if ("completed".equals(codeString))
173          return MedicationAdministrationStatusCodes.COMPLETED;
174        if ("entered-in-error".equals(codeString))
175          return MedicationAdministrationStatusCodes.ENTEREDINERROR;
176        if ("stopped".equals(codeString))
177          return MedicationAdministrationStatusCodes.STOPPED;
178        if ("unknown".equals(codeString))
179          return MedicationAdministrationStatusCodes.UNKNOWN;
180        throw new IllegalArgumentException("Unknown MedicationAdministrationStatusCodes code '"+codeString+"'");
181        }
182        public Enumeration<MedicationAdministrationStatusCodes> fromType(Base code) throws FHIRException {
183          if (code == null)
184            return null;
185          if (code.isEmpty())
186            return new Enumeration<MedicationAdministrationStatusCodes>(this);
187          String codeString = ((PrimitiveType) code).asStringValue();
188          if (codeString == null || "".equals(codeString))
189            return null;
190        if ("in-progress".equals(codeString))
191          return new Enumeration<MedicationAdministrationStatusCodes>(this, MedicationAdministrationStatusCodes.INPROGRESS);
192        if ("not-done".equals(codeString))
193          return new Enumeration<MedicationAdministrationStatusCodes>(this, MedicationAdministrationStatusCodes.NOTDONE);
194        if ("on-hold".equals(codeString))
195          return new Enumeration<MedicationAdministrationStatusCodes>(this, MedicationAdministrationStatusCodes.ONHOLD);
196        if ("completed".equals(codeString))
197          return new Enumeration<MedicationAdministrationStatusCodes>(this, MedicationAdministrationStatusCodes.COMPLETED);
198        if ("entered-in-error".equals(codeString))
199          return new Enumeration<MedicationAdministrationStatusCodes>(this, MedicationAdministrationStatusCodes.ENTEREDINERROR);
200        if ("stopped".equals(codeString))
201          return new Enumeration<MedicationAdministrationStatusCodes>(this, MedicationAdministrationStatusCodes.STOPPED);
202        if ("unknown".equals(codeString))
203          return new Enumeration<MedicationAdministrationStatusCodes>(this, MedicationAdministrationStatusCodes.UNKNOWN);
204        throw new FHIRException("Unknown MedicationAdministrationStatusCodes code '"+codeString+"'");
205        }
206    public String toCode(MedicationAdministrationStatusCodes code) {
207      if (code == MedicationAdministrationStatusCodes.INPROGRESS)
208        return "in-progress";
209      if (code == MedicationAdministrationStatusCodes.NOTDONE)
210        return "not-done";
211      if (code == MedicationAdministrationStatusCodes.ONHOLD)
212        return "on-hold";
213      if (code == MedicationAdministrationStatusCodes.COMPLETED)
214        return "completed";
215      if (code == MedicationAdministrationStatusCodes.ENTEREDINERROR)
216        return "entered-in-error";
217      if (code == MedicationAdministrationStatusCodes.STOPPED)
218        return "stopped";
219      if (code == MedicationAdministrationStatusCodes.UNKNOWN)
220        return "unknown";
221      return "?";
222      }
223    public String toSystem(MedicationAdministrationStatusCodes code) {
224      return code.getSystem();
225      }
226    }
227
228    @Block()
229    public static class MedicationAdministrationPerformerComponent extends BackboneElement implements IBaseBackboneElement {
230        /**
231         * Distinguishes the type of involvement of the performer in the medication administration.
232         */
233        @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
234        @Description(shortDefinition="Type of performance", formalDefinition="Distinguishes the type of involvement of the performer in the medication administration." )
235        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/med-admin-perform-function")
236        protected CodeableConcept function;
237
238        /**
239         * Indicates who or what performed the medication administration.
240         */
241        @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Patient.class, RelatedPerson.class, Device.class}, order=2, min=1, max=1, modifier=false, summary=true)
242        @Description(shortDefinition="Who performed the medication administration", formalDefinition="Indicates who or what performed the medication administration." )
243        protected Reference actor;
244
245        private static final long serialVersionUID = -576943815L;
246
247    /**
248     * Constructor
249     */
250      public MedicationAdministrationPerformerComponent() {
251        super();
252      }
253
254    /**
255     * Constructor
256     */
257      public MedicationAdministrationPerformerComponent(Reference actor) {
258        super();
259        this.setActor(actor);
260      }
261
262        /**
263         * @return {@link #function} (Distinguishes the type of involvement of the performer in the medication administration.)
264         */
265        public CodeableConcept getFunction() { 
266          if (this.function == null)
267            if (Configuration.errorOnAutoCreate())
268              throw new Error("Attempt to auto-create MedicationAdministrationPerformerComponent.function");
269            else if (Configuration.doAutoCreate())
270              this.function = new CodeableConcept(); // cc
271          return this.function;
272        }
273
274        public boolean hasFunction() { 
275          return this.function != null && !this.function.isEmpty();
276        }
277
278        /**
279         * @param value {@link #function} (Distinguishes the type of involvement of the performer in the medication administration.)
280         */
281        public MedicationAdministrationPerformerComponent setFunction(CodeableConcept value) { 
282          this.function = value;
283          return this;
284        }
285
286        /**
287         * @return {@link #actor} (Indicates who or what performed the medication administration.)
288         */
289        public Reference getActor() { 
290          if (this.actor == null)
291            if (Configuration.errorOnAutoCreate())
292              throw new Error("Attempt to auto-create MedicationAdministrationPerformerComponent.actor");
293            else if (Configuration.doAutoCreate())
294              this.actor = new Reference(); // cc
295          return this.actor;
296        }
297
298        public boolean hasActor() { 
299          return this.actor != null && !this.actor.isEmpty();
300        }
301
302        /**
303         * @param value {@link #actor} (Indicates who or what performed the medication administration.)
304         */
305        public MedicationAdministrationPerformerComponent setActor(Reference value) { 
306          this.actor = value;
307          return this;
308        }
309
310        protected void listChildren(List<Property> children) {
311          super.listChildren(children);
312          children.add(new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the performer in the medication administration.", 0, 1, function));
313          children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson|Device)", "Indicates who or what performed the medication administration.", 0, 1, actor));
314        }
315
316        @Override
317        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
318          switch (_hash) {
319          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the performer in the medication administration.", 0, 1, function);
320          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson|Device)", "Indicates who or what performed the medication administration.", 0, 1, actor);
321          default: return super.getNamedProperty(_hash, _name, _checkValid);
322          }
323
324        }
325
326      @Override
327      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
328        switch (hash) {
329        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
330        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
331        default: return super.getProperty(hash, name, checkValid);
332        }
333
334      }
335
336      @Override
337      public Base setProperty(int hash, String name, Base value) throws FHIRException {
338        switch (hash) {
339        case 1380938712: // function
340          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
341          return value;
342        case 92645877: // actor
343          this.actor = TypeConvertor.castToReference(value); // Reference
344          return value;
345        default: return super.setProperty(hash, name, value);
346        }
347
348      }
349
350      @Override
351      public Base setProperty(String name, Base value) throws FHIRException {
352        if (name.equals("function")) {
353          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
354        } else if (name.equals("actor")) {
355          this.actor = TypeConvertor.castToReference(value); // Reference
356        } else
357          return super.setProperty(name, value);
358        return value;
359      }
360
361      @Override
362      public Base makeProperty(int hash, String name) throws FHIRException {
363        switch (hash) {
364        case 1380938712:  return getFunction();
365        case 92645877:  return getActor();
366        default: return super.makeProperty(hash, name);
367        }
368
369      }
370
371      @Override
372      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
373        switch (hash) {
374        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
375        case 92645877: /*actor*/ return new String[] {"Reference"};
376        default: return super.getTypesForProperty(hash, name);
377        }
378
379      }
380
381      @Override
382      public Base addChild(String name) throws FHIRException {
383        if (name.equals("function")) {
384          this.function = new CodeableConcept();
385          return this.function;
386        }
387        else if (name.equals("actor")) {
388          this.actor = new Reference();
389          return this.actor;
390        }
391        else
392          return super.addChild(name);
393      }
394
395      public MedicationAdministrationPerformerComponent copy() {
396        MedicationAdministrationPerformerComponent dst = new MedicationAdministrationPerformerComponent();
397        copyValues(dst);
398        return dst;
399      }
400
401      public void copyValues(MedicationAdministrationPerformerComponent dst) {
402        super.copyValues(dst);
403        dst.function = function == null ? null : function.copy();
404        dst.actor = actor == null ? null : actor.copy();
405      }
406
407      @Override
408      public boolean equalsDeep(Base other_) {
409        if (!super.equalsDeep(other_))
410          return false;
411        if (!(other_ instanceof MedicationAdministrationPerformerComponent))
412          return false;
413        MedicationAdministrationPerformerComponent o = (MedicationAdministrationPerformerComponent) other_;
414        return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
415      }
416
417      @Override
418      public boolean equalsShallow(Base other_) {
419        if (!super.equalsShallow(other_))
420          return false;
421        if (!(other_ instanceof MedicationAdministrationPerformerComponent))
422          return false;
423        MedicationAdministrationPerformerComponent o = (MedicationAdministrationPerformerComponent) other_;
424        return true;
425      }
426
427      public boolean isEmpty() {
428        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
429      }
430
431  public String fhirType() {
432    return "MedicationAdministration.performer";
433
434  }
435
436  }
437
438    @Block()
439    public static class MedicationAdministrationDosageComponent extends BackboneElement implements IBaseBackboneElement {
440        /**
441         * Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.
442
443The dosage instructions should reflect the dosage of the medication that was administered.
444         */
445        @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
446        @Description(shortDefinition="Free text dosage instructions e.g. SIG", formalDefinition="Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.\r\rThe dosage instructions should reflect the dosage of the medication that was administered." )
447        protected StringType text;
448
449        /**
450         * A coded specification of the anatomic site where the medication first entered the body.  For example, "left arm".
451         */
452        @Child(name = "site", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
453        @Description(shortDefinition="Body site administered to", formalDefinition="A coded specification of the anatomic site where the medication first entered the body.  For example, \"left arm\"." )
454        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/approach-site-codes")
455        protected CodeableConcept site;
456
457        /**
458         * A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc.
459         */
460        @Child(name = "route", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
461        @Description(shortDefinition="Path of substance into body", formalDefinition="A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc." )
462        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/route-codes")
463        protected CodeableConcept route;
464
465        /**
466         * A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV.
467         */
468        @Child(name = "method", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
469        @Description(shortDefinition="How drug was administered", formalDefinition="A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV." )
470        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/administration-method-codes")
471        protected CodeableConcept method;
472
473        /**
474         * The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.
475         */
476        @Child(name = "dose", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
477        @Description(shortDefinition="Amount of medication per dose", formalDefinition="The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection." )
478        protected Quantity dose;
479
480        /**
481         * Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.
482         */
483        @Child(name = "rate", type = {Ratio.class, Quantity.class}, order=6, min=0, max=1, modifier=false, summary=false)
484        @Description(shortDefinition="Dose quantity per unit of time", formalDefinition="Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours." )
485        protected DataType rate;
486
487        private static final long serialVersionUID = -484090956L;
488
489    /**
490     * Constructor
491     */
492      public MedicationAdministrationDosageComponent() {
493        super();
494      }
495
496        /**
497         * @return {@link #text} (Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.
498
499The dosage instructions should reflect the dosage of the medication that was administered.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
500         */
501        public StringType getTextElement() { 
502          if (this.text == null)
503            if (Configuration.errorOnAutoCreate())
504              throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.text");
505            else if (Configuration.doAutoCreate())
506              this.text = new StringType(); // bb
507          return this.text;
508        }
509
510        public boolean hasTextElement() { 
511          return this.text != null && !this.text.isEmpty();
512        }
513
514        public boolean hasText() { 
515          return this.text != null && !this.text.isEmpty();
516        }
517
518        /**
519         * @param value {@link #text} (Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.
520
521The dosage instructions should reflect the dosage of the medication that was administered.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
522         */
523        public MedicationAdministrationDosageComponent setTextElement(StringType value) { 
524          this.text = value;
525          return this;
526        }
527
528        /**
529         * @return Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.
530
531The dosage instructions should reflect the dosage of the medication that was administered.
532         */
533        public String getText() { 
534          return this.text == null ? null : this.text.getValue();
535        }
536
537        /**
538         * @param value Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.
539
540The dosage instructions should reflect the dosage of the medication that was administered.
541         */
542        public MedicationAdministrationDosageComponent setText(String value) { 
543          if (Utilities.noString(value))
544            this.text = null;
545          else {
546            if (this.text == null)
547              this.text = new StringType();
548            this.text.setValue(value);
549          }
550          return this;
551        }
552
553        /**
554         * @return {@link #site} (A coded specification of the anatomic site where the medication first entered the body.  For example, "left arm".)
555         */
556        public CodeableConcept getSite() { 
557          if (this.site == null)
558            if (Configuration.errorOnAutoCreate())
559              throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.site");
560            else if (Configuration.doAutoCreate())
561              this.site = new CodeableConcept(); // cc
562          return this.site;
563        }
564
565        public boolean hasSite() { 
566          return this.site != null && !this.site.isEmpty();
567        }
568
569        /**
570         * @param value {@link #site} (A coded specification of the anatomic site where the medication first entered the body.  For example, "left arm".)
571         */
572        public MedicationAdministrationDosageComponent setSite(CodeableConcept value) { 
573          this.site = value;
574          return this;
575        }
576
577        /**
578         * @return {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc.)
579         */
580        public CodeableConcept getRoute() { 
581          if (this.route == null)
582            if (Configuration.errorOnAutoCreate())
583              throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.route");
584            else if (Configuration.doAutoCreate())
585              this.route = new CodeableConcept(); // cc
586          return this.route;
587        }
588
589        public boolean hasRoute() { 
590          return this.route != null && !this.route.isEmpty();
591        }
592
593        /**
594         * @param value {@link #route} (A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc.)
595         */
596        public MedicationAdministrationDosageComponent setRoute(CodeableConcept value) { 
597          this.route = value;
598          return this;
599        }
600
601        /**
602         * @return {@link #method} (A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV.)
603         */
604        public CodeableConcept getMethod() { 
605          if (this.method == null)
606            if (Configuration.errorOnAutoCreate())
607              throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.method");
608            else if (Configuration.doAutoCreate())
609              this.method = new CodeableConcept(); // cc
610          return this.method;
611        }
612
613        public boolean hasMethod() { 
614          return this.method != null && !this.method.isEmpty();
615        }
616
617        /**
618         * @param value {@link #method} (A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV.)
619         */
620        public MedicationAdministrationDosageComponent setMethod(CodeableConcept value) { 
621          this.method = value;
622          return this;
623        }
624
625        /**
626         * @return {@link #dose} (The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.)
627         */
628        public Quantity getDose() { 
629          if (this.dose == null)
630            if (Configuration.errorOnAutoCreate())
631              throw new Error("Attempt to auto-create MedicationAdministrationDosageComponent.dose");
632            else if (Configuration.doAutoCreate())
633              this.dose = new Quantity(); // cc
634          return this.dose;
635        }
636
637        public boolean hasDose() { 
638          return this.dose != null && !this.dose.isEmpty();
639        }
640
641        /**
642         * @param value {@link #dose} (The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.)
643         */
644        public MedicationAdministrationDosageComponent setDose(Quantity value) { 
645          this.dose = value;
646          return this;
647        }
648
649        /**
650         * @return {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.)
651         */
652        public DataType getRate() { 
653          return this.rate;
654        }
655
656        /**
657         * @return {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.)
658         */
659        public Ratio getRateRatio() throws FHIRException { 
660          if (this.rate == null)
661            this.rate = new Ratio();
662          if (!(this.rate instanceof Ratio))
663            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered");
664          return (Ratio) this.rate;
665        }
666
667        public boolean hasRateRatio() { 
668          return this != null && this.rate instanceof Ratio;
669        }
670
671        /**
672         * @return {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.)
673         */
674        public Quantity getRateQuantity() throws FHIRException { 
675          if (this.rate == null)
676            this.rate = new Quantity();
677          if (!(this.rate instanceof Quantity))
678            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.rate.getClass().getName()+" was encountered");
679          return (Quantity) this.rate;
680        }
681
682        public boolean hasRateQuantity() { 
683          return this != null && this.rate instanceof Quantity;
684        }
685
686        public boolean hasRate() { 
687          return this.rate != null && !this.rate.isEmpty();
688        }
689
690        /**
691         * @param value {@link #rate} (Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.)
692         */
693        public MedicationAdministrationDosageComponent setRate(DataType value) { 
694          if (value != null && !(value instanceof Ratio || value instanceof Quantity))
695            throw new Error("Not the right type for MedicationAdministration.dosage.rate[x]: "+value.fhirType());
696          this.rate = value;
697          return this;
698        }
699
700        protected void listChildren(List<Property> children) {
701          super.listChildren(children);
702          children.add(new Property("text", "string", "Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.\r\rThe dosage instructions should reflect the dosage of the medication that was administered.", 0, 1, text));
703          children.add(new Property("site", "CodeableConcept", "A coded specification of the anatomic site where the medication first entered the body.  For example, \"left arm\".", 0, 1, site));
704          children.add(new Property("route", "CodeableConcept", "A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc.", 0, 1, route));
705          children.add(new Property("method", "CodeableConcept", "A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV.", 0, 1, method));
706          children.add(new Property("dose", "Quantity", "The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.", 0, 1, dose));
707          children.add(new Property("rate[x]", "Ratio|Quantity", "Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.", 0, 1, rate));
708        }
709
710        @Override
711        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
712          switch (_hash) {
713          case 3556653: /*text*/  return new Property("text", "string", "Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.\r\rThe dosage instructions should reflect the dosage of the medication that was administered.", 0, 1, text);
714          case 3530567: /*site*/  return new Property("site", "CodeableConcept", "A coded specification of the anatomic site where the medication first entered the body.  For example, \"left arm\".", 0, 1, site);
715          case 108704329: /*route*/  return new Property("route", "CodeableConcept", "A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc.", 0, 1, route);
716          case -1077554975: /*method*/  return new Property("method", "CodeableConcept", "A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV.", 0, 1, method);
717          case 3089437: /*dose*/  return new Property("dose", "Quantity", "The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.", 0, 1, dose);
718          case 983460768: /*rate[x]*/  return new Property("rate[x]", "Ratio|Quantity", "Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.", 0, 1, rate);
719          case 3493088: /*rate*/  return new Property("rate[x]", "Ratio|Quantity", "Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.", 0, 1, rate);
720          case 204021515: /*rateRatio*/  return new Property("rate[x]", "Ratio", "Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.", 0, 1, rate);
721          case -1085459061: /*rateQuantity*/  return new Property("rate[x]", "Quantity", "Identifies the speed with which the medication was or will be introduced into the patient.  Typically, the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time, e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.", 0, 1, rate);
722          default: return super.getNamedProperty(_hash, _name, _checkValid);
723          }
724
725        }
726
727      @Override
728      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
729        switch (hash) {
730        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
731        case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // CodeableConcept
732        case 108704329: /*route*/ return this.route == null ? new Base[0] : new Base[] {this.route}; // CodeableConcept
733        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
734        case 3089437: /*dose*/ return this.dose == null ? new Base[0] : new Base[] {this.dose}; // Quantity
735        case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // DataType
736        default: return super.getProperty(hash, name, checkValid);
737        }
738
739      }
740
741      @Override
742      public Base setProperty(int hash, String name, Base value) throws FHIRException {
743        switch (hash) {
744        case 3556653: // text
745          this.text = TypeConvertor.castToString(value); // StringType
746          return value;
747        case 3530567: // site
748          this.site = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
749          return value;
750        case 108704329: // route
751          this.route = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
752          return value;
753        case -1077554975: // method
754          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
755          return value;
756        case 3089437: // dose
757          this.dose = TypeConvertor.castToQuantity(value); // Quantity
758          return value;
759        case 3493088: // rate
760          this.rate = TypeConvertor.castToType(value); // DataType
761          return value;
762        default: return super.setProperty(hash, name, value);
763        }
764
765      }
766
767      @Override
768      public Base setProperty(String name, Base value) throws FHIRException {
769        if (name.equals("text")) {
770          this.text = TypeConvertor.castToString(value); // StringType
771        } else if (name.equals("site")) {
772          this.site = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
773        } else if (name.equals("route")) {
774          this.route = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
775        } else if (name.equals("method")) {
776          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
777        } else if (name.equals("dose")) {
778          this.dose = TypeConvertor.castToQuantity(value); // Quantity
779        } else if (name.equals("rate[x]")) {
780          this.rate = TypeConvertor.castToType(value); // DataType
781        } else
782          return super.setProperty(name, value);
783        return value;
784      }
785
786      @Override
787      public Base makeProperty(int hash, String name) throws FHIRException {
788        switch (hash) {
789        case 3556653:  return getTextElement();
790        case 3530567:  return getSite();
791        case 108704329:  return getRoute();
792        case -1077554975:  return getMethod();
793        case 3089437:  return getDose();
794        case 983460768:  return getRate();
795        case 3493088:  return getRate();
796        default: return super.makeProperty(hash, name);
797        }
798
799      }
800
801      @Override
802      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
803        switch (hash) {
804        case 3556653: /*text*/ return new String[] {"string"};
805        case 3530567: /*site*/ return new String[] {"CodeableConcept"};
806        case 108704329: /*route*/ return new String[] {"CodeableConcept"};
807        case -1077554975: /*method*/ return new String[] {"CodeableConcept"};
808        case 3089437: /*dose*/ return new String[] {"Quantity"};
809        case 3493088: /*rate*/ return new String[] {"Ratio", "Quantity"};
810        default: return super.getTypesForProperty(hash, name);
811        }
812
813      }
814
815      @Override
816      public Base addChild(String name) throws FHIRException {
817        if (name.equals("text")) {
818          throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.dosage.text");
819        }
820        else if (name.equals("site")) {
821          this.site = new CodeableConcept();
822          return this.site;
823        }
824        else if (name.equals("route")) {
825          this.route = new CodeableConcept();
826          return this.route;
827        }
828        else if (name.equals("method")) {
829          this.method = new CodeableConcept();
830          return this.method;
831        }
832        else if (name.equals("dose")) {
833          this.dose = new Quantity();
834          return this.dose;
835        }
836        else if (name.equals("rateRatio")) {
837          this.rate = new Ratio();
838          return this.rate;
839        }
840        else if (name.equals("rateQuantity")) {
841          this.rate = new Quantity();
842          return this.rate;
843        }
844        else
845          return super.addChild(name);
846      }
847
848      public MedicationAdministrationDosageComponent copy() {
849        MedicationAdministrationDosageComponent dst = new MedicationAdministrationDosageComponent();
850        copyValues(dst);
851        return dst;
852      }
853
854      public void copyValues(MedicationAdministrationDosageComponent dst) {
855        super.copyValues(dst);
856        dst.text = text == null ? null : text.copy();
857        dst.site = site == null ? null : site.copy();
858        dst.route = route == null ? null : route.copy();
859        dst.method = method == null ? null : method.copy();
860        dst.dose = dose == null ? null : dose.copy();
861        dst.rate = rate == null ? null : rate.copy();
862      }
863
864      @Override
865      public boolean equalsDeep(Base other_) {
866        if (!super.equalsDeep(other_))
867          return false;
868        if (!(other_ instanceof MedicationAdministrationDosageComponent))
869          return false;
870        MedicationAdministrationDosageComponent o = (MedicationAdministrationDosageComponent) other_;
871        return compareDeep(text, o.text, true) && compareDeep(site, o.site, true) && compareDeep(route, o.route, true)
872           && compareDeep(method, o.method, true) && compareDeep(dose, o.dose, true) && compareDeep(rate, o.rate, true)
873          ;
874      }
875
876      @Override
877      public boolean equalsShallow(Base other_) {
878        if (!super.equalsShallow(other_))
879          return false;
880        if (!(other_ instanceof MedicationAdministrationDosageComponent))
881          return false;
882        MedicationAdministrationDosageComponent o = (MedicationAdministrationDosageComponent) other_;
883        return compareValues(text, o.text, true);
884      }
885
886      public boolean isEmpty() {
887        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(text, site, route, method
888          , dose, rate);
889      }
890
891  public String fhirType() {
892    return "MedicationAdministration.dosage";
893
894  }
895
896  }
897
898    /**
899     * Identifiers associated with this Medication Administration that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.
900     */
901    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
902    @Description(shortDefinition="External identifier", formalDefinition="Identifiers associated with this Medication Administration that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server." )
903    protected List<Identifier> identifier;
904
905    /**
906     * A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event.
907     */
908    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
909    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event." )
910    protected List<CanonicalType> instantiatesCanonical;
911
912    /**
913     * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration.
914     */
915    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
916    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration." )
917    protected List<UriType> instantiatesUri;
918
919    /**
920     * A plan that is fulfilled in whole or in part by this MedicationAdministration.
921     */
922    @Child(name = "basedOn", type = {CarePlan.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
923    @Description(shortDefinition="Plan this is fulfilled by this administration", formalDefinition="A plan that is fulfilled in whole or in part by this MedicationAdministration." )
924    protected List<Reference> basedOn;
925
926    /**
927     * A larger event of which this particular event is a component or step.
928     */
929    @Child(name = "partOf", type = {MedicationAdministration.class, Procedure.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
930    @Description(shortDefinition="Part of referenced event", formalDefinition="A larger event of which this particular event is a component or step." )
931    protected List<Reference> partOf;
932
933    /**
934     * Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.
935     */
936    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
937    @Description(shortDefinition="in-progress | not-done | on-hold | completed | entered-in-error | stopped | unknown", formalDefinition="Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way." )
938    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-admin-status")
939    protected Enumeration<MedicationAdministrationStatusCodes> status;
940
941    /**
942     * A code indicating why the administration was not performed.
943     */
944    @Child(name = "statusReason", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
945    @Description(shortDefinition="Reason administration not performed", formalDefinition="A code indicating why the administration was not performed." )
946    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reason-medication-not-given-codes")
947    protected List<CodeableConcept> statusReason;
948
949    /**
950     * The type of medication administration (for example, drug classification like ATC, where meds would be administered, legal category of the medication).
951     */
952    @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
953    @Description(shortDefinition="Type of medication administration", formalDefinition="The type of medication administration (for example, drug classification like ATC, where meds would be administered, legal category of the medication)." )
954    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-admin-location")
955    protected List<CodeableConcept> category;
956
957    /**
958     * Identifies the medication that was 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.
959     */
960    @Child(name = "medication", type = {CodeableReference.class}, order=8, min=1, max=1, modifier=false, summary=true)
961    @Description(shortDefinition="What was administered", formalDefinition="Identifies the medication that was 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." )
962    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes")
963    protected CodeableReference medication;
964
965    /**
966     * The person or animal or group receiving the medication.
967     */
968    @Child(name = "subject", type = {Patient.class, Group.class}, order=9, min=1, max=1, modifier=false, summary=true)
969    @Description(shortDefinition="Who received medication", formalDefinition="The person or animal or group receiving the medication." )
970    protected Reference subject;
971
972    /**
973     * The visit, admission, or other contact between patient and health care provider during which the medication administration was performed.
974     */
975    @Child(name = "encounter", type = {Encounter.class}, order=10, min=0, max=1, modifier=false, summary=false)
976    @Description(shortDefinition="Encounter administered as part of", formalDefinition="The visit, admission, or other contact between patient and health care provider during which the medication administration was performed." )
977    protected Reference encounter;
978
979    /**
980     * Additional information (for example, patient height and weight) that supports the administration of the medication.  This attribute can be used to provide documentation of specific characteristics of the patient present at the time of administration.  For example, if the dose says "give "x" if the heartrate exceeds "y"", then the heart rate can be included using this attribute.
981     */
982    @Child(name = "supportingInformation", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
983    @Description(shortDefinition="Additional information to support administration", formalDefinition="Additional information (for example, patient height and weight) that supports the administration of the medication.  This attribute can be used to provide documentation of specific characteristics of the patient present at the time of administration.  For example, if the dose says \"give \"x\" if the heartrate exceeds \"y\"\", then the heart rate can be included using this attribute." )
984    protected List<Reference> supportingInformation;
985
986    /**
987     * A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.
988     */
989    @Child(name = "occurence", type = {DateTimeType.class, Period.class}, order=12, min=1, max=1, modifier=false, summary=true)
990    @Description(shortDefinition="Start and end time of administration", formalDefinition="A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate." )
991    protected DataType occurence;
992
993    /**
994     * The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.
995     */
996    @Child(name = "recorded", type = {DateTimeType.class}, order=13, min=0, max=1, modifier=false, summary=true)
997    @Description(shortDefinition="When the MedicationAdministration was first captured in the subject's record", formalDefinition="The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event." )
998    protected DateTimeType recorded;
999
1000    /**
1001     * Indicates who or what performed the medication administration and how they were involved.
1002     */
1003    @Child(name = "performer", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1004    @Description(shortDefinition="Who performed the medication administration and what they did", formalDefinition="Indicates who or what performed the medication administration and how they were involved." )
1005    protected List<MedicationAdministrationPerformerComponent> performer;
1006
1007    /**
1008     * A code, Condition or observation that supports why the medication was administered.
1009     */
1010    @Child(name = "reason", type = {CodeableReference.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1011    @Description(shortDefinition="Concept, condition or observation that supports why the medication was administered", formalDefinition="A code, Condition or observation that supports why the medication was administered." )
1012    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reason-medication-given-codes")
1013    protected List<CodeableReference> reason;
1014
1015    /**
1016     * The original request, instruction or authority to perform the administration.
1017     */
1018    @Child(name = "request", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
1019    @Description(shortDefinition="Request administration performed against", formalDefinition="The original request, instruction or authority to perform the administration." )
1020    protected Reference request;
1021
1022    /**
1023     * The device used in administering the medication to the patient.  For example, a particular infusion pump.
1024     */
1025    @Child(name = "device", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1026    @Description(shortDefinition="Device used to administer", formalDefinition="The device used in administering the medication to the patient.  For example, a particular infusion pump." )
1027    protected List<Reference> device;
1028
1029    /**
1030     * Extra information about the medication administration that is not conveyed by the other attributes.
1031     */
1032    @Child(name = "note", type = {Annotation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1033    @Description(shortDefinition="Information about the administration", formalDefinition="Extra information about the medication administration that is not conveyed by the other attributes." )
1034    protected List<Annotation> note;
1035
1036    /**
1037     * Describes the medication dosage information details e.g. dose, rate, site, route, etc.
1038     */
1039    @Child(name = "dosage", type = {}, order=19, min=0, max=1, modifier=false, summary=false)
1040    @Description(shortDefinition="Details of how medication was taken", formalDefinition="Describes the medication dosage information details e.g. dose, rate, site, route, etc." )
1041    protected MedicationAdministrationDosageComponent dosage;
1042
1043    /**
1044     * A summary of the events of interest that have occurred, such as when the administration was verified.
1045     */
1046    @Child(name = "eventHistory", type = {Provenance.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1047    @Description(shortDefinition="A list of events of interest in the lifecycle", formalDefinition="A summary of the events of interest that have occurred, such as when the administration was verified." )
1048    protected List<Reference> eventHistory;
1049
1050    private static final long serialVersionUID = -1268367135L;
1051
1052  /**
1053   * Constructor
1054   */
1055    public MedicationAdministration() {
1056      super();
1057    }
1058
1059  /**
1060   * Constructor
1061   */
1062    public MedicationAdministration(MedicationAdministrationStatusCodes status, CodeableReference medication, Reference subject, DataType occurence) {
1063      super();
1064      this.setStatus(status);
1065      this.setMedication(medication);
1066      this.setSubject(subject);
1067      this.setOccurence(occurence);
1068    }
1069
1070    /**
1071     * @return {@link #identifier} (Identifiers associated with this Medication Administration that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.)
1072     */
1073    public List<Identifier> getIdentifier() { 
1074      if (this.identifier == null)
1075        this.identifier = new ArrayList<Identifier>();
1076      return this.identifier;
1077    }
1078
1079    /**
1080     * @return Returns a reference to <code>this</code> for easy method chaining
1081     */
1082    public MedicationAdministration setIdentifier(List<Identifier> theIdentifier) { 
1083      this.identifier = theIdentifier;
1084      return this;
1085    }
1086
1087    public boolean hasIdentifier() { 
1088      if (this.identifier == null)
1089        return false;
1090      for (Identifier item : this.identifier)
1091        if (!item.isEmpty())
1092          return true;
1093      return false;
1094    }
1095
1096    public Identifier addIdentifier() { //3
1097      Identifier t = new Identifier();
1098      if (this.identifier == null)
1099        this.identifier = new ArrayList<Identifier>();
1100      this.identifier.add(t);
1101      return t;
1102    }
1103
1104    public MedicationAdministration addIdentifier(Identifier t) { //3
1105      if (t == null)
1106        return this;
1107      if (this.identifier == null)
1108        this.identifier = new ArrayList<Identifier>();
1109      this.identifier.add(t);
1110      return this;
1111    }
1112
1113    /**
1114     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1115     */
1116    public Identifier getIdentifierFirstRep() { 
1117      if (getIdentifier().isEmpty()) {
1118        addIdentifier();
1119      }
1120      return getIdentifier().get(0);
1121    }
1122
1123    /**
1124     * @return {@link #instantiatesCanonical} (A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event.)
1125     */
1126    public List<CanonicalType> getInstantiatesCanonical() { 
1127      if (this.instantiatesCanonical == null)
1128        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1129      return this.instantiatesCanonical;
1130    }
1131
1132    /**
1133     * @return Returns a reference to <code>this</code> for easy method chaining
1134     */
1135    public MedicationAdministration setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
1136      this.instantiatesCanonical = theInstantiatesCanonical;
1137      return this;
1138    }
1139
1140    public boolean hasInstantiatesCanonical() { 
1141      if (this.instantiatesCanonical == null)
1142        return false;
1143      for (CanonicalType item : this.instantiatesCanonical)
1144        if (!item.isEmpty())
1145          return true;
1146      return false;
1147    }
1148
1149    /**
1150     * @return {@link #instantiatesCanonical} (A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event.)
1151     */
1152    public CanonicalType addInstantiatesCanonicalElement() {//2 
1153      CanonicalType t = new CanonicalType();
1154      if (this.instantiatesCanonical == null)
1155        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1156      this.instantiatesCanonical.add(t);
1157      return t;
1158    }
1159
1160    /**
1161     * @param value {@link #instantiatesCanonical} (A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event.)
1162     */
1163    public MedicationAdministration addInstantiatesCanonical(String value) { //1
1164      CanonicalType t = new CanonicalType();
1165      t.setValue(value);
1166      if (this.instantiatesCanonical == null)
1167        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1168      this.instantiatesCanonical.add(t);
1169      return this;
1170    }
1171
1172    /**
1173     * @param value {@link #instantiatesCanonical} (A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event.)
1174     */
1175    public boolean hasInstantiatesCanonical(String value) { 
1176      if (this.instantiatesCanonical == null)
1177        return false;
1178      for (CanonicalType v : this.instantiatesCanonical)
1179        if (v.getValue().equals(value)) // canonical
1180          return true;
1181      return false;
1182    }
1183
1184    /**
1185     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration.)
1186     */
1187    public List<UriType> getInstantiatesUri() { 
1188      if (this.instantiatesUri == null)
1189        this.instantiatesUri = new ArrayList<UriType>();
1190      return this.instantiatesUri;
1191    }
1192
1193    /**
1194     * @return Returns a reference to <code>this</code> for easy method chaining
1195     */
1196    public MedicationAdministration setInstantiatesUri(List<UriType> theInstantiatesUri) { 
1197      this.instantiatesUri = theInstantiatesUri;
1198      return this;
1199    }
1200
1201    public boolean hasInstantiatesUri() { 
1202      if (this.instantiatesUri == null)
1203        return false;
1204      for (UriType item : this.instantiatesUri)
1205        if (!item.isEmpty())
1206          return true;
1207      return false;
1208    }
1209
1210    /**
1211     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration.)
1212     */
1213    public UriType addInstantiatesUriElement() {//2 
1214      UriType t = new UriType();
1215      if (this.instantiatesUri == null)
1216        this.instantiatesUri = new ArrayList<UriType>();
1217      this.instantiatesUri.add(t);
1218      return t;
1219    }
1220
1221    /**
1222     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration.)
1223     */
1224    public MedicationAdministration addInstantiatesUri(String value) { //1
1225      UriType t = new UriType();
1226      t.setValue(value);
1227      if (this.instantiatesUri == null)
1228        this.instantiatesUri = new ArrayList<UriType>();
1229      this.instantiatesUri.add(t);
1230      return this;
1231    }
1232
1233    /**
1234     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration.)
1235     */
1236    public boolean hasInstantiatesUri(String value) { 
1237      if (this.instantiatesUri == null)
1238        return false;
1239      for (UriType v : this.instantiatesUri)
1240        if (v.getValue().equals(value)) // uri
1241          return true;
1242      return false;
1243    }
1244
1245    /**
1246     * @return {@link #basedOn} (A plan that is fulfilled in whole or in part by this MedicationAdministration.)
1247     */
1248    public List<Reference> getBasedOn() { 
1249      if (this.basedOn == null)
1250        this.basedOn = new ArrayList<Reference>();
1251      return this.basedOn;
1252    }
1253
1254    /**
1255     * @return Returns a reference to <code>this</code> for easy method chaining
1256     */
1257    public MedicationAdministration setBasedOn(List<Reference> theBasedOn) { 
1258      this.basedOn = theBasedOn;
1259      return this;
1260    }
1261
1262    public boolean hasBasedOn() { 
1263      if (this.basedOn == null)
1264        return false;
1265      for (Reference item : this.basedOn)
1266        if (!item.isEmpty())
1267          return true;
1268      return false;
1269    }
1270
1271    public Reference addBasedOn() { //3
1272      Reference t = new Reference();
1273      if (this.basedOn == null)
1274        this.basedOn = new ArrayList<Reference>();
1275      this.basedOn.add(t);
1276      return t;
1277    }
1278
1279    public MedicationAdministration addBasedOn(Reference t) { //3
1280      if (t == null)
1281        return this;
1282      if (this.basedOn == null)
1283        this.basedOn = new ArrayList<Reference>();
1284      this.basedOn.add(t);
1285      return this;
1286    }
1287
1288    /**
1289     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
1290     */
1291    public Reference getBasedOnFirstRep() { 
1292      if (getBasedOn().isEmpty()) {
1293        addBasedOn();
1294      }
1295      return getBasedOn().get(0);
1296    }
1297
1298    /**
1299     * @return {@link #partOf} (A larger event of which this particular event is a component or step.)
1300     */
1301    public List<Reference> getPartOf() { 
1302      if (this.partOf == null)
1303        this.partOf = new ArrayList<Reference>();
1304      return this.partOf;
1305    }
1306
1307    /**
1308     * @return Returns a reference to <code>this</code> for easy method chaining
1309     */
1310    public MedicationAdministration setPartOf(List<Reference> thePartOf) { 
1311      this.partOf = thePartOf;
1312      return this;
1313    }
1314
1315    public boolean hasPartOf() { 
1316      if (this.partOf == null)
1317        return false;
1318      for (Reference item : this.partOf)
1319        if (!item.isEmpty())
1320          return true;
1321      return false;
1322    }
1323
1324    public Reference addPartOf() { //3
1325      Reference t = new Reference();
1326      if (this.partOf == null)
1327        this.partOf = new ArrayList<Reference>();
1328      this.partOf.add(t);
1329      return t;
1330    }
1331
1332    public MedicationAdministration addPartOf(Reference t) { //3
1333      if (t == null)
1334        return this;
1335      if (this.partOf == null)
1336        this.partOf = new ArrayList<Reference>();
1337      this.partOf.add(t);
1338      return this;
1339    }
1340
1341    /**
1342     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist {3}
1343     */
1344    public Reference getPartOfFirstRep() { 
1345      if (getPartOf().isEmpty()) {
1346        addPartOf();
1347      }
1348      return getPartOf().get(0);
1349    }
1350
1351    /**
1352     * @return {@link #status} (Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1353     */
1354    public Enumeration<MedicationAdministrationStatusCodes> getStatusElement() { 
1355      if (this.status == null)
1356        if (Configuration.errorOnAutoCreate())
1357          throw new Error("Attempt to auto-create MedicationAdministration.status");
1358        else if (Configuration.doAutoCreate())
1359          this.status = new Enumeration<MedicationAdministrationStatusCodes>(new MedicationAdministrationStatusCodesEnumFactory()); // bb
1360      return this.status;
1361    }
1362
1363    public boolean hasStatusElement() { 
1364      return this.status != null && !this.status.isEmpty();
1365    }
1366
1367    public boolean hasStatus() { 
1368      return this.status != null && !this.status.isEmpty();
1369    }
1370
1371    /**
1372     * @param value {@link #status} (Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1373     */
1374    public MedicationAdministration setStatusElement(Enumeration<MedicationAdministrationStatusCodes> value) { 
1375      this.status = value;
1376      return this;
1377    }
1378
1379    /**
1380     * @return Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.
1381     */
1382    public MedicationAdministrationStatusCodes getStatus() { 
1383      return this.status == null ? null : this.status.getValue();
1384    }
1385
1386    /**
1387     * @param value Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.
1388     */
1389    public MedicationAdministration setStatus(MedicationAdministrationStatusCodes value) { 
1390        if (this.status == null)
1391          this.status = new Enumeration<MedicationAdministrationStatusCodes>(new MedicationAdministrationStatusCodesEnumFactory());
1392        this.status.setValue(value);
1393      return this;
1394    }
1395
1396    /**
1397     * @return {@link #statusReason} (A code indicating why the administration was not performed.)
1398     */
1399    public List<CodeableConcept> getStatusReason() { 
1400      if (this.statusReason == null)
1401        this.statusReason = new ArrayList<CodeableConcept>();
1402      return this.statusReason;
1403    }
1404
1405    /**
1406     * @return Returns a reference to <code>this</code> for easy method chaining
1407     */
1408    public MedicationAdministration setStatusReason(List<CodeableConcept> theStatusReason) { 
1409      this.statusReason = theStatusReason;
1410      return this;
1411    }
1412
1413    public boolean hasStatusReason() { 
1414      if (this.statusReason == null)
1415        return false;
1416      for (CodeableConcept item : this.statusReason)
1417        if (!item.isEmpty())
1418          return true;
1419      return false;
1420    }
1421
1422    public CodeableConcept addStatusReason() { //3
1423      CodeableConcept t = new CodeableConcept();
1424      if (this.statusReason == null)
1425        this.statusReason = new ArrayList<CodeableConcept>();
1426      this.statusReason.add(t);
1427      return t;
1428    }
1429
1430    public MedicationAdministration addStatusReason(CodeableConcept t) { //3
1431      if (t == null)
1432        return this;
1433      if (this.statusReason == null)
1434        this.statusReason = new ArrayList<CodeableConcept>();
1435      this.statusReason.add(t);
1436      return this;
1437    }
1438
1439    /**
1440     * @return The first repetition of repeating field {@link #statusReason}, creating it if it does not already exist {3}
1441     */
1442    public CodeableConcept getStatusReasonFirstRep() { 
1443      if (getStatusReason().isEmpty()) {
1444        addStatusReason();
1445      }
1446      return getStatusReason().get(0);
1447    }
1448
1449    /**
1450     * @return {@link #category} (The type of medication administration (for example, drug classification like ATC, where meds would be administered, legal category of the medication).)
1451     */
1452    public List<CodeableConcept> getCategory() { 
1453      if (this.category == null)
1454        this.category = new ArrayList<CodeableConcept>();
1455      return this.category;
1456    }
1457
1458    /**
1459     * @return Returns a reference to <code>this</code> for easy method chaining
1460     */
1461    public MedicationAdministration setCategory(List<CodeableConcept> theCategory) { 
1462      this.category = theCategory;
1463      return this;
1464    }
1465
1466    public boolean hasCategory() { 
1467      if (this.category == null)
1468        return false;
1469      for (CodeableConcept item : this.category)
1470        if (!item.isEmpty())
1471          return true;
1472      return false;
1473    }
1474
1475    public CodeableConcept addCategory() { //3
1476      CodeableConcept t = new CodeableConcept();
1477      if (this.category == null)
1478        this.category = new ArrayList<CodeableConcept>();
1479      this.category.add(t);
1480      return t;
1481    }
1482
1483    public MedicationAdministration addCategory(CodeableConcept t) { //3
1484      if (t == null)
1485        return this;
1486      if (this.category == null)
1487        this.category = new ArrayList<CodeableConcept>();
1488      this.category.add(t);
1489      return this;
1490    }
1491
1492    /**
1493     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
1494     */
1495    public CodeableConcept getCategoryFirstRep() { 
1496      if (getCategory().isEmpty()) {
1497        addCategory();
1498      }
1499      return getCategory().get(0);
1500    }
1501
1502    /**
1503     * @return {@link #medication} (Identifies the medication that was 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.)
1504     */
1505    public CodeableReference getMedication() { 
1506      if (this.medication == null)
1507        if (Configuration.errorOnAutoCreate())
1508          throw new Error("Attempt to auto-create MedicationAdministration.medication");
1509        else if (Configuration.doAutoCreate())
1510          this.medication = new CodeableReference(); // cc
1511      return this.medication;
1512    }
1513
1514    public boolean hasMedication() { 
1515      return this.medication != null && !this.medication.isEmpty();
1516    }
1517
1518    /**
1519     * @param value {@link #medication} (Identifies the medication that was 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.)
1520     */
1521    public MedicationAdministration setMedication(CodeableReference value) { 
1522      this.medication = value;
1523      return this;
1524    }
1525
1526    /**
1527     * @return {@link #subject} (The person or animal or group receiving the medication.)
1528     */
1529    public Reference getSubject() { 
1530      if (this.subject == null)
1531        if (Configuration.errorOnAutoCreate())
1532          throw new Error("Attempt to auto-create MedicationAdministration.subject");
1533        else if (Configuration.doAutoCreate())
1534          this.subject = new Reference(); // cc
1535      return this.subject;
1536    }
1537
1538    public boolean hasSubject() { 
1539      return this.subject != null && !this.subject.isEmpty();
1540    }
1541
1542    /**
1543     * @param value {@link #subject} (The person or animal or group receiving the medication.)
1544     */
1545    public MedicationAdministration setSubject(Reference value) { 
1546      this.subject = value;
1547      return this;
1548    }
1549
1550    /**
1551     * @return {@link #encounter} (The visit, admission, or other contact between patient and health care provider during which the medication administration was performed.)
1552     */
1553    public Reference getEncounter() { 
1554      if (this.encounter == null)
1555        if (Configuration.errorOnAutoCreate())
1556          throw new Error("Attempt to auto-create MedicationAdministration.encounter");
1557        else if (Configuration.doAutoCreate())
1558          this.encounter = new Reference(); // cc
1559      return this.encounter;
1560    }
1561
1562    public boolean hasEncounter() { 
1563      return this.encounter != null && !this.encounter.isEmpty();
1564    }
1565
1566    /**
1567     * @param value {@link #encounter} (The visit, admission, or other contact between patient and health care provider during which the medication administration was performed.)
1568     */
1569    public MedicationAdministration setEncounter(Reference value) { 
1570      this.encounter = value;
1571      return this;
1572    }
1573
1574    /**
1575     * @return {@link #supportingInformation} (Additional information (for example, patient height and weight) that supports the administration of the medication.  This attribute can be used to provide documentation of specific characteristics of the patient present at the time of administration.  For example, if the dose says "give "x" if the heartrate exceeds "y"", then the heart rate can be included using this attribute.)
1576     */
1577    public List<Reference> getSupportingInformation() { 
1578      if (this.supportingInformation == null)
1579        this.supportingInformation = new ArrayList<Reference>();
1580      return this.supportingInformation;
1581    }
1582
1583    /**
1584     * @return Returns a reference to <code>this</code> for easy method chaining
1585     */
1586    public MedicationAdministration setSupportingInformation(List<Reference> theSupportingInformation) { 
1587      this.supportingInformation = theSupportingInformation;
1588      return this;
1589    }
1590
1591    public boolean hasSupportingInformation() { 
1592      if (this.supportingInformation == null)
1593        return false;
1594      for (Reference item : this.supportingInformation)
1595        if (!item.isEmpty())
1596          return true;
1597      return false;
1598    }
1599
1600    public Reference addSupportingInformation() { //3
1601      Reference t = new Reference();
1602      if (this.supportingInformation == null)
1603        this.supportingInformation = new ArrayList<Reference>();
1604      this.supportingInformation.add(t);
1605      return t;
1606    }
1607
1608    public MedicationAdministration addSupportingInformation(Reference t) { //3
1609      if (t == null)
1610        return this;
1611      if (this.supportingInformation == null)
1612        this.supportingInformation = new ArrayList<Reference>();
1613      this.supportingInformation.add(t);
1614      return this;
1615    }
1616
1617    /**
1618     * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist {3}
1619     */
1620    public Reference getSupportingInformationFirstRep() { 
1621      if (getSupportingInformation().isEmpty()) {
1622        addSupportingInformation();
1623      }
1624      return getSupportingInformation().get(0);
1625    }
1626
1627    /**
1628     * @return {@link #occurence} (A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.)
1629     */
1630    public DataType getOccurence() { 
1631      return this.occurence;
1632    }
1633
1634    /**
1635     * @return {@link #occurence} (A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.)
1636     */
1637    public DateTimeType getOccurenceDateTimeType() throws FHIRException { 
1638      if (this.occurence == null)
1639        this.occurence = new DateTimeType();
1640      if (!(this.occurence instanceof DateTimeType))
1641        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurence.getClass().getName()+" was encountered");
1642      return (DateTimeType) this.occurence;
1643    }
1644
1645    public boolean hasOccurenceDateTimeType() { 
1646      return this != null && this.occurence instanceof DateTimeType;
1647    }
1648
1649    /**
1650     * @return {@link #occurence} (A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.)
1651     */
1652    public Period getOccurencePeriod() throws FHIRException { 
1653      if (this.occurence == null)
1654        this.occurence = new Period();
1655      if (!(this.occurence instanceof Period))
1656        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurence.getClass().getName()+" was encountered");
1657      return (Period) this.occurence;
1658    }
1659
1660    public boolean hasOccurencePeriod() { 
1661      return this != null && this.occurence instanceof Period;
1662    }
1663
1664    public boolean hasOccurence() { 
1665      return this.occurence != null && !this.occurence.isEmpty();
1666    }
1667
1668    /**
1669     * @param value {@link #occurence} (A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.)
1670     */
1671    public MedicationAdministration setOccurence(DataType value) { 
1672      if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1673        throw new Error("Not the right type for MedicationAdministration.occurence[x]: "+value.fhirType());
1674      this.occurence = value;
1675      return this;
1676    }
1677
1678    /**
1679     * @return {@link #recorded} (The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
1680     */
1681    public DateTimeType getRecordedElement() { 
1682      if (this.recorded == null)
1683        if (Configuration.errorOnAutoCreate())
1684          throw new Error("Attempt to auto-create MedicationAdministration.recorded");
1685        else if (Configuration.doAutoCreate())
1686          this.recorded = new DateTimeType(); // bb
1687      return this.recorded;
1688    }
1689
1690    public boolean hasRecordedElement() { 
1691      return this.recorded != null && !this.recorded.isEmpty();
1692    }
1693
1694    public boolean hasRecorded() { 
1695      return this.recorded != null && !this.recorded.isEmpty();
1696    }
1697
1698    /**
1699     * @param value {@link #recorded} (The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
1700     */
1701    public MedicationAdministration setRecordedElement(DateTimeType value) { 
1702      this.recorded = value;
1703      return this;
1704    }
1705
1706    /**
1707     * @return The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.
1708     */
1709    public Date getRecorded() { 
1710      return this.recorded == null ? null : this.recorded.getValue();
1711    }
1712
1713    /**
1714     * @param value The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.
1715     */
1716    public MedicationAdministration setRecorded(Date value) { 
1717      if (value == null)
1718        this.recorded = null;
1719      else {
1720        if (this.recorded == null)
1721          this.recorded = new DateTimeType();
1722        this.recorded.setValue(value);
1723      }
1724      return this;
1725    }
1726
1727    /**
1728     * @return {@link #performer} (Indicates who or what performed the medication administration and how they were involved.)
1729     */
1730    public List<MedicationAdministrationPerformerComponent> getPerformer() { 
1731      if (this.performer == null)
1732        this.performer = new ArrayList<MedicationAdministrationPerformerComponent>();
1733      return this.performer;
1734    }
1735
1736    /**
1737     * @return Returns a reference to <code>this</code> for easy method chaining
1738     */
1739    public MedicationAdministration setPerformer(List<MedicationAdministrationPerformerComponent> thePerformer) { 
1740      this.performer = thePerformer;
1741      return this;
1742    }
1743
1744    public boolean hasPerformer() { 
1745      if (this.performer == null)
1746        return false;
1747      for (MedicationAdministrationPerformerComponent item : this.performer)
1748        if (!item.isEmpty())
1749          return true;
1750      return false;
1751    }
1752
1753    public MedicationAdministrationPerformerComponent addPerformer() { //3
1754      MedicationAdministrationPerformerComponent t = new MedicationAdministrationPerformerComponent();
1755      if (this.performer == null)
1756        this.performer = new ArrayList<MedicationAdministrationPerformerComponent>();
1757      this.performer.add(t);
1758      return t;
1759    }
1760
1761    public MedicationAdministration addPerformer(MedicationAdministrationPerformerComponent t) { //3
1762      if (t == null)
1763        return this;
1764      if (this.performer == null)
1765        this.performer = new ArrayList<MedicationAdministrationPerformerComponent>();
1766      this.performer.add(t);
1767      return this;
1768    }
1769
1770    /**
1771     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist {3}
1772     */
1773    public MedicationAdministrationPerformerComponent getPerformerFirstRep() { 
1774      if (getPerformer().isEmpty()) {
1775        addPerformer();
1776      }
1777      return getPerformer().get(0);
1778    }
1779
1780    /**
1781     * @return {@link #reason} (A code, Condition or observation that supports why the medication was administered.)
1782     */
1783    public List<CodeableReference> getReason() { 
1784      if (this.reason == null)
1785        this.reason = new ArrayList<CodeableReference>();
1786      return this.reason;
1787    }
1788
1789    /**
1790     * @return Returns a reference to <code>this</code> for easy method chaining
1791     */
1792    public MedicationAdministration setReason(List<CodeableReference> theReason) { 
1793      this.reason = theReason;
1794      return this;
1795    }
1796
1797    public boolean hasReason() { 
1798      if (this.reason == null)
1799        return false;
1800      for (CodeableReference item : this.reason)
1801        if (!item.isEmpty())
1802          return true;
1803      return false;
1804    }
1805
1806    public CodeableReference addReason() { //3
1807      CodeableReference t = new CodeableReference();
1808      if (this.reason == null)
1809        this.reason = new ArrayList<CodeableReference>();
1810      this.reason.add(t);
1811      return t;
1812    }
1813
1814    public MedicationAdministration addReason(CodeableReference t) { //3
1815      if (t == null)
1816        return this;
1817      if (this.reason == null)
1818        this.reason = new ArrayList<CodeableReference>();
1819      this.reason.add(t);
1820      return this;
1821    }
1822
1823    /**
1824     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
1825     */
1826    public CodeableReference getReasonFirstRep() { 
1827      if (getReason().isEmpty()) {
1828        addReason();
1829      }
1830      return getReason().get(0);
1831    }
1832
1833    /**
1834     * @return {@link #request} (The original request, instruction or authority to perform the administration.)
1835     */
1836    public Reference getRequest() { 
1837      if (this.request == null)
1838        if (Configuration.errorOnAutoCreate())
1839          throw new Error("Attempt to auto-create MedicationAdministration.request");
1840        else if (Configuration.doAutoCreate())
1841          this.request = new Reference(); // cc
1842      return this.request;
1843    }
1844
1845    public boolean hasRequest() { 
1846      return this.request != null && !this.request.isEmpty();
1847    }
1848
1849    /**
1850     * @param value {@link #request} (The original request, instruction or authority to perform the administration.)
1851     */
1852    public MedicationAdministration setRequest(Reference value) { 
1853      this.request = value;
1854      return this;
1855    }
1856
1857    /**
1858     * @return {@link #device} (The device used in administering the medication to the patient.  For example, a particular infusion pump.)
1859     */
1860    public List<Reference> getDevice() { 
1861      if (this.device == null)
1862        this.device = new ArrayList<Reference>();
1863      return this.device;
1864    }
1865
1866    /**
1867     * @return Returns a reference to <code>this</code> for easy method chaining
1868     */
1869    public MedicationAdministration setDevice(List<Reference> theDevice) { 
1870      this.device = theDevice;
1871      return this;
1872    }
1873
1874    public boolean hasDevice() { 
1875      if (this.device == null)
1876        return false;
1877      for (Reference item : this.device)
1878        if (!item.isEmpty())
1879          return true;
1880      return false;
1881    }
1882
1883    public Reference addDevice() { //3
1884      Reference t = new Reference();
1885      if (this.device == null)
1886        this.device = new ArrayList<Reference>();
1887      this.device.add(t);
1888      return t;
1889    }
1890
1891    public MedicationAdministration addDevice(Reference t) { //3
1892      if (t == null)
1893        return this;
1894      if (this.device == null)
1895        this.device = new ArrayList<Reference>();
1896      this.device.add(t);
1897      return this;
1898    }
1899
1900    /**
1901     * @return The first repetition of repeating field {@link #device}, creating it if it does not already exist {3}
1902     */
1903    public Reference getDeviceFirstRep() { 
1904      if (getDevice().isEmpty()) {
1905        addDevice();
1906      }
1907      return getDevice().get(0);
1908    }
1909
1910    /**
1911     * @return {@link #note} (Extra information about the medication administration that is not conveyed by the other attributes.)
1912     */
1913    public List<Annotation> getNote() { 
1914      if (this.note == null)
1915        this.note = new ArrayList<Annotation>();
1916      return this.note;
1917    }
1918
1919    /**
1920     * @return Returns a reference to <code>this</code> for easy method chaining
1921     */
1922    public MedicationAdministration setNote(List<Annotation> theNote) { 
1923      this.note = theNote;
1924      return this;
1925    }
1926
1927    public boolean hasNote() { 
1928      if (this.note == null)
1929        return false;
1930      for (Annotation item : this.note)
1931        if (!item.isEmpty())
1932          return true;
1933      return false;
1934    }
1935
1936    public Annotation addNote() { //3
1937      Annotation t = new Annotation();
1938      if (this.note == null)
1939        this.note = new ArrayList<Annotation>();
1940      this.note.add(t);
1941      return t;
1942    }
1943
1944    public MedicationAdministration addNote(Annotation t) { //3
1945      if (t == null)
1946        return this;
1947      if (this.note == null)
1948        this.note = new ArrayList<Annotation>();
1949      this.note.add(t);
1950      return this;
1951    }
1952
1953    /**
1954     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1955     */
1956    public Annotation getNoteFirstRep() { 
1957      if (getNote().isEmpty()) {
1958        addNote();
1959      }
1960      return getNote().get(0);
1961    }
1962
1963    /**
1964     * @return {@link #dosage} (Describes the medication dosage information details e.g. dose, rate, site, route, etc.)
1965     */
1966    public MedicationAdministrationDosageComponent getDosage() { 
1967      if (this.dosage == null)
1968        if (Configuration.errorOnAutoCreate())
1969          throw new Error("Attempt to auto-create MedicationAdministration.dosage");
1970        else if (Configuration.doAutoCreate())
1971          this.dosage = new MedicationAdministrationDosageComponent(); // cc
1972      return this.dosage;
1973    }
1974
1975    public boolean hasDosage() { 
1976      return this.dosage != null && !this.dosage.isEmpty();
1977    }
1978
1979    /**
1980     * @param value {@link #dosage} (Describes the medication dosage information details e.g. dose, rate, site, route, etc.)
1981     */
1982    public MedicationAdministration setDosage(MedicationAdministrationDosageComponent value) { 
1983      this.dosage = value;
1984      return this;
1985    }
1986
1987    /**
1988     * @return {@link #eventHistory} (A summary of the events of interest that have occurred, such as when the administration was verified.)
1989     */
1990    public List<Reference> getEventHistory() { 
1991      if (this.eventHistory == null)
1992        this.eventHistory = new ArrayList<Reference>();
1993      return this.eventHistory;
1994    }
1995
1996    /**
1997     * @return Returns a reference to <code>this</code> for easy method chaining
1998     */
1999    public MedicationAdministration setEventHistory(List<Reference> theEventHistory) { 
2000      this.eventHistory = theEventHistory;
2001      return this;
2002    }
2003
2004    public boolean hasEventHistory() { 
2005      if (this.eventHistory == null)
2006        return false;
2007      for (Reference item : this.eventHistory)
2008        if (!item.isEmpty())
2009          return true;
2010      return false;
2011    }
2012
2013    public Reference addEventHistory() { //3
2014      Reference t = new Reference();
2015      if (this.eventHistory == null)
2016        this.eventHistory = new ArrayList<Reference>();
2017      this.eventHistory.add(t);
2018      return t;
2019    }
2020
2021    public MedicationAdministration addEventHistory(Reference t) { //3
2022      if (t == null)
2023        return this;
2024      if (this.eventHistory == null)
2025        this.eventHistory = new ArrayList<Reference>();
2026      this.eventHistory.add(t);
2027      return this;
2028    }
2029
2030    /**
2031     * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist {3}
2032     */
2033    public Reference getEventHistoryFirstRep() { 
2034      if (getEventHistory().isEmpty()) {
2035        addEventHistory();
2036      }
2037      return getEventHistory().get(0);
2038    }
2039
2040      protected void listChildren(List<Property> children) {
2041        super.listChildren(children);
2042        children.add(new Property("identifier", "Identifier", "Identifiers associated with this Medication Administration that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
2043        children.add(new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition)", "A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2044        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2045        children.add(new Property("basedOn", "Reference(CarePlan)", "A plan that is fulfilled in whole or in part by this MedicationAdministration.", 0, java.lang.Integer.MAX_VALUE, basedOn));
2046        children.add(new Property("partOf", "Reference(MedicationAdministration|Procedure)", "A larger event of which this particular event is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf));
2047        children.add(new Property("status", "code", "Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.", 0, 1, status));
2048        children.add(new Property("statusReason", "CodeableConcept", "A code indicating why the administration was not performed.", 0, java.lang.Integer.MAX_VALUE, statusReason));
2049        children.add(new Property("category", "CodeableConcept", "The type of medication administration (for example, drug classification like ATC, where meds would be administered, legal category of the medication).", 0, java.lang.Integer.MAX_VALUE, category));
2050        children.add(new Property("medication", "CodeableReference(Medication)", "Identifies the medication that was 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));
2051        children.add(new Property("subject", "Reference(Patient|Group)", "The person or animal or group receiving the medication.", 0, 1, subject));
2052        children.add(new Property("encounter", "Reference(Encounter)", "The visit, admission, or other contact between patient and health care provider during which the medication administration was performed.", 0, 1, encounter));
2053        children.add(new Property("supportingInformation", "Reference(Any)", "Additional information (for example, patient height and weight) that supports the administration of the medication.  This attribute can be used to provide documentation of specific characteristics of the patient present at the time of administration.  For example, if the dose says \"give \"x\" if the heartrate exceeds \"y\"\", then the heart rate can be included using this attribute.", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
2054        children.add(new Property("occurence[x]", "dateTime|Period", "A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.", 0, 1, occurence));
2055        children.add(new Property("recorded", "dateTime", "The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.", 0, 1, recorded));
2056        children.add(new Property("performer", "", "Indicates who or what performed the medication administration and how they were involved.", 0, java.lang.Integer.MAX_VALUE, performer));
2057        children.add(new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport)", "A code, Condition or observation that supports why the medication was administered.", 0, java.lang.Integer.MAX_VALUE, reason));
2058        children.add(new Property("request", "Reference(MedicationRequest)", "The original request, instruction or authority to perform the administration.", 0, 1, request));
2059        children.add(new Property("device", "Reference(Device)", "The device used in administering the medication to the patient.  For example, a particular infusion pump.", 0, java.lang.Integer.MAX_VALUE, device));
2060        children.add(new Property("note", "Annotation", "Extra information about the medication administration that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note));
2061        children.add(new Property("dosage", "", "Describes the medication dosage information details e.g. dose, rate, site, route, etc.", 0, 1, dosage));
2062        children.add(new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the administration was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory));
2063      }
2064
2065      @Override
2066      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2067        switch (_hash) {
2068        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers associated with this Medication Administration that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
2069        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition)", "A protocol, guideline, orderset, or other definition that was adhered to in whole or in part by this event.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2070        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationAdministration.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2071        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan)", "A plan that is fulfilled in whole or in part by this MedicationAdministration.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2072        case -995410646: /*partOf*/  return new Property("partOf", "Reference(MedicationAdministration|Procedure)", "A larger event of which this particular event is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf);
2073        case -892481550: /*status*/  return new Property("status", "code", "Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions, it is possible for an administration to be started but not completed or it may be paused while some other process is under way.", 0, 1, status);
2074        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "A code indicating why the administration was not performed.", 0, java.lang.Integer.MAX_VALUE, statusReason);
2075        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The type of medication administration (for example, drug classification like ATC, where meds would be administered, legal category of the medication).", 0, java.lang.Integer.MAX_VALUE, category);
2076        case 1998965455: /*medication*/  return new Property("medication", "CodeableReference(Medication)", "Identifies the medication that was 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);
2077        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The person or animal or group receiving the medication.", 0, 1, subject);
2078        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The visit, admission, or other contact between patient and health care provider during which the medication administration was performed.", 0, 1, encounter);
2079        case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "Reference(Any)", "Additional information (for example, patient height and weight) that supports the administration of the medication.  This attribute can be used to provide documentation of specific characteristics of the patient present at the time of administration.  For example, if the dose says \"give \"x\" if the heartrate exceeds \"y\"\", then the heart rate can be included using this attribute.", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
2080        case 144188521: /*occurence[x]*/  return new Property("occurence[x]", "dateTime|Period", "A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.", 0, 1, occurence);
2081        case -1192857417: /*occurence*/  return new Property("occurence[x]", "dateTime|Period", "A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.", 0, 1, occurence);
2082        case -820552334: /*occurenceDateTime*/  return new Property("occurence[x]", "dateTime", "A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.", 0, 1, occurence);
2083        case 221195608: /*occurencePeriod*/  return new Property("occurence[x]", "Period", "A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.", 0, 1, occurence);
2084        case -799233872: /*recorded*/  return new Property("recorded", "dateTime", "The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.", 0, 1, recorded);
2085        case 481140686: /*performer*/  return new Property("performer", "", "Indicates who or what performed the medication administration and how they were involved.", 0, java.lang.Integer.MAX_VALUE, performer);
2086        case -934964668: /*reason*/  return new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport)", "A code, Condition or observation that supports why the medication was administered.", 0, java.lang.Integer.MAX_VALUE, reason);
2087        case 1095692943: /*request*/  return new Property("request", "Reference(MedicationRequest)", "The original request, instruction or authority to perform the administration.", 0, 1, request);
2088        case -1335157162: /*device*/  return new Property("device", "Reference(Device)", "The device used in administering the medication to the patient.  For example, a particular infusion pump.", 0, java.lang.Integer.MAX_VALUE, device);
2089        case 3387378: /*note*/  return new Property("note", "Annotation", "Extra information about the medication administration that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note);
2090        case -1326018889: /*dosage*/  return new Property("dosage", "", "Describes the medication dosage information details e.g. dose, rate, site, route, etc.", 0, 1, dosage);
2091        case 1835190426: /*eventHistory*/  return new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the administration was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory);
2092        default: return super.getNamedProperty(_hash, _name, _checkValid);
2093        }
2094
2095      }
2096
2097      @Override
2098      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2099        switch (hash) {
2100        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2101        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2102        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2103        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2104        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2105        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationAdministrationStatusCodes>
2106        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : this.statusReason.toArray(new Base[this.statusReason.size()]); // CodeableConcept
2107        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2108        case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // CodeableReference
2109        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2110        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2111        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
2112        case -1192857417: /*occurence*/ return this.occurence == null ? new Base[0] : new Base[] {this.occurence}; // DataType
2113        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // DateTimeType
2114        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // MedicationAdministrationPerformerComponent
2115        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
2116        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
2117        case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // Reference
2118        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2119        case -1326018889: /*dosage*/ return this.dosage == null ? new Base[0] : new Base[] {this.dosage}; // MedicationAdministrationDosageComponent
2120        case 1835190426: /*eventHistory*/ return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference
2121        default: return super.getProperty(hash, name, checkValid);
2122        }
2123
2124      }
2125
2126      @Override
2127      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2128        switch (hash) {
2129        case -1618432855: // identifier
2130          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2131          return value;
2132        case 8911915: // instantiatesCanonical
2133          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2134          return value;
2135        case -1926393373: // instantiatesUri
2136          this.getInstantiatesUri().add(TypeConvertor.castToUri(value)); // UriType
2137          return value;
2138        case -332612366: // basedOn
2139          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
2140          return value;
2141        case -995410646: // partOf
2142          this.getPartOf().add(TypeConvertor.castToReference(value)); // Reference
2143          return value;
2144        case -892481550: // status
2145          value = new MedicationAdministrationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
2146          this.status = (Enumeration) value; // Enumeration<MedicationAdministrationStatusCodes>
2147          return value;
2148        case 2051346646: // statusReason
2149          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2150          return value;
2151        case 50511102: // category
2152          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2153          return value;
2154        case 1998965455: // medication
2155          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
2156          return value;
2157        case -1867885268: // subject
2158          this.subject = TypeConvertor.castToReference(value); // Reference
2159          return value;
2160        case 1524132147: // encounter
2161          this.encounter = TypeConvertor.castToReference(value); // Reference
2162          return value;
2163        case -1248768647: // supportingInformation
2164          this.getSupportingInformation().add(TypeConvertor.castToReference(value)); // Reference
2165          return value;
2166        case -1192857417: // occurence
2167          this.occurence = TypeConvertor.castToType(value); // DataType
2168          return value;
2169        case -799233872: // recorded
2170          this.recorded = TypeConvertor.castToDateTime(value); // DateTimeType
2171          return value;
2172        case 481140686: // performer
2173          this.getPerformer().add((MedicationAdministrationPerformerComponent) value); // MedicationAdministrationPerformerComponent
2174          return value;
2175        case -934964668: // reason
2176          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
2177          return value;
2178        case 1095692943: // request
2179          this.request = TypeConvertor.castToReference(value); // Reference
2180          return value;
2181        case -1335157162: // device
2182          this.getDevice().add(TypeConvertor.castToReference(value)); // Reference
2183          return value;
2184        case 3387378: // note
2185          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
2186          return value;
2187        case -1326018889: // dosage
2188          this.dosage = (MedicationAdministrationDosageComponent) value; // MedicationAdministrationDosageComponent
2189          return value;
2190        case 1835190426: // eventHistory
2191          this.getEventHistory().add(TypeConvertor.castToReference(value)); // Reference
2192          return value;
2193        default: return super.setProperty(hash, name, value);
2194        }
2195
2196      }
2197
2198      @Override
2199      public Base setProperty(String name, Base value) throws FHIRException {
2200        if (name.equals("identifier")) {
2201          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2202        } else if (name.equals("instantiatesCanonical")) {
2203          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value));
2204        } else if (name.equals("instantiatesUri")) {
2205          this.getInstantiatesUri().add(TypeConvertor.castToUri(value));
2206        } else if (name.equals("basedOn")) {
2207          this.getBasedOn().add(TypeConvertor.castToReference(value));
2208        } else if (name.equals("partOf")) {
2209          this.getPartOf().add(TypeConvertor.castToReference(value));
2210        } else if (name.equals("status")) {
2211          value = new MedicationAdministrationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
2212          this.status = (Enumeration) value; // Enumeration<MedicationAdministrationStatusCodes>
2213        } else if (name.equals("statusReason")) {
2214          this.getStatusReason().add(TypeConvertor.castToCodeableConcept(value));
2215        } else if (name.equals("category")) {
2216          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
2217        } else if (name.equals("medication")) {
2218          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
2219        } else if (name.equals("subject")) {
2220          this.subject = TypeConvertor.castToReference(value); // Reference
2221        } else if (name.equals("encounter")) {
2222          this.encounter = TypeConvertor.castToReference(value); // Reference
2223        } else if (name.equals("supportingInformation")) {
2224          this.getSupportingInformation().add(TypeConvertor.castToReference(value));
2225        } else if (name.equals("occurence[x]")) {
2226          this.occurence = TypeConvertor.castToType(value); // DataType
2227        } else if (name.equals("recorded")) {
2228          this.recorded = TypeConvertor.castToDateTime(value); // DateTimeType
2229        } else if (name.equals("performer")) {
2230          this.getPerformer().add((MedicationAdministrationPerformerComponent) value);
2231        } else if (name.equals("reason")) {
2232          this.getReason().add(TypeConvertor.castToCodeableReference(value));
2233        } else if (name.equals("request")) {
2234          this.request = TypeConvertor.castToReference(value); // Reference
2235        } else if (name.equals("device")) {
2236          this.getDevice().add(TypeConvertor.castToReference(value));
2237        } else if (name.equals("note")) {
2238          this.getNote().add(TypeConvertor.castToAnnotation(value));
2239        } else if (name.equals("dosage")) {
2240          this.dosage = (MedicationAdministrationDosageComponent) value; // MedicationAdministrationDosageComponent
2241        } else if (name.equals("eventHistory")) {
2242          this.getEventHistory().add(TypeConvertor.castToReference(value));
2243        } else
2244          return super.setProperty(name, value);
2245        return value;
2246      }
2247
2248      @Override
2249      public Base makeProperty(int hash, String name) throws FHIRException {
2250        switch (hash) {
2251        case -1618432855:  return addIdentifier(); 
2252        case 8911915:  return addInstantiatesCanonicalElement();
2253        case -1926393373:  return addInstantiatesUriElement();
2254        case -332612366:  return addBasedOn(); 
2255        case -995410646:  return addPartOf(); 
2256        case -892481550:  return getStatusElement();
2257        case 2051346646:  return addStatusReason(); 
2258        case 50511102:  return addCategory(); 
2259        case 1998965455:  return getMedication();
2260        case -1867885268:  return getSubject();
2261        case 1524132147:  return getEncounter();
2262        case -1248768647:  return addSupportingInformation(); 
2263        case 144188521:  return getOccurence();
2264        case -1192857417:  return getOccurence();
2265        case -799233872:  return getRecordedElement();
2266        case 481140686:  return addPerformer(); 
2267        case -934964668:  return addReason(); 
2268        case 1095692943:  return getRequest();
2269        case -1335157162:  return addDevice(); 
2270        case 3387378:  return addNote(); 
2271        case -1326018889:  return getDosage();
2272        case 1835190426:  return addEventHistory(); 
2273        default: return super.makeProperty(hash, name);
2274        }
2275
2276      }
2277
2278      @Override
2279      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2280        switch (hash) {
2281        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2282        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
2283        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
2284        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2285        case -995410646: /*partOf*/ return new String[] {"Reference"};
2286        case -892481550: /*status*/ return new String[] {"code"};
2287        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
2288        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2289        case 1998965455: /*medication*/ return new String[] {"CodeableReference"};
2290        case -1867885268: /*subject*/ return new String[] {"Reference"};
2291        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2292        case -1248768647: /*supportingInformation*/ return new String[] {"Reference"};
2293        case -1192857417: /*occurence*/ return new String[] {"dateTime", "Period"};
2294        case -799233872: /*recorded*/ return new String[] {"dateTime"};
2295        case 481140686: /*performer*/ return new String[] {};
2296        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
2297        case 1095692943: /*request*/ return new String[] {"Reference"};
2298        case -1335157162: /*device*/ return new String[] {"Reference"};
2299        case 3387378: /*note*/ return new String[] {"Annotation"};
2300        case -1326018889: /*dosage*/ return new String[] {};
2301        case 1835190426: /*eventHistory*/ return new String[] {"Reference"};
2302        default: return super.getTypesForProperty(hash, name);
2303        }
2304
2305      }
2306
2307      @Override
2308      public Base addChild(String name) throws FHIRException {
2309        if (name.equals("identifier")) {
2310          return addIdentifier();
2311        }
2312        else if (name.equals("instantiatesCanonical")) {
2313          throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.instantiatesCanonical");
2314        }
2315        else if (name.equals("instantiatesUri")) {
2316          throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.instantiatesUri");
2317        }
2318        else if (name.equals("basedOn")) {
2319          return addBasedOn();
2320        }
2321        else if (name.equals("partOf")) {
2322          return addPartOf();
2323        }
2324        else if (name.equals("status")) {
2325          throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.status");
2326        }
2327        else if (name.equals("statusReason")) {
2328          return addStatusReason();
2329        }
2330        else if (name.equals("category")) {
2331          return addCategory();
2332        }
2333        else if (name.equals("medication")) {
2334          this.medication = new CodeableReference();
2335          return this.medication;
2336        }
2337        else if (name.equals("subject")) {
2338          this.subject = new Reference();
2339          return this.subject;
2340        }
2341        else if (name.equals("encounter")) {
2342          this.encounter = new Reference();
2343          return this.encounter;
2344        }
2345        else if (name.equals("supportingInformation")) {
2346          return addSupportingInformation();
2347        }
2348        else if (name.equals("occurenceDateTime")) {
2349          this.occurence = new DateTimeType();
2350          return this.occurence;
2351        }
2352        else if (name.equals("occurencePeriod")) {
2353          this.occurence = new Period();
2354          return this.occurence;
2355        }
2356        else if (name.equals("recorded")) {
2357          throw new FHIRException("Cannot call addChild on a primitive type MedicationAdministration.recorded");
2358        }
2359        else if (name.equals("performer")) {
2360          return addPerformer();
2361        }
2362        else if (name.equals("reason")) {
2363          return addReason();
2364        }
2365        else if (name.equals("request")) {
2366          this.request = new Reference();
2367          return this.request;
2368        }
2369        else if (name.equals("device")) {
2370          return addDevice();
2371        }
2372        else if (name.equals("note")) {
2373          return addNote();
2374        }
2375        else if (name.equals("dosage")) {
2376          this.dosage = new MedicationAdministrationDosageComponent();
2377          return this.dosage;
2378        }
2379        else if (name.equals("eventHistory")) {
2380          return addEventHistory();
2381        }
2382        else
2383          return super.addChild(name);
2384      }
2385
2386  public String fhirType() {
2387    return "MedicationAdministration";
2388
2389  }
2390
2391      public MedicationAdministration copy() {
2392        MedicationAdministration dst = new MedicationAdministration();
2393        copyValues(dst);
2394        return dst;
2395      }
2396
2397      public void copyValues(MedicationAdministration dst) {
2398        super.copyValues(dst);
2399        if (identifier != null) {
2400          dst.identifier = new ArrayList<Identifier>();
2401          for (Identifier i : identifier)
2402            dst.identifier.add(i.copy());
2403        };
2404        if (instantiatesCanonical != null) {
2405          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2406          for (CanonicalType i : instantiatesCanonical)
2407            dst.instantiatesCanonical.add(i.copy());
2408        };
2409        if (instantiatesUri != null) {
2410          dst.instantiatesUri = new ArrayList<UriType>();
2411          for (UriType i : instantiatesUri)
2412            dst.instantiatesUri.add(i.copy());
2413        };
2414        if (basedOn != null) {
2415          dst.basedOn = new ArrayList<Reference>();
2416          for (Reference i : basedOn)
2417            dst.basedOn.add(i.copy());
2418        };
2419        if (partOf != null) {
2420          dst.partOf = new ArrayList<Reference>();
2421          for (Reference i : partOf)
2422            dst.partOf.add(i.copy());
2423        };
2424        dst.status = status == null ? null : status.copy();
2425        if (statusReason != null) {
2426          dst.statusReason = new ArrayList<CodeableConcept>();
2427          for (CodeableConcept i : statusReason)
2428            dst.statusReason.add(i.copy());
2429        };
2430        if (category != null) {
2431          dst.category = new ArrayList<CodeableConcept>();
2432          for (CodeableConcept i : category)
2433            dst.category.add(i.copy());
2434        };
2435        dst.medication = medication == null ? null : medication.copy();
2436        dst.subject = subject == null ? null : subject.copy();
2437        dst.encounter = encounter == null ? null : encounter.copy();
2438        if (supportingInformation != null) {
2439          dst.supportingInformation = new ArrayList<Reference>();
2440          for (Reference i : supportingInformation)
2441            dst.supportingInformation.add(i.copy());
2442        };
2443        dst.occurence = occurence == null ? null : occurence.copy();
2444        dst.recorded = recorded == null ? null : recorded.copy();
2445        if (performer != null) {
2446          dst.performer = new ArrayList<MedicationAdministrationPerformerComponent>();
2447          for (MedicationAdministrationPerformerComponent i : performer)
2448            dst.performer.add(i.copy());
2449        };
2450        if (reason != null) {
2451          dst.reason = new ArrayList<CodeableReference>();
2452          for (CodeableReference i : reason)
2453            dst.reason.add(i.copy());
2454        };
2455        dst.request = request == null ? null : request.copy();
2456        if (device != null) {
2457          dst.device = new ArrayList<Reference>();
2458          for (Reference i : device)
2459            dst.device.add(i.copy());
2460        };
2461        if (note != null) {
2462          dst.note = new ArrayList<Annotation>();
2463          for (Annotation i : note)
2464            dst.note.add(i.copy());
2465        };
2466        dst.dosage = dosage == null ? null : dosage.copy();
2467        if (eventHistory != null) {
2468          dst.eventHistory = new ArrayList<Reference>();
2469          for (Reference i : eventHistory)
2470            dst.eventHistory.add(i.copy());
2471        };
2472      }
2473
2474      protected MedicationAdministration typedCopy() {
2475        return copy();
2476      }
2477
2478      @Override
2479      public boolean equalsDeep(Base other_) {
2480        if (!super.equalsDeep(other_))
2481          return false;
2482        if (!(other_ instanceof MedicationAdministration))
2483          return false;
2484        MedicationAdministration o = (MedicationAdministration) other_;
2485        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
2486           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
2487           && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
2488           && compareDeep(category, o.category, true) && compareDeep(medication, o.medication, true) && compareDeep(subject, o.subject, true)
2489           && compareDeep(encounter, o.encounter, true) && compareDeep(supportingInformation, o.supportingInformation, true)
2490           && compareDeep(occurence, o.occurence, true) && compareDeep(recorded, o.recorded, true) && compareDeep(performer, o.performer, true)
2491           && compareDeep(reason, o.reason, true) && compareDeep(request, o.request, true) && compareDeep(device, o.device, true)
2492           && compareDeep(note, o.note, true) && compareDeep(dosage, o.dosage, true) && compareDeep(eventHistory, o.eventHistory, true)
2493          ;
2494      }
2495
2496      @Override
2497      public boolean equalsShallow(Base other_) {
2498        if (!super.equalsShallow(other_))
2499          return false;
2500        if (!(other_ instanceof MedicationAdministration))
2501          return false;
2502        MedicationAdministration o = (MedicationAdministration) other_;
2503        return compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
2504           && compareValues(status, o.status, true) && compareValues(recorded, o.recorded, true);
2505      }
2506
2507      public boolean isEmpty() {
2508        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
2509          , instantiatesUri, basedOn, partOf, status, statusReason, category, medication
2510          , subject, encounter, supportingInformation, occurence, recorded, performer, reason
2511          , request, device, note, dosage, eventHistory);
2512      }
2513
2514  @Override
2515  public ResourceType getResourceType() {
2516    return ResourceType.MedicationAdministration;
2517   }
2518
2519 /**
2520   * Search parameter: <b>device</b>
2521   * <p>
2522   * Description: <b>Return administrations with this administration device identity</b><br>
2523   * Type: <b>reference</b><br>
2524   * Path: <b>MedicationAdministration.device</b><br>
2525   * </p>
2526   */
2527  @SearchParamDefinition(name="device", path="MedicationAdministration.device", description="Return administrations with this administration device identity", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device") }, target={Device.class } )
2528  public static final String SP_DEVICE = "device";
2529 /**
2530   * <b>Fluent Client</b> search parameter constant for <b>device</b>
2531   * <p>
2532   * Description: <b>Return administrations with this administration device identity</b><br>
2533   * Type: <b>reference</b><br>
2534   * Path: <b>MedicationAdministration.device</b><br>
2535   * </p>
2536   */
2537  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE);
2538
2539/**
2540   * Constant for fluent queries to be used to add include statements. Specifies
2541   * the path value of "<b>MedicationAdministration:device</b>".
2542   */
2543  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("MedicationAdministration:device").toLocked();
2544
2545 /**
2546   * Search parameter: <b>performer</b>
2547   * <p>
2548   * Description: <b>The identity of the individual who administered the medication</b><br>
2549   * Type: <b>reference</b><br>
2550   * Path: <b>MedicationAdministration.performer.actor</b><br>
2551   * </p>
2552   */
2553  @SearchParamDefinition(name="performer", path="MedicationAdministration.performer.actor", description="The identity of the individual who administered the medication", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={Device.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2554  public static final String SP_PERFORMER = "performer";
2555 /**
2556   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2557   * <p>
2558   * Description: <b>The identity of the individual who administered the medication</b><br>
2559   * Type: <b>reference</b><br>
2560   * Path: <b>MedicationAdministration.performer.actor</b><br>
2561   * </p>
2562   */
2563  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
2564
2565/**
2566   * Constant for fluent queries to be used to add include statements. Specifies
2567   * the path value of "<b>MedicationAdministration:performer</b>".
2568   */
2569  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("MedicationAdministration:performer").toLocked();
2570
2571 /**
2572   * Search parameter: <b>reason-given-code</b>
2573   * <p>
2574   * Description: <b>Reasons for administering the medication</b><br>
2575   * Type: <b>token</b><br>
2576   * Path: <b>MedicationAdministration.reason.concept</b><br>
2577   * </p>
2578   */
2579  @SearchParamDefinition(name="reason-given-code", path="MedicationAdministration.reason.concept", description="Reasons for administering the medication", type="token" )
2580  public static final String SP_REASON_GIVEN_CODE = "reason-given-code";
2581 /**
2582   * <b>Fluent Client</b> search parameter constant for <b>reason-given-code</b>
2583   * <p>
2584   * Description: <b>Reasons for administering the medication</b><br>
2585   * Type: <b>token</b><br>
2586   * Path: <b>MedicationAdministration.reason.concept</b><br>
2587   * </p>
2588   */
2589  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_GIVEN_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_GIVEN_CODE);
2590
2591 /**
2592   * Search parameter: <b>reason-given</b>
2593   * <p>
2594   * Description: <b>Reference to a resource (by instance)</b><br>
2595   * Type: <b>reference</b><br>
2596   * Path: <b>MedicationAdministration.reason.reference</b><br>
2597   * </p>
2598   */
2599  @SearchParamDefinition(name="reason-given", path="MedicationAdministration.reason.reference", description="Reference to a resource (by instance)", type="reference" )
2600  public static final String SP_REASON_GIVEN = "reason-given";
2601 /**
2602   * <b>Fluent Client</b> search parameter constant for <b>reason-given</b>
2603   * <p>
2604   * Description: <b>Reference to a resource (by instance)</b><br>
2605   * Type: <b>reference</b><br>
2606   * Path: <b>MedicationAdministration.reason.reference</b><br>
2607   * </p>
2608   */
2609  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REASON_GIVEN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REASON_GIVEN);
2610
2611/**
2612   * Constant for fluent queries to be used to add include statements. Specifies
2613   * the path value of "<b>MedicationAdministration:reason-given</b>".
2614   */
2615  public static final ca.uhn.fhir.model.api.Include INCLUDE_REASON_GIVEN = new ca.uhn.fhir.model.api.Include("MedicationAdministration:reason-given").toLocked();
2616
2617 /**
2618   * Search parameter: <b>reason-not-given</b>
2619   * <p>
2620   * Description: <b>Reasons for not administering the medication</b><br>
2621   * Type: <b>token</b><br>
2622   * Path: <b>MedicationAdministration.statusReason</b><br>
2623   * </p>
2624   */
2625  @SearchParamDefinition(name="reason-not-given", path="MedicationAdministration.statusReason", description="Reasons for not administering the medication", type="token" )
2626  public static final String SP_REASON_NOT_GIVEN = "reason-not-given";
2627 /**
2628   * <b>Fluent Client</b> search parameter constant for <b>reason-not-given</b>
2629   * <p>
2630   * Description: <b>Reasons for not administering the medication</b><br>
2631   * Type: <b>token</b><br>
2632   * Path: <b>MedicationAdministration.statusReason</b><br>
2633   * </p>
2634   */
2635  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REASON_NOT_GIVEN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REASON_NOT_GIVEN);
2636
2637 /**
2638   * Search parameter: <b>request</b>
2639   * <p>
2640   * Description: <b>The identity of a request to list administrations from</b><br>
2641   * Type: <b>reference</b><br>
2642   * Path: <b>MedicationAdministration.request</b><br>
2643   * </p>
2644   */
2645  @SearchParamDefinition(name="request", path="MedicationAdministration.request", description="The identity of a request to list administrations from", type="reference", target={MedicationRequest.class } )
2646  public static final String SP_REQUEST = "request";
2647 /**
2648   * <b>Fluent Client</b> search parameter constant for <b>request</b>
2649   * <p>
2650   * Description: <b>The identity of a request to list administrations from</b><br>
2651   * Type: <b>reference</b><br>
2652   * Path: <b>MedicationAdministration.request</b><br>
2653   * </p>
2654   */
2655  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
2656
2657/**
2658   * Constant for fluent queries to be used to add include statements. Specifies
2659   * the path value of "<b>MedicationAdministration:request</b>".
2660   */
2661  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("MedicationAdministration:request").toLocked();
2662
2663 /**
2664   * Search parameter: <b>subject</b>
2665   * <p>
2666   * Description: <b>The identity of the individual or group to list administrations for</b><br>
2667   * Type: <b>reference</b><br>
2668   * Path: <b>MedicationAdministration.subject</b><br>
2669   * </p>
2670   */
2671  @SearchParamDefinition(name="subject", path="MedicationAdministration.subject", description="The identity of the individual or group to list administrations for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Group.class, Patient.class } )
2672  public static final String SP_SUBJECT = "subject";
2673 /**
2674   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2675   * <p>
2676   * Description: <b>The identity of the individual or group to list administrations for</b><br>
2677   * Type: <b>reference</b><br>
2678   * Path: <b>MedicationAdministration.subject</b><br>
2679   * </p>
2680   */
2681  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2682
2683/**
2684   * Constant for fluent queries to be used to add include statements. Specifies
2685   * the path value of "<b>MedicationAdministration:subject</b>".
2686   */
2687  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicationAdministration:subject").toLocked();
2688
2689 /**
2690   * Search parameter: <b>code</b>
2691   * <p>
2692   * Description: <b>Multiple Resources: 
2693
2694* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
2695* [Condition](condition.html): Code for the condition
2696* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
2697* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
2698* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
2699* [List](list.html): What the purpose of this list is
2700* [Medication](medication.html): Returns medications for a specific code
2701* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
2702* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
2703* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
2704* [MedicationUsage](medicationusage.html): Return statements of this medication code
2705* [Observation](observation.html): The code of the observation type
2706* [Procedure](procedure.html): A code to identify a  procedure
2707* [ServiceRequest](servicerequest.html): What is being requested/ordered
2708</b><br>
2709   * Type: <b>token</b><br>
2710   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code</b><br>
2711   * </p>
2712   */
2713  @SearchParamDefinition(name="code", path="AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [Condition](condition.html): Code for the condition\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationUsage](medicationusage.html): Return statements of this medication code\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [ServiceRequest](servicerequest.html): What is being requested/ordered\r\n", type="token" )
2714  public static final String SP_CODE = "code";
2715 /**
2716   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2717   * <p>
2718   * Description: <b>Multiple Resources: 
2719
2720* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
2721* [Condition](condition.html): Code for the condition
2722* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
2723* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
2724* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
2725* [List](list.html): What the purpose of this list is
2726* [Medication](medication.html): Returns medications for a specific code
2727* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
2728* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
2729* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
2730* [MedicationUsage](medicationusage.html): Return statements of this medication code
2731* [Observation](observation.html): The code of the observation type
2732* [Procedure](procedure.html): A code to identify a  procedure
2733* [ServiceRequest](servicerequest.html): What is being requested/ordered
2734</b><br>
2735   * Type: <b>token</b><br>
2736   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code</b><br>
2737   * </p>
2738   */
2739  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
2740
2741 /**
2742   * Search parameter: <b>identifier</b>
2743   * <p>
2744   * Description: <b>Multiple Resources: 
2745
2746* [AllergyIntolerance](allergyintolerance.html): External ids for this item
2747* [CarePlan](careplan.html): External Ids for this plan
2748* [CareTeam](careteam.html): External Ids for this team
2749* [Composition](composition.html): Version-independent identifier for the Composition
2750* [Condition](condition.html): A unique identifier of the condition record
2751* [Consent](consent.html): Identifier for this record (external references)
2752* [DetectedIssue](detectedissue.html): Unique id for the detected issue
2753* [DeviceRequest](devicerequest.html): Business identifier for request/order
2754* [DiagnosticReport](diagnosticreport.html): An identifier for the report
2755* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
2756* [DocumentReference](documentreference.html): Identifier of the attachment binary
2757* [Encounter](encounter.html): Identifier(s) by which this encounter is known
2758* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
2759* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
2760* [Goal](goal.html): External Ids for this goal
2761* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
2762* [Immunization](immunization.html): Business identifier
2763* [List](list.html): Business identifier
2764* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
2765* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
2766* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
2767* [MedicationUsage](medicationusage.html): Return statements with this external identifier
2768* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
2769* [Observation](observation.html): The unique id for a particular observation
2770* [Procedure](procedure.html): A unique identifier for a procedure
2771* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
2772* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
2773* [SupplyDelivery](supplydelivery.html): External identifier
2774* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
2775* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
2776</b><br>
2777   * Type: <b>token</b><br>
2778   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.content.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
2779   * </p>
2780   */
2781  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.content.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationUsage](medicationusage.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
2782  public static final String SP_IDENTIFIER = "identifier";
2783 /**
2784   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2785   * <p>
2786   * Description: <b>Multiple Resources: 
2787
2788* [AllergyIntolerance](allergyintolerance.html): External ids for this item
2789* [CarePlan](careplan.html): External Ids for this plan
2790* [CareTeam](careteam.html): External Ids for this team
2791* [Composition](composition.html): Version-independent identifier for the Composition
2792* [Condition](condition.html): A unique identifier of the condition record
2793* [Consent](consent.html): Identifier for this record (external references)
2794* [DetectedIssue](detectedissue.html): Unique id for the detected issue
2795* [DeviceRequest](devicerequest.html): Business identifier for request/order
2796* [DiagnosticReport](diagnosticreport.html): An identifier for the report
2797* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
2798* [DocumentReference](documentreference.html): Identifier of the attachment binary
2799* [Encounter](encounter.html): Identifier(s) by which this encounter is known
2800* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
2801* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
2802* [Goal](goal.html): External Ids for this goal
2803* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
2804* [Immunization](immunization.html): Business identifier
2805* [List](list.html): Business identifier
2806* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
2807* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
2808* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
2809* [MedicationUsage](medicationusage.html): Return statements with this external identifier
2810* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
2811* [Observation](observation.html): The unique id for a particular observation
2812* [Procedure](procedure.html): A unique identifier for a procedure
2813* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
2814* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
2815* [SupplyDelivery](supplydelivery.html): External identifier
2816* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
2817* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
2818</b><br>
2819   * Type: <b>token</b><br>
2820   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.content.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
2821   * </p>
2822   */
2823  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2824
2825 /**
2826   * Search parameter: <b>patient</b>
2827   * <p>
2828   * Description: <b>Multiple Resources: 
2829
2830* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2831* [CarePlan](careplan.html): Who the care plan is for
2832* [CareTeam](careteam.html): Who care team is for
2833* [ClinicalImpression](clinicalimpression.html): Patient assessed
2834* [Composition](composition.html): Who and/or what the composition is about
2835* [Condition](condition.html): Who has the condition?
2836* [Consent](consent.html): Who the consent applies to
2837* [DetectedIssue](detectedissue.html): Associated patient
2838* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2839* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
2840* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2841* [DocumentManifest](documentmanifest.html): The subject of the set of documents
2842* [DocumentReference](documentreference.html): Who/what is the subject of the document
2843* [Encounter](encounter.html): The patient present at the encounter
2844* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2845* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2846* [Flag](flag.html): The identity of a subject to list flags for
2847* [Goal](goal.html): Who this goal is intended for
2848* [ImagingStudy](imagingstudy.html): Who the study is about
2849* [Immunization](immunization.html): The patient for the vaccination record
2850* [List](list.html): If all resources have the same subject
2851* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2852* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2853* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2854* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
2855* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
2856* [Observation](observation.html): The subject that the observation is about (if patient)
2857* [Procedure](procedure.html): Search by subject - a patient
2858* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2859* [ServiceRequest](servicerequest.html): Search by subject - a patient
2860* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2861* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2862</b><br>
2863   * Type: <b>reference</b><br>
2864   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
2865   * </p>
2866   */
2867  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, ConceptMap2.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
2868  public static final String SP_PATIENT = "patient";
2869 /**
2870   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2871   * <p>
2872   * Description: <b>Multiple Resources: 
2873
2874* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2875* [CarePlan](careplan.html): Who the care plan is for
2876* [CareTeam](careteam.html): Who care team is for
2877* [ClinicalImpression](clinicalimpression.html): Patient assessed
2878* [Composition](composition.html): Who and/or what the composition is about
2879* [Condition](condition.html): Who has the condition?
2880* [Consent](consent.html): Who the consent applies to
2881* [DetectedIssue](detectedissue.html): Associated patient
2882* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2883* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
2884* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2885* [DocumentManifest](documentmanifest.html): The subject of the set of documents
2886* [DocumentReference](documentreference.html): Who/what is the subject of the document
2887* [Encounter](encounter.html): The patient present at the encounter
2888* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2889* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2890* [Flag](flag.html): The identity of a subject to list flags for
2891* [Goal](goal.html): Who this goal is intended for
2892* [ImagingStudy](imagingstudy.html): Who the study is about
2893* [Immunization](immunization.html): The patient for the vaccination record
2894* [List](list.html): If all resources have the same subject
2895* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2896* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2897* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2898* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
2899* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
2900* [Observation](observation.html): The subject that the observation is about (if patient)
2901* [Procedure](procedure.html): Search by subject - a patient
2902* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2903* [ServiceRequest](servicerequest.html): Search by subject - a patient
2904* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2905* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2906</b><br>
2907   * Type: <b>reference</b><br>
2908   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
2909   * </p>
2910   */
2911  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2912
2913/**
2914   * Constant for fluent queries to be used to add include statements. Specifies
2915   * the path value of "<b>MedicationAdministration:patient</b>".
2916   */
2917  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationAdministration:patient").toLocked();
2918
2919 /**
2920   * Search parameter: <b>date</b>
2921   * <p>
2922   * Description: <b>Multiple Resources: 
2923
2924* [MedicationAdministration](medicationadministration.html): Date administration happened (or did not happen)
2925</b><br>
2926   * Type: <b>date</b><br>
2927   * Path: <b>MedicationAdministration.occurence</b><br>
2928   * </p>
2929   */
2930  @SearchParamDefinition(name="date", path="MedicationAdministration.occurence", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): Date administration happened (or did not happen)\r\n", type="date" )
2931  public static final String SP_DATE = "date";
2932 /**
2933   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2934   * <p>
2935   * Description: <b>Multiple Resources: 
2936
2937* [MedicationAdministration](medicationadministration.html): Date administration happened (or did not happen)
2938</b><br>
2939   * Type: <b>date</b><br>
2940   * Path: <b>MedicationAdministration.occurence</b><br>
2941   * </p>
2942   */
2943  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2944
2945 /**
2946   * Search parameter: <b>encounter</b>
2947   * <p>
2948   * Description: <b>Multiple Resources: 
2949
2950* [MedicationAdministration](medicationadministration.html): Return administrations that share this encounter
2951* [MedicationRequest](medicationrequest.html): Return prescriptions with this encounter identifier
2952</b><br>
2953   * Type: <b>reference</b><br>
2954   * Path: <b>MedicationAdministration.encounter | MedicationRequest.encounter</b><br>
2955   * </p>
2956   */
2957  @SearchParamDefinition(name="encounter", path="MedicationAdministration.encounter | MedicationRequest.encounter", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): Return administrations that share this encounter\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this encounter identifier\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
2958  public static final String SP_ENCOUNTER = "encounter";
2959 /**
2960   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2961   * <p>
2962   * Description: <b>Multiple Resources: 
2963
2964* [MedicationAdministration](medicationadministration.html): Return administrations that share this encounter
2965* [MedicationRequest](medicationrequest.html): Return prescriptions with this encounter identifier
2966</b><br>
2967   * Type: <b>reference</b><br>
2968   * Path: <b>MedicationAdministration.encounter | MedicationRequest.encounter</b><br>
2969   * </p>
2970   */
2971  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2972
2973/**
2974   * Constant for fluent queries to be used to add include statements. Specifies
2975   * the path value of "<b>MedicationAdministration:encounter</b>".
2976   */
2977  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("MedicationAdministration:encounter").toLocked();
2978
2979 /**
2980   * Search parameter: <b>medication</b>
2981   * <p>
2982   * Description: <b>Multiple Resources: 
2983
2984* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
2985* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
2986* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
2987* [MedicationUsage](medicationusage.html): Return statements of this medication reference
2988</b><br>
2989   * Type: <b>reference</b><br>
2990   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference</b><br>
2991   * </p>
2992   */
2993  @SearchParamDefinition(name="medication", path="MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference\r\n* [MedicationUsage](medicationusage.html): Return statements of this medication reference\r\n", type="reference" )
2994  public static final String SP_MEDICATION = "medication";
2995 /**
2996   * <b>Fluent Client</b> search parameter constant for <b>medication</b>
2997   * <p>
2998   * Description: <b>Multiple Resources: 
2999
3000* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
3001* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
3002* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
3003* [MedicationUsage](medicationusage.html): Return statements of this medication reference
3004</b><br>
3005   * Type: <b>reference</b><br>
3006   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference</b><br>
3007   * </p>
3008   */
3009  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION);
3010
3011/**
3012   * Constant for fluent queries to be used to add include statements. Specifies
3013   * the path value of "<b>MedicationAdministration:medication</b>".
3014   */
3015  public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationAdministration:medication").toLocked();
3016
3017 /**
3018   * Search parameter: <b>status</b>
3019   * <p>
3020   * Description: <b>Multiple Resources: 
3021
3022* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
3023* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
3024* [MedicationRequest](medicationrequest.html): Status of the prescription
3025* [MedicationUsage](medicationusage.html): Return statements that match the given status
3026</b><br>
3027   * Type: <b>token</b><br>
3028   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status</b><br>
3029   * </p>
3030   */
3031  @SearchParamDefinition(name="status", path="MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status\r\n* [MedicationRequest](medicationrequest.html): Status of the prescription\r\n* [MedicationUsage](medicationusage.html): Return statements that match the given status\r\n", type="token" )
3032  public static final String SP_STATUS = "status";
3033 /**
3034   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3035   * <p>
3036   * Description: <b>Multiple Resources: 
3037
3038* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
3039* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
3040* [MedicationRequest](medicationrequest.html): Status of the prescription
3041* [MedicationUsage](medicationusage.html): Return statements that match the given status
3042</b><br>
3043   * Type: <b>token</b><br>
3044   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status</b><br>
3045   * </p>
3046   */
3047  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3048
3049
3050}
3051