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