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