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