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