001package org.hl7.fhir.dstu3.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 Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
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/Profile/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 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        SUSPENDED, 
064        /**
065         * The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.
066         */
067        CANCELLED, 
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 doesn't 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 ("suspended".equals(codeString))
092          return SUSPENDED;
093        if ("cancelled".equals(codeString))
094          return CANCELLED;
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 SUSPENDED: return "suspended";
111            case CANCELLED: return "cancelled";
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 SUSPENDED: return "http://hl7.org/fhir/request-status";
123            case CANCELLED: 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 ready to be acted upon";
134            case SUSPENDED: return "The authorization/request to act has been temporarily withdrawn but is expected to resume in the future";
135            case CANCELLED: return "The authorization/request to act has been terminated prior to the 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 doesn't 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 SUSPENDED: return "Suspended";
147            case CANCELLED: return "Cancelled";
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 ("suspended".equals(codeString))
166          return DeviceRequestStatus.SUSPENDED;
167        if ("cancelled".equals(codeString))
168          return DeviceRequestStatus.CANCELLED;
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 ("suspended".equals(codeString))
190          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.SUSPENDED);
191        if ("cancelled".equals(codeString))
192          return new Enumeration<DeviceRequestStatus>(this, DeviceRequestStatus.CANCELLED);
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.SUSPENDED)
207        return "suspended";
208      if (code == DeviceRequestStatus.CANCELLED)
209        return "cancelled";
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 RequestPriority {
224        /**
225         * The request has normal priority
226         */
227        ROUTINE, 
228        /**
229         * The request should be actioned promptly - higher priority than routine
230         */
231        URGENT, 
232        /**
233         * The request should be actioned as soon as possible - higher priority than urgent
234         */
235        ASAP, 
236        /**
237         * The request should be actioned immediately - highest possible priority.  E.g. an emergency
238         */
239        STAT, 
240        /**
241         * added to help the parsers with the generic types
242         */
243        NULL;
244        public static RequestPriority fromCode(String codeString) throws FHIRException {
245            if (codeString == null || "".equals(codeString))
246                return null;
247        if ("routine".equals(codeString))
248          return ROUTINE;
249        if ("urgent".equals(codeString))
250          return URGENT;
251        if ("asap".equals(codeString))
252          return ASAP;
253        if ("stat".equals(codeString))
254          return STAT;
255        if (Configuration.isAcceptInvalidEnums())
256          return null;
257        else
258          throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
259        }
260        public String toCode() {
261          switch (this) {
262            case ROUTINE: return "routine";
263            case URGENT: return "urgent";
264            case ASAP: return "asap";
265            case STAT: return "stat";
266            default: return "?";
267          }
268        }
269        public String getSystem() {
270          switch (this) {
271            case ROUTINE: return "http://hl7.org/fhir/request-priority";
272            case URGENT: return "http://hl7.org/fhir/request-priority";
273            case ASAP: return "http://hl7.org/fhir/request-priority";
274            case STAT: return "http://hl7.org/fhir/request-priority";
275            default: return "?";
276          }
277        }
278        public String getDefinition() {
279          switch (this) {
280            case ROUTINE: return "The request has normal priority";
281            case URGENT: return "The request should be actioned promptly - higher priority than routine";
282            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent";
283            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency";
284            default: return "?";
285          }
286        }
287        public String getDisplay() {
288          switch (this) {
289            case ROUTINE: return "Routine";
290            case URGENT: return "Urgent";
291            case ASAP: return "ASAP";
292            case STAT: return "STAT";
293            default: return "?";
294          }
295        }
296    }
297
298  public static class RequestPriorityEnumFactory implements EnumFactory<RequestPriority> {
299    public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
300      if (codeString == null || "".equals(codeString))
301            if (codeString == null || "".equals(codeString))
302                return null;
303        if ("routine".equals(codeString))
304          return RequestPriority.ROUTINE;
305        if ("urgent".equals(codeString))
306          return RequestPriority.URGENT;
307        if ("asap".equals(codeString))
308          return RequestPriority.ASAP;
309        if ("stat".equals(codeString))
310          return RequestPriority.STAT;
311        throw new IllegalArgumentException("Unknown RequestPriority code '"+codeString+"'");
312        }
313        public Enumeration<RequestPriority> fromType(Base code) throws FHIRException {
314          if (code == null)
315            return null;
316          if (code.isEmpty())
317            return new Enumeration<RequestPriority>(this);
318          String codeString = ((PrimitiveType) code).asStringValue();
319          if (codeString == null || "".equals(codeString))
320            return null;
321        if ("routine".equals(codeString))
322          return new Enumeration<RequestPriority>(this, RequestPriority.ROUTINE);
323        if ("urgent".equals(codeString))
324          return new Enumeration<RequestPriority>(this, RequestPriority.URGENT);
325        if ("asap".equals(codeString))
326          return new Enumeration<RequestPriority>(this, RequestPriority.ASAP);
327        if ("stat".equals(codeString))
328          return new Enumeration<RequestPriority>(this, RequestPriority.STAT);
329        throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
330        }
331    public String toCode(RequestPriority code) {
332      if (code == RequestPriority.ROUTINE)
333        return "routine";
334      if (code == RequestPriority.URGENT)
335        return "urgent";
336      if (code == RequestPriority.ASAP)
337        return "asap";
338      if (code == RequestPriority.STAT)
339        return "stat";
340      return "?";
341      }
342    public String toSystem(RequestPriority code) {
343      return code.getSystem();
344      }
345    }
346
347    @Block()
348    public static class DeviceRequestRequesterComponent extends BackboneElement implements IBaseBackboneElement {
349        /**
350         * The device, practitioner, etc. who initiated the request.
351         */
352        @Child(name = "agent", type = {Device.class, Practitioner.class, Organization.class}, order=1, min=1, max=1, modifier=false, summary=true)
353        @Description(shortDefinition="Individual making the request", formalDefinition="The device, practitioner, etc. who initiated the request." )
354        protected Reference agent;
355
356        /**
357         * The actual object that is the target of the reference (The device, practitioner, etc. who initiated the request.)
358         */
359        protected Resource agentTarget;
360
361        /**
362         * The organization the device or practitioner was acting on behalf of.
363         */
364        @Child(name = "onBehalfOf", type = {Organization.class}, order=2, min=0, max=1, modifier=false, summary=true)
365        @Description(shortDefinition="Organization agent is acting for", formalDefinition="The organization the device or practitioner was acting on behalf of." )
366        protected Reference onBehalfOf;
367
368        /**
369         * The actual object that is the target of the reference (The organization the device or practitioner was acting on behalf of.)
370         */
371        protected Organization onBehalfOfTarget;
372
373        private static final long serialVersionUID = -71453027L;
374
375    /**
376     * Constructor
377     */
378      public DeviceRequestRequesterComponent() {
379        super();
380      }
381
382    /**
383     * Constructor
384     */
385      public DeviceRequestRequesterComponent(Reference agent) {
386        super();
387        this.agent = agent;
388      }
389
390        /**
391         * @return {@link #agent} (The device, practitioner, etc. who initiated the request.)
392         */
393        public Reference getAgent() { 
394          if (this.agent == null)
395            if (Configuration.errorOnAutoCreate())
396              throw new Error("Attempt to auto-create DeviceRequestRequesterComponent.agent");
397            else if (Configuration.doAutoCreate())
398              this.agent = new Reference(); // cc
399          return this.agent;
400        }
401
402        public boolean hasAgent() { 
403          return this.agent != null && !this.agent.isEmpty();
404        }
405
406        /**
407         * @param value {@link #agent} (The device, practitioner, etc. who initiated the request.)
408         */
409        public DeviceRequestRequesterComponent setAgent(Reference value) { 
410          this.agent = value;
411          return this;
412        }
413
414        /**
415         * @return {@link #agent} 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 device, practitioner, etc. who initiated the request.)
416         */
417        public Resource getAgentTarget() { 
418          return this.agentTarget;
419        }
420
421        /**
422         * @param value {@link #agent} 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 device, practitioner, etc. who initiated the request.)
423         */
424        public DeviceRequestRequesterComponent setAgentTarget(Resource value) { 
425          this.agentTarget = value;
426          return this;
427        }
428
429        /**
430         * @return {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
431         */
432        public Reference getOnBehalfOf() { 
433          if (this.onBehalfOf == null)
434            if (Configuration.errorOnAutoCreate())
435              throw new Error("Attempt to auto-create DeviceRequestRequesterComponent.onBehalfOf");
436            else if (Configuration.doAutoCreate())
437              this.onBehalfOf = new Reference(); // cc
438          return this.onBehalfOf;
439        }
440
441        public boolean hasOnBehalfOf() { 
442          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
443        }
444
445        /**
446         * @param value {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
447         */
448        public DeviceRequestRequesterComponent setOnBehalfOf(Reference value) { 
449          this.onBehalfOf = value;
450          return this;
451        }
452
453        /**
454         * @return {@link #onBehalfOf} 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 organization the device or practitioner was acting on behalf of.)
455         */
456        public Organization getOnBehalfOfTarget() { 
457          if (this.onBehalfOfTarget == null)
458            if (Configuration.errorOnAutoCreate())
459              throw new Error("Attempt to auto-create DeviceRequestRequesterComponent.onBehalfOf");
460            else if (Configuration.doAutoCreate())
461              this.onBehalfOfTarget = new Organization(); // aa
462          return this.onBehalfOfTarget;
463        }
464
465        /**
466         * @param value {@link #onBehalfOf} 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 organization the device or practitioner was acting on behalf of.)
467         */
468        public DeviceRequestRequesterComponent setOnBehalfOfTarget(Organization value) { 
469          this.onBehalfOfTarget = value;
470          return this;
471        }
472
473        protected void listChildren(List<Property> childrenList) {
474          super.listChildren(childrenList);
475          childrenList.add(new Property("agent", "Reference(Device|Practitioner|Organization)", "The device, practitioner, etc. who initiated the request.", 0, java.lang.Integer.MAX_VALUE, agent));
476          childrenList.add(new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, java.lang.Integer.MAX_VALUE, onBehalfOf));
477        }
478
479      @Override
480      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
481        switch (hash) {
482        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : new Base[] {this.agent}; // Reference
483        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
484        default: return super.getProperty(hash, name, checkValid);
485        }
486
487      }
488
489      @Override
490      public Base setProperty(int hash, String name, Base value) throws FHIRException {
491        switch (hash) {
492        case 92750597: // agent
493          this.agent = castToReference(value); // Reference
494          return value;
495        case -14402964: // onBehalfOf
496          this.onBehalfOf = castToReference(value); // Reference
497          return value;
498        default: return super.setProperty(hash, name, value);
499        }
500
501      }
502
503      @Override
504      public Base setProperty(String name, Base value) throws FHIRException {
505        if (name.equals("agent")) {
506          this.agent = castToReference(value); // Reference
507        } else if (name.equals("onBehalfOf")) {
508          this.onBehalfOf = castToReference(value); // Reference
509        } else
510          return super.setProperty(name, value);
511        return value;
512      }
513
514      @Override
515      public Base makeProperty(int hash, String name) throws FHIRException {
516        switch (hash) {
517        case 92750597:  return getAgent(); 
518        case -14402964:  return getOnBehalfOf(); 
519        default: return super.makeProperty(hash, name);
520        }
521
522      }
523
524      @Override
525      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
526        switch (hash) {
527        case 92750597: /*agent*/ return new String[] {"Reference"};
528        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
529        default: return super.getTypesForProperty(hash, name);
530        }
531
532      }
533
534      @Override
535      public Base addChild(String name) throws FHIRException {
536        if (name.equals("agent")) {
537          this.agent = new Reference();
538          return this.agent;
539        }
540        else if (name.equals("onBehalfOf")) {
541          this.onBehalfOf = new Reference();
542          return this.onBehalfOf;
543        }
544        else
545          return super.addChild(name);
546      }
547
548      public DeviceRequestRequesterComponent copy() {
549        DeviceRequestRequesterComponent dst = new DeviceRequestRequesterComponent();
550        copyValues(dst);
551        dst.agent = agent == null ? null : agent.copy();
552        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
553        return dst;
554      }
555
556      @Override
557      public boolean equalsDeep(Base other) {
558        if (!super.equalsDeep(other))
559          return false;
560        if (!(other instanceof DeviceRequestRequesterComponent))
561          return false;
562        DeviceRequestRequesterComponent o = (DeviceRequestRequesterComponent) other;
563        return compareDeep(agent, o.agent, true) && compareDeep(onBehalfOf, o.onBehalfOf, true);
564      }
565
566      @Override
567      public boolean equalsShallow(Base other) {
568        if (!super.equalsShallow(other))
569          return false;
570        if (!(other instanceof DeviceRequestRequesterComponent))
571          return false;
572        DeviceRequestRequesterComponent o = (DeviceRequestRequesterComponent) other;
573        return true;
574      }
575
576      public boolean isEmpty() {
577        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(agent, onBehalfOf);
578      }
579
580  public String fhirType() {
581    return "DeviceRequest.requester";
582
583  }
584
585  }
586
587    /**
588     * Identifiers assigned to this order by the orderer or by the receiver.
589     */
590    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
591    @Description(shortDefinition="External Request identifier", formalDefinition="Identifiers assigned to this order by the orderer or by the receiver." )
592    protected List<Identifier> identifier;
593
594    /**
595     * Protocol or definition followed by this request. For example: The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.
596     */
597    @Child(name = "definition", type = {ActivityDefinition.class, PlanDefinition.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
598    @Description(shortDefinition="Protocol or definition", formalDefinition="Protocol or definition followed by this request. For example: The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%." )
599    protected List<Reference> definition;
600    /**
601     * The actual objects that are the target of the reference (Protocol or definition followed by this request. For example: The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.)
602     */
603    protected List<Resource> definitionTarget;
604
605
606    /**
607     * Plan/proposal/order fulfilled by this request.
608     */
609    @Child(name = "basedOn", type = {Reference.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
610    @Description(shortDefinition="What request fulfills", formalDefinition="Plan/proposal/order fulfilled by this request." )
611    protected List<Reference> basedOn;
612    /**
613     * The actual objects that are the target of the reference (Plan/proposal/order fulfilled by this request.)
614     */
615    protected List<Resource> basedOnTarget;
616
617
618    /**
619     * The request takes the place of the referenced completed or terminated request(s).
620     */
621    @Child(name = "priorRequest", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
622    @Description(shortDefinition="What request replaces", formalDefinition="The request takes the place of the referenced completed or terminated request(s)." )
623    protected List<Reference> priorRequest;
624    /**
625     * The actual objects that are the target of the reference (The request takes the place of the referenced completed or terminated request(s).)
626     */
627    protected List<Resource> priorRequestTarget;
628
629
630    /**
631     * Composite request this is part of.
632     */
633    @Child(name = "groupIdentifier", type = {Identifier.class}, order=4, min=0, max=1, modifier=false, summary=true)
634    @Description(shortDefinition="Identifier of composite request", formalDefinition="Composite request this is part of." )
635    protected Identifier groupIdentifier;
636
637    /**
638     * The status of the request.
639     */
640    @Child(name = "status", type = {CodeType.class}, order=5, min=0, max=1, modifier=true, summary=true)
641    @Description(shortDefinition="draft | active | suspended | completed | entered-in-error | cancelled", formalDefinition="The status of the request." )
642    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
643    protected Enumeration<DeviceRequestStatus> status;
644
645    /**
646     * Whether the request is a proposal, plan, an original order or a reflex order.
647     */
648    @Child(name = "intent", type = {CodeableConcept.class}, order=6, min=1, max=1, modifier=true, summary=true)
649    @Description(shortDefinition="proposal | plan | original-order | encoded | reflex-order", formalDefinition="Whether the request is a proposal, plan, an original order or a reflex order." )
650    protected CodeableConcept intent;
651
652    /**
653     * Indicates how quickly the {{title}} should be addressed with respect to other requests.
654     */
655    @Child(name = "priority", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
656    @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." )
657    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
658    protected Enumeration<RequestPriority> priority;
659
660    /**
661     * The details of the device to be used.
662     */
663    @Child(name = "code", type = {Device.class, CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=true)
664    @Description(shortDefinition="Device requested", formalDefinition="The details of the device to be used." )
665    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-kind")
666    protected Type code;
667
668    /**
669     * The patient who will use the device.
670     */
671    @Child(name = "subject", type = {Patient.class, Group.class, Location.class, Device.class}, order=9, min=1, max=1, modifier=false, summary=true)
672    @Description(shortDefinition="Focus of request", formalDefinition="The patient who will use the device." )
673    protected Reference subject;
674
675    /**
676     * The actual object that is the target of the reference (The patient who will use the device.)
677     */
678    protected Resource subjectTarget;
679
680    /**
681     * An encounter that provides additional context in which this request is made.
682     */
683    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=10, min=0, max=1, modifier=false, summary=true)
684    @Description(shortDefinition="Encounter or Episode motivating request", formalDefinition="An encounter that provides additional context in which this request is made." )
685    protected Reference context;
686
687    /**
688     * The actual object that is the target of the reference (An encounter that provides additional context in which this request is made.)
689     */
690    protected Resource contextTarget;
691
692    /**
693     * 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".
694     */
695    @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=11, min=0, max=1, modifier=false, summary=true)
696    @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\"." )
697    protected Type occurrence;
698
699    /**
700     * When the request transitioned to being actionable.
701     */
702    @Child(name = "authoredOn", type = {DateTimeType.class}, order=12, min=0, max=1, modifier=false, summary=true)
703    @Description(shortDefinition="When recorded", formalDefinition="When the request transitioned to being actionable." )
704    protected DateTimeType authoredOn;
705
706    /**
707     * The individual who initiated the request and has responsibility for its activation.
708     */
709    @Child(name = "requester", type = {}, order=13, min=0, max=1, modifier=false, summary=true)
710    @Description(shortDefinition="Who/what is requesting diagnostics", formalDefinition="The individual who initiated the request and has responsibility for its activation." )
711    protected DeviceRequestRequesterComponent requester;
712
713    /**
714     * Desired type of performer for doing the diagnostic testing.
715     */
716    @Child(name = "performerType", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=true)
717    @Description(shortDefinition="Fille role", formalDefinition="Desired type of performer for doing the diagnostic testing." )
718    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-role")
719    protected CodeableConcept performerType;
720
721    /**
722     * The desired perfomer for doing the diagnostic testing.
723     */
724    @Child(name = "performer", type = {Practitioner.class, Organization.class, Patient.class, Device.class, RelatedPerson.class, HealthcareService.class}, order=15, min=0, max=1, modifier=false, summary=true)
725    @Description(shortDefinition="Requested Filler", formalDefinition="The desired perfomer for doing the diagnostic testing." )
726    protected Reference performer;
727
728    /**
729     * The actual object that is the target of the reference (The desired perfomer for doing the diagnostic testing.)
730     */
731    protected Resource performerTarget;
732
733    /**
734     * Reason or justification for the use of this device.
735     */
736    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
737    @Description(shortDefinition="Coded Reason for request", formalDefinition="Reason or justification for the use of this device." )
738    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
739    protected List<CodeableConcept> reasonCode;
740
741    /**
742     * Reason or justification for the use of this device.
743     */
744    @Child(name = "reasonReference", type = {Reference.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
745    @Description(shortDefinition="Linked Reason for request", formalDefinition="Reason or justification for the use of this device." )
746    protected List<Reference> reasonReference;
747    /**
748     * The actual objects that are the target of the reference (Reason or justification for the use of this device.)
749     */
750    protected List<Resource> reasonReferenceTarget;
751
752
753    /**
754     * Additional clinical information about the patient that may influence the request fulfilment.  For example, this may includes body where on the subject's the device will be used ( i.e. the target site).
755     */
756    @Child(name = "supportingInfo", type = {Reference.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
757    @Description(shortDefinition="Additional clinical information", formalDefinition="Additional clinical information about the patient that may influence the request fulfilment.  For example, this may includes body where on the subject's the device will be used ( i.e. the target site)." )
758    protected List<Reference> supportingInfo;
759    /**
760     * 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 includes body where on the subject's the device will be used ( i.e. the target site).)
761     */
762    protected List<Resource> supportingInfoTarget;
763
764
765    /**
766     * 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.
767     */
768    @Child(name = "note", type = {Annotation.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
769    @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." )
770    protected List<Annotation> note;
771
772    /**
773     * Key events in the history of the request.
774     */
775    @Child(name = "relevantHistory", type = {Provenance.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
776    @Description(shortDefinition="Request provenance", formalDefinition="Key events in the history of the request." )
777    protected List<Reference> relevantHistory;
778    /**
779     * The actual objects that are the target of the reference (Key events in the history of the request.)
780     */
781    protected List<Provenance> relevantHistoryTarget;
782
783
784    private static final long serialVersionUID = -2002514925L;
785
786  /**
787   * Constructor
788   */
789    public DeviceRequest() {
790      super();
791    }
792
793  /**
794   * Constructor
795   */
796    public DeviceRequest(CodeableConcept intent, Type code, Reference subject) {
797      super();
798      this.intent = intent;
799      this.code = code;
800      this.subject = subject;
801    }
802
803    /**
804     * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.)
805     */
806    public List<Identifier> getIdentifier() { 
807      if (this.identifier == null)
808        this.identifier = new ArrayList<Identifier>();
809      return this.identifier;
810    }
811
812    /**
813     * @return Returns a reference to <code>this</code> for easy method chaining
814     */
815    public DeviceRequest setIdentifier(List<Identifier> theIdentifier) { 
816      this.identifier = theIdentifier;
817      return this;
818    }
819
820    public boolean hasIdentifier() { 
821      if (this.identifier == null)
822        return false;
823      for (Identifier item : this.identifier)
824        if (!item.isEmpty())
825          return true;
826      return false;
827    }
828
829    public Identifier addIdentifier() { //3
830      Identifier t = new Identifier();
831      if (this.identifier == null)
832        this.identifier = new ArrayList<Identifier>();
833      this.identifier.add(t);
834      return t;
835    }
836
837    public DeviceRequest addIdentifier(Identifier t) { //3
838      if (t == null)
839        return this;
840      if (this.identifier == null)
841        this.identifier = new ArrayList<Identifier>();
842      this.identifier.add(t);
843      return this;
844    }
845
846    /**
847     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
848     */
849    public Identifier getIdentifierFirstRep() { 
850      if (getIdentifier().isEmpty()) {
851        addIdentifier();
852      }
853      return getIdentifier().get(0);
854    }
855
856    /**
857     * @return {@link #definition} (Protocol or definition followed by this request. For example: The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.)
858     */
859    public List<Reference> getDefinition() { 
860      if (this.definition == null)
861        this.definition = new ArrayList<Reference>();
862      return this.definition;
863    }
864
865    /**
866     * @return Returns a reference to <code>this</code> for easy method chaining
867     */
868    public DeviceRequest setDefinition(List<Reference> theDefinition) { 
869      this.definition = theDefinition;
870      return this;
871    }
872
873    public boolean hasDefinition() { 
874      if (this.definition == null)
875        return false;
876      for (Reference item : this.definition)
877        if (!item.isEmpty())
878          return true;
879      return false;
880    }
881
882    public Reference addDefinition() { //3
883      Reference t = new Reference();
884      if (this.definition == null)
885        this.definition = new ArrayList<Reference>();
886      this.definition.add(t);
887      return t;
888    }
889
890    public DeviceRequest addDefinition(Reference t) { //3
891      if (t == null)
892        return this;
893      if (this.definition == null)
894        this.definition = new ArrayList<Reference>();
895      this.definition.add(t);
896      return this;
897    }
898
899    /**
900     * @return The first repetition of repeating field {@link #definition}, creating it if it does not already exist
901     */
902    public Reference getDefinitionFirstRep() { 
903      if (getDefinition().isEmpty()) {
904        addDefinition();
905      }
906      return getDefinition().get(0);
907    }
908
909    /**
910     * @deprecated Use Reference#setResource(IBaseResource) instead
911     */
912    @Deprecated
913    public List<Resource> getDefinitionTarget() { 
914      if (this.definitionTarget == null)
915        this.definitionTarget = new ArrayList<Resource>();
916      return this.definitionTarget;
917    }
918
919    /**
920     * @return {@link #basedOn} (Plan/proposal/order fulfilled by this request.)
921     */
922    public List<Reference> getBasedOn() { 
923      if (this.basedOn == null)
924        this.basedOn = new ArrayList<Reference>();
925      return this.basedOn;
926    }
927
928    /**
929     * @return Returns a reference to <code>this</code> for easy method chaining
930     */
931    public DeviceRequest setBasedOn(List<Reference> theBasedOn) { 
932      this.basedOn = theBasedOn;
933      return this;
934    }
935
936    public boolean hasBasedOn() { 
937      if (this.basedOn == null)
938        return false;
939      for (Reference item : this.basedOn)
940        if (!item.isEmpty())
941          return true;
942      return false;
943    }
944
945    public Reference addBasedOn() { //3
946      Reference t = new Reference();
947      if (this.basedOn == null)
948        this.basedOn = new ArrayList<Reference>();
949      this.basedOn.add(t);
950      return t;
951    }
952
953    public DeviceRequest addBasedOn(Reference t) { //3
954      if (t == null)
955        return this;
956      if (this.basedOn == null)
957        this.basedOn = new ArrayList<Reference>();
958      this.basedOn.add(t);
959      return this;
960    }
961
962    /**
963     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
964     */
965    public Reference getBasedOnFirstRep() { 
966      if (getBasedOn().isEmpty()) {
967        addBasedOn();
968      }
969      return getBasedOn().get(0);
970    }
971
972    /**
973     * @deprecated Use Reference#setResource(IBaseResource) instead
974     */
975    @Deprecated
976    public List<Resource> getBasedOnTarget() { 
977      if (this.basedOnTarget == null)
978        this.basedOnTarget = new ArrayList<Resource>();
979      return this.basedOnTarget;
980    }
981
982    /**
983     * @return {@link #priorRequest} (The request takes the place of the referenced completed or terminated request(s).)
984     */
985    public List<Reference> getPriorRequest() { 
986      if (this.priorRequest == null)
987        this.priorRequest = new ArrayList<Reference>();
988      return this.priorRequest;
989    }
990
991    /**
992     * @return Returns a reference to <code>this</code> for easy method chaining
993     */
994    public DeviceRequest setPriorRequest(List<Reference> thePriorRequest) { 
995      this.priorRequest = thePriorRequest;
996      return this;
997    }
998
999    public boolean hasPriorRequest() { 
1000      if (this.priorRequest == null)
1001        return false;
1002      for (Reference item : this.priorRequest)
1003        if (!item.isEmpty())
1004          return true;
1005      return false;
1006    }
1007
1008    public Reference addPriorRequest() { //3
1009      Reference t = new Reference();
1010      if (this.priorRequest == null)
1011        this.priorRequest = new ArrayList<Reference>();
1012      this.priorRequest.add(t);
1013      return t;
1014    }
1015
1016    public DeviceRequest addPriorRequest(Reference t) { //3
1017      if (t == null)
1018        return this;
1019      if (this.priorRequest == null)
1020        this.priorRequest = new ArrayList<Reference>();
1021      this.priorRequest.add(t);
1022      return this;
1023    }
1024
1025    /**
1026     * @return The first repetition of repeating field {@link #priorRequest}, creating it if it does not already exist
1027     */
1028    public Reference getPriorRequestFirstRep() { 
1029      if (getPriorRequest().isEmpty()) {
1030        addPriorRequest();
1031      }
1032      return getPriorRequest().get(0);
1033    }
1034
1035    /**
1036     * @deprecated Use Reference#setResource(IBaseResource) instead
1037     */
1038    @Deprecated
1039    public List<Resource> getPriorRequestTarget() { 
1040      if (this.priorRequestTarget == null)
1041        this.priorRequestTarget = new ArrayList<Resource>();
1042      return this.priorRequestTarget;
1043    }
1044
1045    /**
1046     * @return {@link #groupIdentifier} (Composite request this is part of.)
1047     */
1048    public Identifier getGroupIdentifier() { 
1049      if (this.groupIdentifier == null)
1050        if (Configuration.errorOnAutoCreate())
1051          throw new Error("Attempt to auto-create DeviceRequest.groupIdentifier");
1052        else if (Configuration.doAutoCreate())
1053          this.groupIdentifier = new Identifier(); // cc
1054      return this.groupIdentifier;
1055    }
1056
1057    public boolean hasGroupIdentifier() { 
1058      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
1059    }
1060
1061    /**
1062     * @param value {@link #groupIdentifier} (Composite request this is part of.)
1063     */
1064    public DeviceRequest setGroupIdentifier(Identifier value) { 
1065      this.groupIdentifier = value;
1066      return this;
1067    }
1068
1069    /**
1070     * @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
1071     */
1072    public Enumeration<DeviceRequestStatus> getStatusElement() { 
1073      if (this.status == null)
1074        if (Configuration.errorOnAutoCreate())
1075          throw new Error("Attempt to auto-create DeviceRequest.status");
1076        else if (Configuration.doAutoCreate())
1077          this.status = new Enumeration<DeviceRequestStatus>(new DeviceRequestStatusEnumFactory()); // bb
1078      return this.status;
1079    }
1080
1081    public boolean hasStatusElement() { 
1082      return this.status != null && !this.status.isEmpty();
1083    }
1084
1085    public boolean hasStatus() { 
1086      return this.status != null && !this.status.isEmpty();
1087    }
1088
1089    /**
1090     * @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
1091     */
1092    public DeviceRequest setStatusElement(Enumeration<DeviceRequestStatus> value) { 
1093      this.status = value;
1094      return this;
1095    }
1096
1097    /**
1098     * @return The status of the request.
1099     */
1100    public DeviceRequestStatus getStatus() { 
1101      return this.status == null ? null : this.status.getValue();
1102    }
1103
1104    /**
1105     * @param value The status of the request.
1106     */
1107    public DeviceRequest setStatus(DeviceRequestStatus value) { 
1108      if (value == null)
1109        this.status = null;
1110      else {
1111        if (this.status == null)
1112          this.status = new Enumeration<DeviceRequestStatus>(new DeviceRequestStatusEnumFactory());
1113        this.status.setValue(value);
1114      }
1115      return this;
1116    }
1117
1118    /**
1119     * @return {@link #intent} (Whether the request is a proposal, plan, an original order or a reflex order.)
1120     */
1121    public CodeableConcept getIntent() { 
1122      if (this.intent == null)
1123        if (Configuration.errorOnAutoCreate())
1124          throw new Error("Attempt to auto-create DeviceRequest.intent");
1125        else if (Configuration.doAutoCreate())
1126          this.intent = new CodeableConcept(); // cc
1127      return this.intent;
1128    }
1129
1130    public boolean hasIntent() { 
1131      return this.intent != null && !this.intent.isEmpty();
1132    }
1133
1134    /**
1135     * @param value {@link #intent} (Whether the request is a proposal, plan, an original order or a reflex order.)
1136     */
1137    public DeviceRequest setIntent(CodeableConcept value) { 
1138      this.intent = value;
1139      return this;
1140    }
1141
1142    /**
1143     * @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
1144     */
1145    public Enumeration<RequestPriority> getPriorityElement() { 
1146      if (this.priority == null)
1147        if (Configuration.errorOnAutoCreate())
1148          throw new Error("Attempt to auto-create DeviceRequest.priority");
1149        else if (Configuration.doAutoCreate())
1150          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
1151      return this.priority;
1152    }
1153
1154    public boolean hasPriorityElement() { 
1155      return this.priority != null && !this.priority.isEmpty();
1156    }
1157
1158    public boolean hasPriority() { 
1159      return this.priority != null && !this.priority.isEmpty();
1160    }
1161
1162    /**
1163     * @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
1164     */
1165    public DeviceRequest setPriorityElement(Enumeration<RequestPriority> value) { 
1166      this.priority = value;
1167      return this;
1168    }
1169
1170    /**
1171     * @return Indicates how quickly the {{title}} should be addressed with respect to other requests.
1172     */
1173    public RequestPriority getPriority() { 
1174      return this.priority == null ? null : this.priority.getValue();
1175    }
1176
1177    /**
1178     * @param value Indicates how quickly the {{title}} should be addressed with respect to other requests.
1179     */
1180    public DeviceRequest setPriority(RequestPriority value) { 
1181      if (value == null)
1182        this.priority = null;
1183      else {
1184        if (this.priority == null)
1185          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
1186        this.priority.setValue(value);
1187      }
1188      return this;
1189    }
1190
1191    /**
1192     * @return {@link #code} (The details of the device to be used.)
1193     */
1194    public Type getCode() { 
1195      return this.code;
1196    }
1197
1198    /**
1199     * @return {@link #code} (The details of the device to be used.)
1200     */
1201    public Reference getCodeReference() throws FHIRException { 
1202      if (!(this.code instanceof Reference))
1203        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.code.getClass().getName()+" was encountered");
1204      return (Reference) this.code;
1205    }
1206
1207    public boolean hasCodeReference() { 
1208      return this.code instanceof Reference;
1209    }
1210
1211    /**
1212     * @return {@link #code} (The details of the device to be used.)
1213     */
1214    public CodeableConcept getCodeCodeableConcept() throws FHIRException { 
1215      if (!(this.code instanceof CodeableConcept))
1216        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.code.getClass().getName()+" was encountered");
1217      return (CodeableConcept) this.code;
1218    }
1219
1220    public boolean hasCodeCodeableConcept() { 
1221      return this.code instanceof CodeableConcept;
1222    }
1223
1224    public boolean hasCode() { 
1225      return this.code != null && !this.code.isEmpty();
1226    }
1227
1228    /**
1229     * @param value {@link #code} (The details of the device to be used.)
1230     */
1231    public DeviceRequest setCode(Type value) { 
1232      this.code = value;
1233      return this;
1234    }
1235
1236    /**
1237     * @return {@link #subject} (The patient who will use the device.)
1238     */
1239    public Reference getSubject() { 
1240      if (this.subject == null)
1241        if (Configuration.errorOnAutoCreate())
1242          throw new Error("Attempt to auto-create DeviceRequest.subject");
1243        else if (Configuration.doAutoCreate())
1244          this.subject = new Reference(); // cc
1245      return this.subject;
1246    }
1247
1248    public boolean hasSubject() { 
1249      return this.subject != null && !this.subject.isEmpty();
1250    }
1251
1252    /**
1253     * @param value {@link #subject} (The patient who will use the device.)
1254     */
1255    public DeviceRequest setSubject(Reference value) { 
1256      this.subject = value;
1257      return this;
1258    }
1259
1260    /**
1261     * @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.)
1262     */
1263    public Resource getSubjectTarget() { 
1264      return this.subjectTarget;
1265    }
1266
1267    /**
1268     * @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.)
1269     */
1270    public DeviceRequest setSubjectTarget(Resource value) { 
1271      this.subjectTarget = value;
1272      return this;
1273    }
1274
1275    /**
1276     * @return {@link #context} (An encounter that provides additional context in which this request is made.)
1277     */
1278    public Reference getContext() { 
1279      if (this.context == null)
1280        if (Configuration.errorOnAutoCreate())
1281          throw new Error("Attempt to auto-create DeviceRequest.context");
1282        else if (Configuration.doAutoCreate())
1283          this.context = new Reference(); // cc
1284      return this.context;
1285    }
1286
1287    public boolean hasContext() { 
1288      return this.context != null && !this.context.isEmpty();
1289    }
1290
1291    /**
1292     * @param value {@link #context} (An encounter that provides additional context in which this request is made.)
1293     */
1294    public DeviceRequest setContext(Reference value) { 
1295      this.context = value;
1296      return this;
1297    }
1298
1299    /**
1300     * @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.)
1301     */
1302    public Resource getContextTarget() { 
1303      return this.contextTarget;
1304    }
1305
1306    /**
1307     * @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.)
1308     */
1309    public DeviceRequest setContextTarget(Resource value) { 
1310      this.contextTarget = value;
1311      return this;
1312    }
1313
1314    /**
1315     * @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".)
1316     */
1317    public Type getOccurrence() { 
1318      return this.occurrence;
1319    }
1320
1321    /**
1322     * @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".)
1323     */
1324    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1325      if (!(this.occurrence instanceof DateTimeType))
1326        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1327      return (DateTimeType) this.occurrence;
1328    }
1329
1330    public boolean hasOccurrenceDateTimeType() { 
1331      return this.occurrence instanceof DateTimeType;
1332    }
1333
1334    /**
1335     * @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".)
1336     */
1337    public Period getOccurrencePeriod() throws FHIRException { 
1338      if (!(this.occurrence instanceof Period))
1339        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1340      return (Period) this.occurrence;
1341    }
1342
1343    public boolean hasOccurrencePeriod() { 
1344      return this.occurrence instanceof Period;
1345    }
1346
1347    /**
1348     * @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".)
1349     */
1350    public Timing getOccurrenceTiming() throws FHIRException { 
1351      if (!(this.occurrence instanceof Timing))
1352        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1353      return (Timing) this.occurrence;
1354    }
1355
1356    public boolean hasOccurrenceTiming() { 
1357      return this.occurrence instanceof Timing;
1358    }
1359
1360    public boolean hasOccurrence() { 
1361      return this.occurrence != null && !this.occurrence.isEmpty();
1362    }
1363
1364    /**
1365     * @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".)
1366     */
1367    public DeviceRequest setOccurrence(Type value) { 
1368      this.occurrence = value;
1369      return this;
1370    }
1371
1372    /**
1373     * @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
1374     */
1375    public DateTimeType getAuthoredOnElement() { 
1376      if (this.authoredOn == null)
1377        if (Configuration.errorOnAutoCreate())
1378          throw new Error("Attempt to auto-create DeviceRequest.authoredOn");
1379        else if (Configuration.doAutoCreate())
1380          this.authoredOn = new DateTimeType(); // bb
1381      return this.authoredOn;
1382    }
1383
1384    public boolean hasAuthoredOnElement() { 
1385      return this.authoredOn != null && !this.authoredOn.isEmpty();
1386    }
1387
1388    public boolean hasAuthoredOn() { 
1389      return this.authoredOn != null && !this.authoredOn.isEmpty();
1390    }
1391
1392    /**
1393     * @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
1394     */
1395    public DeviceRequest setAuthoredOnElement(DateTimeType value) { 
1396      this.authoredOn = value;
1397      return this;
1398    }
1399
1400    /**
1401     * @return When the request transitioned to being actionable.
1402     */
1403    public Date getAuthoredOn() { 
1404      return this.authoredOn == null ? null : this.authoredOn.getValue();
1405    }
1406
1407    /**
1408     * @param value When the request transitioned to being actionable.
1409     */
1410    public DeviceRequest setAuthoredOn(Date value) { 
1411      if (value == null)
1412        this.authoredOn = null;
1413      else {
1414        if (this.authoredOn == null)
1415          this.authoredOn = new DateTimeType();
1416        this.authoredOn.setValue(value);
1417      }
1418      return this;
1419    }
1420
1421    /**
1422     * @return {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1423     */
1424    public DeviceRequestRequesterComponent getRequester() { 
1425      if (this.requester == null)
1426        if (Configuration.errorOnAutoCreate())
1427          throw new Error("Attempt to auto-create DeviceRequest.requester");
1428        else if (Configuration.doAutoCreate())
1429          this.requester = new DeviceRequestRequesterComponent(); // cc
1430      return this.requester;
1431    }
1432
1433    public boolean hasRequester() { 
1434      return this.requester != null && !this.requester.isEmpty();
1435    }
1436
1437    /**
1438     * @param value {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1439     */
1440    public DeviceRequest setRequester(DeviceRequestRequesterComponent value) { 
1441      this.requester = value;
1442      return this;
1443    }
1444
1445    /**
1446     * @return {@link #performerType} (Desired type of performer for doing the diagnostic testing.)
1447     */
1448    public CodeableConcept getPerformerType() { 
1449      if (this.performerType == null)
1450        if (Configuration.errorOnAutoCreate())
1451          throw new Error("Attempt to auto-create DeviceRequest.performerType");
1452        else if (Configuration.doAutoCreate())
1453          this.performerType = new CodeableConcept(); // cc
1454      return this.performerType;
1455    }
1456
1457    public boolean hasPerformerType() { 
1458      return this.performerType != null && !this.performerType.isEmpty();
1459    }
1460
1461    /**
1462     * @param value {@link #performerType} (Desired type of performer for doing the diagnostic testing.)
1463     */
1464    public DeviceRequest setPerformerType(CodeableConcept value) { 
1465      this.performerType = value;
1466      return this;
1467    }
1468
1469    /**
1470     * @return {@link #performer} (The desired perfomer for doing the diagnostic testing.)
1471     */
1472    public Reference getPerformer() { 
1473      if (this.performer == null)
1474        if (Configuration.errorOnAutoCreate())
1475          throw new Error("Attempt to auto-create DeviceRequest.performer");
1476        else if (Configuration.doAutoCreate())
1477          this.performer = new Reference(); // cc
1478      return this.performer;
1479    }
1480
1481    public boolean hasPerformer() { 
1482      return this.performer != null && !this.performer.isEmpty();
1483    }
1484
1485    /**
1486     * @param value {@link #performer} (The desired perfomer for doing the diagnostic testing.)
1487     */
1488    public DeviceRequest setPerformer(Reference value) { 
1489      this.performer = value;
1490      return this;
1491    }
1492
1493    /**
1494     * @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 perfomer for doing the diagnostic testing.)
1495     */
1496    public Resource getPerformerTarget() { 
1497      return this.performerTarget;
1498    }
1499
1500    /**
1501     * @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 perfomer for doing the diagnostic testing.)
1502     */
1503    public DeviceRequest setPerformerTarget(Resource value) { 
1504      this.performerTarget = value;
1505      return this;
1506    }
1507
1508    /**
1509     * @return {@link #reasonCode} (Reason or justification for the use of this device.)
1510     */
1511    public List<CodeableConcept> getReasonCode() { 
1512      if (this.reasonCode == null)
1513        this.reasonCode = new ArrayList<CodeableConcept>();
1514      return this.reasonCode;
1515    }
1516
1517    /**
1518     * @return Returns a reference to <code>this</code> for easy method chaining
1519     */
1520    public DeviceRequest setReasonCode(List<CodeableConcept> theReasonCode) { 
1521      this.reasonCode = theReasonCode;
1522      return this;
1523    }
1524
1525    public boolean hasReasonCode() { 
1526      if (this.reasonCode == null)
1527        return false;
1528      for (CodeableConcept item : this.reasonCode)
1529        if (!item.isEmpty())
1530          return true;
1531      return false;
1532    }
1533
1534    public CodeableConcept addReasonCode() { //3
1535      CodeableConcept t = new CodeableConcept();
1536      if (this.reasonCode == null)
1537        this.reasonCode = new ArrayList<CodeableConcept>();
1538      this.reasonCode.add(t);
1539      return t;
1540    }
1541
1542    public DeviceRequest addReasonCode(CodeableConcept t) { //3
1543      if (t == null)
1544        return this;
1545      if (this.reasonCode == null)
1546        this.reasonCode = new ArrayList<CodeableConcept>();
1547      this.reasonCode.add(t);
1548      return this;
1549    }
1550
1551    /**
1552     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1553     */
1554    public CodeableConcept getReasonCodeFirstRep() { 
1555      if (getReasonCode().isEmpty()) {
1556        addReasonCode();
1557      }
1558      return getReasonCode().get(0);
1559    }
1560
1561    /**
1562     * @return {@link #reasonReference} (Reason or justification for the use of this device.)
1563     */
1564    public List<Reference> getReasonReference() { 
1565      if (this.reasonReference == null)
1566        this.reasonReference = new ArrayList<Reference>();
1567      return this.reasonReference;
1568    }
1569
1570    /**
1571     * @return Returns a reference to <code>this</code> for easy method chaining
1572     */
1573    public DeviceRequest setReasonReference(List<Reference> theReasonReference) { 
1574      this.reasonReference = theReasonReference;
1575      return this;
1576    }
1577
1578    public boolean hasReasonReference() { 
1579      if (this.reasonReference == null)
1580        return false;
1581      for (Reference item : this.reasonReference)
1582        if (!item.isEmpty())
1583          return true;
1584      return false;
1585    }
1586
1587    public Reference addReasonReference() { //3
1588      Reference t = new Reference();
1589      if (this.reasonReference == null)
1590        this.reasonReference = new ArrayList<Reference>();
1591      this.reasonReference.add(t);
1592      return t;
1593    }
1594
1595    public DeviceRequest addReasonReference(Reference t) { //3
1596      if (t == null)
1597        return this;
1598      if (this.reasonReference == null)
1599        this.reasonReference = new ArrayList<Reference>();
1600      this.reasonReference.add(t);
1601      return this;
1602    }
1603
1604    /**
1605     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1606     */
1607    public Reference getReasonReferenceFirstRep() { 
1608      if (getReasonReference().isEmpty()) {
1609        addReasonReference();
1610      }
1611      return getReasonReference().get(0);
1612    }
1613
1614    /**
1615     * @deprecated Use Reference#setResource(IBaseResource) instead
1616     */
1617    @Deprecated
1618    public List<Resource> getReasonReferenceTarget() { 
1619      if (this.reasonReferenceTarget == null)
1620        this.reasonReferenceTarget = new ArrayList<Resource>();
1621      return this.reasonReferenceTarget;
1622    }
1623
1624    /**
1625     * @return {@link #supportingInfo} (Additional clinical information about the patient that may influence the request fulfilment.  For example, this may includes body where on the subject's the device will be used ( i.e. the target site).)
1626     */
1627    public List<Reference> getSupportingInfo() { 
1628      if (this.supportingInfo == null)
1629        this.supportingInfo = new ArrayList<Reference>();
1630      return this.supportingInfo;
1631    }
1632
1633    /**
1634     * @return Returns a reference to <code>this</code> for easy method chaining
1635     */
1636    public DeviceRequest setSupportingInfo(List<Reference> theSupportingInfo) { 
1637      this.supportingInfo = theSupportingInfo;
1638      return this;
1639    }
1640
1641    public boolean hasSupportingInfo() { 
1642      if (this.supportingInfo == null)
1643        return false;
1644      for (Reference item : this.supportingInfo)
1645        if (!item.isEmpty())
1646          return true;
1647      return false;
1648    }
1649
1650    public Reference addSupportingInfo() { //3
1651      Reference t = new Reference();
1652      if (this.supportingInfo == null)
1653        this.supportingInfo = new ArrayList<Reference>();
1654      this.supportingInfo.add(t);
1655      return t;
1656    }
1657
1658    public DeviceRequest addSupportingInfo(Reference t) { //3
1659      if (t == null)
1660        return this;
1661      if (this.supportingInfo == null)
1662        this.supportingInfo = new ArrayList<Reference>();
1663      this.supportingInfo.add(t);
1664      return this;
1665    }
1666
1667    /**
1668     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
1669     */
1670    public Reference getSupportingInfoFirstRep() { 
1671      if (getSupportingInfo().isEmpty()) {
1672        addSupportingInfo();
1673      }
1674      return getSupportingInfo().get(0);
1675    }
1676
1677    /**
1678     * @deprecated Use Reference#setResource(IBaseResource) instead
1679     */
1680    @Deprecated
1681    public List<Resource> getSupportingInfoTarget() { 
1682      if (this.supportingInfoTarget == null)
1683        this.supportingInfoTarget = new ArrayList<Resource>();
1684      return this.supportingInfoTarget;
1685    }
1686
1687    /**
1688     * @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.)
1689     */
1690    public List<Annotation> getNote() { 
1691      if (this.note == null)
1692        this.note = new ArrayList<Annotation>();
1693      return this.note;
1694    }
1695
1696    /**
1697     * @return Returns a reference to <code>this</code> for easy method chaining
1698     */
1699    public DeviceRequest setNote(List<Annotation> theNote) { 
1700      this.note = theNote;
1701      return this;
1702    }
1703
1704    public boolean hasNote() { 
1705      if (this.note == null)
1706        return false;
1707      for (Annotation item : this.note)
1708        if (!item.isEmpty())
1709          return true;
1710      return false;
1711    }
1712
1713    public Annotation addNote() { //3
1714      Annotation t = new Annotation();
1715      if (this.note == null)
1716        this.note = new ArrayList<Annotation>();
1717      this.note.add(t);
1718      return t;
1719    }
1720
1721    public DeviceRequest addNote(Annotation t) { //3
1722      if (t == null)
1723        return this;
1724      if (this.note == null)
1725        this.note = new ArrayList<Annotation>();
1726      this.note.add(t);
1727      return this;
1728    }
1729
1730    /**
1731     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1732     */
1733    public Annotation getNoteFirstRep() { 
1734      if (getNote().isEmpty()) {
1735        addNote();
1736      }
1737      return getNote().get(0);
1738    }
1739
1740    /**
1741     * @return {@link #relevantHistory} (Key events in the history of the request.)
1742     */
1743    public List<Reference> getRelevantHistory() { 
1744      if (this.relevantHistory == null)
1745        this.relevantHistory = new ArrayList<Reference>();
1746      return this.relevantHistory;
1747    }
1748
1749    /**
1750     * @return Returns a reference to <code>this</code> for easy method chaining
1751     */
1752    public DeviceRequest setRelevantHistory(List<Reference> theRelevantHistory) { 
1753      this.relevantHistory = theRelevantHistory;
1754      return this;
1755    }
1756
1757    public boolean hasRelevantHistory() { 
1758      if (this.relevantHistory == null)
1759        return false;
1760      for (Reference item : this.relevantHistory)
1761        if (!item.isEmpty())
1762          return true;
1763      return false;
1764    }
1765
1766    public Reference addRelevantHistory() { //3
1767      Reference t = new Reference();
1768      if (this.relevantHistory == null)
1769        this.relevantHistory = new ArrayList<Reference>();
1770      this.relevantHistory.add(t);
1771      return t;
1772    }
1773
1774    public DeviceRequest addRelevantHistory(Reference t) { //3
1775      if (t == null)
1776        return this;
1777      if (this.relevantHistory == null)
1778        this.relevantHistory = new ArrayList<Reference>();
1779      this.relevantHistory.add(t);
1780      return this;
1781    }
1782
1783    /**
1784     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist
1785     */
1786    public Reference getRelevantHistoryFirstRep() { 
1787      if (getRelevantHistory().isEmpty()) {
1788        addRelevantHistory();
1789      }
1790      return getRelevantHistory().get(0);
1791    }
1792
1793    /**
1794     * @deprecated Use Reference#setResource(IBaseResource) instead
1795     */
1796    @Deprecated
1797    public List<Provenance> getRelevantHistoryTarget() { 
1798      if (this.relevantHistoryTarget == null)
1799        this.relevantHistoryTarget = new ArrayList<Provenance>();
1800      return this.relevantHistoryTarget;
1801    }
1802
1803    /**
1804     * @deprecated Use Reference#setResource(IBaseResource) instead
1805     */
1806    @Deprecated
1807    public Provenance addRelevantHistoryTarget() { 
1808      Provenance r = new Provenance();
1809      if (this.relevantHistoryTarget == null)
1810        this.relevantHistoryTarget = new ArrayList<Provenance>();
1811      this.relevantHistoryTarget.add(r);
1812      return r;
1813    }
1814
1815      protected void listChildren(List<Property> childrenList) {
1816        super.listChildren(childrenList);
1817        childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
1818        childrenList.add(new Property("definition", "Reference(ActivityDefinition|PlanDefinition)", "Protocol or definition followed by this request. For example: The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.", 0, java.lang.Integer.MAX_VALUE, definition));
1819        childrenList.add(new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1820        childrenList.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));
1821        childrenList.add(new Property("groupIdentifier", "Identifier", "Composite request this is part of.", 0, java.lang.Integer.MAX_VALUE, groupIdentifier));
1822        childrenList.add(new Property("status", "code", "The status of the request.", 0, java.lang.Integer.MAX_VALUE, status));
1823        childrenList.add(new Property("intent", "CodeableConcept", "Whether the request is a proposal, plan, an original order or a reflex order.", 0, java.lang.Integer.MAX_VALUE, intent));
1824        childrenList.add(new Property("priority", "code", "Indicates how quickly the {{title}} should be addressed with respect to other requests.", 0, java.lang.Integer.MAX_VALUE, priority));
1825        childrenList.add(new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.", 0, java.lang.Integer.MAX_VALUE, code));
1826        childrenList.add(new Property("subject", "Reference(Patient|Group|Location|Device)", "The patient who will use the device.", 0, java.lang.Integer.MAX_VALUE, subject));
1827        childrenList.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "An encounter that provides additional context in which this request is made.", 0, java.lang.Integer.MAX_VALUE, context));
1828        childrenList.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, java.lang.Integer.MAX_VALUE, occurrence));
1829        childrenList.add(new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, java.lang.Integer.MAX_VALUE, authoredOn));
1830        childrenList.add(new Property("requester", "", "The individual who initiated the request and has responsibility for its activation.", 0, java.lang.Integer.MAX_VALUE, requester));
1831        childrenList.add(new Property("performerType", "CodeableConcept", "Desired type of performer for doing the diagnostic testing.", 0, java.lang.Integer.MAX_VALUE, performerType));
1832        childrenList.add(new Property("performer", "Reference(Practitioner|Organization|Patient|Device|RelatedPerson|HealthcareService)", "The desired perfomer for doing the diagnostic testing.", 0, java.lang.Integer.MAX_VALUE, performer));
1833        childrenList.add(new Property("reasonCode", "CodeableConcept", "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
1834        childrenList.add(new Property("reasonReference", "Reference(Any)", "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
1835        childrenList.add(new Property("supportingInfo", "Reference(Any)", "Additional clinical information about the patient that may influence the request fulfilment.  For example, this may includes body where on the subject's the device will be used ( i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
1836        childrenList.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));
1837        childrenList.add(new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory));
1838      }
1839
1840      @Override
1841      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1842        switch (hash) {
1843        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1844        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : this.definition.toArray(new Base[this.definition.size()]); // Reference
1845        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
1846        case 237568101: /*priorRequest*/ return this.priorRequest == null ? new Base[0] : this.priorRequest.toArray(new Base[this.priorRequest.size()]); // Reference
1847        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
1848        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DeviceRequestStatus>
1849        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // CodeableConcept
1850        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
1851        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Type
1852        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1853        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
1854        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type
1855        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
1856        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // DeviceRequestRequesterComponent
1857        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : new Base[] {this.performerType}; // CodeableConcept
1858        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
1859        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
1860        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
1861        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
1862        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1863        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
1864        default: return super.getProperty(hash, name, checkValid);
1865        }
1866
1867      }
1868
1869      @Override
1870      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1871        switch (hash) {
1872        case -1618432855: // identifier
1873          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1874          return value;
1875        case -1014418093: // definition
1876          this.getDefinition().add(castToReference(value)); // Reference
1877          return value;
1878        case -332612366: // basedOn
1879          this.getBasedOn().add(castToReference(value)); // Reference
1880          return value;
1881        case 237568101: // priorRequest
1882          this.getPriorRequest().add(castToReference(value)); // Reference
1883          return value;
1884        case -445338488: // groupIdentifier
1885          this.groupIdentifier = castToIdentifier(value); // Identifier
1886          return value;
1887        case -892481550: // status
1888          value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
1889          this.status = (Enumeration) value; // Enumeration<DeviceRequestStatus>
1890          return value;
1891        case -1183762788: // intent
1892          this.intent = castToCodeableConcept(value); // CodeableConcept
1893          return value;
1894        case -1165461084: // priority
1895          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
1896          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
1897          return value;
1898        case 3059181: // code
1899          this.code = castToType(value); // Type
1900          return value;
1901        case -1867885268: // subject
1902          this.subject = castToReference(value); // Reference
1903          return value;
1904        case 951530927: // context
1905          this.context = castToReference(value); // Reference
1906          return value;
1907        case 1687874001: // occurrence
1908          this.occurrence = castToType(value); // Type
1909          return value;
1910        case -1500852503: // authoredOn
1911          this.authoredOn = castToDateTime(value); // DateTimeType
1912          return value;
1913        case 693933948: // requester
1914          this.requester = (DeviceRequestRequesterComponent) value; // DeviceRequestRequesterComponent
1915          return value;
1916        case -901444568: // performerType
1917          this.performerType = castToCodeableConcept(value); // CodeableConcept
1918          return value;
1919        case 481140686: // performer
1920          this.performer = castToReference(value); // Reference
1921          return value;
1922        case 722137681: // reasonCode
1923          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
1924          return value;
1925        case -1146218137: // reasonReference
1926          this.getReasonReference().add(castToReference(value)); // Reference
1927          return value;
1928        case 1922406657: // supportingInfo
1929          this.getSupportingInfo().add(castToReference(value)); // Reference
1930          return value;
1931        case 3387378: // note
1932          this.getNote().add(castToAnnotation(value)); // Annotation
1933          return value;
1934        case 1538891575: // relevantHistory
1935          this.getRelevantHistory().add(castToReference(value)); // Reference
1936          return value;
1937        default: return super.setProperty(hash, name, value);
1938        }
1939
1940      }
1941
1942      @Override
1943      public Base setProperty(String name, Base value) throws FHIRException {
1944        if (name.equals("identifier")) {
1945          this.getIdentifier().add(castToIdentifier(value));
1946        } else if (name.equals("definition")) {
1947          this.getDefinition().add(castToReference(value));
1948        } else if (name.equals("basedOn")) {
1949          this.getBasedOn().add(castToReference(value));
1950        } else if (name.equals("priorRequest")) {
1951          this.getPriorRequest().add(castToReference(value));
1952        } else if (name.equals("groupIdentifier")) {
1953          this.groupIdentifier = castToIdentifier(value); // Identifier
1954        } else if (name.equals("status")) {
1955          value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
1956          this.status = (Enumeration) value; // Enumeration<DeviceRequestStatus>
1957        } else if (name.equals("intent")) {
1958          this.intent = castToCodeableConcept(value); // CodeableConcept
1959        } else if (name.equals("priority")) {
1960          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
1961          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
1962        } else if (name.equals("code[x]")) {
1963          this.code = castToType(value); // Type
1964        } else if (name.equals("subject")) {
1965          this.subject = castToReference(value); // Reference
1966        } else if (name.equals("context")) {
1967          this.context = castToReference(value); // Reference
1968        } else if (name.equals("occurrence[x]")) {
1969          this.occurrence = castToType(value); // Type
1970        } else if (name.equals("authoredOn")) {
1971          this.authoredOn = castToDateTime(value); // DateTimeType
1972        } else if (name.equals("requester")) {
1973          this.requester = (DeviceRequestRequesterComponent) value; // DeviceRequestRequesterComponent
1974        } else if (name.equals("performerType")) {
1975          this.performerType = castToCodeableConcept(value); // CodeableConcept
1976        } else if (name.equals("performer")) {
1977          this.performer = castToReference(value); // Reference
1978        } else if (name.equals("reasonCode")) {
1979          this.getReasonCode().add(castToCodeableConcept(value));
1980        } else if (name.equals("reasonReference")) {
1981          this.getReasonReference().add(castToReference(value));
1982        } else if (name.equals("supportingInfo")) {
1983          this.getSupportingInfo().add(castToReference(value));
1984        } else if (name.equals("note")) {
1985          this.getNote().add(castToAnnotation(value));
1986        } else if (name.equals("relevantHistory")) {
1987          this.getRelevantHistory().add(castToReference(value));
1988        } else
1989          return super.setProperty(name, value);
1990        return value;
1991      }
1992
1993      @Override
1994      public Base makeProperty(int hash, String name) throws FHIRException {
1995        switch (hash) {
1996        case -1618432855:  return addIdentifier(); 
1997        case -1014418093:  return addDefinition(); 
1998        case -332612366:  return addBasedOn(); 
1999        case 237568101:  return addPriorRequest(); 
2000        case -445338488:  return getGroupIdentifier(); 
2001        case -892481550:  return getStatusElement();
2002        case -1183762788:  return getIntent(); 
2003        case -1165461084:  return getPriorityElement();
2004        case 941839219:  return getCode(); 
2005        case 3059181:  return getCode(); 
2006        case -1867885268:  return getSubject(); 
2007        case 951530927:  return getContext(); 
2008        case -2022646513:  return getOccurrence(); 
2009        case 1687874001:  return getOccurrence(); 
2010        case -1500852503:  return getAuthoredOnElement();
2011        case 693933948:  return getRequester(); 
2012        case -901444568:  return getPerformerType(); 
2013        case 481140686:  return getPerformer(); 
2014        case 722137681:  return addReasonCode(); 
2015        case -1146218137:  return addReasonReference(); 
2016        case 1922406657:  return addSupportingInfo(); 
2017        case 3387378:  return addNote(); 
2018        case 1538891575:  return addRelevantHistory(); 
2019        default: return super.makeProperty(hash, name);
2020        }
2021
2022      }
2023
2024      @Override
2025      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2026        switch (hash) {
2027        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2028        case -1014418093: /*definition*/ return new String[] {"Reference"};
2029        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2030        case 237568101: /*priorRequest*/ return new String[] {"Reference"};
2031        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
2032        case -892481550: /*status*/ return new String[] {"code"};
2033        case -1183762788: /*intent*/ return new String[] {"CodeableConcept"};
2034        case -1165461084: /*priority*/ return new String[] {"code"};
2035        case 3059181: /*code*/ return new String[] {"Reference", "CodeableConcept"};
2036        case -1867885268: /*subject*/ return new String[] {"Reference"};
2037        case 951530927: /*context*/ return new String[] {"Reference"};
2038        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
2039        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
2040        case 693933948: /*requester*/ return new String[] {};
2041        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
2042        case 481140686: /*performer*/ return new String[] {"Reference"};
2043        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2044        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2045        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
2046        case 3387378: /*note*/ return new String[] {"Annotation"};
2047        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
2048        default: return super.getTypesForProperty(hash, name);
2049        }
2050
2051      }
2052
2053      @Override
2054      public Base addChild(String name) throws FHIRException {
2055        if (name.equals("identifier")) {
2056          return addIdentifier();
2057        }
2058        else if (name.equals("definition")) {
2059          return addDefinition();
2060        }
2061        else if (name.equals("basedOn")) {
2062          return addBasedOn();
2063        }
2064        else if (name.equals("priorRequest")) {
2065          return addPriorRequest();
2066        }
2067        else if (name.equals("groupIdentifier")) {
2068          this.groupIdentifier = new Identifier();
2069          return this.groupIdentifier;
2070        }
2071        else if (name.equals("status")) {
2072          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.status");
2073        }
2074        else if (name.equals("intent")) {
2075          this.intent = new CodeableConcept();
2076          return this.intent;
2077        }
2078        else if (name.equals("priority")) {
2079          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.priority");
2080        }
2081        else if (name.equals("codeReference")) {
2082          this.code = new Reference();
2083          return this.code;
2084        }
2085        else if (name.equals("codeCodeableConcept")) {
2086          this.code = new CodeableConcept();
2087          return this.code;
2088        }
2089        else if (name.equals("subject")) {
2090          this.subject = new Reference();
2091          return this.subject;
2092        }
2093        else if (name.equals("context")) {
2094          this.context = new Reference();
2095          return this.context;
2096        }
2097        else if (name.equals("occurrenceDateTime")) {
2098          this.occurrence = new DateTimeType();
2099          return this.occurrence;
2100        }
2101        else if (name.equals("occurrencePeriod")) {
2102          this.occurrence = new Period();
2103          return this.occurrence;
2104        }
2105        else if (name.equals("occurrenceTiming")) {
2106          this.occurrence = new Timing();
2107          return this.occurrence;
2108        }
2109        else if (name.equals("authoredOn")) {
2110          throw new FHIRException("Cannot call addChild on a primitive type DeviceRequest.authoredOn");
2111        }
2112        else if (name.equals("requester")) {
2113          this.requester = new DeviceRequestRequesterComponent();
2114          return this.requester;
2115        }
2116        else if (name.equals("performerType")) {
2117          this.performerType = new CodeableConcept();
2118          return this.performerType;
2119        }
2120        else if (name.equals("performer")) {
2121          this.performer = new Reference();
2122          return this.performer;
2123        }
2124        else if (name.equals("reasonCode")) {
2125          return addReasonCode();
2126        }
2127        else if (name.equals("reasonReference")) {
2128          return addReasonReference();
2129        }
2130        else if (name.equals("supportingInfo")) {
2131          return addSupportingInfo();
2132        }
2133        else if (name.equals("note")) {
2134          return addNote();
2135        }
2136        else if (name.equals("relevantHistory")) {
2137          return addRelevantHistory();
2138        }
2139        else
2140          return super.addChild(name);
2141      }
2142
2143  public String fhirType() {
2144    return "DeviceRequest";
2145
2146  }
2147
2148      public DeviceRequest copy() {
2149        DeviceRequest dst = new DeviceRequest();
2150        copyValues(dst);
2151        if (identifier != null) {
2152          dst.identifier = new ArrayList<Identifier>();
2153          for (Identifier i : identifier)
2154            dst.identifier.add(i.copy());
2155        };
2156        if (definition != null) {
2157          dst.definition = new ArrayList<Reference>();
2158          for (Reference i : definition)
2159            dst.definition.add(i.copy());
2160        };
2161        if (basedOn != null) {
2162          dst.basedOn = new ArrayList<Reference>();
2163          for (Reference i : basedOn)
2164            dst.basedOn.add(i.copy());
2165        };
2166        if (priorRequest != null) {
2167          dst.priorRequest = new ArrayList<Reference>();
2168          for (Reference i : priorRequest)
2169            dst.priorRequest.add(i.copy());
2170        };
2171        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
2172        dst.status = status == null ? null : status.copy();
2173        dst.intent = intent == null ? null : intent.copy();
2174        dst.priority = priority == null ? null : priority.copy();
2175        dst.code = code == null ? null : code.copy();
2176        dst.subject = subject == null ? null : subject.copy();
2177        dst.context = context == null ? null : context.copy();
2178        dst.occurrence = occurrence == null ? null : occurrence.copy();
2179        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
2180        dst.requester = requester == null ? null : requester.copy();
2181        dst.performerType = performerType == null ? null : performerType.copy();
2182        dst.performer = performer == null ? null : performer.copy();
2183        if (reasonCode != null) {
2184          dst.reasonCode = new ArrayList<CodeableConcept>();
2185          for (CodeableConcept i : reasonCode)
2186            dst.reasonCode.add(i.copy());
2187        };
2188        if (reasonReference != null) {
2189          dst.reasonReference = new ArrayList<Reference>();
2190          for (Reference i : reasonReference)
2191            dst.reasonReference.add(i.copy());
2192        };
2193        if (supportingInfo != null) {
2194          dst.supportingInfo = new ArrayList<Reference>();
2195          for (Reference i : supportingInfo)
2196            dst.supportingInfo.add(i.copy());
2197        };
2198        if (note != null) {
2199          dst.note = new ArrayList<Annotation>();
2200          for (Annotation i : note)
2201            dst.note.add(i.copy());
2202        };
2203        if (relevantHistory != null) {
2204          dst.relevantHistory = new ArrayList<Reference>();
2205          for (Reference i : relevantHistory)
2206            dst.relevantHistory.add(i.copy());
2207        };
2208        return dst;
2209      }
2210
2211      protected DeviceRequest typedCopy() {
2212        return copy();
2213      }
2214
2215      @Override
2216      public boolean equalsDeep(Base other) {
2217        if (!super.equalsDeep(other))
2218          return false;
2219        if (!(other instanceof DeviceRequest))
2220          return false;
2221        DeviceRequest o = (DeviceRequest) other;
2222        return compareDeep(identifier, o.identifier, true) && compareDeep(definition, o.definition, true)
2223           && compareDeep(basedOn, o.basedOn, true) && compareDeep(priorRequest, o.priorRequest, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
2224           && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true) && compareDeep(priority, o.priority, true)
2225           && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true)
2226           && compareDeep(occurrence, o.occurrence, true) && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true)
2227           && compareDeep(performerType, o.performerType, true) && compareDeep(performer, o.performer, true)
2228           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
2229           && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(note, o.note, true) && compareDeep(relevantHistory, o.relevantHistory, true)
2230          ;
2231      }
2232
2233      @Override
2234      public boolean equalsShallow(Base other) {
2235        if (!super.equalsShallow(other))
2236          return false;
2237        if (!(other instanceof DeviceRequest))
2238          return false;
2239        DeviceRequest o = (DeviceRequest) other;
2240        return compareValues(status, o.status, true) && compareValues(priority, o.priority, true) && compareValues(authoredOn, o.authoredOn, true)
2241          ;
2242      }
2243
2244      public boolean isEmpty() {
2245        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definition, basedOn
2246          , priorRequest, groupIdentifier, status, intent, priority, code, subject, context
2247          , occurrence, authoredOn, requester, performerType, performer, reasonCode, reasonReference
2248          , supportingInfo, note, relevantHistory);
2249      }
2250
2251  @Override
2252  public ResourceType getResourceType() {
2253    return ResourceType.DeviceRequest;
2254   }
2255
2256 /**
2257   * Search parameter: <b>requester</b>
2258   * <p>
2259   * Description: <b>Who/what is requesting service </b><br>
2260   * Type: <b>reference</b><br>
2261   * Path: <b>DeviceRequest.requester.agent</b><br>
2262   * </p>
2263   */
2264  @SearchParamDefinition(name="requester", path="DeviceRequest.requester.agent", 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="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Practitioner.class } )
2265  public static final String SP_REQUESTER = "requester";
2266 /**
2267   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
2268   * <p>
2269   * Description: <b>Who/what is requesting service </b><br>
2270   * Type: <b>reference</b><br>
2271   * Path: <b>DeviceRequest.requester.agent</b><br>
2272   * </p>
2273   */
2274  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
2275
2276/**
2277   * Constant for fluent queries to be used to add include statements. Specifies
2278   * the path value of "<b>DeviceRequest:requester</b>".
2279   */
2280  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("DeviceRequest:requester").toLocked();
2281
2282 /**
2283   * Search parameter: <b>identifier</b>
2284   * <p>
2285   * Description: <b>Business identifier for request/order</b><br>
2286   * Type: <b>token</b><br>
2287   * Path: <b>DeviceRequest.identifier</b><br>
2288   * </p>
2289   */
2290  @SearchParamDefinition(name="identifier", path="DeviceRequest.identifier", description="Business identifier for request/order", type="token" )
2291  public static final String SP_IDENTIFIER = "identifier";
2292 /**
2293   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2294   * <p>
2295   * Description: <b>Business identifier for request/order</b><br>
2296   * Type: <b>token</b><br>
2297   * Path: <b>DeviceRequest.identifier</b><br>
2298   * </p>
2299   */
2300  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2301
2302 /**
2303   * Search parameter: <b>code</b>
2304   * <p>
2305   * Description: <b>Code for what is being requested/ordered</b><br>
2306   * Type: <b>token</b><br>
2307   * Path: <b>DeviceRequest.codeCodeableConcept</b><br>
2308   * </p>
2309   */
2310  @SearchParamDefinition(name="code", path="DeviceRequest.code.as(CodeableConcept)", description="Code for what is being requested/ordered", type="token" )
2311  public static final String SP_CODE = "code";
2312 /**
2313   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2314   * <p>
2315   * Description: <b>Code for what is being requested/ordered</b><br>
2316   * Type: <b>token</b><br>
2317   * Path: <b>DeviceRequest.codeCodeableConcept</b><br>
2318   * </p>
2319   */
2320  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
2321
2322 /**
2323   * Search parameter: <b>performer</b>
2324   * <p>
2325   * Description: <b>Desired performer for service</b><br>
2326   * Type: <b>reference</b><br>
2327   * Path: <b>DeviceRequest.performer</b><br>
2328   * </p>
2329   */
2330  @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={Device.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
2331  public static final String SP_PERFORMER = "performer";
2332 /**
2333   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2334   * <p>
2335   * Description: <b>Desired performer for service</b><br>
2336   * Type: <b>reference</b><br>
2337   * Path: <b>DeviceRequest.performer</b><br>
2338   * </p>
2339   */
2340  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
2341
2342/**
2343   * Constant for fluent queries to be used to add include statements. Specifies
2344   * the path value of "<b>DeviceRequest:performer</b>".
2345   */
2346  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("DeviceRequest:performer").toLocked();
2347
2348 /**
2349   * Search parameter: <b>event-date</b>
2350   * <p>
2351   * Description: <b>When service should occur</b><br>
2352   * Type: <b>date</b><br>
2353   * Path: <b>DeviceRequest.occurrenceDateTime, DeviceRequest.occurrencePeriod</b><br>
2354   * </p>
2355   */
2356  @SearchParamDefinition(name="event-date", path="DeviceRequest.occurrence.as(DateTime) | DeviceRequest.occurrence.as(Period)", description="When service should occur", type="date" )
2357  public static final String SP_EVENT_DATE = "event-date";
2358 /**
2359   * <b>Fluent Client</b> search parameter constant for <b>event-date</b>
2360   * <p>
2361   * Description: <b>When service should occur</b><br>
2362   * Type: <b>date</b><br>
2363   * Path: <b>DeviceRequest.occurrenceDateTime, DeviceRequest.occurrencePeriod</b><br>
2364   * </p>
2365   */
2366  public static final ca.uhn.fhir.rest.gclient.DateClientParam EVENT_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EVENT_DATE);
2367
2368 /**
2369   * Search parameter: <b>subject</b>
2370   * <p>
2371   * Description: <b>Individual the service is ordered for</b><br>
2372   * Type: <b>reference</b><br>
2373   * Path: <b>DeviceRequest.subject</b><br>
2374   * </p>
2375   */
2376  @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 } )
2377  public static final String SP_SUBJECT = "subject";
2378 /**
2379   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2380   * <p>
2381   * Description: <b>Individual the service is ordered for</b><br>
2382   * Type: <b>reference</b><br>
2383   * Path: <b>DeviceRequest.subject</b><br>
2384   * </p>
2385   */
2386  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2387
2388/**
2389   * Constant for fluent queries to be used to add include statements. Specifies
2390   * the path value of "<b>DeviceRequest:subject</b>".
2391   */
2392  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DeviceRequest:subject").toLocked();
2393
2394 /**
2395   * Search parameter: <b>encounter</b>
2396   * <p>
2397   * Description: <b>Encounter or Episode during which request was created</b><br>
2398   * Type: <b>reference</b><br>
2399   * Path: <b>DeviceRequest.context</b><br>
2400   * </p>
2401   */
2402  @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 } )
2403  public static final String SP_ENCOUNTER = "encounter";
2404 /**
2405   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2406   * <p>
2407   * Description: <b>Encounter or Episode during which request was created</b><br>
2408   * Type: <b>reference</b><br>
2409   * Path: <b>DeviceRequest.context</b><br>
2410   * </p>
2411   */
2412  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2413
2414/**
2415   * Constant for fluent queries to be used to add include statements. Specifies
2416   * the path value of "<b>DeviceRequest:encounter</b>".
2417   */
2418  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("DeviceRequest:encounter").toLocked();
2419
2420 /**
2421   * Search parameter: <b>authored-on</b>
2422   * <p>
2423   * Description: <b>When the request transitioned to being actionable</b><br>
2424   * Type: <b>date</b><br>
2425   * Path: <b>DeviceRequest.authoredOn</b><br>
2426   * </p>
2427   */
2428  @SearchParamDefinition(name="authored-on", path="DeviceRequest.authoredOn", description="When the request transitioned to being actionable", type="date" )
2429  public static final String SP_AUTHORED_ON = "authored-on";
2430 /**
2431   * <b>Fluent Client</b> search parameter constant for <b>authored-on</b>
2432   * <p>
2433   * Description: <b>When the request transitioned to being actionable</b><br>
2434   * Type: <b>date</b><br>
2435   * Path: <b>DeviceRequest.authoredOn</b><br>
2436   * </p>
2437   */
2438  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED_ON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED_ON);
2439
2440 /**
2441   * Search parameter: <b>intent</b>
2442   * <p>
2443   * Description: <b>proposal | plan | original-order |reflex-order</b><br>
2444   * Type: <b>token</b><br>
2445   * Path: <b>DeviceRequest.intent</b><br>
2446   * </p>
2447   */
2448  @SearchParamDefinition(name="intent", path="DeviceRequest.intent", description="proposal | plan | original-order |reflex-order", type="token" )
2449  public static final String SP_INTENT = "intent";
2450 /**
2451   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
2452   * <p>
2453   * Description: <b>proposal | plan | original-order |reflex-order</b><br>
2454   * Type: <b>token</b><br>
2455   * Path: <b>DeviceRequest.intent</b><br>
2456   * </p>
2457   */
2458  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
2459
2460 /**
2461   * Search parameter: <b>group-identifier</b>
2462   * <p>
2463   * Description: <b>Composite request this is part of</b><br>
2464   * Type: <b>token</b><br>
2465   * Path: <b>DeviceRequest.groupIdentifier</b><br>
2466   * </p>
2467   */
2468  @SearchParamDefinition(name="group-identifier", path="DeviceRequest.groupIdentifier", description="Composite request this is part of", type="token" )
2469  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
2470 /**
2471   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
2472   * <p>
2473   * Description: <b>Composite request this is part of</b><br>
2474   * Type: <b>token</b><br>
2475   * Path: <b>DeviceRequest.groupIdentifier</b><br>
2476   * </p>
2477   */
2478  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP_IDENTIFIER);
2479
2480 /**
2481   * Search parameter: <b>based-on</b>
2482   * <p>
2483   * Description: <b>Plan/proposal/order fulfilled by this request</b><br>
2484   * Type: <b>reference</b><br>
2485   * Path: <b>DeviceRequest.basedOn</b><br>
2486   * </p>
2487   */
2488  @SearchParamDefinition(name="based-on", path="DeviceRequest.basedOn", description="Plan/proposal/order fulfilled by this request", type="reference" )
2489  public static final String SP_BASED_ON = "based-on";
2490 /**
2491   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2492   * <p>
2493   * Description: <b>Plan/proposal/order fulfilled by this request</b><br>
2494   * Type: <b>reference</b><br>
2495   * Path: <b>DeviceRequest.basedOn</b><br>
2496   * </p>
2497   */
2498  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2499
2500/**
2501   * Constant for fluent queries to be used to add include statements. Specifies
2502   * the path value of "<b>DeviceRequest:based-on</b>".
2503   */
2504  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("DeviceRequest:based-on").toLocked();
2505
2506 /**
2507   * Search parameter: <b>priorrequest</b>
2508   * <p>
2509   * Description: <b>Request takes the place of referenced completed or terminated requests</b><br>
2510   * Type: <b>reference</b><br>
2511   * Path: <b>DeviceRequest.priorRequest</b><br>
2512   * </p>
2513   */
2514  @SearchParamDefinition(name="priorrequest", path="DeviceRequest.priorRequest", description="Request takes the place of referenced completed or terminated requests", type="reference" )
2515  public static final String SP_PRIORREQUEST = "priorrequest";
2516 /**
2517   * <b>Fluent Client</b> search parameter constant for <b>priorrequest</b>
2518   * <p>
2519   * Description: <b>Request takes the place of referenced completed or terminated requests</b><br>
2520   * Type: <b>reference</b><br>
2521   * Path: <b>DeviceRequest.priorRequest</b><br>
2522   * </p>
2523   */
2524  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRIORREQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRIORREQUEST);
2525
2526/**
2527   * Constant for fluent queries to be used to add include statements. Specifies
2528   * the path value of "<b>DeviceRequest:priorrequest</b>".
2529   */
2530  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRIORREQUEST = new ca.uhn.fhir.model.api.Include("DeviceRequest:priorrequest").toLocked();
2531
2532 /**
2533   * Search parameter: <b>patient</b>
2534   * <p>
2535   * Description: <b>Individual the service is ordered for</b><br>
2536   * Type: <b>reference</b><br>
2537   * Path: <b>DeviceRequest.subject</b><br>
2538   * </p>
2539   */
2540  @SearchParamDefinition(name="patient", path="DeviceRequest.subject", description="Individual the service is ordered for", type="reference", target={Patient.class } )
2541  public static final String SP_PATIENT = "patient";
2542 /**
2543   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2544   * <p>
2545   * Description: <b>Individual the service is ordered for</b><br>
2546   * Type: <b>reference</b><br>
2547   * Path: <b>DeviceRequest.subject</b><br>
2548   * </p>
2549   */
2550  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2551
2552/**
2553   * Constant for fluent queries to be used to add include statements. Specifies
2554   * the path value of "<b>DeviceRequest:patient</b>".
2555   */
2556  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceRequest:patient").toLocked();
2557
2558 /**
2559   * Search parameter: <b>definition</b>
2560   * <p>
2561   * Description: <b>Protocol or definition followed by this request</b><br>
2562   * Type: <b>reference</b><br>
2563   * Path: <b>DeviceRequest.definition</b><br>
2564   * </p>
2565   */
2566  @SearchParamDefinition(name="definition", path="DeviceRequest.definition", description="Protocol or definition followed by this request", type="reference", target={ActivityDefinition.class, PlanDefinition.class } )
2567  public static final String SP_DEFINITION = "definition";
2568 /**
2569   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
2570   * <p>
2571   * Description: <b>Protocol or definition followed by this request</b><br>
2572   * Type: <b>reference</b><br>
2573   * Path: <b>DeviceRequest.definition</b><br>
2574   * </p>
2575   */
2576  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEFINITION);
2577
2578/**
2579   * Constant for fluent queries to be used to add include statements. Specifies
2580   * the path value of "<b>DeviceRequest:definition</b>".
2581   */
2582  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEFINITION = new ca.uhn.fhir.model.api.Include("DeviceRequest:definition").toLocked();
2583
2584 /**
2585   * Search parameter: <b>device</b>
2586   * <p>
2587   * Description: <b>Reference to resource that is being requested/ordered</b><br>
2588   * Type: <b>reference</b><br>
2589   * Path: <b>DeviceRequest.codeReference</b><br>
2590   * </p>
2591   */
2592  @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 } )
2593  public static final String SP_DEVICE = "device";
2594 /**
2595   * <b>Fluent Client</b> search parameter constant for <b>device</b>
2596   * <p>
2597   * Description: <b>Reference to resource that is being requested/ordered</b><br>
2598   * Type: <b>reference</b><br>
2599   * Path: <b>DeviceRequest.codeReference</b><br>
2600   * </p>
2601   */
2602  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE);
2603
2604/**
2605   * Constant for fluent queries to be used to add include statements. Specifies
2606   * the path value of "<b>DeviceRequest:device</b>".
2607   */
2608  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("DeviceRequest:device").toLocked();
2609
2610 /**
2611   * Search parameter: <b>status</b>
2612   * <p>
2613   * Description: <b>entered-in-error | draft | active |suspended | completed </b><br>
2614   * Type: <b>token</b><br>
2615   * Path: <b>DeviceRequest.status</b><br>
2616   * </p>
2617   */
2618  @SearchParamDefinition(name="status", path="DeviceRequest.status", description="entered-in-error | draft | active |suspended | completed ", type="token" )
2619  public static final String SP_STATUS = "status";
2620 /**
2621   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2622   * <p>
2623   * Description: <b>entered-in-error | draft | active |suspended | completed </b><br>
2624   * Type: <b>token</b><br>
2625   * Path: <b>DeviceRequest.status</b><br>
2626   * </p>
2627   */
2628  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2629
2630
2631}
2632