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