001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * An order or request for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or "MedicationOrder" to generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow patterns.
052 */
053@ResourceDef(name="MedicationRequest", profile="http://hl7.org/fhir/StructureDefinition/MedicationRequest")
054public class MedicationRequest extends DomainResource {
055
056    public enum MedicationRequestIntent {
057        /**
058         * The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act
059         */
060        PROPOSAL, 
061        /**
062         * The request represents an intention to ensure something occurs without providing an authorization for others to act.
063         */
064        PLAN, 
065        /**
066         * The request represents a request/demand and authorization for action
067         */
068        ORDER, 
069        /**
070         * The request represents the original authorization for the medication request.
071         */
072        ORIGINALORDER, 
073        /**
074         * The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization..
075         */
076        REFLEXORDER, 
077        /**
078         * The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.
079         */
080        FILLERORDER, 
081        /**
082         * The request represents an instance for the particular order and is used to generate a schedule of requests on a medication administration record (MAR).
083         */
084        INSTANCEORDER, 
085        /**
086         * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or  other constraints among a set of requests.
087         */
088        OPTION, 
089        /**
090         * added to help the parsers with the generic types
091         */
092        NULL;
093        public static MedicationRequestIntent fromCode(String codeString) throws FHIRException {
094            if (codeString == null || "".equals(codeString))
095                return null;
096        if ("proposal".equals(codeString))
097          return PROPOSAL;
098        if ("plan".equals(codeString))
099          return PLAN;
100        if ("order".equals(codeString))
101          return ORDER;
102        if ("original-order".equals(codeString))
103          return ORIGINALORDER;
104        if ("reflex-order".equals(codeString))
105          return REFLEXORDER;
106        if ("filler-order".equals(codeString))
107          return FILLERORDER;
108        if ("instance-order".equals(codeString))
109          return INSTANCEORDER;
110        if ("option".equals(codeString))
111          return OPTION;
112        if (Configuration.isAcceptInvalidEnums())
113          return null;
114        else
115          throw new FHIRException("Unknown MedicationRequestIntent code '"+codeString+"'");
116        }
117        public String toCode() {
118          switch (this) {
119            case PROPOSAL: return "proposal";
120            case PLAN: return "plan";
121            case ORDER: return "order";
122            case ORIGINALORDER: return "original-order";
123            case REFLEXORDER: return "reflex-order";
124            case FILLERORDER: return "filler-order";
125            case INSTANCEORDER: return "instance-order";
126            case OPTION: return "option";
127            case NULL: return null;
128            default: return "?";
129          }
130        }
131        public String getSystem() {
132          switch (this) {
133            case PROPOSAL: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
134            case PLAN: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
135            case ORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
136            case ORIGINALORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
137            case REFLEXORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
138            case FILLERORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
139            case INSTANCEORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
140            case OPTION: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent";
141            case NULL: return null;
142            default: return "?";
143          }
144        }
145        public String getDefinition() {
146          switch (this) {
147            case PROPOSAL: return "The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act";
148            case PLAN: return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
149            case ORDER: return "The request represents a request/demand and authorization for action";
150            case ORIGINALORDER: return "The request represents the original authorization for the medication request.";
151            case REFLEXORDER: return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization..";
152            case FILLERORDER: return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.";
153            case INSTANCEORDER: return "The request represents an instance for the particular order and is used to generate a schedule of requests on a medication administration record (MAR).";
154            case OPTION: return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or  other constraints among a set of requests.";
155            case NULL: return null;
156            default: return "?";
157          }
158        }
159        public String getDisplay() {
160          switch (this) {
161            case PROPOSAL: return "Proposal";
162            case PLAN: return "Plan";
163            case ORDER: return "Order";
164            case ORIGINALORDER: return "Original Order";
165            case REFLEXORDER: return "Reflex Order";
166            case FILLERORDER: return "Filler Order";
167            case INSTANCEORDER: return "Instance Order";
168            case OPTION: return "Option";
169            case NULL: return null;
170            default: return "?";
171          }
172        }
173    }
174
175  public static class MedicationRequestIntentEnumFactory implements EnumFactory<MedicationRequestIntent> {
176    public MedicationRequestIntent fromCode(String codeString) throws IllegalArgumentException {
177      if (codeString == null || "".equals(codeString))
178            if (codeString == null || "".equals(codeString))
179                return null;
180        if ("proposal".equals(codeString))
181          return MedicationRequestIntent.PROPOSAL;
182        if ("plan".equals(codeString))
183          return MedicationRequestIntent.PLAN;
184        if ("order".equals(codeString))
185          return MedicationRequestIntent.ORDER;
186        if ("original-order".equals(codeString))
187          return MedicationRequestIntent.ORIGINALORDER;
188        if ("reflex-order".equals(codeString))
189          return MedicationRequestIntent.REFLEXORDER;
190        if ("filler-order".equals(codeString))
191          return MedicationRequestIntent.FILLERORDER;
192        if ("instance-order".equals(codeString))
193          return MedicationRequestIntent.INSTANCEORDER;
194        if ("option".equals(codeString))
195          return MedicationRequestIntent.OPTION;
196        throw new IllegalArgumentException("Unknown MedicationRequestIntent code '"+codeString+"'");
197        }
198        public Enumeration<MedicationRequestIntent> fromType(Base code) throws FHIRException {
199          if (code == null)
200            return null;
201          if (code.isEmpty())
202            return new Enumeration<MedicationRequestIntent>(this);
203          String codeString = ((PrimitiveType) code).asStringValue();
204          if (codeString == null || "".equals(codeString))
205            return null;
206        if ("proposal".equals(codeString))
207          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.PROPOSAL);
208        if ("plan".equals(codeString))
209          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.PLAN);
210        if ("order".equals(codeString))
211          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.ORDER);
212        if ("original-order".equals(codeString))
213          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.ORIGINALORDER);
214        if ("reflex-order".equals(codeString))
215          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.REFLEXORDER);
216        if ("filler-order".equals(codeString))
217          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.FILLERORDER);
218        if ("instance-order".equals(codeString))
219          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.INSTANCEORDER);
220        if ("option".equals(codeString))
221          return new Enumeration<MedicationRequestIntent>(this, MedicationRequestIntent.OPTION);
222        throw new FHIRException("Unknown MedicationRequestIntent code '"+codeString+"'");
223        }
224    public String toCode(MedicationRequestIntent code) {
225      if (code == MedicationRequestIntent.PROPOSAL)
226        return "proposal";
227      if (code == MedicationRequestIntent.PLAN)
228        return "plan";
229      if (code == MedicationRequestIntent.ORDER)
230        return "order";
231      if (code == MedicationRequestIntent.ORIGINALORDER)
232        return "original-order";
233      if (code == MedicationRequestIntent.REFLEXORDER)
234        return "reflex-order";
235      if (code == MedicationRequestIntent.FILLERORDER)
236        return "filler-order";
237      if (code == MedicationRequestIntent.INSTANCEORDER)
238        return "instance-order";
239      if (code == MedicationRequestIntent.OPTION)
240        return "option";
241      return "?";
242      }
243    public String toSystem(MedicationRequestIntent code) {
244      return code.getSystem();
245      }
246    }
247
248    public enum MedicationrequestStatus {
249        /**
250         * The request is 'actionable', but not all actions that are implied by it have occurred yet.
251         */
252        ACTIVE, 
253        /**
254         * Actions implied by the request are to be temporarily halted. The request might or might not be resumed. May also be called 'suspended'.
255         */
256        ONHOLD, 
257        /**
258         * The request is no longer active and the subject should no longer be taking the medication.
259         */
260        ENDED, 
261        /**
262         * Actions implied by the request are to be permanently halted, before all of the administrations occurred. This should not be used if the original order was entered in error
263         */
264        STOPPED, 
265        /**
266         * All actions that are implied by the request have occurred.
267         */
268        COMPLETED, 
269        /**
270         * The request has been withdrawn before any administrations have occurred
271         */
272        CANCELLED, 
273        /**
274         * The request was recorded against the wrong patient or for some reason should not have been recorded (e.g. wrong medication, wrong dose, etc). Some of the actions that are implied by the medication request may have occurred. For example, the medication may have been dispensed and the patient may have taken some of the medication.
275         */
276        ENTEREDINERROR, 
277        /**
278         * The request is not yet 'actionable', e.g. it is a work in progress, requires sign-off, verification or needs to be run through decision support process.
279         */
280        DRAFT, 
281        /**
282         * The authoring/source system does not know which of the status values currently applies for this request. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, but the authoring/source system does not know which.
283         */
284        UNKNOWN, 
285        /**
286         * added to help the parsers with the generic types
287         */
288        NULL;
289        public static MedicationrequestStatus fromCode(String codeString) throws FHIRException {
290            if (codeString == null || "".equals(codeString))
291                return null;
292        if ("active".equals(codeString))
293          return ACTIVE;
294        if ("on-hold".equals(codeString))
295          return ONHOLD;
296        if ("ended".equals(codeString))
297          return ENDED;
298        if ("stopped".equals(codeString))
299          return STOPPED;
300        if ("completed".equals(codeString))
301          return COMPLETED;
302        if ("cancelled".equals(codeString))
303          return CANCELLED;
304        if ("entered-in-error".equals(codeString))
305          return ENTEREDINERROR;
306        if ("draft".equals(codeString))
307          return DRAFT;
308        if ("unknown".equals(codeString))
309          return UNKNOWN;
310        if (Configuration.isAcceptInvalidEnums())
311          return null;
312        else
313          throw new FHIRException("Unknown MedicationrequestStatus code '"+codeString+"'");
314        }
315        public String toCode() {
316          switch (this) {
317            case ACTIVE: return "active";
318            case ONHOLD: return "on-hold";
319            case ENDED: return "ended";
320            case STOPPED: return "stopped";
321            case COMPLETED: return "completed";
322            case CANCELLED: return "cancelled";
323            case ENTEREDINERROR: return "entered-in-error";
324            case DRAFT: return "draft";
325            case UNKNOWN: return "unknown";
326            case NULL: return null;
327            default: return "?";
328          }
329        }
330        public String getSystem() {
331          switch (this) {
332            case ACTIVE: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
333            case ONHOLD: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
334            case ENDED: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
335            case STOPPED: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
336            case COMPLETED: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
337            case CANCELLED: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
338            case ENTEREDINERROR: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
339            case DRAFT: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
340            case UNKNOWN: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status";
341            case NULL: return null;
342            default: return "?";
343          }
344        }
345        public String getDefinition() {
346          switch (this) {
347            case ACTIVE: return "The request is 'actionable', but not all actions that are implied by it have occurred yet.";
348            case ONHOLD: return "Actions implied by the request are to be temporarily halted. The request might or might not be resumed. May also be called 'suspended'.";
349            case ENDED: return "The request is no longer active and the subject should no longer be taking the medication.";
350            case STOPPED: return "Actions implied by the request are to be permanently halted, before all of the administrations occurred. This should not be used if the original order was entered in error";
351            case COMPLETED: return "All actions that are implied by the request have occurred.";
352            case CANCELLED: return "The request has been withdrawn before any administrations have occurred";
353            case ENTEREDINERROR: return "The request was recorded against the wrong patient or for some reason should not have been recorded (e.g. wrong medication, wrong dose, etc). Some of the actions that are implied by the medication request may have occurred. For example, the medication may have been dispensed and the patient may have taken some of the medication.";
354            case DRAFT: return "The request is not yet 'actionable', e.g. it is a work in progress, requires sign-off, verification or needs to be run through decision support process.";
355            case UNKNOWN: return "The authoring/source system does not know which of the status values currently applies for this request. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, but the authoring/source system does not know which.";
356            case NULL: return null;
357            default: return "?";
358          }
359        }
360        public String getDisplay() {
361          switch (this) {
362            case ACTIVE: return "Active";
363            case ONHOLD: return "On Hold";
364            case ENDED: return "Ended";
365            case STOPPED: return "Stopped";
366            case COMPLETED: return "Completed";
367            case CANCELLED: return "Cancelled";
368            case ENTEREDINERROR: return "Entered in Error";
369            case DRAFT: return "Draft";
370            case UNKNOWN: return "Unknown";
371            case NULL: return null;
372            default: return "?";
373          }
374        }
375    }
376
377  public static class MedicationrequestStatusEnumFactory implements EnumFactory<MedicationrequestStatus> {
378    public MedicationrequestStatus fromCode(String codeString) throws IllegalArgumentException {
379      if (codeString == null || "".equals(codeString))
380            if (codeString == null || "".equals(codeString))
381                return null;
382        if ("active".equals(codeString))
383          return MedicationrequestStatus.ACTIVE;
384        if ("on-hold".equals(codeString))
385          return MedicationrequestStatus.ONHOLD;
386        if ("ended".equals(codeString))
387          return MedicationrequestStatus.ENDED;
388        if ("stopped".equals(codeString))
389          return MedicationrequestStatus.STOPPED;
390        if ("completed".equals(codeString))
391          return MedicationrequestStatus.COMPLETED;
392        if ("cancelled".equals(codeString))
393          return MedicationrequestStatus.CANCELLED;
394        if ("entered-in-error".equals(codeString))
395          return MedicationrequestStatus.ENTEREDINERROR;
396        if ("draft".equals(codeString))
397          return MedicationrequestStatus.DRAFT;
398        if ("unknown".equals(codeString))
399          return MedicationrequestStatus.UNKNOWN;
400        throw new IllegalArgumentException("Unknown MedicationrequestStatus code '"+codeString+"'");
401        }
402        public Enumeration<MedicationrequestStatus> fromType(Base code) throws FHIRException {
403          if (code == null)
404            return null;
405          if (code.isEmpty())
406            return new Enumeration<MedicationrequestStatus>(this);
407          String codeString = ((PrimitiveType) code).asStringValue();
408          if (codeString == null || "".equals(codeString))
409            return null;
410        if ("active".equals(codeString))
411          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.ACTIVE);
412        if ("on-hold".equals(codeString))
413          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.ONHOLD);
414        if ("ended".equals(codeString))
415          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.ENDED);
416        if ("stopped".equals(codeString))
417          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.STOPPED);
418        if ("completed".equals(codeString))
419          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.COMPLETED);
420        if ("cancelled".equals(codeString))
421          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.CANCELLED);
422        if ("entered-in-error".equals(codeString))
423          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.ENTEREDINERROR);
424        if ("draft".equals(codeString))
425          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.DRAFT);
426        if ("unknown".equals(codeString))
427          return new Enumeration<MedicationrequestStatus>(this, MedicationrequestStatus.UNKNOWN);
428        throw new FHIRException("Unknown MedicationrequestStatus code '"+codeString+"'");
429        }
430    public String toCode(MedicationrequestStatus code) {
431      if (code == MedicationrequestStatus.ACTIVE)
432        return "active";
433      if (code == MedicationrequestStatus.ONHOLD)
434        return "on-hold";
435      if (code == MedicationrequestStatus.ENDED)
436        return "ended";
437      if (code == MedicationrequestStatus.STOPPED)
438        return "stopped";
439      if (code == MedicationrequestStatus.COMPLETED)
440        return "completed";
441      if (code == MedicationrequestStatus.CANCELLED)
442        return "cancelled";
443      if (code == MedicationrequestStatus.ENTEREDINERROR)
444        return "entered-in-error";
445      if (code == MedicationrequestStatus.DRAFT)
446        return "draft";
447      if (code == MedicationrequestStatus.UNKNOWN)
448        return "unknown";
449      return "?";
450      }
451    public String toSystem(MedicationrequestStatus code) {
452      return code.getSystem();
453      }
454    }
455
456    @Block()
457    public static class MedicationRequestDoseComponent extends BackboneElement implements IBaseBackboneElement {
458        /**
459         * 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.
460         */
461        @Child(name = "renderedDosageInstruction", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
462        @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." )
463        protected StringType renderedDosageInstruction;
464
465        /**
466         * The period over which the medication is to be taken.  Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions.
467         */
468        @Child(name = "effectiveDosePeriod", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
469        @Description(shortDefinition="Period over which the medication is to be taken", formalDefinition="The period over which the medication is to be taken.  Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions." )
470        protected Period effectiveDosePeriod;
471
472        /**
473         * Specific instructions for how the medication is to be used by the patient.
474         */
475        @Child(name = "dosageInstruction", type = {Dosage.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
476        @Description(shortDefinition="Specific instructions for how the medication should be taken", formalDefinition="Specific instructions for how the medication is to be used by the patient." )
477        protected List<Dosage> dosageInstruction;
478
479        private static final long serialVersionUID = 1772757503L;
480
481    /**
482     * Constructor
483     */
484      public MedicationRequestDoseComponent() {
485        super();
486      }
487
488        /**
489         * @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
490         */
491        public StringType getRenderedDosageInstructionElement() { 
492          if (this.renderedDosageInstruction == null)
493            if (Configuration.errorOnAutoCreate())
494              throw new Error("Attempt to auto-create MedicationRequestDoseComponent.renderedDosageInstruction");
495            else if (Configuration.doAutoCreate())
496              this.renderedDosageInstruction = new StringType(); // bb
497          return this.renderedDosageInstruction;
498        }
499
500        public boolean hasRenderedDosageInstructionElement() { 
501          return this.renderedDosageInstruction != null && !this.renderedDosageInstruction.isEmpty();
502        }
503
504        public boolean hasRenderedDosageInstruction() { 
505          return this.renderedDosageInstruction != null && !this.renderedDosageInstruction.isEmpty();
506        }
507
508        /**
509         * @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
510         */
511        public MedicationRequestDoseComponent setRenderedDosageInstructionElement(StringType value) { 
512          this.renderedDosageInstruction = value;
513          return this;
514        }
515
516        /**
517         * @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.
518         */
519        public String getRenderedDosageInstruction() { 
520          return this.renderedDosageInstruction == null ? null : this.renderedDosageInstruction.getValue();
521        }
522
523        /**
524         * @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.
525         */
526        public MedicationRequestDoseComponent setRenderedDosageInstruction(String value) { 
527          if (Utilities.noString(value))
528            this.renderedDosageInstruction = null;
529          else {
530            if (this.renderedDosageInstruction == null)
531              this.renderedDosageInstruction = new StringType();
532            this.renderedDosageInstruction.setValue(value);
533          }
534          return this;
535        }
536
537        /**
538         * @return {@link #effectiveDosePeriod} (The period over which the medication is to be taken.  Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions.)
539         */
540        public Period getEffectiveDosePeriod() { 
541          if (this.effectiveDosePeriod == null)
542            if (Configuration.errorOnAutoCreate())
543              throw new Error("Attempt to auto-create MedicationRequestDoseComponent.effectiveDosePeriod");
544            else if (Configuration.doAutoCreate())
545              this.effectiveDosePeriod = new Period(); // cc
546          return this.effectiveDosePeriod;
547        }
548
549        public boolean hasEffectiveDosePeriod() { 
550          return this.effectiveDosePeriod != null && !this.effectiveDosePeriod.isEmpty();
551        }
552
553        /**
554         * @param value {@link #effectiveDosePeriod} (The period over which the medication is to be taken.  Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions.)
555         */
556        public MedicationRequestDoseComponent setEffectiveDosePeriod(Period value) { 
557          this.effectiveDosePeriod = value;
558          return this;
559        }
560
561        /**
562         * @return {@link #dosageInstruction} (Specific instructions for how the medication is to be used by the patient.)
563         */
564        public List<Dosage> getDosageInstruction() { 
565          if (this.dosageInstruction == null)
566            this.dosageInstruction = new ArrayList<Dosage>();
567          return this.dosageInstruction;
568        }
569
570        /**
571         * @return Returns a reference to <code>this</code> for easy method chaining
572         */
573        public MedicationRequestDoseComponent setDosageInstruction(List<Dosage> theDosageInstruction) { 
574          this.dosageInstruction = theDosageInstruction;
575          return this;
576        }
577
578        public boolean hasDosageInstruction() { 
579          if (this.dosageInstruction == null)
580            return false;
581          for (Dosage item : this.dosageInstruction)
582            if (!item.isEmpty())
583              return true;
584          return false;
585        }
586
587        public Dosage addDosageInstruction() { //3
588          Dosage t = new Dosage();
589          if (this.dosageInstruction == null)
590            this.dosageInstruction = new ArrayList<Dosage>();
591          this.dosageInstruction.add(t);
592          return t;
593        }
594
595        public MedicationRequestDoseComponent addDosageInstruction(Dosage t) { //3
596          if (t == null)
597            return this;
598          if (this.dosageInstruction == null)
599            this.dosageInstruction = new ArrayList<Dosage>();
600          this.dosageInstruction.add(t);
601          return this;
602        }
603
604        /**
605         * @return The first repetition of repeating field {@link #dosageInstruction}, creating it if it does not already exist {3}
606         */
607        public Dosage getDosageInstructionFirstRep() { 
608          if (getDosageInstruction().isEmpty()) {
609            addDosageInstruction();
610          }
611          return getDosageInstruction().get(0);
612        }
613
614        protected void listChildren(List<Property> children) {
615          super.listChildren(children);
616          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));
617          children.add(new Property("effectiveDosePeriod", "Period", "The period over which the medication is to be taken.  Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions.", 0, 1, effectiveDosePeriod));
618          children.add(new Property("dosageInstruction", "Dosage", "Specific instructions for how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction));
619        }
620
621        @Override
622        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
623          switch (_hash) {
624          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);
625          case 322608453: /*effectiveDosePeriod*/  return new Property("effectiveDosePeriod", "Period", "The period over which the medication is to be taken.  Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions.", 0, 1, effectiveDosePeriod);
626          case -1201373865: /*dosageInstruction*/  return new Property("dosageInstruction", "Dosage", "Specific instructions for how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction);
627          default: return super.getNamedProperty(_hash, _name, _checkValid);
628          }
629
630        }
631
632      @Override
633      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
634        switch (hash) {
635        case 1718902050: /*renderedDosageInstruction*/ return this.renderedDosageInstruction == null ? new Base[0] : new Base[] {this.renderedDosageInstruction}; // StringType
636        case 322608453: /*effectiveDosePeriod*/ return this.effectiveDosePeriod == null ? new Base[0] : new Base[] {this.effectiveDosePeriod}; // Period
637        case -1201373865: /*dosageInstruction*/ return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // Dosage
638        default: return super.getProperty(hash, name, checkValid);
639        }
640
641      }
642
643      @Override
644      public Base setProperty(int hash, String name, Base value) throws FHIRException {
645        switch (hash) {
646        case 1718902050: // renderedDosageInstruction
647          this.renderedDosageInstruction = TypeConvertor.castToString(value); // StringType
648          return value;
649        case 322608453: // effectiveDosePeriod
650          this.effectiveDosePeriod = TypeConvertor.castToPeriod(value); // Period
651          return value;
652        case -1201373865: // dosageInstruction
653          this.getDosageInstruction().add(TypeConvertor.castToDosage(value)); // Dosage
654          return value;
655        default: return super.setProperty(hash, name, value);
656        }
657
658      }
659
660      @Override
661      public Base setProperty(String name, Base value) throws FHIRException {
662        if (name.equals("renderedDosageInstruction")) {
663          this.renderedDosageInstruction = TypeConvertor.castToString(value); // StringType
664        } else if (name.equals("effectiveDosePeriod")) {
665          this.effectiveDosePeriod = TypeConvertor.castToPeriod(value); // Period
666        } else if (name.equals("dosageInstruction")) {
667          this.getDosageInstruction().add(TypeConvertor.castToDosage(value));
668        } else
669          return super.setProperty(name, value);
670        return value;
671      }
672
673      @Override
674      public Base makeProperty(int hash, String name) throws FHIRException {
675        switch (hash) {
676        case 1718902050:  return getRenderedDosageInstructionElement();
677        case 322608453:  return getEffectiveDosePeriod();
678        case -1201373865:  return addDosageInstruction(); 
679        default: return super.makeProperty(hash, name);
680        }
681
682      }
683
684      @Override
685      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
686        switch (hash) {
687        case 1718902050: /*renderedDosageInstruction*/ return new String[] {"string"};
688        case 322608453: /*effectiveDosePeriod*/ return new String[] {"Period"};
689        case -1201373865: /*dosageInstruction*/ return new String[] {"Dosage"};
690        default: return super.getTypesForProperty(hash, name);
691        }
692
693      }
694
695      @Override
696      public Base addChild(String name) throws FHIRException {
697        if (name.equals("renderedDosageInstruction")) {
698          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.dose.renderedDosageInstruction");
699        }
700        else if (name.equals("effectiveDosePeriod")) {
701          this.effectiveDosePeriod = new Period();
702          return this.effectiveDosePeriod;
703        }
704        else if (name.equals("dosageInstruction")) {
705          return addDosageInstruction();
706        }
707        else
708          return super.addChild(name);
709      }
710
711      public MedicationRequestDoseComponent copy() {
712        MedicationRequestDoseComponent dst = new MedicationRequestDoseComponent();
713        copyValues(dst);
714        return dst;
715      }
716
717      public void copyValues(MedicationRequestDoseComponent dst) {
718        super.copyValues(dst);
719        dst.renderedDosageInstruction = renderedDosageInstruction == null ? null : renderedDosageInstruction.copy();
720        dst.effectiveDosePeriod = effectiveDosePeriod == null ? null : effectiveDosePeriod.copy();
721        if (dosageInstruction != null) {
722          dst.dosageInstruction = new ArrayList<Dosage>();
723          for (Dosage i : dosageInstruction)
724            dst.dosageInstruction.add(i.copy());
725        };
726      }
727
728      @Override
729      public boolean equalsDeep(Base other_) {
730        if (!super.equalsDeep(other_))
731          return false;
732        if (!(other_ instanceof MedicationRequestDoseComponent))
733          return false;
734        MedicationRequestDoseComponent o = (MedicationRequestDoseComponent) other_;
735        return compareDeep(renderedDosageInstruction, o.renderedDosageInstruction, true) && compareDeep(effectiveDosePeriod, o.effectiveDosePeriod, true)
736           && compareDeep(dosageInstruction, o.dosageInstruction, true);
737      }
738
739      @Override
740      public boolean equalsShallow(Base other_) {
741        if (!super.equalsShallow(other_))
742          return false;
743        if (!(other_ instanceof MedicationRequestDoseComponent))
744          return false;
745        MedicationRequestDoseComponent o = (MedicationRequestDoseComponent) other_;
746        return compareValues(renderedDosageInstruction, o.renderedDosageInstruction, true);
747      }
748
749      public boolean isEmpty() {
750        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(renderedDosageInstruction, effectiveDosePeriod
751          , dosageInstruction);
752      }
753
754  public String fhirType() {
755    return "MedicationRequest.dose";
756
757  }
758
759  }
760
761    @Block()
762    public static class MedicationRequestDispenseRequestComponent extends BackboneElement implements IBaseBackboneElement {
763        /**
764         * Indicates the quantity or duration for the first dispense of the medication.
765         */
766        @Child(name = "initialFill", type = {}, order=1, min=0, max=1, modifier=false, summary=false)
767        @Description(shortDefinition="First fill details", formalDefinition="Indicates the quantity or duration for the first dispense of the medication." )
768        protected MedicationRequestDispenseRequestInitialFillComponent initialFill;
769
770        /**
771         * The minimum period of time that must occur between dispenses of the medication.
772         */
773        @Child(name = "dispenseInterval", type = {Duration.class}, order=2, min=0, max=1, modifier=false, summary=false)
774        @Description(shortDefinition="Minimum period of time between dispenses", formalDefinition="The minimum period of time that must occur between dispenses of the medication." )
775        protected Duration dispenseInterval;
776
777        /**
778         * This indicates the validity period of a prescription (stale dating the Prescription).
779         */
780        @Child(name = "validityPeriod", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
781        @Description(shortDefinition="Time period supply is authorized for", formalDefinition="This indicates the validity period of a prescription (stale dating the Prescription)." )
782        protected Period validityPeriod;
783
784        /**
785         * An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.
786         */
787        @Child(name = "numberOfRepeatsAllowed", type = {UnsignedIntType.class}, order=4, min=0, max=1, modifier=false, summary=false)
788        @Description(shortDefinition="Number of refills authorized", formalDefinition="An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense." )
789        protected UnsignedIntType numberOfRepeatsAllowed;
790
791        /**
792         * The amount that is to be dispensed for one fill.
793         */
794        @Child(name = "quantity", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
795        @Description(shortDefinition="Amount of medication to supply per dispense", formalDefinition="The amount that is to be dispensed for one fill." )
796        protected Quantity quantity;
797
798        /**
799         * Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.
800         */
801        @Child(name = "expectedSupplyDuration", type = {Duration.class}, order=6, min=0, max=1, modifier=false, summary=false)
802        @Description(shortDefinition="Number of days supply per dispense", formalDefinition="Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last." )
803        protected Duration expectedSupplyDuration;
804
805        /**
806         * Indicates the intended performing Organization that will dispense the medication as specified by the prescriber.
807         */
808        @Child(name = "dispenser", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=false)
809        @Description(shortDefinition="Intended performer of dispense", formalDefinition="Indicates the intended performing Organization that will dispense the medication as specified by the prescriber." )
810        protected Reference dispenser;
811
812        /**
813         * Provides additional information to the dispenser, for example, counselling to be provided to the patient.
814         */
815        @Child(name = "dispenserInstruction", type = {Annotation.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
816        @Description(shortDefinition="Additional information for the dispenser", formalDefinition="Provides additional information to the dispenser, for example, counselling to be provided to the patient." )
817        protected List<Annotation> dispenserInstruction;
818
819        /**
820         * Provides information about the type of adherence packaging to be supplied for the medication dispense.
821         */
822        @Child(name = "doseAdministrationAid", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
823        @Description(shortDefinition="Type of adherence packaging to use for the dispense", formalDefinition="Provides information about the type of adherence packaging to be supplied for the medication dispense." )
824        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-dose-aid")
825        protected CodeableConcept doseAdministrationAid;
826
827        private static final long serialVersionUID = -916083616L;
828
829    /**
830     * Constructor
831     */
832      public MedicationRequestDispenseRequestComponent() {
833        super();
834      }
835
836        /**
837         * @return {@link #initialFill} (Indicates the quantity or duration for the first dispense of the medication.)
838         */
839        public MedicationRequestDispenseRequestInitialFillComponent getInitialFill() { 
840          if (this.initialFill == null)
841            if (Configuration.errorOnAutoCreate())
842              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.initialFill");
843            else if (Configuration.doAutoCreate())
844              this.initialFill = new MedicationRequestDispenseRequestInitialFillComponent(); // cc
845          return this.initialFill;
846        }
847
848        public boolean hasInitialFill() { 
849          return this.initialFill != null && !this.initialFill.isEmpty();
850        }
851
852        /**
853         * @param value {@link #initialFill} (Indicates the quantity or duration for the first dispense of the medication.)
854         */
855        public MedicationRequestDispenseRequestComponent setInitialFill(MedicationRequestDispenseRequestInitialFillComponent value) { 
856          this.initialFill = value;
857          return this;
858        }
859
860        /**
861         * @return {@link #dispenseInterval} (The minimum period of time that must occur between dispenses of the medication.)
862         */
863        public Duration getDispenseInterval() { 
864          if (this.dispenseInterval == null)
865            if (Configuration.errorOnAutoCreate())
866              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.dispenseInterval");
867            else if (Configuration.doAutoCreate())
868              this.dispenseInterval = new Duration(); // cc
869          return this.dispenseInterval;
870        }
871
872        public boolean hasDispenseInterval() { 
873          return this.dispenseInterval != null && !this.dispenseInterval.isEmpty();
874        }
875
876        /**
877         * @param value {@link #dispenseInterval} (The minimum period of time that must occur between dispenses of the medication.)
878         */
879        public MedicationRequestDispenseRequestComponent setDispenseInterval(Duration value) { 
880          this.dispenseInterval = value;
881          return this;
882        }
883
884        /**
885         * @return {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).)
886         */
887        public Period getValidityPeriod() { 
888          if (this.validityPeriod == null)
889            if (Configuration.errorOnAutoCreate())
890              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.validityPeriod");
891            else if (Configuration.doAutoCreate())
892              this.validityPeriod = new Period(); // cc
893          return this.validityPeriod;
894        }
895
896        public boolean hasValidityPeriod() { 
897          return this.validityPeriod != null && !this.validityPeriod.isEmpty();
898        }
899
900        /**
901         * @param value {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).)
902         */
903        public MedicationRequestDispenseRequestComponent setValidityPeriod(Period value) { 
904          this.validityPeriod = value;
905          return this;
906        }
907
908        /**
909         * @return {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value
910         */
911        public UnsignedIntType getNumberOfRepeatsAllowedElement() { 
912          if (this.numberOfRepeatsAllowed == null)
913            if (Configuration.errorOnAutoCreate())
914              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.numberOfRepeatsAllowed");
915            else if (Configuration.doAutoCreate())
916              this.numberOfRepeatsAllowed = new UnsignedIntType(); // bb
917          return this.numberOfRepeatsAllowed;
918        }
919
920        public boolean hasNumberOfRepeatsAllowedElement() { 
921          return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty();
922        }
923
924        public boolean hasNumberOfRepeatsAllowed() { 
925          return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty();
926        }
927
928        /**
929         * @param value {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value
930         */
931        public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowedElement(UnsignedIntType value) { 
932          this.numberOfRepeatsAllowed = value;
933          return this;
934        }
935
936        /**
937         * @return An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.
938         */
939        public int getNumberOfRepeatsAllowed() { 
940          return this.numberOfRepeatsAllowed == null || this.numberOfRepeatsAllowed.isEmpty() ? 0 : this.numberOfRepeatsAllowed.getValue();
941        }
942
943        /**
944         * @param value An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.
945         */
946        public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowed(int value) { 
947            if (this.numberOfRepeatsAllowed == null)
948              this.numberOfRepeatsAllowed = new UnsignedIntType();
949            this.numberOfRepeatsAllowed.setValue(value);
950          return this;
951        }
952
953        /**
954         * @return {@link #quantity} (The amount that is to be dispensed for one fill.)
955         */
956        public Quantity getQuantity() { 
957          if (this.quantity == null)
958            if (Configuration.errorOnAutoCreate())
959              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.quantity");
960            else if (Configuration.doAutoCreate())
961              this.quantity = new Quantity(); // cc
962          return this.quantity;
963        }
964
965        public boolean hasQuantity() { 
966          return this.quantity != null && !this.quantity.isEmpty();
967        }
968
969        /**
970         * @param value {@link #quantity} (The amount that is to be dispensed for one fill.)
971         */
972        public MedicationRequestDispenseRequestComponent setQuantity(Quantity value) { 
973          this.quantity = value;
974          return this;
975        }
976
977        /**
978         * @return {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.)
979         */
980        public Duration getExpectedSupplyDuration() { 
981          if (this.expectedSupplyDuration == null)
982            if (Configuration.errorOnAutoCreate())
983              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.expectedSupplyDuration");
984            else if (Configuration.doAutoCreate())
985              this.expectedSupplyDuration = new Duration(); // cc
986          return this.expectedSupplyDuration;
987        }
988
989        public boolean hasExpectedSupplyDuration() { 
990          return this.expectedSupplyDuration != null && !this.expectedSupplyDuration.isEmpty();
991        }
992
993        /**
994         * @param value {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.)
995         */
996        public MedicationRequestDispenseRequestComponent setExpectedSupplyDuration(Duration value) { 
997          this.expectedSupplyDuration = value;
998          return this;
999        }
1000
1001        /**
1002         * @return {@link #dispenser} (Indicates the intended performing Organization that will dispense the medication as specified by the prescriber.)
1003         */
1004        public Reference getDispenser() { 
1005          if (this.dispenser == null)
1006            if (Configuration.errorOnAutoCreate())
1007              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.dispenser");
1008            else if (Configuration.doAutoCreate())
1009              this.dispenser = new Reference(); // cc
1010          return this.dispenser;
1011        }
1012
1013        public boolean hasDispenser() { 
1014          return this.dispenser != null && !this.dispenser.isEmpty();
1015        }
1016
1017        /**
1018         * @param value {@link #dispenser} (Indicates the intended performing Organization that will dispense the medication as specified by the prescriber.)
1019         */
1020        public MedicationRequestDispenseRequestComponent setDispenser(Reference value) { 
1021          this.dispenser = value;
1022          return this;
1023        }
1024
1025        /**
1026         * @return {@link #dispenserInstruction} (Provides additional information to the dispenser, for example, counselling to be provided to the patient.)
1027         */
1028        public List<Annotation> getDispenserInstruction() { 
1029          if (this.dispenserInstruction == null)
1030            this.dispenserInstruction = new ArrayList<Annotation>();
1031          return this.dispenserInstruction;
1032        }
1033
1034        /**
1035         * @return Returns a reference to <code>this</code> for easy method chaining
1036         */
1037        public MedicationRequestDispenseRequestComponent setDispenserInstruction(List<Annotation> theDispenserInstruction) { 
1038          this.dispenserInstruction = theDispenserInstruction;
1039          return this;
1040        }
1041
1042        public boolean hasDispenserInstruction() { 
1043          if (this.dispenserInstruction == null)
1044            return false;
1045          for (Annotation item : this.dispenserInstruction)
1046            if (!item.isEmpty())
1047              return true;
1048          return false;
1049        }
1050
1051        public Annotation addDispenserInstruction() { //3
1052          Annotation t = new Annotation();
1053          if (this.dispenserInstruction == null)
1054            this.dispenserInstruction = new ArrayList<Annotation>();
1055          this.dispenserInstruction.add(t);
1056          return t;
1057        }
1058
1059        public MedicationRequestDispenseRequestComponent addDispenserInstruction(Annotation t) { //3
1060          if (t == null)
1061            return this;
1062          if (this.dispenserInstruction == null)
1063            this.dispenserInstruction = new ArrayList<Annotation>();
1064          this.dispenserInstruction.add(t);
1065          return this;
1066        }
1067
1068        /**
1069         * @return The first repetition of repeating field {@link #dispenserInstruction}, creating it if it does not already exist {3}
1070         */
1071        public Annotation getDispenserInstructionFirstRep() { 
1072          if (getDispenserInstruction().isEmpty()) {
1073            addDispenserInstruction();
1074          }
1075          return getDispenserInstruction().get(0);
1076        }
1077
1078        /**
1079         * @return {@link #doseAdministrationAid} (Provides information about the type of adherence packaging to be supplied for the medication dispense.)
1080         */
1081        public CodeableConcept getDoseAdministrationAid() { 
1082          if (this.doseAdministrationAid == null)
1083            if (Configuration.errorOnAutoCreate())
1084              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.doseAdministrationAid");
1085            else if (Configuration.doAutoCreate())
1086              this.doseAdministrationAid = new CodeableConcept(); // cc
1087          return this.doseAdministrationAid;
1088        }
1089
1090        public boolean hasDoseAdministrationAid() { 
1091          return this.doseAdministrationAid != null && !this.doseAdministrationAid.isEmpty();
1092        }
1093
1094        /**
1095         * @param value {@link #doseAdministrationAid} (Provides information about the type of adherence packaging to be supplied for the medication dispense.)
1096         */
1097        public MedicationRequestDispenseRequestComponent setDoseAdministrationAid(CodeableConcept value) { 
1098          this.doseAdministrationAid = value;
1099          return this;
1100        }
1101
1102        protected void listChildren(List<Property> children) {
1103          super.listChildren(children);
1104          children.add(new Property("initialFill", "", "Indicates the quantity or duration for the first dispense of the medication.", 0, 1, initialFill));
1105          children.add(new Property("dispenseInterval", "Duration", "The minimum period of time that must occur between dispenses of the medication.", 0, 1, dispenseInterval));
1106          children.add(new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod));
1107          children.add(new Property("numberOfRepeatsAllowed", "unsignedInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.", 0, 1, numberOfRepeatsAllowed));
1108          children.add(new Property("quantity", "Quantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity));
1109          children.add(new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration));
1110          children.add(new Property("dispenser", "Reference(Organization)", "Indicates the intended performing Organization that will dispense the medication as specified by the prescriber.", 0, 1, dispenser));
1111          children.add(new Property("dispenserInstruction", "Annotation", "Provides additional information to the dispenser, for example, counselling to be provided to the patient.", 0, java.lang.Integer.MAX_VALUE, dispenserInstruction));
1112          children.add(new Property("doseAdministrationAid", "CodeableConcept", "Provides information about the type of adherence packaging to be supplied for the medication dispense.", 0, 1, doseAdministrationAid));
1113        }
1114
1115        @Override
1116        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1117          switch (_hash) {
1118          case 1232961255: /*initialFill*/  return new Property("initialFill", "", "Indicates the quantity or duration for the first dispense of the medication.", 0, 1, initialFill);
1119          case 757112130: /*dispenseInterval*/  return new Property("dispenseInterval", "Duration", "The minimum period of time that must occur between dispenses of the medication.", 0, 1, dispenseInterval);
1120          case -1434195053: /*validityPeriod*/  return new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod);
1121          case -239736976: /*numberOfRepeatsAllowed*/  return new Property("numberOfRepeatsAllowed", "unsignedInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.", 0, 1, numberOfRepeatsAllowed);
1122          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity);
1123          case -1910182789: /*expectedSupplyDuration*/  return new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration);
1124          case 241511093: /*dispenser*/  return new Property("dispenser", "Reference(Organization)", "Indicates the intended performing Organization that will dispense the medication as specified by the prescriber.", 0, 1, dispenser);
1125          case 2073630361: /*dispenserInstruction*/  return new Property("dispenserInstruction", "Annotation", "Provides additional information to the dispenser, for example, counselling to be provided to the patient.", 0, java.lang.Integer.MAX_VALUE, dispenserInstruction);
1126          case 390821217: /*doseAdministrationAid*/  return new Property("doseAdministrationAid", "CodeableConcept", "Provides information about the type of adherence packaging to be supplied for the medication dispense.", 0, 1, doseAdministrationAid);
1127          default: return super.getNamedProperty(_hash, _name, _checkValid);
1128          }
1129
1130        }
1131
1132      @Override
1133      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1134        switch (hash) {
1135        case 1232961255: /*initialFill*/ return this.initialFill == null ? new Base[0] : new Base[] {this.initialFill}; // MedicationRequestDispenseRequestInitialFillComponent
1136        case 757112130: /*dispenseInterval*/ return this.dispenseInterval == null ? new Base[0] : new Base[] {this.dispenseInterval}; // Duration
1137        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
1138        case -239736976: /*numberOfRepeatsAllowed*/ return this.numberOfRepeatsAllowed == null ? new Base[0] : new Base[] {this.numberOfRepeatsAllowed}; // UnsignedIntType
1139        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1140        case -1910182789: /*expectedSupplyDuration*/ return this.expectedSupplyDuration == null ? new Base[0] : new Base[] {this.expectedSupplyDuration}; // Duration
1141        case 241511093: /*dispenser*/ return this.dispenser == null ? new Base[0] : new Base[] {this.dispenser}; // Reference
1142        case 2073630361: /*dispenserInstruction*/ return this.dispenserInstruction == null ? new Base[0] : this.dispenserInstruction.toArray(new Base[this.dispenserInstruction.size()]); // Annotation
1143        case 390821217: /*doseAdministrationAid*/ return this.doseAdministrationAid == null ? new Base[0] : new Base[] {this.doseAdministrationAid}; // CodeableConcept
1144        default: return super.getProperty(hash, name, checkValid);
1145        }
1146
1147      }
1148
1149      @Override
1150      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1151        switch (hash) {
1152        case 1232961255: // initialFill
1153          this.initialFill = (MedicationRequestDispenseRequestInitialFillComponent) value; // MedicationRequestDispenseRequestInitialFillComponent
1154          return value;
1155        case 757112130: // dispenseInterval
1156          this.dispenseInterval = TypeConvertor.castToDuration(value); // Duration
1157          return value;
1158        case -1434195053: // validityPeriod
1159          this.validityPeriod = TypeConvertor.castToPeriod(value); // Period
1160          return value;
1161        case -239736976: // numberOfRepeatsAllowed
1162          this.numberOfRepeatsAllowed = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1163          return value;
1164        case -1285004149: // quantity
1165          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1166          return value;
1167        case -1910182789: // expectedSupplyDuration
1168          this.expectedSupplyDuration = TypeConvertor.castToDuration(value); // Duration
1169          return value;
1170        case 241511093: // dispenser
1171          this.dispenser = TypeConvertor.castToReference(value); // Reference
1172          return value;
1173        case 2073630361: // dispenserInstruction
1174          this.getDispenserInstruction().add(TypeConvertor.castToAnnotation(value)); // Annotation
1175          return value;
1176        case 390821217: // doseAdministrationAid
1177          this.doseAdministrationAid = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1178          return value;
1179        default: return super.setProperty(hash, name, value);
1180        }
1181
1182      }
1183
1184      @Override
1185      public Base setProperty(String name, Base value) throws FHIRException {
1186        if (name.equals("initialFill")) {
1187          this.initialFill = (MedicationRequestDispenseRequestInitialFillComponent) value; // MedicationRequestDispenseRequestInitialFillComponent
1188        } else if (name.equals("dispenseInterval")) {
1189          this.dispenseInterval = TypeConvertor.castToDuration(value); // Duration
1190        } else if (name.equals("validityPeriod")) {
1191          this.validityPeriod = TypeConvertor.castToPeriod(value); // Period
1192        } else if (name.equals("numberOfRepeatsAllowed")) {
1193          this.numberOfRepeatsAllowed = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1194        } else if (name.equals("quantity")) {
1195          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1196        } else if (name.equals("expectedSupplyDuration")) {
1197          this.expectedSupplyDuration = TypeConvertor.castToDuration(value); // Duration
1198        } else if (name.equals("dispenser")) {
1199          this.dispenser = TypeConvertor.castToReference(value); // Reference
1200        } else if (name.equals("dispenserInstruction")) {
1201          this.getDispenserInstruction().add(TypeConvertor.castToAnnotation(value));
1202        } else if (name.equals("doseAdministrationAid")) {
1203          this.doseAdministrationAid = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1204        } else
1205          return super.setProperty(name, value);
1206        return value;
1207      }
1208
1209      @Override
1210      public Base makeProperty(int hash, String name) throws FHIRException {
1211        switch (hash) {
1212        case 1232961255:  return getInitialFill();
1213        case 757112130:  return getDispenseInterval();
1214        case -1434195053:  return getValidityPeriod();
1215        case -239736976:  return getNumberOfRepeatsAllowedElement();
1216        case -1285004149:  return getQuantity();
1217        case -1910182789:  return getExpectedSupplyDuration();
1218        case 241511093:  return getDispenser();
1219        case 2073630361:  return addDispenserInstruction(); 
1220        case 390821217:  return getDoseAdministrationAid();
1221        default: return super.makeProperty(hash, name);
1222        }
1223
1224      }
1225
1226      @Override
1227      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1228        switch (hash) {
1229        case 1232961255: /*initialFill*/ return new String[] {};
1230        case 757112130: /*dispenseInterval*/ return new String[] {"Duration"};
1231        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
1232        case -239736976: /*numberOfRepeatsAllowed*/ return new String[] {"unsignedInt"};
1233        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1234        case -1910182789: /*expectedSupplyDuration*/ return new String[] {"Duration"};
1235        case 241511093: /*dispenser*/ return new String[] {"Reference"};
1236        case 2073630361: /*dispenserInstruction*/ return new String[] {"Annotation"};
1237        case 390821217: /*doseAdministrationAid*/ return new String[] {"CodeableConcept"};
1238        default: return super.getTypesForProperty(hash, name);
1239        }
1240
1241      }
1242
1243      @Override
1244      public Base addChild(String name) throws FHIRException {
1245        if (name.equals("initialFill")) {
1246          this.initialFill = new MedicationRequestDispenseRequestInitialFillComponent();
1247          return this.initialFill;
1248        }
1249        else if (name.equals("dispenseInterval")) {
1250          this.dispenseInterval = new Duration();
1251          return this.dispenseInterval;
1252        }
1253        else if (name.equals("validityPeriod")) {
1254          this.validityPeriod = new Period();
1255          return this.validityPeriod;
1256        }
1257        else if (name.equals("numberOfRepeatsAllowed")) {
1258          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.dispenseRequest.numberOfRepeatsAllowed");
1259        }
1260        else if (name.equals("quantity")) {
1261          this.quantity = new Quantity();
1262          return this.quantity;
1263        }
1264        else if (name.equals("expectedSupplyDuration")) {
1265          this.expectedSupplyDuration = new Duration();
1266          return this.expectedSupplyDuration;
1267        }
1268        else if (name.equals("dispenser")) {
1269          this.dispenser = new Reference();
1270          return this.dispenser;
1271        }
1272        else if (name.equals("dispenserInstruction")) {
1273          return addDispenserInstruction();
1274        }
1275        else if (name.equals("doseAdministrationAid")) {
1276          this.doseAdministrationAid = new CodeableConcept();
1277          return this.doseAdministrationAid;
1278        }
1279        else
1280          return super.addChild(name);
1281      }
1282
1283      public MedicationRequestDispenseRequestComponent copy() {
1284        MedicationRequestDispenseRequestComponent dst = new MedicationRequestDispenseRequestComponent();
1285        copyValues(dst);
1286        return dst;
1287      }
1288
1289      public void copyValues(MedicationRequestDispenseRequestComponent dst) {
1290        super.copyValues(dst);
1291        dst.initialFill = initialFill == null ? null : initialFill.copy();
1292        dst.dispenseInterval = dispenseInterval == null ? null : dispenseInterval.copy();
1293        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
1294        dst.numberOfRepeatsAllowed = numberOfRepeatsAllowed == null ? null : numberOfRepeatsAllowed.copy();
1295        dst.quantity = quantity == null ? null : quantity.copy();
1296        dst.expectedSupplyDuration = expectedSupplyDuration == null ? null : expectedSupplyDuration.copy();
1297        dst.dispenser = dispenser == null ? null : dispenser.copy();
1298        if (dispenserInstruction != null) {
1299          dst.dispenserInstruction = new ArrayList<Annotation>();
1300          for (Annotation i : dispenserInstruction)
1301            dst.dispenserInstruction.add(i.copy());
1302        };
1303        dst.doseAdministrationAid = doseAdministrationAid == null ? null : doseAdministrationAid.copy();
1304      }
1305
1306      @Override
1307      public boolean equalsDeep(Base other_) {
1308        if (!super.equalsDeep(other_))
1309          return false;
1310        if (!(other_ instanceof MedicationRequestDispenseRequestComponent))
1311          return false;
1312        MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_;
1313        return compareDeep(initialFill, o.initialFill, true) && compareDeep(dispenseInterval, o.dispenseInterval, true)
1314           && compareDeep(validityPeriod, o.validityPeriod, true) && compareDeep(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true)
1315           && compareDeep(quantity, o.quantity, true) && compareDeep(expectedSupplyDuration, o.expectedSupplyDuration, true)
1316           && compareDeep(dispenser, o.dispenser, true) && compareDeep(dispenserInstruction, o.dispenserInstruction, true)
1317           && compareDeep(doseAdministrationAid, o.doseAdministrationAid, true);
1318      }
1319
1320      @Override
1321      public boolean equalsShallow(Base other_) {
1322        if (!super.equalsShallow(other_))
1323          return false;
1324        if (!(other_ instanceof MedicationRequestDispenseRequestComponent))
1325          return false;
1326        MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_;
1327        return compareValues(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true);
1328      }
1329
1330      public boolean isEmpty() {
1331        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(initialFill, dispenseInterval
1332          , validityPeriod, numberOfRepeatsAllowed, quantity, expectedSupplyDuration, dispenser
1333          , dispenserInstruction, doseAdministrationAid);
1334      }
1335
1336  public String fhirType() {
1337    return "MedicationRequest.dispenseRequest";
1338
1339  }
1340
1341  }
1342
1343    @Block()
1344    public static class MedicationRequestDispenseRequestInitialFillComponent extends BackboneElement implements IBaseBackboneElement {
1345        /**
1346         * The amount or quantity to provide as part of the first dispense.
1347         */
1348        @Child(name = "quantity", type = {Quantity.class}, order=1, min=0, max=1, modifier=false, summary=false)
1349        @Description(shortDefinition="First fill quantity", formalDefinition="The amount or quantity to provide as part of the first dispense." )
1350        protected Quantity quantity;
1351
1352        /**
1353         * The length of time that the first dispense is expected to last.
1354         */
1355        @Child(name = "duration", type = {Duration.class}, order=2, min=0, max=1, modifier=false, summary=false)
1356        @Description(shortDefinition="First fill duration", formalDefinition="The length of time that the first dispense is expected to last." )
1357        protected Duration duration;
1358
1359        private static final long serialVersionUID = 1223227956L;
1360
1361    /**
1362     * Constructor
1363     */
1364      public MedicationRequestDispenseRequestInitialFillComponent() {
1365        super();
1366      }
1367
1368        /**
1369         * @return {@link #quantity} (The amount or quantity to provide as part of the first dispense.)
1370         */
1371        public Quantity getQuantity() { 
1372          if (this.quantity == null)
1373            if (Configuration.errorOnAutoCreate())
1374              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestInitialFillComponent.quantity");
1375            else if (Configuration.doAutoCreate())
1376              this.quantity = new Quantity(); // cc
1377          return this.quantity;
1378        }
1379
1380        public boolean hasQuantity() { 
1381          return this.quantity != null && !this.quantity.isEmpty();
1382        }
1383
1384        /**
1385         * @param value {@link #quantity} (The amount or quantity to provide as part of the first dispense.)
1386         */
1387        public MedicationRequestDispenseRequestInitialFillComponent setQuantity(Quantity value) { 
1388          this.quantity = value;
1389          return this;
1390        }
1391
1392        /**
1393         * @return {@link #duration} (The length of time that the first dispense is expected to last.)
1394         */
1395        public Duration getDuration() { 
1396          if (this.duration == null)
1397            if (Configuration.errorOnAutoCreate())
1398              throw new Error("Attempt to auto-create MedicationRequestDispenseRequestInitialFillComponent.duration");
1399            else if (Configuration.doAutoCreate())
1400              this.duration = new Duration(); // cc
1401          return this.duration;
1402        }
1403
1404        public boolean hasDuration() { 
1405          return this.duration != null && !this.duration.isEmpty();
1406        }
1407
1408        /**
1409         * @param value {@link #duration} (The length of time that the first dispense is expected to last.)
1410         */
1411        public MedicationRequestDispenseRequestInitialFillComponent setDuration(Duration value) { 
1412          this.duration = value;
1413          return this;
1414        }
1415
1416        protected void listChildren(List<Property> children) {
1417          super.listChildren(children);
1418          children.add(new Property("quantity", "Quantity", "The amount or quantity to provide as part of the first dispense.", 0, 1, quantity));
1419          children.add(new Property("duration", "Duration", "The length of time that the first dispense is expected to last.", 0, 1, duration));
1420        }
1421
1422        @Override
1423        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1424          switch (_hash) {
1425          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount or quantity to provide as part of the first dispense.", 0, 1, quantity);
1426          case -1992012396: /*duration*/  return new Property("duration", "Duration", "The length of time that the first dispense is expected to last.", 0, 1, duration);
1427          default: return super.getNamedProperty(_hash, _name, _checkValid);
1428          }
1429
1430        }
1431
1432      @Override
1433      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1434        switch (hash) {
1435        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1436        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Duration
1437        default: return super.getProperty(hash, name, checkValid);
1438        }
1439
1440      }
1441
1442      @Override
1443      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1444        switch (hash) {
1445        case -1285004149: // quantity
1446          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1447          return value;
1448        case -1992012396: // duration
1449          this.duration = TypeConvertor.castToDuration(value); // Duration
1450          return value;
1451        default: return super.setProperty(hash, name, value);
1452        }
1453
1454      }
1455
1456      @Override
1457      public Base setProperty(String name, Base value) throws FHIRException {
1458        if (name.equals("quantity")) {
1459          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1460        } else if (name.equals("duration")) {
1461          this.duration = TypeConvertor.castToDuration(value); // Duration
1462        } else
1463          return super.setProperty(name, value);
1464        return value;
1465      }
1466
1467      @Override
1468      public Base makeProperty(int hash, String name) throws FHIRException {
1469        switch (hash) {
1470        case -1285004149:  return getQuantity();
1471        case -1992012396:  return getDuration();
1472        default: return super.makeProperty(hash, name);
1473        }
1474
1475      }
1476
1477      @Override
1478      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1479        switch (hash) {
1480        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1481        case -1992012396: /*duration*/ return new String[] {"Duration"};
1482        default: return super.getTypesForProperty(hash, name);
1483        }
1484
1485      }
1486
1487      @Override
1488      public Base addChild(String name) throws FHIRException {
1489        if (name.equals("quantity")) {
1490          this.quantity = new Quantity();
1491          return this.quantity;
1492        }
1493        else if (name.equals("duration")) {
1494          this.duration = new Duration();
1495          return this.duration;
1496        }
1497        else
1498          return super.addChild(name);
1499      }
1500
1501      public MedicationRequestDispenseRequestInitialFillComponent copy() {
1502        MedicationRequestDispenseRequestInitialFillComponent dst = new MedicationRequestDispenseRequestInitialFillComponent();
1503        copyValues(dst);
1504        return dst;
1505      }
1506
1507      public void copyValues(MedicationRequestDispenseRequestInitialFillComponent dst) {
1508        super.copyValues(dst);
1509        dst.quantity = quantity == null ? null : quantity.copy();
1510        dst.duration = duration == null ? null : duration.copy();
1511      }
1512
1513      @Override
1514      public boolean equalsDeep(Base other_) {
1515        if (!super.equalsDeep(other_))
1516          return false;
1517        if (!(other_ instanceof MedicationRequestDispenseRequestInitialFillComponent))
1518          return false;
1519        MedicationRequestDispenseRequestInitialFillComponent o = (MedicationRequestDispenseRequestInitialFillComponent) other_;
1520        return compareDeep(quantity, o.quantity, true) && compareDeep(duration, o.duration, true);
1521      }
1522
1523      @Override
1524      public boolean equalsShallow(Base other_) {
1525        if (!super.equalsShallow(other_))
1526          return false;
1527        if (!(other_ instanceof MedicationRequestDispenseRequestInitialFillComponent))
1528          return false;
1529        MedicationRequestDispenseRequestInitialFillComponent o = (MedicationRequestDispenseRequestInitialFillComponent) other_;
1530        return true;
1531      }
1532
1533      public boolean isEmpty() {
1534        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, duration);
1535      }
1536
1537  public String fhirType() {
1538    return "MedicationRequest.dispenseRequest.initialFill";
1539
1540  }
1541
1542  }
1543
1544    @Block()
1545    public static class MedicationRequestSubstitutionComponent extends BackboneElement implements IBaseBackboneElement {
1546        /**
1547         * True if the prescriber allows a different drug to be dispensed from what was prescribed.
1548         */
1549        @Child(name = "allowed", type = {BooleanType.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1550        @Description(shortDefinition="Whether substitution is allowed or not", formalDefinition="True if the prescriber allows a different drug to be dispensed from what was prescribed." )
1551        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode")
1552        protected DataType allowed;
1553
1554        /**
1555         * Indicates the reason for the substitution, or why substitution must or must not be performed.
1556         */
1557        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1558        @Description(shortDefinition="Why should (not) substitution be made", formalDefinition="Indicates the reason for the substitution, or why substitution must or must not be performed." )
1559        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-SubstanceAdminSubstitutionReason")
1560        protected CodeableConcept reason;
1561
1562        private static final long serialVersionUID = -855005751L;
1563
1564    /**
1565     * Constructor
1566     */
1567      public MedicationRequestSubstitutionComponent() {
1568        super();
1569      }
1570
1571    /**
1572     * Constructor
1573     */
1574      public MedicationRequestSubstitutionComponent(DataType allowed) {
1575        super();
1576        this.setAllowed(allowed);
1577      }
1578
1579        /**
1580         * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.)
1581         */
1582        public DataType getAllowed() { 
1583          return this.allowed;
1584        }
1585
1586        /**
1587         * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.)
1588         */
1589        public BooleanType getAllowedBooleanType() throws FHIRException { 
1590          if (this.allowed == null)
1591            this.allowed = new BooleanType();
1592          if (!(this.allowed instanceof BooleanType))
1593            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.allowed.getClass().getName()+" was encountered");
1594          return (BooleanType) this.allowed;
1595        }
1596
1597        public boolean hasAllowedBooleanType() { 
1598          return this != null && this.allowed instanceof BooleanType;
1599        }
1600
1601        /**
1602         * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.)
1603         */
1604        public CodeableConcept getAllowedCodeableConcept() throws FHIRException { 
1605          if (this.allowed == null)
1606            this.allowed = new CodeableConcept();
1607          if (!(this.allowed instanceof CodeableConcept))
1608            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.allowed.getClass().getName()+" was encountered");
1609          return (CodeableConcept) this.allowed;
1610        }
1611
1612        public boolean hasAllowedCodeableConcept() { 
1613          return this != null && this.allowed instanceof CodeableConcept;
1614        }
1615
1616        public boolean hasAllowed() { 
1617          return this.allowed != null && !this.allowed.isEmpty();
1618        }
1619
1620        /**
1621         * @param value {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.)
1622         */
1623        public MedicationRequestSubstitutionComponent setAllowed(DataType value) { 
1624          if (value != null && !(value instanceof BooleanType || value instanceof CodeableConcept))
1625            throw new Error("Not the right type for MedicationRequest.substitution.allowed[x]: "+value.fhirType());
1626          this.allowed = value;
1627          return this;
1628        }
1629
1630        /**
1631         * @return {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.)
1632         */
1633        public CodeableConcept getReason() { 
1634          if (this.reason == null)
1635            if (Configuration.errorOnAutoCreate())
1636              throw new Error("Attempt to auto-create MedicationRequestSubstitutionComponent.reason");
1637            else if (Configuration.doAutoCreate())
1638              this.reason = new CodeableConcept(); // cc
1639          return this.reason;
1640        }
1641
1642        public boolean hasReason() { 
1643          return this.reason != null && !this.reason.isEmpty();
1644        }
1645
1646        /**
1647         * @param value {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.)
1648         */
1649        public MedicationRequestSubstitutionComponent setReason(CodeableConcept value) { 
1650          this.reason = value;
1651          return this;
1652        }
1653
1654        protected void listChildren(List<Property> children) {
1655          super.listChildren(children);
1656          children.add(new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed));
1657          children.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason));
1658        }
1659
1660        @Override
1661        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1662          switch (_hash) {
1663          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed);
1664          case -911343192: /*allowed*/  return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed);
1665          case 177755488: /*allowedBoolean*/  return new Property("allowed[x]", "boolean", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed);
1666          case 963125465: /*allowedCodeableConcept*/  return new Property("allowed[x]", "CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed);
1667          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason);
1668          default: return super.getNamedProperty(_hash, _name, _checkValid);
1669          }
1670
1671        }
1672
1673      @Override
1674      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1675        switch (hash) {
1676        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // DataType
1677        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
1678        default: return super.getProperty(hash, name, checkValid);
1679        }
1680
1681      }
1682
1683      @Override
1684      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1685        switch (hash) {
1686        case -911343192: // allowed
1687          this.allowed = TypeConvertor.castToType(value); // DataType
1688          return value;
1689        case -934964668: // reason
1690          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1691          return value;
1692        default: return super.setProperty(hash, name, value);
1693        }
1694
1695      }
1696
1697      @Override
1698      public Base setProperty(String name, Base value) throws FHIRException {
1699        if (name.equals("allowed[x]")) {
1700          this.allowed = TypeConvertor.castToType(value); // DataType
1701        } else if (name.equals("reason")) {
1702          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1703        } else
1704          return super.setProperty(name, value);
1705        return value;
1706      }
1707
1708      @Override
1709      public Base makeProperty(int hash, String name) throws FHIRException {
1710        switch (hash) {
1711        case -1336663592:  return getAllowed();
1712        case -911343192:  return getAllowed();
1713        case -934964668:  return getReason();
1714        default: return super.makeProperty(hash, name);
1715        }
1716
1717      }
1718
1719      @Override
1720      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1721        switch (hash) {
1722        case -911343192: /*allowed*/ return new String[] {"boolean", "CodeableConcept"};
1723        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
1724        default: return super.getTypesForProperty(hash, name);
1725        }
1726
1727      }
1728
1729      @Override
1730      public Base addChild(String name) throws FHIRException {
1731        if (name.equals("allowedBoolean")) {
1732          this.allowed = new BooleanType();
1733          return this.allowed;
1734        }
1735        else if (name.equals("allowedCodeableConcept")) {
1736          this.allowed = new CodeableConcept();
1737          return this.allowed;
1738        }
1739        else if (name.equals("reason")) {
1740          this.reason = new CodeableConcept();
1741          return this.reason;
1742        }
1743        else
1744          return super.addChild(name);
1745      }
1746
1747      public MedicationRequestSubstitutionComponent copy() {
1748        MedicationRequestSubstitutionComponent dst = new MedicationRequestSubstitutionComponent();
1749        copyValues(dst);
1750        return dst;
1751      }
1752
1753      public void copyValues(MedicationRequestSubstitutionComponent dst) {
1754        super.copyValues(dst);
1755        dst.allowed = allowed == null ? null : allowed.copy();
1756        dst.reason = reason == null ? null : reason.copy();
1757      }
1758
1759      @Override
1760      public boolean equalsDeep(Base other_) {
1761        if (!super.equalsDeep(other_))
1762          return false;
1763        if (!(other_ instanceof MedicationRequestSubstitutionComponent))
1764          return false;
1765        MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_;
1766        return compareDeep(allowed, o.allowed, true) && compareDeep(reason, o.reason, true);
1767      }
1768
1769      @Override
1770      public boolean equalsShallow(Base other_) {
1771        if (!super.equalsShallow(other_))
1772          return false;
1773        if (!(other_ instanceof MedicationRequestSubstitutionComponent))
1774          return false;
1775        MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_;
1776        return true;
1777      }
1778
1779      public boolean isEmpty() {
1780        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(allowed, reason);
1781      }
1782
1783  public String fhirType() {
1784    return "MedicationRequest.substitution";
1785
1786  }
1787
1788  }
1789
1790    /**
1791     * Identifiers associated with this medication request 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.
1792     */
1793    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1794    @Description(shortDefinition="External ids for this request", formalDefinition="Identifiers associated with this medication request 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." )
1795    protected List<Identifier> identifier;
1796
1797    /**
1798     * The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.
1799     */
1800    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1801    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest." )
1802    protected List<CanonicalType> instantiatesCanonical;
1803
1804    /**
1805     * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.
1806     */
1807    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1808    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest." )
1809    protected List<UriType> instantiatesUri;
1810
1811    /**
1812     * A plan or request that is fulfilled in whole or in part by this medication request.
1813     */
1814    @Child(name = "basedOn", type = {CarePlan.class, MedicationRequest.class, ServiceRequest.class, ImmunizationRecommendation.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1815    @Description(shortDefinition="What request fulfills", formalDefinition="A plan or request that is fulfilled in whole or in part by this medication request." )
1816    protected List<Reference> basedOn;
1817
1818    /**
1819     * A link to a resource representing an earlier order related order or prescription.
1820     */
1821    @Child(name = "priorPrescription", type = {MedicationRequest.class}, order=4, min=0, max=1, modifier=false, summary=false)
1822    @Description(shortDefinition="An order/prescription that is being replaced", formalDefinition="A link to a resource representing an earlier order related order or prescription." )
1823    protected Reference priorPrescription;
1824
1825    /**
1826     * A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.
1827     */
1828    @Child(name = "groupIdentifier", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true)
1829    @Description(shortDefinition="Composite request this is part of", formalDefinition="A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription." )
1830    protected Identifier groupIdentifier;
1831
1832    /**
1833     * A code specifying the current state of the order.  Generally, this will be active or completed state.
1834     */
1835    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
1836    @Description(shortDefinition="active | on-hold | ended | stopped | completed | cancelled | entered-in-error | draft | unknown", formalDefinition="A code specifying the current state of the order.  Generally, this will be active or completed state." )
1837    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-status")
1838    protected Enumeration<MedicationrequestStatus> status;
1839
1840    /**
1841     * Captures the reason for the current state of the MedicationRequest.
1842     */
1843    @Child(name = "statusReason", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
1844    @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current state of the MedicationRequest." )
1845    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-status-reason")
1846    protected CodeableConcept statusReason;
1847
1848    /**
1849     * The date (and perhaps time) when the status was changed.
1850     */
1851    @Child(name = "statusChanged", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
1852    @Description(shortDefinition="When the status was changed", formalDefinition="The date (and perhaps time) when the status was changed." )
1853    protected DateTimeType statusChanged;
1854
1855    /**
1856     * Whether the request is a proposal, plan, or an original order.
1857     */
1858    @Child(name = "intent", type = {CodeType.class}, order=9, min=1, max=1, modifier=true, summary=true)
1859    @Description(shortDefinition="proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition="Whether the request is a proposal, plan, or an original order." )
1860    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-intent")
1861    protected Enumeration<MedicationRequestIntent> intent;
1862
1863    /**
1864     * Indicates the grouping or category of medication request (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).
1865     */
1866    @Child(name = "category", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1867    @Description(shortDefinition="Grouping or category of medication request", formalDefinition="Indicates the grouping or category of medication request (for example, drug classification like ATC, where meds would be administered, legal category of the medication.)." )
1868    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-admin-location")
1869    protected List<CodeableConcept> category;
1870
1871    /**
1872     * Indicates how quickly the Medication Request should be addressed with respect to other requests.
1873     */
1874    @Child(name = "priority", type = {CodeType.class}, order=11, min=0, max=1, modifier=false, summary=true)
1875    @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the Medication Request should be addressed with respect to other requests." )
1876    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
1877    protected Enumeration<RequestPriority> priority;
1878
1879    /**
1880     * If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.
1881     */
1882    @Child(name = "doNotPerform", type = {BooleanType.class}, order=12, min=0, max=1, modifier=true, summary=true)
1883    @Description(shortDefinition="True if patient is to stop taking or not to start taking the medication", formalDefinition="If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication." )
1884    protected BooleanType doNotPerform;
1885
1886    /**
1887     * Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.
1888     */
1889    @Child(name = "medication", type = {CodeableReference.class}, order=13, min=1, max=1, modifier=false, summary=true)
1890    @Description(shortDefinition="Medication to be taken", formalDefinition="Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications." )
1891    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes")
1892    protected CodeableReference medication;
1893
1894    /**
1895     * A link to a resource representing the person or set of individuals to whom the medication will be given.
1896     */
1897    @Child(name = "subject", type = {Patient.class, Group.class}, order=14, min=1, max=1, modifier=false, summary=true)
1898    @Description(shortDefinition="Who or group medication request is for", formalDefinition="A link to a resource representing the person or set of individuals to whom the medication will be given." )
1899    protected Reference subject;
1900
1901    /**
1902     * The person or organization who provided the information about this request, if the source is someone other than the requestor.  This is often used when the MedicationRequest is reported by another person.
1903     */
1904    @Child(name = "informationSource", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Organization.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1905    @Description(shortDefinition="The person or organization who provided the information about this request, if the source is someone other than the requestor", formalDefinition="The person or organization who provided the information about this request, if the source is someone other than the requestor.  This is often used when the MedicationRequest is reported by another person." )
1906    protected List<Reference> informationSource;
1907
1908    /**
1909     * The Encounter during which this [x] was created or to which the creation of this record is tightly associated.
1910     */
1911    @Child(name = "encounter", type = {Encounter.class}, order=16, min=0, max=1, modifier=false, summary=false)
1912    @Description(shortDefinition="Encounter created as part of encounter/admission/stay", formalDefinition="The Encounter during which this [x] was created or to which the creation of this record is tightly associated." )
1913    protected Reference encounter;
1914
1915    /**
1916     * Information to support fulfilling (i.e. dispensing or administering) of the medication, for example, patient height and weight, a MedicationUsage for the patient).
1917     */
1918    @Child(name = "supportingInformation", type = {Reference.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1919    @Description(shortDefinition="Information to support fulfilling of the medication", formalDefinition="Information to support fulfilling (i.e. dispensing or administering) of the medication, for example, patient height and weight, a MedicationUsage for the patient)." )
1920    protected List<Reference> supportingInformation;
1921
1922    /**
1923     * The date (and perhaps time) when the prescription was initially written or authored on.
1924     */
1925    @Child(name = "authoredOn", type = {DateTimeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
1926    @Description(shortDefinition="When request was initially authored", formalDefinition="The date (and perhaps time) when the prescription was initially written or authored on." )
1927    protected DateTimeType authoredOn;
1928
1929    /**
1930     * The individual, organization, or device that initiated the request and has responsibility for its activation.
1931     */
1932    @Child(name = "requester", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=19, min=0, max=1, modifier=false, summary=true)
1933    @Description(shortDefinition="Who/What requested the Request", formalDefinition="The individual, organization, or device that initiated the request and has responsibility for its activation." )
1934    protected Reference requester;
1935
1936    /**
1937     * Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.
1938     */
1939    @Child(name = "reported", type = {BooleanType.class}, order=20, min=0, max=1, modifier=false, summary=true)
1940    @Description(shortDefinition="Reported rather than primary record", formalDefinition="Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report." )
1941    protected BooleanType reported;
1942
1943    /**
1944     * Indicates the type of performer of the administration of the medication.
1945     */
1946    @Child(name = "performerType", type = {CodeableConcept.class}, order=21, min=0, max=1, modifier=false, summary=true)
1947    @Description(shortDefinition="Desired kind of performer of the medication administration", formalDefinition="Indicates the type of performer of the administration of the medication." )
1948    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-intended-performer-role")
1949    protected CodeableConcept performerType;
1950
1951    /**
1952     * The specified desired performer of the medication treatment (e.g. the performer of the medication administration).
1953     */
1954    @Child(name = "performer", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, Device.class, RelatedPerson.class, CareTeam.class, HealthcareService.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1955    @Description(shortDefinition="Intended performer of administration", formalDefinition="The specified desired performer of the medication treatment (e.g. the performer of the medication administration)." )
1956    protected List<Reference> performer;
1957
1958    /**
1959     * The intended type of device that is to be used for the administration of the medication (for example, PCA Pump).
1960     */
1961    @Child(name = "device", type = {CodeableReference.class}, order=23, min=0, max=1, modifier=false, summary=false)
1962    @Description(shortDefinition="Intended type of device for the administration", formalDefinition="The intended type of device that is to be used for the administration of the medication (for example, PCA Pump)." )
1963    protected CodeableReference device;
1964
1965    /**
1966     * The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.
1967     */
1968    @Child(name = "recorder", type = {Practitioner.class, PractitionerRole.class}, order=24, min=0, max=1, modifier=false, summary=false)
1969    @Description(shortDefinition="Person who entered the request", formalDefinition="The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order." )
1970    protected Reference recorder;
1971
1972    /**
1973     * The reason or the indication for ordering or not ordering the medication.
1974     */
1975    @Child(name = "reason", type = {CodeableReference.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1976    @Description(shortDefinition="Reason or indication for ordering or not ordering the medication", formalDefinition="The reason or the indication for ordering or not ordering the medication." )
1977    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
1978    protected List<CodeableReference> reason;
1979
1980    /**
1981     * The description of the overall pattern of the administration of the medication to the patient.
1982     */
1983    @Child(name = "courseOfTherapyType", type = {CodeableConcept.class}, order=26, min=0, max=1, modifier=false, summary=false)
1984    @Description(shortDefinition="Overall pattern of medication administration", formalDefinition="The description of the overall pattern of the administration of the medication to the patient." )
1985    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-course-of-therapy")
1986    protected CodeableConcept courseOfTherapyType;
1987
1988    /**
1989     * Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.
1990     */
1991    @Child(name = "insurance", type = {Coverage.class, ClaimResponse.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1992    @Description(shortDefinition="Associated insurance coverage", formalDefinition="Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service." )
1993    protected List<Reference> insurance;
1994
1995    /**
1996     * Extra information about the prescription that could not be conveyed by the other attributes.
1997     */
1998    @Child(name = "note", type = {Annotation.class}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1999    @Description(shortDefinition="Information about the prescription", formalDefinition="Extra information about the prescription that could not be conveyed by the other attributes." )
2000    protected List<Annotation> note;
2001
2002    /**
2003     * Indicates how the medication is to be used by the patient.
2004     */
2005    @Child(name = "dose", type = {}, order=29, min=0, max=1, modifier=false, summary=false)
2006    @Description(shortDefinition="How the medication should be taken", formalDefinition="Indicates how the medication is to be used by the patient." )
2007    protected MedicationRequestDoseComponent dose;
2008
2009    /**
2010     * Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order).  Note that this information is not always sent with the order.  There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.
2011     */
2012    @Child(name = "dispenseRequest", type = {}, order=30, min=0, max=1, modifier=false, summary=false)
2013    @Description(shortDefinition="Medication supply authorization", formalDefinition="Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order).  Note that this information is not always sent with the order.  There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department." )
2014    protected MedicationRequestDispenseRequestComponent dispenseRequest;
2015
2016    /**
2017     * Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.
2018     */
2019    @Child(name = "substitution", type = {}, order=31, min=0, max=1, modifier=false, summary=false)
2020    @Description(shortDefinition="Any restrictions on medication substitution", formalDefinition="Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done." )
2021    protected MedicationRequestSubstitutionComponent substitution;
2022
2023    /**
2024     * Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.
2025     */
2026    @Child(name = "eventHistory", type = {Provenance.class}, order=32, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2027    @Description(shortDefinition="A list of events of interest in the lifecycle", formalDefinition="Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource." )
2028    protected List<Reference> eventHistory;
2029
2030    private static final long serialVersionUID = 731059762L;
2031
2032  /**
2033   * Constructor
2034   */
2035    public MedicationRequest() {
2036      super();
2037    }
2038
2039  /**
2040   * Constructor
2041   */
2042    public MedicationRequest(MedicationrequestStatus status, MedicationRequestIntent intent, CodeableReference medication, Reference subject) {
2043      super();
2044      this.setStatus(status);
2045      this.setIntent(intent);
2046      this.setMedication(medication);
2047      this.setSubject(subject);
2048    }
2049
2050    /**
2051     * @return {@link #identifier} (Identifiers associated with this medication request 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.)
2052     */
2053    public List<Identifier> getIdentifier() { 
2054      if (this.identifier == null)
2055        this.identifier = new ArrayList<Identifier>();
2056      return this.identifier;
2057    }
2058
2059    /**
2060     * @return Returns a reference to <code>this</code> for easy method chaining
2061     */
2062    public MedicationRequest setIdentifier(List<Identifier> theIdentifier) { 
2063      this.identifier = theIdentifier;
2064      return this;
2065    }
2066
2067    public boolean hasIdentifier() { 
2068      if (this.identifier == null)
2069        return false;
2070      for (Identifier item : this.identifier)
2071        if (!item.isEmpty())
2072          return true;
2073      return false;
2074    }
2075
2076    public Identifier addIdentifier() { //3
2077      Identifier t = new Identifier();
2078      if (this.identifier == null)
2079        this.identifier = new ArrayList<Identifier>();
2080      this.identifier.add(t);
2081      return t;
2082    }
2083
2084    public MedicationRequest addIdentifier(Identifier t) { //3
2085      if (t == null)
2086        return this;
2087      if (this.identifier == null)
2088        this.identifier = new ArrayList<Identifier>();
2089      this.identifier.add(t);
2090      return this;
2091    }
2092
2093    /**
2094     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2095     */
2096    public Identifier getIdentifierFirstRep() { 
2097      if (getIdentifier().isEmpty()) {
2098        addIdentifier();
2099      }
2100      return getIdentifier().get(0);
2101    }
2102
2103    /**
2104     * @return {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.)
2105     */
2106    public List<CanonicalType> getInstantiatesCanonical() { 
2107      if (this.instantiatesCanonical == null)
2108        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2109      return this.instantiatesCanonical;
2110    }
2111
2112    /**
2113     * @return Returns a reference to <code>this</code> for easy method chaining
2114     */
2115    public MedicationRequest setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
2116      this.instantiatesCanonical = theInstantiatesCanonical;
2117      return this;
2118    }
2119
2120    public boolean hasInstantiatesCanonical() { 
2121      if (this.instantiatesCanonical == null)
2122        return false;
2123      for (CanonicalType item : this.instantiatesCanonical)
2124        if (!item.isEmpty())
2125          return true;
2126      return false;
2127    }
2128
2129    /**
2130     * @return {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.)
2131     */
2132    public CanonicalType addInstantiatesCanonicalElement() {//2 
2133      CanonicalType t = new CanonicalType();
2134      if (this.instantiatesCanonical == null)
2135        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2136      this.instantiatesCanonical.add(t);
2137      return t;
2138    }
2139
2140    /**
2141     * @param value {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.)
2142     */
2143    public MedicationRequest addInstantiatesCanonical(String value) { //1
2144      CanonicalType t = new CanonicalType();
2145      t.setValue(value);
2146      if (this.instantiatesCanonical == null)
2147        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2148      this.instantiatesCanonical.add(t);
2149      return this;
2150    }
2151
2152    /**
2153     * @param value {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.)
2154     */
2155    public boolean hasInstantiatesCanonical(String value) { 
2156      if (this.instantiatesCanonical == null)
2157        return false;
2158      for (CanonicalType v : this.instantiatesCanonical)
2159        if (v.getValue().equals(value)) // canonical
2160          return true;
2161      return false;
2162    }
2163
2164    /**
2165     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.)
2166     */
2167    public List<UriType> getInstantiatesUri() { 
2168      if (this.instantiatesUri == null)
2169        this.instantiatesUri = new ArrayList<UriType>();
2170      return this.instantiatesUri;
2171    }
2172
2173    /**
2174     * @return Returns a reference to <code>this</code> for easy method chaining
2175     */
2176    public MedicationRequest setInstantiatesUri(List<UriType> theInstantiatesUri) { 
2177      this.instantiatesUri = theInstantiatesUri;
2178      return this;
2179    }
2180
2181    public boolean hasInstantiatesUri() { 
2182      if (this.instantiatesUri == null)
2183        return false;
2184      for (UriType item : this.instantiatesUri)
2185        if (!item.isEmpty())
2186          return true;
2187      return false;
2188    }
2189
2190    /**
2191     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.)
2192     */
2193    public UriType addInstantiatesUriElement() {//2 
2194      UriType t = new UriType();
2195      if (this.instantiatesUri == null)
2196        this.instantiatesUri = new ArrayList<UriType>();
2197      this.instantiatesUri.add(t);
2198      return t;
2199    }
2200
2201    /**
2202     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.)
2203     */
2204    public MedicationRequest addInstantiatesUri(String value) { //1
2205      UriType t = new UriType();
2206      t.setValue(value);
2207      if (this.instantiatesUri == null)
2208        this.instantiatesUri = new ArrayList<UriType>();
2209      this.instantiatesUri.add(t);
2210      return this;
2211    }
2212
2213    /**
2214     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.)
2215     */
2216    public boolean hasInstantiatesUri(String value) { 
2217      if (this.instantiatesUri == null)
2218        return false;
2219      for (UriType v : this.instantiatesUri)
2220        if (v.getValue().equals(value)) // uri
2221          return true;
2222      return false;
2223    }
2224
2225    /**
2226     * @return {@link #basedOn} (A plan or request that is fulfilled in whole or in part by this medication request.)
2227     */
2228    public List<Reference> getBasedOn() { 
2229      if (this.basedOn == null)
2230        this.basedOn = new ArrayList<Reference>();
2231      return this.basedOn;
2232    }
2233
2234    /**
2235     * @return Returns a reference to <code>this</code> for easy method chaining
2236     */
2237    public MedicationRequest setBasedOn(List<Reference> theBasedOn) { 
2238      this.basedOn = theBasedOn;
2239      return this;
2240    }
2241
2242    public boolean hasBasedOn() { 
2243      if (this.basedOn == null)
2244        return false;
2245      for (Reference item : this.basedOn)
2246        if (!item.isEmpty())
2247          return true;
2248      return false;
2249    }
2250
2251    public Reference addBasedOn() { //3
2252      Reference t = new Reference();
2253      if (this.basedOn == null)
2254        this.basedOn = new ArrayList<Reference>();
2255      this.basedOn.add(t);
2256      return t;
2257    }
2258
2259    public MedicationRequest addBasedOn(Reference t) { //3
2260      if (t == null)
2261        return this;
2262      if (this.basedOn == null)
2263        this.basedOn = new ArrayList<Reference>();
2264      this.basedOn.add(t);
2265      return this;
2266    }
2267
2268    /**
2269     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
2270     */
2271    public Reference getBasedOnFirstRep() { 
2272      if (getBasedOn().isEmpty()) {
2273        addBasedOn();
2274      }
2275      return getBasedOn().get(0);
2276    }
2277
2278    /**
2279     * @return {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.)
2280     */
2281    public Reference getPriorPrescription() { 
2282      if (this.priorPrescription == null)
2283        if (Configuration.errorOnAutoCreate())
2284          throw new Error("Attempt to auto-create MedicationRequest.priorPrescription");
2285        else if (Configuration.doAutoCreate())
2286          this.priorPrescription = new Reference(); // cc
2287      return this.priorPrescription;
2288    }
2289
2290    public boolean hasPriorPrescription() { 
2291      return this.priorPrescription != null && !this.priorPrescription.isEmpty();
2292    }
2293
2294    /**
2295     * @param value {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.)
2296     */
2297    public MedicationRequest setPriorPrescription(Reference value) { 
2298      this.priorPrescription = value;
2299      return this;
2300    }
2301
2302    /**
2303     * @return {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.)
2304     */
2305    public Identifier getGroupIdentifier() { 
2306      if (this.groupIdentifier == null)
2307        if (Configuration.errorOnAutoCreate())
2308          throw new Error("Attempt to auto-create MedicationRequest.groupIdentifier");
2309        else if (Configuration.doAutoCreate())
2310          this.groupIdentifier = new Identifier(); // cc
2311      return this.groupIdentifier;
2312    }
2313
2314    public boolean hasGroupIdentifier() { 
2315      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
2316    }
2317
2318    /**
2319     * @param value {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.)
2320     */
2321    public MedicationRequest setGroupIdentifier(Identifier value) { 
2322      this.groupIdentifier = value;
2323      return this;
2324    }
2325
2326    /**
2327     * @return {@link #status} (A code specifying the current state of the order.  Generally, this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2328     */
2329    public Enumeration<MedicationrequestStatus> getStatusElement() { 
2330      if (this.status == null)
2331        if (Configuration.errorOnAutoCreate())
2332          throw new Error("Attempt to auto-create MedicationRequest.status");
2333        else if (Configuration.doAutoCreate())
2334          this.status = new Enumeration<MedicationrequestStatus>(new MedicationrequestStatusEnumFactory()); // bb
2335      return this.status;
2336    }
2337
2338    public boolean hasStatusElement() { 
2339      return this.status != null && !this.status.isEmpty();
2340    }
2341
2342    public boolean hasStatus() { 
2343      return this.status != null && !this.status.isEmpty();
2344    }
2345
2346    /**
2347     * @param value {@link #status} (A code specifying the current state of the order.  Generally, this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2348     */
2349    public MedicationRequest setStatusElement(Enumeration<MedicationrequestStatus> value) { 
2350      this.status = value;
2351      return this;
2352    }
2353
2354    /**
2355     * @return A code specifying the current state of the order.  Generally, this will be active or completed state.
2356     */
2357    public MedicationrequestStatus getStatus() { 
2358      return this.status == null ? null : this.status.getValue();
2359    }
2360
2361    /**
2362     * @param value A code specifying the current state of the order.  Generally, this will be active or completed state.
2363     */
2364    public MedicationRequest setStatus(MedicationrequestStatus value) { 
2365        if (this.status == null)
2366          this.status = new Enumeration<MedicationrequestStatus>(new MedicationrequestStatusEnumFactory());
2367        this.status.setValue(value);
2368      return this;
2369    }
2370
2371    /**
2372     * @return {@link #statusReason} (Captures the reason for the current state of the MedicationRequest.)
2373     */
2374    public CodeableConcept getStatusReason() { 
2375      if (this.statusReason == null)
2376        if (Configuration.errorOnAutoCreate())
2377          throw new Error("Attempt to auto-create MedicationRequest.statusReason");
2378        else if (Configuration.doAutoCreate())
2379          this.statusReason = new CodeableConcept(); // cc
2380      return this.statusReason;
2381    }
2382
2383    public boolean hasStatusReason() { 
2384      return this.statusReason != null && !this.statusReason.isEmpty();
2385    }
2386
2387    /**
2388     * @param value {@link #statusReason} (Captures the reason for the current state of the MedicationRequest.)
2389     */
2390    public MedicationRequest setStatusReason(CodeableConcept value) { 
2391      this.statusReason = value;
2392      return this;
2393    }
2394
2395    /**
2396     * @return {@link #statusChanged} (The date (and perhaps time) when the status was changed.). This is the underlying object with id, value and extensions. The accessor "getStatusChanged" gives direct access to the value
2397     */
2398    public DateTimeType getStatusChangedElement() { 
2399      if (this.statusChanged == null)
2400        if (Configuration.errorOnAutoCreate())
2401          throw new Error("Attempt to auto-create MedicationRequest.statusChanged");
2402        else if (Configuration.doAutoCreate())
2403          this.statusChanged = new DateTimeType(); // bb
2404      return this.statusChanged;
2405    }
2406
2407    public boolean hasStatusChangedElement() { 
2408      return this.statusChanged != null && !this.statusChanged.isEmpty();
2409    }
2410
2411    public boolean hasStatusChanged() { 
2412      return this.statusChanged != null && !this.statusChanged.isEmpty();
2413    }
2414
2415    /**
2416     * @param value {@link #statusChanged} (The date (and perhaps time) when the status was changed.). This is the underlying object with id, value and extensions. The accessor "getStatusChanged" gives direct access to the value
2417     */
2418    public MedicationRequest setStatusChangedElement(DateTimeType value) { 
2419      this.statusChanged = value;
2420      return this;
2421    }
2422
2423    /**
2424     * @return The date (and perhaps time) when the status was changed.
2425     */
2426    public Date getStatusChanged() { 
2427      return this.statusChanged == null ? null : this.statusChanged.getValue();
2428    }
2429
2430    /**
2431     * @param value The date (and perhaps time) when the status was changed.
2432     */
2433    public MedicationRequest setStatusChanged(Date value) { 
2434      if (value == null)
2435        this.statusChanged = null;
2436      else {
2437        if (this.statusChanged == null)
2438          this.statusChanged = new DateTimeType();
2439        this.statusChanged.setValue(value);
2440      }
2441      return this;
2442    }
2443
2444    /**
2445     * @return {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
2446     */
2447    public Enumeration<MedicationRequestIntent> getIntentElement() { 
2448      if (this.intent == null)
2449        if (Configuration.errorOnAutoCreate())
2450          throw new Error("Attempt to auto-create MedicationRequest.intent");
2451        else if (Configuration.doAutoCreate())
2452          this.intent = new Enumeration<MedicationRequestIntent>(new MedicationRequestIntentEnumFactory()); // bb
2453      return this.intent;
2454    }
2455
2456    public boolean hasIntentElement() { 
2457      return this.intent != null && !this.intent.isEmpty();
2458    }
2459
2460    public boolean hasIntent() { 
2461      return this.intent != null && !this.intent.isEmpty();
2462    }
2463
2464    /**
2465     * @param value {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
2466     */
2467    public MedicationRequest setIntentElement(Enumeration<MedicationRequestIntent> value) { 
2468      this.intent = value;
2469      return this;
2470    }
2471
2472    /**
2473     * @return Whether the request is a proposal, plan, or an original order.
2474     */
2475    public MedicationRequestIntent getIntent() { 
2476      return this.intent == null ? null : this.intent.getValue();
2477    }
2478
2479    /**
2480     * @param value Whether the request is a proposal, plan, or an original order.
2481     */
2482    public MedicationRequest setIntent(MedicationRequestIntent value) { 
2483        if (this.intent == null)
2484          this.intent = new Enumeration<MedicationRequestIntent>(new MedicationRequestIntentEnumFactory());
2485        this.intent.setValue(value);
2486      return this;
2487    }
2488
2489    /**
2490     * @return {@link #category} (Indicates the grouping or category of medication request (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).)
2491     */
2492    public List<CodeableConcept> getCategory() { 
2493      if (this.category == null)
2494        this.category = new ArrayList<CodeableConcept>();
2495      return this.category;
2496    }
2497
2498    /**
2499     * @return Returns a reference to <code>this</code> for easy method chaining
2500     */
2501    public MedicationRequest setCategory(List<CodeableConcept> theCategory) { 
2502      this.category = theCategory;
2503      return this;
2504    }
2505
2506    public boolean hasCategory() { 
2507      if (this.category == null)
2508        return false;
2509      for (CodeableConcept item : this.category)
2510        if (!item.isEmpty())
2511          return true;
2512      return false;
2513    }
2514
2515    public CodeableConcept addCategory() { //3
2516      CodeableConcept t = new CodeableConcept();
2517      if (this.category == null)
2518        this.category = new ArrayList<CodeableConcept>();
2519      this.category.add(t);
2520      return t;
2521    }
2522
2523    public MedicationRequest addCategory(CodeableConcept t) { //3
2524      if (t == null)
2525        return this;
2526      if (this.category == null)
2527        this.category = new ArrayList<CodeableConcept>();
2528      this.category.add(t);
2529      return this;
2530    }
2531
2532    /**
2533     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
2534     */
2535    public CodeableConcept getCategoryFirstRep() { 
2536      if (getCategory().isEmpty()) {
2537        addCategory();
2538      }
2539      return getCategory().get(0);
2540    }
2541
2542    /**
2543     * @return {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2544     */
2545    public Enumeration<RequestPriority> getPriorityElement() { 
2546      if (this.priority == null)
2547        if (Configuration.errorOnAutoCreate())
2548          throw new Error("Attempt to auto-create MedicationRequest.priority");
2549        else if (Configuration.doAutoCreate())
2550          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
2551      return this.priority;
2552    }
2553
2554    public boolean hasPriorityElement() { 
2555      return this.priority != null && !this.priority.isEmpty();
2556    }
2557
2558    public boolean hasPriority() { 
2559      return this.priority != null && !this.priority.isEmpty();
2560    }
2561
2562    /**
2563     * @param value {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2564     */
2565    public MedicationRequest setPriorityElement(Enumeration<RequestPriority> value) { 
2566      this.priority = value;
2567      return this;
2568    }
2569
2570    /**
2571     * @return Indicates how quickly the Medication Request should be addressed with respect to other requests.
2572     */
2573    public RequestPriority getPriority() { 
2574      return this.priority == null ? null : this.priority.getValue();
2575    }
2576
2577    /**
2578     * @param value Indicates how quickly the Medication Request should be addressed with respect to other requests.
2579     */
2580    public MedicationRequest setPriority(RequestPriority value) { 
2581      if (value == null)
2582        this.priority = null;
2583      else {
2584        if (this.priority == null)
2585          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
2586        this.priority.setValue(value);
2587      }
2588      return this;
2589    }
2590
2591    /**
2592     * @return {@link #doNotPerform} (If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value
2593     */
2594    public BooleanType getDoNotPerformElement() { 
2595      if (this.doNotPerform == null)
2596        if (Configuration.errorOnAutoCreate())
2597          throw new Error("Attempt to auto-create MedicationRequest.doNotPerform");
2598        else if (Configuration.doAutoCreate())
2599          this.doNotPerform = new BooleanType(); // bb
2600      return this.doNotPerform;
2601    }
2602
2603    public boolean hasDoNotPerformElement() { 
2604      return this.doNotPerform != null && !this.doNotPerform.isEmpty();
2605    }
2606
2607    public boolean hasDoNotPerform() { 
2608      return this.doNotPerform != null && !this.doNotPerform.isEmpty();
2609    }
2610
2611    /**
2612     * @param value {@link #doNotPerform} (If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value
2613     */
2614    public MedicationRequest setDoNotPerformElement(BooleanType value) { 
2615      this.doNotPerform = value;
2616      return this;
2617    }
2618
2619    /**
2620     * @return If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.
2621     */
2622    public boolean getDoNotPerform() { 
2623      return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
2624    }
2625
2626    /**
2627     * @param value If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.
2628     */
2629    public MedicationRequest setDoNotPerform(boolean value) { 
2630        if (this.doNotPerform == null)
2631          this.doNotPerform = new BooleanType();
2632        this.doNotPerform.setValue(value);
2633      return this;
2634    }
2635
2636    /**
2637     * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.)
2638     */
2639    public CodeableReference getMedication() { 
2640      if (this.medication == null)
2641        if (Configuration.errorOnAutoCreate())
2642          throw new Error("Attempt to auto-create MedicationRequest.medication");
2643        else if (Configuration.doAutoCreate())
2644          this.medication = new CodeableReference(); // cc
2645      return this.medication;
2646    }
2647
2648    public boolean hasMedication() { 
2649      return this.medication != null && !this.medication.isEmpty();
2650    }
2651
2652    /**
2653     * @param value {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.)
2654     */
2655    public MedicationRequest setMedication(CodeableReference value) { 
2656      this.medication = value;
2657      return this;
2658    }
2659
2660    /**
2661     * @return {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.)
2662     */
2663    public Reference getSubject() { 
2664      if (this.subject == null)
2665        if (Configuration.errorOnAutoCreate())
2666          throw new Error("Attempt to auto-create MedicationRequest.subject");
2667        else if (Configuration.doAutoCreate())
2668          this.subject = new Reference(); // cc
2669      return this.subject;
2670    }
2671
2672    public boolean hasSubject() { 
2673      return this.subject != null && !this.subject.isEmpty();
2674    }
2675
2676    /**
2677     * @param value {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.)
2678     */
2679    public MedicationRequest setSubject(Reference value) { 
2680      this.subject = value;
2681      return this;
2682    }
2683
2684    /**
2685     * @return {@link #informationSource} (The person or organization who provided the information about this request, if the source is someone other than the requestor.  This is often used when the MedicationRequest is reported by another person.)
2686     */
2687    public List<Reference> getInformationSource() { 
2688      if (this.informationSource == null)
2689        this.informationSource = new ArrayList<Reference>();
2690      return this.informationSource;
2691    }
2692
2693    /**
2694     * @return Returns a reference to <code>this</code> for easy method chaining
2695     */
2696    public MedicationRequest setInformationSource(List<Reference> theInformationSource) { 
2697      this.informationSource = theInformationSource;
2698      return this;
2699    }
2700
2701    public boolean hasInformationSource() { 
2702      if (this.informationSource == null)
2703        return false;
2704      for (Reference item : this.informationSource)
2705        if (!item.isEmpty())
2706          return true;
2707      return false;
2708    }
2709
2710    public Reference addInformationSource() { //3
2711      Reference t = new Reference();
2712      if (this.informationSource == null)
2713        this.informationSource = new ArrayList<Reference>();
2714      this.informationSource.add(t);
2715      return t;
2716    }
2717
2718    public MedicationRequest addInformationSource(Reference t) { //3
2719      if (t == null)
2720        return this;
2721      if (this.informationSource == null)
2722        this.informationSource = new ArrayList<Reference>();
2723      this.informationSource.add(t);
2724      return this;
2725    }
2726
2727    /**
2728     * @return The first repetition of repeating field {@link #informationSource}, creating it if it does not already exist {3}
2729     */
2730    public Reference getInformationSourceFirstRep() { 
2731      if (getInformationSource().isEmpty()) {
2732        addInformationSource();
2733      }
2734      return getInformationSource().get(0);
2735    }
2736
2737    /**
2738     * @return {@link #encounter} (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.)
2739     */
2740    public Reference getEncounter() { 
2741      if (this.encounter == null)
2742        if (Configuration.errorOnAutoCreate())
2743          throw new Error("Attempt to auto-create MedicationRequest.encounter");
2744        else if (Configuration.doAutoCreate())
2745          this.encounter = new Reference(); // cc
2746      return this.encounter;
2747    }
2748
2749    public boolean hasEncounter() { 
2750      return this.encounter != null && !this.encounter.isEmpty();
2751    }
2752
2753    /**
2754     * @param value {@link #encounter} (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.)
2755     */
2756    public MedicationRequest setEncounter(Reference value) { 
2757      this.encounter = value;
2758      return this;
2759    }
2760
2761    /**
2762     * @return {@link #supportingInformation} (Information to support fulfilling (i.e. dispensing or administering) of the medication, for example, patient height and weight, a MedicationUsage for the patient).)
2763     */
2764    public List<Reference> getSupportingInformation() { 
2765      if (this.supportingInformation == null)
2766        this.supportingInformation = new ArrayList<Reference>();
2767      return this.supportingInformation;
2768    }
2769
2770    /**
2771     * @return Returns a reference to <code>this</code> for easy method chaining
2772     */
2773    public MedicationRequest setSupportingInformation(List<Reference> theSupportingInformation) { 
2774      this.supportingInformation = theSupportingInformation;
2775      return this;
2776    }
2777
2778    public boolean hasSupportingInformation() { 
2779      if (this.supportingInformation == null)
2780        return false;
2781      for (Reference item : this.supportingInformation)
2782        if (!item.isEmpty())
2783          return true;
2784      return false;
2785    }
2786
2787    public Reference addSupportingInformation() { //3
2788      Reference t = new Reference();
2789      if (this.supportingInformation == null)
2790        this.supportingInformation = new ArrayList<Reference>();
2791      this.supportingInformation.add(t);
2792      return t;
2793    }
2794
2795    public MedicationRequest addSupportingInformation(Reference t) { //3
2796      if (t == null)
2797        return this;
2798      if (this.supportingInformation == null)
2799        this.supportingInformation = new ArrayList<Reference>();
2800      this.supportingInformation.add(t);
2801      return this;
2802    }
2803
2804    /**
2805     * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist {3}
2806     */
2807    public Reference getSupportingInformationFirstRep() { 
2808      if (getSupportingInformation().isEmpty()) {
2809        addSupportingInformation();
2810      }
2811      return getSupportingInformation().get(0);
2812    }
2813
2814    /**
2815     * @return {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
2816     */
2817    public DateTimeType getAuthoredOnElement() { 
2818      if (this.authoredOn == null)
2819        if (Configuration.errorOnAutoCreate())
2820          throw new Error("Attempt to auto-create MedicationRequest.authoredOn");
2821        else if (Configuration.doAutoCreate())
2822          this.authoredOn = new DateTimeType(); // bb
2823      return this.authoredOn;
2824    }
2825
2826    public boolean hasAuthoredOnElement() { 
2827      return this.authoredOn != null && !this.authoredOn.isEmpty();
2828    }
2829
2830    public boolean hasAuthoredOn() { 
2831      return this.authoredOn != null && !this.authoredOn.isEmpty();
2832    }
2833
2834    /**
2835     * @param value {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
2836     */
2837    public MedicationRequest setAuthoredOnElement(DateTimeType value) { 
2838      this.authoredOn = value;
2839      return this;
2840    }
2841
2842    /**
2843     * @return The date (and perhaps time) when the prescription was initially written or authored on.
2844     */
2845    public Date getAuthoredOn() { 
2846      return this.authoredOn == null ? null : this.authoredOn.getValue();
2847    }
2848
2849    /**
2850     * @param value The date (and perhaps time) when the prescription was initially written or authored on.
2851     */
2852    public MedicationRequest setAuthoredOn(Date value) { 
2853      if (value == null)
2854        this.authoredOn = null;
2855      else {
2856        if (this.authoredOn == null)
2857          this.authoredOn = new DateTimeType();
2858        this.authoredOn.setValue(value);
2859      }
2860      return this;
2861    }
2862
2863    /**
2864     * @return {@link #requester} (The individual, organization, or device that initiated the request and has responsibility for its activation.)
2865     */
2866    public Reference getRequester() { 
2867      if (this.requester == null)
2868        if (Configuration.errorOnAutoCreate())
2869          throw new Error("Attempt to auto-create MedicationRequest.requester");
2870        else if (Configuration.doAutoCreate())
2871          this.requester = new Reference(); // cc
2872      return this.requester;
2873    }
2874
2875    public boolean hasRequester() { 
2876      return this.requester != null && !this.requester.isEmpty();
2877    }
2878
2879    /**
2880     * @param value {@link #requester} (The individual, organization, or device that initiated the request and has responsibility for its activation.)
2881     */
2882    public MedicationRequest setRequester(Reference value) { 
2883      this.requester = value;
2884      return this;
2885    }
2886
2887    /**
2888     * @return {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.). This is the underlying object with id, value and extensions. The accessor "getReported" gives direct access to the value
2889     */
2890    public BooleanType getReportedElement() { 
2891      if (this.reported == null)
2892        if (Configuration.errorOnAutoCreate())
2893          throw new Error("Attempt to auto-create MedicationRequest.reported");
2894        else if (Configuration.doAutoCreate())
2895          this.reported = new BooleanType(); // bb
2896      return this.reported;
2897    }
2898
2899    public boolean hasReportedElement() { 
2900      return this.reported != null && !this.reported.isEmpty();
2901    }
2902
2903    public boolean hasReported() { 
2904      return this.reported != null && !this.reported.isEmpty();
2905    }
2906
2907    /**
2908     * @param value {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.). This is the underlying object with id, value and extensions. The accessor "getReported" gives direct access to the value
2909     */
2910    public MedicationRequest setReportedElement(BooleanType value) { 
2911      this.reported = value;
2912      return this;
2913    }
2914
2915    /**
2916     * @return Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.
2917     */
2918    public boolean getReported() { 
2919      return this.reported == null || this.reported.isEmpty() ? false : this.reported.getValue();
2920    }
2921
2922    /**
2923     * @param value Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.
2924     */
2925    public MedicationRequest setReported(boolean value) { 
2926        if (this.reported == null)
2927          this.reported = new BooleanType();
2928        this.reported.setValue(value);
2929      return this;
2930    }
2931
2932    /**
2933     * @return {@link #performerType} (Indicates the type of performer of the administration of the medication.)
2934     */
2935    public CodeableConcept getPerformerType() { 
2936      if (this.performerType == null)
2937        if (Configuration.errorOnAutoCreate())
2938          throw new Error("Attempt to auto-create MedicationRequest.performerType");
2939        else if (Configuration.doAutoCreate())
2940          this.performerType = new CodeableConcept(); // cc
2941      return this.performerType;
2942    }
2943
2944    public boolean hasPerformerType() { 
2945      return this.performerType != null && !this.performerType.isEmpty();
2946    }
2947
2948    /**
2949     * @param value {@link #performerType} (Indicates the type of performer of the administration of the medication.)
2950     */
2951    public MedicationRequest setPerformerType(CodeableConcept value) { 
2952      this.performerType = value;
2953      return this;
2954    }
2955
2956    /**
2957     * @return {@link #performer} (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).)
2958     */
2959    public List<Reference> getPerformer() { 
2960      if (this.performer == null)
2961        this.performer = new ArrayList<Reference>();
2962      return this.performer;
2963    }
2964
2965    /**
2966     * @return Returns a reference to <code>this</code> for easy method chaining
2967     */
2968    public MedicationRequest setPerformer(List<Reference> thePerformer) { 
2969      this.performer = thePerformer;
2970      return this;
2971    }
2972
2973    public boolean hasPerformer() { 
2974      if (this.performer == null)
2975        return false;
2976      for (Reference item : this.performer)
2977        if (!item.isEmpty())
2978          return true;
2979      return false;
2980    }
2981
2982    public Reference addPerformer() { //3
2983      Reference t = new Reference();
2984      if (this.performer == null)
2985        this.performer = new ArrayList<Reference>();
2986      this.performer.add(t);
2987      return t;
2988    }
2989
2990    public MedicationRequest addPerformer(Reference t) { //3
2991      if (t == null)
2992        return this;
2993      if (this.performer == null)
2994        this.performer = new ArrayList<Reference>();
2995      this.performer.add(t);
2996      return this;
2997    }
2998
2999    /**
3000     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist {3}
3001     */
3002    public Reference getPerformerFirstRep() { 
3003      if (getPerformer().isEmpty()) {
3004        addPerformer();
3005      }
3006      return getPerformer().get(0);
3007    }
3008
3009    /**
3010     * @return {@link #device} (The intended type of device that is to be used for the administration of the medication (for example, PCA Pump).)
3011     */
3012    public CodeableReference getDevice() { 
3013      if (this.device == null)
3014        if (Configuration.errorOnAutoCreate())
3015          throw new Error("Attempt to auto-create MedicationRequest.device");
3016        else if (Configuration.doAutoCreate())
3017          this.device = new CodeableReference(); // cc
3018      return this.device;
3019    }
3020
3021    public boolean hasDevice() { 
3022      return this.device != null && !this.device.isEmpty();
3023    }
3024
3025    /**
3026     * @param value {@link #device} (The intended type of device that is to be used for the administration of the medication (for example, PCA Pump).)
3027     */
3028    public MedicationRequest setDevice(CodeableReference value) { 
3029      this.device = value;
3030      return this;
3031    }
3032
3033    /**
3034     * @return {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.)
3035     */
3036    public Reference getRecorder() { 
3037      if (this.recorder == null)
3038        if (Configuration.errorOnAutoCreate())
3039          throw new Error("Attempt to auto-create MedicationRequest.recorder");
3040        else if (Configuration.doAutoCreate())
3041          this.recorder = new Reference(); // cc
3042      return this.recorder;
3043    }
3044
3045    public boolean hasRecorder() { 
3046      return this.recorder != null && !this.recorder.isEmpty();
3047    }
3048
3049    /**
3050     * @param value {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.)
3051     */
3052    public MedicationRequest setRecorder(Reference value) { 
3053      this.recorder = value;
3054      return this;
3055    }
3056
3057    /**
3058     * @return {@link #reason} (The reason or the indication for ordering or not ordering the medication.)
3059     */
3060    public List<CodeableReference> getReason() { 
3061      if (this.reason == null)
3062        this.reason = new ArrayList<CodeableReference>();
3063      return this.reason;
3064    }
3065
3066    /**
3067     * @return Returns a reference to <code>this</code> for easy method chaining
3068     */
3069    public MedicationRequest setReason(List<CodeableReference> theReason) { 
3070      this.reason = theReason;
3071      return this;
3072    }
3073
3074    public boolean hasReason() { 
3075      if (this.reason == null)
3076        return false;
3077      for (CodeableReference item : this.reason)
3078        if (!item.isEmpty())
3079          return true;
3080      return false;
3081    }
3082
3083    public CodeableReference addReason() { //3
3084      CodeableReference t = new CodeableReference();
3085      if (this.reason == null)
3086        this.reason = new ArrayList<CodeableReference>();
3087      this.reason.add(t);
3088      return t;
3089    }
3090
3091    public MedicationRequest addReason(CodeableReference t) { //3
3092      if (t == null)
3093        return this;
3094      if (this.reason == null)
3095        this.reason = new ArrayList<CodeableReference>();
3096      this.reason.add(t);
3097      return this;
3098    }
3099
3100    /**
3101     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
3102     */
3103    public CodeableReference getReasonFirstRep() { 
3104      if (getReason().isEmpty()) {
3105        addReason();
3106      }
3107      return getReason().get(0);
3108    }
3109
3110    /**
3111     * @return {@link #courseOfTherapyType} (The description of the overall pattern of the administration of the medication to the patient.)
3112     */
3113    public CodeableConcept getCourseOfTherapyType() { 
3114      if (this.courseOfTherapyType == null)
3115        if (Configuration.errorOnAutoCreate())
3116          throw new Error("Attempt to auto-create MedicationRequest.courseOfTherapyType");
3117        else if (Configuration.doAutoCreate())
3118          this.courseOfTherapyType = new CodeableConcept(); // cc
3119      return this.courseOfTherapyType;
3120    }
3121
3122    public boolean hasCourseOfTherapyType() { 
3123      return this.courseOfTherapyType != null && !this.courseOfTherapyType.isEmpty();
3124    }
3125
3126    /**
3127     * @param value {@link #courseOfTherapyType} (The description of the overall pattern of the administration of the medication to the patient.)
3128     */
3129    public MedicationRequest setCourseOfTherapyType(CodeableConcept value) { 
3130      this.courseOfTherapyType = value;
3131      return this;
3132    }
3133
3134    /**
3135     * @return {@link #insurance} (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.)
3136     */
3137    public List<Reference> getInsurance() { 
3138      if (this.insurance == null)
3139        this.insurance = new ArrayList<Reference>();
3140      return this.insurance;
3141    }
3142
3143    /**
3144     * @return Returns a reference to <code>this</code> for easy method chaining
3145     */
3146    public MedicationRequest setInsurance(List<Reference> theInsurance) { 
3147      this.insurance = theInsurance;
3148      return this;
3149    }
3150
3151    public boolean hasInsurance() { 
3152      if (this.insurance == null)
3153        return false;
3154      for (Reference item : this.insurance)
3155        if (!item.isEmpty())
3156          return true;
3157      return false;
3158    }
3159
3160    public Reference addInsurance() { //3
3161      Reference t = new Reference();
3162      if (this.insurance == null)
3163        this.insurance = new ArrayList<Reference>();
3164      this.insurance.add(t);
3165      return t;
3166    }
3167
3168    public MedicationRequest addInsurance(Reference t) { //3
3169      if (t == null)
3170        return this;
3171      if (this.insurance == null)
3172        this.insurance = new ArrayList<Reference>();
3173      this.insurance.add(t);
3174      return this;
3175    }
3176
3177    /**
3178     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist {3}
3179     */
3180    public Reference getInsuranceFirstRep() { 
3181      if (getInsurance().isEmpty()) {
3182        addInsurance();
3183      }
3184      return getInsurance().get(0);
3185    }
3186
3187    /**
3188     * @return {@link #note} (Extra information about the prescription that could not be conveyed by the other attributes.)
3189     */
3190    public List<Annotation> getNote() { 
3191      if (this.note == null)
3192        this.note = new ArrayList<Annotation>();
3193      return this.note;
3194    }
3195
3196    /**
3197     * @return Returns a reference to <code>this</code> for easy method chaining
3198     */
3199    public MedicationRequest setNote(List<Annotation> theNote) { 
3200      this.note = theNote;
3201      return this;
3202    }
3203
3204    public boolean hasNote() { 
3205      if (this.note == null)
3206        return false;
3207      for (Annotation item : this.note)
3208        if (!item.isEmpty())
3209          return true;
3210      return false;
3211    }
3212
3213    public Annotation addNote() { //3
3214      Annotation t = new Annotation();
3215      if (this.note == null)
3216        this.note = new ArrayList<Annotation>();
3217      this.note.add(t);
3218      return t;
3219    }
3220
3221    public MedicationRequest addNote(Annotation t) { //3
3222      if (t == null)
3223        return this;
3224      if (this.note == null)
3225        this.note = new ArrayList<Annotation>();
3226      this.note.add(t);
3227      return this;
3228    }
3229
3230    /**
3231     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
3232     */
3233    public Annotation getNoteFirstRep() { 
3234      if (getNote().isEmpty()) {
3235        addNote();
3236      }
3237      return getNote().get(0);
3238    }
3239
3240    /**
3241     * @return {@link #dose} (Indicates how the medication is to be used by the patient.)
3242     */
3243    public MedicationRequestDoseComponent getDose() { 
3244      if (this.dose == null)
3245        if (Configuration.errorOnAutoCreate())
3246          throw new Error("Attempt to auto-create MedicationRequest.dose");
3247        else if (Configuration.doAutoCreate())
3248          this.dose = new MedicationRequestDoseComponent(); // cc
3249      return this.dose;
3250    }
3251
3252    public boolean hasDose() { 
3253      return this.dose != null && !this.dose.isEmpty();
3254    }
3255
3256    /**
3257     * @param value {@link #dose} (Indicates how the medication is to be used by the patient.)
3258     */
3259    public MedicationRequest setDose(MedicationRequestDoseComponent value) { 
3260      this.dose = value;
3261      return this;
3262    }
3263
3264    /**
3265     * @return {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order).  Note that this information is not always sent with the order.  There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.)
3266     */
3267    public MedicationRequestDispenseRequestComponent getDispenseRequest() { 
3268      if (this.dispenseRequest == null)
3269        if (Configuration.errorOnAutoCreate())
3270          throw new Error("Attempt to auto-create MedicationRequest.dispenseRequest");
3271        else if (Configuration.doAutoCreate())
3272          this.dispenseRequest = new MedicationRequestDispenseRequestComponent(); // cc
3273      return this.dispenseRequest;
3274    }
3275
3276    public boolean hasDispenseRequest() { 
3277      return this.dispenseRequest != null && !this.dispenseRequest.isEmpty();
3278    }
3279
3280    /**
3281     * @param value {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order).  Note that this information is not always sent with the order.  There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.)
3282     */
3283    public MedicationRequest setDispenseRequest(MedicationRequestDispenseRequestComponent value) { 
3284      this.dispenseRequest = value;
3285      return this;
3286    }
3287
3288    /**
3289     * @return {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.)
3290     */
3291    public MedicationRequestSubstitutionComponent getSubstitution() { 
3292      if (this.substitution == null)
3293        if (Configuration.errorOnAutoCreate())
3294          throw new Error("Attempt to auto-create MedicationRequest.substitution");
3295        else if (Configuration.doAutoCreate())
3296          this.substitution = new MedicationRequestSubstitutionComponent(); // cc
3297      return this.substitution;
3298    }
3299
3300    public boolean hasSubstitution() { 
3301      return this.substitution != null && !this.substitution.isEmpty();
3302    }
3303
3304    /**
3305     * @param value {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.)
3306     */
3307    public MedicationRequest setSubstitution(MedicationRequestSubstitutionComponent value) { 
3308      this.substitution = value;
3309      return this;
3310    }
3311
3312    /**
3313     * @return {@link #eventHistory} (Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.)
3314     */
3315    public List<Reference> getEventHistory() { 
3316      if (this.eventHistory == null)
3317        this.eventHistory = new ArrayList<Reference>();
3318      return this.eventHistory;
3319    }
3320
3321    /**
3322     * @return Returns a reference to <code>this</code> for easy method chaining
3323     */
3324    public MedicationRequest setEventHistory(List<Reference> theEventHistory) { 
3325      this.eventHistory = theEventHistory;
3326      return this;
3327    }
3328
3329    public boolean hasEventHistory() { 
3330      if (this.eventHistory == null)
3331        return false;
3332      for (Reference item : this.eventHistory)
3333        if (!item.isEmpty())
3334          return true;
3335      return false;
3336    }
3337
3338    public Reference addEventHistory() { //3
3339      Reference t = new Reference();
3340      if (this.eventHistory == null)
3341        this.eventHistory = new ArrayList<Reference>();
3342      this.eventHistory.add(t);
3343      return t;
3344    }
3345
3346    public MedicationRequest addEventHistory(Reference t) { //3
3347      if (t == null)
3348        return this;
3349      if (this.eventHistory == null)
3350        this.eventHistory = new ArrayList<Reference>();
3351      this.eventHistory.add(t);
3352      return this;
3353    }
3354
3355    /**
3356     * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist {3}
3357     */
3358    public Reference getEventHistoryFirstRep() { 
3359      if (getEventHistory().isEmpty()) {
3360        addEventHistory();
3361      }
3362      return getEventHistory().get(0);
3363    }
3364
3365      protected void listChildren(List<Property> children) {
3366        super.listChildren(children);
3367        children.add(new Property("identifier", "Identifier", "Identifiers associated with this medication request 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));
3368        children.add(new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition)", "The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
3369        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
3370        children.add(new Property("basedOn", "Reference(CarePlan|MedicationRequest|ServiceRequest|ImmunizationRecommendation)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn));
3371        children.add(new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription));
3372        children.add(new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier));
3373        children.add(new Property("status", "code", "A code specifying the current state of the order.  Generally, this will be active or completed state.", 0, 1, status));
3374        children.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the MedicationRequest.", 0, 1, statusReason));
3375        children.add(new Property("statusChanged", "dateTime", "The date (and perhaps time) when the status was changed.", 0, 1, statusChanged));
3376        children.add(new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent));
3377        children.add(new Property("category", "CodeableConcept", "Indicates the grouping or category of medication request (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).", 0, java.lang.Integer.MAX_VALUE, category));
3378        children.add(new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority));
3379        children.add(new Property("doNotPerform", "boolean", "If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.", 0, 1, doNotPerform));
3380        children.add(new Property("medication", "CodeableReference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication));
3381        children.add(new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject));
3382        children.add(new Property("informationSource", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "The person or organization who provided the information about this request, if the source is someone other than the requestor.  This is often used when the MedicationRequest is reported by another person.", 0, java.lang.Integer.MAX_VALUE, informationSource));
3383        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which this [x] was created or to which the creation of this record is tightly associated.", 0, 1, encounter));
3384        children.add(new Property("supportingInformation", "Reference(Any)", "Information to support fulfilling (i.e. dispensing or administering) of the medication, for example, patient height and weight, a MedicationUsage for the patient).", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
3385        children.add(new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn));
3386        children.add(new Property("requester", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The individual, organization, or device that initiated the request and has responsibility for its activation.", 0, 1, requester));
3387        children.add(new Property("reported", "boolean", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.", 0, 1, reported));
3388        children.add(new Property("performerType", "CodeableConcept", "Indicates the type of performer of the administration of the medication.", 0, 1, performerType));
3389        children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam|HealthcareService)", "The specified desired performer of the medication treatment (e.g. the performer of the medication administration).", 0, java.lang.Integer.MAX_VALUE, performer));
3390        children.add(new Property("device", "CodeableReference(DeviceDefinition)", "The intended type of device that is to be used for the administration of the medication (for example, PCA Pump).", 0, 1, device));
3391        children.add(new Property("recorder", "Reference(Practitioner|PractitionerRole)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder));
3392        children.add(new Property("reason", "CodeableReference(Condition|Observation)", "The reason or the indication for ordering or not ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reason));
3393        children.add(new Property("courseOfTherapyType", "CodeableConcept", "The description of the overall pattern of the administration of the medication to the patient.", 0, 1, courseOfTherapyType));
3394        children.add(new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.", 0, java.lang.Integer.MAX_VALUE, insurance));
3395        children.add(new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note));
3396        children.add(new Property("dose", "", "Indicates how the medication is to be used by the patient.", 0, 1, dose));
3397        children.add(new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order).  Note that this information is not always sent with the order.  There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest));
3398        children.add(new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution));
3399        children.add(new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory));
3400      }
3401
3402      @Override
3403      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3404        switch (_hash) {
3405        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers associated with this medication request 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);
3406        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition)", "The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
3407        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
3408        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|MedicationRequest|ServiceRequest|ImmunizationRecommendation)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn);
3409        case -486355964: /*priorPrescription*/  return new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription);
3410        case -445338488: /*groupIdentifier*/  return new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier);
3411        case -892481550: /*status*/  return new Property("status", "code", "A code specifying the current state of the order.  Generally, this will be active or completed state.", 0, 1, status);
3412        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the MedicationRequest.", 0, 1, statusReason);
3413        case -1174686110: /*statusChanged*/  return new Property("statusChanged", "dateTime", "The date (and perhaps time) when the status was changed.", 0, 1, statusChanged);
3414        case -1183762788: /*intent*/  return new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent);
3415        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Indicates the grouping or category of medication request (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).", 0, java.lang.Integer.MAX_VALUE, category);
3416        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority);
3417        case -1788508167: /*doNotPerform*/  return new Property("doNotPerform", "boolean", "If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.", 0, 1, doNotPerform);
3418        case 1998965455: /*medication*/  return new Property("medication", "CodeableReference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication);
3419        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject);
3420        case -2123220889: /*informationSource*/  return new Property("informationSource", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "The person or organization who provided the information about this request, if the source is someone other than the requestor.  This is often used when the MedicationRequest is reported by another person.", 0, java.lang.Integer.MAX_VALUE, informationSource);
3421        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter during which this [x] was created or to which the creation of this record is tightly associated.", 0, 1, encounter);
3422        case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "Reference(Any)", "Information to support fulfilling (i.e. dispensing or administering) of the medication, for example, patient height and weight, a MedicationUsage for the patient).", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
3423        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn);
3424        case 693933948: /*requester*/  return new Property("requester", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The individual, organization, or device that initiated the request and has responsibility for its activation.", 0, 1, requester);
3425        case -427039533: /*reported*/  return new Property("reported", "boolean", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.", 0, 1, reported);
3426        case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "Indicates the type of performer of the administration of the medication.", 0, 1, performerType);
3427        case 481140686: /*performer*/  return new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam|HealthcareService)", "The specified desired performer of the medication treatment (e.g. the performer of the medication administration).", 0, java.lang.Integer.MAX_VALUE, performer);
3428        case -1335157162: /*device*/  return new Property("device", "CodeableReference(DeviceDefinition)", "The intended type of device that is to be used for the administration of the medication (for example, PCA Pump).", 0, 1, device);
3429        case -799233858: /*recorder*/  return new Property("recorder", "Reference(Practitioner|PractitionerRole)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder);
3430        case -934964668: /*reason*/  return new Property("reason", "CodeableReference(Condition|Observation)", "The reason or the indication for ordering or not ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reason);
3431        case -447282031: /*courseOfTherapyType*/  return new Property("courseOfTherapyType", "CodeableConcept", "The description of the overall pattern of the administration of the medication to the patient.", 0, 1, courseOfTherapyType);
3432        case 73049818: /*insurance*/  return new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.", 0, java.lang.Integer.MAX_VALUE, insurance);
3433        case 3387378: /*note*/  return new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note);
3434        case 3089437: /*dose*/  return new Property("dose", "", "Indicates how the medication is to be used by the patient.", 0, 1, dose);
3435        case 824620658: /*dispenseRequest*/  return new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order).  Note that this information is not always sent with the order.  There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest);
3436        case 826147581: /*substitution*/  return new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution);
3437        case 1835190426: /*eventHistory*/  return new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory);
3438        default: return super.getNamedProperty(_hash, _name, _checkValid);
3439        }
3440
3441      }
3442
3443      @Override
3444      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3445        switch (hash) {
3446        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3447        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
3448        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
3449        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
3450        case -486355964: /*priorPrescription*/ return this.priorPrescription == null ? new Base[0] : new Base[] {this.priorPrescription}; // Reference
3451        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
3452        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationrequestStatus>
3453        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
3454        case -1174686110: /*statusChanged*/ return this.statusChanged == null ? new Base[0] : new Base[] {this.statusChanged}; // DateTimeType
3455        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<MedicationRequestIntent>
3456        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3457        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
3458        case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType
3459        case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // CodeableReference
3460        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3461        case -2123220889: /*informationSource*/ return this.informationSource == null ? new Base[0] : this.informationSource.toArray(new Base[this.informationSource.size()]); // Reference
3462        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3463        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
3464        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
3465        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // Reference
3466        case -427039533: /*reported*/ return this.reported == null ? new Base[0] : new Base[] {this.reported}; // BooleanType
3467        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : new Base[] {this.performerType}; // CodeableConcept
3468        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // Reference
3469        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // CodeableReference
3470        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
3471        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
3472        case -447282031: /*courseOfTherapyType*/ return this.courseOfTherapyType == null ? new Base[0] : new Base[] {this.courseOfTherapyType}; // CodeableConcept
3473        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // Reference
3474        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3475        case 3089437: /*dose*/ return this.dose == null ? new Base[0] : new Base[] {this.dose}; // MedicationRequestDoseComponent
3476        case 824620658: /*dispenseRequest*/ return this.dispenseRequest == null ? new Base[0] : new Base[] {this.dispenseRequest}; // MedicationRequestDispenseRequestComponent
3477        case 826147581: /*substitution*/ return this.substitution == null ? new Base[0] : new Base[] {this.substitution}; // MedicationRequestSubstitutionComponent
3478        case 1835190426: /*eventHistory*/ return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference
3479        default: return super.getProperty(hash, name, checkValid);
3480        }
3481
3482      }
3483
3484      @Override
3485      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3486        switch (hash) {
3487        case -1618432855: // identifier
3488          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3489          return value;
3490        case 8911915: // instantiatesCanonical
3491          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value)); // CanonicalType
3492          return value;
3493        case -1926393373: // instantiatesUri
3494          this.getInstantiatesUri().add(TypeConvertor.castToUri(value)); // UriType
3495          return value;
3496        case -332612366: // basedOn
3497          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
3498          return value;
3499        case -486355964: // priorPrescription
3500          this.priorPrescription = TypeConvertor.castToReference(value); // Reference
3501          return value;
3502        case -445338488: // groupIdentifier
3503          this.groupIdentifier = TypeConvertor.castToIdentifier(value); // Identifier
3504          return value;
3505        case -892481550: // status
3506          value = new MedicationrequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3507          this.status = (Enumeration) value; // Enumeration<MedicationrequestStatus>
3508          return value;
3509        case 2051346646: // statusReason
3510          this.statusReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3511          return value;
3512        case -1174686110: // statusChanged
3513          this.statusChanged = TypeConvertor.castToDateTime(value); // DateTimeType
3514          return value;
3515        case -1183762788: // intent
3516          value = new MedicationRequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
3517          this.intent = (Enumeration) value; // Enumeration<MedicationRequestIntent>
3518          return value;
3519        case 50511102: // category
3520          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3521          return value;
3522        case -1165461084: // priority
3523          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
3524          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
3525          return value;
3526        case -1788508167: // doNotPerform
3527          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
3528          return value;
3529        case 1998965455: // medication
3530          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
3531          return value;
3532        case -1867885268: // subject
3533          this.subject = TypeConvertor.castToReference(value); // Reference
3534          return value;
3535        case -2123220889: // informationSource
3536          this.getInformationSource().add(TypeConvertor.castToReference(value)); // Reference
3537          return value;
3538        case 1524132147: // encounter
3539          this.encounter = TypeConvertor.castToReference(value); // Reference
3540          return value;
3541        case -1248768647: // supportingInformation
3542          this.getSupportingInformation().add(TypeConvertor.castToReference(value)); // Reference
3543          return value;
3544        case -1500852503: // authoredOn
3545          this.authoredOn = TypeConvertor.castToDateTime(value); // DateTimeType
3546          return value;
3547        case 693933948: // requester
3548          this.requester = TypeConvertor.castToReference(value); // Reference
3549          return value;
3550        case -427039533: // reported
3551          this.reported = TypeConvertor.castToBoolean(value); // BooleanType
3552          return value;
3553        case -901444568: // performerType
3554          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3555          return value;
3556        case 481140686: // performer
3557          this.getPerformer().add(TypeConvertor.castToReference(value)); // Reference
3558          return value;
3559        case -1335157162: // device
3560          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
3561          return value;
3562        case -799233858: // recorder
3563          this.recorder = TypeConvertor.castToReference(value); // Reference
3564          return value;
3565        case -934964668: // reason
3566          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
3567          return value;
3568        case -447282031: // courseOfTherapyType
3569          this.courseOfTherapyType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3570          return value;
3571        case 73049818: // insurance
3572          this.getInsurance().add(TypeConvertor.castToReference(value)); // Reference
3573          return value;
3574        case 3387378: // note
3575          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
3576          return value;
3577        case 3089437: // dose
3578          this.dose = (MedicationRequestDoseComponent) value; // MedicationRequestDoseComponent
3579          return value;
3580        case 824620658: // dispenseRequest
3581          this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent
3582          return value;
3583        case 826147581: // substitution
3584          this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent
3585          return value;
3586        case 1835190426: // eventHistory
3587          this.getEventHistory().add(TypeConvertor.castToReference(value)); // Reference
3588          return value;
3589        default: return super.setProperty(hash, name, value);
3590        }
3591
3592      }
3593
3594      @Override
3595      public Base setProperty(String name, Base value) throws FHIRException {
3596        if (name.equals("identifier")) {
3597          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3598        } else if (name.equals("instantiatesCanonical")) {
3599          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value));
3600        } else if (name.equals("instantiatesUri")) {
3601          this.getInstantiatesUri().add(TypeConvertor.castToUri(value));
3602        } else if (name.equals("basedOn")) {
3603          this.getBasedOn().add(TypeConvertor.castToReference(value));
3604        } else if (name.equals("priorPrescription")) {
3605          this.priorPrescription = TypeConvertor.castToReference(value); // Reference
3606        } else if (name.equals("groupIdentifier")) {
3607          this.groupIdentifier = TypeConvertor.castToIdentifier(value); // Identifier
3608        } else if (name.equals("status")) {
3609          value = new MedicationrequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3610          this.status = (Enumeration) value; // Enumeration<MedicationrequestStatus>
3611        } else if (name.equals("statusReason")) {
3612          this.statusReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3613        } else if (name.equals("statusChanged")) {
3614          this.statusChanged = TypeConvertor.castToDateTime(value); // DateTimeType
3615        } else if (name.equals("intent")) {
3616          value = new MedicationRequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
3617          this.intent = (Enumeration) value; // Enumeration<MedicationRequestIntent>
3618        } else if (name.equals("category")) {
3619          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
3620        } else if (name.equals("priority")) {
3621          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
3622          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
3623        } else if (name.equals("doNotPerform")) {
3624          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
3625        } else if (name.equals("medication")) {
3626          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
3627        } else if (name.equals("subject")) {
3628          this.subject = TypeConvertor.castToReference(value); // Reference
3629        } else if (name.equals("informationSource")) {
3630          this.getInformationSource().add(TypeConvertor.castToReference(value));
3631        } else if (name.equals("encounter")) {
3632          this.encounter = TypeConvertor.castToReference(value); // Reference
3633        } else if (name.equals("supportingInformation")) {
3634          this.getSupportingInformation().add(TypeConvertor.castToReference(value));
3635        } else if (name.equals("authoredOn")) {
3636          this.authoredOn = TypeConvertor.castToDateTime(value); // DateTimeType
3637        } else if (name.equals("requester")) {
3638          this.requester = TypeConvertor.castToReference(value); // Reference
3639        } else if (name.equals("reported")) {
3640          this.reported = TypeConvertor.castToBoolean(value); // BooleanType
3641        } else if (name.equals("performerType")) {
3642          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3643        } else if (name.equals("performer")) {
3644          this.getPerformer().add(TypeConvertor.castToReference(value));
3645        } else if (name.equals("device")) {
3646          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
3647        } else if (name.equals("recorder")) {
3648          this.recorder = TypeConvertor.castToReference(value); // Reference
3649        } else if (name.equals("reason")) {
3650          this.getReason().add(TypeConvertor.castToCodeableReference(value));
3651        } else if (name.equals("courseOfTherapyType")) {
3652          this.courseOfTherapyType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3653        } else if (name.equals("insurance")) {
3654          this.getInsurance().add(TypeConvertor.castToReference(value));
3655        } else if (name.equals("note")) {
3656          this.getNote().add(TypeConvertor.castToAnnotation(value));
3657        } else if (name.equals("dose")) {
3658          this.dose = (MedicationRequestDoseComponent) value; // MedicationRequestDoseComponent
3659        } else if (name.equals("dispenseRequest")) {
3660          this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent
3661        } else if (name.equals("substitution")) {
3662          this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent
3663        } else if (name.equals("eventHistory")) {
3664          this.getEventHistory().add(TypeConvertor.castToReference(value));
3665        } else
3666          return super.setProperty(name, value);
3667        return value;
3668      }
3669
3670      @Override
3671      public Base makeProperty(int hash, String name) throws FHIRException {
3672        switch (hash) {
3673        case -1618432855:  return addIdentifier(); 
3674        case 8911915:  return addInstantiatesCanonicalElement();
3675        case -1926393373:  return addInstantiatesUriElement();
3676        case -332612366:  return addBasedOn(); 
3677        case -486355964:  return getPriorPrescription();
3678        case -445338488:  return getGroupIdentifier();
3679        case -892481550:  return getStatusElement();
3680        case 2051346646:  return getStatusReason();
3681        case -1174686110:  return getStatusChangedElement();
3682        case -1183762788:  return getIntentElement();
3683        case 50511102:  return addCategory(); 
3684        case -1165461084:  return getPriorityElement();
3685        case -1788508167:  return getDoNotPerformElement();
3686        case 1998965455:  return getMedication();
3687        case -1867885268:  return getSubject();
3688        case -2123220889:  return addInformationSource(); 
3689        case 1524132147:  return getEncounter();
3690        case -1248768647:  return addSupportingInformation(); 
3691        case -1500852503:  return getAuthoredOnElement();
3692        case 693933948:  return getRequester();
3693        case -427039533:  return getReportedElement();
3694        case -901444568:  return getPerformerType();
3695        case 481140686:  return addPerformer(); 
3696        case -1335157162:  return getDevice();
3697        case -799233858:  return getRecorder();
3698        case -934964668:  return addReason(); 
3699        case -447282031:  return getCourseOfTherapyType();
3700        case 73049818:  return addInsurance(); 
3701        case 3387378:  return addNote(); 
3702        case 3089437:  return getDose();
3703        case 824620658:  return getDispenseRequest();
3704        case 826147581:  return getSubstitution();
3705        case 1835190426:  return addEventHistory(); 
3706        default: return super.makeProperty(hash, name);
3707        }
3708
3709      }
3710
3711      @Override
3712      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3713        switch (hash) {
3714        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3715        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
3716        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
3717        case -332612366: /*basedOn*/ return new String[] {"Reference"};
3718        case -486355964: /*priorPrescription*/ return new String[] {"Reference"};
3719        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
3720        case -892481550: /*status*/ return new String[] {"code"};
3721        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
3722        case -1174686110: /*statusChanged*/ return new String[] {"dateTime"};
3723        case -1183762788: /*intent*/ return new String[] {"code"};
3724        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
3725        case -1165461084: /*priority*/ return new String[] {"code"};
3726        case -1788508167: /*doNotPerform*/ return new String[] {"boolean"};
3727        case 1998965455: /*medication*/ return new String[] {"CodeableReference"};
3728        case -1867885268: /*subject*/ return new String[] {"Reference"};
3729        case -2123220889: /*informationSource*/ return new String[] {"Reference"};
3730        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3731        case -1248768647: /*supportingInformation*/ return new String[] {"Reference"};
3732        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
3733        case 693933948: /*requester*/ return new String[] {"Reference"};
3734        case -427039533: /*reported*/ return new String[] {"boolean"};
3735        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
3736        case 481140686: /*performer*/ return new String[] {"Reference"};
3737        case -1335157162: /*device*/ return new String[] {"CodeableReference"};
3738        case -799233858: /*recorder*/ return new String[] {"Reference"};
3739        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
3740        case -447282031: /*courseOfTherapyType*/ return new String[] {"CodeableConcept"};
3741        case 73049818: /*insurance*/ return new String[] {"Reference"};
3742        case 3387378: /*note*/ return new String[] {"Annotation"};
3743        case 3089437: /*dose*/ return new String[] {};
3744        case 824620658: /*dispenseRequest*/ return new String[] {};
3745        case 826147581: /*substitution*/ return new String[] {};
3746        case 1835190426: /*eventHistory*/ return new String[] {"Reference"};
3747        default: return super.getTypesForProperty(hash, name);
3748        }
3749
3750      }
3751
3752      @Override
3753      public Base addChild(String name) throws FHIRException {
3754        if (name.equals("identifier")) {
3755          return addIdentifier();
3756        }
3757        else if (name.equals("instantiatesCanonical")) {
3758          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.instantiatesCanonical");
3759        }
3760        else if (name.equals("instantiatesUri")) {
3761          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.instantiatesUri");
3762        }
3763        else if (name.equals("basedOn")) {
3764          return addBasedOn();
3765        }
3766        else if (name.equals("priorPrescription")) {
3767          this.priorPrescription = new Reference();
3768          return this.priorPrescription;
3769        }
3770        else if (name.equals("groupIdentifier")) {
3771          this.groupIdentifier = new Identifier();
3772          return this.groupIdentifier;
3773        }
3774        else if (name.equals("status")) {
3775          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.status");
3776        }
3777        else if (name.equals("statusReason")) {
3778          this.statusReason = new CodeableConcept();
3779          return this.statusReason;
3780        }
3781        else if (name.equals("statusChanged")) {
3782          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.statusChanged");
3783        }
3784        else if (name.equals("intent")) {
3785          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.intent");
3786        }
3787        else if (name.equals("category")) {
3788          return addCategory();
3789        }
3790        else if (name.equals("priority")) {
3791          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.priority");
3792        }
3793        else if (name.equals("doNotPerform")) {
3794          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.doNotPerform");
3795        }
3796        else if (name.equals("medication")) {
3797          this.medication = new CodeableReference();
3798          return this.medication;
3799        }
3800        else if (name.equals("subject")) {
3801          this.subject = new Reference();
3802          return this.subject;
3803        }
3804        else if (name.equals("informationSource")) {
3805          return addInformationSource();
3806        }
3807        else if (name.equals("encounter")) {
3808          this.encounter = new Reference();
3809          return this.encounter;
3810        }
3811        else if (name.equals("supportingInformation")) {
3812          return addSupportingInformation();
3813        }
3814        else if (name.equals("authoredOn")) {
3815          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.authoredOn");
3816        }
3817        else if (name.equals("requester")) {
3818          this.requester = new Reference();
3819          return this.requester;
3820        }
3821        else if (name.equals("reported")) {
3822          throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.reported");
3823        }
3824        else if (name.equals("performerType")) {
3825          this.performerType = new CodeableConcept();
3826          return this.performerType;
3827        }
3828        else if (name.equals("performer")) {
3829          return addPerformer();
3830        }
3831        else if (name.equals("device")) {
3832          this.device = new CodeableReference();
3833          return this.device;
3834        }
3835        else if (name.equals("recorder")) {
3836          this.recorder = new Reference();
3837          return this.recorder;
3838        }
3839        else if (name.equals("reason")) {
3840          return addReason();
3841        }
3842        else if (name.equals("courseOfTherapyType")) {
3843          this.courseOfTherapyType = new CodeableConcept();
3844          return this.courseOfTherapyType;
3845        }
3846        else if (name.equals("insurance")) {
3847          return addInsurance();
3848        }
3849        else if (name.equals("note")) {
3850          return addNote();
3851        }
3852        else if (name.equals("dose")) {
3853          this.dose = new MedicationRequestDoseComponent();
3854          return this.dose;
3855        }
3856        else if (name.equals("dispenseRequest")) {
3857          this.dispenseRequest = new MedicationRequestDispenseRequestComponent();
3858          return this.dispenseRequest;
3859        }
3860        else if (name.equals("substitution")) {
3861          this.substitution = new MedicationRequestSubstitutionComponent();
3862          return this.substitution;
3863        }
3864        else if (name.equals("eventHistory")) {
3865          return addEventHistory();
3866        }
3867        else
3868          return super.addChild(name);
3869      }
3870
3871  public String fhirType() {
3872    return "MedicationRequest";
3873
3874  }
3875
3876      public MedicationRequest copy() {
3877        MedicationRequest dst = new MedicationRequest();
3878        copyValues(dst);
3879        return dst;
3880      }
3881
3882      public void copyValues(MedicationRequest dst) {
3883        super.copyValues(dst);
3884        if (identifier != null) {
3885          dst.identifier = new ArrayList<Identifier>();
3886          for (Identifier i : identifier)
3887            dst.identifier.add(i.copy());
3888        };
3889        if (instantiatesCanonical != null) {
3890          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
3891          for (CanonicalType i : instantiatesCanonical)
3892            dst.instantiatesCanonical.add(i.copy());
3893        };
3894        if (instantiatesUri != null) {
3895          dst.instantiatesUri = new ArrayList<UriType>();
3896          for (UriType i : instantiatesUri)
3897            dst.instantiatesUri.add(i.copy());
3898        };
3899        if (basedOn != null) {
3900          dst.basedOn = new ArrayList<Reference>();
3901          for (Reference i : basedOn)
3902            dst.basedOn.add(i.copy());
3903        };
3904        dst.priorPrescription = priorPrescription == null ? null : priorPrescription.copy();
3905        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
3906        dst.status = status == null ? null : status.copy();
3907        dst.statusReason = statusReason == null ? null : statusReason.copy();
3908        dst.statusChanged = statusChanged == null ? null : statusChanged.copy();
3909        dst.intent = intent == null ? null : intent.copy();
3910        if (category != null) {
3911          dst.category = new ArrayList<CodeableConcept>();
3912          for (CodeableConcept i : category)
3913            dst.category.add(i.copy());
3914        };
3915        dst.priority = priority == null ? null : priority.copy();
3916        dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
3917        dst.medication = medication == null ? null : medication.copy();
3918        dst.subject = subject == null ? null : subject.copy();
3919        if (informationSource != null) {
3920          dst.informationSource = new ArrayList<Reference>();
3921          for (Reference i : informationSource)
3922            dst.informationSource.add(i.copy());
3923        };
3924        dst.encounter = encounter == null ? null : encounter.copy();
3925        if (supportingInformation != null) {
3926          dst.supportingInformation = new ArrayList<Reference>();
3927          for (Reference i : supportingInformation)
3928            dst.supportingInformation.add(i.copy());
3929        };
3930        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
3931        dst.requester = requester == null ? null : requester.copy();
3932        dst.reported = reported == null ? null : reported.copy();
3933        dst.performerType = performerType == null ? null : performerType.copy();
3934        if (performer != null) {
3935          dst.performer = new ArrayList<Reference>();
3936          for (Reference i : performer)
3937            dst.performer.add(i.copy());
3938        };
3939        dst.device = device == null ? null : device.copy();
3940        dst.recorder = recorder == null ? null : recorder.copy();
3941        if (reason != null) {
3942          dst.reason = new ArrayList<CodeableReference>();
3943          for (CodeableReference i : reason)
3944            dst.reason.add(i.copy());
3945        };
3946        dst.courseOfTherapyType = courseOfTherapyType == null ? null : courseOfTherapyType.copy();
3947        if (insurance != null) {
3948          dst.insurance = new ArrayList<Reference>();
3949          for (Reference i : insurance)
3950            dst.insurance.add(i.copy());
3951        };
3952        if (note != null) {
3953          dst.note = new ArrayList<Annotation>();
3954          for (Annotation i : note)
3955            dst.note.add(i.copy());
3956        };
3957        dst.dose = dose == null ? null : dose.copy();
3958        dst.dispenseRequest = dispenseRequest == null ? null : dispenseRequest.copy();
3959        dst.substitution = substitution == null ? null : substitution.copy();
3960        if (eventHistory != null) {
3961          dst.eventHistory = new ArrayList<Reference>();
3962          for (Reference i : eventHistory)
3963            dst.eventHistory.add(i.copy());
3964        };
3965      }
3966
3967      protected MedicationRequest typedCopy() {
3968        return copy();
3969      }
3970
3971      @Override
3972      public boolean equalsDeep(Base other_) {
3973        if (!super.equalsDeep(other_))
3974          return false;
3975        if (!(other_ instanceof MedicationRequest))
3976          return false;
3977        MedicationRequest o = (MedicationRequest) other_;
3978        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
3979           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
3980           && compareDeep(priorPrescription, o.priorPrescription, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
3981           && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) && compareDeep(statusChanged, o.statusChanged, true)
3982           && compareDeep(intent, o.intent, true) && compareDeep(category, o.category, true) && compareDeep(priority, o.priority, true)
3983           && compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(medication, o.medication, true)
3984           && compareDeep(subject, o.subject, true) && compareDeep(informationSource, o.informationSource, true)
3985           && compareDeep(encounter, o.encounter, true) && compareDeep(supportingInformation, o.supportingInformation, true)
3986           && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true) && compareDeep(reported, o.reported, true)
3987           && compareDeep(performerType, o.performerType, true) && compareDeep(performer, o.performer, true)
3988           && compareDeep(device, o.device, true) && compareDeep(recorder, o.recorder, true) && compareDeep(reason, o.reason, true)
3989           && compareDeep(courseOfTherapyType, o.courseOfTherapyType, true) && compareDeep(insurance, o.insurance, true)
3990           && compareDeep(note, o.note, true) && compareDeep(dose, o.dose, true) && compareDeep(dispenseRequest, o.dispenseRequest, true)
3991           && compareDeep(substitution, o.substitution, true) && compareDeep(eventHistory, o.eventHistory, true)
3992          ;
3993      }
3994
3995      @Override
3996      public boolean equalsShallow(Base other_) {
3997        if (!super.equalsShallow(other_))
3998          return false;
3999        if (!(other_ instanceof MedicationRequest))
4000          return false;
4001        MedicationRequest o = (MedicationRequest) other_;
4002        return compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
4003           && compareValues(status, o.status, true) && compareValues(statusChanged, o.statusChanged, true) && compareValues(intent, o.intent, true)
4004           && compareValues(priority, o.priority, true) && compareValues(doNotPerform, o.doNotPerform, true) && compareValues(authoredOn, o.authoredOn, true)
4005           && compareValues(reported, o.reported, true);
4006      }
4007
4008      public boolean isEmpty() {
4009        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
4010          , instantiatesUri, basedOn, priorPrescription, groupIdentifier, status, statusReason
4011          , statusChanged, intent, category, priority, doNotPerform, medication, subject
4012          , informationSource, encounter, supportingInformation, authoredOn, requester, reported
4013          , performerType, performer, device, recorder, reason, courseOfTherapyType, insurance
4014          , note, dose, dispenseRequest, substitution, eventHistory);
4015      }
4016
4017  @Override
4018  public ResourceType getResourceType() {
4019    return ResourceType.MedicationRequest;
4020   }
4021
4022 /**
4023   * Search parameter: <b>authoredon</b>
4024   * <p>
4025   * Description: <b>Return prescriptions written on this date</b><br>
4026   * Type: <b>date</b><br>
4027   * Path: <b>MedicationRequest.authoredOn</b><br>
4028   * </p>
4029   */
4030  @SearchParamDefinition(name="authoredon", path="MedicationRequest.authoredOn", description="Return prescriptions written on this date", type="date" )
4031  public static final String SP_AUTHOREDON = "authoredon";
4032 /**
4033   * <b>Fluent Client</b> search parameter constant for <b>authoredon</b>
4034   * <p>
4035   * Description: <b>Return prescriptions written on this date</b><br>
4036   * Type: <b>date</b><br>
4037   * Path: <b>MedicationRequest.authoredOn</b><br>
4038   * </p>
4039   */
4040  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHOREDON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHOREDON);
4041
4042 /**
4043   * Search parameter: <b>category</b>
4044   * <p>
4045   * Description: <b>Returns prescriptions with different categories</b><br>
4046   * Type: <b>token</b><br>
4047   * Path: <b>MedicationRequest.category</b><br>
4048   * </p>
4049   */
4050  @SearchParamDefinition(name="category", path="MedicationRequest.category", description="Returns prescriptions with different categories", type="token" )
4051  public static final String SP_CATEGORY = "category";
4052 /**
4053   * <b>Fluent Client</b> search parameter constant for <b>category</b>
4054   * <p>
4055   * Description: <b>Returns prescriptions with different categories</b><br>
4056   * Type: <b>token</b><br>
4057   * Path: <b>MedicationRequest.category</b><br>
4058   * </p>
4059   */
4060  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
4061
4062 /**
4063   * Search parameter: <b>combo-date</b>
4064   * <p>
4065   * Description: <b>Returns medication request to be administered on a specific date or within a date range</b><br>
4066   * Type: <b>date</b><br>
4067   * Path: <b>MedicationRequest.dose.dosageInstruction.timing.event | (MedicationRequest.dose.dosageInstruction.timing.repeat.bounds as Period)</b><br>
4068   * </p>
4069   */
4070  @SearchParamDefinition(name="combo-date", path="MedicationRequest.dose.dosageInstruction.timing.event | (MedicationRequest.dose.dosageInstruction.timing.repeat.bounds as Period)", description="Returns medication request to be administered on a specific date or within a date range", type="date" )
4071  public static final String SP_COMBO_DATE = "combo-date";
4072 /**
4073   * <b>Fluent Client</b> search parameter constant for <b>combo-date</b>
4074   * <p>
4075   * Description: <b>Returns medication request to be administered on a specific date or within a date range</b><br>
4076   * Type: <b>date</b><br>
4077   * Path: <b>MedicationRequest.dose.dosageInstruction.timing.event | (MedicationRequest.dose.dosageInstruction.timing.repeat.bounds as Period)</b><br>
4078   * </p>
4079   */
4080  public static final ca.uhn.fhir.rest.gclient.DateClientParam COMBO_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_COMBO_DATE);
4081
4082 /**
4083   * Search parameter: <b>intended-dispenser</b>
4084   * <p>
4085   * Description: <b>Returns prescriptions intended to be dispensed by this Organization</b><br>
4086   * Type: <b>reference</b><br>
4087   * Path: <b>MedicationRequest.dispenseRequest.dispenser</b><br>
4088   * </p>
4089   */
4090  @SearchParamDefinition(name="intended-dispenser", path="MedicationRequest.dispenseRequest.dispenser", description="Returns prescriptions intended to be dispensed by this Organization", type="reference", target={Organization.class } )
4091  public static final String SP_INTENDED_DISPENSER = "intended-dispenser";
4092 /**
4093   * <b>Fluent Client</b> search parameter constant for <b>intended-dispenser</b>
4094   * <p>
4095   * Description: <b>Returns prescriptions intended to be dispensed by this Organization</b><br>
4096   * Type: <b>reference</b><br>
4097   * Path: <b>MedicationRequest.dispenseRequest.dispenser</b><br>
4098   * </p>
4099   */
4100  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INTENDED_DISPENSER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INTENDED_DISPENSER);
4101
4102/**
4103   * Constant for fluent queries to be used to add include statements. Specifies
4104   * the path value of "<b>MedicationRequest:intended-dispenser</b>".
4105   */
4106  public static final ca.uhn.fhir.model.api.Include INCLUDE_INTENDED_DISPENSER = new ca.uhn.fhir.model.api.Include("MedicationRequest:intended-dispenser").toLocked();
4107
4108 /**
4109   * Search parameter: <b>intended-performer</b>
4110   * <p>
4111   * Description: <b>Returns the intended performer of the administration of the medication request</b><br>
4112   * Type: <b>reference</b><br>
4113   * Path: <b>MedicationRequest.performer</b><br>
4114   * </p>
4115   */
4116  @SearchParamDefinition(name="intended-performer", path="MedicationRequest.performer", description="Returns the intended performer of the administration of the medication request", type="reference", target={CareTeam.class, Device.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
4117  public static final String SP_INTENDED_PERFORMER = "intended-performer";
4118 /**
4119   * <b>Fluent Client</b> search parameter constant for <b>intended-performer</b>
4120   * <p>
4121   * Description: <b>Returns the intended performer of the administration of the medication request</b><br>
4122   * Type: <b>reference</b><br>
4123   * Path: <b>MedicationRequest.performer</b><br>
4124   * </p>
4125   */
4126  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INTENDED_PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INTENDED_PERFORMER);
4127
4128/**
4129   * Constant for fluent queries to be used to add include statements. Specifies
4130   * the path value of "<b>MedicationRequest:intended-performer</b>".
4131   */
4132  public static final ca.uhn.fhir.model.api.Include INCLUDE_INTENDED_PERFORMER = new ca.uhn.fhir.model.api.Include("MedicationRequest:intended-performer").toLocked();
4133
4134 /**
4135   * Search parameter: <b>intended-performertype</b>
4136   * <p>
4137   * Description: <b>Returns requests for a specific type of performer</b><br>
4138   * Type: <b>token</b><br>
4139   * Path: <b>MedicationRequest.performerType</b><br>
4140   * </p>
4141   */
4142  @SearchParamDefinition(name="intended-performertype", path="MedicationRequest.performerType", description="Returns requests for a specific type of performer", type="token" )
4143  public static final String SP_INTENDED_PERFORMERTYPE = "intended-performertype";
4144 /**
4145   * <b>Fluent Client</b> search parameter constant for <b>intended-performertype</b>
4146   * <p>
4147   * Description: <b>Returns requests for a specific type of performer</b><br>
4148   * Type: <b>token</b><br>
4149   * Path: <b>MedicationRequest.performerType</b><br>
4150   * </p>
4151   */
4152  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENDED_PERFORMERTYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENDED_PERFORMERTYPE);
4153
4154 /**
4155   * Search parameter: <b>intent</b>
4156   * <p>
4157   * Description: <b>Returns prescriptions with different intents</b><br>
4158   * Type: <b>token</b><br>
4159   * Path: <b>MedicationRequest.intent</b><br>
4160   * </p>
4161   */
4162  @SearchParamDefinition(name="intent", path="MedicationRequest.intent", description="Returns prescriptions with different intents", type="token" )
4163  public static final String SP_INTENT = "intent";
4164 /**
4165   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
4166   * <p>
4167   * Description: <b>Returns prescriptions with different intents</b><br>
4168   * Type: <b>token</b><br>
4169   * Path: <b>MedicationRequest.intent</b><br>
4170   * </p>
4171   */
4172  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
4173
4174 /**
4175   * Search parameter: <b>priority</b>
4176   * <p>
4177   * Description: <b>Returns prescriptions with different priorities</b><br>
4178   * Type: <b>token</b><br>
4179   * Path: <b>MedicationRequest.priority</b><br>
4180   * </p>
4181   */
4182  @SearchParamDefinition(name="priority", path="MedicationRequest.priority", description="Returns prescriptions with different priorities", type="token" )
4183  public static final String SP_PRIORITY = "priority";
4184 /**
4185   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
4186   * <p>
4187   * Description: <b>Returns prescriptions with different priorities</b><br>
4188   * Type: <b>token</b><br>
4189   * Path: <b>MedicationRequest.priority</b><br>
4190   * </p>
4191   */
4192  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
4193
4194 /**
4195   * Search parameter: <b>requester</b>
4196   * <p>
4197   * Description: <b>Returns prescriptions prescribed by this prescriber</b><br>
4198   * Type: <b>reference</b><br>
4199   * Path: <b>MedicationRequest.requester</b><br>
4200   * </p>
4201   */
4202  @SearchParamDefinition(name="requester", path="MedicationRequest.requester", description="Returns prescriptions prescribed by this prescriber", 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 } )
4203  public static final String SP_REQUESTER = "requester";
4204 /**
4205   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
4206   * <p>
4207   * Description: <b>Returns prescriptions prescribed by this prescriber</b><br>
4208   * Type: <b>reference</b><br>
4209   * Path: <b>MedicationRequest.requester</b><br>
4210   * </p>
4211   */
4212  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
4213
4214/**
4215   * Constant for fluent queries to be used to add include statements. Specifies
4216   * the path value of "<b>MedicationRequest:requester</b>".
4217   */
4218  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("MedicationRequest:requester").toLocked();
4219
4220 /**
4221   * Search parameter: <b>subject</b>
4222   * <p>
4223   * Description: <b>The identity of a patient to list orders  for</b><br>
4224   * Type: <b>reference</b><br>
4225   * Path: <b>MedicationRequest.subject</b><br>
4226   * </p>
4227   */
4228  @SearchParamDefinition(name="subject", path="MedicationRequest.subject", description="The identity of a patient to list orders  for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Group.class, Patient.class } )
4229  public static final String SP_SUBJECT = "subject";
4230 /**
4231   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
4232   * <p>
4233   * Description: <b>The identity of a patient to list orders  for</b><br>
4234   * Type: <b>reference</b><br>
4235   * Path: <b>MedicationRequest.subject</b><br>
4236   * </p>
4237   */
4238  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
4239
4240/**
4241   * Constant for fluent queries to be used to add include statements. Specifies
4242   * the path value of "<b>MedicationRequest:subject</b>".
4243   */
4244  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicationRequest:subject").toLocked();
4245
4246 /**
4247   * Search parameter: <b>code</b>
4248   * <p>
4249   * Description: <b>Multiple Resources: 
4250
4251* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
4252* [Condition](condition.html): Code for the condition
4253* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
4254* [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
4255* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
4256* [List](list.html): What the purpose of this list is
4257* [Medication](medication.html): Returns medications for a specific code
4258* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
4259* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
4260* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
4261* [MedicationUsage](medicationusage.html): Return statements of this medication code
4262* [Observation](observation.html): The code of the observation type
4263* [Procedure](procedure.html): A code to identify a  procedure
4264* [ServiceRequest](servicerequest.html): What is being requested/ordered
4265</b><br>
4266   * Type: <b>token</b><br>
4267   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code</b><br>
4268   * </p>
4269   */
4270  @SearchParamDefinition(name="code", path="AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [Condition](condition.html): Code for the condition\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationUsage](medicationusage.html): Return statements of this medication code\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [ServiceRequest](servicerequest.html): What is being requested/ordered\r\n", type="token" )
4271  public static final String SP_CODE = "code";
4272 /**
4273   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4274   * <p>
4275   * Description: <b>Multiple Resources: 
4276
4277* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
4278* [Condition](condition.html): Code for the condition
4279* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
4280* [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
4281* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
4282* [List](list.html): What the purpose of this list is
4283* [Medication](medication.html): Returns medications for a specific code
4284* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
4285* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
4286* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
4287* [MedicationUsage](medicationusage.html): Return statements of this medication code
4288* [Observation](observation.html): The code of the observation type
4289* [Procedure](procedure.html): A code to identify a  procedure
4290* [ServiceRequest](servicerequest.html): What is being requested/ordered
4291</b><br>
4292   * Type: <b>token</b><br>
4293   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code</b><br>
4294   * </p>
4295   */
4296  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4297
4298 /**
4299   * Search parameter: <b>identifier</b>
4300   * <p>
4301   * Description: <b>Multiple Resources: 
4302
4303* [AllergyIntolerance](allergyintolerance.html): External ids for this item
4304* [CarePlan](careplan.html): External Ids for this plan
4305* [CareTeam](careteam.html): External Ids for this team
4306* [Composition](composition.html): Version-independent identifier for the Composition
4307* [Condition](condition.html): A unique identifier of the condition record
4308* [Consent](consent.html): Identifier for this record (external references)
4309* [DetectedIssue](detectedissue.html): Unique id for the detected issue
4310* [DeviceRequest](devicerequest.html): Business identifier for request/order
4311* [DiagnosticReport](diagnosticreport.html): An identifier for the report
4312* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
4313* [DocumentReference](documentreference.html): Identifier of the attachment binary
4314* [Encounter](encounter.html): Identifier(s) by which this encounter is known
4315* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
4316* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
4317* [Goal](goal.html): External Ids for this goal
4318* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
4319* [Immunization](immunization.html): Business identifier
4320* [List](list.html): Business identifier
4321* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
4322* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
4323* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
4324* [MedicationUsage](medicationusage.html): Return statements with this external identifier
4325* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
4326* [Observation](observation.html): The unique id for a particular observation
4327* [Procedure](procedure.html): A unique identifier for a procedure
4328* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
4329* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
4330* [SupplyDelivery](supplydelivery.html): External identifier
4331* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
4332* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
4333</b><br>
4334   * Type: <b>token</b><br>
4335   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
4336   * </p>
4337   */
4338  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationUsage](medicationusage.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
4339  public static final String SP_IDENTIFIER = "identifier";
4340 /**
4341   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4342   * <p>
4343   * Description: <b>Multiple Resources: 
4344
4345* [AllergyIntolerance](allergyintolerance.html): External ids for this item
4346* [CarePlan](careplan.html): External Ids for this plan
4347* [CareTeam](careteam.html): External Ids for this team
4348* [Composition](composition.html): Version-independent identifier for the Composition
4349* [Condition](condition.html): A unique identifier of the condition record
4350* [Consent](consent.html): Identifier for this record (external references)
4351* [DetectedIssue](detectedissue.html): Unique id for the detected issue
4352* [DeviceRequest](devicerequest.html): Business identifier for request/order
4353* [DiagnosticReport](diagnosticreport.html): An identifier for the report
4354* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
4355* [DocumentReference](documentreference.html): Identifier of the attachment binary
4356* [Encounter](encounter.html): Identifier(s) by which this encounter is known
4357* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
4358* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
4359* [Goal](goal.html): External Ids for this goal
4360* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
4361* [Immunization](immunization.html): Business identifier
4362* [List](list.html): Business identifier
4363* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
4364* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
4365* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
4366* [MedicationUsage](medicationusage.html): Return statements with this external identifier
4367* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
4368* [Observation](observation.html): The unique id for a particular observation
4369* [Procedure](procedure.html): A unique identifier for a procedure
4370* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
4371* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
4372* [SupplyDelivery](supplydelivery.html): External identifier
4373* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
4374* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
4375</b><br>
4376   * Type: <b>token</b><br>
4377   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
4378   * </p>
4379   */
4380  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4381
4382 /**
4383   * Search parameter: <b>patient</b>
4384   * <p>
4385   * Description: <b>Multiple Resources: 
4386
4387* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
4388* [CarePlan](careplan.html): Who the care plan is for
4389* [CareTeam](careteam.html): Who care team is for
4390* [ClinicalImpression](clinicalimpression.html): Patient assessed
4391* [Composition](composition.html): Who and/or what the composition is about
4392* [Condition](condition.html): Who has the condition?
4393* [Consent](consent.html): Who the consent applies to
4394* [DetectedIssue](detectedissue.html): Associated patient
4395* [DeviceRequest](devicerequest.html): Individual the service is ordered for
4396* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
4397* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
4398* [DocumentManifest](documentmanifest.html): The subject of the set of documents
4399* [DocumentReference](documentreference.html): Who/what is the subject of the document
4400* [Encounter](encounter.html): The patient present at the encounter
4401* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
4402* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
4403* [Flag](flag.html): The identity of a subject to list flags for
4404* [Goal](goal.html): Who this goal is intended for
4405* [ImagingStudy](imagingstudy.html): Who the study is about
4406* [Immunization](immunization.html): The patient for the vaccination record
4407* [List](list.html): If all resources have the same subject
4408* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
4409* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
4410* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
4411* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
4412* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
4413* [Observation](observation.html): The subject that the observation is about (if patient)
4414* [Procedure](procedure.html): Search by subject - a patient
4415* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
4416* [ServiceRequest](servicerequest.html): Search by subject - a patient
4417* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
4418* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
4419</b><br>
4420   * Type: <b>reference</b><br>
4421   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
4422   * </p>
4423   */
4424  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", target={Patient.class } )
4425  public static final String SP_PATIENT = "patient";
4426 /**
4427   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4428   * <p>
4429   * Description: <b>Multiple Resources: 
4430
4431* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
4432* [CarePlan](careplan.html): Who the care plan is for
4433* [CareTeam](careteam.html): Who care team is for
4434* [ClinicalImpression](clinicalimpression.html): Patient assessed
4435* [Composition](composition.html): Who and/or what the composition is about
4436* [Condition](condition.html): Who has the condition?
4437* [Consent](consent.html): Who the consent applies to
4438* [DetectedIssue](detectedissue.html): Associated patient
4439* [DeviceRequest](devicerequest.html): Individual the service is ordered for
4440* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
4441* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
4442* [DocumentManifest](documentmanifest.html): The subject of the set of documents
4443* [DocumentReference](documentreference.html): Who/what is the subject of the document
4444* [Encounter](encounter.html): The patient present at the encounter
4445* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
4446* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
4447* [Flag](flag.html): The identity of a subject to list flags for
4448* [Goal](goal.html): Who this goal is intended for
4449* [ImagingStudy](imagingstudy.html): Who the study is about
4450* [Immunization](immunization.html): The patient for the vaccination record
4451* [List](list.html): If all resources have the same subject
4452* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
4453* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
4454* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
4455* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
4456* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
4457* [Observation](observation.html): The subject that the observation is about (if patient)
4458* [Procedure](procedure.html): Search by subject - a patient
4459* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
4460* [ServiceRequest](servicerequest.html): Search by subject - a patient
4461* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
4462* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
4463</b><br>
4464   * Type: <b>reference</b><br>
4465   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
4466   * </p>
4467   */
4468  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4469
4470/**
4471   * Constant for fluent queries to be used to add include statements. Specifies
4472   * the path value of "<b>MedicationRequest:patient</b>".
4473   */
4474  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationRequest:patient").toLocked();
4475
4476 /**
4477   * Search parameter: <b>encounter</b>
4478   * <p>
4479   * Description: <b>Multiple Resources: 
4480
4481* [MedicationAdministration](medicationadministration.html): Return administrations that share this encounter
4482* [MedicationRequest](medicationrequest.html): Return prescriptions with this encounter identifier
4483</b><br>
4484   * Type: <b>reference</b><br>
4485   * Path: <b>MedicationAdministration.encounter | MedicationRequest.encounter</b><br>
4486   * </p>
4487   */
4488  @SearchParamDefinition(name="encounter", path="MedicationAdministration.encounter | MedicationRequest.encounter", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): Return administrations that share this encounter\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this encounter identifier\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
4489  public static final String SP_ENCOUNTER = "encounter";
4490 /**
4491   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
4492   * <p>
4493   * Description: <b>Multiple Resources: 
4494
4495* [MedicationAdministration](medicationadministration.html): Return administrations that share this encounter
4496* [MedicationRequest](medicationrequest.html): Return prescriptions with this encounter identifier
4497</b><br>
4498   * Type: <b>reference</b><br>
4499   * Path: <b>MedicationAdministration.encounter | MedicationRequest.encounter</b><br>
4500   * </p>
4501   */
4502  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
4503
4504/**
4505   * Constant for fluent queries to be used to add include statements. Specifies
4506   * the path value of "<b>MedicationRequest:encounter</b>".
4507   */
4508  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("MedicationRequest:encounter").toLocked();
4509
4510 /**
4511   * Search parameter: <b>medication</b>
4512   * <p>
4513   * Description: <b>Multiple Resources: 
4514
4515* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
4516* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
4517* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
4518* [MedicationUsage](medicationusage.html): Return statements of this medication reference
4519</b><br>
4520   * Type: <b>reference</b><br>
4521   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference</b><br>
4522   * </p>
4523   */
4524  @SearchParamDefinition(name="medication", path="MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference\r\n* [MedicationUsage](medicationusage.html): Return statements of this medication reference\r\n", type="reference" )
4525  public static final String SP_MEDICATION = "medication";
4526 /**
4527   * <b>Fluent Client</b> search parameter constant for <b>medication</b>
4528   * <p>
4529   * Description: <b>Multiple Resources: 
4530
4531* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
4532* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
4533* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
4534* [MedicationUsage](medicationusage.html): Return statements of this medication reference
4535</b><br>
4536   * Type: <b>reference</b><br>
4537   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference</b><br>
4538   * </p>
4539   */
4540  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION);
4541
4542/**
4543   * Constant for fluent queries to be used to add include statements. Specifies
4544   * the path value of "<b>MedicationRequest:medication</b>".
4545   */
4546  public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationRequest:medication").toLocked();
4547
4548 /**
4549   * Search parameter: <b>status</b>
4550   * <p>
4551   * Description: <b>Multiple Resources: 
4552
4553* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
4554* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
4555* [MedicationRequest](medicationrequest.html): Status of the prescription
4556* [MedicationUsage](medicationusage.html): Return statements that match the given status
4557</b><br>
4558   * Type: <b>token</b><br>
4559   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status</b><br>
4560   * </p>
4561   */
4562  @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" )
4563  public static final String SP_STATUS = "status";
4564 /**
4565   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4566   * <p>
4567   * Description: <b>Multiple Resources: 
4568
4569* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
4570* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
4571* [MedicationRequest](medicationrequest.html): Status of the prescription
4572* [MedicationUsage](medicationusage.html): Return statements that match the given status
4573</b><br>
4574   * Type: <b>token</b><br>
4575   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status</b><br>
4576   * </p>
4577   */
4578  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4579
4580
4581}
4582