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