001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Indicates that a medication product is to be or has been dispensed for a named person/patient.  This includes a description of the medication product (supply) provided and the instructions for administering the medication.  The medication dispense is the result of a pharmacy system responding to a medication order.
052 */
053@ResourceDef(name="MedicationDispense", profile="http://hl7.org/fhir/StructureDefinition/MedicationDispense")
054public class MedicationDispense extends DomainResource {
055
056    public enum MedicationDispenseStatusCodes {
057        /**
058         * The core event has not started yet, but some staging activities have begun (e.g. initial compounding or packaging of medication). Preparation stages may be tracked for billing purposes.
059         */
060        PREPARATION, 
061        /**
062         * The dispensed product is ready for pickup.
063         */
064        INPROGRESS, 
065        /**
066         * The dispensed product was not and will never be picked up by the patient.
067         */
068        CANCELLED, 
069        /**
070         * The dispense process is paused while waiting for an external event to reactivate the dispense.  For example, new stock has arrived or the prescriber has called.
071         */
072        ONHOLD, 
073        /**
074         * The dispensed product has been picked up.
075         */
076        COMPLETED, 
077        /**
078         * The dispense was entered in error and therefore nullified.
079         */
080        ENTEREDINERROR, 
081        /**
082         * Actions implied by the dispense have been permanently halted, before all of them occurred.
083         */
084        STOPPED, 
085        /**
086         * The dispense was declined and not performed.
087         */
088        DECLINED, 
089        /**
090         * The authoring system does not know which of the status values applies for this medication dispense.  Note: this concept is not to be used for other - one of the listed statuses is presumed to apply, it's just now known which one.
091         */
092        UNKNOWN, 
093        /**
094         * added to help the parsers with the generic types
095         */
096        NULL;
097        public static MedicationDispenseStatusCodes fromCode(String codeString) throws FHIRException {
098            if (codeString == null || "".equals(codeString))
099                return null;
100        if ("preparation".equals(codeString))
101          return PREPARATION;
102        if ("in-progress".equals(codeString))
103          return INPROGRESS;
104        if ("cancelled".equals(codeString))
105          return CANCELLED;
106        if ("on-hold".equals(codeString))
107          return ONHOLD;
108        if ("completed".equals(codeString))
109          return COMPLETED;
110        if ("entered-in-error".equals(codeString))
111          return ENTEREDINERROR;
112        if ("stopped".equals(codeString))
113          return STOPPED;
114        if ("declined".equals(codeString))
115          return DECLINED;
116        if ("unknown".equals(codeString))
117          return UNKNOWN;
118        if (Configuration.isAcceptInvalidEnums())
119          return null;
120        else
121          throw new FHIRException("Unknown MedicationDispenseStatusCodes code '"+codeString+"'");
122        }
123        public String toCode() {
124          switch (this) {
125            case PREPARATION: return "preparation";
126            case INPROGRESS: return "in-progress";
127            case CANCELLED: return "cancelled";
128            case ONHOLD: return "on-hold";
129            case COMPLETED: return "completed";
130            case ENTEREDINERROR: return "entered-in-error";
131            case STOPPED: return "stopped";
132            case DECLINED: return "declined";
133            case UNKNOWN: return "unknown";
134            case NULL: return null;
135            default: return "?";
136          }
137        }
138        public String getSystem() {
139          switch (this) {
140            case PREPARATION: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
141            case INPROGRESS: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
142            case CANCELLED: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
143            case ONHOLD: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
144            case COMPLETED: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
145            case ENTEREDINERROR: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
146            case STOPPED: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
147            case DECLINED: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
148            case UNKNOWN: return "http://hl7.org/fhir/CodeSystem/medicationdispense-status";
149            case NULL: return null;
150            default: return "?";
151          }
152        }
153        public String getDefinition() {
154          switch (this) {
155            case PREPARATION: return "The core event has not started yet, but some staging activities have begun (e.g. initial compounding or packaging of medication). Preparation stages may be tracked for billing purposes.";
156            case INPROGRESS: return "The dispensed product is ready for pickup.";
157            case CANCELLED: return "The dispensed product was not and will never be picked up by the patient.";
158            case ONHOLD: return "The dispense process is paused while waiting for an external event to reactivate the dispense.  For example, new stock has arrived or the prescriber has called.";
159            case COMPLETED: return "The dispensed product has been picked up.";
160            case ENTEREDINERROR: return "The dispense was entered in error and therefore nullified.";
161            case STOPPED: return "Actions implied by the dispense have been permanently halted, before all of them occurred.";
162            case DECLINED: return "The dispense was declined and not performed.";
163            case UNKNOWN: return "The authoring system does not know which of the status values applies for this medication dispense.  Note: this concept is not to be used for other - one of the listed statuses is presumed to apply, it's just now known which one.";
164            case NULL: return null;
165            default: return "?";
166          }
167        }
168        public String getDisplay() {
169          switch (this) {
170            case PREPARATION: return "Preparation";
171            case INPROGRESS: return "In Progress";
172            case CANCELLED: return "Cancelled";
173            case ONHOLD: return "On Hold";
174            case COMPLETED: return "Completed";
175            case ENTEREDINERROR: return "Entered in Error";
176            case STOPPED: return "Stopped";
177            case DECLINED: return "Declined";
178            case UNKNOWN: return "Unknown";
179            case NULL: return null;
180            default: return "?";
181          }
182        }
183    }
184
185  public static class MedicationDispenseStatusCodesEnumFactory implements EnumFactory<MedicationDispenseStatusCodes> {
186    public MedicationDispenseStatusCodes fromCode(String codeString) throws IllegalArgumentException {
187      if (codeString == null || "".equals(codeString))
188            if (codeString == null || "".equals(codeString))
189                return null;
190        if ("preparation".equals(codeString))
191          return MedicationDispenseStatusCodes.PREPARATION;
192        if ("in-progress".equals(codeString))
193          return MedicationDispenseStatusCodes.INPROGRESS;
194        if ("cancelled".equals(codeString))
195          return MedicationDispenseStatusCodes.CANCELLED;
196        if ("on-hold".equals(codeString))
197          return MedicationDispenseStatusCodes.ONHOLD;
198        if ("completed".equals(codeString))
199          return MedicationDispenseStatusCodes.COMPLETED;
200        if ("entered-in-error".equals(codeString))
201          return MedicationDispenseStatusCodes.ENTEREDINERROR;
202        if ("stopped".equals(codeString))
203          return MedicationDispenseStatusCodes.STOPPED;
204        if ("declined".equals(codeString))
205          return MedicationDispenseStatusCodes.DECLINED;
206        if ("unknown".equals(codeString))
207          return MedicationDispenseStatusCodes.UNKNOWN;
208        throw new IllegalArgumentException("Unknown MedicationDispenseStatusCodes code '"+codeString+"'");
209        }
210        public Enumeration<MedicationDispenseStatusCodes> fromType(PrimitiveType<?> code) throws FHIRException {
211          if (code == null)
212            return null;
213          if (code.isEmpty())
214            return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.NULL, code);
215          String codeString = ((PrimitiveType) code).asStringValue();
216          if (codeString == null || "".equals(codeString))
217            return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.NULL, code);
218        if ("preparation".equals(codeString))
219          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.PREPARATION, code);
220        if ("in-progress".equals(codeString))
221          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.INPROGRESS, code);
222        if ("cancelled".equals(codeString))
223          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.CANCELLED, code);
224        if ("on-hold".equals(codeString))
225          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.ONHOLD, code);
226        if ("completed".equals(codeString))
227          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.COMPLETED, code);
228        if ("entered-in-error".equals(codeString))
229          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.ENTEREDINERROR, code);
230        if ("stopped".equals(codeString))
231          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.STOPPED, code);
232        if ("declined".equals(codeString))
233          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.DECLINED, code);
234        if ("unknown".equals(codeString))
235          return new Enumeration<MedicationDispenseStatusCodes>(this, MedicationDispenseStatusCodes.UNKNOWN, code);
236        throw new FHIRException("Unknown MedicationDispenseStatusCodes code '"+codeString+"'");
237        }
238    public String toCode(MedicationDispenseStatusCodes code) {
239      if (code == MedicationDispenseStatusCodes.PREPARATION)
240        return "preparation";
241      if (code == MedicationDispenseStatusCodes.INPROGRESS)
242        return "in-progress";
243      if (code == MedicationDispenseStatusCodes.CANCELLED)
244        return "cancelled";
245      if (code == MedicationDispenseStatusCodes.ONHOLD)
246        return "on-hold";
247      if (code == MedicationDispenseStatusCodes.COMPLETED)
248        return "completed";
249      if (code == MedicationDispenseStatusCodes.ENTEREDINERROR)
250        return "entered-in-error";
251      if (code == MedicationDispenseStatusCodes.STOPPED)
252        return "stopped";
253      if (code == MedicationDispenseStatusCodes.DECLINED)
254        return "declined";
255      if (code == MedicationDispenseStatusCodes.UNKNOWN)
256        return "unknown";
257      return "?";
258      }
259    public String toSystem(MedicationDispenseStatusCodes code) {
260      return code.getSystem();
261      }
262    }
263
264    @Block()
265    public static class MedicationDispensePerformerComponent extends BackboneElement implements IBaseBackboneElement {
266        /**
267         * Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.
268         */
269        @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
270        @Description(shortDefinition="Who performed the dispense and what they did", formalDefinition="Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker." )
271        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationdispense-performer-function")
272        protected CodeableConcept function;
273
274        /**
275         * The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication.
276         */
277        @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, Device.class, RelatedPerson.class, CareTeam.class}, order=2, min=1, max=1, modifier=false, summary=false)
278        @Description(shortDefinition="Individual who was performing", formalDefinition="The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication." )
279        protected Reference actor;
280
281        private static final long serialVersionUID = -576943815L;
282
283    /**
284     * Constructor
285     */
286      public MedicationDispensePerformerComponent() {
287        super();
288      }
289
290    /**
291     * Constructor
292     */
293      public MedicationDispensePerformerComponent(Reference actor) {
294        super();
295        this.setActor(actor);
296      }
297
298        /**
299         * @return {@link #function} (Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.)
300         */
301        public CodeableConcept getFunction() { 
302          if (this.function == null)
303            if (Configuration.errorOnAutoCreate())
304              throw new Error("Attempt to auto-create MedicationDispensePerformerComponent.function");
305            else if (Configuration.doAutoCreate())
306              this.function = new CodeableConcept(); // cc
307          return this.function;
308        }
309
310        public boolean hasFunction() { 
311          return this.function != null && !this.function.isEmpty();
312        }
313
314        /**
315         * @param value {@link #function} (Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.)
316         */
317        public MedicationDispensePerformerComponent setFunction(CodeableConcept value) { 
318          this.function = value;
319          return this;
320        }
321
322        /**
323         * @return {@link #actor} (The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication.)
324         */
325        public Reference getActor() { 
326          if (this.actor == null)
327            if (Configuration.errorOnAutoCreate())
328              throw new Error("Attempt to auto-create MedicationDispensePerformerComponent.actor");
329            else if (Configuration.doAutoCreate())
330              this.actor = new Reference(); // cc
331          return this.actor;
332        }
333
334        public boolean hasActor() { 
335          return this.actor != null && !this.actor.isEmpty();
336        }
337
338        /**
339         * @param value {@link #actor} (The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication.)
340         */
341        public MedicationDispensePerformerComponent setActor(Reference value) { 
342          this.actor = value;
343          return this;
344        }
345
346        protected void listChildren(List<Property> children) {
347          super.listChildren(children);
348          children.add(new Property("function", "CodeableConcept", "Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.", 0, 1, function));
349          children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication.", 0, 1, actor));
350        }
351
352        @Override
353        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
354          switch (_hash) {
355          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.", 0, 1, function);
356          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication.", 0, 1, actor);
357          default: return super.getNamedProperty(_hash, _name, _checkValid);
358          }
359
360        }
361
362      @Override
363      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
364        switch (hash) {
365        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
366        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
367        default: return super.getProperty(hash, name, checkValid);
368        }
369
370      }
371
372      @Override
373      public Base setProperty(int hash, String name, Base value) throws FHIRException {
374        switch (hash) {
375        case 1380938712: // function
376          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
377          return value;
378        case 92645877: // actor
379          this.actor = TypeConvertor.castToReference(value); // Reference
380          return value;
381        default: return super.setProperty(hash, name, value);
382        }
383
384      }
385
386      @Override
387      public Base setProperty(String name, Base value) throws FHIRException {
388        if (name.equals("function")) {
389          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
390        } else if (name.equals("actor")) {
391          this.actor = TypeConvertor.castToReference(value); // Reference
392        } else
393          return super.setProperty(name, value);
394        return value;
395      }
396
397  @Override
398  public void removeChild(String name, Base value) throws FHIRException {
399        if (name.equals("function")) {
400          this.function = null;
401        } else if (name.equals("actor")) {
402          this.actor = null;
403        } else
404          super.removeChild(name, value);
405        
406      }
407
408      @Override
409      public Base makeProperty(int hash, String name) throws FHIRException {
410        switch (hash) {
411        case 1380938712:  return getFunction();
412        case 92645877:  return getActor();
413        default: return super.makeProperty(hash, name);
414        }
415
416      }
417
418      @Override
419      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
420        switch (hash) {
421        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
422        case 92645877: /*actor*/ return new String[] {"Reference"};
423        default: return super.getTypesForProperty(hash, name);
424        }
425
426      }
427
428      @Override
429      public Base addChild(String name) throws FHIRException {
430        if (name.equals("function")) {
431          this.function = new CodeableConcept();
432          return this.function;
433        }
434        else if (name.equals("actor")) {
435          this.actor = new Reference();
436          return this.actor;
437        }
438        else
439          return super.addChild(name);
440      }
441
442      public MedicationDispensePerformerComponent copy() {
443        MedicationDispensePerformerComponent dst = new MedicationDispensePerformerComponent();
444        copyValues(dst);
445        return dst;
446      }
447
448      public void copyValues(MedicationDispensePerformerComponent dst) {
449        super.copyValues(dst);
450        dst.function = function == null ? null : function.copy();
451        dst.actor = actor == null ? null : actor.copy();
452      }
453
454      @Override
455      public boolean equalsDeep(Base other_) {
456        if (!super.equalsDeep(other_))
457          return false;
458        if (!(other_ instanceof MedicationDispensePerformerComponent))
459          return false;
460        MedicationDispensePerformerComponent o = (MedicationDispensePerformerComponent) other_;
461        return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
462      }
463
464      @Override
465      public boolean equalsShallow(Base other_) {
466        if (!super.equalsShallow(other_))
467          return false;
468        if (!(other_ instanceof MedicationDispensePerformerComponent))
469          return false;
470        MedicationDispensePerformerComponent o = (MedicationDispensePerformerComponent) other_;
471        return true;
472      }
473
474      public boolean isEmpty() {
475        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
476      }
477
478  public String fhirType() {
479    return "MedicationDispense.performer";
480
481  }
482
483  }
484
485    @Block()
486    public static class MedicationDispenseSubstitutionComponent extends BackboneElement implements IBaseBackboneElement {
487        /**
488         * True if the dispenser dispensed a different drug or product from what was prescribed.
489         */
490        @Child(name = "wasSubstituted", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=false)
491        @Description(shortDefinition="Whether a substitution was or was not performed on the dispense", formalDefinition="True if the dispenser dispensed a different drug or product from what was prescribed." )
492        protected BooleanType wasSubstituted;
493
494        /**
495         * A code signifying whether a different drug was dispensed from what was prescribed.
496         */
497        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
498        @Description(shortDefinition="Code signifying whether a different drug was dispensed from what was prescribed", formalDefinition="A code signifying whether a different drug was dispensed from what was prescribed." )
499        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode")
500        protected CodeableConcept type;
501
502        /**
503         * Indicates the reason for the substitution (or lack of substitution) from what was prescribed.
504         */
505        @Child(name = "reason", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
506        @Description(shortDefinition="Why was substitution made", formalDefinition="Indicates the reason for the substitution (or lack of substitution) from what was prescribed." )
507        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-SubstanceAdminSubstitutionReason")
508        protected List<CodeableConcept> reason;
509
510        /**
511         * The person or organization that has primary responsibility for the substitution.
512         */
513        @Child(name = "responsibleParty", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
514        @Description(shortDefinition="Who is responsible for the substitution", formalDefinition="The person or organization that has primary responsibility for the substitution." )
515        protected Reference responsibleParty;
516
517        private static final long serialVersionUID = 431402218L;
518
519    /**
520     * Constructor
521     */
522      public MedicationDispenseSubstitutionComponent() {
523        super();
524      }
525
526    /**
527     * Constructor
528     */
529      public MedicationDispenseSubstitutionComponent(boolean wasSubstituted) {
530        super();
531        this.setWasSubstituted(wasSubstituted);
532      }
533
534        /**
535         * @return {@link #wasSubstituted} (True if the dispenser dispensed a different drug or product from what was prescribed.). This is the underlying object with id, value and extensions. The accessor "getWasSubstituted" gives direct access to the value
536         */
537        public BooleanType getWasSubstitutedElement() { 
538          if (this.wasSubstituted == null)
539            if (Configuration.errorOnAutoCreate())
540              throw new Error("Attempt to auto-create MedicationDispenseSubstitutionComponent.wasSubstituted");
541            else if (Configuration.doAutoCreate())
542              this.wasSubstituted = new BooleanType(); // bb
543          return this.wasSubstituted;
544        }
545
546        public boolean hasWasSubstitutedElement() { 
547          return this.wasSubstituted != null && !this.wasSubstituted.isEmpty();
548        }
549
550        public boolean hasWasSubstituted() { 
551          return this.wasSubstituted != null && !this.wasSubstituted.isEmpty();
552        }
553
554        /**
555         * @param value {@link #wasSubstituted} (True if the dispenser dispensed a different drug or product from what was prescribed.). This is the underlying object with id, value and extensions. The accessor "getWasSubstituted" gives direct access to the value
556         */
557        public MedicationDispenseSubstitutionComponent setWasSubstitutedElement(BooleanType value) { 
558          this.wasSubstituted = value;
559          return this;
560        }
561
562        /**
563         * @return True if the dispenser dispensed a different drug or product from what was prescribed.
564         */
565        public boolean getWasSubstituted() { 
566          return this.wasSubstituted == null || this.wasSubstituted.isEmpty() ? false : this.wasSubstituted.getValue();
567        }
568
569        /**
570         * @param value True if the dispenser dispensed a different drug or product from what was prescribed.
571         */
572        public MedicationDispenseSubstitutionComponent setWasSubstituted(boolean value) { 
573            if (this.wasSubstituted == null)
574              this.wasSubstituted = new BooleanType();
575            this.wasSubstituted.setValue(value);
576          return this;
577        }
578
579        /**
580         * @return {@link #type} (A code signifying whether a different drug was dispensed from what was prescribed.)
581         */
582        public CodeableConcept getType() { 
583          if (this.type == null)
584            if (Configuration.errorOnAutoCreate())
585              throw new Error("Attempt to auto-create MedicationDispenseSubstitutionComponent.type");
586            else if (Configuration.doAutoCreate())
587              this.type = new CodeableConcept(); // cc
588          return this.type;
589        }
590
591        public boolean hasType() { 
592          return this.type != null && !this.type.isEmpty();
593        }
594
595        /**
596         * @param value {@link #type} (A code signifying whether a different drug was dispensed from what was prescribed.)
597         */
598        public MedicationDispenseSubstitutionComponent setType(CodeableConcept value) { 
599          this.type = value;
600          return this;
601        }
602
603        /**
604         * @return {@link #reason} (Indicates the reason for the substitution (or lack of substitution) from what was prescribed.)
605         */
606        public List<CodeableConcept> getReason() { 
607          if (this.reason == null)
608            this.reason = new ArrayList<CodeableConcept>();
609          return this.reason;
610        }
611
612        /**
613         * @return Returns a reference to <code>this</code> for easy method chaining
614         */
615        public MedicationDispenseSubstitutionComponent setReason(List<CodeableConcept> theReason) { 
616          this.reason = theReason;
617          return this;
618        }
619
620        public boolean hasReason() { 
621          if (this.reason == null)
622            return false;
623          for (CodeableConcept item : this.reason)
624            if (!item.isEmpty())
625              return true;
626          return false;
627        }
628
629        public CodeableConcept addReason() { //3
630          CodeableConcept t = new CodeableConcept();
631          if (this.reason == null)
632            this.reason = new ArrayList<CodeableConcept>();
633          this.reason.add(t);
634          return t;
635        }
636
637        public MedicationDispenseSubstitutionComponent addReason(CodeableConcept t) { //3
638          if (t == null)
639            return this;
640          if (this.reason == null)
641            this.reason = new ArrayList<CodeableConcept>();
642          this.reason.add(t);
643          return this;
644        }
645
646        /**
647         * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
648         */
649        public CodeableConcept getReasonFirstRep() { 
650          if (getReason().isEmpty()) {
651            addReason();
652          }
653          return getReason().get(0);
654        }
655
656        /**
657         * @return {@link #responsibleParty} (The person or organization that has primary responsibility for the substitution.)
658         */
659        public Reference getResponsibleParty() { 
660          if (this.responsibleParty == null)
661            if (Configuration.errorOnAutoCreate())
662              throw new Error("Attempt to auto-create MedicationDispenseSubstitutionComponent.responsibleParty");
663            else if (Configuration.doAutoCreate())
664              this.responsibleParty = new Reference(); // cc
665          return this.responsibleParty;
666        }
667
668        public boolean hasResponsibleParty() { 
669          return this.responsibleParty != null && !this.responsibleParty.isEmpty();
670        }
671
672        /**
673         * @param value {@link #responsibleParty} (The person or organization that has primary responsibility for the substitution.)
674         */
675        public MedicationDispenseSubstitutionComponent setResponsibleParty(Reference value) { 
676          this.responsibleParty = value;
677          return this;
678        }
679
680        protected void listChildren(List<Property> children) {
681          super.listChildren(children);
682          children.add(new Property("wasSubstituted", "boolean", "True if the dispenser dispensed a different drug or product from what was prescribed.", 0, 1, wasSubstituted));
683          children.add(new Property("type", "CodeableConcept", "A code signifying whether a different drug was dispensed from what was prescribed.", 0, 1, type));
684          children.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution (or lack of substitution) from what was prescribed.", 0, java.lang.Integer.MAX_VALUE, reason));
685          children.add(new Property("responsibleParty", "Reference(Practitioner|PractitionerRole|Organization)", "The person or organization that has primary responsibility for the substitution.", 0, 1, responsibleParty));
686        }
687
688        @Override
689        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
690          switch (_hash) {
691          case -592113567: /*wasSubstituted*/  return new Property("wasSubstituted", "boolean", "True if the dispenser dispensed a different drug or product from what was prescribed.", 0, 1, wasSubstituted);
692          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A code signifying whether a different drug was dispensed from what was prescribed.", 0, 1, type);
693          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Indicates the reason for the substitution (or lack of substitution) from what was prescribed.", 0, java.lang.Integer.MAX_VALUE, reason);
694          case 1511509392: /*responsibleParty*/  return new Property("responsibleParty", "Reference(Practitioner|PractitionerRole|Organization)", "The person or organization that has primary responsibility for the substitution.", 0, 1, responsibleParty);
695          default: return super.getNamedProperty(_hash, _name, _checkValid);
696          }
697
698        }
699
700      @Override
701      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
702        switch (hash) {
703        case -592113567: /*wasSubstituted*/ return this.wasSubstituted == null ? new Base[0] : new Base[] {this.wasSubstituted}; // BooleanType
704        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
705        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
706        case 1511509392: /*responsibleParty*/ return this.responsibleParty == null ? new Base[0] : new Base[] {this.responsibleParty}; // Reference
707        default: return super.getProperty(hash, name, checkValid);
708        }
709
710      }
711
712      @Override
713      public Base setProperty(int hash, String name, Base value) throws FHIRException {
714        switch (hash) {
715        case -592113567: // wasSubstituted
716          this.wasSubstituted = TypeConvertor.castToBoolean(value); // BooleanType
717          return value;
718        case 3575610: // type
719          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
720          return value;
721        case -934964668: // reason
722          this.getReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
723          return value;
724        case 1511509392: // responsibleParty
725          this.responsibleParty = TypeConvertor.castToReference(value); // Reference
726          return value;
727        default: return super.setProperty(hash, name, value);
728        }
729
730      }
731
732      @Override
733      public Base setProperty(String name, Base value) throws FHIRException {
734        if (name.equals("wasSubstituted")) {
735          this.wasSubstituted = TypeConvertor.castToBoolean(value); // BooleanType
736        } else if (name.equals("type")) {
737          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
738        } else if (name.equals("reason")) {
739          this.getReason().add(TypeConvertor.castToCodeableConcept(value));
740        } else if (name.equals("responsibleParty")) {
741          this.responsibleParty = TypeConvertor.castToReference(value); // Reference
742        } else
743          return super.setProperty(name, value);
744        return value;
745      }
746
747  @Override
748  public void removeChild(String name, Base value) throws FHIRException {
749        if (name.equals("wasSubstituted")) {
750          this.wasSubstituted = null;
751        } else if (name.equals("type")) {
752          this.type = null;
753        } else if (name.equals("reason")) {
754          this.getReason().remove(value);
755        } else if (name.equals("responsibleParty")) {
756          this.responsibleParty = null;
757        } else
758          super.removeChild(name, value);
759        
760      }
761
762      @Override
763      public Base makeProperty(int hash, String name) throws FHIRException {
764        switch (hash) {
765        case -592113567:  return getWasSubstitutedElement();
766        case 3575610:  return getType();
767        case -934964668:  return addReason(); 
768        case 1511509392:  return getResponsibleParty();
769        default: return super.makeProperty(hash, name);
770        }
771
772      }
773
774      @Override
775      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
776        switch (hash) {
777        case -592113567: /*wasSubstituted*/ return new String[] {"boolean"};
778        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
779        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
780        case 1511509392: /*responsibleParty*/ return new String[] {"Reference"};
781        default: return super.getTypesForProperty(hash, name);
782        }
783
784      }
785
786      @Override
787      public Base addChild(String name) throws FHIRException {
788        if (name.equals("wasSubstituted")) {
789          throw new FHIRException("Cannot call addChild on a singleton property MedicationDispense.substitution.wasSubstituted");
790        }
791        else if (name.equals("type")) {
792          this.type = new CodeableConcept();
793          return this.type;
794        }
795        else if (name.equals("reason")) {
796          return addReason();
797        }
798        else if (name.equals("responsibleParty")) {
799          this.responsibleParty = new Reference();
800          return this.responsibleParty;
801        }
802        else
803          return super.addChild(name);
804      }
805
806      public MedicationDispenseSubstitutionComponent copy() {
807        MedicationDispenseSubstitutionComponent dst = new MedicationDispenseSubstitutionComponent();
808        copyValues(dst);
809        return dst;
810      }
811
812      public void copyValues(MedicationDispenseSubstitutionComponent dst) {
813        super.copyValues(dst);
814        dst.wasSubstituted = wasSubstituted == null ? null : wasSubstituted.copy();
815        dst.type = type == null ? null : type.copy();
816        if (reason != null) {
817          dst.reason = new ArrayList<CodeableConcept>();
818          for (CodeableConcept i : reason)
819            dst.reason.add(i.copy());
820        };
821        dst.responsibleParty = responsibleParty == null ? null : responsibleParty.copy();
822      }
823
824      @Override
825      public boolean equalsDeep(Base other_) {
826        if (!super.equalsDeep(other_))
827          return false;
828        if (!(other_ instanceof MedicationDispenseSubstitutionComponent))
829          return false;
830        MedicationDispenseSubstitutionComponent o = (MedicationDispenseSubstitutionComponent) other_;
831        return compareDeep(wasSubstituted, o.wasSubstituted, true) && compareDeep(type, o.type, true) && compareDeep(reason, o.reason, true)
832           && compareDeep(responsibleParty, o.responsibleParty, true);
833      }
834
835      @Override
836      public boolean equalsShallow(Base other_) {
837        if (!super.equalsShallow(other_))
838          return false;
839        if (!(other_ instanceof MedicationDispenseSubstitutionComponent))
840          return false;
841        MedicationDispenseSubstitutionComponent o = (MedicationDispenseSubstitutionComponent) other_;
842        return compareValues(wasSubstituted, o.wasSubstituted, true);
843      }
844
845      public boolean isEmpty() {
846        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(wasSubstituted, type, reason
847          , responsibleParty);
848      }
849
850  public String fhirType() {
851    return "MedicationDispense.substitution";
852
853  }
854
855  }
856
857    /**
858     * Identifiers associated with this Medication Dispense 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.
859     */
860    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
861    @Description(shortDefinition="External identifier", formalDefinition="Identifiers associated with this Medication Dispense 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." )
862    protected List<Identifier> identifier;
863
864    /**
865     * A plan that is fulfilled in whole or in part by this MedicationDispense.
866     */
867    @Child(name = "basedOn", type = {CarePlan.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
868    @Description(shortDefinition="Plan that is fulfilled by this dispense", formalDefinition="A plan that is fulfilled in whole or in part by this MedicationDispense." )
869    protected List<Reference> basedOn;
870
871    /**
872     * The procedure or medication administration that triggered the dispense.
873     */
874    @Child(name = "partOf", type = {Procedure.class, MedicationAdministration.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
875    @Description(shortDefinition="Event that dispense is part of", formalDefinition="The procedure or medication administration that triggered the dispense." )
876    protected List<Reference> partOf;
877
878    /**
879     * A code specifying the state of the set of dispense events.
880     */
881    @Child(name = "status", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=true)
882    @Description(shortDefinition="preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown", formalDefinition="A code specifying the state of the set of dispense events." )
883    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationdispense-status")
884    protected Enumeration<MedicationDispenseStatusCodes> status;
885
886    /**
887     * Indicates the reason why a dispense was not performed.
888     */
889    @Child(name = "notPerformedReason", type = {CodeableReference.class}, order=4, min=0, max=1, modifier=false, summary=false)
890    @Description(shortDefinition="Why a dispense was not performed", formalDefinition="Indicates the reason why a dispense was not performed." )
891    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationdispense-status-reason")
892    protected CodeableReference notPerformedReason;
893
894    /**
895     * The date (and maybe time) when the status of the dispense record changed.
896     */
897    @Child(name = "statusChanged", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
898    @Description(shortDefinition="When the status changed", formalDefinition="The date (and maybe time) when the status of the dispense record changed." )
899    protected DateTimeType statusChanged;
900
901    /**
902     * Indicates the type of medication dispense (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).
903     */
904    @Child(name = "category", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
905    @Description(shortDefinition="Type of medication dispense", formalDefinition="Indicates the type of medication dispense (for example, drug classification like ATC, where meds would be administered, legal category of the medication.)." )
906    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationdispense-admin-location")
907    protected List<CodeableConcept> category;
908
909    /**
910     * Identifies the medication supplied. 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.
911     */
912    @Child(name = "medication", type = {CodeableReference.class}, order=7, min=1, max=1, modifier=false, summary=true)
913    @Description(shortDefinition="What medication was supplied", formalDefinition="Identifies the medication supplied. 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." )
914    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes")
915    protected CodeableReference medication;
916
917    /**
918     * A link to a resource representing the person or the group to whom the medication will be given.
919     */
920    @Child(name = "subject", type = {Patient.class, Group.class}, order=8, min=1, max=1, modifier=false, summary=true)
921    @Description(shortDefinition="Who the dispense is for", formalDefinition="A link to a resource representing the person or the group to whom the medication will be given." )
922    protected Reference subject;
923
924    /**
925     * The encounter that establishes the context for this event.
926     */
927    @Child(name = "encounter", type = {Encounter.class}, order=9, min=0, max=1, modifier=false, summary=false)
928    @Description(shortDefinition="Encounter associated with event", formalDefinition="The encounter that establishes the context for this event." )
929    protected Reference encounter;
930
931    /**
932     * Additional information that supports the medication being dispensed.  For example, there may be requirements that a specific lab test has been completed prior to dispensing or the patient's weight at the time of dispensing is documented.
933     */
934    @Child(name = "supportingInformation", type = {Reference.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
935    @Description(shortDefinition="Information that supports the dispensing of the medication", formalDefinition="Additional information that supports the medication being dispensed.  For example, there may be requirements that a specific lab test has been completed prior to dispensing or the patient's weight at the time of dispensing is documented." )
936    protected List<Reference> supportingInformation;
937
938    /**
939     * Indicates who or what performed the event.
940     */
941    @Child(name = "performer", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
942    @Description(shortDefinition="Who performed event", formalDefinition="Indicates who or what performed the event." )
943    protected List<MedicationDispensePerformerComponent> performer;
944
945    /**
946     * The principal physical location where the dispense was performed.
947     */
948    @Child(name = "location", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
949    @Description(shortDefinition="Where the dispense occurred", formalDefinition="The principal physical location where the dispense was performed." )
950    protected Reference location;
951
952    /**
953     * Indicates the medication order that is being dispensed against.
954     */
955    @Child(name = "authorizingPrescription", type = {MedicationRequest.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
956    @Description(shortDefinition="Medication order that authorizes the dispense", formalDefinition="Indicates the medication order that is being dispensed against." )
957    protected List<Reference> authorizingPrescription;
958
959    /**
960     * Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.
961     */
962    @Child(name = "type", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
963    @Description(shortDefinition="Trial fill, partial fill, emergency fill, etc", formalDefinition="Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc." )
964    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActPharmacySupplyType")
965    protected CodeableConcept type;
966
967    /**
968     * The amount of medication that has been dispensed. Includes unit of measure.
969     */
970    @Child(name = "quantity", type = {Quantity.class}, order=15, min=0, max=1, modifier=false, summary=false)
971    @Description(shortDefinition="Amount dispensed", formalDefinition="The amount of medication that has been dispensed. Includes unit of measure." )
972    protected Quantity quantity;
973
974    /**
975     * The amount of medication expressed as a timing amount.
976     */
977    @Child(name = "daysSupply", type = {Quantity.class}, order=16, min=0, max=1, modifier=false, summary=false)
978    @Description(shortDefinition="Amount of medication expressed as a timing amount", formalDefinition="The amount of medication expressed as a timing amount." )
979    protected Quantity daysSupply;
980
981    /**
982     * The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.
983     */
984    @Child(name = "recorded", type = {DateTimeType.class}, order=17, min=0, max=1, modifier=false, summary=false)
985    @Description(shortDefinition="When the recording of the dispense started", formalDefinition="The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated." )
986    protected DateTimeType recorded;
987
988    /**
989     * The time when the dispensed product was packaged and reviewed.
990     */
991    @Child(name = "whenPrepared", type = {DateTimeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
992    @Description(shortDefinition="When product was packaged and reviewed", formalDefinition="The time when the dispensed product was packaged and reviewed." )
993    protected DateTimeType whenPrepared;
994
995    /**
996     * The time the dispensed product was provided to the patient or their representative.
997     */
998    @Child(name = "whenHandedOver", type = {DateTimeType.class}, order=19, min=0, max=1, modifier=false, summary=false)
999    @Description(shortDefinition="When product was given out", formalDefinition="The time the dispensed product was provided to the patient or their representative." )
1000    protected DateTimeType whenHandedOver;
1001
1002    /**
1003     * Identification of the facility/location where the medication was/will be shipped to, as part of the dispense event.
1004     */
1005    @Child(name = "destination", type = {Location.class}, order=20, min=0, max=1, modifier=false, summary=false)
1006    @Description(shortDefinition="Where the medication was/will be sent", formalDefinition="Identification of the facility/location where the medication was/will be shipped to, as part of the dispense event." )
1007    protected Reference destination;
1008
1009    /**
1010     * Identifies the person who picked up the medication or the location of where the medication was delivered.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.
1011     */
1012    @Child(name = "receiver", type = {Patient.class, Practitioner.class, RelatedPerson.class, Location.class, PractitionerRole.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1013    @Description(shortDefinition="Who collected the medication or where the medication was delivered", formalDefinition="Identifies the person who picked up the medication or the location of where the medication was delivered.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location." )
1014    protected List<Reference> receiver;
1015
1016    /**
1017     * Extra information about the dispense that could not be conveyed in the other attributes.
1018     */
1019    @Child(name = "note", type = {Annotation.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1020    @Description(shortDefinition="Information about the dispense", formalDefinition="Extra information about the dispense that could not be conveyed in the other attributes." )
1021    protected List<Annotation> note;
1022
1023    /**
1024     * The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.
1025     */
1026    @Child(name = "renderedDosageInstruction", type = {MarkdownType.class}, order=23, min=0, max=1, modifier=false, summary=false)
1027    @Description(shortDefinition="Full representation of the dosage instructions", formalDefinition="The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses." )
1028    protected MarkdownType renderedDosageInstruction;
1029
1030    /**
1031     * Indicates how the medication is to be used by the patient.
1032     */
1033    @Child(name = "dosageInstruction", type = {Dosage.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1034    @Description(shortDefinition="How the medication is to be used by the patient or administered by the caregiver", formalDefinition="Indicates how the medication is to be used by the patient." )
1035    protected List<Dosage> dosageInstruction;
1036
1037    /**
1038     * Indicates whether or not substitution was made as part of the dispense.  In some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done.
1039     */
1040    @Child(name = "substitution", type = {}, order=25, min=0, max=1, modifier=false, summary=false)
1041    @Description(shortDefinition="Whether a substitution was performed on the dispense", formalDefinition="Indicates whether or not substitution was made as part of the dispense.  In some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done." )
1042    protected MedicationDispenseSubstitutionComponent substitution;
1043
1044    /**
1045     * A summary of the events of interest that have occurred, such as when the dispense was verified.
1046     */
1047    @Child(name = "eventHistory", type = {Provenance.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1048    @Description(shortDefinition="A list of relevant lifecycle events", formalDefinition="A summary of the events of interest that have occurred, such as when the dispense was verified." )
1049    protected List<Reference> eventHistory;
1050
1051    private static final long serialVersionUID = 88138059L;
1052
1053  /**
1054   * Constructor
1055   */
1056    public MedicationDispense() {
1057      super();
1058    }
1059
1060  /**
1061   * Constructor
1062   */
1063    public MedicationDispense(MedicationDispenseStatusCodes status, CodeableReference medication, Reference subject) {
1064      super();
1065      this.setStatus(status);
1066      this.setMedication(medication);
1067      this.setSubject(subject);
1068    }
1069
1070    /**
1071     * @return {@link #identifier} (Identifiers associated with this Medication Dispense that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.)
1072     */
1073    public List<Identifier> getIdentifier() { 
1074      if (this.identifier == null)
1075        this.identifier = new ArrayList<Identifier>();
1076      return this.identifier;
1077    }
1078
1079    /**
1080     * @return Returns a reference to <code>this</code> for easy method chaining
1081     */
1082    public MedicationDispense setIdentifier(List<Identifier> theIdentifier) { 
1083      this.identifier = theIdentifier;
1084      return this;
1085    }
1086
1087    public boolean hasIdentifier() { 
1088      if (this.identifier == null)
1089        return false;
1090      for (Identifier item : this.identifier)
1091        if (!item.isEmpty())
1092          return true;
1093      return false;
1094    }
1095
1096    public Identifier addIdentifier() { //3
1097      Identifier t = new Identifier();
1098      if (this.identifier == null)
1099        this.identifier = new ArrayList<Identifier>();
1100      this.identifier.add(t);
1101      return t;
1102    }
1103
1104    public MedicationDispense addIdentifier(Identifier t) { //3
1105      if (t == null)
1106        return this;
1107      if (this.identifier == null)
1108        this.identifier = new ArrayList<Identifier>();
1109      this.identifier.add(t);
1110      return this;
1111    }
1112
1113    /**
1114     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1115     */
1116    public Identifier getIdentifierFirstRep() { 
1117      if (getIdentifier().isEmpty()) {
1118        addIdentifier();
1119      }
1120      return getIdentifier().get(0);
1121    }
1122
1123    /**
1124     * @return {@link #basedOn} (A plan that is fulfilled in whole or in part by this MedicationDispense.)
1125     */
1126    public List<Reference> getBasedOn() { 
1127      if (this.basedOn == null)
1128        this.basedOn = new ArrayList<Reference>();
1129      return this.basedOn;
1130    }
1131
1132    /**
1133     * @return Returns a reference to <code>this</code> for easy method chaining
1134     */
1135    public MedicationDispense setBasedOn(List<Reference> theBasedOn) { 
1136      this.basedOn = theBasedOn;
1137      return this;
1138    }
1139
1140    public boolean hasBasedOn() { 
1141      if (this.basedOn == null)
1142        return false;
1143      for (Reference item : this.basedOn)
1144        if (!item.isEmpty())
1145          return true;
1146      return false;
1147    }
1148
1149    public Reference addBasedOn() { //3
1150      Reference t = new Reference();
1151      if (this.basedOn == null)
1152        this.basedOn = new ArrayList<Reference>();
1153      this.basedOn.add(t);
1154      return t;
1155    }
1156
1157    public MedicationDispense addBasedOn(Reference t) { //3
1158      if (t == null)
1159        return this;
1160      if (this.basedOn == null)
1161        this.basedOn = new ArrayList<Reference>();
1162      this.basedOn.add(t);
1163      return this;
1164    }
1165
1166    /**
1167     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
1168     */
1169    public Reference getBasedOnFirstRep() { 
1170      if (getBasedOn().isEmpty()) {
1171        addBasedOn();
1172      }
1173      return getBasedOn().get(0);
1174    }
1175
1176    /**
1177     * @return {@link #partOf} (The procedure or medication administration that triggered the dispense.)
1178     */
1179    public List<Reference> getPartOf() { 
1180      if (this.partOf == null)
1181        this.partOf = new ArrayList<Reference>();
1182      return this.partOf;
1183    }
1184
1185    /**
1186     * @return Returns a reference to <code>this</code> for easy method chaining
1187     */
1188    public MedicationDispense setPartOf(List<Reference> thePartOf) { 
1189      this.partOf = thePartOf;
1190      return this;
1191    }
1192
1193    public boolean hasPartOf() { 
1194      if (this.partOf == null)
1195        return false;
1196      for (Reference item : this.partOf)
1197        if (!item.isEmpty())
1198          return true;
1199      return false;
1200    }
1201
1202    public Reference addPartOf() { //3
1203      Reference t = new Reference();
1204      if (this.partOf == null)
1205        this.partOf = new ArrayList<Reference>();
1206      this.partOf.add(t);
1207      return t;
1208    }
1209
1210    public MedicationDispense addPartOf(Reference t) { //3
1211      if (t == null)
1212        return this;
1213      if (this.partOf == null)
1214        this.partOf = new ArrayList<Reference>();
1215      this.partOf.add(t);
1216      return this;
1217    }
1218
1219    /**
1220     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist {3}
1221     */
1222    public Reference getPartOfFirstRep() { 
1223      if (getPartOf().isEmpty()) {
1224        addPartOf();
1225      }
1226      return getPartOf().get(0);
1227    }
1228
1229    /**
1230     * @return {@link #status} (A code specifying the state of the set of dispense events.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1231     */
1232    public Enumeration<MedicationDispenseStatusCodes> getStatusElement() { 
1233      if (this.status == null)
1234        if (Configuration.errorOnAutoCreate())
1235          throw new Error("Attempt to auto-create MedicationDispense.status");
1236        else if (Configuration.doAutoCreate())
1237          this.status = new Enumeration<MedicationDispenseStatusCodes>(new MedicationDispenseStatusCodesEnumFactory()); // bb
1238      return this.status;
1239    }
1240
1241    public boolean hasStatusElement() { 
1242      return this.status != null && !this.status.isEmpty();
1243    }
1244
1245    public boolean hasStatus() { 
1246      return this.status != null && !this.status.isEmpty();
1247    }
1248
1249    /**
1250     * @param value {@link #status} (A code specifying the state of the set of dispense events.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1251     */
1252    public MedicationDispense setStatusElement(Enumeration<MedicationDispenseStatusCodes> value) { 
1253      this.status = value;
1254      return this;
1255    }
1256
1257    /**
1258     * @return A code specifying the state of the set of dispense events.
1259     */
1260    public MedicationDispenseStatusCodes getStatus() { 
1261      return this.status == null ? null : this.status.getValue();
1262    }
1263
1264    /**
1265     * @param value A code specifying the state of the set of dispense events.
1266     */
1267    public MedicationDispense setStatus(MedicationDispenseStatusCodes value) { 
1268        if (this.status == null)
1269          this.status = new Enumeration<MedicationDispenseStatusCodes>(new MedicationDispenseStatusCodesEnumFactory());
1270        this.status.setValue(value);
1271      return this;
1272    }
1273
1274    /**
1275     * @return {@link #notPerformedReason} (Indicates the reason why a dispense was not performed.)
1276     */
1277    public CodeableReference getNotPerformedReason() { 
1278      if (this.notPerformedReason == null)
1279        if (Configuration.errorOnAutoCreate())
1280          throw new Error("Attempt to auto-create MedicationDispense.notPerformedReason");
1281        else if (Configuration.doAutoCreate())
1282          this.notPerformedReason = new CodeableReference(); // cc
1283      return this.notPerformedReason;
1284    }
1285
1286    public boolean hasNotPerformedReason() { 
1287      return this.notPerformedReason != null && !this.notPerformedReason.isEmpty();
1288    }
1289
1290    /**
1291     * @param value {@link #notPerformedReason} (Indicates the reason why a dispense was not performed.)
1292     */
1293    public MedicationDispense setNotPerformedReason(CodeableReference value) { 
1294      this.notPerformedReason = value;
1295      return this;
1296    }
1297
1298    /**
1299     * @return {@link #statusChanged} (The date (and maybe time) when the status of the dispense record changed.). This is the underlying object with id, value and extensions. The accessor "getStatusChanged" gives direct access to the value
1300     */
1301    public DateTimeType getStatusChangedElement() { 
1302      if (this.statusChanged == null)
1303        if (Configuration.errorOnAutoCreate())
1304          throw new Error("Attempt to auto-create MedicationDispense.statusChanged");
1305        else if (Configuration.doAutoCreate())
1306          this.statusChanged = new DateTimeType(); // bb
1307      return this.statusChanged;
1308    }
1309
1310    public boolean hasStatusChangedElement() { 
1311      return this.statusChanged != null && !this.statusChanged.isEmpty();
1312    }
1313
1314    public boolean hasStatusChanged() { 
1315      return this.statusChanged != null && !this.statusChanged.isEmpty();
1316    }
1317
1318    /**
1319     * @param value {@link #statusChanged} (The date (and maybe time) when the status of the dispense record changed.). This is the underlying object with id, value and extensions. The accessor "getStatusChanged" gives direct access to the value
1320     */
1321    public MedicationDispense setStatusChangedElement(DateTimeType value) { 
1322      this.statusChanged = value;
1323      return this;
1324    }
1325
1326    /**
1327     * @return The date (and maybe time) when the status of the dispense record changed.
1328     */
1329    public Date getStatusChanged() { 
1330      return this.statusChanged == null ? null : this.statusChanged.getValue();
1331    }
1332
1333    /**
1334     * @param value The date (and maybe time) when the status of the dispense record changed.
1335     */
1336    public MedicationDispense setStatusChanged(Date value) { 
1337      if (value == null)
1338        this.statusChanged = null;
1339      else {
1340        if (this.statusChanged == null)
1341          this.statusChanged = new DateTimeType();
1342        this.statusChanged.setValue(value);
1343      }
1344      return this;
1345    }
1346
1347    /**
1348     * @return {@link #category} (Indicates the type of medication dispense (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).)
1349     */
1350    public List<CodeableConcept> getCategory() { 
1351      if (this.category == null)
1352        this.category = new ArrayList<CodeableConcept>();
1353      return this.category;
1354    }
1355
1356    /**
1357     * @return Returns a reference to <code>this</code> for easy method chaining
1358     */
1359    public MedicationDispense setCategory(List<CodeableConcept> theCategory) { 
1360      this.category = theCategory;
1361      return this;
1362    }
1363
1364    public boolean hasCategory() { 
1365      if (this.category == null)
1366        return false;
1367      for (CodeableConcept item : this.category)
1368        if (!item.isEmpty())
1369          return true;
1370      return false;
1371    }
1372
1373    public CodeableConcept addCategory() { //3
1374      CodeableConcept t = new CodeableConcept();
1375      if (this.category == null)
1376        this.category = new ArrayList<CodeableConcept>();
1377      this.category.add(t);
1378      return t;
1379    }
1380
1381    public MedicationDispense addCategory(CodeableConcept t) { //3
1382      if (t == null)
1383        return this;
1384      if (this.category == null)
1385        this.category = new ArrayList<CodeableConcept>();
1386      this.category.add(t);
1387      return this;
1388    }
1389
1390    /**
1391     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
1392     */
1393    public CodeableConcept getCategoryFirstRep() { 
1394      if (getCategory().isEmpty()) {
1395        addCategory();
1396      }
1397      return getCategory().get(0);
1398    }
1399
1400    /**
1401     * @return {@link #medication} (Identifies the medication supplied. 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.)
1402     */
1403    public CodeableReference getMedication() { 
1404      if (this.medication == null)
1405        if (Configuration.errorOnAutoCreate())
1406          throw new Error("Attempt to auto-create MedicationDispense.medication");
1407        else if (Configuration.doAutoCreate())
1408          this.medication = new CodeableReference(); // cc
1409      return this.medication;
1410    }
1411
1412    public boolean hasMedication() { 
1413      return this.medication != null && !this.medication.isEmpty();
1414    }
1415
1416    /**
1417     * @param value {@link #medication} (Identifies the medication supplied. 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.)
1418     */
1419    public MedicationDispense setMedication(CodeableReference value) { 
1420      this.medication = value;
1421      return this;
1422    }
1423
1424    /**
1425     * @return {@link #subject} (A link to a resource representing the person or the group to whom the medication will be given.)
1426     */
1427    public Reference getSubject() { 
1428      if (this.subject == null)
1429        if (Configuration.errorOnAutoCreate())
1430          throw new Error("Attempt to auto-create MedicationDispense.subject");
1431        else if (Configuration.doAutoCreate())
1432          this.subject = new Reference(); // cc
1433      return this.subject;
1434    }
1435
1436    public boolean hasSubject() { 
1437      return this.subject != null && !this.subject.isEmpty();
1438    }
1439
1440    /**
1441     * @param value {@link #subject} (A link to a resource representing the person or the group to whom the medication will be given.)
1442     */
1443    public MedicationDispense setSubject(Reference value) { 
1444      this.subject = value;
1445      return this;
1446    }
1447
1448    /**
1449     * @return {@link #encounter} (The encounter that establishes the context for this event.)
1450     */
1451    public Reference getEncounter() { 
1452      if (this.encounter == null)
1453        if (Configuration.errorOnAutoCreate())
1454          throw new Error("Attempt to auto-create MedicationDispense.encounter");
1455        else if (Configuration.doAutoCreate())
1456          this.encounter = new Reference(); // cc
1457      return this.encounter;
1458    }
1459
1460    public boolean hasEncounter() { 
1461      return this.encounter != null && !this.encounter.isEmpty();
1462    }
1463
1464    /**
1465     * @param value {@link #encounter} (The encounter that establishes the context for this event.)
1466     */
1467    public MedicationDispense setEncounter(Reference value) { 
1468      this.encounter = value;
1469      return this;
1470    }
1471
1472    /**
1473     * @return {@link #supportingInformation} (Additional information that supports the medication being dispensed.  For example, there may be requirements that a specific lab test has been completed prior to dispensing or the patient's weight at the time of dispensing is documented.)
1474     */
1475    public List<Reference> getSupportingInformation() { 
1476      if (this.supportingInformation == null)
1477        this.supportingInformation = new ArrayList<Reference>();
1478      return this.supportingInformation;
1479    }
1480
1481    /**
1482     * @return Returns a reference to <code>this</code> for easy method chaining
1483     */
1484    public MedicationDispense setSupportingInformation(List<Reference> theSupportingInformation) { 
1485      this.supportingInformation = theSupportingInformation;
1486      return this;
1487    }
1488
1489    public boolean hasSupportingInformation() { 
1490      if (this.supportingInformation == null)
1491        return false;
1492      for (Reference item : this.supportingInformation)
1493        if (!item.isEmpty())
1494          return true;
1495      return false;
1496    }
1497
1498    public Reference addSupportingInformation() { //3
1499      Reference t = new Reference();
1500      if (this.supportingInformation == null)
1501        this.supportingInformation = new ArrayList<Reference>();
1502      this.supportingInformation.add(t);
1503      return t;
1504    }
1505
1506    public MedicationDispense addSupportingInformation(Reference t) { //3
1507      if (t == null)
1508        return this;
1509      if (this.supportingInformation == null)
1510        this.supportingInformation = new ArrayList<Reference>();
1511      this.supportingInformation.add(t);
1512      return this;
1513    }
1514
1515    /**
1516     * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist {3}
1517     */
1518    public Reference getSupportingInformationFirstRep() { 
1519      if (getSupportingInformation().isEmpty()) {
1520        addSupportingInformation();
1521      }
1522      return getSupportingInformation().get(0);
1523    }
1524
1525    /**
1526     * @return {@link #performer} (Indicates who or what performed the event.)
1527     */
1528    public List<MedicationDispensePerformerComponent> getPerformer() { 
1529      if (this.performer == null)
1530        this.performer = new ArrayList<MedicationDispensePerformerComponent>();
1531      return this.performer;
1532    }
1533
1534    /**
1535     * @return Returns a reference to <code>this</code> for easy method chaining
1536     */
1537    public MedicationDispense setPerformer(List<MedicationDispensePerformerComponent> thePerformer) { 
1538      this.performer = thePerformer;
1539      return this;
1540    }
1541
1542    public boolean hasPerformer() { 
1543      if (this.performer == null)
1544        return false;
1545      for (MedicationDispensePerformerComponent item : this.performer)
1546        if (!item.isEmpty())
1547          return true;
1548      return false;
1549    }
1550
1551    public MedicationDispensePerformerComponent addPerformer() { //3
1552      MedicationDispensePerformerComponent t = new MedicationDispensePerformerComponent();
1553      if (this.performer == null)
1554        this.performer = new ArrayList<MedicationDispensePerformerComponent>();
1555      this.performer.add(t);
1556      return t;
1557    }
1558
1559    public MedicationDispense addPerformer(MedicationDispensePerformerComponent t) { //3
1560      if (t == null)
1561        return this;
1562      if (this.performer == null)
1563        this.performer = new ArrayList<MedicationDispensePerformerComponent>();
1564      this.performer.add(t);
1565      return this;
1566    }
1567
1568    /**
1569     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist {3}
1570     */
1571    public MedicationDispensePerformerComponent getPerformerFirstRep() { 
1572      if (getPerformer().isEmpty()) {
1573        addPerformer();
1574      }
1575      return getPerformer().get(0);
1576    }
1577
1578    /**
1579     * @return {@link #location} (The principal physical location where the dispense was performed.)
1580     */
1581    public Reference getLocation() { 
1582      if (this.location == null)
1583        if (Configuration.errorOnAutoCreate())
1584          throw new Error("Attempt to auto-create MedicationDispense.location");
1585        else if (Configuration.doAutoCreate())
1586          this.location = new Reference(); // cc
1587      return this.location;
1588    }
1589
1590    public boolean hasLocation() { 
1591      return this.location != null && !this.location.isEmpty();
1592    }
1593
1594    /**
1595     * @param value {@link #location} (The principal physical location where the dispense was performed.)
1596     */
1597    public MedicationDispense setLocation(Reference value) { 
1598      this.location = value;
1599      return this;
1600    }
1601
1602    /**
1603     * @return {@link #authorizingPrescription} (Indicates the medication order that is being dispensed against.)
1604     */
1605    public List<Reference> getAuthorizingPrescription() { 
1606      if (this.authorizingPrescription == null)
1607        this.authorizingPrescription = new ArrayList<Reference>();
1608      return this.authorizingPrescription;
1609    }
1610
1611    /**
1612     * @return Returns a reference to <code>this</code> for easy method chaining
1613     */
1614    public MedicationDispense setAuthorizingPrescription(List<Reference> theAuthorizingPrescription) { 
1615      this.authorizingPrescription = theAuthorizingPrescription;
1616      return this;
1617    }
1618
1619    public boolean hasAuthorizingPrescription() { 
1620      if (this.authorizingPrescription == null)
1621        return false;
1622      for (Reference item : this.authorizingPrescription)
1623        if (!item.isEmpty())
1624          return true;
1625      return false;
1626    }
1627
1628    public Reference addAuthorizingPrescription() { //3
1629      Reference t = new Reference();
1630      if (this.authorizingPrescription == null)
1631        this.authorizingPrescription = new ArrayList<Reference>();
1632      this.authorizingPrescription.add(t);
1633      return t;
1634    }
1635
1636    public MedicationDispense addAuthorizingPrescription(Reference t) { //3
1637      if (t == null)
1638        return this;
1639      if (this.authorizingPrescription == null)
1640        this.authorizingPrescription = new ArrayList<Reference>();
1641      this.authorizingPrescription.add(t);
1642      return this;
1643    }
1644
1645    /**
1646     * @return The first repetition of repeating field {@link #authorizingPrescription}, creating it if it does not already exist {3}
1647     */
1648    public Reference getAuthorizingPrescriptionFirstRep() { 
1649      if (getAuthorizingPrescription().isEmpty()) {
1650        addAuthorizingPrescription();
1651      }
1652      return getAuthorizingPrescription().get(0);
1653    }
1654
1655    /**
1656     * @return {@link #type} (Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.)
1657     */
1658    public CodeableConcept getType() { 
1659      if (this.type == null)
1660        if (Configuration.errorOnAutoCreate())
1661          throw new Error("Attempt to auto-create MedicationDispense.type");
1662        else if (Configuration.doAutoCreate())
1663          this.type = new CodeableConcept(); // cc
1664      return this.type;
1665    }
1666
1667    public boolean hasType() { 
1668      return this.type != null && !this.type.isEmpty();
1669    }
1670
1671    /**
1672     * @param value {@link #type} (Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.)
1673     */
1674    public MedicationDispense setType(CodeableConcept value) { 
1675      this.type = value;
1676      return this;
1677    }
1678
1679    /**
1680     * @return {@link #quantity} (The amount of medication that has been dispensed. Includes unit of measure.)
1681     */
1682    public Quantity getQuantity() { 
1683      if (this.quantity == null)
1684        if (Configuration.errorOnAutoCreate())
1685          throw new Error("Attempt to auto-create MedicationDispense.quantity");
1686        else if (Configuration.doAutoCreate())
1687          this.quantity = new Quantity(); // cc
1688      return this.quantity;
1689    }
1690
1691    public boolean hasQuantity() { 
1692      return this.quantity != null && !this.quantity.isEmpty();
1693    }
1694
1695    /**
1696     * @param value {@link #quantity} (The amount of medication that has been dispensed. Includes unit of measure.)
1697     */
1698    public MedicationDispense setQuantity(Quantity value) { 
1699      this.quantity = value;
1700      return this;
1701    }
1702
1703    /**
1704     * @return {@link #daysSupply} (The amount of medication expressed as a timing amount.)
1705     */
1706    public Quantity getDaysSupply() { 
1707      if (this.daysSupply == null)
1708        if (Configuration.errorOnAutoCreate())
1709          throw new Error("Attempt to auto-create MedicationDispense.daysSupply");
1710        else if (Configuration.doAutoCreate())
1711          this.daysSupply = new Quantity(); // cc
1712      return this.daysSupply;
1713    }
1714
1715    public boolean hasDaysSupply() { 
1716      return this.daysSupply != null && !this.daysSupply.isEmpty();
1717    }
1718
1719    /**
1720     * @param value {@link #daysSupply} (The amount of medication expressed as a timing amount.)
1721     */
1722    public MedicationDispense setDaysSupply(Quantity value) { 
1723      this.daysSupply = value;
1724      return this;
1725    }
1726
1727    /**
1728     * @return {@link #recorded} (The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
1729     */
1730    public DateTimeType getRecordedElement() { 
1731      if (this.recorded == null)
1732        if (Configuration.errorOnAutoCreate())
1733          throw new Error("Attempt to auto-create MedicationDispense.recorded");
1734        else if (Configuration.doAutoCreate())
1735          this.recorded = new DateTimeType(); // bb
1736      return this.recorded;
1737    }
1738
1739    public boolean hasRecordedElement() { 
1740      return this.recorded != null && !this.recorded.isEmpty();
1741    }
1742
1743    public boolean hasRecorded() { 
1744      return this.recorded != null && !this.recorded.isEmpty();
1745    }
1746
1747    /**
1748     * @param value {@link #recorded} (The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
1749     */
1750    public MedicationDispense setRecordedElement(DateTimeType value) { 
1751      this.recorded = value;
1752      return this;
1753    }
1754
1755    /**
1756     * @return The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.
1757     */
1758    public Date getRecorded() { 
1759      return this.recorded == null ? null : this.recorded.getValue();
1760    }
1761
1762    /**
1763     * @param value The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.
1764     */
1765    public MedicationDispense setRecorded(Date value) { 
1766      if (value == null)
1767        this.recorded = null;
1768      else {
1769        if (this.recorded == null)
1770          this.recorded = new DateTimeType();
1771        this.recorded.setValue(value);
1772      }
1773      return this;
1774    }
1775
1776    /**
1777     * @return {@link #whenPrepared} (The time when the dispensed product was packaged and reviewed.). This is the underlying object with id, value and extensions. The accessor "getWhenPrepared" gives direct access to the value
1778     */
1779    public DateTimeType getWhenPreparedElement() { 
1780      if (this.whenPrepared == null)
1781        if (Configuration.errorOnAutoCreate())
1782          throw new Error("Attempt to auto-create MedicationDispense.whenPrepared");
1783        else if (Configuration.doAutoCreate())
1784          this.whenPrepared = new DateTimeType(); // bb
1785      return this.whenPrepared;
1786    }
1787
1788    public boolean hasWhenPreparedElement() { 
1789      return this.whenPrepared != null && !this.whenPrepared.isEmpty();
1790    }
1791
1792    public boolean hasWhenPrepared() { 
1793      return this.whenPrepared != null && !this.whenPrepared.isEmpty();
1794    }
1795
1796    /**
1797     * @param value {@link #whenPrepared} (The time when the dispensed product was packaged and reviewed.). This is the underlying object with id, value and extensions. The accessor "getWhenPrepared" gives direct access to the value
1798     */
1799    public MedicationDispense setWhenPreparedElement(DateTimeType value) { 
1800      this.whenPrepared = value;
1801      return this;
1802    }
1803
1804    /**
1805     * @return The time when the dispensed product was packaged and reviewed.
1806     */
1807    public Date getWhenPrepared() { 
1808      return this.whenPrepared == null ? null : this.whenPrepared.getValue();
1809    }
1810
1811    /**
1812     * @param value The time when the dispensed product was packaged and reviewed.
1813     */
1814    public MedicationDispense setWhenPrepared(Date value) { 
1815      if (value == null)
1816        this.whenPrepared = null;
1817      else {
1818        if (this.whenPrepared == null)
1819          this.whenPrepared = new DateTimeType();
1820        this.whenPrepared.setValue(value);
1821      }
1822      return this;
1823    }
1824
1825    /**
1826     * @return {@link #whenHandedOver} (The time the dispensed product was provided to the patient or their representative.). This is the underlying object with id, value and extensions. The accessor "getWhenHandedOver" gives direct access to the value
1827     */
1828    public DateTimeType getWhenHandedOverElement() { 
1829      if (this.whenHandedOver == null)
1830        if (Configuration.errorOnAutoCreate())
1831          throw new Error("Attempt to auto-create MedicationDispense.whenHandedOver");
1832        else if (Configuration.doAutoCreate())
1833          this.whenHandedOver = new DateTimeType(); // bb
1834      return this.whenHandedOver;
1835    }
1836
1837    public boolean hasWhenHandedOverElement() { 
1838      return this.whenHandedOver != null && !this.whenHandedOver.isEmpty();
1839    }
1840
1841    public boolean hasWhenHandedOver() { 
1842      return this.whenHandedOver != null && !this.whenHandedOver.isEmpty();
1843    }
1844
1845    /**
1846     * @param value {@link #whenHandedOver} (The time the dispensed product was provided to the patient or their representative.). This is the underlying object with id, value and extensions. The accessor "getWhenHandedOver" gives direct access to the value
1847     */
1848    public MedicationDispense setWhenHandedOverElement(DateTimeType value) { 
1849      this.whenHandedOver = value;
1850      return this;
1851    }
1852
1853    /**
1854     * @return The time the dispensed product was provided to the patient or their representative.
1855     */
1856    public Date getWhenHandedOver() { 
1857      return this.whenHandedOver == null ? null : this.whenHandedOver.getValue();
1858    }
1859
1860    /**
1861     * @param value The time the dispensed product was provided to the patient or their representative.
1862     */
1863    public MedicationDispense setWhenHandedOver(Date value) { 
1864      if (value == null)
1865        this.whenHandedOver = null;
1866      else {
1867        if (this.whenHandedOver == null)
1868          this.whenHandedOver = new DateTimeType();
1869        this.whenHandedOver.setValue(value);
1870      }
1871      return this;
1872    }
1873
1874    /**
1875     * @return {@link #destination} (Identification of the facility/location where the medication was/will be shipped to, as part of the dispense event.)
1876     */
1877    public Reference getDestination() { 
1878      if (this.destination == null)
1879        if (Configuration.errorOnAutoCreate())
1880          throw new Error("Attempt to auto-create MedicationDispense.destination");
1881        else if (Configuration.doAutoCreate())
1882          this.destination = new Reference(); // cc
1883      return this.destination;
1884    }
1885
1886    public boolean hasDestination() { 
1887      return this.destination != null && !this.destination.isEmpty();
1888    }
1889
1890    /**
1891     * @param value {@link #destination} (Identification of the facility/location where the medication was/will be shipped to, as part of the dispense event.)
1892     */
1893    public MedicationDispense setDestination(Reference value) { 
1894      this.destination = value;
1895      return this;
1896    }
1897
1898    /**
1899     * @return {@link #receiver} (Identifies the person who picked up the medication or the location of where the medication was delivered.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.)
1900     */
1901    public List<Reference> getReceiver() { 
1902      if (this.receiver == null)
1903        this.receiver = new ArrayList<Reference>();
1904      return this.receiver;
1905    }
1906
1907    /**
1908     * @return Returns a reference to <code>this</code> for easy method chaining
1909     */
1910    public MedicationDispense setReceiver(List<Reference> theReceiver) { 
1911      this.receiver = theReceiver;
1912      return this;
1913    }
1914
1915    public boolean hasReceiver() { 
1916      if (this.receiver == null)
1917        return false;
1918      for (Reference item : this.receiver)
1919        if (!item.isEmpty())
1920          return true;
1921      return false;
1922    }
1923
1924    public Reference addReceiver() { //3
1925      Reference t = new Reference();
1926      if (this.receiver == null)
1927        this.receiver = new ArrayList<Reference>();
1928      this.receiver.add(t);
1929      return t;
1930    }
1931
1932    public MedicationDispense addReceiver(Reference t) { //3
1933      if (t == null)
1934        return this;
1935      if (this.receiver == null)
1936        this.receiver = new ArrayList<Reference>();
1937      this.receiver.add(t);
1938      return this;
1939    }
1940
1941    /**
1942     * @return The first repetition of repeating field {@link #receiver}, creating it if it does not already exist {3}
1943     */
1944    public Reference getReceiverFirstRep() { 
1945      if (getReceiver().isEmpty()) {
1946        addReceiver();
1947      }
1948      return getReceiver().get(0);
1949    }
1950
1951    /**
1952     * @return {@link #note} (Extra information about the dispense that could not be conveyed in the other attributes.)
1953     */
1954    public List<Annotation> getNote() { 
1955      if (this.note == null)
1956        this.note = new ArrayList<Annotation>();
1957      return this.note;
1958    }
1959
1960    /**
1961     * @return Returns a reference to <code>this</code> for easy method chaining
1962     */
1963    public MedicationDispense setNote(List<Annotation> theNote) { 
1964      this.note = theNote;
1965      return this;
1966    }
1967
1968    public boolean hasNote() { 
1969      if (this.note == null)
1970        return false;
1971      for (Annotation item : this.note)
1972        if (!item.isEmpty())
1973          return true;
1974      return false;
1975    }
1976
1977    public Annotation addNote() { //3
1978      Annotation t = new Annotation();
1979      if (this.note == null)
1980        this.note = new ArrayList<Annotation>();
1981      this.note.add(t);
1982      return t;
1983    }
1984
1985    public MedicationDispense addNote(Annotation t) { //3
1986      if (t == null)
1987        return this;
1988      if (this.note == null)
1989        this.note = new ArrayList<Annotation>();
1990      this.note.add(t);
1991      return this;
1992    }
1993
1994    /**
1995     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1996     */
1997    public Annotation getNoteFirstRep() { 
1998      if (getNote().isEmpty()) {
1999        addNote();
2000      }
2001      return getNote().get(0);
2002    }
2003
2004    /**
2005     * @return {@link #renderedDosageInstruction} (The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.). This is the underlying object with id, value and extensions. The accessor "getRenderedDosageInstruction" gives direct access to the value
2006     */
2007    public MarkdownType getRenderedDosageInstructionElement() { 
2008      if (this.renderedDosageInstruction == null)
2009        if (Configuration.errorOnAutoCreate())
2010          throw new Error("Attempt to auto-create MedicationDispense.renderedDosageInstruction");
2011        else if (Configuration.doAutoCreate())
2012          this.renderedDosageInstruction = new MarkdownType(); // bb
2013      return this.renderedDosageInstruction;
2014    }
2015
2016    public boolean hasRenderedDosageInstructionElement() { 
2017      return this.renderedDosageInstruction != null && !this.renderedDosageInstruction.isEmpty();
2018    }
2019
2020    public boolean hasRenderedDosageInstruction() { 
2021      return this.renderedDosageInstruction != null && !this.renderedDosageInstruction.isEmpty();
2022    }
2023
2024    /**
2025     * @param value {@link #renderedDosageInstruction} (The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.). This is the underlying object with id, value and extensions. The accessor "getRenderedDosageInstruction" gives direct access to the value
2026     */
2027    public MedicationDispense setRenderedDosageInstructionElement(MarkdownType value) { 
2028      this.renderedDosageInstruction = value;
2029      return this;
2030    }
2031
2032    /**
2033     * @return The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.
2034     */
2035    public String getRenderedDosageInstruction() { 
2036      return this.renderedDosageInstruction == null ? null : this.renderedDosageInstruction.getValue();
2037    }
2038
2039    /**
2040     * @param value The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.
2041     */
2042    public MedicationDispense setRenderedDosageInstruction(String value) { 
2043      if (Utilities.noString(value))
2044        this.renderedDosageInstruction = null;
2045      else {
2046        if (this.renderedDosageInstruction == null)
2047          this.renderedDosageInstruction = new MarkdownType();
2048        this.renderedDosageInstruction.setValue(value);
2049      }
2050      return this;
2051    }
2052
2053    /**
2054     * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient.)
2055     */
2056    public List<Dosage> getDosageInstruction() { 
2057      if (this.dosageInstruction == null)
2058        this.dosageInstruction = new ArrayList<Dosage>();
2059      return this.dosageInstruction;
2060    }
2061
2062    /**
2063     * @return Returns a reference to <code>this</code> for easy method chaining
2064     */
2065    public MedicationDispense setDosageInstruction(List<Dosage> theDosageInstruction) { 
2066      this.dosageInstruction = theDosageInstruction;
2067      return this;
2068    }
2069
2070    public boolean hasDosageInstruction() { 
2071      if (this.dosageInstruction == null)
2072        return false;
2073      for (Dosage item : this.dosageInstruction)
2074        if (!item.isEmpty())
2075          return true;
2076      return false;
2077    }
2078
2079    public Dosage addDosageInstruction() { //3
2080      Dosage t = new Dosage();
2081      if (this.dosageInstruction == null)
2082        this.dosageInstruction = new ArrayList<Dosage>();
2083      this.dosageInstruction.add(t);
2084      return t;
2085    }
2086
2087    public MedicationDispense addDosageInstruction(Dosage t) { //3
2088      if (t == null)
2089        return this;
2090      if (this.dosageInstruction == null)
2091        this.dosageInstruction = new ArrayList<Dosage>();
2092      this.dosageInstruction.add(t);
2093      return this;
2094    }
2095
2096    /**
2097     * @return The first repetition of repeating field {@link #dosageInstruction}, creating it if it does not already exist {3}
2098     */
2099    public Dosage getDosageInstructionFirstRep() { 
2100      if (getDosageInstruction().isEmpty()) {
2101        addDosageInstruction();
2102      }
2103      return getDosageInstruction().get(0);
2104    }
2105
2106    /**
2107     * @return {@link #substitution} (Indicates whether or not substitution was made as part of the dispense.  In some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done.)
2108     */
2109    public MedicationDispenseSubstitutionComponent getSubstitution() { 
2110      if (this.substitution == null)
2111        if (Configuration.errorOnAutoCreate())
2112          throw new Error("Attempt to auto-create MedicationDispense.substitution");
2113        else if (Configuration.doAutoCreate())
2114          this.substitution = new MedicationDispenseSubstitutionComponent(); // cc
2115      return this.substitution;
2116    }
2117
2118    public boolean hasSubstitution() { 
2119      return this.substitution != null && !this.substitution.isEmpty();
2120    }
2121
2122    /**
2123     * @param value {@link #substitution} (Indicates whether or not substitution was made as part of the dispense.  In some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done.)
2124     */
2125    public MedicationDispense setSubstitution(MedicationDispenseSubstitutionComponent value) { 
2126      this.substitution = value;
2127      return this;
2128    }
2129
2130    /**
2131     * @return {@link #eventHistory} (A summary of the events of interest that have occurred, such as when the dispense was verified.)
2132     */
2133    public List<Reference> getEventHistory() { 
2134      if (this.eventHistory == null)
2135        this.eventHistory = new ArrayList<Reference>();
2136      return this.eventHistory;
2137    }
2138
2139    /**
2140     * @return Returns a reference to <code>this</code> for easy method chaining
2141     */
2142    public MedicationDispense setEventHistory(List<Reference> theEventHistory) { 
2143      this.eventHistory = theEventHistory;
2144      return this;
2145    }
2146
2147    public boolean hasEventHistory() { 
2148      if (this.eventHistory == null)
2149        return false;
2150      for (Reference item : this.eventHistory)
2151        if (!item.isEmpty())
2152          return true;
2153      return false;
2154    }
2155
2156    public Reference addEventHistory() { //3
2157      Reference t = new Reference();
2158      if (this.eventHistory == null)
2159        this.eventHistory = new ArrayList<Reference>();
2160      this.eventHistory.add(t);
2161      return t;
2162    }
2163
2164    public MedicationDispense addEventHistory(Reference t) { //3
2165      if (t == null)
2166        return this;
2167      if (this.eventHistory == null)
2168        this.eventHistory = new ArrayList<Reference>();
2169      this.eventHistory.add(t);
2170      return this;
2171    }
2172
2173    /**
2174     * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist {3}
2175     */
2176    public Reference getEventHistoryFirstRep() { 
2177      if (getEventHistory().isEmpty()) {
2178        addEventHistory();
2179      }
2180      return getEventHistory().get(0);
2181    }
2182
2183      protected void listChildren(List<Property> children) {
2184        super.listChildren(children);
2185        children.add(new Property("identifier", "Identifier", "Identifiers associated with this Medication Dispense 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));
2186        children.add(new Property("basedOn", "Reference(CarePlan)", "A plan that is fulfilled in whole or in part by this MedicationDispense.", 0, java.lang.Integer.MAX_VALUE, basedOn));
2187        children.add(new Property("partOf", "Reference(Procedure|MedicationAdministration)", "The procedure or medication administration that triggered the dispense.", 0, java.lang.Integer.MAX_VALUE, partOf));
2188        children.add(new Property("status", "code", "A code specifying the state of the set of dispense events.", 0, 1, status));
2189        children.add(new Property("notPerformedReason", "CodeableReference(DetectedIssue)", "Indicates the reason why a dispense was not performed.", 0, 1, notPerformedReason));
2190        children.add(new Property("statusChanged", "dateTime", "The date (and maybe time) when the status of the dispense record changed.", 0, 1, statusChanged));
2191        children.add(new Property("category", "CodeableConcept", "Indicates the type of medication dispense (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).", 0, java.lang.Integer.MAX_VALUE, category));
2192        children.add(new Property("medication", "CodeableReference(Medication)", "Identifies the medication supplied. 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));
2193        children.add(new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or the group to whom the medication will be given.", 0, 1, subject));
2194        children.add(new Property("encounter", "Reference(Encounter)", "The encounter that establishes the context for this event.", 0, 1, encounter));
2195        children.add(new Property("supportingInformation", "Reference(Any)", "Additional information that supports the medication being dispensed.  For example, there may be requirements that a specific lab test has been completed prior to dispensing or the patient's weight at the time of dispensing is documented.", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
2196        children.add(new Property("performer", "", "Indicates who or what performed the event.", 0, java.lang.Integer.MAX_VALUE, performer));
2197        children.add(new Property("location", "Reference(Location)", "The principal physical location where the dispense was performed.", 0, 1, location));
2198        children.add(new Property("authorizingPrescription", "Reference(MedicationRequest)", "Indicates the medication order that is being dispensed against.", 0, java.lang.Integer.MAX_VALUE, authorizingPrescription));
2199        children.add(new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.", 0, 1, type));
2200        children.add(new Property("quantity", "Quantity", "The amount of medication that has been dispensed. Includes unit of measure.", 0, 1, quantity));
2201        children.add(new Property("daysSupply", "Quantity", "The amount of medication expressed as a timing amount.", 0, 1, daysSupply));
2202        children.add(new Property("recorded", "dateTime", "The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.", 0, 1, recorded));
2203        children.add(new Property("whenPrepared", "dateTime", "The time when the dispensed product was packaged and reviewed.", 0, 1, whenPrepared));
2204        children.add(new Property("whenHandedOver", "dateTime", "The time the dispensed product was provided to the patient or their representative.", 0, 1, whenHandedOver));
2205        children.add(new Property("destination", "Reference(Location)", "Identification of the facility/location where the medication was/will be shipped to, as part of the dispense event.", 0, 1, destination));
2206        children.add(new Property("receiver", "Reference(Patient|Practitioner|RelatedPerson|Location|PractitionerRole)", "Identifies the person who picked up the medication or the location of where the medication was delivered.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.", 0, java.lang.Integer.MAX_VALUE, receiver));
2207        children.add(new Property("note", "Annotation", "Extra information about the dispense that could not be conveyed in the other attributes.", 0, java.lang.Integer.MAX_VALUE, note));
2208        children.add(new Property("renderedDosageInstruction", "markdown", "The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.", 0, 1, renderedDosageInstruction));
2209        children.add(new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction));
2210        children.add(new Property("substitution", "", "Indicates whether or not substitution was made as part of the dispense.  In some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done.", 0, 1, substitution));
2211        children.add(new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the dispense was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory));
2212      }
2213
2214      @Override
2215      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2216        switch (_hash) {
2217        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers associated with this Medication Dispense 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);
2218        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan)", "A plan that is fulfilled in whole or in part by this MedicationDispense.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2219        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Procedure|MedicationAdministration)", "The procedure or medication administration that triggered the dispense.", 0, java.lang.Integer.MAX_VALUE, partOf);
2220        case -892481550: /*status*/  return new Property("status", "code", "A code specifying the state of the set of dispense events.", 0, 1, status);
2221        case -820839727: /*notPerformedReason*/  return new Property("notPerformedReason", "CodeableReference(DetectedIssue)", "Indicates the reason why a dispense was not performed.", 0, 1, notPerformedReason);
2222        case -1174686110: /*statusChanged*/  return new Property("statusChanged", "dateTime", "The date (and maybe time) when the status of the dispense record changed.", 0, 1, statusChanged);
2223        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Indicates the type of medication dispense (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).", 0, java.lang.Integer.MAX_VALUE, category);
2224        case 1998965455: /*medication*/  return new Property("medication", "CodeableReference(Medication)", "Identifies the medication supplied. 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);
2225        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or the group to whom the medication will be given.", 0, 1, subject);
2226        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The encounter that establishes the context for this event.", 0, 1, encounter);
2227        case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "Reference(Any)", "Additional information that supports the medication being dispensed.  For example, there may be requirements that a specific lab test has been completed prior to dispensing or the patient's weight at the time of dispensing is documented.", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
2228        case 481140686: /*performer*/  return new Property("performer", "", "Indicates who or what performed the event.", 0, java.lang.Integer.MAX_VALUE, performer);
2229        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The principal physical location where the dispense was performed.", 0, 1, location);
2230        case -1237557856: /*authorizingPrescription*/  return new Property("authorizingPrescription", "Reference(MedicationRequest)", "Indicates the medication order that is being dispensed against.", 0, java.lang.Integer.MAX_VALUE, authorizingPrescription);
2231        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.", 0, 1, type);
2232        case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount of medication that has been dispensed. Includes unit of measure.", 0, 1, quantity);
2233        case 197175334: /*daysSupply*/  return new Property("daysSupply", "Quantity", "The amount of medication expressed as a timing amount.", 0, 1, daysSupply);
2234        case -799233872: /*recorded*/  return new Property("recorded", "dateTime", "The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.", 0, 1, recorded);
2235        case -562837097: /*whenPrepared*/  return new Property("whenPrepared", "dateTime", "The time when the dispensed product was packaged and reviewed.", 0, 1, whenPrepared);
2236        case -940241380: /*whenHandedOver*/  return new Property("whenHandedOver", "dateTime", "The time the dispensed product was provided to the patient or their representative.", 0, 1, whenHandedOver);
2237        case -1429847026: /*destination*/  return new Property("destination", "Reference(Location)", "Identification of the facility/location where the medication was/will be shipped to, as part of the dispense event.", 0, 1, destination);
2238        case -808719889: /*receiver*/  return new Property("receiver", "Reference(Patient|Practitioner|RelatedPerson|Location|PractitionerRole)", "Identifies the person who picked up the medication or the location of where the medication was delivered.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.", 0, java.lang.Integer.MAX_VALUE, receiver);
2239        case 3387378: /*note*/  return new Property("note", "Annotation", "Extra information about the dispense that could not be conveyed in the other attributes.", 0, java.lang.Integer.MAX_VALUE, note);
2240        case 1718902050: /*renderedDosageInstruction*/  return new Property("renderedDosageInstruction", "markdown", "The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.", 0, 1, renderedDosageInstruction);
2241        case -1201373865: /*dosageInstruction*/  return new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction);
2242        case 826147581: /*substitution*/  return new Property("substitution", "", "Indicates whether or not substitution was made as part of the dispense.  In some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done.", 0, 1, substitution);
2243        case 1835190426: /*eventHistory*/  return new Property("eventHistory", "Reference(Provenance)", "A summary of the events of interest that have occurred, such as when the dispense was verified.", 0, java.lang.Integer.MAX_VALUE, eventHistory);
2244        default: return super.getNamedProperty(_hash, _name, _checkValid);
2245        }
2246
2247      }
2248
2249      @Override
2250      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2251        switch (hash) {
2252        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2253        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2254        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2255        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationDispenseStatusCodes>
2256        case -820839727: /*notPerformedReason*/ return this.notPerformedReason == null ? new Base[0] : new Base[] {this.notPerformedReason}; // CodeableReference
2257        case -1174686110: /*statusChanged*/ return this.statusChanged == null ? new Base[0] : new Base[] {this.statusChanged}; // DateTimeType
2258        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2259        case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // CodeableReference
2260        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2261        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2262        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
2263        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // MedicationDispensePerformerComponent
2264        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2265        case -1237557856: /*authorizingPrescription*/ return this.authorizingPrescription == null ? new Base[0] : this.authorizingPrescription.toArray(new Base[this.authorizingPrescription.size()]); // Reference
2266        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2267        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
2268        case 197175334: /*daysSupply*/ return this.daysSupply == null ? new Base[0] : new Base[] {this.daysSupply}; // Quantity
2269        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // DateTimeType
2270        case -562837097: /*whenPrepared*/ return this.whenPrepared == null ? new Base[0] : new Base[] {this.whenPrepared}; // DateTimeType
2271        case -940241380: /*whenHandedOver*/ return this.whenHandedOver == null ? new Base[0] : new Base[] {this.whenHandedOver}; // DateTimeType
2272        case -1429847026: /*destination*/ return this.destination == null ? new Base[0] : new Base[] {this.destination}; // Reference
2273        case -808719889: /*receiver*/ return this.receiver == null ? new Base[0] : this.receiver.toArray(new Base[this.receiver.size()]); // Reference
2274        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2275        case 1718902050: /*renderedDosageInstruction*/ return this.renderedDosageInstruction == null ? new Base[0] : new Base[] {this.renderedDosageInstruction}; // MarkdownType
2276        case -1201373865: /*dosageInstruction*/ return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // Dosage
2277        case 826147581: /*substitution*/ return this.substitution == null ? new Base[0] : new Base[] {this.substitution}; // MedicationDispenseSubstitutionComponent
2278        case 1835190426: /*eventHistory*/ return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference
2279        default: return super.getProperty(hash, name, checkValid);
2280        }
2281
2282      }
2283
2284      @Override
2285      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2286        switch (hash) {
2287        case -1618432855: // identifier
2288          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2289          return value;
2290        case -332612366: // basedOn
2291          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
2292          return value;
2293        case -995410646: // partOf
2294          this.getPartOf().add(TypeConvertor.castToReference(value)); // Reference
2295          return value;
2296        case -892481550: // status
2297          value = new MedicationDispenseStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
2298          this.status = (Enumeration) value; // Enumeration<MedicationDispenseStatusCodes>
2299          return value;
2300        case -820839727: // notPerformedReason
2301          this.notPerformedReason = TypeConvertor.castToCodeableReference(value); // CodeableReference
2302          return value;
2303        case -1174686110: // statusChanged
2304          this.statusChanged = TypeConvertor.castToDateTime(value); // DateTimeType
2305          return value;
2306        case 50511102: // category
2307          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2308          return value;
2309        case 1998965455: // medication
2310          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
2311          return value;
2312        case -1867885268: // subject
2313          this.subject = TypeConvertor.castToReference(value); // Reference
2314          return value;
2315        case 1524132147: // encounter
2316          this.encounter = TypeConvertor.castToReference(value); // Reference
2317          return value;
2318        case -1248768647: // supportingInformation
2319          this.getSupportingInformation().add(TypeConvertor.castToReference(value)); // Reference
2320          return value;
2321        case 481140686: // performer
2322          this.getPerformer().add((MedicationDispensePerformerComponent) value); // MedicationDispensePerformerComponent
2323          return value;
2324        case 1901043637: // location
2325          this.location = TypeConvertor.castToReference(value); // Reference
2326          return value;
2327        case -1237557856: // authorizingPrescription
2328          this.getAuthorizingPrescription().add(TypeConvertor.castToReference(value)); // Reference
2329          return value;
2330        case 3575610: // type
2331          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2332          return value;
2333        case -1285004149: // quantity
2334          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
2335          return value;
2336        case 197175334: // daysSupply
2337          this.daysSupply = TypeConvertor.castToQuantity(value); // Quantity
2338          return value;
2339        case -799233872: // recorded
2340          this.recorded = TypeConvertor.castToDateTime(value); // DateTimeType
2341          return value;
2342        case -562837097: // whenPrepared
2343          this.whenPrepared = TypeConvertor.castToDateTime(value); // DateTimeType
2344          return value;
2345        case -940241380: // whenHandedOver
2346          this.whenHandedOver = TypeConvertor.castToDateTime(value); // DateTimeType
2347          return value;
2348        case -1429847026: // destination
2349          this.destination = TypeConvertor.castToReference(value); // Reference
2350          return value;
2351        case -808719889: // receiver
2352          this.getReceiver().add(TypeConvertor.castToReference(value)); // Reference
2353          return value;
2354        case 3387378: // note
2355          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
2356          return value;
2357        case 1718902050: // renderedDosageInstruction
2358          this.renderedDosageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType
2359          return value;
2360        case -1201373865: // dosageInstruction
2361          this.getDosageInstruction().add(TypeConvertor.castToDosage(value)); // Dosage
2362          return value;
2363        case 826147581: // substitution
2364          this.substitution = (MedicationDispenseSubstitutionComponent) value; // MedicationDispenseSubstitutionComponent
2365          return value;
2366        case 1835190426: // eventHistory
2367          this.getEventHistory().add(TypeConvertor.castToReference(value)); // Reference
2368          return value;
2369        default: return super.setProperty(hash, name, value);
2370        }
2371
2372      }
2373
2374      @Override
2375      public Base setProperty(String name, Base value) throws FHIRException {
2376        if (name.equals("identifier")) {
2377          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2378        } else if (name.equals("basedOn")) {
2379          this.getBasedOn().add(TypeConvertor.castToReference(value));
2380        } else if (name.equals("partOf")) {
2381          this.getPartOf().add(TypeConvertor.castToReference(value));
2382        } else if (name.equals("status")) {
2383          value = new MedicationDispenseStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
2384          this.status = (Enumeration) value; // Enumeration<MedicationDispenseStatusCodes>
2385        } else if (name.equals("notPerformedReason")) {
2386          this.notPerformedReason = TypeConvertor.castToCodeableReference(value); // CodeableReference
2387        } else if (name.equals("statusChanged")) {
2388          this.statusChanged = TypeConvertor.castToDateTime(value); // DateTimeType
2389        } else if (name.equals("category")) {
2390          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
2391        } else if (name.equals("medication")) {
2392          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
2393        } else if (name.equals("subject")) {
2394          this.subject = TypeConvertor.castToReference(value); // Reference
2395        } else if (name.equals("encounter")) {
2396          this.encounter = TypeConvertor.castToReference(value); // Reference
2397        } else if (name.equals("supportingInformation")) {
2398          this.getSupportingInformation().add(TypeConvertor.castToReference(value));
2399        } else if (name.equals("performer")) {
2400          this.getPerformer().add((MedicationDispensePerformerComponent) value);
2401        } else if (name.equals("location")) {
2402          this.location = TypeConvertor.castToReference(value); // Reference
2403        } else if (name.equals("authorizingPrescription")) {
2404          this.getAuthorizingPrescription().add(TypeConvertor.castToReference(value));
2405        } else if (name.equals("type")) {
2406          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2407        } else if (name.equals("quantity")) {
2408          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
2409        } else if (name.equals("daysSupply")) {
2410          this.daysSupply = TypeConvertor.castToQuantity(value); // Quantity
2411        } else if (name.equals("recorded")) {
2412          this.recorded = TypeConvertor.castToDateTime(value); // DateTimeType
2413        } else if (name.equals("whenPrepared")) {
2414          this.whenPrepared = TypeConvertor.castToDateTime(value); // DateTimeType
2415        } else if (name.equals("whenHandedOver")) {
2416          this.whenHandedOver = TypeConvertor.castToDateTime(value); // DateTimeType
2417        } else if (name.equals("destination")) {
2418          this.destination = TypeConvertor.castToReference(value); // Reference
2419        } else if (name.equals("receiver")) {
2420          this.getReceiver().add(TypeConvertor.castToReference(value));
2421        } else if (name.equals("note")) {
2422          this.getNote().add(TypeConvertor.castToAnnotation(value));
2423        } else if (name.equals("renderedDosageInstruction")) {
2424          this.renderedDosageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType
2425        } else if (name.equals("dosageInstruction")) {
2426          this.getDosageInstruction().add(TypeConvertor.castToDosage(value));
2427        } else if (name.equals("substitution")) {
2428          this.substitution = (MedicationDispenseSubstitutionComponent) value; // MedicationDispenseSubstitutionComponent
2429        } else if (name.equals("eventHistory")) {
2430          this.getEventHistory().add(TypeConvertor.castToReference(value));
2431        } else
2432          return super.setProperty(name, value);
2433        return value;
2434      }
2435
2436  @Override
2437  public void removeChild(String name, Base value) throws FHIRException {
2438        if (name.equals("identifier")) {
2439          this.getIdentifier().remove(value);
2440        } else if (name.equals("basedOn")) {
2441          this.getBasedOn().remove(value);
2442        } else if (name.equals("partOf")) {
2443          this.getPartOf().remove(value);
2444        } else if (name.equals("status")) {
2445          value = new MedicationDispenseStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
2446          this.status = (Enumeration) value; // Enumeration<MedicationDispenseStatusCodes>
2447        } else if (name.equals("notPerformedReason")) {
2448          this.notPerformedReason = null;
2449        } else if (name.equals("statusChanged")) {
2450          this.statusChanged = null;
2451        } else if (name.equals("category")) {
2452          this.getCategory().remove(value);
2453        } else if (name.equals("medication")) {
2454          this.medication = null;
2455        } else if (name.equals("subject")) {
2456          this.subject = null;
2457        } else if (name.equals("encounter")) {
2458          this.encounter = null;
2459        } else if (name.equals("supportingInformation")) {
2460          this.getSupportingInformation().remove(value);
2461        } else if (name.equals("performer")) {
2462          this.getPerformer().remove((MedicationDispensePerformerComponent) value);
2463        } else if (name.equals("location")) {
2464          this.location = null;
2465        } else if (name.equals("authorizingPrescription")) {
2466          this.getAuthorizingPrescription().remove(value);
2467        } else if (name.equals("type")) {
2468          this.type = null;
2469        } else if (name.equals("quantity")) {
2470          this.quantity = null;
2471        } else if (name.equals("daysSupply")) {
2472          this.daysSupply = null;
2473        } else if (name.equals("recorded")) {
2474          this.recorded = null;
2475        } else if (name.equals("whenPrepared")) {
2476          this.whenPrepared = null;
2477        } else if (name.equals("whenHandedOver")) {
2478          this.whenHandedOver = null;
2479        } else if (name.equals("destination")) {
2480          this.destination = null;
2481        } else if (name.equals("receiver")) {
2482          this.getReceiver().remove(value);
2483        } else if (name.equals("note")) {
2484          this.getNote().remove(value);
2485        } else if (name.equals("renderedDosageInstruction")) {
2486          this.renderedDosageInstruction = null;
2487        } else if (name.equals("dosageInstruction")) {
2488          this.getDosageInstruction().remove(value);
2489        } else if (name.equals("substitution")) {
2490          this.substitution = (MedicationDispenseSubstitutionComponent) value; // MedicationDispenseSubstitutionComponent
2491        } else if (name.equals("eventHistory")) {
2492          this.getEventHistory().remove(value);
2493        } else
2494          super.removeChild(name, value);
2495        
2496      }
2497
2498      @Override
2499      public Base makeProperty(int hash, String name) throws FHIRException {
2500        switch (hash) {
2501        case -1618432855:  return addIdentifier(); 
2502        case -332612366:  return addBasedOn(); 
2503        case -995410646:  return addPartOf(); 
2504        case -892481550:  return getStatusElement();
2505        case -820839727:  return getNotPerformedReason();
2506        case -1174686110:  return getStatusChangedElement();
2507        case 50511102:  return addCategory(); 
2508        case 1998965455:  return getMedication();
2509        case -1867885268:  return getSubject();
2510        case 1524132147:  return getEncounter();
2511        case -1248768647:  return addSupportingInformation(); 
2512        case 481140686:  return addPerformer(); 
2513        case 1901043637:  return getLocation();
2514        case -1237557856:  return addAuthorizingPrescription(); 
2515        case 3575610:  return getType();
2516        case -1285004149:  return getQuantity();
2517        case 197175334:  return getDaysSupply();
2518        case -799233872:  return getRecordedElement();
2519        case -562837097:  return getWhenPreparedElement();
2520        case -940241380:  return getWhenHandedOverElement();
2521        case -1429847026:  return getDestination();
2522        case -808719889:  return addReceiver(); 
2523        case 3387378:  return addNote(); 
2524        case 1718902050:  return getRenderedDosageInstructionElement();
2525        case -1201373865:  return addDosageInstruction(); 
2526        case 826147581:  return getSubstitution();
2527        case 1835190426:  return addEventHistory(); 
2528        default: return super.makeProperty(hash, name);
2529        }
2530
2531      }
2532
2533      @Override
2534      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2535        switch (hash) {
2536        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2537        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2538        case -995410646: /*partOf*/ return new String[] {"Reference"};
2539        case -892481550: /*status*/ return new String[] {"code"};
2540        case -820839727: /*notPerformedReason*/ return new String[] {"CodeableReference"};
2541        case -1174686110: /*statusChanged*/ return new String[] {"dateTime"};
2542        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2543        case 1998965455: /*medication*/ return new String[] {"CodeableReference"};
2544        case -1867885268: /*subject*/ return new String[] {"Reference"};
2545        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2546        case -1248768647: /*supportingInformation*/ return new String[] {"Reference"};
2547        case 481140686: /*performer*/ return new String[] {};
2548        case 1901043637: /*location*/ return new String[] {"Reference"};
2549        case -1237557856: /*authorizingPrescription*/ return new String[] {"Reference"};
2550        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2551        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
2552        case 197175334: /*daysSupply*/ return new String[] {"Quantity"};
2553        case -799233872: /*recorded*/ return new String[] {"dateTime"};
2554        case -562837097: /*whenPrepared*/ return new String[] {"dateTime"};
2555        case -940241380: /*whenHandedOver*/ return new String[] {"dateTime"};
2556        case -1429847026: /*destination*/ return new String[] {"Reference"};
2557        case -808719889: /*receiver*/ return new String[] {"Reference"};
2558        case 3387378: /*note*/ return new String[] {"Annotation"};
2559        case 1718902050: /*renderedDosageInstruction*/ return new String[] {"markdown"};
2560        case -1201373865: /*dosageInstruction*/ return new String[] {"Dosage"};
2561        case 826147581: /*substitution*/ return new String[] {};
2562        case 1835190426: /*eventHistory*/ return new String[] {"Reference"};
2563        default: return super.getTypesForProperty(hash, name);
2564        }
2565
2566      }
2567
2568      @Override
2569      public Base addChild(String name) throws FHIRException {
2570        if (name.equals("identifier")) {
2571          return addIdentifier();
2572        }
2573        else if (name.equals("basedOn")) {
2574          return addBasedOn();
2575        }
2576        else if (name.equals("partOf")) {
2577          return addPartOf();
2578        }
2579        else if (name.equals("status")) {
2580          throw new FHIRException("Cannot call addChild on a singleton property MedicationDispense.status");
2581        }
2582        else if (name.equals("notPerformedReason")) {
2583          this.notPerformedReason = new CodeableReference();
2584          return this.notPerformedReason;
2585        }
2586        else if (name.equals("statusChanged")) {
2587          throw new FHIRException("Cannot call addChild on a singleton property MedicationDispense.statusChanged");
2588        }
2589        else if (name.equals("category")) {
2590          return addCategory();
2591        }
2592        else if (name.equals("medication")) {
2593          this.medication = new CodeableReference();
2594          return this.medication;
2595        }
2596        else if (name.equals("subject")) {
2597          this.subject = new Reference();
2598          return this.subject;
2599        }
2600        else if (name.equals("encounter")) {
2601          this.encounter = new Reference();
2602          return this.encounter;
2603        }
2604        else if (name.equals("supportingInformation")) {
2605          return addSupportingInformation();
2606        }
2607        else if (name.equals("performer")) {
2608          return addPerformer();
2609        }
2610        else if (name.equals("location")) {
2611          this.location = new Reference();
2612          return this.location;
2613        }
2614        else if (name.equals("authorizingPrescription")) {
2615          return addAuthorizingPrescription();
2616        }
2617        else if (name.equals("type")) {
2618          this.type = new CodeableConcept();
2619          return this.type;
2620        }
2621        else if (name.equals("quantity")) {
2622          this.quantity = new Quantity();
2623          return this.quantity;
2624        }
2625        else if (name.equals("daysSupply")) {
2626          this.daysSupply = new Quantity();
2627          return this.daysSupply;
2628        }
2629        else if (name.equals("recorded")) {
2630          throw new FHIRException("Cannot call addChild on a singleton property MedicationDispense.recorded");
2631        }
2632        else if (name.equals("whenPrepared")) {
2633          throw new FHIRException("Cannot call addChild on a singleton property MedicationDispense.whenPrepared");
2634        }
2635        else if (name.equals("whenHandedOver")) {
2636          throw new FHIRException("Cannot call addChild on a singleton property MedicationDispense.whenHandedOver");
2637        }
2638        else if (name.equals("destination")) {
2639          this.destination = new Reference();
2640          return this.destination;
2641        }
2642        else if (name.equals("receiver")) {
2643          return addReceiver();
2644        }
2645        else if (name.equals("note")) {
2646          return addNote();
2647        }
2648        else if (name.equals("renderedDosageInstruction")) {
2649          throw new FHIRException("Cannot call addChild on a singleton property MedicationDispense.renderedDosageInstruction");
2650        }
2651        else if (name.equals("dosageInstruction")) {
2652          return addDosageInstruction();
2653        }
2654        else if (name.equals("substitution")) {
2655          this.substitution = new MedicationDispenseSubstitutionComponent();
2656          return this.substitution;
2657        }
2658        else if (name.equals("eventHistory")) {
2659          return addEventHistory();
2660        }
2661        else
2662          return super.addChild(name);
2663      }
2664
2665  public String fhirType() {
2666    return "MedicationDispense";
2667
2668  }
2669
2670      public MedicationDispense copy() {
2671        MedicationDispense dst = new MedicationDispense();
2672        copyValues(dst);
2673        return dst;
2674      }
2675
2676      public void copyValues(MedicationDispense dst) {
2677        super.copyValues(dst);
2678        if (identifier != null) {
2679          dst.identifier = new ArrayList<Identifier>();
2680          for (Identifier i : identifier)
2681            dst.identifier.add(i.copy());
2682        };
2683        if (basedOn != null) {
2684          dst.basedOn = new ArrayList<Reference>();
2685          for (Reference i : basedOn)
2686            dst.basedOn.add(i.copy());
2687        };
2688        if (partOf != null) {
2689          dst.partOf = new ArrayList<Reference>();
2690          for (Reference i : partOf)
2691            dst.partOf.add(i.copy());
2692        };
2693        dst.status = status == null ? null : status.copy();
2694        dst.notPerformedReason = notPerformedReason == null ? null : notPerformedReason.copy();
2695        dst.statusChanged = statusChanged == null ? null : statusChanged.copy();
2696        if (category != null) {
2697          dst.category = new ArrayList<CodeableConcept>();
2698          for (CodeableConcept i : category)
2699            dst.category.add(i.copy());
2700        };
2701        dst.medication = medication == null ? null : medication.copy();
2702        dst.subject = subject == null ? null : subject.copy();
2703        dst.encounter = encounter == null ? null : encounter.copy();
2704        if (supportingInformation != null) {
2705          dst.supportingInformation = new ArrayList<Reference>();
2706          for (Reference i : supportingInformation)
2707            dst.supportingInformation.add(i.copy());
2708        };
2709        if (performer != null) {
2710          dst.performer = new ArrayList<MedicationDispensePerformerComponent>();
2711          for (MedicationDispensePerformerComponent i : performer)
2712            dst.performer.add(i.copy());
2713        };
2714        dst.location = location == null ? null : location.copy();
2715        if (authorizingPrescription != null) {
2716          dst.authorizingPrescription = new ArrayList<Reference>();
2717          for (Reference i : authorizingPrescription)
2718            dst.authorizingPrescription.add(i.copy());
2719        };
2720        dst.type = type == null ? null : type.copy();
2721        dst.quantity = quantity == null ? null : quantity.copy();
2722        dst.daysSupply = daysSupply == null ? null : daysSupply.copy();
2723        dst.recorded = recorded == null ? null : recorded.copy();
2724        dst.whenPrepared = whenPrepared == null ? null : whenPrepared.copy();
2725        dst.whenHandedOver = whenHandedOver == null ? null : whenHandedOver.copy();
2726        dst.destination = destination == null ? null : destination.copy();
2727        if (receiver != null) {
2728          dst.receiver = new ArrayList<Reference>();
2729          for (Reference i : receiver)
2730            dst.receiver.add(i.copy());
2731        };
2732        if (note != null) {
2733          dst.note = new ArrayList<Annotation>();
2734          for (Annotation i : note)
2735            dst.note.add(i.copy());
2736        };
2737        dst.renderedDosageInstruction = renderedDosageInstruction == null ? null : renderedDosageInstruction.copy();
2738        if (dosageInstruction != null) {
2739          dst.dosageInstruction = new ArrayList<Dosage>();
2740          for (Dosage i : dosageInstruction)
2741            dst.dosageInstruction.add(i.copy());
2742        };
2743        dst.substitution = substitution == null ? null : substitution.copy();
2744        if (eventHistory != null) {
2745          dst.eventHistory = new ArrayList<Reference>();
2746          for (Reference i : eventHistory)
2747            dst.eventHistory.add(i.copy());
2748        };
2749      }
2750
2751      protected MedicationDispense typedCopy() {
2752        return copy();
2753      }
2754
2755      @Override
2756      public boolean equalsDeep(Base other_) {
2757        if (!super.equalsDeep(other_))
2758          return false;
2759        if (!(other_ instanceof MedicationDispense))
2760          return false;
2761        MedicationDispense o = (MedicationDispense) other_;
2762        return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(partOf, o.partOf, true)
2763           && compareDeep(status, o.status, true) && compareDeep(notPerformedReason, o.notPerformedReason, true)
2764           && compareDeep(statusChanged, o.statusChanged, true) && compareDeep(category, o.category, true)
2765           && compareDeep(medication, o.medication, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
2766           && compareDeep(supportingInformation, o.supportingInformation, true) && compareDeep(performer, o.performer, true)
2767           && compareDeep(location, o.location, true) && compareDeep(authorizingPrescription, o.authorizingPrescription, true)
2768           && compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true) && compareDeep(daysSupply, o.daysSupply, true)
2769           && compareDeep(recorded, o.recorded, true) && compareDeep(whenPrepared, o.whenPrepared, true) && compareDeep(whenHandedOver, o.whenHandedOver, true)
2770           && compareDeep(destination, o.destination, true) && compareDeep(receiver, o.receiver, true) && compareDeep(note, o.note, true)
2771           && compareDeep(renderedDosageInstruction, o.renderedDosageInstruction, true) && compareDeep(dosageInstruction, o.dosageInstruction, true)
2772           && compareDeep(substitution, o.substitution, true) && compareDeep(eventHistory, o.eventHistory, true)
2773          ;
2774      }
2775
2776      @Override
2777      public boolean equalsShallow(Base other_) {
2778        if (!super.equalsShallow(other_))
2779          return false;
2780        if (!(other_ instanceof MedicationDispense))
2781          return false;
2782        MedicationDispense o = (MedicationDispense) other_;
2783        return compareValues(status, o.status, true) && compareValues(statusChanged, o.statusChanged, true)
2784           && compareValues(recorded, o.recorded, true) && compareValues(whenPrepared, o.whenPrepared, true) && compareValues(whenHandedOver, o.whenHandedOver, true)
2785           && compareValues(renderedDosageInstruction, o.renderedDosageInstruction, true);
2786      }
2787
2788      public boolean isEmpty() {
2789        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, partOf
2790          , status, notPerformedReason, statusChanged, category, medication, subject, encounter
2791          , supportingInformation, performer, location, authorizingPrescription, type, quantity
2792          , daysSupply, recorded, whenPrepared, whenHandedOver, destination, receiver, note
2793          , renderedDosageInstruction, dosageInstruction, substitution, eventHistory);
2794      }
2795
2796  @Override
2797  public ResourceType getResourceType() {
2798    return ResourceType.MedicationDispense;
2799   }
2800
2801 /**
2802   * Search parameter: <b>destination</b>
2803   * <p>
2804   * Description: <b>Returns dispenses that should be sent to a specific destination</b><br>
2805   * Type: <b>reference</b><br>
2806   * Path: <b>MedicationDispense.destination</b><br>
2807   * </p>
2808   */
2809  @SearchParamDefinition(name="destination", path="MedicationDispense.destination", description="Returns dispenses that should be sent to a specific destination", type="reference", target={Location.class } )
2810  public static final String SP_DESTINATION = "destination";
2811 /**
2812   * <b>Fluent Client</b> search parameter constant for <b>destination</b>
2813   * <p>
2814   * Description: <b>Returns dispenses that should be sent to a specific destination</b><br>
2815   * Type: <b>reference</b><br>
2816   * Path: <b>MedicationDispense.destination</b><br>
2817   * </p>
2818   */
2819  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DESTINATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DESTINATION);
2820
2821/**
2822   * Constant for fluent queries to be used to add include statements. Specifies
2823   * the path value of "<b>MedicationDispense:destination</b>".
2824   */
2825  public static final ca.uhn.fhir.model.api.Include INCLUDE_DESTINATION = new ca.uhn.fhir.model.api.Include("MedicationDispense:destination").toLocked();
2826
2827 /**
2828   * Search parameter: <b>location</b>
2829   * <p>
2830   * Description: <b>Returns dispense for a given location</b><br>
2831   * Type: <b>reference</b><br>
2832   * Path: <b>MedicationDispense.location</b><br>
2833   * </p>
2834   */
2835  @SearchParamDefinition(name="location", path="MedicationDispense.location", description="Returns dispense for a given location", type="reference", target={Location.class } )
2836  public static final String SP_LOCATION = "location";
2837 /**
2838   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2839   * <p>
2840   * Description: <b>Returns dispense for a given location</b><br>
2841   * Type: <b>reference</b><br>
2842   * Path: <b>MedicationDispense.location</b><br>
2843   * </p>
2844   */
2845  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2846
2847/**
2848   * Constant for fluent queries to be used to add include statements. Specifies
2849   * the path value of "<b>MedicationDispense:location</b>".
2850   */
2851  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("MedicationDispense:location").toLocked();
2852
2853 /**
2854   * Search parameter: <b>performer</b>
2855   * <p>
2856   * Description: <b>Returns dispenses performed by a specific individual</b><br>
2857   * Type: <b>reference</b><br>
2858   * Path: <b>MedicationDispense.performer.actor</b><br>
2859   * </p>
2860   */
2861  @SearchParamDefinition(name="performer", path="MedicationDispense.performer.actor", description="Returns dispenses performed by a specific individual", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2862  public static final String SP_PERFORMER = "performer";
2863 /**
2864   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2865   * <p>
2866   * Description: <b>Returns dispenses performed by a specific individual</b><br>
2867   * Type: <b>reference</b><br>
2868   * Path: <b>MedicationDispense.performer.actor</b><br>
2869   * </p>
2870   */
2871  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
2872
2873/**
2874   * Constant for fluent queries to be used to add include statements. Specifies
2875   * the path value of "<b>MedicationDispense:performer</b>".
2876   */
2877  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("MedicationDispense:performer").toLocked();
2878
2879 /**
2880   * Search parameter: <b>receiver</b>
2881   * <p>
2882   * Description: <b>The identity of a receiver to list dispenses for</b><br>
2883   * Type: <b>reference</b><br>
2884   * Path: <b>MedicationDispense.receiver</b><br>
2885   * </p>
2886   */
2887  @SearchParamDefinition(name="receiver", path="MedicationDispense.receiver", description="The identity of a receiver to list dispenses for", 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") }, target={Location.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2888  public static final String SP_RECEIVER = "receiver";
2889 /**
2890   * <b>Fluent Client</b> search parameter constant for <b>receiver</b>
2891   * <p>
2892   * Description: <b>The identity of a receiver to list dispenses for</b><br>
2893   * Type: <b>reference</b><br>
2894   * Path: <b>MedicationDispense.receiver</b><br>
2895   * </p>
2896   */
2897  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECEIVER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECEIVER);
2898
2899/**
2900   * Constant for fluent queries to be used to add include statements. Specifies
2901   * the path value of "<b>MedicationDispense:receiver</b>".
2902   */
2903  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECEIVER = new ca.uhn.fhir.model.api.Include("MedicationDispense:receiver").toLocked();
2904
2905 /**
2906   * Search parameter: <b>recorded</b>
2907   * <p>
2908   * Description: <b>Returns dispenses where dispensing activity began on this date</b><br>
2909   * Type: <b>date</b><br>
2910   * Path: <b>MedicationDispense.recorded</b><br>
2911   * </p>
2912   */
2913  @SearchParamDefinition(name="recorded", path="MedicationDispense.recorded", description="Returns dispenses where dispensing activity began on this date", type="date" )
2914  public static final String SP_RECORDED = "recorded";
2915 /**
2916   * <b>Fluent Client</b> search parameter constant for <b>recorded</b>
2917   * <p>
2918   * Description: <b>Returns dispenses where dispensing activity began on this date</b><br>
2919   * Type: <b>date</b><br>
2920   * Path: <b>MedicationDispense.recorded</b><br>
2921   * </p>
2922   */
2923  public static final ca.uhn.fhir.rest.gclient.DateClientParam RECORDED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_RECORDED);
2924
2925 /**
2926   * Search parameter: <b>responsibleparty</b>
2927   * <p>
2928   * Description: <b>Returns dispenses with the specified responsible party</b><br>
2929   * Type: <b>reference</b><br>
2930   * Path: <b>MedicationDispense.substitution.responsibleParty</b><br>
2931   * </p>
2932   */
2933  @SearchParamDefinition(name="responsibleparty", path="MedicationDispense.substitution.responsibleParty", description="Returns dispenses with the specified responsible party", type="reference", target={Organization.class, Practitioner.class, PractitionerRole.class } )
2934  public static final String SP_RESPONSIBLEPARTY = "responsibleparty";
2935 /**
2936   * <b>Fluent Client</b> search parameter constant for <b>responsibleparty</b>
2937   * <p>
2938   * Description: <b>Returns dispenses with the specified responsible party</b><br>
2939   * Type: <b>reference</b><br>
2940   * Path: <b>MedicationDispense.substitution.responsibleParty</b><br>
2941   * </p>
2942   */
2943  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESPONSIBLEPARTY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESPONSIBLEPARTY);
2944
2945/**
2946   * Constant for fluent queries to be used to add include statements. Specifies
2947   * the path value of "<b>MedicationDispense:responsibleparty</b>".
2948   */
2949  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESPONSIBLEPARTY = new ca.uhn.fhir.model.api.Include("MedicationDispense:responsibleparty").toLocked();
2950
2951 /**
2952   * Search parameter: <b>subject</b>
2953   * <p>
2954   * Description: <b>The identity of a patient for whom to list dispenses</b><br>
2955   * Type: <b>reference</b><br>
2956   * Path: <b>MedicationDispense.subject</b><br>
2957   * </p>
2958   */
2959  @SearchParamDefinition(name="subject", path="MedicationDispense.subject", description="The identity of a patient for whom to list dispenses", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Group.class, Patient.class } )
2960  public static final String SP_SUBJECT = "subject";
2961 /**
2962   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2963   * <p>
2964   * Description: <b>The identity of a patient for whom to list dispenses</b><br>
2965   * Type: <b>reference</b><br>
2966   * Path: <b>MedicationDispense.subject</b><br>
2967   * </p>
2968   */
2969  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2970
2971/**
2972   * Constant for fluent queries to be used to add include statements. Specifies
2973   * the path value of "<b>MedicationDispense:subject</b>".
2974   */
2975  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicationDispense:subject").toLocked();
2976
2977 /**
2978   * Search parameter: <b>whenhandedover</b>
2979   * <p>
2980   * Description: <b>Returns dispenses handed over on this date</b><br>
2981   * Type: <b>date</b><br>
2982   * Path: <b>MedicationDispense.whenHandedOver</b><br>
2983   * </p>
2984   */
2985  @SearchParamDefinition(name="whenhandedover", path="MedicationDispense.whenHandedOver", description="Returns dispenses handed over on this date", type="date" )
2986  public static final String SP_WHENHANDEDOVER = "whenhandedover";
2987 /**
2988   * <b>Fluent Client</b> search parameter constant for <b>whenhandedover</b>
2989   * <p>
2990   * Description: <b>Returns dispenses handed over on this date</b><br>
2991   * Type: <b>date</b><br>
2992   * Path: <b>MedicationDispense.whenHandedOver</b><br>
2993   * </p>
2994   */
2995  public static final ca.uhn.fhir.rest.gclient.DateClientParam WHENHANDEDOVER = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHENHANDEDOVER);
2996
2997 /**
2998   * Search parameter: <b>whenprepared</b>
2999   * <p>
3000   * Description: <b>Returns dispenses prepared on this date</b><br>
3001   * Type: <b>date</b><br>
3002   * Path: <b>MedicationDispense.whenPrepared</b><br>
3003   * </p>
3004   */
3005  @SearchParamDefinition(name="whenprepared", path="MedicationDispense.whenPrepared", description="Returns dispenses prepared on this date", type="date" )
3006  public static final String SP_WHENPREPARED = "whenprepared";
3007 /**
3008   * <b>Fluent Client</b> search parameter constant for <b>whenprepared</b>
3009   * <p>
3010   * Description: <b>Returns dispenses prepared on this date</b><br>
3011   * Type: <b>date</b><br>
3012   * Path: <b>MedicationDispense.whenPrepared</b><br>
3013   * </p>
3014   */
3015  public static final ca.uhn.fhir.rest.gclient.DateClientParam WHENPREPARED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHENPREPARED);
3016
3017 /**
3018   * Search parameter: <b>code</b>
3019   * <p>
3020   * Description: <b>Multiple Resources: 
3021
3022* [AdverseEvent](adverseevent.html): Event or incident that occurred or was averted
3023* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
3024* [AuditEvent](auditevent.html): More specific code for the event
3025* [Basic](basic.html): Kind of Resource
3026* [ChargeItem](chargeitem.html): A code that identifies the charge, like a billing code
3027* [Condition](condition.html): Code for the condition
3028* [DetectedIssue](detectedissue.html): Issue Type, e.g. drug-drug, duplicate therapy, etc.
3029* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
3030* [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
3031* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
3032* [ImagingSelection](imagingselection.html): The imaging selection status
3033* [List](list.html): What the purpose of this list is
3034* [Medication](medication.html): Returns medications for a specific code
3035* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
3036* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
3037* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
3038* [MedicationStatement](medicationstatement.html): Return statements of this medication code
3039* [NutritionIntake](nutritionintake.html): Returns statements of this code of NutritionIntake
3040* [Observation](observation.html): The code of the observation type
3041* [Procedure](procedure.html): A code to identify a  procedure
3042* [RequestOrchestration](requestorchestration.html): The code of the request orchestration
3043* [Task](task.html): Search by task code
3044</b><br>
3045   * Type: <b>token</b><br>
3046   * Path: <b>AdverseEvent.code | AllergyIntolerance.code | AllergyIntolerance.reaction.substance | AuditEvent.code | Basic.code | ChargeItem.code | Condition.code | DetectedIssue.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | ImagingSelection.status | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationStatement.medication.concept | NutritionIntake.code | Observation.code | Procedure.code | RequestOrchestration.code | Task.code</b><br>
3047   * </p>
3048   */
3049  @SearchParamDefinition(name="code", path="AdverseEvent.code | AllergyIntolerance.code | AllergyIntolerance.reaction.substance | AuditEvent.code | Basic.code | ChargeItem.code | Condition.code | DetectedIssue.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | ImagingSelection.status | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationStatement.medication.concept | NutritionIntake.code | Observation.code | Procedure.code | RequestOrchestration.code | Task.code", description="Multiple Resources: \r\n\r\n* [AdverseEvent](adverseevent.html): Event or incident that occurred or was averted\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [AuditEvent](auditevent.html): More specific code for the event\r\n* [Basic](basic.html): Kind of Resource\r\n* [ChargeItem](chargeitem.html): A code that identifies the charge, like a billing code\r\n* [Condition](condition.html): Code for the condition\r\n* [DetectedIssue](detectedissue.html): Issue Type, e.g. drug-drug, duplicate therapy, etc.\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* [ImagingSelection](imagingselection.html): The imaging selection status\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* [NutritionIntake](nutritionintake.html): Returns statements of this code of NutritionIntake\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [RequestOrchestration](requestorchestration.html): The code of the request orchestration\r\n* [Task](task.html): Search by task code\r\n", type="token" )
3050  public static final String SP_CODE = "code";
3051 /**
3052   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3053   * <p>
3054   * Description: <b>Multiple Resources: 
3055
3056* [AdverseEvent](adverseevent.html): Event or incident that occurred or was averted
3057* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
3058* [AuditEvent](auditevent.html): More specific code for the event
3059* [Basic](basic.html): Kind of Resource
3060* [ChargeItem](chargeitem.html): A code that identifies the charge, like a billing code
3061* [Condition](condition.html): Code for the condition
3062* [DetectedIssue](detectedissue.html): Issue Type, e.g. drug-drug, duplicate therapy, etc.
3063* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
3064* [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
3065* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
3066* [ImagingSelection](imagingselection.html): The imaging selection status
3067* [List](list.html): What the purpose of this list is
3068* [Medication](medication.html): Returns medications for a specific code
3069* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
3070* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
3071* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
3072* [MedicationStatement](medicationstatement.html): Return statements of this medication code
3073* [NutritionIntake](nutritionintake.html): Returns statements of this code of NutritionIntake
3074* [Observation](observation.html): The code of the observation type
3075* [Procedure](procedure.html): A code to identify a  procedure
3076* [RequestOrchestration](requestorchestration.html): The code of the request orchestration
3077* [Task](task.html): Search by task code
3078</b><br>
3079   * Type: <b>token</b><br>
3080   * Path: <b>AdverseEvent.code | AllergyIntolerance.code | AllergyIntolerance.reaction.substance | AuditEvent.code | Basic.code | ChargeItem.code | Condition.code | DetectedIssue.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | ImagingSelection.status | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationStatement.medication.concept | NutritionIntake.code | Observation.code | Procedure.code | RequestOrchestration.code | Task.code</b><br>
3081   * </p>
3082   */
3083  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3084
3085 /**
3086   * Search parameter: <b>encounter</b>
3087   * <p>
3088   * Description: <b>Multiple Resources: 
3089
3090* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
3091* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
3092* [ChargeItem](chargeitem.html): Encounter associated with event
3093* [Claim](claim.html): Encounters associated with a billed line item
3094* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
3095* [Communication](communication.html): The Encounter during which this Communication was created
3096* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
3097* [Composition](composition.html): Context of the Composition
3098* [Condition](condition.html): The Encounter during which this Condition was created
3099* [DeviceRequest](devicerequest.html): Encounter during which request was created
3100* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
3101* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
3102* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
3103* [Flag](flag.html): Alert relevant during encounter
3104* [ImagingStudy](imagingstudy.html): The context of the study
3105* [List](list.html): Context in which list created
3106* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
3107* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
3108* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
3109* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
3110* [Observation](observation.html): Encounter related to the observation
3111* [Procedure](procedure.html): The Encounter during which this Procedure was created
3112* [Provenance](provenance.html): Encounter related to the Provenance
3113* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
3114* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
3115* [RiskAssessment](riskassessment.html): Where was assessment performed?
3116* [ServiceRequest](servicerequest.html): An encounter in which this request is made
3117* [Task](task.html): Search by encounter
3118* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
3119</b><br>
3120   * Type: <b>reference</b><br>
3121   * Path: <b>AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter</b><br>
3122   * </p>
3123   */
3124  @SearchParamDefinition(name="encounter", path="AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter", description="Multiple Resources: \r\n\r\n* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent\r\n* [CarePlan](careplan.html): The Encounter during which this CarePlan was created\r\n* [ChargeItem](chargeitem.html): Encounter associated with event\r\n* [Claim](claim.html): Encounters associated with a billed line item\r\n* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created\r\n* [Communication](communication.html): The Encounter during which this Communication was created\r\n* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created\r\n* [Composition](composition.html): Context of the Composition\r\n* [Condition](condition.html): The Encounter during which this Condition was created\r\n* [DeviceRequest](devicerequest.html): Encounter during which request was created\r\n* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made\r\n* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values\r\n* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item\r\n* [Flag](flag.html): Alert relevant during encounter\r\n* [ImagingStudy](imagingstudy.html): The context of the study\r\n* [List](list.html): Context in which list created\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter\r\n* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier\r\n* [Observation](observation.html): Encounter related to the observation\r\n* [Procedure](procedure.html): The Encounter during which this Procedure was created\r\n* [Provenance](provenance.html): Encounter related to the Provenance\r\n* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response\r\n* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to\r\n* [RiskAssessment](riskassessment.html): Where was assessment performed?\r\n* [ServiceRequest](servicerequest.html): An encounter in which this request is made\r\n* [Task](task.html): Search by encounter\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
3125  public static final String SP_ENCOUNTER = "encounter";
3126 /**
3127   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3128   * <p>
3129   * Description: <b>Multiple Resources: 
3130
3131* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
3132* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
3133* [ChargeItem](chargeitem.html): Encounter associated with event
3134* [Claim](claim.html): Encounters associated with a billed line item
3135* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
3136* [Communication](communication.html): The Encounter during which this Communication was created
3137* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
3138* [Composition](composition.html): Context of the Composition
3139* [Condition](condition.html): The Encounter during which this Condition was created
3140* [DeviceRequest](devicerequest.html): Encounter during which request was created
3141* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
3142* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
3143* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
3144* [Flag](flag.html): Alert relevant during encounter
3145* [ImagingStudy](imagingstudy.html): The context of the study
3146* [List](list.html): Context in which list created
3147* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
3148* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
3149* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
3150* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
3151* [Observation](observation.html): Encounter related to the observation
3152* [Procedure](procedure.html): The Encounter during which this Procedure was created
3153* [Provenance](provenance.html): Encounter related to the Provenance
3154* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
3155* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
3156* [RiskAssessment](riskassessment.html): Where was assessment performed?
3157* [ServiceRequest](servicerequest.html): An encounter in which this request is made
3158* [Task](task.html): Search by encounter
3159* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
3160</b><br>
3161   * Type: <b>reference</b><br>
3162   * Path: <b>AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter</b><br>
3163   * </p>
3164   */
3165  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3166
3167/**
3168   * Constant for fluent queries to be used to add include statements. Specifies
3169   * the path value of "<b>MedicationDispense:encounter</b>".
3170   */
3171  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("MedicationDispense:encounter").toLocked();
3172
3173 /**
3174   * Search parameter: <b>identifier</b>
3175   * <p>
3176   * Description: <b>Multiple Resources: 
3177
3178* [Account](account.html): Account number
3179* [AdverseEvent](adverseevent.html): Business identifier for the event
3180* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3181* [Appointment](appointment.html): An Identifier of the Appointment
3182* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response
3183* [Basic](basic.html): Business identifier
3184* [BodyStructure](bodystructure.html): Bodystructure identifier
3185* [CarePlan](careplan.html): External Ids for this plan
3186* [CareTeam](careteam.html): External Ids for this team
3187* [ChargeItem](chargeitem.html): Business Identifier for item
3188* [Claim](claim.html): The primary identifier of the financial resource
3189* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse
3190* [ClinicalImpression](clinicalimpression.html): Business identifier
3191* [Communication](communication.html): Unique identifier
3192* [CommunicationRequest](communicationrequest.html): Unique identifier
3193* [Composition](composition.html): Version-independent identifier for the Composition
3194* [Condition](condition.html): A unique identifier of the condition record
3195* [Consent](consent.html): Identifier for this record (external references)
3196* [Contract](contract.html): The identity of the contract
3197* [Coverage](coverage.html): The primary identifier of the insured and the coverage
3198* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility
3199* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier
3200* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3201* [DeviceRequest](devicerequest.html): Business identifier for request/order
3202* [DeviceUsage](deviceusage.html): Search by identifier
3203* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3204* [DocumentReference](documentreference.html): Identifier of the attachment binary
3205* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3206* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment
3207* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3208* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit
3209* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3210* [Flag](flag.html): Business identifier
3211* [Goal](goal.html): External Ids for this goal
3212* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response
3213* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection
3214* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
3215* [Immunization](immunization.html): Business identifier
3216* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation
3217* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier
3218* [Invoice](invoice.html): Business Identifier for item
3219* [List](list.html): Business identifier
3220* [MeasureReport](measurereport.html): External identifier of the measure report to be returned
3221* [Medication](medication.html): Returns medications with this external identifier
3222* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3223* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3224* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3225* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
3226* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence
3227* [NutritionIntake](nutritionintake.html): Return statements with this external identifier
3228* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3229* [Observation](observation.html): The unique id for a particular observation
3230* [Person](person.html): A person Identifier
3231* [Procedure](procedure.html): A unique identifier for a procedure
3232* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response
3233* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson
3234* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration
3235* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study
3236* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3237* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3238* [Specimen](specimen.html): The unique identifier associated with the specimen
3239* [SupplyDelivery](supplydelivery.html): External identifier
3240* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3241* [Task](task.html): Search for a task instance by its business identifier
3242* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3243</b><br>
3244   * Type: <b>token</b><br>
3245   * Path: <b>Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier</b><br>
3246   * </p>
3247   */
3248  @SearchParamDefinition(name="identifier", path="Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [Account](account.html): Account number\r\n* [AdverseEvent](adverseevent.html): Business identifier for the event\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [Appointment](appointment.html): An Identifier of the Appointment\r\n* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response\r\n* [Basic](basic.html): Business identifier\r\n* [BodyStructure](bodystructure.html): Bodystructure identifier\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [ChargeItem](chargeitem.html): Business Identifier for item\r\n* [Claim](claim.html): The primary identifier of the financial resource\r\n* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse\r\n* [ClinicalImpression](clinicalimpression.html): Business identifier\r\n* [Communication](communication.html): Unique identifier\r\n* [CommunicationRequest](communicationrequest.html): Unique identifier\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* [Contract](contract.html): The identity of the contract\r\n* [Coverage](coverage.html): The primary identifier of the insured and the coverage\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DeviceUsage](deviceusage.html): Search by identifier\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Flag](flag.html): Business identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response\r\n* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier\r\n* [Invoice](invoice.html): Business Identifier for item\r\n* [List](list.html): Business identifier\r\n* [MeasureReport](measurereport.html): External identifier of the measure report to be returned\r\n* [Medication](medication.html): Returns medications with this external 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* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence\r\n* [NutritionIntake](nutritionintake.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* [Person](person.html): A person Identifier\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response\r\n* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson\r\n* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration\r\n* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [Specimen](specimen.html): The unique identifier associated with the specimen\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [Task](task.html): Search for a task instance by its business identifier\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
3249  public static final String SP_IDENTIFIER = "identifier";
3250 /**
3251   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3252   * <p>
3253   * Description: <b>Multiple Resources: 
3254
3255* [Account](account.html): Account number
3256* [AdverseEvent](adverseevent.html): Business identifier for the event
3257* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3258* [Appointment](appointment.html): An Identifier of the Appointment
3259* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response
3260* [Basic](basic.html): Business identifier
3261* [BodyStructure](bodystructure.html): Bodystructure identifier
3262* [CarePlan](careplan.html): External Ids for this plan
3263* [CareTeam](careteam.html): External Ids for this team
3264* [ChargeItem](chargeitem.html): Business Identifier for item
3265* [Claim](claim.html): The primary identifier of the financial resource
3266* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse
3267* [ClinicalImpression](clinicalimpression.html): Business identifier
3268* [Communication](communication.html): Unique identifier
3269* [CommunicationRequest](communicationrequest.html): Unique identifier
3270* [Composition](composition.html): Version-independent identifier for the Composition
3271* [Condition](condition.html): A unique identifier of the condition record
3272* [Consent](consent.html): Identifier for this record (external references)
3273* [Contract](contract.html): The identity of the contract
3274* [Coverage](coverage.html): The primary identifier of the insured and the coverage
3275* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility
3276* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier
3277* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3278* [DeviceRequest](devicerequest.html): Business identifier for request/order
3279* [DeviceUsage](deviceusage.html): Search by identifier
3280* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3281* [DocumentReference](documentreference.html): Identifier of the attachment binary
3282* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3283* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment
3284* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3285* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit
3286* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3287* [Flag](flag.html): Business identifier
3288* [Goal](goal.html): External Ids for this goal
3289* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response
3290* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection
3291* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
3292* [Immunization](immunization.html): Business identifier
3293* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation
3294* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier
3295* [Invoice](invoice.html): Business Identifier for item
3296* [List](list.html): Business identifier
3297* [MeasureReport](measurereport.html): External identifier of the measure report to be returned
3298* [Medication](medication.html): Returns medications with this external identifier
3299* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3300* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3301* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3302* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
3303* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence
3304* [NutritionIntake](nutritionintake.html): Return statements with this external identifier
3305* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3306* [Observation](observation.html): The unique id for a particular observation
3307* [Person](person.html): A person Identifier
3308* [Procedure](procedure.html): A unique identifier for a procedure
3309* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response
3310* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson
3311* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration
3312* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study
3313* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3314* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3315* [Specimen](specimen.html): The unique identifier associated with the specimen
3316* [SupplyDelivery](supplydelivery.html): External identifier
3317* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3318* [Task](task.html): Search for a task instance by its business identifier
3319* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3320</b><br>
3321   * Type: <b>token</b><br>
3322   * Path: <b>Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier</b><br>
3323   * </p>
3324   */
3325  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3326
3327 /**
3328   * Search parameter: <b>patient</b>
3329   * <p>
3330   * Description: <b>Multiple Resources: 
3331
3332* [Account](account.html): The entity that caused the expenses
3333* [AdverseEvent](adverseevent.html): Subject impacted by event
3334* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
3335* [Appointment](appointment.html): One of the individuals of the appointment is this patient
3336* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
3337* [AuditEvent](auditevent.html): Where the activity involved patient data
3338* [Basic](basic.html): Identifies the focus of this resource
3339* [BodyStructure](bodystructure.html): Who this is about
3340* [CarePlan](careplan.html): Who the care plan is for
3341* [CareTeam](careteam.html): Who care team is for
3342* [ChargeItem](chargeitem.html): Individual service was done for/to
3343* [Claim](claim.html): Patient receiving the products or services
3344* [ClaimResponse](claimresponse.html): The subject of care
3345* [ClinicalImpression](clinicalimpression.html): Patient assessed
3346* [Communication](communication.html): Focus of message
3347* [CommunicationRequest](communicationrequest.html): Focus of message
3348* [Composition](composition.html): Who and/or what the composition is about
3349* [Condition](condition.html): Who has the condition?
3350* [Consent](consent.html): Who the consent applies to
3351* [Contract](contract.html): The identity of the subject of the contract (if a patient)
3352* [Coverage](coverage.html): Retrieve coverages for a patient
3353* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
3354* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
3355* [DetectedIssue](detectedissue.html): Associated patient
3356* [DeviceRequest](devicerequest.html): Individual the service is ordered for
3357* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
3358* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
3359* [DocumentReference](documentreference.html): Who/what is the subject of the document
3360* [Encounter](encounter.html): The patient present at the encounter
3361* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
3362* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
3363* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
3364* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
3365* [Flag](flag.html): The identity of a subject to list flags for
3366* [Goal](goal.html): Who this goal is intended for
3367* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
3368* [ImagingSelection](imagingselection.html): Who the study is about
3369* [ImagingStudy](imagingstudy.html): Who the study is about
3370* [Immunization](immunization.html): The patient for the vaccination record
3371* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
3372* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
3373* [Invoice](invoice.html): Recipient(s) of goods and services
3374* [List](list.html): If all resources have the same subject
3375* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
3376* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3377* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3378* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3379* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
3380* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
3381* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
3382* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
3383* [Observation](observation.html): The subject that the observation is about (if patient)
3384* [Person](person.html): The Person links to this Patient
3385* [Procedure](procedure.html): Search by subject - a patient
3386* [Provenance](provenance.html): Where the activity involved patient data
3387* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
3388* [RelatedPerson](relatedperson.html): The patient this related person is related to
3389* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
3390* [ResearchSubject](researchsubject.html): Who or what is part of study
3391* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3392* [ServiceRequest](servicerequest.html): Search by subject - a patient
3393* [Specimen](specimen.html): The patient the specimen comes from
3394* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3395* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
3396* [Task](task.html): Search by patient
3397* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3398</b><br>
3399   * Type: <b>reference</b><br>
3400   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.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) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
3401   * </p>
3402   */
3403  @SearchParamDefinition(name="patient", path="Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.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) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [Account](account.html): The entity that caused the expenses\r\n* [AdverseEvent](adverseevent.html): Subject impacted by event\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [Appointment](appointment.html): One of the individuals of the appointment is this patient\r\n* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient\r\n* [AuditEvent](auditevent.html): Where the activity involved patient data\r\n* [Basic](basic.html): Identifies the focus of this resource\r\n* [BodyStructure](bodystructure.html): Who this is about\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ChargeItem](chargeitem.html): Individual service was done for/to\r\n* [Claim](claim.html): Patient receiving the products or services\r\n* [ClaimResponse](claimresponse.html): The subject of care\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Communication](communication.html): Focus of message\r\n* [CommunicationRequest](communicationrequest.html): Focus of message\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* [Contract](contract.html): The identity of the subject of the contract (if a patient)\r\n* [Coverage](coverage.html): Retrieve coverages for a patient\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient\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* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results\r\n* [ImagingSelection](imagingselection.html): Who the study is about\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for\r\n* [Invoice](invoice.html): Recipient(s) of goods and services\r\n* [List](list.html): If all resources have the same subject\r\n* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for\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* [MolecularSequence](molecularsequence.html): The subject that the sequence is about\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Person](person.html): The Person links to this Patient\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [Provenance](provenance.html): Where the activity involved patient data\r\n* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response\r\n* [RelatedPerson](relatedperson.html): The patient this related person is related to\r\n* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations\r\n* [ResearchSubject](researchsubject.html): Who or what is part of study\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [Specimen](specimen.html): The patient the specimen comes from\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined\r\n* [Task](task.html): Search by patient\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={Patient.class } )
3404  public static final String SP_PATIENT = "patient";
3405 /**
3406   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3407   * <p>
3408   * Description: <b>Multiple Resources: 
3409
3410* [Account](account.html): The entity that caused the expenses
3411* [AdverseEvent](adverseevent.html): Subject impacted by event
3412* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
3413* [Appointment](appointment.html): One of the individuals of the appointment is this patient
3414* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
3415* [AuditEvent](auditevent.html): Where the activity involved patient data
3416* [Basic](basic.html): Identifies the focus of this resource
3417* [BodyStructure](bodystructure.html): Who this is about
3418* [CarePlan](careplan.html): Who the care plan is for
3419* [CareTeam](careteam.html): Who care team is for
3420* [ChargeItem](chargeitem.html): Individual service was done for/to
3421* [Claim](claim.html): Patient receiving the products or services
3422* [ClaimResponse](claimresponse.html): The subject of care
3423* [ClinicalImpression](clinicalimpression.html): Patient assessed
3424* [Communication](communication.html): Focus of message
3425* [CommunicationRequest](communicationrequest.html): Focus of message
3426* [Composition](composition.html): Who and/or what the composition is about
3427* [Condition](condition.html): Who has the condition?
3428* [Consent](consent.html): Who the consent applies to
3429* [Contract](contract.html): The identity of the subject of the contract (if a patient)
3430* [Coverage](coverage.html): Retrieve coverages for a patient
3431* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
3432* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
3433* [DetectedIssue](detectedissue.html): Associated patient
3434* [DeviceRequest](devicerequest.html): Individual the service is ordered for
3435* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
3436* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
3437* [DocumentReference](documentreference.html): Who/what is the subject of the document
3438* [Encounter](encounter.html): The patient present at the encounter
3439* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
3440* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
3441* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
3442* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
3443* [Flag](flag.html): The identity of a subject to list flags for
3444* [Goal](goal.html): Who this goal is intended for
3445* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
3446* [ImagingSelection](imagingselection.html): Who the study is about
3447* [ImagingStudy](imagingstudy.html): Who the study is about
3448* [Immunization](immunization.html): The patient for the vaccination record
3449* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
3450* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
3451* [Invoice](invoice.html): Recipient(s) of goods and services
3452* [List](list.html): If all resources have the same subject
3453* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
3454* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3455* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3456* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3457* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
3458* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
3459* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
3460* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
3461* [Observation](observation.html): The subject that the observation is about (if patient)
3462* [Person](person.html): The Person links to this Patient
3463* [Procedure](procedure.html): Search by subject - a patient
3464* [Provenance](provenance.html): Where the activity involved patient data
3465* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
3466* [RelatedPerson](relatedperson.html): The patient this related person is related to
3467* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
3468* [ResearchSubject](researchsubject.html): Who or what is part of study
3469* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3470* [ServiceRequest](servicerequest.html): Search by subject - a patient
3471* [Specimen](specimen.html): The patient the specimen comes from
3472* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3473* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
3474* [Task](task.html): Search by patient
3475* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3476</b><br>
3477   * Type: <b>reference</b><br>
3478   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.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) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
3479   * </p>
3480   */
3481  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3482
3483/**
3484   * Constant for fluent queries to be used to add include statements. Specifies
3485   * the path value of "<b>MedicationDispense:patient</b>".
3486   */
3487  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationDispense:patient").toLocked();
3488
3489 /**
3490   * Search parameter: <b>type</b>
3491   * <p>
3492   * Description: <b>Multiple Resources: 
3493
3494* [Account](account.html): E.g. patient, expense, depreciation
3495* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)
3496* [Composition](composition.html): Kind of composition (LOINC if possible)
3497* [Coverage](coverage.html): The kind of coverage (health plan, auto, Workers Compensation)
3498* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)
3499* [Encounter](encounter.html): Specific type of encounter
3500* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management
3501* [Invoice](invoice.html): Type of Invoice
3502* [MedicationDispense](medicationdispense.html): Returns dispenses of a specific type
3503* [MolecularSequence](molecularsequence.html): Amino Acid Sequence/ DNA Sequence / RNA Sequence
3504* [Specimen](specimen.html): The specimen type
3505</b><br>
3506   * Type: <b>token</b><br>
3507   * Path: <b>Account.type | AllergyIntolerance.type | Composition.type | Coverage.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type | Invoice.type | MedicationDispense.type | MolecularSequence.type | Specimen.type</b><br>
3508   * </p>
3509   */
3510  @SearchParamDefinition(name="type", path="Account.type | AllergyIntolerance.type | Composition.type | Coverage.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type | Invoice.type | MedicationDispense.type | MolecularSequence.type | Specimen.type", description="Multiple Resources: \r\n\r\n* [Account](account.html): E.g. patient, expense, depreciation\r\n* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)\r\n* [Composition](composition.html): Kind of composition (LOINC if possible)\r\n* [Coverage](coverage.html): The kind of coverage (health plan, auto, Workers Compensation)\r\n* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)\r\n* [Encounter](encounter.html): Specific type of encounter\r\n* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management\r\n* [Invoice](invoice.html): Type of Invoice\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of a specific type\r\n* [MolecularSequence](molecularsequence.html): Amino Acid Sequence/ DNA Sequence / RNA Sequence\r\n* [Specimen](specimen.html): The specimen type\r\n", type="token" )
3511  public static final String SP_TYPE = "type";
3512 /**
3513   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3514   * <p>
3515   * Description: <b>Multiple Resources: 
3516
3517* [Account](account.html): E.g. patient, expense, depreciation
3518* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)
3519* [Composition](composition.html): Kind of composition (LOINC if possible)
3520* [Coverage](coverage.html): The kind of coverage (health plan, auto, Workers Compensation)
3521* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)
3522* [Encounter](encounter.html): Specific type of encounter
3523* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management
3524* [Invoice](invoice.html): Type of Invoice
3525* [MedicationDispense](medicationdispense.html): Returns dispenses of a specific type
3526* [MolecularSequence](molecularsequence.html): Amino Acid Sequence/ DNA Sequence / RNA Sequence
3527* [Specimen](specimen.html): The specimen type
3528</b><br>
3529   * Type: <b>token</b><br>
3530   * Path: <b>Account.type | AllergyIntolerance.type | Composition.type | Coverage.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type | Invoice.type | MedicationDispense.type | MolecularSequence.type | Specimen.type</b><br>
3531   * </p>
3532   */
3533  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3534
3535 /**
3536   * Search parameter: <b>medication</b>
3537   * <p>
3538   * Description: <b>Multiple Resources: 
3539
3540* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
3541* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
3542* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
3543* [MedicationStatement](medicationstatement.html): Return statements of this medication reference
3544</b><br>
3545   * Type: <b>reference</b><br>
3546   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationStatement.medication.reference</b><br>
3547   * </p>
3548   */
3549  @SearchParamDefinition(name="medication", path="MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationStatement.medication.reference", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference\r\n* [MedicationStatement](medicationstatement.html): Return statements of this medication reference\r\n", type="reference", target={Medication.class } )
3550  public static final String SP_MEDICATION = "medication";
3551 /**
3552   * <b>Fluent Client</b> search parameter constant for <b>medication</b>
3553   * <p>
3554   * Description: <b>Multiple Resources: 
3555
3556* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
3557* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
3558* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
3559* [MedicationStatement](medicationstatement.html): Return statements of this medication reference
3560</b><br>
3561   * Type: <b>reference</b><br>
3562   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationStatement.medication.reference</b><br>
3563   * </p>
3564   */
3565  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION);
3566
3567/**
3568   * Constant for fluent queries to be used to add include statements. Specifies
3569   * the path value of "<b>MedicationDispense:medication</b>".
3570   */
3571  public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationDispense:medication").toLocked();
3572
3573 /**
3574   * Search parameter: <b>prescription</b>
3575   * <p>
3576   * Description: <b>Multiple Resources: 
3577
3578* [MedicationDispense](medicationdispense.html): The identity of a prescription to list dispenses from
3579</b><br>
3580   * Type: <b>reference</b><br>
3581   * Path: <b>MedicationDispense.authorizingPrescription</b><br>
3582   * </p>
3583   */
3584  @SearchParamDefinition(name="prescription", path="MedicationDispense.authorizingPrescription", description="Multiple Resources: \r\n\r\n* [MedicationDispense](medicationdispense.html): The identity of a prescription to list dispenses from\r\n", type="reference", target={MedicationRequest.class } )
3585  public static final String SP_PRESCRIPTION = "prescription";
3586 /**
3587   * <b>Fluent Client</b> search parameter constant for <b>prescription</b>
3588   * <p>
3589   * Description: <b>Multiple Resources: 
3590
3591* [MedicationDispense](medicationdispense.html): The identity of a prescription to list dispenses from
3592</b><br>
3593   * Type: <b>reference</b><br>
3594   * Path: <b>MedicationDispense.authorizingPrescription</b><br>
3595   * </p>
3596   */
3597  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRESCRIPTION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRESCRIPTION);
3598
3599/**
3600   * Constant for fluent queries to be used to add include statements. Specifies
3601   * the path value of "<b>MedicationDispense:prescription</b>".
3602   */
3603  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRESCRIPTION = new ca.uhn.fhir.model.api.Include("MedicationDispense:prescription").toLocked();
3604
3605 /**
3606   * Search parameter: <b>status</b>
3607   * <p>
3608   * Description: <b>Multiple Resources: 
3609
3610* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
3611* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
3612* [MedicationRequest](medicationrequest.html): Status of the prescription
3613* [MedicationStatement](medicationstatement.html): Return statements that match the given status
3614</b><br>
3615   * Type: <b>token</b><br>
3616   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationStatement.status</b><br>
3617   * </p>
3618   */
3619  @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" )
3620  public static final String SP_STATUS = "status";
3621 /**
3622   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3623   * <p>
3624   * Description: <b>Multiple Resources: 
3625
3626* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
3627* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
3628* [MedicationRequest](medicationrequest.html): Status of the prescription
3629* [MedicationStatement](medicationstatement.html): Return statements that match the given status
3630</b><br>
3631   * Type: <b>token</b><br>
3632   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationStatement.status</b><br>
3633   * </p>
3634   */
3635  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3636
3637
3638}
3639