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