001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * Represents a request for a patient to employ a medical device. The device may be an implantable device, or an external assistive device, such as a walker.
050 */
051@ResourceDef(name="DeviceRequest", profile="http://hl7.org/fhir/StructureDefinition/DeviceRequest")
052public class DeviceRequest extends DomainResource {
053
054    public enum DeviceRequestStatus {
055        /**
056         * The request has been created but is not yet complete or ready for action.
057         */
058        DRAFT, 
059        /**
060         * The request is in force and ready to be acted upon.
061         */
062        ACTIVE, 
063        /**
064         * The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.
065         */
066        ONHOLD, 
067        /**
068         * The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.
069         */
070        REVOKED, 
071        /**
072         * The activity described by the request has been fully performed.  No further activity will occur.
073         */
074        COMPLETED, 
075        /**
076         * This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be "revoked" rather than "entered-in-error".).
077         */
078        ENTEREDINERROR, 
079        /**
080         * 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.
081         */
082        UNKNOWN, 
083        /**
084         * added to help the parsers with the generic types
085         */
086        NULL;
087        public static DeviceRequestStatus fromCode(String codeString) throws FHIRException {
088            if (codeString == null || "".equals(codeString))
089                return null;
090        if ("draft".equals(codeString))
091          return DRAFT;
092        if ("active".equals(codeString))
093          return ACTIVE;
094        if ("on-hold".equals(codeString))
095          return ONHOLD;
096        if ("revoked".equals(codeString))
097          return REVOKED;
098        if ("completed".equals(codeString))
099          return COMPLETED;
100        if ("entered-in-error".equals(codeString))
101          return ENTEREDINERROR;
102        if ("unknown".equals(codeString))
103          return UNKNOWN;
104        if (Configuration.isAcceptInvalidEnums())
105          return null;
106        else
107          throw new FHIRException("Unknown DeviceRequestStatus code '"+codeString+"'");
108        }
109        public String toCode() {
110          switch (this) {
111            case DRAFT: return "draft";
112            case ACTIVE: return "active";
113            case ONHOLD: return "on-hold";
114            case REVOKED: return "revoked";
115            case COMPLETED: return "completed";
116            case ENTEREDINERROR: return "entered-in-error";
117            case UNKNOWN: return "unknown";
118            case NULL: return null;
119            default: return "?";
120          }
121        }
122        public String getSystem() {
123          switch (this) {
124            case DRAFT: return "http://hl7.org/fhir/request-status";
125            case ACTIVE: return "http://hl7.org/fhir/request-status";
126            case ONHOLD: return "http://hl7.org/fhir/request-status";
127            case REVOKED: return "http://hl7.org/fhir/request-status";
128            case COMPLETED: return "http://hl7.org/fhir/request-status";
129            case ENTEREDINERROR: return "http://hl7.org/fhir/request-status";
130            case UNKNOWN: return "http://hl7.org/fhir/request-status";
131            case NULL: return null;
132            default: return "?";
133          }
134        }
135        public String getDefinition() {
136          switch (this) {
137            case DRAFT: return "The request has been created but is not yet complete or ready for action.";
138            case ACTIVE: return "The request is in force and ready to be acted upon.";
139            case ONHOLD: return "The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.";
140            case REVOKED: return "The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
141            case COMPLETED: return "The activity described by the request has been fully performed.  No further activity will occur.";
142            case ENTEREDINERROR: return "This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be \"revoked\" rather than \"entered-in-error\".).";
143            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.";
144            case NULL: return null;
145            default: return "?";
146          }
147        }
148        public String getDisplay() {
149          switch (this) {
150            case DRAFT: return "Draft";
151            case ACTIVE: return "Active";
152            case ONHOLD: return "On Hold";
153            case REVOKED: return "Revoked";
154            case COMPLETED: return "Completed";
155            case ENTEREDINERROR: return "Entered in Error";
156            case UNKNOWN: return "Unknown";
157            case NULL: return null;
158            default: return "?";
159          }
160        }
161    }
162
163  public static class DeviceRequestStatusEnumFactory implements EnumFactory<DeviceRequestStatus> {
164    public DeviceRequestStatus fromCode(String codeString) throws IllegalArgumentException {
165      if (codeString == null || "".equals(codeString))
166            if (codeString == null || "".equals(codeString))
167                return null;
168        if ("draft".equals(codeString))
169          return DeviceRequestStatus.DRAFT;
170        if ("active".equals(codeString))
171          return DeviceRequestStatus.ACTIVE;
172        if ("on-hold".equals(codeString))
173          return DeviceRequestStatus.ONHOLD;
174        if ("revoked".equals(codeString))
175          return DeviceRequestStatus.REVOKED;
176        if ("completed".equals(codeString))
177          return DeviceRequestStatus.COMPLETED;
178        if ("entered-in-error".equals(codeString))
179          return DeviceRequestStatus.ENTEREDINERROR;
180        if ("unknown".equals(codeString))
181          return DeviceRequestStatus.UNKNOWN;
182        throw new IllegalArgumentException("Unknown DeviceRequestStatus code '"+codeString+"'");
183        }
184        public Enumeration<DeviceRequestStatus> fromType(Base code) throws FHIRException {
185          if (code == null)
186            return null;
187          if (code.isEmpty())
188            return new Enumeration<DeviceRequestStatus>(this);
189          String codeString = ((PrimitiveType) code).asStringValue();
190          if (codeString == null || "".equals(codeString))
191            return null;
192        if ("draft".equals(codeString))
193          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.DRAFT);
194        if ("active".equals(codeString))
195          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.ACTIVE);
196        if ("on-hold".equals(codeString))
197          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.ONHOLD);
198        if ("revoked".equals(codeString))
199          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.REVOKED);
200        if ("completed".equals(codeString))
201          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.COMPLETED);
202        if ("entered-in-error".equals(codeString))
203          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.ENTEREDINERROR);
204        if ("unknown".equals(codeString))
205          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.UNKNOWN);
206        throw new FHIRException("Unknown DeviceRequestStatus code '"+codeString+"'");
207        }
208    public String toCode(DeviceRequestStatus code) {
209      if (code == DeviceRequestStatus.DRAFT)
210        return "draft";
211      if (code == DeviceRequestStatus.ACTIVE)
212        return "active";
213      if (code == DeviceRequestStatus.ONHOLD)
214        return "on-hold";
215      if (code == DeviceRequestStatus.REVOKED)
216        return "revoked";
217      if (code == DeviceRequestStatus.COMPLETED)
218        return "completed";
219      if (code == DeviceRequestStatus.ENTEREDINERROR)
220        return "entered-in-error";
221      if (code == DeviceRequestStatus.UNKNOWN)
222        return "unknown";
223      return "?";
224      }
225    public String toSystem(DeviceRequestStatus code) {
226      return code.getSystem();
227      }
228    }
229
230    public enum RequestIntent {
231        /**
232         * The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.
233         */
234        PROPOSAL, 
235        /**
236         * The request represents an intention to ensure something occurs without providing an authorization for others to act.
237         */
238        PLAN, 
239        /**
240         * The request represents a legally binding instruction authored by a Patient or RelatedPerson.
241         */
242        DIRECTIVE, 
243        /**
244         * The request represents a request/demand and authorization for action by a Practitioner.
245         */
246        ORDER, 
247        /**
248         * The request represents an original authorization for action.
249         */
250        ORIGINALORDER, 
251        /**
252         * 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.
253         */
254        REFLEXORDER, 
255        /**
256         * 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.
257         */
258        FILLERORDER, 
259        /**
260         * An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.
261         */
262        INSTANCEORDER, 
263        /**
264         * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.
265         */
266        OPTION, 
267        /**
268         * added to help the parsers with the generic types
269         */
270        NULL;
271        public static RequestIntent fromCode(String codeString) throws FHIRException {
272            if (codeString == null || "".equals(codeString))
273                return null;
274        if ("proposal".equals(codeString))
275          return PROPOSAL;
276        if ("plan".equals(codeString))
277          return PLAN;
278        if ("directive".equals(codeString))
279          return DIRECTIVE;
280        if ("order".equals(codeString))
281          return ORDER;
282        if ("original-order".equals(codeString))
283          return ORIGINALORDER;
284        if ("reflex-order".equals(codeString))
285          return REFLEXORDER;
286        if ("filler-order".equals(codeString))
287          return FILLERORDER;
288        if ("instance-order".equals(codeString))
289          return INSTANCEORDER;
290        if ("option".equals(codeString))
291          return OPTION;
292        if (Configuration.isAcceptInvalidEnums())
293          return null;
294        else
295          throw new FHIRException("Unknown RequestIntent code '"+codeString+"'");
296        }
297        public String toCode() {
298          switch (this) {
299            case PROPOSAL: return "proposal";
300            case PLAN: return "plan";
301            case DIRECTIVE: return "directive";
302            case ORDER: return "order";
303            case ORIGINALORDER: return "original-order";
304            case REFLEXORDER: return "reflex-order";
305            case FILLERORDER: return "filler-order";
306            case INSTANCEORDER: return "instance-order";
307            case OPTION: return "option";
308            case NULL: return null;
309            default: return "?";
310          }
311        }
312        public String getSystem() {
313          switch (this) {
314            case PROPOSAL: return "http://hl7.org/fhir/request-intent";
315            case PLAN: return "http://hl7.org/fhir/request-intent";
316            case DIRECTIVE: return "http://hl7.org/fhir/request-intent";
317            case ORDER: return "http://hl7.org/fhir/request-intent";
318            case ORIGINALORDER: return "http://hl7.org/fhir/request-intent";
319            case REFLEXORDER: return "http://hl7.org/fhir/request-intent";
320            case FILLERORDER: return "http://hl7.org/fhir/request-intent";
321            case INSTANCEORDER: return "http://hl7.org/fhir/request-intent";
322            case OPTION: return "http://hl7.org/fhir/request-intent";
323            case NULL: return null;
324            default: return "?";
325          }
326        }
327        public String getDefinition() {
328          switch (this) {
329            case PROPOSAL: return "The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.";
330            case PLAN: return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
331            case DIRECTIVE: return "The request represents a legally binding instruction authored by a Patient or RelatedPerson.";
332            case ORDER: return "The request represents a request/demand and authorization for action by a Practitioner.";
333            case ORIGINALORDER: return "The request represents an original authorization for action.";
334            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.";
335            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.";
336            case INSTANCEORDER: return "An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.";
337            case OPTION: return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.";
338            case NULL: return null;
339            default: return "?";
340          }
341        }
342        public String getDisplay() {
343          switch (this) {
344            case PROPOSAL: return "Proposal";
345            case PLAN: return "Plan";
346            case DIRECTIVE: return "Directive";
347            case ORDER: return "Order";
348            case ORIGINALORDER: return "Original Order";
349            case REFLEXORDER: return "Reflex Order";
350            case FILLERORDER: return "Filler Order";
351            case INSTANCEORDER: return "Instance Order";
352            case OPTION: return "Option";
353            case NULL: return null;
354            default: return "?";
355          }
356        }
357    }
358
359  public static class RequestIntentEnumFactory implements EnumFactory<RequestIntent> {
360    public RequestIntent fromCode(String codeString) throws IllegalArgumentException {
361      if (codeString == null || "".equals(codeString))
362            if (codeString == null || "".equals(codeString))
363                return null;
364        if ("proposal".equals(codeString))
365          return RequestIntent.PROPOSAL;
366        if ("plan".equals(codeString))
367          return RequestIntent.PLAN;
368        if ("directive".equals(codeString))
369          return RequestIntent.DIRECTIVE;
370        if ("order".equals(codeString))
371          return RequestIntent.ORDER;
372        if ("original-order".equals(codeString))
373          return RequestIntent.ORIGINALORDER;
374        if ("reflex-order".equals(codeString))
375          return RequestIntent.REFLEXORDER;
376        if ("filler-order".equals(codeString))
377          return RequestIntent.FILLERORDER;
378        if ("instance-order".equals(codeString))
379          return RequestIntent.INSTANCEORDER;
380        if ("option".equals(codeString))
381          return RequestIntent.OPTION;
382        throw new IllegalArgumentException("Unknown RequestIntent code '"+codeString+"'");
383        }
384        public Enumeration<RequestIntent> fromType(Base code) throws FHIRException {
385          if (code == null)
386            return null;
387          if (code.isEmpty())
388            return new Enumeration<RequestIntent>(this);
389          String codeString = ((PrimitiveType) code).asStringValue();
390          if (codeString == null || "".equals(codeString))
391            return null;
392        if ("proposal".equals(codeString))
393          return new Enumeration<RequestIntent>(this, RequestIntent.PROPOSAL);
394        if ("plan".equals(codeString))
395          return new Enumeration<RequestIntent>(this, RequestIntent.PLAN);
396        if ("directive".equals(codeString))
397          return new Enumeration<RequestIntent>(this, RequestIntent.DIRECTIVE);
398        if ("order".equals(codeString))
399          return new Enumeration<RequestIntent>(this, RequestIntent.ORDER);
400        if ("original-order".equals(codeString))
401          return new Enumeration<RequestIntent>(this, RequestIntent.ORIGINALORDER);
402        if ("reflex-order".equals(codeString))
403          return new Enumeration<RequestIntent>(this, RequestIntent.REFLEXORDER);
404        if ("filler-order".equals(codeString))
405          return new Enumeration<RequestIntent>(this, RequestIntent.FILLERORDER);
406        if ("instance-order".equals(codeString))
407          return new Enumeration<RequestIntent>(this, RequestIntent.INSTANCEORDER);
408        if ("option".equals(codeString))
409          return new Enumeration<RequestIntent>(this, RequestIntent.OPTION);
410        throw new FHIRException("Unknown RequestIntent code '"+codeString+"'");
411        }
412    public String toCode(RequestIntent code) {
413      if (code == RequestIntent.PROPOSAL)
414        return "proposal";
415      if (code == RequestIntent.PLAN)
416        return "plan";
417      if (code == RequestIntent.DIRECTIVE)
418        return "directive";
419      if (code == RequestIntent.ORDER)
420        return "order";
421      if (code == RequestIntent.ORIGINALORDER)
422        return "original-order";
423      if (code == RequestIntent.REFLEXORDER)
424        return "reflex-order";
425      if (code == RequestIntent.FILLERORDER)
426        return "filler-order";
427      if (code == RequestIntent.INSTANCEORDER)
428        return "instance-order";
429      if (code == RequestIntent.OPTION)
430        return "option";
431      return "?";
432      }
433    public String toSystem(RequestIntent code) {
434      return code.getSystem();
435      }
436    }
437
438    public enum RequestPriority {
439        /**
440         * The request has normal priority.
441         */
442        ROUTINE, 
443        /**
444         * The request should be actioned promptly - higher priority than routine.
445         */
446        URGENT, 
447        /**
448         * The request should be actioned as soon as possible - higher priority than urgent.
449         */
450        ASAP, 
451        /**
452         * The request should be actioned immediately - highest possible priority.  E.g. an emergency.
453         */
454        STAT, 
455        /**
456         * added to help the parsers with the generic types
457         */
458        NULL;
459        public static RequestPriority fromCode(String codeString) throws FHIRException {
460            if (codeString == null || "".equals(codeString))
461                return null;
462        if ("routine".equals(codeString))
463          return ROUTINE;
464        if ("urgent".equals(codeString))
465          return URGENT;
466        if ("asap".equals(codeString))
467          return ASAP;
468        if ("stat".equals(codeString))
469          return STAT;
470        if (Configuration.isAcceptInvalidEnums())
471          return null;
472        else
473          throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
474        }
475        public String toCode() {
476          switch (this) {
477            case ROUTINE: return "routine";
478            case URGENT: return "urgent";
479            case ASAP: return "asap";
480            case STAT: return "stat";
481            case NULL: return null;
482            default: return "?";
483          }
484        }
485        public String getSystem() {
486          switch (this) {
487            case ROUTINE: return "http://hl7.org/fhir/request-priority";
488            case URGENT: return "http://hl7.org/fhir/request-priority";
489            case ASAP: return "http://hl7.org/fhir/request-priority";
490            case STAT: return "http://hl7.org/fhir/request-priority";
491            case NULL: return null;
492            default: return "?";
493          }
494        }
495        public String getDefinition() {
496          switch (this) {
497            case ROUTINE: return "The request has normal priority.";
498            case URGENT: return "The request should be actioned promptly - higher priority than routine.";
499            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent.";
500            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency.";
501            case NULL: return null;
502            default: return "?";
503          }
504        }
505        public String getDisplay() {
506          switch (this) {
507            case ROUTINE: return "Routine";
508            case URGENT: return "Urgent";
509            case ASAP: return "ASAP";
510            case STAT: return "STAT";
511            case NULL: return null;
512            default: return "?";
513          }
514        }
515    }
516
517  public static class RequestPriorityEnumFactory implements EnumFactory<RequestPriority> {
518    public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
519      if (codeString == null || "".equals(codeString))
520            if (codeString == null || "".equals(codeString))
521                return null;
522        if ("routine".equals(codeString))
523          return RequestPriority.ROUTINE;
524        if ("urgent".equals(codeString))
525          return RequestPriority.URGENT;
526        if ("asap".equals(codeString))
527          return RequestPriority.ASAP;
528        if ("stat".equals(codeString))
529          return RequestPriority.STAT;
530        throw new IllegalArgumentException("Unknown RequestPriority code '"+codeString+"'");
531        }
532        public Enumeration<RequestPriority> fromType(Base code) throws FHIRException {
533          if (code == null)
534            return null;
535          if (code.isEmpty())
536            return new Enumeration<RequestPriority>(this);
537          String codeString = ((PrimitiveType) code).asStringValue();
538          if (codeString == null || "".equals(codeString))
539            return null;
540        if ("routine".equals(codeString))
541          return new Enumeration<RequestPriority>(this, RequestPriority.ROUTINE);
542        if ("urgent".equals(codeString))
543          return new Enumeration<RequestPriority>(this, RequestPriority.URGENT);
544        if ("asap".equals(codeString))
545          return new Enumeration<RequestPriority>(this, RequestPriority.ASAP);
546        if ("stat".equals(codeString))
547          return new Enumeration<RequestPriority>(this, RequestPriority.STAT);
548        throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
549        }
550    public String toCode(RequestPriority code) {
551      if (code == RequestPriority.ROUTINE)
552        return "routine";
553      if (code == RequestPriority.URGENT)
554        return "urgent";
555      if (code == RequestPriority.ASAP)
556        return "asap";
557      if (code == RequestPriority.STAT)
558        return "stat";
559      return "?";
560      }
561    public String toSystem(RequestPriority code) {
562      return code.getSystem();
563      }
564    }
565
566    @Block()
567    public static class DeviceRequestParameterComponent extends BackboneElement implements IBaseBackboneElement {
568        /**
569         * A code or string that identifies the device detail being asserted.
570         */
571        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
572        @Description(shortDefinition="Device detail", formalDefinition="A code or string that identifies the device detail being asserted." )
573        protected CodeableConcept code;
574
575        /**
576         * The value of the device detail.
577         */
578        @Child(name = "value", type = {CodeableConcept.class, Quantity.class, Range.class, BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
579        @Description(shortDefinition="Value of detail", formalDefinition="The value of the device detail." )
580        protected Type value;
581
582        private static final long serialVersionUID = 884525025L;
583
584    /**
585     * Constructor
586     */
587      public DeviceRequestParameterComponent() {
588        super();
589      }
590
591        /**
592         * @return {@link #code} (A code or string that identifies the device detail being asserted.)
593         */
594        public CodeableConcept getCode() { 
595          if (this.code == null)
596            if (Configuration.errorOnAutoCreate())
597              throw new Error("Attempt to auto-create DeviceRequestParameterComponent.code");
598            else if (Configuration.doAutoCreate())
599              this.code = new CodeableConcept(); // cc
600          return this.code;
601        }
602
603        public boolean hasCode() { 
604          return this.code != null && !this.code.isEmpty();
605        }
606
607        /**
608         * @param value {@link #code} (A code or string that identifies the device detail being asserted.)
609         */
610        public DeviceRequestParameterComponent setCode(CodeableConcept value) { 
611          this.code = value;
612          return this;
613        }
614
615        /**
616         * @return {@link #value} (The value of the device detail.)
617         */
618        public Type getValue() { 
619          return this.value;
620        }
621
622        /**
623         * @return {@link #value} (The value of the device detail.)
624         */
625        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
626          if (this.value == null)
627            this.value = new CodeableConcept();
628          if (!(this.value instanceof CodeableConcept))
629            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
630          return (CodeableConcept) this.value;
631        }
632
633        public boolean hasValueCodeableConcept() { 
634          return this != null && this.value instanceof CodeableConcept;
635        }
636
637        /**
638         * @return {@link #value} (The value of the device detail.)
639         */
640        public Quantity getValueQuantity() throws FHIRException { 
641          if (this.value == null)
642            this.value = new Quantity();
643          if (!(this.value instanceof Quantity))
644            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
645          return (Quantity) this.value;
646        }
647
648        public boolean hasValueQuantity() { 
649          return this != null && this.value instanceof Quantity;
650        }
651
652        /**
653         * @return {@link #value} (The value of the device detail.)
654         */
655        public Range getValueRange() throws FHIRException { 
656          if (this.value == null)
657            this.value = new Range();
658          if (!(this.value instanceof Range))
659            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
660          return (Range) this.value;
661        }
662
663        public boolean hasValueRange() { 
664          return this != null && this.value instanceof Range;
665        }
666
667        /**
668         * @return {@link #value} (The value of the device detail.)
669         */
670        public BooleanType getValueBooleanType() throws FHIRException { 
671          if (this.value == null)
672            this.value = new BooleanType();
673          if (!(this.value instanceof BooleanType))
674            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
675          return (BooleanType) this.value;
676        }
677
678        public boolean hasValueBooleanType() { 
679          return this != null && this.value instanceof BooleanType;
680        }
681
682        public boolean hasValue() { 
683          return this.value != null && !this.value.isEmpty();
684        }
685
686        /**
687         * @param value {@link #value} (The value of the device detail.)
688         */
689        public DeviceRequestParameterComponent setValue(Type value) { 
690          if (value != null && !(value instanceof CodeableConcept || value instanceof Quantity || value instanceof Range || value instanceof BooleanType))
691            throw new Error("Not the right type for DeviceRequest.parameter.value[x]: "+value.fhirType());
692          this.value = value;
693          return this;
694        }
695
696        protected void listChildren(List<Property> children) {
697          super.listChildren(children);
698          children.add(new Property("code", "CodeableConcept", "A code or string that identifies the device detail being asserted.", 0, 1, code));
699          children.add(new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.", 0, 1, value));
700        }
701
702        @Override
703        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
704          switch (_hash) {
705          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code or string that identifies the device detail being asserted.", 0, 1, code);
706          case -1410166417: /*value[x]*/  return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.", 0, 1, value);
707          case 111972721: /*value*/  return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.", 0, 1, value);
708          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.", 0, 1, value);
709          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.", 0, 1, value);
710          case 2030761548: /*valueRange*/  return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.", 0, 1, value);
711          case 733421943: /*valueBoolean*/  return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.", 0, 1, value);
712          default: return super.getNamedProperty(_hash, _name, _checkValid);
713          }
714
715        }
716
717      @Override
718      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
719        switch (hash) {
720        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
721        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
722        default: return super.getProperty(hash, name, checkValid);
723        }
724
725      }
726
727      @Override
728      public Base setProperty(int hash, String name, Base value) throws FHIRException {
729        switch (hash) {
730        case 3059181: // code
731          this.code = castToCodeableConcept(value); // CodeableConcept
732          return value;
733        case 111972721: // value
734          this.value = castToType(value); // Type
735          return value;
736        default: return super.setProperty(hash, name, value);
737        }
738
739      }
740
741      @Override
742      public Base setProperty(String name, Base value) throws FHIRException {
743        if (name.equals("code")) {
744          this.code = castToCodeableConcept(value); // CodeableConcept
745        } else if (name.equals("value[x]")) {
746          this.value = castToType(value); // Type
747        } else
748          return super.setProperty(name, value);
749        return value;
750      }
751
752      @Override
753      public Base makeProperty(int hash, String name) throws FHIRException {
754        switch (hash) {
755        case 3059181:  return getCode(); 
756        case -1410166417:  return getValue(); 
757        case 111972721:  return getValue(); 
758        default: return super.makeProperty(hash, name);
759        }
760
761      }
762
763      @Override
764      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
765        switch (hash) {
766        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
767        case 111972721: /*value*/ return new String[] {"CodeableConcept", "Quantity", "Range", "boolean"};
768        default: return super.getTypesForProperty(hash, name);
769        }
770
771      }
772
773      @Override
774      public Base addChild(String name) throws FHIRException {
775        if (name.equals("code")) {
776          this.code = new CodeableConcept();
777          return this.code;
778        }
779        else if (name.equals("valueCodeableConcept")) {
780          this.value = new CodeableConcept();
781          return this.value;
782        }
783        else if (name.equals("valueQuantity")) {
784          this.value = new Quantity();
785          return this.value;
786        }
787        else if (name.equals("valueRange")) {
788          this.value = new Range();
789          return this.value;
790        }
791        else if (name.equals("valueBoolean")) {
792          this.value = new BooleanType();
793          return this.value;
794        }
795        else
796          return super.addChild(name);
797      }
798
799      public DeviceRequestParameterComponent copy() {
800        DeviceRequestParameterComponent dst = new DeviceRequestParameterComponent();
801        copyValues(dst);
802        return dst;
803      }
804
805      public void copyValues(DeviceRequestParameterComponent dst) {
806        super.copyValues(dst);
807        dst.code = code == null ? null : code.copy();
808        dst.value = value == null ? null : value.copy();
809      }
810
811      @Override
812      public boolean equalsDeep(Base other_) {
813        if (!super.equalsDeep(other_))
814          return false;
815        if (!(other_ instanceof DeviceRequestParameterComponent))
816          return false;
817        DeviceRequestParameterComponent o = (DeviceRequestParameterComponent) other_;
818        return compareDeep(code, o.code, true) && compareDeep(value, o.value, true);
819      }
820
821      @Override
822      public boolean equalsShallow(Base other_) {
823        if (!super.equalsShallow(other_))
824          return false;
825        if (!(other_ instanceof DeviceRequestParameterComponent))
826          return false;
827        DeviceRequestParameterComponent o = (DeviceRequestParameterComponent) other_;
828        return true;
829      }
830
831      public boolean isEmpty() {
832        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value);
833      }
834
835  public String fhirType() {
836    return "DeviceRequest.parameter";
837
838  }
839
840  }
841
842    /**
843     * Identifiers assigned to this order by the orderer or by the receiver.
844     */
845    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
846    @Description(shortDefinition="External Request identifier", formalDefinition="Identifiers assigned to this order by the orderer or by the receiver." )
847    protected List<Identifier> identifier;
848
849    /**
850     * The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.
851     */
852    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
853    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest." )
854    protected List<CanonicalType> instantiatesCanonical;
855
856    /**
857     * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.
858     */
859    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
860    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest." )
861    protected List<UriType> instantiatesUri;
862
863    /**
864     * Plan/proposal/order fulfilled by this request.
865     */
866    @Child(name = "basedOn", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
867    @Description(shortDefinition="What request fulfills", formalDefinition="Plan/proposal/order fulfilled by this request." )
868    protected List<Reference> basedOn;
869    /**
870     * The actual objects that are the target of the reference (Plan/proposal/order fulfilled by this request.)
871     */
872    protected List<Resource> basedOnTarget;
873
874
875    /**
876     * The request takes the place of the referenced completed or terminated request(s).
877     */
878    @Child(name = "priorRequest", type = {Reference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
879    @Description(shortDefinition="What request replaces", formalDefinition="The request takes the place of the referenced completed or terminated request(s)." )
880    protected List<Reference> priorRequest;
881    /**
882     * The actual objects that are the target of the reference (The request takes the place of the referenced completed or terminated request(s).)
883     */
884    protected List<Resource> priorRequestTarget;
885
886
887    /**
888     * Composite request this is part of.
889     */
890    @Child(name = "groupIdentifier", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true)
891    @Description(shortDefinition="Identifier of composite request", formalDefinition="Composite request this is part of." )
892    protected Identifier groupIdentifier;
893
894    /**
895     * The status of the request.
896     */
897    @Child(name = "status", type = {CodeType.class}, order=6, min=0, max=1, modifier=true, summary=true)
898    @Description(shortDefinition="draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition="The status of the request." )
899    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
900    protected Enumeration<DeviceRequestStatus> status;
901
902    /**
903     * Whether the request is a proposal, plan, an original order or a reflex order.
904     */
905    @Child(name = "intent", type = {CodeType.class}, order=7, min=1, max=1, modifier=true, summary=true)
906    @Description(shortDefinition="proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition="Whether the request is a proposal, plan, an original order or a reflex order." )
907    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-intent")
908    protected Enumeration<RequestIntent> intent;
909
910    /**
911     * Indicates how quickly the {{title}} should be addressed with respect to other requests.
912     */
913    @Child(name = "priority", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
914    @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the {{title}} should be addressed with respect to other requests." )
915    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
916    protected Enumeration<RequestPriority> priority;
917
918    /**
919     * The details of the device to be used.
920     */
921    @Child(name = "code", type = {Device.class, CodeableConcept.class}, order=9, min=1, max=1, modifier=false, summary=true)
922    @Description(shortDefinition="Device requested", formalDefinition="The details of the device to be used." )
923    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-kind")
924    protected Type code;
925
926    /**
927     * Specific parameters for the ordered item.  For example, the prism value for lenses.
928     */
929    @Child(name = "parameter", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
930    @Description(shortDefinition="Device details", formalDefinition="Specific parameters for the ordered item.  For example, the prism value for lenses." )
931    protected List<DeviceRequestParameterComponent> parameter;
932
933    /**
934     * The patient who will use the device.
935     */
936    @Child(name = "subject", type = {Patient.class, Group.class, Location.class, Device.class}, order=11, min=1, max=1, modifier=false, summary=true)
937    @Description(shortDefinition="Focus of request", formalDefinition="The patient who will use the device." )
938    protected Reference subject;
939
940    /**
941     * The actual object that is the target of the reference (The patient who will use the device.)
942     */
943    protected Resource subjectTarget;
944
945    /**
946     * An encounter that provides additional context in which this request is made.
947     */
948    @Child(name = "encounter", type = {Encounter.class}, order=12, min=0, max=1, modifier=false, summary=true)
949    @Description(shortDefinition="Encounter motivating request", formalDefinition="An encounter that provides additional context in which this request is made." )
950    protected Reference encounter;
951
952    /**
953     * The actual object that is the target of the reference (An encounter that provides additional context in which this request is made.)
954     */
955    protected Encounter encounterTarget;
956
957    /**
958     * The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".
959     */
960    @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=13, min=0, max=1, modifier=false, summary=true)
961    @Description(shortDefinition="Desired time or schedule for use", formalDefinition="The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\"." )
962    protected Type occurrence;
963
964    /**
965     * When the request transitioned to being actionable.
966     */
967    @Child(name = "authoredOn", type = {DateTimeType.class}, order=14, min=0, max=1, modifier=false, summary=true)
968    @Description(shortDefinition="When recorded", formalDefinition="When the request transitioned to being actionable." )
969    protected DateTimeType authoredOn;
970
971    /**
972     * The individual who initiated the request and has responsibility for its activation.
973     */
974    @Child(name = "requester", type = {Device.class, Practitioner.class, PractitionerRole.class, Organization.class}, order=15, min=0, max=1, modifier=false, summary=true)
975    @Description(shortDefinition="Who/what is requesting diagnostics", formalDefinition="The individual who initiated the request and has responsibility for its activation." )
976    protected Reference requester;
977
978    /**
979     * The actual object that is the target of the reference (The individual who initiated the request and has responsibility for its activation.)
980     */
981    protected Resource requesterTarget;
982
983    /**
984     * Desired type of performer for doing the diagnostic testing.
985     */
986    @Child(name = "performerType", type = {CodeableConcept.class}, order=16, min=0, max=1, modifier=false, summary=true)
987    @Description(shortDefinition="Filler role", formalDefinition="Desired type of performer for doing the diagnostic testing." )
988    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-role")
989    protected CodeableConcept performerType;
990
991    /**
992     * The desired performer for doing the diagnostic testing.
993     */
994    @Child(name = "performer", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, HealthcareService.class, Patient.class, Device.class, RelatedPerson.class}, order=17, min=0, max=1, modifier=false, summary=true)
995    @Description(shortDefinition="Requested Filler", formalDefinition="The desired performer for doing the diagnostic testing." )
996    protected Reference performer;
997
998    /**
999     * The actual object that is the target of the reference (The desired performer for doing the diagnostic testing.)
1000     */
1001    protected Resource performerTarget;
1002
1003    /**
1004     * Reason or justification for the use of this device.
1005     */
1006    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1007    @Description(shortDefinition="Coded Reason for request", formalDefinition="Reason or justification for the use of this device." )
1008    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
1009    protected List<CodeableConcept> reasonCode;
1010
1011    /**
1012     * Reason or justification for the use of this device.
1013     */
1014    @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1015    @Description(shortDefinition="Linked Reason for request", formalDefinition="Reason or justification for the use of this device." )
1016    protected List<Reference> reasonReference;
1017    /**
1018     * The actual objects that are the target of the reference (Reason or justification for the use of this device.)
1019     */
1020    protected List<Resource> reasonReferenceTarget;
1021
1022
1023    /**
1024     * Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.
1025     */
1026    @Child(name = "insurance", type = {Coverage.class, ClaimResponse.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1027    @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." )
1028    protected List<Reference> insurance;
1029    /**
1030     * The actual objects that are the target of the reference (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.)
1031     */
1032    protected List<Resource> insuranceTarget;
1033
1034
1035    /**
1036     * Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).
1037     */
1038    @Child(name = "supportingInfo", type = {Reference.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1039    @Description(shortDefinition="Additional clinical information", formalDefinition="Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site)." )
1040    protected List<Reference> supportingInfo;
1041    /**
1042     * The actual objects that are the target of the reference (Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).)
1043     */
1044    protected List<Resource> supportingInfoTarget;
1045
1046
1047    /**
1048     * Details about this request that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.
1049     */
1050    @Child(name = "note", type = {Annotation.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1051    @Description(shortDefinition="Notes or comments", formalDefinition="Details about this request that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement." )
1052    protected List<Annotation> note;
1053
1054    /**
1055     * Key events in the history of the request.
1056     */
1057    @Child(name = "relevantHistory", type = {Provenance.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1058    @Description(shortDefinition="Request provenance", formalDefinition="Key events in the history of the request." )
1059    protected List<Reference> relevantHistory;
1060    /**
1061     * The actual objects that are the target of the reference (Key events in the history of the request.)
1062     */
1063    protected List<Provenance> relevantHistoryTarget;
1064
1065
1066    private static final long serialVersionUID = 1484452423L;
1067
1068  /**
1069   * Constructor
1070   */
1071    public DeviceRequest() {
1072      super();
1073    }
1074
1075  /**
1076   * Constructor
1077   */
1078    public DeviceRequest(Enumeration<RequestIntent> intent, Type code, Reference subject) {
1079      super();
1080      this.intent = intent;
1081      this.code = code;
1082      this.subject = subject;
1083    }
1084
1085    /**
1086     * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.)
1087     */
1088    public List<Identifier> getIdentifier() { 
1089      if (this.identifier == null)
1090        this.identifier = new ArrayList<Identifier>();
1091      return this.identifier;
1092    }
1093
1094    /**
1095     * @return Returns a reference to <code>this</code> for easy method chaining
1096     */
1097    public DeviceRequest setIdentifier(List<Identifier> theIdentifier) { 
1098      this.identifier = theIdentifier;
1099      return this;
1100    }
1101
1102    public boolean hasIdentifier() { 
1103      if (this.identifier == null)
1104        return false;
1105      for (Identifier item : this.identifier)
1106        if (!item.isEmpty())
1107          return true;
1108      return false;
1109    }
1110
1111    public Identifier addIdentifier() { //3
1112      Identifier t = new Identifier();
1113      if (this.identifier == null)
1114        this.identifier = new ArrayList<Identifier>();
1115      this.identifier.add(t);
1116      return t;
1117    }
1118
1119    public DeviceRequest addIdentifier(Identifier t) { //3
1120      if (t == null)
1121        return this;
1122      if (this.identifier == null)
1123        this.identifier = new ArrayList<Identifier>();
1124      this.identifier.add(t);
1125      return this;
1126    }
1127
1128    /**
1129     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1130     */
1131    public Identifier getIdentifierFirstRep() { 
1132      if (getIdentifier().isEmpty()) {
1133        addIdentifier();
1134      }
1135      return getIdentifier().get(0);
1136    }
1137
1138    /**
1139     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1140     */
1141    public List<CanonicalType> getInstantiatesCanonical() { 
1142      if (this.instantiatesCanonical == null)
1143        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1144      return this.instantiatesCanonical;
1145    }
1146
1147    /**
1148     * @return Returns a reference to <code>this</code> for easy method chaining
1149     */
1150    public DeviceRequest setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
1151      this.instantiatesCanonical = theInstantiatesCanonical;
1152      return this;
1153    }
1154
1155    public boolean hasInstantiatesCanonical() { 
1156      if (this.instantiatesCanonical == null)
1157        return false;
1158      for (CanonicalType item : this.instantiatesCanonical)
1159        if (!item.isEmpty())
1160          return true;
1161      return false;
1162    }
1163
1164    /**
1165     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1166     */
1167    public CanonicalType addInstantiatesCanonicalElement() {//2 
1168      CanonicalType t = new CanonicalType();
1169      if (this.instantiatesCanonical == null)
1170        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1171      this.instantiatesCanonical.add(t);
1172      return t;
1173    }
1174
1175    /**
1176     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1177     */
1178    public DeviceRequest addInstantiatesCanonical(String value) { //1
1179      CanonicalType t = new CanonicalType();
1180      t.setValue(value);
1181      if (this.instantiatesCanonical == null)
1182        this.instantiatesCanonical = new ArrayList<CanonicalType>();
1183      this.instantiatesCanonical.add(t);
1184      return this;
1185    }
1186
1187    /**
1188     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1189     */
1190    public boolean hasInstantiatesCanonical(String value) { 
1191      if (this.instantiatesCanonical == null)
1192        return false;
1193      for (CanonicalType v : this.instantiatesCanonical)
1194        if (v.getValue().equals(value)) // canonical(ActivityDefinition|PlanDefinition)
1195          return true;
1196      return false;
1197    }
1198
1199    /**
1200     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1201     */
1202    public List<UriType> getInstantiatesUri() { 
1203      if (this.instantiatesUri == null)
1204        this.instantiatesUri = new ArrayList<UriType>();
1205      return this.instantiatesUri;
1206    }
1207
1208    /**
1209     * @return Returns a reference to <code>this</code> for easy method chaining
1210     */
1211    public DeviceRequest setInstantiatesUri(List<UriType> theInstantiatesUri) { 
1212      this.instantiatesUri = theInstantiatesUri;
1213      return this;
1214    }
1215
1216    public boolean hasInstantiatesUri() { 
1217      if (this.instantiatesUri == null)
1218        return false;
1219      for (UriType item : this.instantiatesUri)
1220        if (!item.isEmpty())
1221          return true;
1222      return false;
1223    }
1224
1225    /**
1226     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1227     */
1228    public UriType addInstantiatesUriElement() {//2 
1229      UriType t = new UriType();
1230      if (this.instantiatesUri == null)
1231        this.instantiatesUri = new ArrayList<UriType>();
1232      this.instantiatesUri.add(t);
1233      return t;
1234    }
1235
1236    /**
1237     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1238     */
1239    public DeviceRequest addInstantiatesUri(String value) { //1
1240      UriType t = new UriType();
1241      t.setValue(value);
1242      if (this.instantiatesUri == null)
1243        this.instantiatesUri = new ArrayList<UriType>();
1244      this.instantiatesUri.add(t);
1245      return this;
1246    }
1247
1248    /**
1249     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.)
1250     */
1251    public boolean hasInstantiatesUri(String value) { 
1252      if (this.instantiatesUri == null)
1253        return false;
1254      for (UriType v : this.instantiatesUri)
1255        if (v.getValue().equals(value)) // uri
1256          return true;
1257      return false;
1258    }
1259
1260    /**
1261     * @return {@link #basedOn} (Plan/proposal/order fulfilled by this request.)
1262     */
1263    public List<Reference> getBasedOn() { 
1264      if (this.basedOn == null)
1265        this.basedOn = new ArrayList<Reference>();
1266      return this.basedOn;
1267    }
1268
1269    /**
1270     * @return Returns a reference to <code>this</code> for easy method chaining
1271     */
1272    public DeviceRequest setBasedOn(List<Reference> theBasedOn) { 
1273      this.basedOn = theBasedOn;
1274      return this;
1275    }
1276
1277    public boolean hasBasedOn() { 
1278      if (this.basedOn == null)
1279        return false;
1280      for (Reference item : this.basedOn)
1281        if (!item.isEmpty())
1282          return true;
1283      return false;
1284    }
1285
1286    public Reference addBasedOn() { //3
1287      Reference t = new Reference();
1288      if (this.basedOn == null)
1289        this.basedOn = new ArrayList<Reference>();
1290      this.basedOn.add(t);
1291      return t;
1292    }
1293
1294    public DeviceRequest addBasedOn(Reference t) { //3
1295      if (t == null)
1296        return this;
1297      if (this.basedOn == null)
1298        this.basedOn = new ArrayList<Reference>();
1299      this.basedOn.add(t);
1300      return this;
1301    }
1302
1303    /**
1304     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
1305     */
1306    public Reference getBasedOnFirstRep() { 
1307      if (getBasedOn().isEmpty()) {
1308        addBasedOn();
1309      }
1310      return getBasedOn().get(0);
1311    }
1312
1313    /**
1314     * @deprecated Use Reference#setResource(IBaseResource) instead
1315     */
1316    @Deprecated
1317    public List<Resource> getBasedOnTarget() { 
1318      if (this.basedOnTarget == null)
1319        this.basedOnTarget = new ArrayList<Resource>();
1320      return this.basedOnTarget;
1321    }
1322
1323    /**
1324     * @return {@link #priorRequest} (The request takes the place of the referenced completed or terminated request(s).)
1325     */
1326    public List<Reference> getPriorRequest() { 
1327      if (this.priorRequest == null)
1328        this.priorRequest = new ArrayList<Reference>();
1329      return this.priorRequest;
1330    }
1331
1332    /**
1333     * @return Returns a reference to <code>this</code> for easy method chaining
1334     */
1335    public DeviceRequest setPriorRequest(List<Reference> thePriorRequest) { 
1336      this.priorRequest = thePriorRequest;
1337      return this;
1338    }
1339
1340    public boolean hasPriorRequest() { 
1341      if (this.priorRequest == null)
1342        return false;
1343      for (Reference item : this.priorRequest)
1344        if (!item.isEmpty())
1345          return true;
1346      return false;
1347    }
1348
1349    public Reference addPriorRequest() { //3
1350      Reference t = new Reference();
1351      if (this.priorRequest == null)
1352        this.priorRequest = new ArrayList<Reference>();
1353      this.priorRequest.add(t);
1354      return t;
1355    }
1356
1357    public DeviceRequest addPriorRequest(Reference t) { //3
1358      if (t == null)
1359        return this;
1360      if (this.priorRequest == null)
1361        this.priorRequest = new ArrayList<Reference>();
1362      this.priorRequest.add(t);
1363      return this;
1364    }
1365
1366    /**
1367     * @return The first repetition of repeating field {@link #priorRequest}, creating it if it does not already exist
1368     */
1369    public Reference getPriorRequestFirstRep() { 
1370      if (getPriorRequest().isEmpty()) {
1371        addPriorRequest();
1372      }
1373      return getPriorRequest().get(0);
1374    }
1375
1376    /**
1377     * @deprecated Use Reference#setResource(IBaseResource) instead
1378     */
1379    @Deprecated
1380    public List<Resource> getPriorRequestTarget() { 
1381      if (this.priorRequestTarget == null)
1382        this.priorRequestTarget = new ArrayList<Resource>();
1383      return this.priorRequestTarget;
1384    }
1385
1386    /**
1387     * @return {@link #groupIdentifier} (Composite request this is part of.)
1388     */
1389    public Identifier getGroupIdentifier() { 
1390      if (this.groupIdentifier == null)
1391        if (Configuration.errorOnAutoCreate())
1392          throw new Error("Attempt to auto-create DeviceRequest.groupIdentifier");
1393        else if (Configuration.doAutoCreate())
1394          this.groupIdentifier = new Identifier(); // cc
1395      return this.groupIdentifier;
1396    }
1397
1398    public boolean hasGroupIdentifier() { 
1399      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
1400    }
1401
1402    /**
1403     * @param value {@link #groupIdentifier} (Composite request this is part of.)
1404     */
1405    public DeviceRequest setGroupIdentifier(Identifier value) { 
1406      this.groupIdentifier = value;
1407      return this;
1408    }
1409
1410    /**
1411     * @return {@link #status} (The status of the request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1412     */
1413    public Enumeration<DeviceRequestStatus> getStatusElement() { 
1414      if (this.status == null)
1415        if (Configuration.errorOnAutoCreate())
1416          throw new Error("Attempt to auto-create DeviceRequest.status");
1417        else if (Configuration.doAutoCreate())
1418          this.status = new Enumeration<DeviceRequestStatus>(new DeviceRequestStatusEnumFactory()); // bb
1419      return this.status;
1420    }
1421
1422    public boolean hasStatusElement() { 
1423      return this.status != null && !this.status.isEmpty();
1424    }
1425
1426    public boolean hasStatus() { 
1427      return this.status != null && !this.status.isEmpty();
1428    }
1429
1430    /**
1431     * @param value {@link #status} (The status of the request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1432     */
1433    public DeviceRequest setStatusElement(Enumeration<DeviceRequestStatus> value) { 
1434      this.status = value;
1435      return this;
1436    }
1437
1438    /**
1439     * @return The status of the request.
1440     */
1441    public DeviceRequestStatus getStatus() { 
1442      return this.status == null ? null : this.status.getValue();
1443    }
1444
1445    /**
1446     * @param value The status of the request.
1447     */
1448    public DeviceRequest setStatus(DeviceRequestStatus value) { 
1449      if (value == null)
1450        this.status = null;
1451      else {
1452        if (this.status == null)
1453          this.status = new Enumeration<DeviceRequestStatus>(new DeviceRequestStatusEnumFactory());
1454        this.status.setValue(value);
1455      }
1456      return this;
1457    }
1458
1459    /**
1460     * @return {@link #intent} (Whether the request is a proposal, plan, an original order or a reflex order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
1461     */
1462    public Enumeration<RequestIntent> getIntentElement() { 
1463      if (this.intent == null)
1464        if (Configuration.errorOnAutoCreate())
1465          throw new Error("Attempt to auto-create DeviceRequest.intent");
1466        else if (Configuration.doAutoCreate())
1467          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory()); // bb
1468      return this.intent;
1469    }
1470
1471    public boolean hasIntentElement() { 
1472      return this.intent != null && !this.intent.isEmpty();
1473    }
1474
1475    public boolean hasIntent() { 
1476      return this.intent != null && !this.intent.isEmpty();
1477    }
1478
1479    /**
1480     * @param value {@link #intent} (Whether the request is a proposal, plan, an original order or a reflex order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
1481     */
1482    public DeviceRequest setIntentElement(Enumeration<RequestIntent> value) { 
1483      this.intent = value;
1484      return this;
1485    }
1486
1487    /**
1488     * @return Whether the request is a proposal, plan, an original order or a reflex order.
1489     */
1490    public RequestIntent getIntent() { 
1491      return this.intent == null ? null : this.intent.getValue();
1492    }
1493
1494    /**
1495     * @param value Whether the request is a proposal, plan, an original order or a reflex order.
1496     */
1497    public DeviceRequest setIntent(RequestIntent value) { 
1498        if (this.intent == null)
1499          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory());
1500        this.intent.setValue(value);
1501      return this;
1502    }
1503
1504    /**
1505     * @return {@link #priority} (Indicates how quickly the {{title}} 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
1506     */
1507    public Enumeration<RequestPriority> getPriorityElement() { 
1508      if (this.priority == null)
1509        if (Configuration.errorOnAutoCreate())
1510          throw new Error("Attempt to auto-create DeviceRequest.priority");
1511        else if (Configuration.doAutoCreate())
1512          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
1513      return this.priority;
1514    }
1515
1516    public boolean hasPriorityElement() { 
1517      return this.priority != null && !this.priority.isEmpty();
1518    }
1519
1520    public boolean hasPriority() { 
1521      return this.priority != null && !this.priority.isEmpty();
1522    }
1523
1524    /**
1525     * @param value {@link #priority} (Indicates how quickly the {{title}} 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
1526     */
1527    public DeviceRequest setPriorityElement(Enumeration<RequestPriority> value) { 
1528      this.priority = value;
1529      return this;
1530    }
1531
1532    /**
1533     * @return Indicates how quickly the {{title}} should be addressed with respect to other requests.
1534     */
1535    public RequestPriority getPriority() { 
1536      return this.priority == null ? null : this.priority.getValue();
1537    }
1538
1539    /**
1540     * @param value Indicates how quickly the {{title}} should be addressed with respect to other requests.
1541     */
1542    public DeviceRequest setPriority(RequestPriority value) { 
1543      if (value == null)
1544        this.priority = null;
1545      else {
1546        if (this.priority == null)
1547          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
1548        this.priority.setValue(value);
1549      }
1550      return this;
1551    }
1552
1553    /**
1554     * @return {@link #code} (The details of the device to be used.)
1555     */
1556    public Type getCode() { 
1557      return this.code;
1558    }
1559
1560    /**
1561     * @return {@link #code} (The details of the device to be used.)
1562     */
1563    public Reference getCodeReference() throws FHIRException { 
1564      if (this.code == null)
1565        this.code = new Reference();
1566      if (!(this.code instanceof Reference))
1567        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.code.getClass().getName()+" was encountered");
1568      return (Reference) this.code;
1569    }
1570
1571    public boolean hasCodeReference() { 
1572      return this != null && this.code instanceof Reference;
1573    }
1574
1575    /**
1576     * @return {@link #code} (The details of the device to be used.)
1577     */
1578    public CodeableConcept getCodeCodeableConcept() throws FHIRException { 
1579      if (this.code == null)
1580        this.code = new CodeableConcept();
1581      if (!(this.code instanceof CodeableConcept))
1582        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.code.getClass().getName()+" was encountered");
1583      return (CodeableConcept) this.code;
1584    }
1585
1586    public boolean hasCodeCodeableConcept() { 
1587      return this != null && this.code instanceof CodeableConcept;
1588    }
1589
1590    public boolean hasCode() { 
1591      return this.code != null && !this.code.isEmpty();
1592    }
1593
1594    /**
1595     * @param value {@link #code} (The details of the device to be used.)
1596     */
1597    public DeviceRequest setCode(Type value) { 
1598      if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
1599        throw new Error("Not the right type for DeviceRequest.code[x]: "+value.fhirType());
1600      this.code = value;
1601      return this;
1602    }
1603
1604    /**
1605     * @return {@link #parameter} (Specific parameters for the ordered item.  For example, the prism value for lenses.)
1606     */
1607    public List<DeviceRequestParameterComponent> getParameter() { 
1608      if (this.parameter == null)
1609        this.parameter = new ArrayList<DeviceRequestParameterComponent>();
1610      return this.parameter;
1611    }
1612
1613    /**
1614     * @return Returns a reference to <code>this</code> for easy method chaining
1615     */
1616    public DeviceRequest setParameter(List<DeviceRequestParameterComponent> theParameter) { 
1617      this.parameter = theParameter;
1618      return this;
1619    }
1620
1621    public boolean hasParameter() { 
1622      if (this.parameter == null)
1623        return false;
1624      for (DeviceRequestParameterComponent item : this.parameter)
1625        if (!item.isEmpty())
1626          return true;
1627      return false;
1628    }
1629
1630    public DeviceRequestParameterComponent addParameter() { //3
1631      DeviceRequestParameterComponent t = new DeviceRequestParameterComponent();
1632      if (this.parameter == null)
1633        this.parameter = new ArrayList<DeviceRequestParameterComponent>();
1634      this.parameter.add(t);
1635      return t;
1636    }
1637
1638    public DeviceRequest addParameter(DeviceRequestParameterComponent t) { //3
1639      if (t == null)
1640        return this;
1641      if (this.parameter == null)
1642        this.parameter = new ArrayList<DeviceRequestParameterComponent>();
1643      this.parameter.add(t);
1644      return this;
1645    }
1646
1647    /**
1648     * @return The first repetition of repeating field {@link #parameter}, creating it if it does not already exist
1649     */
1650    public DeviceRequestParameterComponent getParameterFirstRep() { 
1651      if (getParameter().isEmpty()) {
1652        addParameter();
1653      }
1654      return getParameter().get(0);
1655    }
1656
1657    /**
1658     * @return {@link #subject} (The patient who will use the device.)
1659     */
1660    public Reference getSubject() { 
1661      if (this.subject == null)
1662        if (Configuration.errorOnAutoCreate())
1663          throw new Error("Attempt to auto-create DeviceRequest.subject");
1664        else if (Configuration.doAutoCreate())
1665          this.subject = new Reference(); // cc
1666      return this.subject;
1667    }
1668
1669    public boolean hasSubject() { 
1670      return this.subject != null && !this.subject.isEmpty();
1671    }
1672
1673    /**
1674     * @param value {@link #subject} (The patient who will use the device.)
1675     */
1676    public DeviceRequest setSubject(Reference value) { 
1677      this.subject = value;
1678      return this;
1679    }
1680
1681    /**
1682     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient who will use the device.)
1683     */
1684    public Resource getSubjectTarget() { 
1685      return this.subjectTarget;
1686    }
1687
1688    /**
1689     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient who will use the device.)
1690     */
1691    public DeviceRequest setSubjectTarget(Resource value) { 
1692      this.subjectTarget = value;
1693      return this;
1694    }
1695
1696    /**
1697     * @return {@link #encounter} (An encounter that provides additional context in which this request is made.)
1698     */
1699    public Reference getEncounter() { 
1700      if (this.encounter == null)
1701        if (Configuration.errorOnAutoCreate())
1702          throw new Error("Attempt to auto-create DeviceRequest.encounter");
1703        else if (Configuration.doAutoCreate())
1704          this.encounter = new Reference(); // cc
1705      return this.encounter;
1706    }
1707
1708    public boolean hasEncounter() { 
1709      return this.encounter != null && !this.encounter.isEmpty();
1710    }
1711
1712    /**
1713     * @param value {@link #encounter} (An encounter that provides additional context in which this request is made.)
1714     */
1715    public DeviceRequest setEncounter(Reference value) { 
1716      this.encounter = value;
1717      return this;
1718    }
1719
1720    /**
1721     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (An encounter that provides additional context in which this request is made.)
1722     */
1723    public Encounter getEncounterTarget() { 
1724      if (this.encounterTarget == null)
1725        if (Configuration.errorOnAutoCreate())
1726          throw new Error("Attempt to auto-create DeviceRequest.encounter");
1727        else if (Configuration.doAutoCreate())
1728          this.encounterTarget = new Encounter(); // aa
1729      return this.encounterTarget;
1730    }
1731
1732    /**
1733     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (An encounter that provides additional context in which this request is made.)
1734     */
1735    public DeviceRequest setEncounterTarget(Encounter value) { 
1736      this.encounterTarget = value;
1737      return this;
1738    }
1739
1740    /**
1741     * @return {@link #occurrence} (The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".)
1742     */
1743    public Type getOccurrence() { 
1744      return this.occurrence;
1745    }
1746
1747    /**
1748     * @return {@link #occurrence} (The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".)
1749     */
1750    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1751      if (this.occurrence == null)
1752        this.occurrence = new DateTimeType();
1753      if (!(this.occurrence instanceof DateTimeType))
1754        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1755      return (DateTimeType) this.occurrence;
1756    }
1757
1758    public boolean hasOccurrenceDateTimeType() { 
1759      return this != null && this.occurrence instanceof DateTimeType;
1760    }
1761
1762    /**
1763     * @return {@link #occurrence} (The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".)
1764     */
1765    public Period getOccurrencePeriod() throws FHIRException { 
1766      if (this.occurrence == null)
1767        this.occurrence = new Period();
1768      if (!(this.occurrence instanceof Period))
1769        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1770      return (Period) this.occurrence;
1771    }
1772
1773    public boolean hasOccurrencePeriod() { 
1774      return this != null && this.occurrence instanceof Period;
1775    }
1776
1777    /**
1778     * @return {@link #occurrence} (The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".)
1779     */
1780    public Timing getOccurrenceTiming() throws FHIRException { 
1781      if (this.occurrence == null)
1782        this.occurrence = new Timing();
1783      if (!(this.occurrence instanceof Timing))
1784        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1785      return (Timing) this.occurrence;
1786    }
1787
1788    public boolean hasOccurrenceTiming() { 
1789      return this != null && this.occurrence instanceof Timing;
1790    }
1791
1792    public boolean hasOccurrence() { 
1793      return this.occurrence != null && !this.occurrence.isEmpty();
1794    }
1795
1796    /**
1797     * @param value {@link #occurrence} (The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".)
1798     */
1799    public DeviceRequest setOccurrence(Type value) { 
1800      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
1801        throw new Error("Not the right type for DeviceRequest.occurrence[x]: "+value.fhirType());
1802      this.occurrence = value;
1803      return this;
1804    }
1805
1806    /**
1807     * @return {@link #authoredOn} (When the request transitioned to being actionable.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
1808     */
1809    public DateTimeType getAuthoredOnElement() { 
1810      if (this.authoredOn == null)
1811        if (Configuration.errorOnAutoCreate())
1812          throw new Error("Attempt to auto-create DeviceRequest.authoredOn");
1813        else if (Configuration.doAutoCreate())
1814          this.authoredOn = new DateTimeType(); // bb
1815      return this.authoredOn;
1816    }
1817
1818    public boolean hasAuthoredOnElement() { 
1819      return this.authoredOn != null && !this.authoredOn.isEmpty();
1820    }
1821
1822    public boolean hasAuthoredOn() { 
1823      return this.authoredOn != null && !this.authoredOn.isEmpty();
1824    }
1825
1826    /**
1827     * @param value {@link #authoredOn} (When the request transitioned to being actionable.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
1828     */
1829    public DeviceRequest setAuthoredOnElement(DateTimeType value) { 
1830      this.authoredOn = value;
1831      return this;
1832    }
1833
1834    /**
1835     * @return When the request transitioned to being actionable.
1836     */
1837    public Date getAuthoredOn() { 
1838      return this.authoredOn == null ? null : this.authoredOn.getValue();
1839    }
1840
1841    /**
1842     * @param value When the request transitioned to being actionable.
1843     */
1844    public DeviceRequest setAuthoredOn(Date value) { 
1845      if (value == null)
1846        this.authoredOn = null;
1847      else {
1848        if (this.authoredOn == null)
1849          this.authoredOn = new DateTimeType();
1850        this.authoredOn.setValue(value);
1851      }
1852      return this;
1853    }
1854
1855    /**
1856     * @return {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1857     */
1858    public Reference getRequester() { 
1859      if (this.requester == null)
1860        if (Configuration.errorOnAutoCreate())
1861          throw new Error("Attempt to auto-create DeviceRequest.requester");
1862        else if (Configuration.doAutoCreate())
1863          this.requester = new Reference(); // cc
1864      return this.requester;
1865    }
1866
1867    public boolean hasRequester() { 
1868      return this.requester != null && !this.requester.isEmpty();
1869    }
1870
1871    /**
1872     * @param value {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1873     */
1874    public DeviceRequest setRequester(Reference value) { 
1875      this.requester = value;
1876      return this;
1877    }
1878
1879    /**
1880     * @return {@link #requester} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The individual who initiated the request and has responsibility for its activation.)
1881     */
1882    public Resource getRequesterTarget() { 
1883      return this.requesterTarget;
1884    }
1885
1886    /**
1887     * @param value {@link #requester} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The individual who initiated the request and has responsibility for its activation.)
1888     */
1889    public DeviceRequest setRequesterTarget(Resource value) { 
1890      this.requesterTarget = value;
1891      return this;
1892    }
1893
1894    /**
1895     * @return {@link #performerType} (Desired type of performer for doing the diagnostic testing.)
1896     */
1897    public CodeableConcept getPerformerType() { 
1898      if (this.performerType == null)
1899        if (Configuration.errorOnAutoCreate())
1900          throw new Error("Attempt to auto-create DeviceRequest.performerType");
1901        else if (Configuration.doAutoCreate())
1902          this.performerType = new CodeableConcept(); // cc
1903      return this.performerType;
1904    }
1905
1906    public boolean hasPerformerType() { 
1907      return this.performerType != null && !this.performerType.isEmpty();
1908    }
1909
1910    /**
1911     * @param value {@link #performerType} (Desired type of performer for doing the diagnostic testing.)
1912     */
1913    public DeviceRequest setPerformerType(CodeableConcept value) { 
1914      this.performerType = value;
1915      return this;
1916    }
1917
1918    /**
1919     * @return {@link #performer} (The desired performer for doing the diagnostic testing.)
1920     */
1921    public Reference getPerformer() { 
1922      if (this.performer == null)
1923        if (Configuration.errorOnAutoCreate())
1924          throw new Error("Attempt to auto-create DeviceRequest.performer");
1925        else if (Configuration.doAutoCreate())
1926          this.performer = new Reference(); // cc
1927      return this.performer;
1928    }
1929
1930    public boolean hasPerformer() { 
1931      return this.performer != null && !this.performer.isEmpty();
1932    }
1933
1934    /**
1935     * @param value {@link #performer} (The desired performer for doing the diagnostic testing.)
1936     */
1937    public DeviceRequest setPerformer(Reference value) { 
1938      this.performer = value;
1939      return this;
1940    }
1941
1942    /**
1943     * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The desired performer for doing the diagnostic testing.)
1944     */
1945    public Resource getPerformerTarget() { 
1946      return this.performerTarget;
1947    }
1948
1949    /**
1950     * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The desired performer for doing the diagnostic testing.)
1951     */
1952    public DeviceRequest setPerformerTarget(Resource value) { 
1953      this.performerTarget = value;
1954      return this;
1955    }
1956
1957    /**
1958     * @return {@link #reasonCode} (Reason or justification for the use of this device.)
1959     */
1960    public List<CodeableConcept> getReasonCode() { 
1961      if (this.reasonCode == null)
1962        this.reasonCode = new ArrayList<CodeableConcept>();
1963      return this.reasonCode;
1964    }
1965
1966    /**
1967     * @return Returns a reference to <code>this</code> for easy method chaining
1968     */
1969    public DeviceRequest setReasonCode(List<CodeableConcept> theReasonCode) { 
1970      this.reasonCode = theReasonCode;
1971      return this;
1972    }
1973
1974    public boolean hasReasonCode() { 
1975      if (this.reasonCode == null)
1976        return false;
1977      for (CodeableConcept item : this.reasonCode)
1978        if (!item.isEmpty())
1979          return true;
1980      return false;
1981    }
1982
1983    public CodeableConcept addReasonCode() { //3
1984      CodeableConcept t = new CodeableConcept();
1985      if (this.reasonCode == null)
1986        this.reasonCode = new ArrayList<CodeableConcept>();
1987      this.reasonCode.add(t);
1988      return t;
1989    }
1990
1991    public DeviceRequest addReasonCode(CodeableConcept t) { //3
1992      if (t == null)
1993        return this;
1994      if (this.reasonCode == null)
1995        this.reasonCode = new ArrayList<CodeableConcept>();
1996      this.reasonCode.add(t);
1997      return this;
1998    }
1999
2000    /**
2001     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
2002     */
2003    public CodeableConcept getReasonCodeFirstRep() { 
2004      if (getReasonCode().isEmpty()) {
2005        addReasonCode();
2006      }
2007      return getReasonCode().get(0);
2008    }
2009
2010    /**
2011     * @return {@link #reasonReference} (Reason or justification for the use of this device.)
2012     */
2013    public List<Reference> getReasonReference() { 
2014      if (this.reasonReference == null)
2015        this.reasonReference = new ArrayList<Reference>();
2016      return this.reasonReference;
2017    }
2018
2019    /**
2020     * @return Returns a reference to <code>this</code> for easy method chaining
2021     */
2022    public DeviceRequest setReasonReference(List<Reference> theReasonReference) { 
2023      this.reasonReference = theReasonReference;
2024      return this;
2025    }
2026
2027    public boolean hasReasonReference() { 
2028      if (this.reasonReference == null)
2029        return false;
2030      for (Reference item : this.reasonReference)
2031        if (!item.isEmpty())
2032          return true;
2033      return false;
2034    }
2035
2036    public Reference addReasonReference() { //3
2037      Reference t = new Reference();
2038      if (this.reasonReference == null)
2039        this.reasonReference = new ArrayList<Reference>();
2040      this.reasonReference.add(t);
2041      return t;
2042    }
2043
2044    public DeviceRequest addReasonReference(Reference t) { //3
2045      if (t == null)
2046        return this;
2047      if (this.reasonReference == null)
2048        this.reasonReference = new ArrayList<Reference>();
2049      this.reasonReference.add(t);
2050      return this;
2051    }
2052
2053    /**
2054     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
2055     */
2056    public Reference getReasonReferenceFirstRep() { 
2057      if (getReasonReference().isEmpty()) {
2058        addReasonReference();
2059      }
2060      return getReasonReference().get(0);
2061    }
2062
2063    /**
2064     * @deprecated Use Reference#setResource(IBaseResource) instead
2065     */
2066    @Deprecated
2067    public List<Resource> getReasonReferenceTarget() { 
2068      if (this.reasonReferenceTarget == null)
2069        this.reasonReferenceTarget = new ArrayList<Resource>();
2070      return this.reasonReferenceTarget;
2071    }
2072
2073    /**
2074     * @return {@link #insurance} (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.)
2075     */
2076    public List<Reference> getInsurance() { 
2077      if (this.insurance == null)
2078        this.insurance = new ArrayList<Reference>();
2079      return this.insurance;
2080    }
2081
2082    /**
2083     * @return Returns a reference to <code>this</code> for easy method chaining
2084     */
2085    public DeviceRequest setInsurance(List<Reference> theInsurance) { 
2086      this.insurance = theInsurance;
2087      return this;
2088    }
2089
2090    public boolean hasInsurance() { 
2091      if (this.insurance == null)
2092        return false;
2093      for (Reference item : this.insurance)
2094        if (!item.isEmpty())
2095          return true;
2096      return false;
2097    }
2098
2099    public Reference addInsurance() { //3
2100      Reference t = new Reference();
2101      if (this.insurance == null)
2102        this.insurance = new ArrayList<Reference>();
2103      this.insurance.add(t);
2104      return t;
2105    }
2106
2107    public DeviceRequest addInsurance(Reference t) { //3
2108      if (t == null)
2109        return this;
2110      if (this.insurance == null)
2111        this.insurance = new ArrayList<Reference>();
2112      this.insurance.add(t);
2113      return this;
2114    }
2115
2116    /**
2117     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
2118     */
2119    public Reference getInsuranceFirstRep() { 
2120      if (getInsurance().isEmpty()) {
2121        addInsurance();
2122      }
2123      return getInsurance().get(0);
2124    }
2125
2126    /**
2127     * @deprecated Use Reference#setResource(IBaseResource) instead
2128     */
2129    @Deprecated
2130    public List<Resource> getInsuranceTarget() { 
2131      if (this.insuranceTarget == null)
2132        this.insuranceTarget = new ArrayList<Resource>();
2133      return this.insuranceTarget;
2134    }
2135
2136    /**
2137     * @return {@link #supportingInfo} (Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).)
2138     */
2139    public List<Reference> getSupportingInfo() { 
2140      if (this.supportingInfo == null)
2141        this.supportingInfo = new ArrayList<Reference>();
2142      return this.supportingInfo;
2143    }
2144
2145    /**
2146     * @return Returns a reference to <code>this</code> for easy method chaining
2147     */
2148    public DeviceRequest setSupportingInfo(List<Reference> theSupportingInfo) { 
2149      this.supportingInfo = theSupportingInfo;
2150      return this;
2151    }
2152
2153    public boolean hasSupportingInfo() { 
2154      if (this.supportingInfo == null)
2155        return false;
2156      for (Reference item : this.supportingInfo)
2157        if (!item.isEmpty())
2158          return true;
2159      return false;
2160    }
2161
2162    public Reference addSupportingInfo() { //3
2163      Reference t = new Reference();
2164      if (this.supportingInfo == null)
2165        this.supportingInfo = new ArrayList<Reference>();
2166      this.supportingInfo.add(t);
2167      return t;
2168    }
2169
2170    public DeviceRequest addSupportingInfo(Reference t) { //3
2171      if (t == null)
2172        return this;
2173      if (this.supportingInfo == null)
2174        this.supportingInfo = new ArrayList<Reference>();
2175      this.supportingInfo.add(t);
2176      return this;
2177    }
2178
2179    /**
2180     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
2181     */
2182    public Reference getSupportingInfoFirstRep() { 
2183      if (getSupportingInfo().isEmpty()) {
2184        addSupportingInfo();
2185      }
2186      return getSupportingInfo().get(0);
2187    }
2188
2189    /**
2190     * @deprecated Use Reference#setResource(IBaseResource) instead
2191     */
2192    @Deprecated
2193    public List<Resource> getSupportingInfoTarget() { 
2194      if (this.supportingInfoTarget == null)
2195        this.supportingInfoTarget = new ArrayList<Resource>();
2196      return this.supportingInfoTarget;
2197    }
2198
2199    /**
2200     * @return {@link #note} (Details about this request that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.)
2201     */
2202    public List<Annotation> getNote() { 
2203      if (this.note == null)
2204        this.note = new ArrayList<Annotation>();
2205      return this.note;
2206    }
2207
2208    /**
2209     * @return Returns a reference to <code>this</code> for easy method chaining
2210     */
2211    public DeviceRequest setNote(List<Annotation> theNote) { 
2212      this.note = theNote;
2213      return this;
2214    }
2215
2216    public boolean hasNote() { 
2217      if (this.note == null)
2218        return false;
2219      for (Annotation item : this.note)
2220        if (!item.isEmpty())
2221          return true;
2222      return false;
2223    }
2224
2225    public Annotation addNote() { //3
2226      Annotation t = new Annotation();
2227      if (this.note == null)
2228        this.note = new ArrayList<Annotation>();
2229      this.note.add(t);
2230      return t;
2231    }
2232
2233    public DeviceRequest addNote(Annotation t) { //3
2234      if (t == null)
2235        return this;
2236      if (this.note == null)
2237        this.note = new ArrayList<Annotation>();
2238      this.note.add(t);
2239      return this;
2240    }
2241
2242    /**
2243     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2244     */
2245    public Annotation getNoteFirstRep() { 
2246      if (getNote().isEmpty()) {
2247        addNote();
2248      }
2249      return getNote().get(0);
2250    }
2251
2252    /**
2253     * @return {@link #relevantHistory} (Key events in the history of the request.)
2254     */
2255    public List<Reference> getRelevantHistory() { 
2256      if (this.relevantHistory == null)
2257        this.relevantHistory = new ArrayList<Reference>();
2258      return this.relevantHistory;
2259    }
2260
2261    /**
2262     * @return Returns a reference to <code>this</code> for easy method chaining
2263     */
2264    public DeviceRequest setRelevantHistory(List<Reference> theRelevantHistory) { 
2265      this.relevantHistory = theRelevantHistory;
2266      return this;
2267    }
2268
2269    public boolean hasRelevantHistory() { 
2270      if (this.relevantHistory == null)
2271        return false;
2272      for (Reference item : this.relevantHistory)
2273        if (!item.isEmpty())
2274          return true;
2275      return false;
2276    }
2277
2278    public Reference addRelevantHistory() { //3
2279      Reference t = new Reference();
2280      if (this.relevantHistory == null)
2281        this.relevantHistory = new ArrayList<Reference>();
2282      this.relevantHistory.add(t);
2283      return t;
2284    }
2285
2286    public DeviceRequest addRelevantHistory(Reference t) { //3
2287      if (t == null)
2288        return this;
2289      if (this.relevantHistory == null)
2290        this.relevantHistory = new ArrayList<Reference>();
2291      this.relevantHistory.add(t);
2292      return this;
2293    }
2294
2295    /**
2296     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist
2297     */
2298    public Reference getRelevantHistoryFirstRep() { 
2299      if (getRelevantHistory().isEmpty()) {
2300        addRelevantHistory();
2301      }
2302      return getRelevantHistory().get(0);
2303    }
2304
2305    /**
2306     * @deprecated Use Reference#setResource(IBaseResource) instead
2307     */
2308    @Deprecated
2309    public List<Provenance> getRelevantHistoryTarget() { 
2310      if (this.relevantHistoryTarget == null)
2311        this.relevantHistoryTarget = new ArrayList<Provenance>();
2312      return this.relevantHistoryTarget;
2313    }
2314
2315    /**
2316     * @deprecated Use Reference#setResource(IBaseResource) instead
2317     */
2318    @Deprecated
2319    public Provenance addRelevantHistoryTarget() { 
2320      Provenance r = new Provenance();
2321      if (this.relevantHistoryTarget == null)
2322        this.relevantHistoryTarget = new ArrayList<Provenance>();
2323      this.relevantHistoryTarget.add(r);
2324      return r;
2325    }
2326
2327      protected void listChildren(List<Property> children) {
2328        super.listChildren(children);
2329        children.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
2330        children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2331        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2332        children.add(new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn));
2333        children.add(new Property("priorRequest", "Reference(Any)", "The request takes the place of the referenced completed or terminated request(s).", 0, java.lang.Integer.MAX_VALUE, priorRequest));
2334        children.add(new Property("groupIdentifier", "Identifier", "Composite request this is part of.", 0, 1, groupIdentifier));
2335        children.add(new Property("status", "code", "The status of the request.", 0, 1, status));
2336        children.add(new Property("intent", "code", "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent));
2337        children.add(new Property("priority", "code", "Indicates how quickly the {{title}} should be addressed with respect to other requests.", 0, 1, priority));
2338        children.add(new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.", 0, 1, code));
2339        children.add(new Property("parameter", "", "Specific parameters for the ordered item.  For example, the prism value for lenses.", 0, java.lang.Integer.MAX_VALUE, parameter));
2340        children.add(new Property("subject", "Reference(Patient|Group|Location|Device)", "The patient who will use the device.", 0, 1, subject));
2341        children.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional context in which this request is made.", 0, 1, encounter));
2342        children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, 1, occurrence));
2343        children.add(new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, 1, authoredOn));
2344        children.add(new Property("requester", "Reference(Device|Practitioner|PractitionerRole|Organization)", "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester));
2345        children.add(new Property("performerType", "CodeableConcept", "Desired type of performer for doing the diagnostic testing.", 0, 1, performerType));
2346        children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)", "The desired performer for doing the diagnostic testing.", 0, 1, performer));
2347        children.add(new Property("reasonCode", "CodeableConcept", "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2348        children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2349        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));
2350        children.add(new Property("supportingInfo", "Reference(Any)", "Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
2351        children.add(new Property("note", "Annotation", "Details about this request that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, note));
2352        children.add(new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory));
2353      }
2354
2355      @Override
2356      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2357        switch (_hash) {
2358        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier);
2359        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2360        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2361        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2362        case 237568101: /*priorRequest*/  return new Property("priorRequest", "Reference(Any)", "The request takes the place of the referenced completed or terminated request(s).", 0, java.lang.Integer.MAX_VALUE, priorRequest);
2363        case -445338488: /*groupIdentifier*/  return new Property("groupIdentifier", "Identifier", "Composite request this is part of.", 0, 1, groupIdentifier);
2364        case -892481550: /*status*/  return new Property("status", "code", "The status of the request.", 0, 1, status);
2365        case -1183762788: /*intent*/  return new Property("intent", "code", "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent);
2366        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the {{title}} should be addressed with respect to other requests.", 0, 1, priority);
2367        case 941839219: /*code[x]*/  return new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.", 0, 1, code);
2368        case 3059181: /*code*/  return new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.", 0, 1, code);
2369        case 1565461470: /*codeReference*/  return new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.", 0, 1, code);
2370        case 4899316: /*codeCodeableConcept*/  return new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.", 0, 1, code);
2371        case 1954460585: /*parameter*/  return new Property("parameter", "", "Specific parameters for the ordered item.  For example, the prism value for lenses.", 0, java.lang.Integer.MAX_VALUE, parameter);
2372        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group|Location|Device)", "The patient who will use the device.", 0, 1, subject);
2373        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "An encounter that provides additional context in which this request is made.", 0, 1, encounter);
2374        case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, 1, occurrence);
2375        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, 1, occurrence);
2376        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, 1, occurrence);
2377        case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, 1, occurrence);
2378        case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".", 0, 1, occurrence);
2379        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, 1, authoredOn);
2380        case 693933948: /*requester*/  return new Property("requester", "Reference(Device|Practitioner|PractitionerRole|Organization)", "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester);
2381        case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "Desired type of performer for doing the diagnostic testing.", 0, 1, performerType);
2382        case 481140686: /*performer*/  return new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)", "The desired performer for doing the diagnostic testing.", 0, 1, performer);
2383        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2384        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2385        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);
2386        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "Reference(Any)", "Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
2387        case 3387378: /*note*/  return new Property("note", "Annotation", "Details about this request that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, note);
2388        case 1538891575: /*relevantHistory*/  return new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
2389        default: return super.getNamedProperty(_hash, _name, _checkValid);
2390        }
2391
2392      }
2393
2394      @Override
2395      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2396        switch (hash) {
2397        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2398        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2399        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2400        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2401        case 237568101: /*priorRequest*/ return this.priorRequest == null ? new Base[0] : this.priorRequest.toArray(new Base[this.priorRequest.size()]); // Reference
2402        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
2403        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DeviceRequestStatus>
2404        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<RequestIntent>
2405        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
2406        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Type
2407        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // DeviceRequestParameterComponent
2408        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2409        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2410        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
2411        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
2412        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // Reference
2413        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : new Base[] {this.performerType}; // CodeableConcept
2414        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
2415        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2416        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2417        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // Reference
2418        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
2419        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2420        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
2421        default: return super.getProperty(hash, name, checkValid);
2422        }
2423
2424      }
2425
2426      @Override
2427      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2428        switch (hash) {
2429        case -1618432855: // identifier
2430          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2431          return value;
2432        case 8911915: // instantiatesCanonical
2433          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
2434          return value;
2435        case -1926393373: // instantiatesUri
2436          this.getInstantiatesUri().add(castToUri(value)); // UriType
2437          return value;
2438        case -332612366: // basedOn
2439          this.getBasedOn().add(castToReference(value)); // Reference
2440          return value;
2441        case 237568101: // priorRequest
2442          this.getPriorRequest().add(castToReference(value)); // Reference
2443          return value;
2444        case -445338488: // groupIdentifier
2445          this.groupIdentifier = castToIdentifier(value); // Identifier
2446          return value;
2447        case -892481550: // status
2448          value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
2449          this.status = (Enumeration) value; // Enumeration<DeviceRequestStatus>
2450          return value;
2451        case -1183762788: // intent
2452          value = new RequestIntentEnumFactory().fromType(castToCode(value));
2453          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
2454          return value;
2455        case -1165461084: // priority
2456          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
2457          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
2458          return value;
2459        case 3059181: // code
2460          this.code = castToType(value); // Type
2461          return value;
2462        case 1954460585: // parameter
2463          this.getParameter().add((DeviceRequestParameterComponent) value); // DeviceRequestParameterComponent
2464          return value;
2465        case -1867885268: // subject
2466          this.subject = castToReference(value); // Reference
2467          return value;
2468        case 1524132147: // encounter
2469          this.encounter = castToReference(value); // Reference
2470          return value;
2471        case 1687874001: // occurrence
2472          this.occurrence = castToType(value); // Type
2473          return value;
2474        case -1500852503: // authoredOn
2475          this.authoredOn = castToDateTime(value); // DateTimeType
2476          return value;
2477        case 693933948: // requester
2478          this.requester = castToReference(value); // Reference
2479          return value;
2480        case -901444568: // performerType
2481          this.performerType = castToCodeableConcept(value); // CodeableConcept
2482          return value;
2483        case 481140686: // performer
2484          this.performer = castToReference(value); // Reference
2485          return value;
2486        case 722137681: // reasonCode
2487          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2488          return value;
2489        case -1146218137: // reasonReference
2490          this.getReasonReference().add(castToReference(value)); // Reference
2491          return value;
2492        case 73049818: // insurance
2493          this.getInsurance().add(castToReference(value)); // Reference
2494          return value;
2495        case 1922406657: // supportingInfo
2496          this.getSupportingInfo().add(castToReference(value)); // Reference
2497          return value;
2498        case 3387378: // note
2499          this.getNote().add(castToAnnotation(value)); // Annotation
2500          return value;
2501        case 1538891575: // relevantHistory
2502          this.getRelevantHistory().add(castToReference(value)); // Reference
2503          return value;
2504        default: return super.setProperty(hash, name, value);
2505        }
2506
2507      }
2508
2509      @Override
2510      public Base setProperty(String name, Base value) throws FHIRException {
2511        if (name.equals("identifier")) {
2512          this.getIdentifier().add(castToIdentifier(value));
2513        } else if (name.equals("instantiatesCanonical")) {
2514          this.getInstantiatesCanonical().add(castToCanonical(value));
2515        } else if (name.equals("instantiatesUri")) {
2516          this.getInstantiatesUri().add(castToUri(value));
2517        } else if (name.equals("basedOn")) {
2518          this.getBasedOn().add(castToReference(value));
2519        } else if (name.equals("priorRequest")) {
2520          this.getPriorRequest().add(castToReference(value));
2521        } else if (name.equals("groupIdentifier")) {
2522          this.groupIdentifier = castToIdentifier(value); // Identifier
2523        } else if (name.equals("status")) {
2524          value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
2525          this.status = (Enumeration) value; // Enumeration<DeviceRequestStatus>
2526        } else if (name.equals("intent")) {
2527          value = new RequestIntentEnumFactory().fromType(castToCode(value));
2528          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
2529        } else if (name.equals("priority")) {
2530          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
2531          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
2532        } else if (name.equals("code[x]")) {
2533          this.code = castToType(value); // Type
2534        } else if (name.equals("parameter")) {
2535          this.getParameter().add((DeviceRequestParameterComponent) value);
2536        } else if (name.equals("subject")) {
2537          this.subject = castToReference(value); // Reference
2538        } else if (name.equals("encounter")) {
2539          this.encounter = castToReference(value); // Reference
2540        } else if (name.equals("occurrence[x]")) {
2541          this.occurrence = castToType(value); // Type
2542        } else if (name.equals("authoredOn")) {
2543          this.authoredOn = castToDateTime(value); // DateTimeType
2544        } else if (name.equals("requester")) {
2545          this.requester = castToReference(value); // Reference
2546        } else if (name.equals("performerType")) {
2547          this.performerType = castToCodeableConcept(value); // CodeableConcept
2548        } else if (name.equals("performer")) {
2549          this.performer = castToReference(value); // Reference
2550        } else if (name.equals("reasonCode")) {
2551          this.getReasonCode().add(castToCodeableConcept(value));
2552        } else if (name.equals("reasonReference")) {
2553          this.getReasonReference().add(castToReference(value));
2554        } else if (name.equals("insurance")) {
2555          this.getInsurance().add(castToReference(value));
2556        } else if (name.equals("supportingInfo")) {
2557          this.getSupportingInfo().add(castToReference(value));
2558        } else if (name.equals("note")) {
2559          this.getNote().add(castToAnnotation(value));
2560        } else if (name.equals("relevantHistory")) {
2561          this.getRelevantHistory().add(castToReference(value));
2562        } else
2563          return super.setProperty(name, value);
2564        return value;
2565      }
2566
2567      @Override
2568      public Base makeProperty(int hash, String name) throws FHIRException {
2569        switch (hash) {
2570        case -1618432855:  return addIdentifier(); 
2571        case 8911915:  return addInstantiatesCanonicalElement();
2572        case -1926393373:  return addInstantiatesUriElement();
2573        case -332612366:  return addBasedOn(); 
2574        case 237568101:  return addPriorRequest(); 
2575        case -445338488:  return getGroupIdentifier(); 
2576        case -892481550:  return getStatusElement();
2577        case -1183762788:  return getIntentElement();
2578        case -1165461084:  return getPriorityElement();
2579        case 941839219:  return getCode(); 
2580        case 3059181:  return getCode(); 
2581        case 1954460585:  return addParameter(); 
2582        case -1867885268:  return getSubject(); 
2583        case 1524132147:  return getEncounter(); 
2584        case -2022646513:  return getOccurrence(); 
2585        case 1687874001:  return getOccurrence(); 
2586        case -1500852503:  return getAuthoredOnElement();
2587        case 693933948:  return getRequester(); 
2588        case -901444568:  return getPerformerType(); 
2589        case 481140686:  return getPerformer(); 
2590        case 722137681:  return addReasonCode(); 
2591        case -1146218137:  return addReasonReference(); 
2592        case 73049818:  return addInsurance(); 
2593        case 1922406657:  return addSupportingInfo(); 
2594        case 3387378:  return addNote(); 
2595        case 1538891575:  return addRelevantHistory(); 
2596        default: return super.makeProperty(hash, name);
2597        }
2598
2599      }
2600
2601      @Override
2602      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2603        switch (hash) {
2604        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2605        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
2606        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
2607        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2608        case 237568101: /*priorRequest*/ return new String[] {"Reference"};
2609        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
2610        case -892481550: /*status*/ return new String[] {"code"};
2611        case -1183762788: /*intent*/ return new String[] {"code"};
2612        case -1165461084: /*priority*/ return new String[] {"code"};
2613        case 3059181: /*code*/ return new String[] {"Reference", "CodeableConcept"};
2614        case 1954460585: /*parameter*/ return new String[] {};
2615        case -1867885268: /*subject*/ return new String[] {"Reference"};
2616        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2617        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
2618        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
2619        case 693933948: /*requester*/ return new String[] {"Reference"};
2620        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
2621        case 481140686: /*performer*/ return new String[] {"Reference"};
2622        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2623        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2624        case 73049818: /*insurance*/ return new String[] {"Reference"};
2625        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
2626        case 3387378: /*note*/ return new String[] {"Annotation"};
2627        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
2628        default: return super.getTypesForProperty(hash, name);
2629        }
2630
2631      }
2632
2633      @Override
2634      public Base addChild(String name) throws FHIRException {
2635        if (name.equals("identifier")) {
2636          return addIdentifier();
2637        }
2638        else if (name.equals("instantiatesCanonical")) {
2639          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.instantiatesCanonical");
2640        }
2641        else if (name.equals("instantiatesUri")) {
2642          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.instantiatesUri");
2643        }
2644        else if (name.equals("basedOn")) {
2645          return addBasedOn();
2646        }
2647        else if (name.equals("priorRequest")) {
2648          return addPriorRequest();
2649        }
2650        else if (name.equals("groupIdentifier")) {
2651          this.groupIdentifier = new Identifier();
2652          return this.groupIdentifier;
2653        }
2654        else if (name.equals("status")) {
2655          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.status");
2656        }
2657        else if (name.equals("intent")) {
2658          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.intent");
2659        }
2660        else if (name.equals("priority")) {
2661          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.priority");
2662        }
2663        else if (name.equals("codeReference")) {
2664          this.code = new Reference();
2665          return this.code;
2666        }
2667        else if (name.equals("codeCodeableConcept")) {
2668          this.code = new CodeableConcept();
2669          return this.code;
2670        }
2671        else if (name.equals("parameter")) {
2672          return addParameter();
2673        }
2674        else if (name.equals("subject")) {
2675          this.subject = new Reference();
2676          return this.subject;
2677        }
2678        else if (name.equals("encounter")) {
2679          this.encounter = new Reference();
2680          return this.encounter;
2681        }
2682        else if (name.equals("occurrenceDateTime")) {
2683          this.occurrence = new DateTimeType();
2684          return this.occurrence;
2685        }
2686        else if (name.equals("occurrencePeriod")) {
2687          this.occurrence = new Period();
2688          return this.occurrence;
2689        }
2690        else if (name.equals("occurrenceTiming")) {
2691          this.occurrence = new Timing();
2692          return this.occurrence;
2693        }
2694        else if (name.equals("authoredOn")) {
2695          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.authoredOn");
2696        }
2697        else if (name.equals("requester")) {
2698          this.requester = new Reference();
2699          return this.requester;
2700        }
2701        else if (name.equals("performerType")) {
2702          this.performerType = new CodeableConcept();
2703          return this.performerType;
2704        }
2705        else if (name.equals("performer")) {
2706          this.performer = new Reference();
2707          return this.performer;
2708        }
2709        else if (name.equals("reasonCode")) {
2710          return addReasonCode();
2711        }
2712        else if (name.equals("reasonReference")) {
2713          return addReasonReference();
2714        }
2715        else if (name.equals("insurance")) {
2716          return addInsurance();
2717        }
2718        else if (name.equals("supportingInfo")) {
2719          return addSupportingInfo();
2720        }
2721        else if (name.equals("note")) {
2722          return addNote();
2723        }
2724        else if (name.equals("relevantHistory")) {
2725          return addRelevantHistory();
2726        }
2727        else
2728          return super.addChild(name);
2729      }
2730
2731  public String fhirType() {
2732    return "DeviceRequest";
2733
2734  }
2735
2736      public DeviceRequest copy() {
2737        DeviceRequest dst = new DeviceRequest();
2738        copyValues(dst);
2739        return dst;
2740      }
2741
2742      public void copyValues(DeviceRequest dst) {
2743        super.copyValues(dst);
2744        if (identifier != null) {
2745          dst.identifier = new ArrayList<Identifier>();
2746          for (Identifier i : identifier)
2747            dst.identifier.add(i.copy());
2748        };
2749        if (instantiatesCanonical != null) {
2750          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2751          for (CanonicalType i : instantiatesCanonical)
2752            dst.instantiatesCanonical.add(i.copy());
2753        };
2754        if (instantiatesUri != null) {
2755          dst.instantiatesUri = new ArrayList<UriType>();
2756          for (UriType i : instantiatesUri)
2757            dst.instantiatesUri.add(i.copy());
2758        };
2759        if (basedOn != null) {
2760          dst.basedOn = new ArrayList<Reference>();
2761          for (Reference i : basedOn)
2762            dst.basedOn.add(i.copy());
2763        };
2764        if (priorRequest != null) {
2765          dst.priorRequest = new ArrayList<Reference>();
2766          for (Reference i : priorRequest)
2767            dst.priorRequest.add(i.copy());
2768        };
2769        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
2770        dst.status = status == null ? null : status.copy();
2771        dst.intent = intent == null ? null : intent.copy();
2772        dst.priority = priority == null ? null : priority.copy();
2773        dst.code = code == null ? null : code.copy();
2774        if (parameter != null) {
2775          dst.parameter = new ArrayList<DeviceRequestParameterComponent>();
2776          for (DeviceRequestParameterComponent i : parameter)
2777            dst.parameter.add(i.copy());
2778        };
2779        dst.subject = subject == null ? null : subject.copy();
2780        dst.encounter = encounter == null ? null : encounter.copy();
2781        dst.occurrence = occurrence == null ? null : occurrence.copy();
2782        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
2783        dst.requester = requester == null ? null : requester.copy();
2784        dst.performerType = performerType == null ? null : performerType.copy();
2785        dst.performer = performer == null ? null : performer.copy();
2786        if (reasonCode != null) {
2787          dst.reasonCode = new ArrayList<CodeableConcept>();
2788          for (CodeableConcept i : reasonCode)
2789            dst.reasonCode.add(i.copy());
2790        };
2791        if (reasonReference != null) {
2792          dst.reasonReference = new ArrayList<Reference>();
2793          for (Reference i : reasonReference)
2794            dst.reasonReference.add(i.copy());
2795        };
2796        if (insurance != null) {
2797          dst.insurance = new ArrayList<Reference>();
2798          for (Reference i : insurance)
2799            dst.insurance.add(i.copy());
2800        };
2801        if (supportingInfo != null) {
2802          dst.supportingInfo = new ArrayList<Reference>();
2803          for (Reference i : supportingInfo)
2804            dst.supportingInfo.add(i.copy());
2805        };
2806        if (note != null) {
2807          dst.note = new ArrayList<Annotation>();
2808          for (Annotation i : note)
2809            dst.note.add(i.copy());
2810        };
2811        if (relevantHistory != null) {
2812          dst.relevantHistory = new ArrayList<Reference>();
2813          for (Reference i : relevantHistory)
2814            dst.relevantHistory.add(i.copy());
2815        };
2816      }
2817
2818      protected DeviceRequest typedCopy() {
2819        return copy();
2820      }
2821
2822      @Override
2823      public boolean equalsDeep(Base other_) {
2824        if (!super.equalsDeep(other_))
2825          return false;
2826        if (!(other_ instanceof DeviceRequest))
2827          return false;
2828        DeviceRequest o = (DeviceRequest) other_;
2829        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
2830           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
2831           && compareDeep(priorRequest, o.priorRequest, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
2832           && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true) && compareDeep(priority, o.priority, true)
2833           && compareDeep(code, o.code, true) && compareDeep(parameter, o.parameter, true) && compareDeep(subject, o.subject, true)
2834           && compareDeep(encounter, o.encounter, true) && compareDeep(occurrence, o.occurrence, true) && compareDeep(authoredOn, o.authoredOn, true)
2835           && compareDeep(requester, o.requester, true) && compareDeep(performerType, o.performerType, true)
2836           && compareDeep(performer, o.performer, true) && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
2837           && compareDeep(insurance, o.insurance, true) && compareDeep(supportingInfo, o.supportingInfo, true)
2838           && compareDeep(note, o.note, true) && compareDeep(relevantHistory, o.relevantHistory, true);
2839      }
2840
2841      @Override
2842      public boolean equalsShallow(Base other_) {
2843        if (!super.equalsShallow(other_))
2844          return false;
2845        if (!(other_ instanceof DeviceRequest))
2846          return false;
2847        DeviceRequest o = (DeviceRequest) other_;
2848        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
2849           && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true) && compareValues(authoredOn, o.authoredOn, true)
2850          ;
2851      }
2852
2853      public boolean isEmpty() {
2854        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
2855          , instantiatesUri, basedOn, priorRequest, groupIdentifier, status, intent, priority
2856          , code, parameter, subject, encounter, occurrence, authoredOn, requester, performerType
2857          , performer, reasonCode, reasonReference, insurance, supportingInfo, note, relevantHistory
2858          );
2859      }
2860
2861  @Override
2862  public ResourceType getResourceType() {
2863    return ResourceType.DeviceRequest;
2864   }
2865
2866 /**
2867   * Search parameter: <b>requester</b>
2868   * <p>
2869   * Description: <b>Who/what is requesting service</b><br>
2870   * Type: <b>reference</b><br>
2871   * Path: <b>DeviceRequest.requester</b><br>
2872   * </p>
2873   */
2874  @SearchParamDefinition(name="requester", path="DeviceRequest.requester", description="Who/what is requesting service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Practitioner.class, PractitionerRole.class } )
2875  public static final String SP_REQUESTER = "requester";
2876 /**
2877   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
2878   * <p>
2879   * Description: <b>Who/what is requesting service</b><br>
2880   * Type: <b>reference</b><br>
2881   * Path: <b>DeviceRequest.requester</b><br>
2882   * </p>
2883   */
2884  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
2885
2886/**
2887   * Constant for fluent queries to be used to add include statements. Specifies
2888   * the path value of "<b>DeviceRequest:requester</b>".
2889   */
2890  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("DeviceRequest:requester").toLocked();
2891
2892 /**
2893   * Search parameter: <b>insurance</b>
2894   * <p>
2895   * Description: <b>Associated insurance coverage</b><br>
2896   * Type: <b>reference</b><br>
2897   * Path: <b>DeviceRequest.insurance</b><br>
2898   * </p>
2899   */
2900  @SearchParamDefinition(name="insurance", path="DeviceRequest.insurance", description="Associated insurance coverage", type="reference", target={ClaimResponse.class, Coverage.class } )
2901  public static final String SP_INSURANCE = "insurance";
2902 /**
2903   * <b>Fluent Client</b> search parameter constant for <b>insurance</b>
2904   * <p>
2905   * Description: <b>Associated insurance coverage</b><br>
2906   * Type: <b>reference</b><br>
2907   * Path: <b>DeviceRequest.insurance</b><br>
2908   * </p>
2909   */
2910  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSURANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSURANCE);
2911
2912/**
2913   * Constant for fluent queries to be used to add include statements. Specifies
2914   * the path value of "<b>DeviceRequest:insurance</b>".
2915   */
2916  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSURANCE = new ca.uhn.fhir.model.api.Include("DeviceRequest:insurance").toLocked();
2917
2918 /**
2919   * Search parameter: <b>identifier</b>
2920   * <p>
2921   * Description: <b>Business identifier for request/order</b><br>
2922   * Type: <b>token</b><br>
2923   * Path: <b>DeviceRequest.identifier</b><br>
2924   * </p>
2925   */
2926  @SearchParamDefinition(name="identifier", path="DeviceRequest.identifier", description="Business identifier for request/order", type="token" )
2927  public static final String SP_IDENTIFIER = "identifier";
2928 /**
2929   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2930   * <p>
2931   * Description: <b>Business identifier for request/order</b><br>
2932   * Type: <b>token</b><br>
2933   * Path: <b>DeviceRequest.identifier</b><br>
2934   * </p>
2935   */
2936  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2937
2938 /**
2939   * Search parameter: <b>code</b>
2940   * <p>
2941   * Description: <b>Code for what is being requested/ordered</b><br>
2942   * Type: <b>token</b><br>
2943   * Path: <b>DeviceRequest.codeCodeableConcept</b><br>
2944   * </p>
2945   */
2946  @SearchParamDefinition(name="code", path="(DeviceRequest.code as CodeableConcept)", description="Code for what is being requested/ordered", type="token" )
2947  public static final String SP_CODE = "code";
2948 /**
2949   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2950   * <p>
2951   * Description: <b>Code for what is being requested/ordered</b><br>
2952   * Type: <b>token</b><br>
2953   * Path: <b>DeviceRequest.codeCodeableConcept</b><br>
2954   * </p>
2955   */
2956  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
2957
2958 /**
2959   * Search parameter: <b>performer</b>
2960   * <p>
2961   * Description: <b>Desired performer for service</b><br>
2962   * Type: <b>reference</b><br>
2963   * Path: <b>DeviceRequest.performer</b><br>
2964   * </p>
2965   */
2966  @SearchParamDefinition(name="performer", path="DeviceRequest.performer", description="Desired performer for service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={CareTeam.class, Device.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2967  public static final String SP_PERFORMER = "performer";
2968 /**
2969   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2970   * <p>
2971   * Description: <b>Desired performer for service</b><br>
2972   * Type: <b>reference</b><br>
2973   * Path: <b>DeviceRequest.performer</b><br>
2974   * </p>
2975   */
2976  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
2977
2978/**
2979   * Constant for fluent queries to be used to add include statements. Specifies
2980   * the path value of "<b>DeviceRequest:performer</b>".
2981   */
2982  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("DeviceRequest:performer").toLocked();
2983
2984 /**
2985   * Search parameter: <b>event-date</b>
2986   * <p>
2987   * Description: <b>When service should occur</b><br>
2988   * Type: <b>date</b><br>
2989   * Path: <b>DeviceRequest.occurrenceDateTime, DeviceRequest.occurrencePeriod</b><br>
2990   * </p>
2991   */
2992  @SearchParamDefinition(name="event-date", path="(DeviceRequest.occurrence as dateTime) | (DeviceRequest.occurrence as Period)", description="When service should occur", type="date" )
2993  public static final String SP_EVENT_DATE = "event-date";
2994 /**
2995   * <b>Fluent Client</b> search parameter constant for <b>event-date</b>
2996   * <p>
2997   * Description: <b>When service should occur</b><br>
2998   * Type: <b>date</b><br>
2999   * Path: <b>DeviceRequest.occurrenceDateTime, DeviceRequest.occurrencePeriod</b><br>
3000   * </p>
3001   */
3002  public static final ca.uhn.fhir.rest.gclient.DateClientParam EVENT_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EVENT_DATE);
3003
3004 /**
3005   * Search parameter: <b>subject</b>
3006   * <p>
3007   * Description: <b>Individual the service is ordered for</b><br>
3008   * Type: <b>reference</b><br>
3009   * Path: <b>DeviceRequest.subject</b><br>
3010   * </p>
3011   */
3012  @SearchParamDefinition(name="subject", path="DeviceRequest.subject", description="Individual the service is ordered for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Device.class, Group.class, Location.class, Patient.class } )
3013  public static final String SP_SUBJECT = "subject";
3014 /**
3015   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3016   * <p>
3017   * Description: <b>Individual the service is ordered for</b><br>
3018   * Type: <b>reference</b><br>
3019   * Path: <b>DeviceRequest.subject</b><br>
3020   * </p>
3021   */
3022  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3023
3024/**
3025   * Constant for fluent queries to be used to add include statements. Specifies
3026   * the path value of "<b>DeviceRequest:subject</b>".
3027   */
3028  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DeviceRequest:subject").toLocked();
3029
3030 /**
3031   * Search parameter: <b>instantiates-canonical</b>
3032   * <p>
3033   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3034   * Type: <b>reference</b><br>
3035   * Path: <b>DeviceRequest.instantiatesCanonical</b><br>
3036   * </p>
3037   */
3038  @SearchParamDefinition(name="instantiates-canonical", path="DeviceRequest.instantiatesCanonical", description="Instantiates FHIR protocol or definition", type="reference", target={ActivityDefinition.class, PlanDefinition.class } )
3039  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
3040 /**
3041   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
3042   * <p>
3043   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3044   * Type: <b>reference</b><br>
3045   * Path: <b>DeviceRequest.instantiatesCanonical</b><br>
3046   * </p>
3047   */
3048  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
3049
3050/**
3051   * Constant for fluent queries to be used to add include statements. Specifies
3052   * the path value of "<b>DeviceRequest:instantiates-canonical</b>".
3053   */
3054  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("DeviceRequest:instantiates-canonical").toLocked();
3055
3056 /**
3057   * Search parameter: <b>encounter</b>
3058   * <p>
3059   * Description: <b>Encounter during which request was created</b><br>
3060   * Type: <b>reference</b><br>
3061   * Path: <b>DeviceRequest.encounter</b><br>
3062   * </p>
3063   */
3064  @SearchParamDefinition(name="encounter", path="DeviceRequest.encounter", description="Encounter during which request was created", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
3065  public static final String SP_ENCOUNTER = "encounter";
3066 /**
3067   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3068   * <p>
3069   * Description: <b>Encounter during which request was created</b><br>
3070   * Type: <b>reference</b><br>
3071   * Path: <b>DeviceRequest.encounter</b><br>
3072   * </p>
3073   */
3074  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3075
3076/**
3077   * Constant for fluent queries to be used to add include statements. Specifies
3078   * the path value of "<b>DeviceRequest:encounter</b>".
3079   */
3080  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("DeviceRequest:encounter").toLocked();
3081
3082 /**
3083   * Search parameter: <b>authored-on</b>
3084   * <p>
3085   * Description: <b>When the request transitioned to being actionable</b><br>
3086   * Type: <b>date</b><br>
3087   * Path: <b>DeviceRequest.authoredOn</b><br>
3088   * </p>
3089   */
3090  @SearchParamDefinition(name="authored-on", path="DeviceRequest.authoredOn", description="When the request transitioned to being actionable", type="date" )
3091  public static final String SP_AUTHORED_ON = "authored-on";
3092 /**
3093   * <b>Fluent Client</b> search parameter constant for <b>authored-on</b>
3094   * <p>
3095   * Description: <b>When the request transitioned to being actionable</b><br>
3096   * Type: <b>date</b><br>
3097   * Path: <b>DeviceRequest.authoredOn</b><br>
3098   * </p>
3099   */
3100  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED_ON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED_ON);
3101
3102 /**
3103   * Search parameter: <b>intent</b>
3104   * <p>
3105   * Description: <b>proposal | plan | original-order |reflex-order</b><br>
3106   * Type: <b>token</b><br>
3107   * Path: <b>DeviceRequest.intent</b><br>
3108   * </p>
3109   */
3110  @SearchParamDefinition(name="intent", path="DeviceRequest.intent", description="proposal | plan | original-order |reflex-order", type="token" )
3111  public static final String SP_INTENT = "intent";
3112 /**
3113   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
3114   * <p>
3115   * Description: <b>proposal | plan | original-order |reflex-order</b><br>
3116   * Type: <b>token</b><br>
3117   * Path: <b>DeviceRequest.intent</b><br>
3118   * </p>
3119   */
3120  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
3121
3122 /**
3123   * Search parameter: <b>group-identifier</b>
3124   * <p>
3125   * Description: <b>Composite request this is part of</b><br>
3126   * Type: <b>token</b><br>
3127   * Path: <b>DeviceRequest.groupIdentifier</b><br>
3128   * </p>
3129   */
3130  @SearchParamDefinition(name="group-identifier", path="DeviceRequest.groupIdentifier", description="Composite request this is part of", type="token" )
3131  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
3132 /**
3133   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
3134   * <p>
3135   * Description: <b>Composite request this is part of</b><br>
3136   * Type: <b>token</b><br>
3137   * Path: <b>DeviceRequest.groupIdentifier</b><br>
3138   * </p>
3139   */
3140  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP_IDENTIFIER);
3141
3142 /**
3143   * Search parameter: <b>based-on</b>
3144   * <p>
3145   * Description: <b>Plan/proposal/order fulfilled by this request</b><br>
3146   * Type: <b>reference</b><br>
3147   * Path: <b>DeviceRequest.basedOn</b><br>
3148   * </p>
3149   */
3150  @SearchParamDefinition(name="based-on", path="DeviceRequest.basedOn", description="Plan/proposal/order fulfilled by this request", type="reference" )
3151  public static final String SP_BASED_ON = "based-on";
3152 /**
3153   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
3154   * <p>
3155   * Description: <b>Plan/proposal/order fulfilled by this request</b><br>
3156   * Type: <b>reference</b><br>
3157   * Path: <b>DeviceRequest.basedOn</b><br>
3158   * </p>
3159   */
3160  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
3161
3162/**
3163   * Constant for fluent queries to be used to add include statements. Specifies
3164   * the path value of "<b>DeviceRequest:based-on</b>".
3165   */
3166  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("DeviceRequest:based-on").toLocked();
3167
3168 /**
3169   * Search parameter: <b>patient</b>
3170   * <p>
3171   * Description: <b>Individual the service is ordered for</b><br>
3172   * Type: <b>reference</b><br>
3173   * Path: <b>DeviceRequest.subject</b><br>
3174   * </p>
3175   */
3176  @SearchParamDefinition(name="patient", path="DeviceRequest.subject.where(resolve() is Patient)", description="Individual the service is ordered for", type="reference", target={Patient.class } )
3177  public static final String SP_PATIENT = "patient";
3178 /**
3179   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3180   * <p>
3181   * Description: <b>Individual the service is ordered for</b><br>
3182   * Type: <b>reference</b><br>
3183   * Path: <b>DeviceRequest.subject</b><br>
3184   * </p>
3185   */
3186  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3187
3188/**
3189   * Constant for fluent queries to be used to add include statements. Specifies
3190   * the path value of "<b>DeviceRequest:patient</b>".
3191   */
3192  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceRequest:patient").toLocked();
3193
3194 /**
3195   * Search parameter: <b>instantiates-uri</b>
3196   * <p>
3197   * Description: <b>Instantiates external protocol or definition</b><br>
3198   * Type: <b>uri</b><br>
3199   * Path: <b>DeviceRequest.instantiatesUri</b><br>
3200   * </p>
3201   */
3202  @SearchParamDefinition(name="instantiates-uri", path="DeviceRequest.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
3203  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
3204 /**
3205   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
3206   * <p>
3207   * Description: <b>Instantiates external protocol or definition</b><br>
3208   * Type: <b>uri</b><br>
3209   * Path: <b>DeviceRequest.instantiatesUri</b><br>
3210   * </p>
3211   */
3212  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
3213
3214 /**
3215   * Search parameter: <b>prior-request</b>
3216   * <p>
3217   * Description: <b>Request takes the place of referenced completed or terminated requests</b><br>
3218   * Type: <b>reference</b><br>
3219   * Path: <b>DeviceRequest.priorRequest</b><br>
3220   * </p>
3221   */
3222  @SearchParamDefinition(name="prior-request", path="DeviceRequest.priorRequest", description="Request takes the place of referenced completed or terminated requests", type="reference" )
3223  public static final String SP_PRIOR_REQUEST = "prior-request";
3224 /**
3225   * <b>Fluent Client</b> search parameter constant for <b>prior-request</b>
3226   * <p>
3227   * Description: <b>Request takes the place of referenced completed or terminated requests</b><br>
3228   * Type: <b>reference</b><br>
3229   * Path: <b>DeviceRequest.priorRequest</b><br>
3230   * </p>
3231   */
3232  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRIOR_REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRIOR_REQUEST);
3233
3234/**
3235   * Constant for fluent queries to be used to add include statements. Specifies
3236   * the path value of "<b>DeviceRequest:prior-request</b>".
3237   */
3238  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRIOR_REQUEST = new ca.uhn.fhir.model.api.Include("DeviceRequest:prior-request").toLocked();
3239
3240 /**
3241   * Search parameter: <b>device</b>
3242   * <p>
3243   * Description: <b>Reference to resource that is being requested/ordered</b><br>
3244   * Type: <b>reference</b><br>
3245   * Path: <b>DeviceRequest.codeReference</b><br>
3246   * </p>
3247   */
3248  @SearchParamDefinition(name="device", path="(DeviceRequest.code as Reference)", description="Reference to resource that is being requested/ordered", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device") }, target={Device.class } )
3249  public static final String SP_DEVICE = "device";
3250 /**
3251   * <b>Fluent Client</b> search parameter constant for <b>device</b>
3252   * <p>
3253   * Description: <b>Reference to resource that is being requested/ordered</b><br>
3254   * Type: <b>reference</b><br>
3255   * Path: <b>DeviceRequest.codeReference</b><br>
3256   * </p>
3257   */
3258  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE);
3259
3260/**
3261   * Constant for fluent queries to be used to add include statements. Specifies
3262   * the path value of "<b>DeviceRequest:device</b>".
3263   */
3264  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("DeviceRequest:device").toLocked();
3265
3266 /**
3267   * Search parameter: <b>status</b>
3268   * <p>
3269   * Description: <b>entered-in-error | draft | active |suspended | completed</b><br>
3270   * Type: <b>token</b><br>
3271   * Path: <b>DeviceRequest.status</b><br>
3272   * </p>
3273   */
3274  @SearchParamDefinition(name="status", path="DeviceRequest.status", description="entered-in-error | draft | active |suspended | completed", type="token" )
3275  public static final String SP_STATUS = "status";
3276 /**
3277   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3278   * <p>
3279   * Description: <b>entered-in-error | draft | active |suspended | completed</b><br>
3280   * Type: <b>token</b><br>
3281   * Path: <b>DeviceRequest.status</b><br>
3282   * </p>
3283   */
3284  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3285
3286
3287}