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 void removeChild(String name, Base value) throws FHIRException {
936      if (name.equals("code")) {
937        this.code = null;
938      } else if (name.equals("value[x]")) {
939        this.value = null;
940      } else
941        super.removeChild(name, value);
942      
943    }
944
945    @Override
946    public Base makeProperty(int hash, String name) throws FHIRException {
947      switch (hash) {
948      case 3059181:
949        return getCode();
950      case -1410166417:
951        return getValue();
952      case 111972721:
953        return getValue();
954      default:
955        return super.makeProperty(hash, name);
956      }
957
958    }
959
960    @Override
961    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
962      switch (hash) {
963      case 3059181:
964        /* code */ return new String[] { "CodeableConcept" };
965      case 111972721:
966        /* value */ return new String[] { "CodeableConcept", "Quantity", "Range", "boolean" };
967      default:
968        return super.getTypesForProperty(hash, name);
969      }
970
971    }
972
973    @Override
974    public Base addChild(String name) throws FHIRException {
975      if (name.equals("code")) {
976        this.code = new CodeableConcept();
977        return this.code;
978      } else if (name.equals("valueCodeableConcept")) {
979        this.value = new CodeableConcept();
980        return this.value;
981      } else if (name.equals("valueQuantity")) {
982        this.value = new Quantity();
983        return this.value;
984      } else if (name.equals("valueRange")) {
985        this.value = new Range();
986        return this.value;
987      } else if (name.equals("valueBoolean")) {
988        this.value = new BooleanType();
989        return this.value;
990      } else
991        return super.addChild(name);
992    }
993
994    public DeviceRequestParameterComponent copy() {
995      DeviceRequestParameterComponent dst = new DeviceRequestParameterComponent();
996      copyValues(dst);
997      return dst;
998    }
999
1000    public void copyValues(DeviceRequestParameterComponent dst) {
1001      super.copyValues(dst);
1002      dst.code = code == null ? null : code.copy();
1003      dst.value = value == null ? null : value.copy();
1004    }
1005
1006    @Override
1007    public boolean equalsDeep(Base other_) {
1008      if (!super.equalsDeep(other_))
1009        return false;
1010      if (!(other_ instanceof DeviceRequestParameterComponent))
1011        return false;
1012      DeviceRequestParameterComponent o = (DeviceRequestParameterComponent) other_;
1013      return compareDeep(code, o.code, true) && compareDeep(value, o.value, true);
1014    }
1015
1016    @Override
1017    public boolean equalsShallow(Base other_) {
1018      if (!super.equalsShallow(other_))
1019        return false;
1020      if (!(other_ instanceof DeviceRequestParameterComponent))
1021        return false;
1022      DeviceRequestParameterComponent o = (DeviceRequestParameterComponent) other_;
1023      return true;
1024    }
1025
1026    public boolean isEmpty() {
1027      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value);
1028    }
1029
1030    public String fhirType() {
1031      return "DeviceRequest.parameter";
1032
1033    }
1034
1035  }
1036
1037  /**
1038   * Identifiers assigned to this order by the orderer or by the receiver.
1039   */
1040  @Child(name = "identifier", type = {
1041      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1042  @Description(shortDefinition = "External Request identifier", formalDefinition = "Identifiers assigned to this order by the orderer or by the receiver.")
1043  protected List<Identifier> identifier;
1044
1045  /**
1046   * The URL pointing to a FHIR-defined protocol, guideline, orderset or other
1047   * definition that is adhered to in whole or in part by this DeviceRequest.
1048   */
1049  @Child(name = "instantiatesCanonical", type = {
1050      CanonicalType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1051  @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.")
1052  protected List<CanonicalType> instantiatesCanonical;
1053
1054  /**
1055   * The URL pointing to an externally maintained protocol, guideline, orderset or
1056   * other definition that is adhered to in whole or in part by this
1057   * DeviceRequest.
1058   */
1059  @Child(name = "instantiatesUri", type = {
1060      UriType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1061  @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.")
1062  protected List<UriType> instantiatesUri;
1063
1064  /**
1065   * Plan/proposal/order fulfilled by this request.
1066   */
1067  @Child(name = "basedOn", type = {
1068      Reference.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1069  @Description(shortDefinition = "What request fulfills", formalDefinition = "Plan/proposal/order fulfilled by this request.")
1070  protected List<Reference> basedOn;
1071  /**
1072   * The actual objects that are the target of the reference (Plan/proposal/order
1073   * fulfilled by this request.)
1074   */
1075  protected List<Resource> basedOnTarget;
1076
1077  /**
1078   * The request takes the place of the referenced completed or terminated
1079   * request(s).
1080   */
1081  @Child(name = "priorRequest", type = {
1082      Reference.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1083  @Description(shortDefinition = "What request replaces", formalDefinition = "The request takes the place of the referenced completed or terminated request(s).")
1084  protected List<Reference> priorRequest;
1085  /**
1086   * The actual objects that are the target of the reference (The request takes
1087   * the place of the referenced completed or terminated request(s).)
1088   */
1089  protected List<Resource> priorRequestTarget;
1090
1091  /**
1092   * Composite request this is part of.
1093   */
1094  @Child(name = "groupIdentifier", type = {
1095      Identifier.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1096  @Description(shortDefinition = "Identifier of composite request", formalDefinition = "Composite request this is part of.")
1097  protected Identifier groupIdentifier;
1098
1099  /**
1100   * The status of the request.
1101   */
1102  @Child(name = "status", type = { CodeType.class }, order = 6, min = 0, max = 1, modifier = true, summary = true)
1103  @Description(shortDefinition = "draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition = "The status of the request.")
1104  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-status")
1105  protected Enumeration<DeviceRequestStatus> status;
1106
1107  /**
1108   * Whether the request is a proposal, plan, an original order or a reflex order.
1109   */
1110  @Child(name = "intent", type = { CodeType.class }, order = 7, min = 1, max = 1, modifier = true, summary = true)
1111  @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.")
1112  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-intent")
1113  protected Enumeration<RequestIntent> intent;
1114
1115  /**
1116   * Indicates how quickly the {{title}} should be addressed with respect to other
1117   * requests.
1118   */
1119  @Child(name = "priority", type = { CodeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
1120  @Description(shortDefinition = "routine | urgent | asap | stat", formalDefinition = "Indicates how quickly the {{title}} should be addressed with respect to other requests.")
1121  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-priority")
1122  protected Enumeration<RequestPriority> priority;
1123
1124  /**
1125   * The details of the device to be used.
1126   */
1127  @Child(name = "code", type = { Device.class,
1128      CodeableConcept.class }, order = 9, min = 1, max = 1, modifier = false, summary = true)
1129  @Description(shortDefinition = "Device requested", formalDefinition = "The details of the device to be used.")
1130  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/device-kind")
1131  protected Type code;
1132
1133  /**
1134   * Specific parameters for the ordered item. For example, the prism value for
1135   * lenses.
1136   */
1137  @Child(name = "parameter", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1138  @Description(shortDefinition = "Device details", formalDefinition = "Specific parameters for the ordered item.  For example, the prism value for lenses.")
1139  protected List<DeviceRequestParameterComponent> parameter;
1140
1141  /**
1142   * The patient who will use the device.
1143   */
1144  @Child(name = "subject", type = { Patient.class, Group.class, Location.class,
1145      Device.class }, order = 11, min = 1, max = 1, modifier = false, summary = true)
1146  @Description(shortDefinition = "Focus of request", formalDefinition = "The patient who will use the device.")
1147  protected Reference subject;
1148
1149  /**
1150   * The actual object that is the target of the reference (The patient who will
1151   * use the device.)
1152   */
1153  protected Resource subjectTarget;
1154
1155  /**
1156   * An encounter that provides additional context in which this request is made.
1157   */
1158  @Child(name = "encounter", type = { Encounter.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
1159  @Description(shortDefinition = "Encounter motivating request", formalDefinition = "An encounter that provides additional context in which this request is made.")
1160  protected Reference encounter;
1161
1162  /**
1163   * The actual object that is the target of the reference (An encounter that
1164   * provides additional context in which this request is made.)
1165   */
1166  protected Encounter encounterTarget;
1167
1168  /**
1169   * The timing schedule for the use of the device. The Schedule data type allows
1170   * many different expressions, for example. "Every 8 hours"; "Three times a
1171   * day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct
1172   * 2013, 17 Oct 2013 and 1 Nov 2013".
1173   */
1174  @Child(name = "occurrence", type = { DateTimeType.class, Period.class,
1175      Timing.class }, order = 13, min = 0, max = 1, modifier = false, summary = true)
1176  @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\".")
1177  protected Type occurrence;
1178
1179  /**
1180   * When the request transitioned to being actionable.
1181   */
1182  @Child(name = "authoredOn", type = {
1183      DateTimeType.class }, order = 14, min = 0, max = 1, modifier = false, summary = true)
1184  @Description(shortDefinition = "When recorded", formalDefinition = "When the request transitioned to being actionable.")
1185  protected DateTimeType authoredOn;
1186
1187  /**
1188   * The individual who initiated the request and has responsibility for its
1189   * activation.
1190   */
1191  @Child(name = "requester", type = { Device.class, Practitioner.class, PractitionerRole.class,
1192      Organization.class }, order = 15, min = 0, max = 1, modifier = false, summary = true)
1193  @Description(shortDefinition = "Who/what is requesting diagnostics", formalDefinition = "The individual who initiated the request and has responsibility for its activation.")
1194  protected Reference requester;
1195
1196  /**
1197   * The actual object that is the target of the reference (The individual who
1198   * initiated the request and has responsibility for its activation.)
1199   */
1200  protected Resource requesterTarget;
1201
1202  /**
1203   * Desired type of performer for doing the diagnostic testing.
1204   */
1205  @Child(name = "performerType", type = {
1206      CodeableConcept.class }, order = 16, min = 0, max = 1, modifier = false, summary = true)
1207  @Description(shortDefinition = "Filler role", formalDefinition = "Desired type of performer for doing the diagnostic testing.")
1208  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/participant-role")
1209  protected CodeableConcept performerType;
1210
1211  /**
1212   * The desired performer for doing the diagnostic testing.
1213   */
1214  @Child(name = "performer", type = { Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class,
1215      HealthcareService.class, Patient.class, Device.class,
1216      RelatedPerson.class }, order = 17, min = 0, max = 1, modifier = false, summary = true)
1217  @Description(shortDefinition = "Requested Filler", formalDefinition = "The desired performer for doing the diagnostic testing.")
1218  protected Reference performer;
1219
1220  /**
1221   * The actual object that is the target of the reference (The desired performer
1222   * for doing the diagnostic testing.)
1223   */
1224  protected Resource performerTarget;
1225
1226  /**
1227   * Reason or justification for the use of this device.
1228   */
1229  @Child(name = "reasonCode", type = {
1230      CodeableConcept.class }, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1231  @Description(shortDefinition = "Coded Reason for request", formalDefinition = "Reason or justification for the use of this device.")
1232  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-code")
1233  protected List<CodeableConcept> reasonCode;
1234
1235  /**
1236   * Reason or justification for the use of this device.
1237   */
1238  @Child(name = "reasonReference", type = { Condition.class, Observation.class, DiagnosticReport.class,
1239      DocumentReference.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1240  @Description(shortDefinition = "Linked Reason for request", formalDefinition = "Reason or justification for the use of this device.")
1241  protected List<Reference> reasonReference;
1242  /**
1243   * The actual objects that are the target of the reference (Reason or
1244   * justification for the use of this device.)
1245   */
1246  protected List<Resource> reasonReferenceTarget;
1247
1248  /**
1249   * Insurance plans, coverage extensions, pre-authorizations and/or
1250   * pre-determinations that may be required for delivering the requested service.
1251   */
1252  @Child(name = "insurance", type = { Coverage.class,
1253      ClaimResponse.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1254  @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.")
1255  protected List<Reference> insurance;
1256  /**
1257   * The actual objects that are the target of the reference (Insurance plans,
1258   * coverage extensions, pre-authorizations and/or pre-determinations that may be
1259   * required for delivering the requested service.)
1260   */
1261  protected List<Resource> insuranceTarget;
1262
1263  /**
1264   * Additional clinical information about the patient that may influence the
1265   * request fulfilment. For example, this may include where on the subject's body
1266   * the device will be used (i.e. the target site).
1267   */
1268  @Child(name = "supportingInfo", type = {
1269      Reference.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1270  @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).")
1271  protected List<Reference> supportingInfo;
1272  /**
1273   * The actual objects that are the target of the reference (Additional clinical
1274   * information about the patient that may influence the request fulfilment. For
1275   * example, this may include where on the subject's body the device will be used
1276   * (i.e. the target site).)
1277   */
1278  protected List<Resource> supportingInfoTarget;
1279
1280  /**
1281   * Details about this request that were not represented at all or sufficiently
1282   * in one of the attributes provided in a class. These may include for example a
1283   * comment, an instruction, or a note associated with the statement.
1284   */
1285  @Child(name = "note", type = {
1286      Annotation.class }, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1287  @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.")
1288  protected List<Annotation> note;
1289
1290  /**
1291   * Key events in the history of the request.
1292   */
1293  @Child(name = "relevantHistory", type = {
1294      Provenance.class }, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1295  @Description(shortDefinition = "Request provenance", formalDefinition = "Key events in the history of the request.")
1296  protected List<Reference> relevantHistory;
1297  /**
1298   * The actual objects that are the target of the reference (Key events in the
1299   * history of the request.)
1300   */
1301  protected List<Provenance> relevantHistoryTarget;
1302
1303  private static final long serialVersionUID = 1484452423L;
1304
1305  /**
1306   * Constructor
1307   */
1308  public DeviceRequest() {
1309    super();
1310  }
1311
1312  /**
1313   * Constructor
1314   */
1315  public DeviceRequest(Enumeration<RequestIntent> intent, Type code, Reference subject) {
1316    super();
1317    this.intent = intent;
1318    this.code = code;
1319    this.subject = subject;
1320  }
1321
1322  /**
1323   * @return {@link #identifier} (Identifiers assigned to this order by the
1324   *         orderer or by the receiver.)
1325   */
1326  public List<Identifier> getIdentifier() {
1327    if (this.identifier == null)
1328      this.identifier = new ArrayList<Identifier>();
1329    return this.identifier;
1330  }
1331
1332  /**
1333   * @return Returns a reference to <code>this</code> for easy method chaining
1334   */
1335  public DeviceRequest setIdentifier(List<Identifier> theIdentifier) {
1336    this.identifier = theIdentifier;
1337    return this;
1338  }
1339
1340  public boolean hasIdentifier() {
1341    if (this.identifier == null)
1342      return false;
1343    for (Identifier item : this.identifier)
1344      if (!item.isEmpty())
1345        return true;
1346    return false;
1347  }
1348
1349  public Identifier addIdentifier() { // 3
1350    Identifier t = new Identifier();
1351    if (this.identifier == null)
1352      this.identifier = new ArrayList<Identifier>();
1353    this.identifier.add(t);
1354    return t;
1355  }
1356
1357  public DeviceRequest addIdentifier(Identifier t) { // 3
1358    if (t == null)
1359      return this;
1360    if (this.identifier == null)
1361      this.identifier = new ArrayList<Identifier>();
1362    this.identifier.add(t);
1363    return this;
1364  }
1365
1366  /**
1367   * @return The first repetition of repeating field {@link #identifier}, creating
1368   *         it if it does not already exist
1369   */
1370  public Identifier getIdentifierFirstRep() {
1371    if (getIdentifier().isEmpty()) {
1372      addIdentifier();
1373    }
1374    return getIdentifier().get(0);
1375  }
1376
1377  /**
1378   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
1379   *         protocol, guideline, orderset or other definition that is adhered to
1380   *         in whole or in part by this DeviceRequest.)
1381   */
1382  public List<CanonicalType> getInstantiatesCanonical() {
1383    if (this.instantiatesCanonical == null)
1384      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1385    return this.instantiatesCanonical;
1386  }
1387
1388  /**
1389   * @return Returns a reference to <code>this</code> for easy method chaining
1390   */
1391  public DeviceRequest setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) {
1392    this.instantiatesCanonical = theInstantiatesCanonical;
1393    return this;
1394  }
1395
1396  public boolean hasInstantiatesCanonical() {
1397    if (this.instantiatesCanonical == null)
1398      return false;
1399    for (CanonicalType item : this.instantiatesCanonical)
1400      if (!item.isEmpty())
1401        return true;
1402    return false;
1403  }
1404
1405  /**
1406   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
1407   *         protocol, guideline, orderset or other definition that is adhered to
1408   *         in whole or in part by this DeviceRequest.)
1409   */
1410  public CanonicalType addInstantiatesCanonicalElement() {// 2
1411    CanonicalType t = new CanonicalType();
1412    if (this.instantiatesCanonical == null)
1413      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1414    this.instantiatesCanonical.add(t);
1415    return t;
1416  }
1417
1418  /**
1419   * @param value {@link #instantiatesCanonical} (The URL pointing to a
1420   *              FHIR-defined protocol, guideline, orderset or other definition
1421   *              that is adhered to in whole or in part by this DeviceRequest.)
1422   */
1423  public DeviceRequest addInstantiatesCanonical(String value) { // 1
1424    CanonicalType t = new CanonicalType();
1425    t.setValue(value);
1426    if (this.instantiatesCanonical == null)
1427      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1428    this.instantiatesCanonical.add(t);
1429    return this;
1430  }
1431
1432  /**
1433   * @param value {@link #instantiatesCanonical} (The URL pointing to a
1434   *              FHIR-defined protocol, guideline, orderset or other definition
1435   *              that is adhered to in whole or in part by this DeviceRequest.)
1436   */
1437  public boolean hasInstantiatesCanonical(String value) {
1438    if (this.instantiatesCanonical == null)
1439      return false;
1440    for (CanonicalType v : this.instantiatesCanonical)
1441      if (v.getValue().equals(value)) // canonical(ActivityDefinition|PlanDefinition)
1442        return true;
1443    return false;
1444  }
1445
1446  /**
1447   * @return {@link #instantiatesUri} (The URL pointing to an externally
1448   *         maintained protocol, guideline, orderset or other definition that is
1449   *         adhered to in whole or in part by this DeviceRequest.)
1450   */
1451  public List<UriType> getInstantiatesUri() {
1452    if (this.instantiatesUri == null)
1453      this.instantiatesUri = new ArrayList<UriType>();
1454    return this.instantiatesUri;
1455  }
1456
1457  /**
1458   * @return Returns a reference to <code>this</code> for easy method chaining
1459   */
1460  public DeviceRequest setInstantiatesUri(List<UriType> theInstantiatesUri) {
1461    this.instantiatesUri = theInstantiatesUri;
1462    return this;
1463  }
1464
1465  public boolean hasInstantiatesUri() {
1466    if (this.instantiatesUri == null)
1467      return false;
1468    for (UriType item : this.instantiatesUri)
1469      if (!item.isEmpty())
1470        return true;
1471    return false;
1472  }
1473
1474  /**
1475   * @return {@link #instantiatesUri} (The URL pointing to an externally
1476   *         maintained protocol, guideline, orderset or other definition that is
1477   *         adhered to in whole or in part by this DeviceRequest.)
1478   */
1479  public UriType addInstantiatesUriElement() {// 2
1480    UriType t = new UriType();
1481    if (this.instantiatesUri == null)
1482      this.instantiatesUri = new ArrayList<UriType>();
1483    this.instantiatesUri.add(t);
1484    return t;
1485  }
1486
1487  /**
1488   * @param value {@link #instantiatesUri} (The URL pointing to an externally
1489   *              maintained protocol, guideline, orderset or other definition
1490   *              that is adhered to in whole or in part by this DeviceRequest.)
1491   */
1492  public DeviceRequest addInstantiatesUri(String value) { // 1
1493    UriType t = new UriType();
1494    t.setValue(value);
1495    if (this.instantiatesUri == null)
1496      this.instantiatesUri = new ArrayList<UriType>();
1497    this.instantiatesUri.add(t);
1498    return this;
1499  }
1500
1501  /**
1502   * @param value {@link #instantiatesUri} (The URL pointing to an externally
1503   *              maintained protocol, guideline, orderset or other definition
1504   *              that is adhered to in whole or in part by this DeviceRequest.)
1505   */
1506  public boolean hasInstantiatesUri(String value) {
1507    if (this.instantiatesUri == null)
1508      return false;
1509    for (UriType v : this.instantiatesUri)
1510      if (v.getValue().equals(value)) // uri
1511        return true;
1512    return false;
1513  }
1514
1515  /**
1516   * @return {@link #basedOn} (Plan/proposal/order fulfilled by this request.)
1517   */
1518  public List<Reference> getBasedOn() {
1519    if (this.basedOn == null)
1520      this.basedOn = new ArrayList<Reference>();
1521    return this.basedOn;
1522  }
1523
1524  /**
1525   * @return Returns a reference to <code>this</code> for easy method chaining
1526   */
1527  public DeviceRequest setBasedOn(List<Reference> theBasedOn) {
1528    this.basedOn = theBasedOn;
1529    return this;
1530  }
1531
1532  public boolean hasBasedOn() {
1533    if (this.basedOn == null)
1534      return false;
1535    for (Reference item : this.basedOn)
1536      if (!item.isEmpty())
1537        return true;
1538    return false;
1539  }
1540
1541  public Reference addBasedOn() { // 3
1542    Reference t = new Reference();
1543    if (this.basedOn == null)
1544      this.basedOn = new ArrayList<Reference>();
1545    this.basedOn.add(t);
1546    return t;
1547  }
1548
1549  public DeviceRequest addBasedOn(Reference t) { // 3
1550    if (t == null)
1551      return this;
1552    if (this.basedOn == null)
1553      this.basedOn = new ArrayList<Reference>();
1554    this.basedOn.add(t);
1555    return this;
1556  }
1557
1558  /**
1559   * @return The first repetition of repeating field {@link #basedOn}, creating it
1560   *         if it does not already exist
1561   */
1562  public Reference getBasedOnFirstRep() {
1563    if (getBasedOn().isEmpty()) {
1564      addBasedOn();
1565    }
1566    return getBasedOn().get(0);
1567  }
1568
1569  /**
1570   * @deprecated Use Reference#setResource(IBaseResource) instead
1571   */
1572  @Deprecated
1573  public List<Resource> getBasedOnTarget() {
1574    if (this.basedOnTarget == null)
1575      this.basedOnTarget = new ArrayList<Resource>();
1576    return this.basedOnTarget;
1577  }
1578
1579  /**
1580   * @return {@link #priorRequest} (The request takes the place of the referenced
1581   *         completed or terminated request(s).)
1582   */
1583  public List<Reference> getPriorRequest() {
1584    if (this.priorRequest == null)
1585      this.priorRequest = new ArrayList<Reference>();
1586    return this.priorRequest;
1587  }
1588
1589  /**
1590   * @return Returns a reference to <code>this</code> for easy method chaining
1591   */
1592  public DeviceRequest setPriorRequest(List<Reference> thePriorRequest) {
1593    this.priorRequest = thePriorRequest;
1594    return this;
1595  }
1596
1597  public boolean hasPriorRequest() {
1598    if (this.priorRequest == null)
1599      return false;
1600    for (Reference item : this.priorRequest)
1601      if (!item.isEmpty())
1602        return true;
1603    return false;
1604  }
1605
1606  public Reference addPriorRequest() { // 3
1607    Reference t = new Reference();
1608    if (this.priorRequest == null)
1609      this.priorRequest = new ArrayList<Reference>();
1610    this.priorRequest.add(t);
1611    return t;
1612  }
1613
1614  public DeviceRequest addPriorRequest(Reference t) { // 3
1615    if (t == null)
1616      return this;
1617    if (this.priorRequest == null)
1618      this.priorRequest = new ArrayList<Reference>();
1619    this.priorRequest.add(t);
1620    return this;
1621  }
1622
1623  /**
1624   * @return The first repetition of repeating field {@link #priorRequest},
1625   *         creating it if it does not already exist
1626   */
1627  public Reference getPriorRequestFirstRep() {
1628    if (getPriorRequest().isEmpty()) {
1629      addPriorRequest();
1630    }
1631    return getPriorRequest().get(0);
1632  }
1633
1634  /**
1635   * @deprecated Use Reference#setResource(IBaseResource) instead
1636   */
1637  @Deprecated
1638  public List<Resource> getPriorRequestTarget() {
1639    if (this.priorRequestTarget == null)
1640      this.priorRequestTarget = new ArrayList<Resource>();
1641    return this.priorRequestTarget;
1642  }
1643
1644  /**
1645   * @return {@link #groupIdentifier} (Composite request this is part of.)
1646   */
1647  public Identifier getGroupIdentifier() {
1648    if (this.groupIdentifier == null)
1649      if (Configuration.errorOnAutoCreate())
1650        throw new Error("Attempt to auto-create DeviceRequest.groupIdentifier");
1651      else if (Configuration.doAutoCreate())
1652        this.groupIdentifier = new Identifier(); // cc
1653    return this.groupIdentifier;
1654  }
1655
1656  public boolean hasGroupIdentifier() {
1657    return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
1658  }
1659
1660  /**
1661   * @param value {@link #groupIdentifier} (Composite request this is part of.)
1662   */
1663  public DeviceRequest setGroupIdentifier(Identifier value) {
1664    this.groupIdentifier = value;
1665    return this;
1666  }
1667
1668  /**
1669   * @return {@link #status} (The status of the request.). This is the underlying
1670   *         object with id, value and extensions. The accessor "getStatus" gives
1671   *         direct access to the value
1672   */
1673  public Enumeration<DeviceRequestStatus> getStatusElement() {
1674    if (this.status == null)
1675      if (Configuration.errorOnAutoCreate())
1676        throw new Error("Attempt to auto-create DeviceRequest.status");
1677      else if (Configuration.doAutoCreate())
1678        this.status = new Enumeration<DeviceRequestStatus>(new DeviceRequestStatusEnumFactory()); // bb
1679    return this.status;
1680  }
1681
1682  public boolean hasStatusElement() {
1683    return this.status != null && !this.status.isEmpty();
1684  }
1685
1686  public boolean hasStatus() {
1687    return this.status != null && !this.status.isEmpty();
1688  }
1689
1690  /**
1691   * @param value {@link #status} (The status of the request.). This is the
1692   *              underlying object with id, value and extensions. The accessor
1693   *              "getStatus" gives direct access to the value
1694   */
1695  public DeviceRequest setStatusElement(Enumeration<DeviceRequestStatus> value) {
1696    this.status = value;
1697    return this;
1698  }
1699
1700  /**
1701   * @return The status of the request.
1702   */
1703  public DeviceRequestStatus getStatus() {
1704    return this.status == null ? null : this.status.getValue();
1705  }
1706
1707  /**
1708   * @param value The status of the request.
1709   */
1710  public DeviceRequest setStatus(DeviceRequestStatus value) {
1711    if (value == null)
1712      this.status = null;
1713    else {
1714      if (this.status == null)
1715        this.status = new Enumeration<DeviceRequestStatus>(new DeviceRequestStatusEnumFactory());
1716      this.status.setValue(value);
1717    }
1718    return this;
1719  }
1720
1721  /**
1722   * @return {@link #intent} (Whether the request is a proposal, plan, an original
1723   *         order or a reflex order.). This is the underlying object with id,
1724   *         value and extensions. The accessor "getIntent" gives direct access to
1725   *         the value
1726   */
1727  public Enumeration<RequestIntent> getIntentElement() {
1728    if (this.intent == null)
1729      if (Configuration.errorOnAutoCreate())
1730        throw new Error("Attempt to auto-create DeviceRequest.intent");
1731      else if (Configuration.doAutoCreate())
1732        this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory()); // bb
1733    return this.intent;
1734  }
1735
1736  public boolean hasIntentElement() {
1737    return this.intent != null && !this.intent.isEmpty();
1738  }
1739
1740  public boolean hasIntent() {
1741    return this.intent != null && !this.intent.isEmpty();
1742  }
1743
1744  /**
1745   * @param value {@link #intent} (Whether the request is a proposal, plan, an
1746   *              original order or a reflex order.). This is the underlying
1747   *              object with id, value and extensions. The accessor "getIntent"
1748   *              gives direct access to the value
1749   */
1750  public DeviceRequest setIntentElement(Enumeration<RequestIntent> value) {
1751    this.intent = value;
1752    return this;
1753  }
1754
1755  /**
1756   * @return Whether the request is a proposal, plan, an original order or a
1757   *         reflex order.
1758   */
1759  public RequestIntent getIntent() {
1760    return this.intent == null ? null : this.intent.getValue();
1761  }
1762
1763  /**
1764   * @param value Whether the request is a proposal, plan, an original order or a
1765   *              reflex order.
1766   */
1767  public DeviceRequest setIntent(RequestIntent value) {
1768    if (this.intent == null)
1769      this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory());
1770    this.intent.setValue(value);
1771    return this;
1772  }
1773
1774  /**
1775   * @return {@link #priority} (Indicates how quickly the {{title}} should be
1776   *         addressed with respect to other requests.). This is the underlying
1777   *         object with id, value and extensions. The accessor "getPriority"
1778   *         gives direct access to the value
1779   */
1780  public Enumeration<RequestPriority> getPriorityElement() {
1781    if (this.priority == null)
1782      if (Configuration.errorOnAutoCreate())
1783        throw new Error("Attempt to auto-create DeviceRequest.priority");
1784      else if (Configuration.doAutoCreate())
1785        this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
1786    return this.priority;
1787  }
1788
1789  public boolean hasPriorityElement() {
1790    return this.priority != null && !this.priority.isEmpty();
1791  }
1792
1793  public boolean hasPriority() {
1794    return this.priority != null && !this.priority.isEmpty();
1795  }
1796
1797  /**
1798   * @param value {@link #priority} (Indicates how quickly the {{title}} should be
1799   *              addressed with respect to other requests.). This is the
1800   *              underlying object with id, value and extensions. The accessor
1801   *              "getPriority" gives direct access to the value
1802   */
1803  public DeviceRequest setPriorityElement(Enumeration<RequestPriority> value) {
1804    this.priority = value;
1805    return this;
1806  }
1807
1808  /**
1809   * @return Indicates how quickly the {{title}} should be addressed with respect
1810   *         to other requests.
1811   */
1812  public RequestPriority getPriority() {
1813    return this.priority == null ? null : this.priority.getValue();
1814  }
1815
1816  /**
1817   * @param value Indicates how quickly the {{title}} should be addressed with
1818   *              respect to other requests.
1819   */
1820  public DeviceRequest setPriority(RequestPriority value) {
1821    if (value == null)
1822      this.priority = null;
1823    else {
1824      if (this.priority == null)
1825        this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
1826      this.priority.setValue(value);
1827    }
1828    return this;
1829  }
1830
1831  /**
1832   * @return {@link #code} (The details of the device to be used.)
1833   */
1834  public Type getCode() {
1835    return this.code;
1836  }
1837
1838  /**
1839   * @return {@link #code} (The details of the device to be used.)
1840   */
1841  public Reference getCodeReference() throws FHIRException {
1842    if (this.code == null)
1843      this.code = new Reference();
1844    if (!(this.code instanceof Reference))
1845      throw new FHIRException(
1846          "Type mismatch: the type Reference was expected, but " + this.code.getClass().getName() + " was encountered");
1847    return (Reference) this.code;
1848  }
1849
1850  public boolean hasCodeReference() {
1851    return this != null && this.code instanceof Reference;
1852  }
1853
1854  /**
1855   * @return {@link #code} (The details of the device to be used.)
1856   */
1857  public CodeableConcept getCodeCodeableConcept() throws FHIRException {
1858    if (this.code == null)
1859      this.code = new CodeableConcept();
1860    if (!(this.code instanceof CodeableConcept))
1861      throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1862          + this.code.getClass().getName() + " was encountered");
1863    return (CodeableConcept) this.code;
1864  }
1865
1866  public boolean hasCodeCodeableConcept() {
1867    return this != null && this.code instanceof CodeableConcept;
1868  }
1869
1870  public boolean hasCode() {
1871    return this.code != null && !this.code.isEmpty();
1872  }
1873
1874  /**
1875   * @param value {@link #code} (The details of the device to be used.)
1876   */
1877  public DeviceRequest setCode(Type value) {
1878    if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
1879      throw new Error("Not the right type for DeviceRequest.code[x]: " + value.fhirType());
1880    this.code = value;
1881    return this;
1882  }
1883
1884  /**
1885   * @return {@link #parameter} (Specific parameters for the ordered item. For
1886   *         example, the prism value for lenses.)
1887   */
1888  public List<DeviceRequestParameterComponent> getParameter() {
1889    if (this.parameter == null)
1890      this.parameter = new ArrayList<DeviceRequestParameterComponent>();
1891    return this.parameter;
1892  }
1893
1894  /**
1895   * @return Returns a reference to <code>this</code> for easy method chaining
1896   */
1897  public DeviceRequest setParameter(List<DeviceRequestParameterComponent> theParameter) {
1898    this.parameter = theParameter;
1899    return this;
1900  }
1901
1902  public boolean hasParameter() {
1903    if (this.parameter == null)
1904      return false;
1905    for (DeviceRequestParameterComponent item : this.parameter)
1906      if (!item.isEmpty())
1907        return true;
1908    return false;
1909  }
1910
1911  public DeviceRequestParameterComponent addParameter() { // 3
1912    DeviceRequestParameterComponent t = new DeviceRequestParameterComponent();
1913    if (this.parameter == null)
1914      this.parameter = new ArrayList<DeviceRequestParameterComponent>();
1915    this.parameter.add(t);
1916    return t;
1917  }
1918
1919  public DeviceRequest addParameter(DeviceRequestParameterComponent t) { // 3
1920    if (t == null)
1921      return this;
1922    if (this.parameter == null)
1923      this.parameter = new ArrayList<DeviceRequestParameterComponent>();
1924    this.parameter.add(t);
1925    return this;
1926  }
1927
1928  /**
1929   * @return The first repetition of repeating field {@link #parameter}, creating
1930   *         it if it does not already exist
1931   */
1932  public DeviceRequestParameterComponent getParameterFirstRep() {
1933    if (getParameter().isEmpty()) {
1934      addParameter();
1935    }
1936    return getParameter().get(0);
1937  }
1938
1939  /**
1940   * @return {@link #subject} (The patient who will use the device.)
1941   */
1942  public Reference getSubject() {
1943    if (this.subject == null)
1944      if (Configuration.errorOnAutoCreate())
1945        throw new Error("Attempt to auto-create DeviceRequest.subject");
1946      else if (Configuration.doAutoCreate())
1947        this.subject = new Reference(); // cc
1948    return this.subject;
1949  }
1950
1951  public boolean hasSubject() {
1952    return this.subject != null && !this.subject.isEmpty();
1953  }
1954
1955  /**
1956   * @param value {@link #subject} (The patient who will use the device.)
1957   */
1958  public DeviceRequest setSubject(Reference value) {
1959    this.subject = value;
1960    return this;
1961  }
1962
1963  /**
1964   * @return {@link #subject} The actual object that is the target of the
1965   *         reference. The reference library doesn't populate this, but you can
1966   *         use it to hold the resource if you resolve it. (The patient who will
1967   *         use the device.)
1968   */
1969  public Resource getSubjectTarget() {
1970    return this.subjectTarget;
1971  }
1972
1973  /**
1974   * @param value {@link #subject} The actual object that is the target of the
1975   *              reference. The reference library doesn't use these, but you can
1976   *              use it to hold the resource if you resolve it. (The patient who
1977   *              will use the device.)
1978   */
1979  public DeviceRequest setSubjectTarget(Resource value) {
1980    this.subjectTarget = value;
1981    return this;
1982  }
1983
1984  /**
1985   * @return {@link #encounter} (An encounter that provides additional context in
1986   *         which this request is made.)
1987   */
1988  public Reference getEncounter() {
1989    if (this.encounter == null)
1990      if (Configuration.errorOnAutoCreate())
1991        throw new Error("Attempt to auto-create DeviceRequest.encounter");
1992      else if (Configuration.doAutoCreate())
1993        this.encounter = new Reference(); // cc
1994    return this.encounter;
1995  }
1996
1997  public boolean hasEncounter() {
1998    return this.encounter != null && !this.encounter.isEmpty();
1999  }
2000
2001  /**
2002   * @param value {@link #encounter} (An encounter that provides additional
2003   *              context in which this request is made.)
2004   */
2005  public DeviceRequest setEncounter(Reference value) {
2006    this.encounter = value;
2007    return this;
2008  }
2009
2010  /**
2011   * @return {@link #encounter} The actual object that is the target of the
2012   *         reference. The reference library doesn't populate this, but you can
2013   *         use it to hold the resource if you resolve it. (An encounter that
2014   *         provides additional context in which this request is made.)
2015   */
2016  public Encounter getEncounterTarget() {
2017    if (this.encounterTarget == null)
2018      if (Configuration.errorOnAutoCreate())
2019        throw new Error("Attempt to auto-create DeviceRequest.encounter");
2020      else if (Configuration.doAutoCreate())
2021        this.encounterTarget = new Encounter(); // aa
2022    return this.encounterTarget;
2023  }
2024
2025  /**
2026   * @param value {@link #encounter} The actual object that is the target of the
2027   *              reference. The reference library doesn't use these, but you can
2028   *              use it to hold the resource if you resolve it. (An encounter
2029   *              that provides additional context in which this request is made.)
2030   */
2031  public DeviceRequest setEncounterTarget(Encounter value) {
2032    this.encounterTarget = value;
2033    return this;
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 Type getOccurrence() {
2044    return this.occurrence;
2045  }
2046
2047  /**
2048   * @return {@link #occurrence} (The timing schedule for the use of the device.
2049   *         The Schedule data type allows many different expressions, for
2050   *         example. "Every 8 hours"; "Three times a day"; "1/2 an hour before
2051   *         breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013
2052   *         and 1 Nov 2013".)
2053   */
2054  public DateTimeType getOccurrenceDateTimeType() throws FHIRException {
2055    if (this.occurrence == null)
2056      this.occurrence = new DateTimeType();
2057    if (!(this.occurrence instanceof DateTimeType))
2058      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
2059          + this.occurrence.getClass().getName() + " was encountered");
2060    return (DateTimeType) this.occurrence;
2061  }
2062
2063  public boolean hasOccurrenceDateTimeType() {
2064    return this != null && this.occurrence instanceof DateTimeType;
2065  }
2066
2067  /**
2068   * @return {@link #occurrence} (The timing schedule for the use of the device.
2069   *         The Schedule data type allows many different expressions, for
2070   *         example. "Every 8 hours"; "Three times a day"; "1/2 an hour before
2071   *         breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013
2072   *         and 1 Nov 2013".)
2073   */
2074  public Period getOccurrencePeriod() throws FHIRException {
2075    if (this.occurrence == null)
2076      this.occurrence = new Period();
2077    if (!(this.occurrence instanceof Period))
2078      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.occurrence.getClass().getName()
2079          + " was encountered");
2080    return (Period) this.occurrence;
2081  }
2082
2083  public boolean hasOccurrencePeriod() {
2084    return this != null && this.occurrence instanceof Period;
2085  }
2086
2087  /**
2088   * @return {@link #occurrence} (The timing schedule for the use of the device.
2089   *         The Schedule data type allows many different expressions, for
2090   *         example. "Every 8 hours"; "Three times a day"; "1/2 an hour before
2091   *         breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013
2092   *         and 1 Nov 2013".)
2093   */
2094  public Timing getOccurrenceTiming() throws FHIRException {
2095    if (this.occurrence == null)
2096      this.occurrence = new Timing();
2097    if (!(this.occurrence instanceof Timing))
2098      throw new FHIRException("Type mismatch: the type Timing was expected, but " + this.occurrence.getClass().getName()
2099          + " was encountered");
2100    return (Timing) this.occurrence;
2101  }
2102
2103  public boolean hasOccurrenceTiming() {
2104    return this != null && this.occurrence instanceof Timing;
2105  }
2106
2107  public boolean hasOccurrence() {
2108    return this.occurrence != null && !this.occurrence.isEmpty();
2109  }
2110
2111  /**
2112   * @param value {@link #occurrence} (The timing schedule for the use of the
2113   *              device. The Schedule data type allows many different
2114   *              expressions, for example. "Every 8 hours"; "Three times a day";
2115   *              "1/2 an hour before breakfast for 10 days from 23-Dec 2011:";
2116   *              "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".)
2117   */
2118  public DeviceRequest setOccurrence(Type value) {
2119    if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
2120      throw new Error("Not the right type for DeviceRequest.occurrence[x]: " + value.fhirType());
2121    this.occurrence = value;
2122    return this;
2123  }
2124
2125  /**
2126   * @return {@link #authoredOn} (When the request transitioned to being
2127   *         actionable.). This is the underlying object with id, value and
2128   *         extensions. The accessor "getAuthoredOn" gives direct access to the
2129   *         value
2130   */
2131  public DateTimeType getAuthoredOnElement() {
2132    if (this.authoredOn == null)
2133      if (Configuration.errorOnAutoCreate())
2134        throw new Error("Attempt to auto-create DeviceRequest.authoredOn");
2135      else if (Configuration.doAutoCreate())
2136        this.authoredOn = new DateTimeType(); // bb
2137    return this.authoredOn;
2138  }
2139
2140  public boolean hasAuthoredOnElement() {
2141    return this.authoredOn != null && !this.authoredOn.isEmpty();
2142  }
2143
2144  public boolean hasAuthoredOn() {
2145    return this.authoredOn != null && !this.authoredOn.isEmpty();
2146  }
2147
2148  /**
2149   * @param value {@link #authoredOn} (When the request transitioned to being
2150   *              actionable.). This is the underlying object with id, value and
2151   *              extensions. The accessor "getAuthoredOn" gives direct access to
2152   *              the value
2153   */
2154  public DeviceRequest setAuthoredOnElement(DateTimeType value) {
2155    this.authoredOn = value;
2156    return this;
2157  }
2158
2159  /**
2160   * @return When the request transitioned to being actionable.
2161   */
2162  public Date getAuthoredOn() {
2163    return this.authoredOn == null ? null : this.authoredOn.getValue();
2164  }
2165
2166  /**
2167   * @param value When the request transitioned to being actionable.
2168   */
2169  public DeviceRequest setAuthoredOn(Date value) {
2170    if (value == null)
2171      this.authoredOn = null;
2172    else {
2173      if (this.authoredOn == null)
2174        this.authoredOn = new DateTimeType();
2175      this.authoredOn.setValue(value);
2176    }
2177    return this;
2178  }
2179
2180  /**
2181   * @return {@link #requester} (The individual who initiated the request and has
2182   *         responsibility for its activation.)
2183   */
2184  public Reference getRequester() {
2185    if (this.requester == null)
2186      if (Configuration.errorOnAutoCreate())
2187        throw new Error("Attempt to auto-create DeviceRequest.requester");
2188      else if (Configuration.doAutoCreate())
2189        this.requester = new Reference(); // cc
2190    return this.requester;
2191  }
2192
2193  public boolean hasRequester() {
2194    return this.requester != null && !this.requester.isEmpty();
2195  }
2196
2197  /**
2198   * @param value {@link #requester} (The individual who initiated the request and
2199   *              has responsibility for its activation.)
2200   */
2201  public DeviceRequest setRequester(Reference value) {
2202    this.requester = value;
2203    return this;
2204  }
2205
2206  /**
2207   * @return {@link #requester} The actual object that is the target of the
2208   *         reference. The reference library doesn't populate this, but you can
2209   *         use it to hold the resource if you resolve it. (The individual who
2210   *         initiated the request and has responsibility for its activation.)
2211   */
2212  public Resource getRequesterTarget() {
2213    return this.requesterTarget;
2214  }
2215
2216  /**
2217   * @param value {@link #requester} The actual object that is the target of the
2218   *              reference. The reference library doesn't use these, but you can
2219   *              use it to hold the resource if you resolve it. (The individual
2220   *              who initiated the request and has responsibility for its
2221   *              activation.)
2222   */
2223  public DeviceRequest setRequesterTarget(Resource value) {
2224    this.requesterTarget = value;
2225    return this;
2226  }
2227
2228  /**
2229   * @return {@link #performerType} (Desired type of performer for doing the
2230   *         diagnostic testing.)
2231   */
2232  public CodeableConcept getPerformerType() {
2233    if (this.performerType == null)
2234      if (Configuration.errorOnAutoCreate())
2235        throw new Error("Attempt to auto-create DeviceRequest.performerType");
2236      else if (Configuration.doAutoCreate())
2237        this.performerType = new CodeableConcept(); // cc
2238    return this.performerType;
2239  }
2240
2241  public boolean hasPerformerType() {
2242    return this.performerType != null && !this.performerType.isEmpty();
2243  }
2244
2245  /**
2246   * @param value {@link #performerType} (Desired type of performer for doing the
2247   *              diagnostic testing.)
2248   */
2249  public DeviceRequest setPerformerType(CodeableConcept value) {
2250    this.performerType = value;
2251    return this;
2252  }
2253
2254  /**
2255   * @return {@link #performer} (The desired performer for doing the diagnostic
2256   *         testing.)
2257   */
2258  public Reference getPerformer() {
2259    if (this.performer == null)
2260      if (Configuration.errorOnAutoCreate())
2261        throw new Error("Attempt to auto-create DeviceRequest.performer");
2262      else if (Configuration.doAutoCreate())
2263        this.performer = new Reference(); // cc
2264    return this.performer;
2265  }
2266
2267  public boolean hasPerformer() {
2268    return this.performer != null && !this.performer.isEmpty();
2269  }
2270
2271  /**
2272   * @param value {@link #performer} (The desired performer for doing the
2273   *              diagnostic testing.)
2274   */
2275  public DeviceRequest setPerformer(Reference value) {
2276    this.performer = value;
2277    return this;
2278  }
2279
2280  /**
2281   * @return {@link #performer} The actual object that is the target of the
2282   *         reference. The reference library doesn't populate this, but you can
2283   *         use it to hold the resource if you resolve it. (The desired performer
2284   *         for doing the diagnostic testing.)
2285   */
2286  public Resource getPerformerTarget() {
2287    return this.performerTarget;
2288  }
2289
2290  /**
2291   * @param value {@link #performer} The actual object that is the target of the
2292   *              reference. The reference library doesn't use these, but you can
2293   *              use it to hold the resource if you resolve it. (The desired
2294   *              performer for doing the diagnostic testing.)
2295   */
2296  public DeviceRequest setPerformerTarget(Resource value) {
2297    this.performerTarget = value;
2298    return this;
2299  }
2300
2301  /**
2302   * @return {@link #reasonCode} (Reason or justification for the use of this
2303   *         device.)
2304   */
2305  public List<CodeableConcept> getReasonCode() {
2306    if (this.reasonCode == null)
2307      this.reasonCode = new ArrayList<CodeableConcept>();
2308    return this.reasonCode;
2309  }
2310
2311  /**
2312   * @return Returns a reference to <code>this</code> for easy method chaining
2313   */
2314  public DeviceRequest setReasonCode(List<CodeableConcept> theReasonCode) {
2315    this.reasonCode = theReasonCode;
2316    return this;
2317  }
2318
2319  public boolean hasReasonCode() {
2320    if (this.reasonCode == null)
2321      return false;
2322    for (CodeableConcept item : this.reasonCode)
2323      if (!item.isEmpty())
2324        return true;
2325    return false;
2326  }
2327
2328  public CodeableConcept addReasonCode() { // 3
2329    CodeableConcept t = new CodeableConcept();
2330    if (this.reasonCode == null)
2331      this.reasonCode = new ArrayList<CodeableConcept>();
2332    this.reasonCode.add(t);
2333    return t;
2334  }
2335
2336  public DeviceRequest addReasonCode(CodeableConcept t) { // 3
2337    if (t == null)
2338      return this;
2339    if (this.reasonCode == null)
2340      this.reasonCode = new ArrayList<CodeableConcept>();
2341    this.reasonCode.add(t);
2342    return this;
2343  }
2344
2345  /**
2346   * @return The first repetition of repeating field {@link #reasonCode}, creating
2347   *         it if it does not already exist
2348   */
2349  public CodeableConcept getReasonCodeFirstRep() {
2350    if (getReasonCode().isEmpty()) {
2351      addReasonCode();
2352    }
2353    return getReasonCode().get(0);
2354  }
2355
2356  /**
2357   * @return {@link #reasonReference} (Reason or justification for the use of this
2358   *         device.)
2359   */
2360  public List<Reference> getReasonReference() {
2361    if (this.reasonReference == null)
2362      this.reasonReference = new ArrayList<Reference>();
2363    return this.reasonReference;
2364  }
2365
2366  /**
2367   * @return Returns a reference to <code>this</code> for easy method chaining
2368   */
2369  public DeviceRequest setReasonReference(List<Reference> theReasonReference) {
2370    this.reasonReference = theReasonReference;
2371    return this;
2372  }
2373
2374  public boolean hasReasonReference() {
2375    if (this.reasonReference == null)
2376      return false;
2377    for (Reference item : this.reasonReference)
2378      if (!item.isEmpty())
2379        return true;
2380    return false;
2381  }
2382
2383  public Reference addReasonReference() { // 3
2384    Reference t = new Reference();
2385    if (this.reasonReference == null)
2386      this.reasonReference = new ArrayList<Reference>();
2387    this.reasonReference.add(t);
2388    return t;
2389  }
2390
2391  public DeviceRequest addReasonReference(Reference t) { // 3
2392    if (t == null)
2393      return this;
2394    if (this.reasonReference == null)
2395      this.reasonReference = new ArrayList<Reference>();
2396    this.reasonReference.add(t);
2397    return this;
2398  }
2399
2400  /**
2401   * @return The first repetition of repeating field {@link #reasonReference},
2402   *         creating it if it does not already exist
2403   */
2404  public Reference getReasonReferenceFirstRep() {
2405    if (getReasonReference().isEmpty()) {
2406      addReasonReference();
2407    }
2408    return getReasonReference().get(0);
2409  }
2410
2411  /**
2412   * @deprecated Use Reference#setResource(IBaseResource) instead
2413   */
2414  @Deprecated
2415  public List<Resource> getReasonReferenceTarget() {
2416    if (this.reasonReferenceTarget == null)
2417      this.reasonReferenceTarget = new ArrayList<Resource>();
2418    return this.reasonReferenceTarget;
2419  }
2420
2421  /**
2422   * @return {@link #insurance} (Insurance plans, coverage extensions,
2423   *         pre-authorizations and/or pre-determinations that may be required for
2424   *         delivering the requested service.)
2425   */
2426  public List<Reference> getInsurance() {
2427    if (this.insurance == null)
2428      this.insurance = new ArrayList<Reference>();
2429    return this.insurance;
2430  }
2431
2432  /**
2433   * @return Returns a reference to <code>this</code> for easy method chaining
2434   */
2435  public DeviceRequest setInsurance(List<Reference> theInsurance) {
2436    this.insurance = theInsurance;
2437    return this;
2438  }
2439
2440  public boolean hasInsurance() {
2441    if (this.insurance == null)
2442      return false;
2443    for (Reference item : this.insurance)
2444      if (!item.isEmpty())
2445        return true;
2446    return false;
2447  }
2448
2449  public Reference addInsurance() { // 3
2450    Reference t = new Reference();
2451    if (this.insurance == null)
2452      this.insurance = new ArrayList<Reference>();
2453    this.insurance.add(t);
2454    return t;
2455  }
2456
2457  public DeviceRequest addInsurance(Reference t) { // 3
2458    if (t == null)
2459      return this;
2460    if (this.insurance == null)
2461      this.insurance = new ArrayList<Reference>();
2462    this.insurance.add(t);
2463    return this;
2464  }
2465
2466  /**
2467   * @return The first repetition of repeating field {@link #insurance}, creating
2468   *         it if it does not already exist
2469   */
2470  public Reference getInsuranceFirstRep() {
2471    if (getInsurance().isEmpty()) {
2472      addInsurance();
2473    }
2474    return getInsurance().get(0);
2475  }
2476
2477  /**
2478   * @deprecated Use Reference#setResource(IBaseResource) instead
2479   */
2480  @Deprecated
2481  public List<Resource> getInsuranceTarget() {
2482    if (this.insuranceTarget == null)
2483      this.insuranceTarget = new ArrayList<Resource>();
2484    return this.insuranceTarget;
2485  }
2486
2487  /**
2488   * @return {@link #supportingInfo} (Additional clinical information about the
2489   *         patient that may influence the request fulfilment. For example, this
2490   *         may include where on the subject's body the device will be used (i.e.
2491   *         the target site).)
2492   */
2493  public List<Reference> getSupportingInfo() {
2494    if (this.supportingInfo == null)
2495      this.supportingInfo = new ArrayList<Reference>();
2496    return this.supportingInfo;
2497  }
2498
2499  /**
2500   * @return Returns a reference to <code>this</code> for easy method chaining
2501   */
2502  public DeviceRequest setSupportingInfo(List<Reference> theSupportingInfo) {
2503    this.supportingInfo = theSupportingInfo;
2504    return this;
2505  }
2506
2507  public boolean hasSupportingInfo() {
2508    if (this.supportingInfo == null)
2509      return false;
2510    for (Reference item : this.supportingInfo)
2511      if (!item.isEmpty())
2512        return true;
2513    return false;
2514  }
2515
2516  public Reference addSupportingInfo() { // 3
2517    Reference t = new Reference();
2518    if (this.supportingInfo == null)
2519      this.supportingInfo = new ArrayList<Reference>();
2520    this.supportingInfo.add(t);
2521    return t;
2522  }
2523
2524  public DeviceRequest addSupportingInfo(Reference t) { // 3
2525    if (t == null)
2526      return this;
2527    if (this.supportingInfo == null)
2528      this.supportingInfo = new ArrayList<Reference>();
2529    this.supportingInfo.add(t);
2530    return this;
2531  }
2532
2533  /**
2534   * @return The first repetition of repeating field {@link #supportingInfo},
2535   *         creating it if it does not already exist
2536   */
2537  public Reference getSupportingInfoFirstRep() {
2538    if (getSupportingInfo().isEmpty()) {
2539      addSupportingInfo();
2540    }
2541    return getSupportingInfo().get(0);
2542  }
2543
2544  /**
2545   * @deprecated Use Reference#setResource(IBaseResource) instead
2546   */
2547  @Deprecated
2548  public List<Resource> getSupportingInfoTarget() {
2549    if (this.supportingInfoTarget == null)
2550      this.supportingInfoTarget = new ArrayList<Resource>();
2551    return this.supportingInfoTarget;
2552  }
2553
2554  /**
2555   * @return {@link #note} (Details about this request that were not represented
2556   *         at all or sufficiently in one of the attributes provided in a class.
2557   *         These may include for example a comment, an instruction, or a note
2558   *         associated with the statement.)
2559   */
2560  public List<Annotation> getNote() {
2561    if (this.note == null)
2562      this.note = new ArrayList<Annotation>();
2563    return this.note;
2564  }
2565
2566  /**
2567   * @return Returns a reference to <code>this</code> for easy method chaining
2568   */
2569  public DeviceRequest setNote(List<Annotation> theNote) {
2570    this.note = theNote;
2571    return this;
2572  }
2573
2574  public boolean hasNote() {
2575    if (this.note == null)
2576      return false;
2577    for (Annotation item : this.note)
2578      if (!item.isEmpty())
2579        return true;
2580    return false;
2581  }
2582
2583  public Annotation addNote() { // 3
2584    Annotation t = new Annotation();
2585    if (this.note == null)
2586      this.note = new ArrayList<Annotation>();
2587    this.note.add(t);
2588    return t;
2589  }
2590
2591  public DeviceRequest addNote(Annotation t) { // 3
2592    if (t == null)
2593      return this;
2594    if (this.note == null)
2595      this.note = new ArrayList<Annotation>();
2596    this.note.add(t);
2597    return this;
2598  }
2599
2600  /**
2601   * @return The first repetition of repeating field {@link #note}, creating it if
2602   *         it does not already exist
2603   */
2604  public Annotation getNoteFirstRep() {
2605    if (getNote().isEmpty()) {
2606      addNote();
2607    }
2608    return getNote().get(0);
2609  }
2610
2611  /**
2612   * @return {@link #relevantHistory} (Key events in the history of the request.)
2613   */
2614  public List<Reference> getRelevantHistory() {
2615    if (this.relevantHistory == null)
2616      this.relevantHistory = new ArrayList<Reference>();
2617    return this.relevantHistory;
2618  }
2619
2620  /**
2621   * @return Returns a reference to <code>this</code> for easy method chaining
2622   */
2623  public DeviceRequest setRelevantHistory(List<Reference> theRelevantHistory) {
2624    this.relevantHistory = theRelevantHistory;
2625    return this;
2626  }
2627
2628  public boolean hasRelevantHistory() {
2629    if (this.relevantHistory == null)
2630      return false;
2631    for (Reference item : this.relevantHistory)
2632      if (!item.isEmpty())
2633        return true;
2634    return false;
2635  }
2636
2637  public Reference addRelevantHistory() { // 3
2638    Reference t = new Reference();
2639    if (this.relevantHistory == null)
2640      this.relevantHistory = new ArrayList<Reference>();
2641    this.relevantHistory.add(t);
2642    return t;
2643  }
2644
2645  public DeviceRequest addRelevantHistory(Reference t) { // 3
2646    if (t == null)
2647      return this;
2648    if (this.relevantHistory == null)
2649      this.relevantHistory = new ArrayList<Reference>();
2650    this.relevantHistory.add(t);
2651    return this;
2652  }
2653
2654  /**
2655   * @return The first repetition of repeating field {@link #relevantHistory},
2656   *         creating it if it does not already exist
2657   */
2658  public Reference getRelevantHistoryFirstRep() {
2659    if (getRelevantHistory().isEmpty()) {
2660      addRelevantHistory();
2661    }
2662    return getRelevantHistory().get(0);
2663  }
2664
2665  /**
2666   * @deprecated Use Reference#setResource(IBaseResource) instead
2667   */
2668  @Deprecated
2669  public List<Provenance> getRelevantHistoryTarget() {
2670    if (this.relevantHistoryTarget == null)
2671      this.relevantHistoryTarget = new ArrayList<Provenance>();
2672    return this.relevantHistoryTarget;
2673  }
2674
2675  /**
2676   * @deprecated Use Reference#setResource(IBaseResource) instead
2677   */
2678  @Deprecated
2679  public Provenance addRelevantHistoryTarget() {
2680    Provenance r = new Provenance();
2681    if (this.relevantHistoryTarget == null)
2682      this.relevantHistoryTarget = new ArrayList<Provenance>();
2683    this.relevantHistoryTarget.add(r);
2684    return r;
2685  }
2686
2687  protected void listChildren(List<Property> children) {
2688    super.listChildren(children);
2689    children.add(new Property("identifier", "Identifier",
2690        "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE,
2691        identifier));
2692    children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)",
2693        "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.",
2694        0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2695    children.add(new Property("instantiatesUri", "uri",
2696        "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.",
2697        0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2698    children.add(new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.", 0,
2699        java.lang.Integer.MAX_VALUE, basedOn));
2700    children.add(new Property("priorRequest", "Reference(Any)",
2701        "The request takes the place of the referenced completed or terminated request(s).", 0,
2702        java.lang.Integer.MAX_VALUE, priorRequest));
2703    children.add(
2704        new Property("groupIdentifier", "Identifier", "Composite request this is part of.", 0, 1, groupIdentifier));
2705    children.add(new Property("status", "code", "The status of the request.", 0, 1, status));
2706    children.add(new Property("intent", "code",
2707        "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent));
2708    children.add(new Property("priority", "code",
2709        "Indicates how quickly the {{title}} should be addressed with respect to other requests.", 0, 1, priority));
2710    children.add(new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.",
2711        0, 1, code));
2712    children.add(new Property("parameter", "",
2713        "Specific parameters for the ordered item.  For example, the prism value for lenses.", 0,
2714        java.lang.Integer.MAX_VALUE, parameter));
2715    children.add(new Property("subject", "Reference(Patient|Group|Location|Device)",
2716        "The patient who will use the device.", 0, 1, subject));
2717    children.add(new Property("encounter", "Reference(Encounter)",
2718        "An encounter that provides additional context in which this request is made.", 0, 1, encounter));
2719    children.add(new Property("occurrence[x]", "dateTime|Period|Timing",
2720        "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\".",
2721        0, 1, occurrence));
2722    children.add(
2723        new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, 1, authoredOn));
2724    children.add(new Property("requester", "Reference(Device|Practitioner|PractitionerRole|Organization)",
2725        "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester));
2726    children.add(new Property("performerType", "CodeableConcept",
2727        "Desired type of performer for doing the diagnostic testing.", 0, 1, performerType));
2728    children.add(new Property("performer",
2729        "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)",
2730        "The desired performer for doing the diagnostic testing.", 0, 1, performer));
2731    children.add(new Property("reasonCode", "CodeableConcept", "Reason or justification for the use of this device.", 0,
2732        java.lang.Integer.MAX_VALUE, reasonCode));
2733    children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)",
2734        "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2735    children.add(new Property("insurance", "Reference(Coverage|ClaimResponse)",
2736        "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.",
2737        0, java.lang.Integer.MAX_VALUE, insurance));
2738    children.add(new Property("supportingInfo", "Reference(Any)",
2739        "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).",
2740        0, java.lang.Integer.MAX_VALUE, supportingInfo));
2741    children.add(new Property("note", "Annotation",
2742        "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.",
2743        0, java.lang.Integer.MAX_VALUE, note));
2744    children.add(new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.",
2745        0, java.lang.Integer.MAX_VALUE, relevantHistory));
2746  }
2747
2748  @Override
2749  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2750    switch (_hash) {
2751    case -1618432855:
2752      /* identifier */ return new Property("identifier", "Identifier",
2753          "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE,
2754          identifier);
2755    case 8911915:
2756      /* instantiatesCanonical */ return new Property("instantiatesCanonical",
2757          "canonical(ActivityDefinition|PlanDefinition)",
2758          "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.",
2759          0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2760    case -1926393373:
2761      /* instantiatesUri */ return new Property("instantiatesUri", "uri",
2762          "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.",
2763          0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2764    case -332612366:
2765      /* basedOn */ return new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.",
2766          0, java.lang.Integer.MAX_VALUE, basedOn);
2767    case 237568101:
2768      /* priorRequest */ return new Property("priorRequest", "Reference(Any)",
2769          "The request takes the place of the referenced completed or terminated request(s).", 0,
2770          java.lang.Integer.MAX_VALUE, priorRequest);
2771    case -445338488:
2772      /* groupIdentifier */ return new Property("groupIdentifier", "Identifier", "Composite request this is part of.",
2773          0, 1, groupIdentifier);
2774    case -892481550:
2775      /* status */ return new Property("status", "code", "The status of the request.", 0, 1, status);
2776    case -1183762788:
2777      /* intent */ return new Property("intent", "code",
2778          "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent);
2779    case -1165461084:
2780      /* priority */ return new Property("priority", "code",
2781          "Indicates how quickly the {{title}} should be addressed with respect to other requests.", 0, 1, priority);
2782    case 941839219:
2783      /* code[x] */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
2784          "The details of the device to be used.", 0, 1, code);
2785    case 3059181:
2786      /* code */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
2787          "The details of the device to be used.", 0, 1, code);
2788    case 1565461470:
2789      /* codeReference */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
2790          "The details of the device to be used.", 0, 1, code);
2791    case 4899316:
2792      /* codeCodeableConcept */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
2793          "The details of the device to be used.", 0, 1, code);
2794    case 1954460585:
2795      /* parameter */ return new Property("parameter", "",
2796          "Specific parameters for the ordered item.  For example, the prism value for lenses.", 0,
2797          java.lang.Integer.MAX_VALUE, parameter);
2798    case -1867885268:
2799      /* subject */ return new Property("subject", "Reference(Patient|Group|Location|Device)",
2800          "The patient who will use the device.", 0, 1, subject);
2801    case 1524132147:
2802      /* encounter */ return new Property("encounter", "Reference(Encounter)",
2803          "An encounter that provides additional context in which this request is made.", 0, 1, encounter);
2804    case -2022646513:
2805      /* occurrence[x] */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2806          "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\".",
2807          0, 1, occurrence);
2808    case 1687874001:
2809      /* occurrence */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2810          "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\".",
2811          0, 1, occurrence);
2812    case -298443636:
2813      /* occurrenceDateTime */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2814          "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\".",
2815          0, 1, occurrence);
2816    case 1397156594:
2817      /* occurrencePeriod */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2818          "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\".",
2819          0, 1, occurrence);
2820    case 1515218299:
2821      /* occurrenceTiming */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2822          "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\".",
2823          0, 1, occurrence);
2824    case -1500852503:
2825      /* authoredOn */ return new Property("authoredOn", "dateTime",
2826          "When the request transitioned to being actionable.", 0, 1, authoredOn);
2827    case 693933948:
2828      /* requester */ return new Property("requester", "Reference(Device|Practitioner|PractitionerRole|Organization)",
2829          "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester);
2830    case -901444568:
2831      /* performerType */ return new Property("performerType", "CodeableConcept",
2832          "Desired type of performer for doing the diagnostic testing.", 0, 1, performerType);
2833    case 481140686:
2834      /* performer */ return new Property("performer",
2835          "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)",
2836          "The desired performer for doing the diagnostic testing.", 0, 1, performer);
2837    case 722137681:
2838      /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
2839          "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2840    case -1146218137:
2841      /* reasonReference */ return new Property("reasonReference",
2842          "Reference(Condition|Observation|DiagnosticReport|DocumentReference)",
2843          "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2844    case 73049818:
2845      /* insurance */ return new Property("insurance", "Reference(Coverage|ClaimResponse)",
2846          "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.",
2847          0, java.lang.Integer.MAX_VALUE, insurance);
2848    case 1922406657:
2849      /* supportingInfo */ return new Property("supportingInfo", "Reference(Any)",
2850          "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).",
2851          0, java.lang.Integer.MAX_VALUE, supportingInfo);
2852    case 3387378:
2853      /* note */ return new Property("note", "Annotation",
2854          "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.",
2855          0, java.lang.Integer.MAX_VALUE, note);
2856    case 1538891575:
2857      /* relevantHistory */ return new Property("relevantHistory", "Reference(Provenance)",
2858          "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
2859    default:
2860      return super.getNamedProperty(_hash, _name, _checkValid);
2861    }
2862
2863  }
2864
2865  @Override
2866  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2867    switch (hash) {
2868    case -1618432855:
2869      /* identifier */ return this.identifier == null ? new Base[0]
2870          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2871    case 8911915:
2872      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
2873          : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2874    case -1926393373:
2875      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0]
2876          : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2877    case -332612366:
2878      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2879    case 237568101:
2880      /* priorRequest */ return this.priorRequest == null ? new Base[0]
2881          : this.priorRequest.toArray(new Base[this.priorRequest.size()]); // Reference
2882    case -445338488:
2883      /* groupIdentifier */ return this.groupIdentifier == null ? new Base[0] : new Base[] { this.groupIdentifier }; // Identifier
2884    case -892481550:
2885      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<DeviceRequestStatus>
2886    case -1183762788:
2887      /* intent */ return this.intent == null ? new Base[0] : new Base[] { this.intent }; // Enumeration<RequestIntent>
2888    case -1165461084:
2889      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // Enumeration<RequestPriority>
2890    case 3059181:
2891      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // Type
2892    case 1954460585:
2893      /* parameter */ return this.parameter == null ? new Base[0]
2894          : this.parameter.toArray(new Base[this.parameter.size()]); // DeviceRequestParameterComponent
2895    case -1867885268:
2896      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2897    case 1524132147:
2898      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
2899    case 1687874001:
2900      /* occurrence */ return this.occurrence == null ? new Base[0] : new Base[] { this.occurrence }; // Type
2901    case -1500852503:
2902      /* authoredOn */ return this.authoredOn == null ? new Base[0] : new Base[] { this.authoredOn }; // DateTimeType
2903    case 693933948:
2904      /* requester */ return this.requester == null ? new Base[0] : new Base[] { this.requester }; // Reference
2905    case -901444568:
2906      /* performerType */ return this.performerType == null ? new Base[0] : new Base[] { this.performerType }; // CodeableConcept
2907    case 481140686:
2908      /* performer */ return this.performer == null ? new Base[0] : new Base[] { this.performer }; // Reference
2909    case 722137681:
2910      /* reasonCode */ return this.reasonCode == null ? new Base[0]
2911          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2912    case -1146218137:
2913      /* reasonReference */ return this.reasonReference == null ? new Base[0]
2914          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2915    case 73049818:
2916      /* insurance */ return this.insurance == null ? new Base[0]
2917          : this.insurance.toArray(new Base[this.insurance.size()]); // Reference
2918    case 1922406657:
2919      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
2920          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
2921    case 3387378:
2922      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2923    case 1538891575:
2924      /* relevantHistory */ return this.relevantHistory == null ? new Base[0]
2925          : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
2926    default:
2927      return super.getProperty(hash, name, checkValid);
2928    }
2929
2930  }
2931
2932  @Override
2933  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2934    switch (hash) {
2935    case -1618432855: // identifier
2936      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2937      return value;
2938    case 8911915: // instantiatesCanonical
2939      this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
2940      return value;
2941    case -1926393373: // instantiatesUri
2942      this.getInstantiatesUri().add(castToUri(value)); // UriType
2943      return value;
2944    case -332612366: // basedOn
2945      this.getBasedOn().add(castToReference(value)); // Reference
2946      return value;
2947    case 237568101: // priorRequest
2948      this.getPriorRequest().add(castToReference(value)); // Reference
2949      return value;
2950    case -445338488: // groupIdentifier
2951      this.groupIdentifier = castToIdentifier(value); // Identifier
2952      return value;
2953    case -892481550: // status
2954      value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
2955      this.status = (Enumeration) value; // Enumeration<DeviceRequestStatus>
2956      return value;
2957    case -1183762788: // intent
2958      value = new RequestIntentEnumFactory().fromType(castToCode(value));
2959      this.intent = (Enumeration) value; // Enumeration<RequestIntent>
2960      return value;
2961    case -1165461084: // priority
2962      value = new RequestPriorityEnumFactory().fromType(castToCode(value));
2963      this.priority = (Enumeration) value; // Enumeration<RequestPriority>
2964      return value;
2965    case 3059181: // code
2966      this.code = castToType(value); // Type
2967      return value;
2968    case 1954460585: // parameter
2969      this.getParameter().add((DeviceRequestParameterComponent) value); // DeviceRequestParameterComponent
2970      return value;
2971    case -1867885268: // subject
2972      this.subject = castToReference(value); // Reference
2973      return value;
2974    case 1524132147: // encounter
2975      this.encounter = castToReference(value); // Reference
2976      return value;
2977    case 1687874001: // occurrence
2978      this.occurrence = castToType(value); // Type
2979      return value;
2980    case -1500852503: // authoredOn
2981      this.authoredOn = castToDateTime(value); // DateTimeType
2982      return value;
2983    case 693933948: // requester
2984      this.requester = castToReference(value); // Reference
2985      return value;
2986    case -901444568: // performerType
2987      this.performerType = castToCodeableConcept(value); // CodeableConcept
2988      return value;
2989    case 481140686: // performer
2990      this.performer = castToReference(value); // Reference
2991      return value;
2992    case 722137681: // reasonCode
2993      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2994      return value;
2995    case -1146218137: // reasonReference
2996      this.getReasonReference().add(castToReference(value)); // Reference
2997      return value;
2998    case 73049818: // insurance
2999      this.getInsurance().add(castToReference(value)); // Reference
3000      return value;
3001    case 1922406657: // supportingInfo
3002      this.getSupportingInfo().add(castToReference(value)); // Reference
3003      return value;
3004    case 3387378: // note
3005      this.getNote().add(castToAnnotation(value)); // Annotation
3006      return value;
3007    case 1538891575: // relevantHistory
3008      this.getRelevantHistory().add(castToReference(value)); // Reference
3009      return value;
3010    default:
3011      return super.setProperty(hash, name, value);
3012    }
3013
3014  }
3015
3016  @Override
3017  public Base setProperty(String name, Base value) throws FHIRException {
3018    if (name.equals("identifier")) {
3019      this.getIdentifier().add(castToIdentifier(value));
3020    } else if (name.equals("instantiatesCanonical")) {
3021      this.getInstantiatesCanonical().add(castToCanonical(value));
3022    } else if (name.equals("instantiatesUri")) {
3023      this.getInstantiatesUri().add(castToUri(value));
3024    } else if (name.equals("basedOn")) {
3025      this.getBasedOn().add(castToReference(value));
3026    } else if (name.equals("priorRequest")) {
3027      this.getPriorRequest().add(castToReference(value));
3028    } else if (name.equals("groupIdentifier")) {
3029      this.groupIdentifier = castToIdentifier(value); // Identifier
3030    } else if (name.equals("status")) {
3031      value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
3032      this.status = (Enumeration) value; // Enumeration<DeviceRequestStatus>
3033    } else if (name.equals("intent")) {
3034      value = new RequestIntentEnumFactory().fromType(castToCode(value));
3035      this.intent = (Enumeration) value; // Enumeration<RequestIntent>
3036    } else if (name.equals("priority")) {
3037      value = new RequestPriorityEnumFactory().fromType(castToCode(value));
3038      this.priority = (Enumeration) value; // Enumeration<RequestPriority>
3039    } else if (name.equals("code[x]")) {
3040      this.code = castToType(value); // Type
3041    } else if (name.equals("parameter")) {
3042      this.getParameter().add((DeviceRequestParameterComponent) value);
3043    } else if (name.equals("subject")) {
3044      this.subject = castToReference(value); // Reference
3045    } else if (name.equals("encounter")) {
3046      this.encounter = castToReference(value); // Reference
3047    } else if (name.equals("occurrence[x]")) {
3048      this.occurrence = castToType(value); // Type
3049    } else if (name.equals("authoredOn")) {
3050      this.authoredOn = castToDateTime(value); // DateTimeType
3051    } else if (name.equals("requester")) {
3052      this.requester = castToReference(value); // Reference
3053    } else if (name.equals("performerType")) {
3054      this.performerType = castToCodeableConcept(value); // CodeableConcept
3055    } else if (name.equals("performer")) {
3056      this.performer = castToReference(value); // Reference
3057    } else if (name.equals("reasonCode")) {
3058      this.getReasonCode().add(castToCodeableConcept(value));
3059    } else if (name.equals("reasonReference")) {
3060      this.getReasonReference().add(castToReference(value));
3061    } else if (name.equals("insurance")) {
3062      this.getInsurance().add(castToReference(value));
3063    } else if (name.equals("supportingInfo")) {
3064      this.getSupportingInfo().add(castToReference(value));
3065    } else if (name.equals("note")) {
3066      this.getNote().add(castToAnnotation(value));
3067    } else if (name.equals("relevantHistory")) {
3068      this.getRelevantHistory().add(castToReference(value));
3069    } else
3070      return super.setProperty(name, value);
3071    return value;
3072  }
3073
3074  @Override
3075  public void removeChild(String name, Base value) throws FHIRException {
3076    if (name.equals("identifier")) {
3077      this.getIdentifier().remove(castToIdentifier(value));
3078    } else if (name.equals("instantiatesCanonical")) {
3079      this.getInstantiatesCanonical().remove(castToCanonical(value));
3080    } else if (name.equals("instantiatesUri")) {
3081      this.getInstantiatesUri().remove(castToUri(value));
3082    } else if (name.equals("basedOn")) {
3083      this.getBasedOn().remove(castToReference(value));
3084    } else if (name.equals("priorRequest")) {
3085      this.getPriorRequest().remove(castToReference(value));
3086    } else if (name.equals("groupIdentifier")) {
3087      this.groupIdentifier = null;
3088    } else if (name.equals("status")) {
3089      this.status = null;
3090    } else if (name.equals("intent")) {
3091      this.intent = null;
3092    } else if (name.equals("priority")) {
3093      this.priority = null;
3094    } else if (name.equals("code[x]")) {
3095      this.code = null;
3096    } else if (name.equals("parameter")) {
3097      this.getParameter().remove((DeviceRequestParameterComponent) value);
3098    } else if (name.equals("subject")) {
3099      this.subject = null;
3100    } else if (name.equals("encounter")) {
3101      this.encounter = null;
3102    } else if (name.equals("occurrence[x]")) {
3103      this.occurrence = null;
3104    } else if (name.equals("authoredOn")) {
3105      this.authoredOn = null;
3106    } else if (name.equals("requester")) {
3107      this.requester = null;
3108    } else if (name.equals("performerType")) {
3109      this.performerType = null;
3110    } else if (name.equals("performer")) {
3111      this.performer = null;
3112    } else if (name.equals("reasonCode")) {
3113      this.getReasonCode().remove(castToCodeableConcept(value));
3114    } else if (name.equals("reasonReference")) {
3115      this.getReasonReference().remove(castToReference(value));
3116    } else if (name.equals("insurance")) {
3117      this.getInsurance().remove(castToReference(value));
3118    } else if (name.equals("supportingInfo")) {
3119      this.getSupportingInfo().remove(castToReference(value));
3120    } else if (name.equals("note")) {
3121      this.getNote().remove(castToAnnotation(value));
3122    } else if (name.equals("relevantHistory")) {
3123      this.getRelevantHistory().remove(castToReference(value));
3124    } else
3125      super.removeChild(name, value);
3126    
3127  }
3128
3129  @Override
3130  public Base makeProperty(int hash, String name) throws FHIRException {
3131    switch (hash) {
3132    case -1618432855:
3133      return addIdentifier();
3134    case 8911915:
3135      return addInstantiatesCanonicalElement();
3136    case -1926393373:
3137      return addInstantiatesUriElement();
3138    case -332612366:
3139      return addBasedOn();
3140    case 237568101:
3141      return addPriorRequest();
3142    case -445338488:
3143      return getGroupIdentifier();
3144    case -892481550:
3145      return getStatusElement();
3146    case -1183762788:
3147      return getIntentElement();
3148    case -1165461084:
3149      return getPriorityElement();
3150    case 941839219:
3151      return getCode();
3152    case 3059181:
3153      return getCode();
3154    case 1954460585:
3155      return addParameter();
3156    case -1867885268:
3157      return getSubject();
3158    case 1524132147:
3159      return getEncounter();
3160    case -2022646513:
3161      return getOccurrence();
3162    case 1687874001:
3163      return getOccurrence();
3164    case -1500852503:
3165      return getAuthoredOnElement();
3166    case 693933948:
3167      return getRequester();
3168    case -901444568:
3169      return getPerformerType();
3170    case 481140686:
3171      return getPerformer();
3172    case 722137681:
3173      return addReasonCode();
3174    case -1146218137:
3175      return addReasonReference();
3176    case 73049818:
3177      return addInsurance();
3178    case 1922406657:
3179      return addSupportingInfo();
3180    case 3387378:
3181      return addNote();
3182    case 1538891575:
3183      return addRelevantHistory();
3184    default:
3185      return super.makeProperty(hash, name);
3186    }
3187
3188  }
3189
3190  @Override
3191  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3192    switch (hash) {
3193    case -1618432855:
3194      /* identifier */ return new String[] { "Identifier" };
3195    case 8911915:
3196      /* instantiatesCanonical */ return new String[] { "canonical" };
3197    case -1926393373:
3198      /* instantiatesUri */ return new String[] { "uri" };
3199    case -332612366:
3200      /* basedOn */ return new String[] { "Reference" };
3201    case 237568101:
3202      /* priorRequest */ return new String[] { "Reference" };
3203    case -445338488:
3204      /* groupIdentifier */ return new String[] { "Identifier" };
3205    case -892481550:
3206      /* status */ return new String[] { "code" };
3207    case -1183762788:
3208      /* intent */ return new String[] { "code" };
3209    case -1165461084:
3210      /* priority */ return new String[] { "code" };
3211    case 3059181:
3212      /* code */ return new String[] { "Reference", "CodeableConcept" };
3213    case 1954460585:
3214      /* parameter */ return new String[] {};
3215    case -1867885268:
3216      /* subject */ return new String[] { "Reference" };
3217    case 1524132147:
3218      /* encounter */ return new String[] { "Reference" };
3219    case 1687874001:
3220      /* occurrence */ return new String[] { "dateTime", "Period", "Timing" };
3221    case -1500852503:
3222      /* authoredOn */ return new String[] { "dateTime" };
3223    case 693933948:
3224      /* requester */ return new String[] { "Reference" };
3225    case -901444568:
3226      /* performerType */ return new String[] { "CodeableConcept" };
3227    case 481140686:
3228      /* performer */ return new String[] { "Reference" };
3229    case 722137681:
3230      /* reasonCode */ return new String[] { "CodeableConcept" };
3231    case -1146218137:
3232      /* reasonReference */ return new String[] { "Reference" };
3233    case 73049818:
3234      /* insurance */ return new String[] { "Reference" };
3235    case 1922406657:
3236      /* supportingInfo */ return new String[] { "Reference" };
3237    case 3387378:
3238      /* note */ return new String[] { "Annotation" };
3239    case 1538891575:
3240      /* relevantHistory */ return new String[] { "Reference" };
3241    default:
3242      return super.getTypesForProperty(hash, name);
3243    }
3244
3245  }
3246
3247  @Override
3248  public Base addChild(String name) throws FHIRException {
3249    if (name.equals("identifier")) {
3250      return addIdentifier();
3251    } else if (name.equals("instantiatesCanonical")) {
3252      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.instantiatesCanonical");
3253    } else if (name.equals("instantiatesUri")) {
3254      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.instantiatesUri");
3255    } else if (name.equals("basedOn")) {
3256      return addBasedOn();
3257    } else if (name.equals("priorRequest")) {
3258      return addPriorRequest();
3259    } else if (name.equals("groupIdentifier")) {
3260      this.groupIdentifier = new Identifier();
3261      return this.groupIdentifier;
3262    } else if (name.equals("status")) {
3263      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.status");
3264    } else if (name.equals("intent")) {
3265      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.intent");
3266    } else if (name.equals("priority")) {
3267      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.priority");
3268    } else if (name.equals("codeReference")) {
3269      this.code = new Reference();
3270      return this.code;
3271    } else if (name.equals("codeCodeableConcept")) {
3272      this.code = new CodeableConcept();
3273      return this.code;
3274    } else if (name.equals("parameter")) {
3275      return addParameter();
3276    } else if (name.equals("subject")) {
3277      this.subject = new Reference();
3278      return this.subject;
3279    } else if (name.equals("encounter")) {
3280      this.encounter = new Reference();
3281      return this.encounter;
3282    } else if (name.equals("occurrenceDateTime")) {
3283      this.occurrence = new DateTimeType();
3284      return this.occurrence;
3285    } else if (name.equals("occurrencePeriod")) {
3286      this.occurrence = new Period();
3287      return this.occurrence;
3288    } else if (name.equals("occurrenceTiming")) {
3289      this.occurrence = new Timing();
3290      return this.occurrence;
3291    } else if (name.equals("authoredOn")) {
3292      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.authoredOn");
3293    } else if (name.equals("requester")) {
3294      this.requester = new Reference();
3295      return this.requester;
3296    } else if (name.equals("performerType")) {
3297      this.performerType = new CodeableConcept();
3298      return this.performerType;
3299    } else if (name.equals("performer")) {
3300      this.performer = new Reference();
3301      return this.performer;
3302    } else if (name.equals("reasonCode")) {
3303      return addReasonCode();
3304    } else if (name.equals("reasonReference")) {
3305      return addReasonReference();
3306    } else if (name.equals("insurance")) {
3307      return addInsurance();
3308    } else if (name.equals("supportingInfo")) {
3309      return addSupportingInfo();
3310    } else if (name.equals("note")) {
3311      return addNote();
3312    } else if (name.equals("relevantHistory")) {
3313      return addRelevantHistory();
3314    } else
3315      return super.addChild(name);
3316  }
3317
3318  public String fhirType() {
3319    return "DeviceRequest";
3320
3321  }
3322
3323  public DeviceRequest copy() {
3324    DeviceRequest dst = new DeviceRequest();
3325    copyValues(dst);
3326    return dst;
3327  }
3328
3329  public void copyValues(DeviceRequest dst) {
3330    super.copyValues(dst);
3331    if (identifier != null) {
3332      dst.identifier = new ArrayList<Identifier>();
3333      for (Identifier i : identifier)
3334        dst.identifier.add(i.copy());
3335    }
3336    ;
3337    if (instantiatesCanonical != null) {
3338      dst.instantiatesCanonical = new ArrayList<CanonicalType>();
3339      for (CanonicalType i : instantiatesCanonical)
3340        dst.instantiatesCanonical.add(i.copy());
3341    }
3342    ;
3343    if (instantiatesUri != null) {
3344      dst.instantiatesUri = new ArrayList<UriType>();
3345      for (UriType i : instantiatesUri)
3346        dst.instantiatesUri.add(i.copy());
3347    }
3348    ;
3349    if (basedOn != null) {
3350      dst.basedOn = new ArrayList<Reference>();
3351      for (Reference i : basedOn)
3352        dst.basedOn.add(i.copy());
3353    }
3354    ;
3355    if (priorRequest != null) {
3356      dst.priorRequest = new ArrayList<Reference>();
3357      for (Reference i : priorRequest)
3358        dst.priorRequest.add(i.copy());
3359    }
3360    ;
3361    dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
3362    dst.status = status == null ? null : status.copy();
3363    dst.intent = intent == null ? null : intent.copy();
3364    dst.priority = priority == null ? null : priority.copy();
3365    dst.code = code == null ? null : code.copy();
3366    if (parameter != null) {
3367      dst.parameter = new ArrayList<DeviceRequestParameterComponent>();
3368      for (DeviceRequestParameterComponent i : parameter)
3369        dst.parameter.add(i.copy());
3370    }
3371    ;
3372    dst.subject = subject == null ? null : subject.copy();
3373    dst.encounter = encounter == null ? null : encounter.copy();
3374    dst.occurrence = occurrence == null ? null : occurrence.copy();
3375    dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
3376    dst.requester = requester == null ? null : requester.copy();
3377    dst.performerType = performerType == null ? null : performerType.copy();
3378    dst.performer = performer == null ? null : performer.copy();
3379    if (reasonCode != null) {
3380      dst.reasonCode = new ArrayList<CodeableConcept>();
3381      for (CodeableConcept i : reasonCode)
3382        dst.reasonCode.add(i.copy());
3383    }
3384    ;
3385    if (reasonReference != null) {
3386      dst.reasonReference = new ArrayList<Reference>();
3387      for (Reference i : reasonReference)
3388        dst.reasonReference.add(i.copy());
3389    }
3390    ;
3391    if (insurance != null) {
3392      dst.insurance = new ArrayList<Reference>();
3393      for (Reference i : insurance)
3394        dst.insurance.add(i.copy());
3395    }
3396    ;
3397    if (supportingInfo != null) {
3398      dst.supportingInfo = new ArrayList<Reference>();
3399      for (Reference i : supportingInfo)
3400        dst.supportingInfo.add(i.copy());
3401    }
3402    ;
3403    if (note != null) {
3404      dst.note = new ArrayList<Annotation>();
3405      for (Annotation i : note)
3406        dst.note.add(i.copy());
3407    }
3408    ;
3409    if (relevantHistory != null) {
3410      dst.relevantHistory = new ArrayList<Reference>();
3411      for (Reference i : relevantHistory)
3412        dst.relevantHistory.add(i.copy());
3413    }
3414    ;
3415  }
3416
3417  protected DeviceRequest typedCopy() {
3418    return copy();
3419  }
3420
3421  @Override
3422  public boolean equalsDeep(Base other_) {
3423    if (!super.equalsDeep(other_))
3424      return false;
3425    if (!(other_ instanceof DeviceRequest))
3426      return false;
3427    DeviceRequest o = (DeviceRequest) other_;
3428    return compareDeep(identifier, o.identifier, true)
3429        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
3430        && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
3431        && compareDeep(priorRequest, o.priorRequest, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
3432        && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true)
3433        && compareDeep(priority, o.priority, true) && compareDeep(code, o.code, true)
3434        && compareDeep(parameter, o.parameter, true) && compareDeep(subject, o.subject, true)
3435        && compareDeep(encounter, o.encounter, true) && compareDeep(occurrence, o.occurrence, true)
3436        && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true)
3437        && compareDeep(performerType, o.performerType, true) && compareDeep(performer, o.performer, true)
3438        && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
3439        && compareDeep(insurance, o.insurance, true) && compareDeep(supportingInfo, o.supportingInfo, true)
3440        && compareDeep(note, o.note, true) && compareDeep(relevantHistory, o.relevantHistory, true);
3441  }
3442
3443  @Override
3444  public boolean equalsShallow(Base other_) {
3445    if (!super.equalsShallow(other_))
3446      return false;
3447    if (!(other_ instanceof DeviceRequest))
3448      return false;
3449    DeviceRequest o = (DeviceRequest) other_;
3450    return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
3451        && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true)
3452        && compareValues(authoredOn, o.authoredOn, true);
3453  }
3454
3455  public boolean isEmpty() {
3456    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical, instantiatesUri,
3457        basedOn, priorRequest, groupIdentifier, status, intent, priority, code, parameter, subject, encounter,
3458        occurrence, authoredOn, requester, performerType, performer, reasonCode, reasonReference, insurance,
3459        supportingInfo, note, relevantHistory);
3460  }
3461
3462  @Override
3463  public ResourceType getResourceType() {
3464    return ResourceType.DeviceRequest;
3465  }
3466
3467  /**
3468   * Search parameter: <b>requester</b>
3469   * <p>
3470   * Description: <b>Who/what is requesting service</b><br>
3471   * Type: <b>reference</b><br>
3472   * Path: <b>DeviceRequest.requester</b><br>
3473   * </p>
3474   */
3475  @SearchParamDefinition(name = "requester", path = "DeviceRequest.requester", description = "Who/what is requesting service", type = "reference", providesMembershipIn = {
3476      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3477      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class,
3478          Organization.class, Practitioner.class, PractitionerRole.class })
3479  public static final String SP_REQUESTER = "requester";
3480  /**
3481   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
3482   * <p>
3483   * Description: <b>Who/what is requesting service</b><br>
3484   * Type: <b>reference</b><br>
3485   * Path: <b>DeviceRequest.requester</b><br>
3486   * </p>
3487   */
3488  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3489      SP_REQUESTER);
3490
3491  /**
3492   * Constant for fluent queries to be used to add include statements. Specifies
3493   * the path value of "<b>DeviceRequest:requester</b>".
3494   */
3495  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include(
3496      "DeviceRequest:requester").toLocked();
3497
3498  /**
3499   * Search parameter: <b>insurance</b>
3500   * <p>
3501   * Description: <b>Associated insurance coverage</b><br>
3502   * Type: <b>reference</b><br>
3503   * Path: <b>DeviceRequest.insurance</b><br>
3504   * </p>
3505   */
3506  @SearchParamDefinition(name = "insurance", path = "DeviceRequest.insurance", description = "Associated insurance coverage", type = "reference", target = {
3507      ClaimResponse.class, Coverage.class })
3508  public static final String SP_INSURANCE = "insurance";
3509  /**
3510   * <b>Fluent Client</b> search parameter constant for <b>insurance</b>
3511   * <p>
3512   * Description: <b>Associated insurance coverage</b><br>
3513   * Type: <b>reference</b><br>
3514   * Path: <b>DeviceRequest.insurance</b><br>
3515   * </p>
3516   */
3517  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSURANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3518      SP_INSURANCE);
3519
3520  /**
3521   * Constant for fluent queries to be used to add include statements. Specifies
3522   * the path value of "<b>DeviceRequest:insurance</b>".
3523   */
3524  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSURANCE = new ca.uhn.fhir.model.api.Include(
3525      "DeviceRequest:insurance").toLocked();
3526
3527  /**
3528   * Search parameter: <b>identifier</b>
3529   * <p>
3530   * Description: <b>Business identifier for request/order</b><br>
3531   * Type: <b>token</b><br>
3532   * Path: <b>DeviceRequest.identifier</b><br>
3533   * </p>
3534   */
3535  @SearchParamDefinition(name = "identifier", path = "DeviceRequest.identifier", description = "Business identifier for request/order", type = "token")
3536  public static final String SP_IDENTIFIER = "identifier";
3537  /**
3538   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3539   * <p>
3540   * Description: <b>Business identifier for request/order</b><br>
3541   * Type: <b>token</b><br>
3542   * Path: <b>DeviceRequest.identifier</b><br>
3543   * </p>
3544   */
3545  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3546      SP_IDENTIFIER);
3547
3548  /**
3549   * Search parameter: <b>code</b>
3550   * <p>
3551   * Description: <b>Code for what is being requested/ordered</b><br>
3552   * Type: <b>token</b><br>
3553   * Path: <b>DeviceRequest.codeCodeableConcept</b><br>
3554   * </p>
3555   */
3556  @SearchParamDefinition(name = "code", path = "(DeviceRequest.code as CodeableConcept)", description = "Code for what is being requested/ordered", type = "token")
3557  public static final String SP_CODE = "code";
3558  /**
3559   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3560   * <p>
3561   * Description: <b>Code for what is being requested/ordered</b><br>
3562   * Type: <b>token</b><br>
3563   * Path: <b>DeviceRequest.codeCodeableConcept</b><br>
3564   * </p>
3565   */
3566  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3567      SP_CODE);
3568
3569  /**
3570   * Search parameter: <b>performer</b>
3571   * <p>
3572   * Description: <b>Desired performer for service</b><br>
3573   * Type: <b>reference</b><br>
3574   * Path: <b>DeviceRequest.performer</b><br>
3575   * </p>
3576   */
3577  @SearchParamDefinition(name = "performer", path = "DeviceRequest.performer", description = "Desired performer for service", type = "reference", providesMembershipIn = {
3578      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3579      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
3580      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { CareTeam.class, Device.class,
3581          HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class,
3582          RelatedPerson.class })
3583  public static final String SP_PERFORMER = "performer";
3584  /**
3585   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3586   * <p>
3587   * Description: <b>Desired performer for service</b><br>
3588   * Type: <b>reference</b><br>
3589   * Path: <b>DeviceRequest.performer</b><br>
3590   * </p>
3591   */
3592  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3593      SP_PERFORMER);
3594
3595  /**
3596   * Constant for fluent queries to be used to add include statements. Specifies
3597   * the path value of "<b>DeviceRequest:performer</b>".
3598   */
3599  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include(
3600      "DeviceRequest:performer").toLocked();
3601
3602  /**
3603   * Search parameter: <b>event-date</b>
3604   * <p>
3605   * Description: <b>When service should occur</b><br>
3606   * Type: <b>date</b><br>
3607   * Path: <b>DeviceRequest.occurrenceDateTime,
3608   * DeviceRequest.occurrencePeriod</b><br>
3609   * </p>
3610   */
3611  @SearchParamDefinition(name = "event-date", path = "(DeviceRequest.occurrence as dateTime) | (DeviceRequest.occurrence as Period)", description = "When service should occur", type = "date")
3612  public static final String SP_EVENT_DATE = "event-date";
3613  /**
3614   * <b>Fluent Client</b> search parameter constant for <b>event-date</b>
3615   * <p>
3616   * Description: <b>When service should occur</b><br>
3617   * Type: <b>date</b><br>
3618   * Path: <b>DeviceRequest.occurrenceDateTime,
3619   * DeviceRequest.occurrencePeriod</b><br>
3620   * </p>
3621   */
3622  public static final ca.uhn.fhir.rest.gclient.DateClientParam EVENT_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3623      SP_EVENT_DATE);
3624
3625  /**
3626   * Search parameter: <b>subject</b>
3627   * <p>
3628   * Description: <b>Individual the service is ordered for</b><br>
3629   * Type: <b>reference</b><br>
3630   * Path: <b>DeviceRequest.subject</b><br>
3631   * </p>
3632   */
3633  @SearchParamDefinition(name = "subject", path = "DeviceRequest.subject", description = "Individual the service is ordered for", type = "reference", providesMembershipIn = {
3634      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3635      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Device.class, Group.class,
3636          Location.class, Patient.class })
3637  public static final String SP_SUBJECT = "subject";
3638  /**
3639   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3640   * <p>
3641   * Description: <b>Individual the service is ordered for</b><br>
3642   * Type: <b>reference</b><br>
3643   * Path: <b>DeviceRequest.subject</b><br>
3644   * </p>
3645   */
3646  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3647      SP_SUBJECT);
3648
3649  /**
3650   * Constant for fluent queries to be used to add include statements. Specifies
3651   * the path value of "<b>DeviceRequest:subject</b>".
3652   */
3653  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
3654      "DeviceRequest:subject").toLocked();
3655
3656  /**
3657   * Search parameter: <b>instantiates-canonical</b>
3658   * <p>
3659   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3660   * Type: <b>reference</b><br>
3661   * Path: <b>DeviceRequest.instantiatesCanonical</b><br>
3662   * </p>
3663   */
3664  @SearchParamDefinition(name = "instantiates-canonical", path = "DeviceRequest.instantiatesCanonical", description = "Instantiates FHIR protocol or definition", type = "reference", target = {
3665      ActivityDefinition.class, PlanDefinition.class })
3666  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
3667  /**
3668   * <b>Fluent Client</b> search parameter constant for
3669   * <b>instantiates-canonical</b>
3670   * <p>
3671   * Description: <b>Instantiates FHIR protocol or definition</b><br>
3672   * Type: <b>reference</b><br>
3673   * Path: <b>DeviceRequest.instantiatesCanonical</b><br>
3674   * </p>
3675   */
3676  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3677      SP_INSTANTIATES_CANONICAL);
3678
3679  /**
3680   * Constant for fluent queries to be used to add include statements. Specifies
3681   * the path value of "<b>DeviceRequest:instantiates-canonical</b>".
3682   */
3683  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include(
3684      "DeviceRequest:instantiates-canonical").toLocked();
3685
3686  /**
3687   * Search parameter: <b>encounter</b>
3688   * <p>
3689   * Description: <b>Encounter during which request was created</b><br>
3690   * Type: <b>reference</b><br>
3691   * Path: <b>DeviceRequest.encounter</b><br>
3692   * </p>
3693   */
3694  @SearchParamDefinition(name = "encounter", path = "DeviceRequest.encounter", description = "Encounter during which request was created", type = "reference", providesMembershipIn = {
3695      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
3696  public static final String SP_ENCOUNTER = "encounter";
3697  /**
3698   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3699   * <p>
3700   * Description: <b>Encounter during which request was created</b><br>
3701   * Type: <b>reference</b><br>
3702   * Path: <b>DeviceRequest.encounter</b><br>
3703   * </p>
3704   */
3705  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3706      SP_ENCOUNTER);
3707
3708  /**
3709   * Constant for fluent queries to be used to add include statements. Specifies
3710   * the path value of "<b>DeviceRequest:encounter</b>".
3711   */
3712  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
3713      "DeviceRequest:encounter").toLocked();
3714
3715  /**
3716   * Search parameter: <b>authored-on</b>
3717   * <p>
3718   * Description: <b>When the request transitioned to being actionable</b><br>
3719   * Type: <b>date</b><br>
3720   * Path: <b>DeviceRequest.authoredOn</b><br>
3721   * </p>
3722   */
3723  @SearchParamDefinition(name = "authored-on", path = "DeviceRequest.authoredOn", description = "When the request transitioned to being actionable", type = "date")
3724  public static final String SP_AUTHORED_ON = "authored-on";
3725  /**
3726   * <b>Fluent Client</b> search parameter constant for <b>authored-on</b>
3727   * <p>
3728   * Description: <b>When the request transitioned to being actionable</b><br>
3729   * Type: <b>date</b><br>
3730   * Path: <b>DeviceRequest.authoredOn</b><br>
3731   * </p>
3732   */
3733  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED_ON = new ca.uhn.fhir.rest.gclient.DateClientParam(
3734      SP_AUTHORED_ON);
3735
3736  /**
3737   * Search parameter: <b>intent</b>
3738   * <p>
3739   * Description: <b>proposal | plan | original-order |reflex-order</b><br>
3740   * Type: <b>token</b><br>
3741   * Path: <b>DeviceRequest.intent</b><br>
3742   * </p>
3743   */
3744  @SearchParamDefinition(name = "intent", path = "DeviceRequest.intent", description = "proposal | plan | original-order |reflex-order", type = "token")
3745  public static final String SP_INTENT = "intent";
3746  /**
3747   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
3748   * <p>
3749   * Description: <b>proposal | plan | original-order |reflex-order</b><br>
3750   * Type: <b>token</b><br>
3751   * Path: <b>DeviceRequest.intent</b><br>
3752   * </p>
3753   */
3754  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3755      SP_INTENT);
3756
3757  /**
3758   * Search parameter: <b>group-identifier</b>
3759   * <p>
3760   * Description: <b>Composite request this is part of</b><br>
3761   * Type: <b>token</b><br>
3762   * Path: <b>DeviceRequest.groupIdentifier</b><br>
3763   * </p>
3764   */
3765  @SearchParamDefinition(name = "group-identifier", path = "DeviceRequest.groupIdentifier", description = "Composite request this is part of", type = "token")
3766  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
3767  /**
3768   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
3769   * <p>
3770   * Description: <b>Composite request this is part of</b><br>
3771   * Type: <b>token</b><br>
3772   * Path: <b>DeviceRequest.groupIdentifier</b><br>
3773   * </p>
3774   */
3775  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3776      SP_GROUP_IDENTIFIER);
3777
3778  /**
3779   * Search parameter: <b>based-on</b>
3780   * <p>
3781   * Description: <b>Plan/proposal/order fulfilled by this request</b><br>
3782   * Type: <b>reference</b><br>
3783   * Path: <b>DeviceRequest.basedOn</b><br>
3784   * </p>
3785   */
3786  @SearchParamDefinition(name = "based-on", path = "DeviceRequest.basedOn", description = "Plan/proposal/order fulfilled by this request", type = "reference")
3787  public static final String SP_BASED_ON = "based-on";
3788  /**
3789   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
3790   * <p>
3791   * Description: <b>Plan/proposal/order fulfilled by this request</b><br>
3792   * Type: <b>reference</b><br>
3793   * Path: <b>DeviceRequest.basedOn</b><br>
3794   * </p>
3795   */
3796  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3797      SP_BASED_ON);
3798
3799  /**
3800   * Constant for fluent queries to be used to add include statements. Specifies
3801   * the path value of "<b>DeviceRequest:based-on</b>".
3802   */
3803  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include(
3804      "DeviceRequest:based-on").toLocked();
3805
3806  /**
3807   * Search parameter: <b>patient</b>
3808   * <p>
3809   * Description: <b>Individual the service is ordered for</b><br>
3810   * Type: <b>reference</b><br>
3811   * Path: <b>DeviceRequest.subject</b><br>
3812   * </p>
3813   */
3814  @SearchParamDefinition(name = "patient", path = "DeviceRequest.subject.where(resolve() is Patient)", description = "Individual the service is ordered for", type = "reference", target = {
3815      Patient.class })
3816  public static final String SP_PATIENT = "patient";
3817  /**
3818   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3819   * <p>
3820   * Description: <b>Individual the service is ordered for</b><br>
3821   * Type: <b>reference</b><br>
3822   * Path: <b>DeviceRequest.subject</b><br>
3823   * </p>
3824   */
3825  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3826      SP_PATIENT);
3827
3828  /**
3829   * Constant for fluent queries to be used to add include statements. Specifies
3830   * the path value of "<b>DeviceRequest:patient</b>".
3831   */
3832  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
3833      "DeviceRequest:patient").toLocked();
3834
3835  /**
3836   * Search parameter: <b>instantiates-uri</b>
3837   * <p>
3838   * Description: <b>Instantiates external protocol or definition</b><br>
3839   * Type: <b>uri</b><br>
3840   * Path: <b>DeviceRequest.instantiatesUri</b><br>
3841   * </p>
3842   */
3843  @SearchParamDefinition(name = "instantiates-uri", path = "DeviceRequest.instantiatesUri", description = "Instantiates external protocol or definition", type = "uri")
3844  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
3845  /**
3846   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
3847   * <p>
3848   * Description: <b>Instantiates external protocol or definition</b><br>
3849   * Type: <b>uri</b><br>
3850   * Path: <b>DeviceRequest.instantiatesUri</b><br>
3851   * </p>
3852   */
3853  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(
3854      SP_INSTANTIATES_URI);
3855
3856  /**
3857   * Search parameter: <b>prior-request</b>
3858   * <p>
3859   * Description: <b>Request takes the place of referenced completed or terminated
3860   * requests</b><br>
3861   * Type: <b>reference</b><br>
3862   * Path: <b>DeviceRequest.priorRequest</b><br>
3863   * </p>
3864   */
3865  @SearchParamDefinition(name = "prior-request", path = "DeviceRequest.priorRequest", description = "Request takes the place of referenced completed or terminated requests", type = "reference")
3866  public static final String SP_PRIOR_REQUEST = "prior-request";
3867  /**
3868   * <b>Fluent Client</b> search parameter constant for <b>prior-request</b>
3869   * <p>
3870   * Description: <b>Request takes the place of referenced completed or terminated
3871   * requests</b><br>
3872   * Type: <b>reference</b><br>
3873   * Path: <b>DeviceRequest.priorRequest</b><br>
3874   * </p>
3875   */
3876  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRIOR_REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3877      SP_PRIOR_REQUEST);
3878
3879  /**
3880   * Constant for fluent queries to be used to add include statements. Specifies
3881   * the path value of "<b>DeviceRequest:prior-request</b>".
3882   */
3883  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRIOR_REQUEST = new ca.uhn.fhir.model.api.Include(
3884      "DeviceRequest:prior-request").toLocked();
3885
3886  /**
3887   * Search parameter: <b>device</b>
3888   * <p>
3889   * Description: <b>Reference to resource that is being requested/ordered</b><br>
3890   * Type: <b>reference</b><br>
3891   * Path: <b>DeviceRequest.codeReference</b><br>
3892   * </p>
3893   */
3894  @SearchParamDefinition(name = "device", path = "(DeviceRequest.code as Reference)", description = "Reference to resource that is being requested/ordered", type = "reference", providesMembershipIn = {
3895      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
3896  public static final String SP_DEVICE = "device";
3897  /**
3898   * <b>Fluent Client</b> search parameter constant for <b>device</b>
3899   * <p>
3900   * Description: <b>Reference to resource that is being requested/ordered</b><br>
3901   * Type: <b>reference</b><br>
3902   * Path: <b>DeviceRequest.codeReference</b><br>
3903   * </p>
3904   */
3905  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3906      SP_DEVICE);
3907
3908  /**
3909   * Constant for fluent queries to be used to add include statements. Specifies
3910   * the path value of "<b>DeviceRequest:device</b>".
3911   */
3912  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include(
3913      "DeviceRequest:device").toLocked();
3914
3915  /**
3916   * Search parameter: <b>status</b>
3917   * <p>
3918   * Description: <b>entered-in-error | draft | active |suspended |
3919   * completed</b><br>
3920   * Type: <b>token</b><br>
3921   * Path: <b>DeviceRequest.status</b><br>
3922   * </p>
3923   */
3924  @SearchParamDefinition(name = "status", path = "DeviceRequest.status", description = "entered-in-error | draft | active |suspended | completed", type = "token")
3925  public static final String SP_STATUS = "status";
3926  /**
3927   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3928   * <p>
3929   * Description: <b>entered-in-error | draft | active |suspended |
3930   * completed</b><br>
3931   * Type: <b>token</b><br>
3932   * Path: <b>DeviceRequest.status</b><br>
3933   * </p>
3934   */
3935  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3936      SP_STATUS);
3937
3938}