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