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