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