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