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