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