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