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