001package org.hl7.fhir.r4b.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 Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r4b.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 | original-order | reflex-order | filler-order | instance-order | option", 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 that identifies a particular service (i.e., procedure, diagnostic investigation, or panel of investigations) that have been requested.
139     */
140    @Child(name = "code", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=true)
141    @Description(shortDefinition="What is being requested/ordered", formalDefinition="A code that identifies a particular service (i.e., procedure, diagnostic investigation, or panel of investigations) that have been requested." )
142    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-code")
143    protected CodeableConcept 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     * An encounter that provides additional information about the healthcare context in which this request is made.
169     */
170    @Child(name = "encounter", type = {Encounter.class}, order=15, min=0, max=1, modifier=false, summary=true)
171    @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." )
172    protected Reference encounter;
173
174    /**
175     * The date/time at which the requested service should occur.
176     */
177    @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=16, min=0, max=1, modifier=false, summary=true)
178    @Description(shortDefinition="When service should occur", formalDefinition="The date/time at which the requested service should occur." )
179    protected DataType occurrence;
180
181    /**
182     * If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.
183     */
184    @Child(name = "asNeeded", type = {BooleanType.class, CodeableConcept.class}, order=17, min=0, max=1, modifier=false, summary=true)
185    @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." )
186    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-as-needed-reason")
187    protected DataType asNeeded;
188
189    /**
190     * When the request transitioned to being actionable.
191     */
192    @Child(name = "authoredOn", type = {DateTimeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
193    @Description(shortDefinition="Date request signed", formalDefinition="When the request transitioned to being actionable." )
194    protected DateTimeType authoredOn;
195
196    /**
197     * The individual who initiated the request and has responsibility for its activation.
198     */
199    @Child(name = "requester", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=19, min=0, max=1, modifier=false, summary=true)
200    @Description(shortDefinition="Who/what is requesting service", formalDefinition="The individual who initiated the request and has responsibility for its activation." )
201    protected Reference requester;
202
203    /**
204     * Desired type of performer for doing the requested service.
205     */
206    @Child(name = "performerType", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=true)
207    @Description(shortDefinition="Performer role", formalDefinition="Desired type of performer for doing the requested service." )
208    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-role")
209    protected CodeableConcept performerType;
210
211    /**
212     * The desired performer for doing the requested service.  For example, the surgeon, dermatopathologist, endoscopist, etc.
213     */
214    @Child(name = "performer", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, HealthcareService.class, Patient.class, Device.class, RelatedPerson.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
215    @Description(shortDefinition="Requested performer", formalDefinition="The desired performer for doing the requested service.  For example, the surgeon, dermatopathologist, endoscopist, etc." )
216    protected List<Reference> performer;
217
218    /**
219     * 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.
220     */
221    @Child(name = "locationCode", type = {CodeableConcept.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
222    @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." )
223    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ServiceDeliveryLocationRoleType")
224    protected List<CodeableConcept> locationCode;
225
226    /**
227     * A reference to the the preferred location(s) where the procedure should actually happen. E.g. at home or nursing day care center.
228     */
229    @Child(name = "locationReference", type = {Location.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
230    @Description(shortDefinition="Requested location", formalDefinition="A reference to the the preferred location(s) where the procedure should actually happen. E.g. at home or nursing day care center." )
231    protected List<Reference> locationReference;
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 = "reasonCode", type = {CodeableConcept.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<CodeableConcept> reasonCode;
240
241    /**
242     * Indicates another resource that provides a justification for why this service is being requested.   May relate to the resources referred to in `supportingInfo`.
243     */
244    @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
245    @Description(shortDefinition="Explanation/Justification for service or service", formalDefinition="Indicates another resource that provides a justification for why this service is being requested.   May relate to the resources referred to in `supportingInfo`." )
246    protected List<Reference> reasonReference;
247
248    /**
249     * Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be needed for delivering the requested service.
250     */
251    @Child(name = "insurance", type = {Coverage.class, ClaimResponse.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
252    @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." )
253    protected List<Reference> insurance;
254
255    /**
256     * 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.
257     */
258    @Child(name = "supportingInfo", type = {Reference.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
259    @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." )
260    protected List<Reference> supportingInfo;
261
262    /**
263     * One or more specimens that the laboratory procedure will use.
264     */
265    @Child(name = "specimen", type = {Specimen.class}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
266    @Description(shortDefinition="Procedure Samples", formalDefinition="One or more specimens that the laboratory procedure will use." )
267    protected List<Reference> specimen;
268
269    /**
270     * Anatomic location where the procedure should be performed. This is the target site.
271     */
272    @Child(name = "bodySite", type = {CodeableConcept.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
273    @Description(shortDefinition="Location on Body", formalDefinition="Anatomic location where the procedure should be performed. This is the target site." )
274    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
275    protected List<CodeableConcept> bodySite;
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 = -461863342L;
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 that identifies a particular service (i.e., procedure, diagnostic investigation, or panel of investigations) that have been requested.)
861     */
862    public CodeableConcept 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 CodeableConcept(); // 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 that identifies a particular service (i.e., procedure, diagnostic investigation, or panel of investigations) that have been requested.)
877     */
878    public ServiceRequest setCode(CodeableConcept 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 #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
1028     */
1029    public Reference getEncounter() { 
1030      if (this.encounter == null)
1031        if (Configuration.errorOnAutoCreate())
1032          throw new Error("Attempt to auto-create ServiceRequest.encounter");
1033        else if (Configuration.doAutoCreate())
1034          this.encounter = new Reference(); // cc
1035      return this.encounter;
1036    }
1037
1038    public boolean hasEncounter() { 
1039      return this.encounter != null && !this.encounter.isEmpty();
1040    }
1041
1042    /**
1043     * @param value {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
1044     */
1045    public ServiceRequest setEncounter(Reference value) { 
1046      this.encounter = value;
1047      return this;
1048    }
1049
1050    /**
1051     * @return {@link #occurrence} (The date/time at which the requested service should occur.)
1052     */
1053    public DataType getOccurrence() { 
1054      return this.occurrence;
1055    }
1056
1057    /**
1058     * @return {@link #occurrence} (The date/time at which the requested service should occur.)
1059     */
1060    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
1061      if (this.occurrence == null)
1062        this.occurrence = new DateTimeType();
1063      if (!(this.occurrence instanceof DateTimeType))
1064        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1065      return (DateTimeType) this.occurrence;
1066    }
1067
1068    public boolean hasOccurrenceDateTimeType() { 
1069      return this != null && this.occurrence instanceof DateTimeType;
1070    }
1071
1072    /**
1073     * @return {@link #occurrence} (The date/time at which the requested service should occur.)
1074     */
1075    public Period getOccurrencePeriod() throws FHIRException { 
1076      if (this.occurrence == null)
1077        this.occurrence = new Period();
1078      if (!(this.occurrence instanceof Period))
1079        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1080      return (Period) this.occurrence;
1081    }
1082
1083    public boolean hasOccurrencePeriod() { 
1084      return this != null && this.occurrence instanceof Period;
1085    }
1086
1087    /**
1088     * @return {@link #occurrence} (The date/time at which the requested service should occur.)
1089     */
1090    public Timing getOccurrenceTiming() throws FHIRException { 
1091      if (this.occurrence == null)
1092        this.occurrence = new Timing();
1093      if (!(this.occurrence instanceof Timing))
1094        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
1095      return (Timing) this.occurrence;
1096    }
1097
1098    public boolean hasOccurrenceTiming() { 
1099      return this != null && this.occurrence instanceof Timing;
1100    }
1101
1102    public boolean hasOccurrence() { 
1103      return this.occurrence != null && !this.occurrence.isEmpty();
1104    }
1105
1106    /**
1107     * @param value {@link #occurrence} (The date/time at which the requested service should occur.)
1108     */
1109    public ServiceRequest setOccurrence(DataType value) { 
1110      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
1111        throw new Error("Not the right type for ServiceRequest.occurrence[x]: "+value.fhirType());
1112      this.occurrence = value;
1113      return this;
1114    }
1115
1116    /**
1117     * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.)
1118     */
1119    public DataType getAsNeeded() { 
1120      return this.asNeeded;
1121    }
1122
1123    /**
1124     * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.)
1125     */
1126    public BooleanType getAsNeededBooleanType() throws FHIRException { 
1127      if (this.asNeeded == null)
1128        this.asNeeded = new BooleanType();
1129      if (!(this.asNeeded instanceof BooleanType))
1130        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.asNeeded.getClass().getName()+" was encountered");
1131      return (BooleanType) this.asNeeded;
1132    }
1133
1134    public boolean hasAsNeededBooleanType() { 
1135      return this != null && this.asNeeded instanceof BooleanType;
1136    }
1137
1138    /**
1139     * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.)
1140     */
1141    public CodeableConcept getAsNeededCodeableConcept() throws FHIRException { 
1142      if (this.asNeeded == null)
1143        this.asNeeded = new CodeableConcept();
1144      if (!(this.asNeeded instanceof CodeableConcept))
1145        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.asNeeded.getClass().getName()+" was encountered");
1146      return (CodeableConcept) this.asNeeded;
1147    }
1148
1149    public boolean hasAsNeededCodeableConcept() { 
1150      return this != null && this.asNeeded instanceof CodeableConcept;
1151    }
1152
1153    public boolean hasAsNeeded() { 
1154      return this.asNeeded != null && !this.asNeeded.isEmpty();
1155    }
1156
1157    /**
1158     * @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.)
1159     */
1160    public ServiceRequest setAsNeeded(DataType value) { 
1161      if (value != null && !(value instanceof BooleanType || value instanceof CodeableConcept))
1162        throw new Error("Not the right type for ServiceRequest.asNeeded[x]: "+value.fhirType());
1163      this.asNeeded = value;
1164      return this;
1165    }
1166
1167    /**
1168     * @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
1169     */
1170    public DateTimeType getAuthoredOnElement() { 
1171      if (this.authoredOn == null)
1172        if (Configuration.errorOnAutoCreate())
1173          throw new Error("Attempt to auto-create ServiceRequest.authoredOn");
1174        else if (Configuration.doAutoCreate())
1175          this.authoredOn = new DateTimeType(); // bb
1176      return this.authoredOn;
1177    }
1178
1179    public boolean hasAuthoredOnElement() { 
1180      return this.authoredOn != null && !this.authoredOn.isEmpty();
1181    }
1182
1183    public boolean hasAuthoredOn() { 
1184      return this.authoredOn != null && !this.authoredOn.isEmpty();
1185    }
1186
1187    /**
1188     * @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
1189     */
1190    public ServiceRequest setAuthoredOnElement(DateTimeType value) { 
1191      this.authoredOn = value;
1192      return this;
1193    }
1194
1195    /**
1196     * @return When the request transitioned to being actionable.
1197     */
1198    public Date getAuthoredOn() { 
1199      return this.authoredOn == null ? null : this.authoredOn.getValue();
1200    }
1201
1202    /**
1203     * @param value When the request transitioned to being actionable.
1204     */
1205    public ServiceRequest setAuthoredOn(Date value) { 
1206      if (value == null)
1207        this.authoredOn = null;
1208      else {
1209        if (this.authoredOn == null)
1210          this.authoredOn = new DateTimeType();
1211        this.authoredOn.setValue(value);
1212      }
1213      return this;
1214    }
1215
1216    /**
1217     * @return {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1218     */
1219    public Reference getRequester() { 
1220      if (this.requester == null)
1221        if (Configuration.errorOnAutoCreate())
1222          throw new Error("Attempt to auto-create ServiceRequest.requester");
1223        else if (Configuration.doAutoCreate())
1224          this.requester = new Reference(); // cc
1225      return this.requester;
1226    }
1227
1228    public boolean hasRequester() { 
1229      return this.requester != null && !this.requester.isEmpty();
1230    }
1231
1232    /**
1233     * @param value {@link #requester} (The individual who initiated the request and has responsibility for its activation.)
1234     */
1235    public ServiceRequest setRequester(Reference value) { 
1236      this.requester = value;
1237      return this;
1238    }
1239
1240    /**
1241     * @return {@link #performerType} (Desired type of performer for doing the requested service.)
1242     */
1243    public CodeableConcept getPerformerType() { 
1244      if (this.performerType == null)
1245        if (Configuration.errorOnAutoCreate())
1246          throw new Error("Attempt to auto-create ServiceRequest.performerType");
1247        else if (Configuration.doAutoCreate())
1248          this.performerType = new CodeableConcept(); // cc
1249      return this.performerType;
1250    }
1251
1252    public boolean hasPerformerType() { 
1253      return this.performerType != null && !this.performerType.isEmpty();
1254    }
1255
1256    /**
1257     * @param value {@link #performerType} (Desired type of performer for doing the requested service.)
1258     */
1259    public ServiceRequest setPerformerType(CodeableConcept value) { 
1260      this.performerType = value;
1261      return this;
1262    }
1263
1264    /**
1265     * @return {@link #performer} (The desired performer for doing the requested service.  For example, the surgeon, dermatopathologist, endoscopist, etc.)
1266     */
1267    public List<Reference> getPerformer() { 
1268      if (this.performer == null)
1269        this.performer = new ArrayList<Reference>();
1270      return this.performer;
1271    }
1272
1273    /**
1274     * @return Returns a reference to <code>this</code> for easy method chaining
1275     */
1276    public ServiceRequest setPerformer(List<Reference> thePerformer) { 
1277      this.performer = thePerformer;
1278      return this;
1279    }
1280
1281    public boolean hasPerformer() { 
1282      if (this.performer == null)
1283        return false;
1284      for (Reference item : this.performer)
1285        if (!item.isEmpty())
1286          return true;
1287      return false;
1288    }
1289
1290    public Reference addPerformer() { //3
1291      Reference t = new Reference();
1292      if (this.performer == null)
1293        this.performer = new ArrayList<Reference>();
1294      this.performer.add(t);
1295      return t;
1296    }
1297
1298    public ServiceRequest addPerformer(Reference t) { //3
1299      if (t == null)
1300        return this;
1301      if (this.performer == null)
1302        this.performer = new ArrayList<Reference>();
1303      this.performer.add(t);
1304      return this;
1305    }
1306
1307    /**
1308     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist {3}
1309     */
1310    public Reference getPerformerFirstRep() { 
1311      if (getPerformer().isEmpty()) {
1312        addPerformer();
1313      }
1314      return getPerformer().get(0);
1315    }
1316
1317    /**
1318     * @return {@link #locationCode} (The preferred location(s) where the procedure should actually happen in coded or free text form. E.g. at home or nursing day care center.)
1319     */
1320    public List<CodeableConcept> getLocationCode() { 
1321      if (this.locationCode == null)
1322        this.locationCode = new ArrayList<CodeableConcept>();
1323      return this.locationCode;
1324    }
1325
1326    /**
1327     * @return Returns a reference to <code>this</code> for easy method chaining
1328     */
1329    public ServiceRequest setLocationCode(List<CodeableConcept> theLocationCode) { 
1330      this.locationCode = theLocationCode;
1331      return this;
1332    }
1333
1334    public boolean hasLocationCode() { 
1335      if (this.locationCode == null)
1336        return false;
1337      for (CodeableConcept item : this.locationCode)
1338        if (!item.isEmpty())
1339          return true;
1340      return false;
1341    }
1342
1343    public CodeableConcept addLocationCode() { //3
1344      CodeableConcept t = new CodeableConcept();
1345      if (this.locationCode == null)
1346        this.locationCode = new ArrayList<CodeableConcept>();
1347      this.locationCode.add(t);
1348      return t;
1349    }
1350
1351    public ServiceRequest addLocationCode(CodeableConcept t) { //3
1352      if (t == null)
1353        return this;
1354      if (this.locationCode == null)
1355        this.locationCode = new ArrayList<CodeableConcept>();
1356      this.locationCode.add(t);
1357      return this;
1358    }
1359
1360    /**
1361     * @return The first repetition of repeating field {@link #locationCode}, creating it if it does not already exist {3}
1362     */
1363    public CodeableConcept getLocationCodeFirstRep() { 
1364      if (getLocationCode().isEmpty()) {
1365        addLocationCode();
1366      }
1367      return getLocationCode().get(0);
1368    }
1369
1370    /**
1371     * @return {@link #locationReference} (A reference to the the preferred location(s) where the procedure should actually happen. E.g. at home or nursing day care center.)
1372     */
1373    public List<Reference> getLocationReference() { 
1374      if (this.locationReference == null)
1375        this.locationReference = new ArrayList<Reference>();
1376      return this.locationReference;
1377    }
1378
1379    /**
1380     * @return Returns a reference to <code>this</code> for easy method chaining
1381     */
1382    public ServiceRequest setLocationReference(List<Reference> theLocationReference) { 
1383      this.locationReference = theLocationReference;
1384      return this;
1385    }
1386
1387    public boolean hasLocationReference() { 
1388      if (this.locationReference == null)
1389        return false;
1390      for (Reference item : this.locationReference)
1391        if (!item.isEmpty())
1392          return true;
1393      return false;
1394    }
1395
1396    public Reference addLocationReference() { //3
1397      Reference t = new Reference();
1398      if (this.locationReference == null)
1399        this.locationReference = new ArrayList<Reference>();
1400      this.locationReference.add(t);
1401      return t;
1402    }
1403
1404    public ServiceRequest addLocationReference(Reference t) { //3
1405      if (t == null)
1406        return this;
1407      if (this.locationReference == null)
1408        this.locationReference = new ArrayList<Reference>();
1409      this.locationReference.add(t);
1410      return this;
1411    }
1412
1413    /**
1414     * @return The first repetition of repeating field {@link #locationReference}, creating it if it does not already exist {3}
1415     */
1416    public Reference getLocationReferenceFirstRep() { 
1417      if (getLocationReference().isEmpty()) {
1418        addLocationReference();
1419      }
1420      return getLocationReference().get(0);
1421    }
1422
1423    /**
1424     * @return {@link #reasonCode} (An explanation or justification for why this service is being requested in coded or textual form.   This is often for billing purposes.  May relate to the resources referred to in `supportingInfo`.)
1425     */
1426    public List<CodeableConcept> getReasonCode() { 
1427      if (this.reasonCode == null)
1428        this.reasonCode = new ArrayList<CodeableConcept>();
1429      return this.reasonCode;
1430    }
1431
1432    /**
1433     * @return Returns a reference to <code>this</code> for easy method chaining
1434     */
1435    public ServiceRequest setReasonCode(List<CodeableConcept> theReasonCode) { 
1436      this.reasonCode = theReasonCode;
1437      return this;
1438    }
1439
1440    public boolean hasReasonCode() { 
1441      if (this.reasonCode == null)
1442        return false;
1443      for (CodeableConcept item : this.reasonCode)
1444        if (!item.isEmpty())
1445          return true;
1446      return false;
1447    }
1448
1449    public CodeableConcept addReasonCode() { //3
1450      CodeableConcept t = new CodeableConcept();
1451      if (this.reasonCode == null)
1452        this.reasonCode = new ArrayList<CodeableConcept>();
1453      this.reasonCode.add(t);
1454      return t;
1455    }
1456
1457    public ServiceRequest addReasonCode(CodeableConcept t) { //3
1458      if (t == null)
1459        return this;
1460      if (this.reasonCode == null)
1461        this.reasonCode = new ArrayList<CodeableConcept>();
1462      this.reasonCode.add(t);
1463      return this;
1464    }
1465
1466    /**
1467     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist {3}
1468     */
1469    public CodeableConcept getReasonCodeFirstRep() { 
1470      if (getReasonCode().isEmpty()) {
1471        addReasonCode();
1472      }
1473      return getReasonCode().get(0);
1474    }
1475
1476    /**
1477     * @return {@link #reasonReference} (Indicates another resource that provides a justification for why this service is being requested.   May relate to the resources referred to in `supportingInfo`.)
1478     */
1479    public List<Reference> getReasonReference() { 
1480      if (this.reasonReference == null)
1481        this.reasonReference = new ArrayList<Reference>();
1482      return this.reasonReference;
1483    }
1484
1485    /**
1486     * @return Returns a reference to <code>this</code> for easy method chaining
1487     */
1488    public ServiceRequest setReasonReference(List<Reference> theReasonReference) { 
1489      this.reasonReference = theReasonReference;
1490      return this;
1491    }
1492
1493    public boolean hasReasonReference() { 
1494      if (this.reasonReference == null)
1495        return false;
1496      for (Reference item : this.reasonReference)
1497        if (!item.isEmpty())
1498          return true;
1499      return false;
1500    }
1501
1502    public Reference addReasonReference() { //3
1503      Reference t = new Reference();
1504      if (this.reasonReference == null)
1505        this.reasonReference = new ArrayList<Reference>();
1506      this.reasonReference.add(t);
1507      return t;
1508    }
1509
1510    public ServiceRequest addReasonReference(Reference t) { //3
1511      if (t == null)
1512        return this;
1513      if (this.reasonReference == null)
1514        this.reasonReference = new ArrayList<Reference>();
1515      this.reasonReference.add(t);
1516      return this;
1517    }
1518
1519    /**
1520     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist {3}
1521     */
1522    public Reference getReasonReferenceFirstRep() { 
1523      if (getReasonReference().isEmpty()) {
1524        addReasonReference();
1525      }
1526      return getReasonReference().get(0);
1527    }
1528
1529    /**
1530     * @return {@link #insurance} (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be needed for delivering the requested service.)
1531     */
1532    public List<Reference> getInsurance() { 
1533      if (this.insurance == null)
1534        this.insurance = new ArrayList<Reference>();
1535      return this.insurance;
1536    }
1537
1538    /**
1539     * @return Returns a reference to <code>this</code> for easy method chaining
1540     */
1541    public ServiceRequest setInsurance(List<Reference> theInsurance) { 
1542      this.insurance = theInsurance;
1543      return this;
1544    }
1545
1546    public boolean hasInsurance() { 
1547      if (this.insurance == null)
1548        return false;
1549      for (Reference item : this.insurance)
1550        if (!item.isEmpty())
1551          return true;
1552      return false;
1553    }
1554
1555    public Reference addInsurance() { //3
1556      Reference t = new Reference();
1557      if (this.insurance == null)
1558        this.insurance = new ArrayList<Reference>();
1559      this.insurance.add(t);
1560      return t;
1561    }
1562
1563    public ServiceRequest addInsurance(Reference t) { //3
1564      if (t == null)
1565        return this;
1566      if (this.insurance == null)
1567        this.insurance = new ArrayList<Reference>();
1568      this.insurance.add(t);
1569      return this;
1570    }
1571
1572    /**
1573     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist {3}
1574     */
1575    public Reference getInsuranceFirstRep() { 
1576      if (getInsurance().isEmpty()) {
1577        addInsurance();
1578      }
1579      return getInsurance().get(0);
1580    }
1581
1582    /**
1583     * @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.)
1584     */
1585    public List<Reference> getSupportingInfo() { 
1586      if (this.supportingInfo == null)
1587        this.supportingInfo = new ArrayList<Reference>();
1588      return this.supportingInfo;
1589    }
1590
1591    /**
1592     * @return Returns a reference to <code>this</code> for easy method chaining
1593     */
1594    public ServiceRequest setSupportingInfo(List<Reference> theSupportingInfo) { 
1595      this.supportingInfo = theSupportingInfo;
1596      return this;
1597    }
1598
1599    public boolean hasSupportingInfo() { 
1600      if (this.supportingInfo == null)
1601        return false;
1602      for (Reference item : this.supportingInfo)
1603        if (!item.isEmpty())
1604          return true;
1605      return false;
1606    }
1607
1608    public Reference addSupportingInfo() { //3
1609      Reference t = new Reference();
1610      if (this.supportingInfo == null)
1611        this.supportingInfo = new ArrayList<Reference>();
1612      this.supportingInfo.add(t);
1613      return t;
1614    }
1615
1616    public ServiceRequest addSupportingInfo(Reference t) { //3
1617      if (t == null)
1618        return this;
1619      if (this.supportingInfo == null)
1620        this.supportingInfo = new ArrayList<Reference>();
1621      this.supportingInfo.add(t);
1622      return this;
1623    }
1624
1625    /**
1626     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
1627     */
1628    public Reference getSupportingInfoFirstRep() { 
1629      if (getSupportingInfo().isEmpty()) {
1630        addSupportingInfo();
1631      }
1632      return getSupportingInfo().get(0);
1633    }
1634
1635    /**
1636     * @return {@link #specimen} (One or more specimens that the laboratory procedure will use.)
1637     */
1638    public List<Reference> getSpecimen() { 
1639      if (this.specimen == null)
1640        this.specimen = new ArrayList<Reference>();
1641      return this.specimen;
1642    }
1643
1644    /**
1645     * @return Returns a reference to <code>this</code> for easy method chaining
1646     */
1647    public ServiceRequest setSpecimen(List<Reference> theSpecimen) { 
1648      this.specimen = theSpecimen;
1649      return this;
1650    }
1651
1652    public boolean hasSpecimen() { 
1653      if (this.specimen == null)
1654        return false;
1655      for (Reference item : this.specimen)
1656        if (!item.isEmpty())
1657          return true;
1658      return false;
1659    }
1660
1661    public Reference addSpecimen() { //3
1662      Reference t = new Reference();
1663      if (this.specimen == null)
1664        this.specimen = new ArrayList<Reference>();
1665      this.specimen.add(t);
1666      return t;
1667    }
1668
1669    public ServiceRequest addSpecimen(Reference t) { //3
1670      if (t == null)
1671        return this;
1672      if (this.specimen == null)
1673        this.specimen = new ArrayList<Reference>();
1674      this.specimen.add(t);
1675      return this;
1676    }
1677
1678    /**
1679     * @return The first repetition of repeating field {@link #specimen}, creating it if it does not already exist {3}
1680     */
1681    public Reference getSpecimenFirstRep() { 
1682      if (getSpecimen().isEmpty()) {
1683        addSpecimen();
1684      }
1685      return getSpecimen().get(0);
1686    }
1687
1688    /**
1689     * @return {@link #bodySite} (Anatomic location where the procedure should be performed. This is the target site.)
1690     */
1691    public List<CodeableConcept> getBodySite() { 
1692      if (this.bodySite == null)
1693        this.bodySite = new ArrayList<CodeableConcept>();
1694      return this.bodySite;
1695    }
1696
1697    /**
1698     * @return Returns a reference to <code>this</code> for easy method chaining
1699     */
1700    public ServiceRequest setBodySite(List<CodeableConcept> theBodySite) { 
1701      this.bodySite = theBodySite;
1702      return this;
1703    }
1704
1705    public boolean hasBodySite() { 
1706      if (this.bodySite == null)
1707        return false;
1708      for (CodeableConcept item : this.bodySite)
1709        if (!item.isEmpty())
1710          return true;
1711      return false;
1712    }
1713
1714    public CodeableConcept addBodySite() { //3
1715      CodeableConcept t = new CodeableConcept();
1716      if (this.bodySite == null)
1717        this.bodySite = new ArrayList<CodeableConcept>();
1718      this.bodySite.add(t);
1719      return t;
1720    }
1721
1722    public ServiceRequest addBodySite(CodeableConcept t) { //3
1723      if (t == null)
1724        return this;
1725      if (this.bodySite == null)
1726        this.bodySite = new ArrayList<CodeableConcept>();
1727      this.bodySite.add(t);
1728      return this;
1729    }
1730
1731    /**
1732     * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist {3}
1733     */
1734    public CodeableConcept getBodySiteFirstRep() { 
1735      if (getBodySite().isEmpty()) {
1736        addBodySite();
1737      }
1738      return getBodySite().get(0);
1739    }
1740
1741    /**
1742     * @return {@link #note} (Any other notes and comments made about the service request. For example, internal billing notes.)
1743     */
1744    public List<Annotation> getNote() { 
1745      if (this.note == null)
1746        this.note = new ArrayList<Annotation>();
1747      return this.note;
1748    }
1749
1750    /**
1751     * @return Returns a reference to <code>this</code> for easy method chaining
1752     */
1753    public ServiceRequest setNote(List<Annotation> theNote) { 
1754      this.note = theNote;
1755      return this;
1756    }
1757
1758    public boolean hasNote() { 
1759      if (this.note == null)
1760        return false;
1761      for (Annotation item : this.note)
1762        if (!item.isEmpty())
1763          return true;
1764      return false;
1765    }
1766
1767    public Annotation addNote() { //3
1768      Annotation t = new Annotation();
1769      if (this.note == null)
1770        this.note = new ArrayList<Annotation>();
1771      this.note.add(t);
1772      return t;
1773    }
1774
1775    public ServiceRequest addNote(Annotation t) { //3
1776      if (t == null)
1777        return this;
1778      if (this.note == null)
1779        this.note = new ArrayList<Annotation>();
1780      this.note.add(t);
1781      return this;
1782    }
1783
1784    /**
1785     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1786     */
1787    public Annotation getNoteFirstRep() { 
1788      if (getNote().isEmpty()) {
1789        addNote();
1790      }
1791      return getNote().get(0);
1792    }
1793
1794    /**
1795     * @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
1796     */
1797    public StringType getPatientInstructionElement() { 
1798      if (this.patientInstruction == null)
1799        if (Configuration.errorOnAutoCreate())
1800          throw new Error("Attempt to auto-create ServiceRequest.patientInstruction");
1801        else if (Configuration.doAutoCreate())
1802          this.patientInstruction = new StringType(); // bb
1803      return this.patientInstruction;
1804    }
1805
1806    public boolean hasPatientInstructionElement() { 
1807      return this.patientInstruction != null && !this.patientInstruction.isEmpty();
1808    }
1809
1810    public boolean hasPatientInstruction() { 
1811      return this.patientInstruction != null && !this.patientInstruction.isEmpty();
1812    }
1813
1814    /**
1815     * @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
1816     */
1817    public ServiceRequest setPatientInstructionElement(StringType value) { 
1818      this.patientInstruction = value;
1819      return this;
1820    }
1821
1822    /**
1823     * @return Instructions in terms that are understood by the patient or consumer.
1824     */
1825    public String getPatientInstruction() { 
1826      return this.patientInstruction == null ? null : this.patientInstruction.getValue();
1827    }
1828
1829    /**
1830     * @param value Instructions in terms that are understood by the patient or consumer.
1831     */
1832    public ServiceRequest setPatientInstruction(String value) { 
1833      if (Utilities.noString(value))
1834        this.patientInstruction = null;
1835      else {
1836        if (this.patientInstruction == null)
1837          this.patientInstruction = new StringType();
1838        this.patientInstruction.setValue(value);
1839      }
1840      return this;
1841    }
1842
1843    /**
1844     * @return {@link #relevantHistory} (Key events in the history of the request.)
1845     */
1846    public List<Reference> getRelevantHistory() { 
1847      if (this.relevantHistory == null)
1848        this.relevantHistory = new ArrayList<Reference>();
1849      return this.relevantHistory;
1850    }
1851
1852    /**
1853     * @return Returns a reference to <code>this</code> for easy method chaining
1854     */
1855    public ServiceRequest setRelevantHistory(List<Reference> theRelevantHistory) { 
1856      this.relevantHistory = theRelevantHistory;
1857      return this;
1858    }
1859
1860    public boolean hasRelevantHistory() { 
1861      if (this.relevantHistory == null)
1862        return false;
1863      for (Reference item : this.relevantHistory)
1864        if (!item.isEmpty())
1865          return true;
1866      return false;
1867    }
1868
1869    public Reference addRelevantHistory() { //3
1870      Reference t = new Reference();
1871      if (this.relevantHistory == null)
1872        this.relevantHistory = new ArrayList<Reference>();
1873      this.relevantHistory.add(t);
1874      return t;
1875    }
1876
1877    public ServiceRequest addRelevantHistory(Reference t) { //3
1878      if (t == null)
1879        return this;
1880      if (this.relevantHistory == null)
1881        this.relevantHistory = new ArrayList<Reference>();
1882      this.relevantHistory.add(t);
1883      return this;
1884    }
1885
1886    /**
1887     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist {3}
1888     */
1889    public Reference getRelevantHistoryFirstRep() { 
1890      if (getRelevantHistory().isEmpty()) {
1891        addRelevantHistory();
1892      }
1893      return getRelevantHistory().get(0);
1894    }
1895
1896      protected void listChildren(List<Property> children) {
1897        super.listChildren(children);
1898        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));
1899        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));
1900        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));
1901        children.add(new Property("basedOn", "Reference(CarePlan|ServiceRequest|MedicationRequest)", "Plan/proposal/order fulfilled by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1902        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));
1903        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));
1904        children.add(new Property("status", "code", "The status of the order.", 0, 1, status));
1905        children.add(new Property("intent", "code", "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent));
1906        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));
1907        children.add(new Property("priority", "code", "Indicates how quickly the ServiceRequest should be addressed with respect to other requests.", 0, 1, priority));
1908        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));
1909        children.add(new Property("code", "CodeableConcept", "A code that identifies a particular service (i.e., procedure, diagnostic investigation, or panel of investigations) that have been requested.", 0, 1, code));
1910        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));
1911        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));
1912        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));
1913        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));
1914        children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "The date/time at which the requested service should occur.", 0, 1, occurrence));
1915        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));
1916        children.add(new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, 1, authoredOn));
1917        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));
1918        children.add(new Property("performerType", "CodeableConcept", "Desired type of performer for doing the requested service.", 0, 1, performerType));
1919        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));
1920        children.add(new Property("locationCode", "CodeableConcept", "The preferred location(s) where the procedure should actually happen in coded or free text form. E.g. at home or nursing day care center.", 0, java.lang.Integer.MAX_VALUE, locationCode));
1921        children.add(new Property("locationReference", "Reference(Location)", "A reference to the the preferred location(s) where the procedure should actually happen. E.g. at home or nursing day care center.", 0, java.lang.Integer.MAX_VALUE, locationReference));
1922        children.add(new Property("reasonCode", "CodeableConcept", "An explanation or justification for why this service is being requested in coded or textual form.   This is often for billing purposes.  May relate to the resources referred to in `supportingInfo`.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
1923        children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates another resource that provides a justification for why this service is being requested.   May relate to the resources referred to in `supportingInfo`.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
1924        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));
1925        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));
1926        children.add(new Property("specimen", "Reference(Specimen)", "One or more specimens that the laboratory procedure will use.", 0, java.lang.Integer.MAX_VALUE, specimen));
1927        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));
1928        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));
1929        children.add(new Property("patientInstruction", "string", "Instructions in terms that are understood by the patient or consumer.", 0, 1, patientInstruction));
1930        children.add(new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory));
1931      }
1932
1933      @Override
1934      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1935        switch (_hash) {
1936        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);
1937        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);
1938        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);
1939        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);
1940        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);
1941        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);
1942        case -892481550: /*status*/  return new Property("status", "code", "The status of the order.", 0, 1, status);
1943        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);
1944        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);
1945        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the ServiceRequest should be addressed with respect to other requests.", 0, 1, priority);
1946        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);
1947        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code that identifies a particular service (i.e., procedure, diagnostic investigation, or panel of investigations) that have been requested.", 0, 1, code);
1948        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);
1949        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);
1950        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);
1951        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);
1952        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);
1953        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);
1954        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);
1955        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);
1956        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);
1957        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date/time at which the requested service should occur.", 0, 1, occurrence);
1958        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime", "The date/time at which the requested service should occur.", 0, 1, occurrence);
1959        case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "Period", "The date/time at which the requested service should occur.", 0, 1, occurrence);
1960        case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "Timing", "The date/time at which the requested service should occur.", 0, 1, occurrence);
1961        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);
1962        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);
1963        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);
1964        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);
1965        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, 1, authoredOn);
1966        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);
1967        case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "Desired type of performer for doing the requested service.", 0, 1, performerType);
1968        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);
1969        case -58794174: /*locationCode*/  return new Property("locationCode", "CodeableConcept", "The preferred location(s) where the procedure should actually happen in coded or free text form. E.g. at home or nursing day care center.", 0, java.lang.Integer.MAX_VALUE, locationCode);
1970        case 755866390: /*locationReference*/  return new Property("locationReference", "Reference(Location)", "A reference to the the preferred location(s) where the procedure should actually happen. E.g. at home or nursing day care center.", 0, java.lang.Integer.MAX_VALUE, locationReference);
1971        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "An explanation or justification for why this service is being requested in coded or textual form.   This is often for billing purposes.  May relate to the resources referred to in `supportingInfo`.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
1972        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates another resource that provides a justification for why this service is being requested.   May relate to the resources referred to in `supportingInfo`.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
1973        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);
1974        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);
1975        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);
1976        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);
1977        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);
1978        case 737543241: /*patientInstruction*/  return new Property("patientInstruction", "string", "Instructions in terms that are understood by the patient or consumer.", 0, 1, patientInstruction);
1979        case 1538891575: /*relevantHistory*/  return new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
1980        default: return super.getNamedProperty(_hash, _name, _checkValid);
1981        }
1982
1983      }
1984
1985      @Override
1986      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1987        switch (hash) {
1988        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1989        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
1990        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
1991        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
1992        case -430332865: /*replaces*/ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
1993        case 395923612: /*requisition*/ return this.requisition == null ? new Base[0] : new Base[] {this.requisition}; // Identifier
1994        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<RequestStatus>
1995        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<RequestIntent>
1996        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1997        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
1998        case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType
1999        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2000        case 1187338559: /*orderDetail*/ return this.orderDetail == null ? new Base[0] : this.orderDetail.toArray(new Base[this.orderDetail.size()]); // CodeableConcept
2001        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // DataType
2002        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2003        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2004        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // DataType
2005        case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // DataType
2006        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
2007        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // Reference
2008        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : new Base[] {this.performerType}; // CodeableConcept
2009        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // Reference
2010        case -58794174: /*locationCode*/ return this.locationCode == null ? new Base[0] : this.locationCode.toArray(new Base[this.locationCode.size()]); // CodeableConcept
2011        case 755866390: /*locationReference*/ return this.locationReference == null ? new Base[0] : this.locationReference.toArray(new Base[this.locationReference.size()]); // Reference
2012        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2013        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2014        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // Reference
2015        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
2016        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
2017        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // CodeableConcept
2018        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2019        case 737543241: /*patientInstruction*/ return this.patientInstruction == null ? new Base[0] : new Base[] {this.patientInstruction}; // StringType
2020        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
2021        default: return super.getProperty(hash, name, checkValid);
2022        }
2023
2024      }
2025
2026      @Override
2027      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2028        switch (hash) {
2029        case -1618432855: // identifier
2030          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2031          return value;
2032        case 8911915: // instantiatesCanonical
2033          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2034          return value;
2035        case -1926393373: // instantiatesUri
2036          this.getInstantiatesUri().add(TypeConvertor.castToUri(value)); // UriType
2037          return value;
2038        case -332612366: // basedOn
2039          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
2040          return value;
2041        case -430332865: // replaces
2042          this.getReplaces().add(TypeConvertor.castToReference(value)); // Reference
2043          return value;
2044        case 395923612: // requisition
2045          this.requisition = TypeConvertor.castToIdentifier(value); // Identifier
2046          return value;
2047        case -892481550: // status
2048          value = new RequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2049          this.status = (Enumeration) value; // Enumeration<RequestStatus>
2050          return value;
2051        case -1183762788: // intent
2052          value = new RequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
2053          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
2054          return value;
2055        case 50511102: // category
2056          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2057          return value;
2058        case -1165461084: // priority
2059          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
2060          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
2061          return value;
2062        case -1788508167: // doNotPerform
2063          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
2064          return value;
2065        case 3059181: // code
2066          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2067          return value;
2068        case 1187338559: // orderDetail
2069          this.getOrderDetail().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2070          return value;
2071        case -1285004149: // quantity
2072          this.quantity = TypeConvertor.castToType(value); // DataType
2073          return value;
2074        case -1867885268: // subject
2075          this.subject = TypeConvertor.castToReference(value); // Reference
2076          return value;
2077        case 1524132147: // encounter
2078          this.encounter = TypeConvertor.castToReference(value); // Reference
2079          return value;
2080        case 1687874001: // occurrence
2081          this.occurrence = TypeConvertor.castToType(value); // DataType
2082          return value;
2083        case -1432923513: // asNeeded
2084          this.asNeeded = TypeConvertor.castToType(value); // DataType
2085          return value;
2086        case -1500852503: // authoredOn
2087          this.authoredOn = TypeConvertor.castToDateTime(value); // DateTimeType
2088          return value;
2089        case 693933948: // requester
2090          this.requester = TypeConvertor.castToReference(value); // Reference
2091          return value;
2092        case -901444568: // performerType
2093          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2094          return value;
2095        case 481140686: // performer
2096          this.getPerformer().add(TypeConvertor.castToReference(value)); // Reference
2097          return value;
2098        case -58794174: // locationCode
2099          this.getLocationCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2100          return value;
2101        case 755866390: // locationReference
2102          this.getLocationReference().add(TypeConvertor.castToReference(value)); // Reference
2103          return value;
2104        case 722137681: // reasonCode
2105          this.getReasonCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2106          return value;
2107        case -1146218137: // reasonReference
2108          this.getReasonReference().add(TypeConvertor.castToReference(value)); // Reference
2109          return value;
2110        case 73049818: // insurance
2111          this.getInsurance().add(TypeConvertor.castToReference(value)); // Reference
2112          return value;
2113        case 1922406657: // supportingInfo
2114          this.getSupportingInfo().add(TypeConvertor.castToReference(value)); // Reference
2115          return value;
2116        case -2132868344: // specimen
2117          this.getSpecimen().add(TypeConvertor.castToReference(value)); // Reference
2118          return value;
2119        case 1702620169: // bodySite
2120          this.getBodySite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2121          return value;
2122        case 3387378: // note
2123          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
2124          return value;
2125        case 737543241: // patientInstruction
2126          this.patientInstruction = TypeConvertor.castToString(value); // StringType
2127          return value;
2128        case 1538891575: // relevantHistory
2129          this.getRelevantHistory().add(TypeConvertor.castToReference(value)); // Reference
2130          return value;
2131        default: return super.setProperty(hash, name, value);
2132        }
2133
2134      }
2135
2136      @Override
2137      public Base setProperty(String name, Base value) throws FHIRException {
2138        if (name.equals("identifier")) {
2139          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2140        } else if (name.equals("instantiatesCanonical")) {
2141          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value));
2142        } else if (name.equals("instantiatesUri")) {
2143          this.getInstantiatesUri().add(TypeConvertor.castToUri(value));
2144        } else if (name.equals("basedOn")) {
2145          this.getBasedOn().add(TypeConvertor.castToReference(value));
2146        } else if (name.equals("replaces")) {
2147          this.getReplaces().add(TypeConvertor.castToReference(value));
2148        } else if (name.equals("requisition")) {
2149          this.requisition = TypeConvertor.castToIdentifier(value); // Identifier
2150        } else if (name.equals("status")) {
2151          value = new RequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2152          this.status = (Enumeration) value; // Enumeration<RequestStatus>
2153        } else if (name.equals("intent")) {
2154          value = new RequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
2155          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
2156        } else if (name.equals("category")) {
2157          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
2158        } else if (name.equals("priority")) {
2159          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
2160          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
2161        } else if (name.equals("doNotPerform")) {
2162          this.doNotPerform = TypeConvertor.castToBoolean(value); // BooleanType
2163        } else if (name.equals("code")) {
2164          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2165        } else if (name.equals("orderDetail")) {
2166          this.getOrderDetail().add(TypeConvertor.castToCodeableConcept(value));
2167        } else if (name.equals("quantity[x]")) {
2168          this.quantity = TypeConvertor.castToType(value); // DataType
2169        } else if (name.equals("subject")) {
2170          this.subject = TypeConvertor.castToReference(value); // Reference
2171        } else if (name.equals("encounter")) {
2172          this.encounter = TypeConvertor.castToReference(value); // Reference
2173        } else if (name.equals("occurrence[x]")) {
2174          this.occurrence = TypeConvertor.castToType(value); // DataType
2175        } else if (name.equals("asNeeded[x]")) {
2176          this.asNeeded = TypeConvertor.castToType(value); // DataType
2177        } else if (name.equals("authoredOn")) {
2178          this.authoredOn = TypeConvertor.castToDateTime(value); // DateTimeType
2179        } else if (name.equals("requester")) {
2180          this.requester = TypeConvertor.castToReference(value); // Reference
2181        } else if (name.equals("performerType")) {
2182          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2183        } else if (name.equals("performer")) {
2184          this.getPerformer().add(TypeConvertor.castToReference(value));
2185        } else if (name.equals("locationCode")) {
2186          this.getLocationCode().add(TypeConvertor.castToCodeableConcept(value));
2187        } else if (name.equals("locationReference")) {
2188          this.getLocationReference().add(TypeConvertor.castToReference(value));
2189        } else if (name.equals("reasonCode")) {
2190          this.getReasonCode().add(TypeConvertor.castToCodeableConcept(value));
2191        } else if (name.equals("reasonReference")) {
2192          this.getReasonReference().add(TypeConvertor.castToReference(value));
2193        } else if (name.equals("insurance")) {
2194          this.getInsurance().add(TypeConvertor.castToReference(value));
2195        } else if (name.equals("supportingInfo")) {
2196          this.getSupportingInfo().add(TypeConvertor.castToReference(value));
2197        } else if (name.equals("specimen")) {
2198          this.getSpecimen().add(TypeConvertor.castToReference(value));
2199        } else if (name.equals("bodySite")) {
2200          this.getBodySite().add(TypeConvertor.castToCodeableConcept(value));
2201        } else if (name.equals("note")) {
2202          this.getNote().add(TypeConvertor.castToAnnotation(value));
2203        } else if (name.equals("patientInstruction")) {
2204          this.patientInstruction = TypeConvertor.castToString(value); // StringType
2205        } else if (name.equals("relevantHistory")) {
2206          this.getRelevantHistory().add(TypeConvertor.castToReference(value));
2207        } else
2208          return super.setProperty(name, value);
2209        return value;
2210      }
2211
2212      @Override
2213      public Base makeProperty(int hash, String name) throws FHIRException {
2214        switch (hash) {
2215        case -1618432855:  return addIdentifier(); 
2216        case 8911915:  return addInstantiatesCanonicalElement();
2217        case -1926393373:  return addInstantiatesUriElement();
2218        case -332612366:  return addBasedOn(); 
2219        case -430332865:  return addReplaces(); 
2220        case 395923612:  return getRequisition();
2221        case -892481550:  return getStatusElement();
2222        case -1183762788:  return getIntentElement();
2223        case 50511102:  return addCategory(); 
2224        case -1165461084:  return getPriorityElement();
2225        case -1788508167:  return getDoNotPerformElement();
2226        case 3059181:  return getCode();
2227        case 1187338559:  return addOrderDetail(); 
2228        case -515002347:  return getQuantity();
2229        case -1285004149:  return getQuantity();
2230        case -1867885268:  return getSubject();
2231        case 1524132147:  return getEncounter();
2232        case -2022646513:  return getOccurrence();
2233        case 1687874001:  return getOccurrence();
2234        case -544329575:  return getAsNeeded();
2235        case -1432923513:  return getAsNeeded();
2236        case -1500852503:  return getAuthoredOnElement();
2237        case 693933948:  return getRequester();
2238        case -901444568:  return getPerformerType();
2239        case 481140686:  return addPerformer(); 
2240        case -58794174:  return addLocationCode(); 
2241        case 755866390:  return addLocationReference(); 
2242        case 722137681:  return addReasonCode(); 
2243        case -1146218137:  return addReasonReference(); 
2244        case 73049818:  return addInsurance(); 
2245        case 1922406657:  return addSupportingInfo(); 
2246        case -2132868344:  return addSpecimen(); 
2247        case 1702620169:  return addBodySite(); 
2248        case 3387378:  return addNote(); 
2249        case 737543241:  return getPatientInstructionElement();
2250        case 1538891575:  return addRelevantHistory(); 
2251        default: return super.makeProperty(hash, name);
2252        }
2253
2254      }
2255
2256      @Override
2257      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2258        switch (hash) {
2259        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2260        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
2261        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
2262        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2263        case -430332865: /*replaces*/ return new String[] {"Reference"};
2264        case 395923612: /*requisition*/ return new String[] {"Identifier"};
2265        case -892481550: /*status*/ return new String[] {"code"};
2266        case -1183762788: /*intent*/ return new String[] {"code"};
2267        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2268        case -1165461084: /*priority*/ return new String[] {"code"};
2269        case -1788508167: /*doNotPerform*/ return new String[] {"boolean"};
2270        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2271        case 1187338559: /*orderDetail*/ return new String[] {"CodeableConcept"};
2272        case -1285004149: /*quantity*/ return new String[] {"Quantity", "Ratio", "Range"};
2273        case -1867885268: /*subject*/ return new String[] {"Reference"};
2274        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2275        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
2276        case -1432923513: /*asNeeded*/ return new String[] {"boolean", "CodeableConcept"};
2277        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
2278        case 693933948: /*requester*/ return new String[] {"Reference"};
2279        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
2280        case 481140686: /*performer*/ return new String[] {"Reference"};
2281        case -58794174: /*locationCode*/ return new String[] {"CodeableConcept"};
2282        case 755866390: /*locationReference*/ return new String[] {"Reference"};
2283        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2284        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2285        case 73049818: /*insurance*/ return new String[] {"Reference"};
2286        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
2287        case -2132868344: /*specimen*/ return new String[] {"Reference"};
2288        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
2289        case 3387378: /*note*/ return new String[] {"Annotation"};
2290        case 737543241: /*patientInstruction*/ return new String[] {"string"};
2291        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
2292        default: return super.getTypesForProperty(hash, name);
2293        }
2294
2295      }
2296
2297      @Override
2298      public Base addChild(String name) throws FHIRException {
2299        if (name.equals("identifier")) {
2300          return addIdentifier();
2301        }
2302        else if (name.equals("instantiatesCanonical")) {
2303          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.instantiatesCanonical");
2304        }
2305        else if (name.equals("instantiatesUri")) {
2306          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.instantiatesUri");
2307        }
2308        else if (name.equals("basedOn")) {
2309          return addBasedOn();
2310        }
2311        else if (name.equals("replaces")) {
2312          return addReplaces();
2313        }
2314        else if (name.equals("requisition")) {
2315          this.requisition = new Identifier();
2316          return this.requisition;
2317        }
2318        else if (name.equals("status")) {
2319          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.status");
2320        }
2321        else if (name.equals("intent")) {
2322          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.intent");
2323        }
2324        else if (name.equals("category")) {
2325          return addCategory();
2326        }
2327        else if (name.equals("priority")) {
2328          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.priority");
2329        }
2330        else if (name.equals("doNotPerform")) {
2331          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.doNotPerform");
2332        }
2333        else if (name.equals("code")) {
2334          this.code = new CodeableConcept();
2335          return this.code;
2336        }
2337        else if (name.equals("orderDetail")) {
2338          return addOrderDetail();
2339        }
2340        else if (name.equals("quantityQuantity")) {
2341          this.quantity = new Quantity();
2342          return this.quantity;
2343        }
2344        else if (name.equals("quantityRatio")) {
2345          this.quantity = new Ratio();
2346          return this.quantity;
2347        }
2348        else if (name.equals("quantityRange")) {
2349          this.quantity = new Range();
2350          return this.quantity;
2351        }
2352        else if (name.equals("subject")) {
2353          this.subject = new Reference();
2354          return this.subject;
2355        }
2356        else if (name.equals("encounter")) {
2357          this.encounter = new Reference();
2358          return this.encounter;
2359        }
2360        else if (name.equals("occurrenceDateTime")) {
2361          this.occurrence = new DateTimeType();
2362          return this.occurrence;
2363        }
2364        else if (name.equals("occurrencePeriod")) {
2365          this.occurrence = new Period();
2366          return this.occurrence;
2367        }
2368        else if (name.equals("occurrenceTiming")) {
2369          this.occurrence = new Timing();
2370          return this.occurrence;
2371        }
2372        else if (name.equals("asNeededBoolean")) {
2373          this.asNeeded = new BooleanType();
2374          return this.asNeeded;
2375        }
2376        else if (name.equals("asNeededCodeableConcept")) {
2377          this.asNeeded = new CodeableConcept();
2378          return this.asNeeded;
2379        }
2380        else if (name.equals("authoredOn")) {
2381          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.authoredOn");
2382        }
2383        else if (name.equals("requester")) {
2384          this.requester = new Reference();
2385          return this.requester;
2386        }
2387        else if (name.equals("performerType")) {
2388          this.performerType = new CodeableConcept();
2389          return this.performerType;
2390        }
2391        else if (name.equals("performer")) {
2392          return addPerformer();
2393        }
2394        else if (name.equals("locationCode")) {
2395          return addLocationCode();
2396        }
2397        else if (name.equals("locationReference")) {
2398          return addLocationReference();
2399        }
2400        else if (name.equals("reasonCode")) {
2401          return addReasonCode();
2402        }
2403        else if (name.equals("reasonReference")) {
2404          return addReasonReference();
2405        }
2406        else if (name.equals("insurance")) {
2407          return addInsurance();
2408        }
2409        else if (name.equals("supportingInfo")) {
2410          return addSupportingInfo();
2411        }
2412        else if (name.equals("specimen")) {
2413          return addSpecimen();
2414        }
2415        else if (name.equals("bodySite")) {
2416          return addBodySite();
2417        }
2418        else if (name.equals("note")) {
2419          return addNote();
2420        }
2421        else if (name.equals("patientInstruction")) {
2422          throw new FHIRException("Cannot call addChild on a primitive type ServiceRequest.patientInstruction");
2423        }
2424        else if (name.equals("relevantHistory")) {
2425          return addRelevantHistory();
2426        }
2427        else
2428          return super.addChild(name);
2429      }
2430
2431  public String fhirType() {
2432    return "ServiceRequest";
2433
2434  }
2435
2436      public ServiceRequest copy() {
2437        ServiceRequest dst = new ServiceRequest();
2438        copyValues(dst);
2439        return dst;
2440      }
2441
2442      public void copyValues(ServiceRequest dst) {
2443        super.copyValues(dst);
2444        if (identifier != null) {
2445          dst.identifier = new ArrayList<Identifier>();
2446          for (Identifier i : identifier)
2447            dst.identifier.add(i.copy());
2448        };
2449        if (instantiatesCanonical != null) {
2450          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2451          for (CanonicalType i : instantiatesCanonical)
2452            dst.instantiatesCanonical.add(i.copy());
2453        };
2454        if (instantiatesUri != null) {
2455          dst.instantiatesUri = new ArrayList<UriType>();
2456          for (UriType i : instantiatesUri)
2457            dst.instantiatesUri.add(i.copy());
2458        };
2459        if (basedOn != null) {
2460          dst.basedOn = new ArrayList<Reference>();
2461          for (Reference i : basedOn)
2462            dst.basedOn.add(i.copy());
2463        };
2464        if (replaces != null) {
2465          dst.replaces = new ArrayList<Reference>();
2466          for (Reference i : replaces)
2467            dst.replaces.add(i.copy());
2468        };
2469        dst.requisition = requisition == null ? null : requisition.copy();
2470        dst.status = status == null ? null : status.copy();
2471        dst.intent = intent == null ? null : intent.copy();
2472        if (category != null) {
2473          dst.category = new ArrayList<CodeableConcept>();
2474          for (CodeableConcept i : category)
2475            dst.category.add(i.copy());
2476        };
2477        dst.priority = priority == null ? null : priority.copy();
2478        dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
2479        dst.code = code == null ? null : code.copy();
2480        if (orderDetail != null) {
2481          dst.orderDetail = new ArrayList<CodeableConcept>();
2482          for (CodeableConcept i : orderDetail)
2483            dst.orderDetail.add(i.copy());
2484        };
2485        dst.quantity = quantity == null ? null : quantity.copy();
2486        dst.subject = subject == null ? null : subject.copy();
2487        dst.encounter = encounter == null ? null : encounter.copy();
2488        dst.occurrence = occurrence == null ? null : occurrence.copy();
2489        dst.asNeeded = asNeeded == null ? null : asNeeded.copy();
2490        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
2491        dst.requester = requester == null ? null : requester.copy();
2492        dst.performerType = performerType == null ? null : performerType.copy();
2493        if (performer != null) {
2494          dst.performer = new ArrayList<Reference>();
2495          for (Reference i : performer)
2496            dst.performer.add(i.copy());
2497        };
2498        if (locationCode != null) {
2499          dst.locationCode = new ArrayList<CodeableConcept>();
2500          for (CodeableConcept i : locationCode)
2501            dst.locationCode.add(i.copy());
2502        };
2503        if (locationReference != null) {
2504          dst.locationReference = new ArrayList<Reference>();
2505          for (Reference i : locationReference)
2506            dst.locationReference.add(i.copy());
2507        };
2508        if (reasonCode != null) {
2509          dst.reasonCode = new ArrayList<CodeableConcept>();
2510          for (CodeableConcept i : reasonCode)
2511            dst.reasonCode.add(i.copy());
2512        };
2513        if (reasonReference != null) {
2514          dst.reasonReference = new ArrayList<Reference>();
2515          for (Reference i : reasonReference)
2516            dst.reasonReference.add(i.copy());
2517        };
2518        if (insurance != null) {
2519          dst.insurance = new ArrayList<Reference>();
2520          for (Reference i : insurance)
2521            dst.insurance.add(i.copy());
2522        };
2523        if (supportingInfo != null) {
2524          dst.supportingInfo = new ArrayList<Reference>();
2525          for (Reference i : supportingInfo)
2526            dst.supportingInfo.add(i.copy());
2527        };
2528        if (specimen != null) {
2529          dst.specimen = new ArrayList<Reference>();
2530          for (Reference i : specimen)
2531            dst.specimen.add(i.copy());
2532        };
2533        if (bodySite != null) {
2534          dst.bodySite = new ArrayList<CodeableConcept>();
2535          for (CodeableConcept i : bodySite)
2536            dst.bodySite.add(i.copy());
2537        };
2538        if (note != null) {
2539          dst.note = new ArrayList<Annotation>();
2540          for (Annotation i : note)
2541            dst.note.add(i.copy());
2542        };
2543        dst.patientInstruction = patientInstruction == null ? null : patientInstruction.copy();
2544        if (relevantHistory != null) {
2545          dst.relevantHistory = new ArrayList<Reference>();
2546          for (Reference i : relevantHistory)
2547            dst.relevantHistory.add(i.copy());
2548        };
2549      }
2550
2551      protected ServiceRequest typedCopy() {
2552        return copy();
2553      }
2554
2555      @Override
2556      public boolean equalsDeep(Base other_) {
2557        if (!super.equalsDeep(other_))
2558          return false;
2559        if (!(other_ instanceof ServiceRequest))
2560          return false;
2561        ServiceRequest o = (ServiceRequest) other_;
2562        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
2563           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
2564           && compareDeep(replaces, o.replaces, true) && compareDeep(requisition, o.requisition, true) && compareDeep(status, o.status, true)
2565           && compareDeep(intent, o.intent, true) && compareDeep(category, o.category, true) && compareDeep(priority, o.priority, true)
2566           && compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(code, o.code, true) && compareDeep(orderDetail, o.orderDetail, true)
2567           && compareDeep(quantity, o.quantity, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
2568           && compareDeep(occurrence, o.occurrence, true) && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(authoredOn, o.authoredOn, true)
2569           && compareDeep(requester, o.requester, true) && compareDeep(performerType, o.performerType, true)
2570           && compareDeep(performer, o.performer, true) && compareDeep(locationCode, o.locationCode, true)
2571           && compareDeep(locationReference, o.locationReference, true) && compareDeep(reasonCode, o.reasonCode, true)
2572           && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(insurance, o.insurance, true)
2573           && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(specimen, o.specimen, true)
2574           && compareDeep(bodySite, o.bodySite, true) && compareDeep(note, o.note, true) && compareDeep(patientInstruction, o.patientInstruction, true)
2575           && compareDeep(relevantHistory, o.relevantHistory, true);
2576      }
2577
2578      @Override
2579      public boolean equalsShallow(Base other_) {
2580        if (!super.equalsShallow(other_))
2581          return false;
2582        if (!(other_ instanceof ServiceRequest))
2583          return false;
2584        ServiceRequest o = (ServiceRequest) other_;
2585        return compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
2586           && compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true)
2587           && compareValues(doNotPerform, o.doNotPerform, true) && compareValues(authoredOn, o.authoredOn, true)
2588           && compareValues(patientInstruction, o.patientInstruction, true);
2589      }
2590
2591      public boolean isEmpty() {
2592        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
2593          , instantiatesUri, basedOn, replaces, requisition, status, intent, category, priority
2594          , doNotPerform, code, orderDetail, quantity, subject, encounter, occurrence, asNeeded
2595          , authoredOn, requester, performerType, performer, locationCode, locationReference
2596          , reasonCode, reasonReference, insurance, supportingInfo, specimen, bodySite, note
2597          , patientInstruction, relevantHistory);
2598      }
2599
2600  @Override
2601  public ResourceType getResourceType() {
2602    return ResourceType.ServiceRequest;
2603   }
2604
2605 /**
2606   * Search parameter: <b>authored</b>
2607   * <p>
2608   * Description: <b>Date request signed</b><br>
2609   * Type: <b>date</b><br>
2610   * Path: <b>ServiceRequest.authoredOn</b><br>
2611   * </p>
2612   */
2613  @SearchParamDefinition(name="authored", path="ServiceRequest.authoredOn", description="Date request signed", type="date" )
2614  public static final String SP_AUTHORED = "authored";
2615 /**
2616   * <b>Fluent Client</b> search parameter constant for <b>authored</b>
2617   * <p>
2618   * Description: <b>Date request signed</b><br>
2619   * Type: <b>date</b><br>
2620   * Path: <b>ServiceRequest.authoredOn</b><br>
2621   * </p>
2622   */
2623  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED);
2624
2625 /**
2626   * Search parameter: <b>based-on</b>
2627   * <p>
2628   * Description: <b>What request fulfills</b><br>
2629   * Type: <b>reference</b><br>
2630   * Path: <b>ServiceRequest.basedOn</b><br>
2631   * </p>
2632   */
2633  @SearchParamDefinition(name="based-on", path="ServiceRequest.basedOn", description="What request fulfills", type="reference", target={CarePlan.class, MedicationRequest.class, ServiceRequest.class } )
2634  public static final String SP_BASED_ON = "based-on";
2635 /**
2636   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2637   * <p>
2638   * Description: <b>What request fulfills</b><br>
2639   * Type: <b>reference</b><br>
2640   * Path: <b>ServiceRequest.basedOn</b><br>
2641   * </p>
2642   */
2643  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2644
2645/**
2646   * Constant for fluent queries to be used to add include statements. Specifies
2647   * the path value of "<b>ServiceRequest:based-on</b>".
2648   */
2649  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("ServiceRequest:based-on").toLocked();
2650
2651 /**
2652   * Search parameter: <b>body-site</b>
2653   * <p>
2654   * Description: <b>Where procedure is going to be done</b><br>
2655   * Type: <b>token</b><br>
2656   * Path: <b>ServiceRequest.bodySite</b><br>
2657   * </p>
2658   */
2659  @SearchParamDefinition(name="body-site", path="ServiceRequest.bodySite", description="Where procedure is going to be done", type="token" )
2660  public static final String SP_BODY_SITE = "body-site";
2661 /**
2662   * <b>Fluent Client</b> search parameter constant for <b>body-site</b>
2663   * <p>
2664   * Description: <b>Where procedure is going to be done</b><br>
2665   * Type: <b>token</b><br>
2666   * Path: <b>ServiceRequest.bodySite</b><br>
2667   * </p>
2668   */
2669  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BODY_SITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BODY_SITE);
2670
2671 /**
2672   * Search parameter: <b>category</b>
2673   * <p>
2674   * Description: <b>Classification of service</b><br>
2675   * Type: <b>token</b><br>
2676   * Path: <b>ServiceRequest.category</b><br>
2677   * </p>
2678   */
2679  @SearchParamDefinition(name="category", path="ServiceRequest.category", description="Classification of service", type="token" )
2680  public static final String SP_CATEGORY = "category";
2681 /**
2682   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2683   * <p>
2684   * Description: <b>Classification of service</b><br>
2685   * Type: <b>token</b><br>
2686   * Path: <b>ServiceRequest.category</b><br>
2687   * </p>
2688   */
2689  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2690
2691 /**
2692   * Search parameter: <b>instantiates-canonical</b>
2693   * <p>
2694   * Description: <b>Instantiates FHIR protocol or definition</b><br>
2695   * Type: <b>reference</b><br>
2696   * Path: <b>ServiceRequest.instantiatesCanonical</b><br>
2697   * </p>
2698   */
2699  @SearchParamDefinition(name="instantiates-canonical", path="ServiceRequest.instantiatesCanonical", description="Instantiates FHIR protocol or definition", type="reference", target={ActivityDefinition.class, PlanDefinition.class } )
2700  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
2701 /**
2702   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
2703   * <p>
2704   * Description: <b>Instantiates FHIR protocol or definition</b><br>
2705   * Type: <b>reference</b><br>
2706   * Path: <b>ServiceRequest.instantiatesCanonical</b><br>
2707   * </p>
2708   */
2709  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
2710
2711/**
2712   * Constant for fluent queries to be used to add include statements. Specifies
2713   * the path value of "<b>ServiceRequest:instantiates-canonical</b>".
2714   */
2715  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("ServiceRequest:instantiates-canonical").toLocked();
2716
2717 /**
2718   * Search parameter: <b>instantiates-uri</b>
2719   * <p>
2720   * Description: <b>Instantiates external protocol or definition</b><br>
2721   * Type: <b>uri</b><br>
2722   * Path: <b>ServiceRequest.instantiatesUri</b><br>
2723   * </p>
2724   */
2725  @SearchParamDefinition(name="instantiates-uri", path="ServiceRequest.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
2726  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
2727 /**
2728   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
2729   * <p>
2730   * Description: <b>Instantiates external protocol or definition</b><br>
2731   * Type: <b>uri</b><br>
2732   * Path: <b>ServiceRequest.instantiatesUri</b><br>
2733   * </p>
2734   */
2735  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
2736
2737 /**
2738   * Search parameter: <b>intent</b>
2739   * <p>
2740   * Description: <b>proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option</b><br>
2741   * Type: <b>token</b><br>
2742   * Path: <b>ServiceRequest.intent</b><br>
2743   * </p>
2744   */
2745  @SearchParamDefinition(name="intent", path="ServiceRequest.intent", description="proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", type="token" )
2746  public static final String SP_INTENT = "intent";
2747 /**
2748   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
2749   * <p>
2750   * Description: <b>proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option</b><br>
2751   * Type: <b>token</b><br>
2752   * Path: <b>ServiceRequest.intent</b><br>
2753   * </p>
2754   */
2755  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
2756
2757 /**
2758   * Search parameter: <b>occurrence</b>
2759   * <p>
2760   * Description: <b>When service should occur</b><br>
2761   * Type: <b>date</b><br>
2762   * Path: <b>ServiceRequest.occurrence</b><br>
2763   * </p>
2764   */
2765  @SearchParamDefinition(name="occurrence", path="ServiceRequest.occurrence", description="When service should occur", type="date" )
2766  public static final String SP_OCCURRENCE = "occurrence";
2767 /**
2768   * <b>Fluent Client</b> search parameter constant for <b>occurrence</b>
2769   * <p>
2770   * Description: <b>When service should occur</b><br>
2771   * Type: <b>date</b><br>
2772   * Path: <b>ServiceRequest.occurrence</b><br>
2773   * </p>
2774   */
2775  public static final ca.uhn.fhir.rest.gclient.DateClientParam OCCURRENCE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_OCCURRENCE);
2776
2777 /**
2778   * Search parameter: <b>performer-type</b>
2779   * <p>
2780   * Description: <b>Performer role</b><br>
2781   * Type: <b>token</b><br>
2782   * Path: <b>ServiceRequest.performerType</b><br>
2783   * </p>
2784   */
2785  @SearchParamDefinition(name="performer-type", path="ServiceRequest.performerType", description="Performer role", type="token" )
2786  public static final String SP_PERFORMER_TYPE = "performer-type";
2787 /**
2788   * <b>Fluent Client</b> search parameter constant for <b>performer-type</b>
2789   * <p>
2790   * Description: <b>Performer role</b><br>
2791   * Type: <b>token</b><br>
2792   * Path: <b>ServiceRequest.performerType</b><br>
2793   * </p>
2794   */
2795  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PERFORMER_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PERFORMER_TYPE);
2796
2797 /**
2798   * Search parameter: <b>performer</b>
2799   * <p>
2800   * Description: <b>Requested performer</b><br>
2801   * Type: <b>reference</b><br>
2802   * Path: <b>ServiceRequest.performer</b><br>
2803   * </p>
2804   */
2805  @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 } )
2806  public static final String SP_PERFORMER = "performer";
2807 /**
2808   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2809   * <p>
2810   * Description: <b>Requested performer</b><br>
2811   * Type: <b>reference</b><br>
2812   * Path: <b>ServiceRequest.performer</b><br>
2813   * </p>
2814   */
2815  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
2816
2817/**
2818   * Constant for fluent queries to be used to add include statements. Specifies
2819   * the path value of "<b>ServiceRequest:performer</b>".
2820   */
2821  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("ServiceRequest:performer").toLocked();
2822
2823 /**
2824   * Search parameter: <b>priority</b>
2825   * <p>
2826   * Description: <b>routine | urgent | asap | stat</b><br>
2827   * Type: <b>token</b><br>
2828   * Path: <b>ServiceRequest.priority</b><br>
2829   * </p>
2830   */
2831  @SearchParamDefinition(name="priority", path="ServiceRequest.priority", description="routine | urgent | asap | stat", type="token" )
2832  public static final String SP_PRIORITY = "priority";
2833 /**
2834   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
2835   * <p>
2836   * Description: <b>routine | urgent | asap | stat</b><br>
2837   * Type: <b>token</b><br>
2838   * Path: <b>ServiceRequest.priority</b><br>
2839   * </p>
2840   */
2841  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
2842
2843 /**
2844   * Search parameter: <b>replaces</b>
2845   * <p>
2846   * Description: <b>What request replaces</b><br>
2847   * Type: <b>reference</b><br>
2848   * Path: <b>ServiceRequest.replaces</b><br>
2849   * </p>
2850   */
2851  @SearchParamDefinition(name="replaces", path="ServiceRequest.replaces", description="What request replaces", type="reference", target={ServiceRequest.class } )
2852  public static final String SP_REPLACES = "replaces";
2853 /**
2854   * <b>Fluent Client</b> search parameter constant for <b>replaces</b>
2855   * <p>
2856   * Description: <b>What request replaces</b><br>
2857   * Type: <b>reference</b><br>
2858   * Path: <b>ServiceRequest.replaces</b><br>
2859   * </p>
2860   */
2861  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REPLACES = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REPLACES);
2862
2863/**
2864   * Constant for fluent queries to be used to add include statements. Specifies
2865   * the path value of "<b>ServiceRequest:replaces</b>".
2866   */
2867  public static final ca.uhn.fhir.model.api.Include INCLUDE_REPLACES = new ca.uhn.fhir.model.api.Include("ServiceRequest:replaces").toLocked();
2868
2869 /**
2870   * Search parameter: <b>requester</b>
2871   * <p>
2872   * Description: <b>Who/what is requesting service</b><br>
2873   * Type: <b>reference</b><br>
2874   * Path: <b>ServiceRequest.requester</b><br>
2875   * </p>
2876   */
2877  @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 } )
2878  public static final String SP_REQUESTER = "requester";
2879 /**
2880   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
2881   * <p>
2882   * Description: <b>Who/what is requesting service</b><br>
2883   * Type: <b>reference</b><br>
2884   * Path: <b>ServiceRequest.requester</b><br>
2885   * </p>
2886   */
2887  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
2888
2889/**
2890   * Constant for fluent queries to be used to add include statements. Specifies
2891   * the path value of "<b>ServiceRequest:requester</b>".
2892   */
2893  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("ServiceRequest:requester").toLocked();
2894
2895 /**
2896   * Search parameter: <b>requisition</b>
2897   * <p>
2898   * Description: <b>Composite Request ID</b><br>
2899   * Type: <b>token</b><br>
2900   * Path: <b>ServiceRequest.requisition</b><br>
2901   * </p>
2902   */
2903  @SearchParamDefinition(name="requisition", path="ServiceRequest.requisition", description="Composite Request ID", type="token" )
2904  public static final String SP_REQUISITION = "requisition";
2905 /**
2906   * <b>Fluent Client</b> search parameter constant for <b>requisition</b>
2907   * <p>
2908   * Description: <b>Composite Request ID</b><br>
2909   * Type: <b>token</b><br>
2910   * Path: <b>ServiceRequest.requisition</b><br>
2911   * </p>
2912   */
2913  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REQUISITION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REQUISITION);
2914
2915 /**
2916   * Search parameter: <b>specimen</b>
2917   * <p>
2918   * Description: <b>Specimen to be tested</b><br>
2919   * Type: <b>reference</b><br>
2920   * Path: <b>ServiceRequest.specimen</b><br>
2921   * </p>
2922   */
2923  @SearchParamDefinition(name="specimen", path="ServiceRequest.specimen", description="Specimen to be tested", type="reference", target={Specimen.class } )
2924  public static final String SP_SPECIMEN = "specimen";
2925 /**
2926   * <b>Fluent Client</b> search parameter constant for <b>specimen</b>
2927   * <p>
2928   * Description: <b>Specimen to be tested</b><br>
2929   * Type: <b>reference</b><br>
2930   * Path: <b>ServiceRequest.specimen</b><br>
2931   * </p>
2932   */
2933  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SPECIMEN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SPECIMEN);
2934
2935/**
2936   * Constant for fluent queries to be used to add include statements. Specifies
2937   * the path value of "<b>ServiceRequest:specimen</b>".
2938   */
2939  public static final ca.uhn.fhir.model.api.Include INCLUDE_SPECIMEN = new ca.uhn.fhir.model.api.Include("ServiceRequest:specimen").toLocked();
2940
2941 /**
2942   * Search parameter: <b>status</b>
2943   * <p>
2944   * Description: <b>draft | active | on-hold | revoked | completed | entered-in-error | unknown</b><br>
2945   * Type: <b>token</b><br>
2946   * Path: <b>ServiceRequest.status</b><br>
2947   * </p>
2948   */
2949  @SearchParamDefinition(name="status", path="ServiceRequest.status", description="draft | active | on-hold | revoked | completed | entered-in-error | unknown", type="token" )
2950  public static final String SP_STATUS = "status";
2951 /**
2952   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2953   * <p>
2954   * Description: <b>draft | active | on-hold | revoked | completed | entered-in-error | unknown</b><br>
2955   * Type: <b>token</b><br>
2956   * Path: <b>ServiceRequest.status</b><br>
2957   * </p>
2958   */
2959  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2960
2961 /**
2962   * Search parameter: <b>subject</b>
2963   * <p>
2964   * Description: <b>Search by subject</b><br>
2965   * Type: <b>reference</b><br>
2966   * Path: <b>ServiceRequest.subject</b><br>
2967   * </p>
2968   */
2969  @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 } )
2970  public static final String SP_SUBJECT = "subject";
2971 /**
2972   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2973   * <p>
2974   * Description: <b>Search by subject</b><br>
2975   * Type: <b>reference</b><br>
2976   * Path: <b>ServiceRequest.subject</b><br>
2977   * </p>
2978   */
2979  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2980
2981/**
2982   * Constant for fluent queries to be used to add include statements. Specifies
2983   * the path value of "<b>ServiceRequest:subject</b>".
2984   */
2985  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("ServiceRequest:subject").toLocked();
2986
2987 /**
2988   * Search parameter: <b>code</b>
2989   * <p>
2990   * Description: <b>Multiple Resources: 
2991
2992* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
2993* [Condition](condition.html): Code for the condition
2994* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
2995* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
2996* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
2997* [List](list.html): What the purpose of this list is
2998* [Medication](medication.html): Returns medications for a specific code
2999* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
3000* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
3001* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
3002* [MedicationStatement](medicationstatement.html): Return statements of this medication code
3003* [Observation](observation.html): The code of the observation type
3004* [Procedure](procedure.html): A code to identify a  procedure
3005* [ServiceRequest](servicerequest.html): What is being requested/ordered
3006</b><br>
3007   * Type: <b>token</b><br>
3008   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationStatement.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code</b><br>
3009   * </p>
3010   */
3011  @SearchParamDefinition(name="code", path="AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationStatement.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [Condition](condition.html): Code for the condition\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationStatement](medicationstatement.html): Return statements of this medication code\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [ServiceRequest](servicerequest.html): What is being requested/ordered\r\n", type="token" )
3012  public static final String SP_CODE = "code";
3013 /**
3014   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3015   * <p>
3016   * Description: <b>Multiple Resources: 
3017
3018* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
3019* [Condition](condition.html): Code for the condition
3020* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
3021* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
3022* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
3023* [List](list.html): What the purpose of this list is
3024* [Medication](medication.html): Returns medications for a specific code
3025* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
3026* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
3027* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
3028* [MedicationStatement](medicationstatement.html): Return statements of this medication code
3029* [Observation](observation.html): The code of the observation type
3030* [Procedure](procedure.html): A code to identify a  procedure
3031* [ServiceRequest](servicerequest.html): What is being requested/ordered
3032</b><br>
3033   * Type: <b>token</b><br>
3034   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationStatement.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code</b><br>
3035   * </p>
3036   */
3037  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3038
3039 /**
3040   * Search parameter: <b>encounter</b>
3041   * <p>
3042   * Description: <b>Multiple Resources: 
3043
3044* [Composition](composition.html): Context of the Composition
3045* [DeviceRequest](devicerequest.html): Encounter during which request was created
3046* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
3047* [DocumentReference](documentreference.html): Context of the document  content
3048* [Flag](flag.html): Alert relevant during encounter
3049* [List](list.html): Context in which list created
3050* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
3051* [Observation](observation.html): Encounter related to the observation
3052* [Procedure](procedure.html): Encounter created as part of
3053* [RiskAssessment](riskassessment.html): Where was assessment performed?
3054* [ServiceRequest](servicerequest.html): An encounter in which this request is made
3055* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
3056</b><br>
3057   * Type: <b>reference</b><br>
3058   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | DocumentReference.context.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
3059   * </p>
3060   */
3061  @SearchParamDefinition(name="encounter", path="Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | DocumentReference.context.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* [DocumentReference](documentreference.html): Context of the document  content\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): Encounter created as part of\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, EpisodeOfCare.class } )
3062  public static final String SP_ENCOUNTER = "encounter";
3063 /**
3064   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3065   * <p>
3066   * Description: <b>Multiple Resources: 
3067
3068* [Composition](composition.html): Context of the Composition
3069* [DeviceRequest](devicerequest.html): Encounter during which request was created
3070* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
3071* [DocumentReference](documentreference.html): Context of the document  content
3072* [Flag](flag.html): Alert relevant during encounter
3073* [List](list.html): Context in which list created
3074* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
3075* [Observation](observation.html): Encounter related to the observation
3076* [Procedure](procedure.html): Encounter created as part of
3077* [RiskAssessment](riskassessment.html): Where was assessment performed?
3078* [ServiceRequest](servicerequest.html): An encounter in which this request is made
3079* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
3080</b><br>
3081   * Type: <b>reference</b><br>
3082   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | DocumentReference.context.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
3083   * </p>
3084   */
3085  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3086
3087/**
3088   * Constant for fluent queries to be used to add include statements. Specifies
3089   * the path value of "<b>ServiceRequest:encounter</b>".
3090   */
3091  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ServiceRequest:encounter").toLocked();
3092
3093 /**
3094   * Search parameter: <b>identifier</b>
3095   * <p>
3096   * Description: <b>Multiple Resources: 
3097
3098* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3099* [CarePlan](careplan.html): External Ids for this plan
3100* [CareTeam](careteam.html): External Ids for this team
3101* [Composition](composition.html): Version-independent identifier for the Composition
3102* [Condition](condition.html): A unique identifier of the condition record
3103* [Consent](consent.html): Identifier for this record (external references)
3104* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3105* [DeviceRequest](devicerequest.html): Business identifier for request/order
3106* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3107* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
3108* [DocumentReference](documentreference.html): Master Version Specific Identifier
3109* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3110* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3111* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3112* [Goal](goal.html): External Ids for this goal
3113* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number
3114* [Immunization](immunization.html): Business identifier
3115* [List](list.html): Business identifier
3116* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3117* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3118* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3119* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
3120* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3121* [Observation](observation.html): The unique id for a particular observation
3122* [Procedure](procedure.html): A unique identifier for a procedure
3123* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3124* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3125* [SupplyDelivery](supplydelivery.html): External identifier
3126* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3127* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3128</b><br>
3129   * Type: <b>token</b><br>
3130   * 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.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
3131   * </p>
3132   */
3133  @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.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.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): Master Version Specific Identifier\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 and Accession number\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* [MedicationStatement](medicationstatement.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" )
3134  public static final String SP_IDENTIFIER = "identifier";
3135 /**
3136   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3137   * <p>
3138   * Description: <b>Multiple Resources: 
3139
3140* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3141* [CarePlan](careplan.html): External Ids for this plan
3142* [CareTeam](careteam.html): External Ids for this team
3143* [Composition](composition.html): Version-independent identifier for the Composition
3144* [Condition](condition.html): A unique identifier of the condition record
3145* [Consent](consent.html): Identifier for this record (external references)
3146* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3147* [DeviceRequest](devicerequest.html): Business identifier for request/order
3148* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3149* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
3150* [DocumentReference](documentreference.html): Master Version Specific Identifier
3151* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3152* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3153* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3154* [Goal](goal.html): External Ids for this goal
3155* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number
3156* [Immunization](immunization.html): Business identifier
3157* [List](list.html): Business identifier
3158* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3159* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3160* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3161* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
3162* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3163* [Observation](observation.html): The unique id for a particular observation
3164* [Procedure](procedure.html): A unique identifier for a procedure
3165* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3166* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3167* [SupplyDelivery](supplydelivery.html): External identifier
3168* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3169* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3170</b><br>
3171   * Type: <b>token</b><br>
3172   * 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.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
3173   * </p>
3174   */
3175  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3176
3177 /**
3178   * Search parameter: <b>patient</b>
3179   * <p>
3180   * Description: <b>Multiple Resources: 
3181
3182* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
3183* [CarePlan](careplan.html): Who the care plan is for
3184* [CareTeam](careteam.html): Who care team is for
3185* [ClinicalImpression](clinicalimpression.html): Patient or group assessed
3186* [Composition](composition.html): Who and/or what the composition is about
3187* [Condition](condition.html): Who has the condition?
3188* [Consent](consent.html): Who the consent applies to
3189* [DetectedIssue](detectedissue.html): Associated patient
3190* [DeviceRequest](devicerequest.html): Individual the service is ordered for
3191* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient
3192* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
3193* [DocumentManifest](documentmanifest.html): The subject of the set of documents
3194* [DocumentReference](documentreference.html): Who/what is the subject of the document
3195* [Encounter](encounter.html): The patient or group present at the encounter
3196* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
3197* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
3198* [Flag](flag.html): The identity of a subject to list flags for
3199* [Goal](goal.html): Who this goal is intended for
3200* [ImagingStudy](imagingstudy.html): Who the study is about
3201* [Immunization](immunization.html): The patient for the vaccination record
3202* [List](list.html): If all resources have the same subject
3203* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3204* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3205* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3206* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
3207* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
3208* [Observation](observation.html): The subject that the observation is about (if patient)
3209* [Procedure](procedure.html): Search by subject - a patient
3210* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3211* [ServiceRequest](servicerequest.html): Search by subject - a patient
3212* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3213* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3214</b><br>
3215   * Type: <b>reference</b><br>
3216   * 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.patient | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject.where(resolve() is 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) | MedicationStatement.subject.where(resolve() is Patient) | NutritionOrder.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 | VisionPrescription.patient</b><br>
3217   * </p>
3218   */
3219  @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.patient | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject.where(resolve() is 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) | MedicationStatement.subject.where(resolve() is Patient) | NutritionOrder.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 | 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 or group 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* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient\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 or group 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* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person 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* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, CatalogEntry.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceMetric.class, DeviceRequest.class, DeviceUseStatement.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Media.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchDefinition.class, ResearchElementDefinition.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
3220  public static final String SP_PATIENT = "patient";
3221 /**
3222   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3223   * <p>
3224   * Description: <b>Multiple Resources: 
3225
3226* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
3227* [CarePlan](careplan.html): Who the care plan is for
3228* [CareTeam](careteam.html): Who care team is for
3229* [ClinicalImpression](clinicalimpression.html): Patient or group assessed
3230* [Composition](composition.html): Who and/or what the composition is about
3231* [Condition](condition.html): Who has the condition?
3232* [Consent](consent.html): Who the consent applies to
3233* [DetectedIssue](detectedissue.html): Associated patient
3234* [DeviceRequest](devicerequest.html): Individual the service is ordered for
3235* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient
3236* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
3237* [DocumentManifest](documentmanifest.html): The subject of the set of documents
3238* [DocumentReference](documentreference.html): Who/what is the subject of the document
3239* [Encounter](encounter.html): The patient or group present at the encounter
3240* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
3241* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
3242* [Flag](flag.html): The identity of a subject to list flags for
3243* [Goal](goal.html): Who this goal is intended for
3244* [ImagingStudy](imagingstudy.html): Who the study is about
3245* [Immunization](immunization.html): The patient for the vaccination record
3246* [List](list.html): If all resources have the same subject
3247* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3248* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3249* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3250* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
3251* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
3252* [Observation](observation.html): The subject that the observation is about (if patient)
3253* [Procedure](procedure.html): Search by subject - a patient
3254* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3255* [ServiceRequest](servicerequest.html): Search by subject - a patient
3256* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3257* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3258</b><br>
3259   * Type: <b>reference</b><br>
3260   * 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.patient | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject.where(resolve() is 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) | MedicationStatement.subject.where(resolve() is Patient) | NutritionOrder.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 | VisionPrescription.patient</b><br>
3261   * </p>
3262   */
3263  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3264
3265/**
3266   * Constant for fluent queries to be used to add include statements. Specifies
3267   * the path value of "<b>ServiceRequest:patient</b>".
3268   */
3269  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ServiceRequest:patient").toLocked();
3270
3271
3272}
3273