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