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