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