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