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