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