001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.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.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A record of a device being used by a patient where the record is the result of a report from the patient or a clinician.
052 */
053@ResourceDef(name="DeviceUsage", profile="http://hl7.org/fhir/StructureDefinition/DeviceUsage")
054public class DeviceUsage extends DomainResource {
055
056    public enum DeviceUsageStatus {
057        /**
058         * The device is still being used.
059         */
060        ACTIVE, 
061        /**
062         * The device is no longer being used.
063         */
064        COMPLETED, 
065        /**
066         * The device was not used.
067         */
068        NOTDONE, 
069        /**
070         * The statement was recorded incorrectly.
071         */
072        ENTEREDINERROR, 
073        /**
074         * The device may be used at some time in the future.
075         */
076        INTENDED, 
077        /**
078         * Actions implied by the statement have been permanently halted, before all of them occurred.
079         */
080        STOPPED, 
081        /**
082         * Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called \"suspended\".
083         */
084        ONHOLD, 
085        /**
086         * added to help the parsers with the generic types
087         */
088        NULL;
089        public static DeviceUsageStatus fromCode(String codeString) throws FHIRException {
090            if (codeString == null || "".equals(codeString))
091                return null;
092        if ("active".equals(codeString))
093          return ACTIVE;
094        if ("completed".equals(codeString))
095          return COMPLETED;
096        if ("not-done".equals(codeString))
097          return NOTDONE;
098        if ("entered-in-error".equals(codeString))
099          return ENTEREDINERROR;
100        if ("intended".equals(codeString))
101          return INTENDED;
102        if ("stopped".equals(codeString))
103          return STOPPED;
104        if ("on-hold".equals(codeString))
105          return ONHOLD;
106        if (Configuration.isAcceptInvalidEnums())
107          return null;
108        else
109          throw new FHIRException("Unknown DeviceUsageStatus code '"+codeString+"'");
110        }
111        public String toCode() {
112          switch (this) {
113            case ACTIVE: return "active";
114            case COMPLETED: return "completed";
115            case NOTDONE: return "not-done";
116            case ENTEREDINERROR: return "entered-in-error";
117            case INTENDED: return "intended";
118            case STOPPED: return "stopped";
119            case ONHOLD: return "on-hold";
120            default: return "?";
121          }
122        }
123        public String getSystem() {
124          switch (this) {
125            case ACTIVE: return "http://hl7.org/fhir/device-usage-status";
126            case COMPLETED: return "http://hl7.org/fhir/device-usage-status";
127            case NOTDONE: return "http://hl7.org/fhir/device-usage-status";
128            case ENTEREDINERROR: return "http://hl7.org/fhir/device-usage-status";
129            case INTENDED: return "http://hl7.org/fhir/device-usage-status";
130            case STOPPED: return "http://hl7.org/fhir/device-usage-status";
131            case ONHOLD: return "http://hl7.org/fhir/device-usage-status";
132            default: return "?";
133          }
134        }
135        public String getDefinition() {
136          switch (this) {
137            case ACTIVE: return "The device is still being used.";
138            case COMPLETED: return "The device is no longer being used.";
139            case NOTDONE: return "The device was not used.";
140            case ENTEREDINERROR: return "The statement was recorded incorrectly.";
141            case INTENDED: return "The device may be used at some time in the future.";
142            case STOPPED: return "Actions implied by the statement have been permanently halted, before all of them occurred.";
143            case ONHOLD: return "Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
144            default: return "?";
145          }
146        }
147        public String getDisplay() {
148          switch (this) {
149            case ACTIVE: return "Active";
150            case COMPLETED: return "Completed";
151            case NOTDONE: return "Not done";
152            case ENTEREDINERROR: return "Entered in Error";
153            case INTENDED: return "Intended";
154            case STOPPED: return "Stopped";
155            case ONHOLD: return "On Hold";
156            default: return "?";
157          }
158        }
159    }
160
161  public static class DeviceUsageStatusEnumFactory implements EnumFactory<DeviceUsageStatus> {
162    public DeviceUsageStatus fromCode(String codeString) throws IllegalArgumentException {
163      if (codeString == null || "".equals(codeString))
164            if (codeString == null || "".equals(codeString))
165                return null;
166        if ("active".equals(codeString))
167          return DeviceUsageStatus.ACTIVE;
168        if ("completed".equals(codeString))
169          return DeviceUsageStatus.COMPLETED;
170        if ("not-done".equals(codeString))
171          return DeviceUsageStatus.NOTDONE;
172        if ("entered-in-error".equals(codeString))
173          return DeviceUsageStatus.ENTEREDINERROR;
174        if ("intended".equals(codeString))
175          return DeviceUsageStatus.INTENDED;
176        if ("stopped".equals(codeString))
177          return DeviceUsageStatus.STOPPED;
178        if ("on-hold".equals(codeString))
179          return DeviceUsageStatus.ONHOLD;
180        throw new IllegalArgumentException("Unknown DeviceUsageStatus code '"+codeString+"'");
181        }
182        public Enumeration<DeviceUsageStatus> fromType(Base code) throws FHIRException {
183          if (code == null)
184            return null;
185          if (code.isEmpty())
186            return new Enumeration<DeviceUsageStatus>(this);
187          String codeString = ((PrimitiveType) code).asStringValue();
188          if (codeString == null || "".equals(codeString))
189            return null;
190        if ("active".equals(codeString))
191          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.ACTIVE);
192        if ("completed".equals(codeString))
193          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.COMPLETED);
194        if ("not-done".equals(codeString))
195          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.NOTDONE);
196        if ("entered-in-error".equals(codeString))
197          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.ENTEREDINERROR);
198        if ("intended".equals(codeString))
199          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.INTENDED);
200        if ("stopped".equals(codeString))
201          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.STOPPED);
202        if ("on-hold".equals(codeString))
203          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.ONHOLD);
204        throw new FHIRException("Unknown DeviceUsageStatus code '"+codeString+"'");
205        }
206    public String toCode(DeviceUsageStatus code) {
207      if (code == DeviceUsageStatus.ACTIVE)
208        return "active";
209      if (code == DeviceUsageStatus.COMPLETED)
210        return "completed";
211      if (code == DeviceUsageStatus.NOTDONE)
212        return "not-done";
213      if (code == DeviceUsageStatus.ENTEREDINERROR)
214        return "entered-in-error";
215      if (code == DeviceUsageStatus.INTENDED)
216        return "intended";
217      if (code == DeviceUsageStatus.STOPPED)
218        return "stopped";
219      if (code == DeviceUsageStatus.ONHOLD)
220        return "on-hold";
221      return "?";
222      }
223    public String toSystem(DeviceUsageStatus code) {
224      return code.getSystem();
225      }
226    }
227
228    /**
229     * An external identifier for this statement such as an IRI.
230     */
231    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
232    @Description(shortDefinition="External identifier for this record", formalDefinition="An external identifier for this statement such as an IRI." )
233    protected List<Identifier> identifier;
234
235    /**
236     * A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage.
237     */
238    @Child(name = "basedOn", type = {ServiceRequest.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
239    @Description(shortDefinition="Fulfills plan, proposal or order", formalDefinition="A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage." )
240    protected List<Reference> basedOn;
241
242    /**
243     * A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.
244     */
245    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
246    @Description(shortDefinition="active | completed | not-done | entered-in-error +", formalDefinition="A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed." )
247    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-usage-status")
248    protected Enumeration<DeviceUsageStatus> status;
249
250    /**
251     * This attribute indicates a category for the statement - The device statement may be made in an inpatient or outpatient settting (inpatient | outpatient | community | patientspecified).
252     */
253    @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
254    @Description(shortDefinition="The category of the statement - classifying how the statement is made", formalDefinition="This attribute indicates a category for the statement - The device statement may be made in an inpatient or outpatient settting (inpatient | outpatient | community | patientspecified)." )
255    protected List<CodeableConcept> category;
256
257    /**
258     * The patient who used the device.
259     */
260    @Child(name = "patient", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true)
261    @Description(shortDefinition="Patient using device", formalDefinition="The patient who used the device." )
262    protected Reference patient;
263
264    /**
265     * Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage.
266     */
267    @Child(name = "derivedFrom", type = {ServiceRequest.class, Procedure.class, Claim.class, Observation.class, QuestionnaireResponse.class, DocumentReference.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
268    @Description(shortDefinition="Supporting information", formalDefinition="Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage." )
269    protected List<Reference> derivedFrom;
270
271    /**
272     * The encounter or episode of care that establishes the context for this device use statement.
273     */
274    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=6, min=0, max=1, modifier=false, summary=true)
275    @Description(shortDefinition="The encounter or episode of care that establishes the context for this device use statement", formalDefinition="The encounter or episode of care that establishes the context for this device use statement." )
276    protected Reference context;
277
278    /**
279     * How often the device was used.
280     */
281    @Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
282    @Description(shortDefinition="How often  the device was used", formalDefinition="How often the device was used." )
283    protected DataType timing;
284
285    /**
286     * The time at which the statement was recorded by informationSource.
287     */
288    @Child(name = "dateAsserted", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
289    @Description(shortDefinition="When the statement was made (and recorded)", formalDefinition="The time at which the statement was recorded by informationSource." )
290    protected DateTimeType dateAsserted;
291
292    /**
293     * The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement.
294     */
295    @Child(name = "usageStatus", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
296    @Description(shortDefinition="The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement", formalDefinition="The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement." )
297    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-usage-status")
298    protected CodeableConcept usageStatus;
299
300    /**
301     * The reason for asserting the usage status - for example forgot, lost, stolen, broken.
302     */
303    @Child(name = "usageReason", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
304    @Description(shortDefinition="The reason for asserting the usage status - for example forgot, lost, stolen, broken", formalDefinition="The reason for asserting the usage status - for example forgot, lost, stolen, broken." )
305    protected List<CodeableConcept> usageReason;
306
307    /**
308     * Who reported the device was being used by the patient.
309     */
310    @Child(name = "informationSource", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Organization.class}, order=11, min=0, max=1, modifier=false, summary=true)
311    @Description(shortDefinition="Who made the statement", formalDefinition="Who reported the device was being used by the patient." )
312    protected Reference informationSource;
313
314    /**
315     * Code or Reference to device used.
316     */
317    @Child(name = "device", type = {CodeableReference.class}, order=12, min=1, max=1, modifier=false, summary=true)
318    @Description(shortDefinition="Code or Reference to device used", formalDefinition="Code or Reference to device used." )
319    protected CodeableReference device;
320
321    /**
322     * Reason or justification for the use of the device. A coded concept, or another resource whose existence justifies this DeviceUsage.
323     */
324    @Child(name = "reason", type = {CodeableReference.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
325    @Description(shortDefinition="Why device was used", formalDefinition="Reason or justification for the use of the device. A coded concept, or another resource whose existence justifies this DeviceUsage." )
326    protected List<CodeableReference> reason;
327
328    /**
329     * Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).
330     */
331    @Child(name = "bodySite", type = {CodeableReference.class}, order=14, min=0, max=1, modifier=false, summary=true)
332    @Description(shortDefinition="Target body site", formalDefinition="Indicates the anotomic location on the subject's body where the device was used ( i.e. the target)." )
333    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
334    protected CodeableReference bodySite;
335
336    /**
337     * Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.
338     */
339    @Child(name = "note", type = {Annotation.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
340    @Description(shortDefinition="Addition details (comments, instructions)", formalDefinition="Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement." )
341    protected List<Annotation> note;
342
343    private static final long serialVersionUID = 979004394L;
344
345  /**
346   * Constructor
347   */
348    public DeviceUsage() {
349      super();
350    }
351
352  /**
353   * Constructor
354   */
355    public DeviceUsage(DeviceUsageStatus status, Reference patient, CodeableReference device) {
356      super();
357      this.setStatus(status);
358      this.setPatient(patient);
359      this.setDevice(device);
360    }
361
362    /**
363     * @return {@link #identifier} (An external identifier for this statement such as an IRI.)
364     */
365    public List<Identifier> getIdentifier() { 
366      if (this.identifier == null)
367        this.identifier = new ArrayList<Identifier>();
368      return this.identifier;
369    }
370
371    /**
372     * @return Returns a reference to <code>this</code> for easy method chaining
373     */
374    public DeviceUsage setIdentifier(List<Identifier> theIdentifier) { 
375      this.identifier = theIdentifier;
376      return this;
377    }
378
379    public boolean hasIdentifier() { 
380      if (this.identifier == null)
381        return false;
382      for (Identifier item : this.identifier)
383        if (!item.isEmpty())
384          return true;
385      return false;
386    }
387
388    public Identifier addIdentifier() { //3
389      Identifier t = new Identifier();
390      if (this.identifier == null)
391        this.identifier = new ArrayList<Identifier>();
392      this.identifier.add(t);
393      return t;
394    }
395
396    public DeviceUsage addIdentifier(Identifier t) { //3
397      if (t == null)
398        return this;
399      if (this.identifier == null)
400        this.identifier = new ArrayList<Identifier>();
401      this.identifier.add(t);
402      return this;
403    }
404
405    /**
406     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
407     */
408    public Identifier getIdentifierFirstRep() { 
409      if (getIdentifier().isEmpty()) {
410        addIdentifier();
411      }
412      return getIdentifier().get(0);
413    }
414
415    /**
416     * @return {@link #basedOn} (A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage.)
417     */
418    public List<Reference> getBasedOn() { 
419      if (this.basedOn == null)
420        this.basedOn = new ArrayList<Reference>();
421      return this.basedOn;
422    }
423
424    /**
425     * @return Returns a reference to <code>this</code> for easy method chaining
426     */
427    public DeviceUsage setBasedOn(List<Reference> theBasedOn) { 
428      this.basedOn = theBasedOn;
429      return this;
430    }
431
432    public boolean hasBasedOn() { 
433      if (this.basedOn == null)
434        return false;
435      for (Reference item : this.basedOn)
436        if (!item.isEmpty())
437          return true;
438      return false;
439    }
440
441    public Reference addBasedOn() { //3
442      Reference t = new Reference();
443      if (this.basedOn == null)
444        this.basedOn = new ArrayList<Reference>();
445      this.basedOn.add(t);
446      return t;
447    }
448
449    public DeviceUsage addBasedOn(Reference t) { //3
450      if (t == null)
451        return this;
452      if (this.basedOn == null)
453        this.basedOn = new ArrayList<Reference>();
454      this.basedOn.add(t);
455      return this;
456    }
457
458    /**
459     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
460     */
461    public Reference getBasedOnFirstRep() { 
462      if (getBasedOn().isEmpty()) {
463        addBasedOn();
464      }
465      return getBasedOn().get(0);
466    }
467
468    /**
469     * @return {@link #status} (A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
470     */
471    public Enumeration<DeviceUsageStatus> getStatusElement() { 
472      if (this.status == null)
473        if (Configuration.errorOnAutoCreate())
474          throw new Error("Attempt to auto-create DeviceUsage.status");
475        else if (Configuration.doAutoCreate())
476          this.status = new Enumeration<DeviceUsageStatus>(new DeviceUsageStatusEnumFactory()); // bb
477      return this.status;
478    }
479
480    public boolean hasStatusElement() { 
481      return this.status != null && !this.status.isEmpty();
482    }
483
484    public boolean hasStatus() { 
485      return this.status != null && !this.status.isEmpty();
486    }
487
488    /**
489     * @param value {@link #status} (A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
490     */
491    public DeviceUsage setStatusElement(Enumeration<DeviceUsageStatus> value) { 
492      this.status = value;
493      return this;
494    }
495
496    /**
497     * @return A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.
498     */
499    public DeviceUsageStatus getStatus() { 
500      return this.status == null ? null : this.status.getValue();
501    }
502
503    /**
504     * @param value A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.
505     */
506    public DeviceUsage setStatus(DeviceUsageStatus value) { 
507        if (this.status == null)
508          this.status = new Enumeration<DeviceUsageStatus>(new DeviceUsageStatusEnumFactory());
509        this.status.setValue(value);
510      return this;
511    }
512
513    /**
514     * @return {@link #category} (This attribute indicates a category for the statement - The device statement may be made in an inpatient or outpatient settting (inpatient | outpatient | community | patientspecified).)
515     */
516    public List<CodeableConcept> getCategory() { 
517      if (this.category == null)
518        this.category = new ArrayList<CodeableConcept>();
519      return this.category;
520    }
521
522    /**
523     * @return Returns a reference to <code>this</code> for easy method chaining
524     */
525    public DeviceUsage setCategory(List<CodeableConcept> theCategory) { 
526      this.category = theCategory;
527      return this;
528    }
529
530    public boolean hasCategory() { 
531      if (this.category == null)
532        return false;
533      for (CodeableConcept item : this.category)
534        if (!item.isEmpty())
535          return true;
536      return false;
537    }
538
539    public CodeableConcept addCategory() { //3
540      CodeableConcept t = new CodeableConcept();
541      if (this.category == null)
542        this.category = new ArrayList<CodeableConcept>();
543      this.category.add(t);
544      return t;
545    }
546
547    public DeviceUsage addCategory(CodeableConcept t) { //3
548      if (t == null)
549        return this;
550      if (this.category == null)
551        this.category = new ArrayList<CodeableConcept>();
552      this.category.add(t);
553      return this;
554    }
555
556    /**
557     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
558     */
559    public CodeableConcept getCategoryFirstRep() { 
560      if (getCategory().isEmpty()) {
561        addCategory();
562      }
563      return getCategory().get(0);
564    }
565
566    /**
567     * @return {@link #patient} (The patient who used the device.)
568     */
569    public Reference getPatient() { 
570      if (this.patient == null)
571        if (Configuration.errorOnAutoCreate())
572          throw new Error("Attempt to auto-create DeviceUsage.patient");
573        else if (Configuration.doAutoCreate())
574          this.patient = new Reference(); // cc
575      return this.patient;
576    }
577
578    public boolean hasPatient() { 
579      return this.patient != null && !this.patient.isEmpty();
580    }
581
582    /**
583     * @param value {@link #patient} (The patient who used the device.)
584     */
585    public DeviceUsage setPatient(Reference value) { 
586      this.patient = value;
587      return this;
588    }
589
590    /**
591     * @return {@link #derivedFrom} (Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage.)
592     */
593    public List<Reference> getDerivedFrom() { 
594      if (this.derivedFrom == null)
595        this.derivedFrom = new ArrayList<Reference>();
596      return this.derivedFrom;
597    }
598
599    /**
600     * @return Returns a reference to <code>this</code> for easy method chaining
601     */
602    public DeviceUsage setDerivedFrom(List<Reference> theDerivedFrom) { 
603      this.derivedFrom = theDerivedFrom;
604      return this;
605    }
606
607    public boolean hasDerivedFrom() { 
608      if (this.derivedFrom == null)
609        return false;
610      for (Reference item : this.derivedFrom)
611        if (!item.isEmpty())
612          return true;
613      return false;
614    }
615
616    public Reference addDerivedFrom() { //3
617      Reference t = new Reference();
618      if (this.derivedFrom == null)
619        this.derivedFrom = new ArrayList<Reference>();
620      this.derivedFrom.add(t);
621      return t;
622    }
623
624    public DeviceUsage addDerivedFrom(Reference t) { //3
625      if (t == null)
626        return this;
627      if (this.derivedFrom == null)
628        this.derivedFrom = new ArrayList<Reference>();
629      this.derivedFrom.add(t);
630      return this;
631    }
632
633    /**
634     * @return The first repetition of repeating field {@link #derivedFrom}, creating it if it does not already exist {3}
635     */
636    public Reference getDerivedFromFirstRep() { 
637      if (getDerivedFrom().isEmpty()) {
638        addDerivedFrom();
639      }
640      return getDerivedFrom().get(0);
641    }
642
643    /**
644     * @return {@link #context} (The encounter or episode of care that establishes the context for this device use statement.)
645     */
646    public Reference getContext() { 
647      if (this.context == null)
648        if (Configuration.errorOnAutoCreate())
649          throw new Error("Attempt to auto-create DeviceUsage.context");
650        else if (Configuration.doAutoCreate())
651          this.context = new Reference(); // cc
652      return this.context;
653    }
654
655    public boolean hasContext() { 
656      return this.context != null && !this.context.isEmpty();
657    }
658
659    /**
660     * @param value {@link #context} (The encounter or episode of care that establishes the context for this device use statement.)
661     */
662    public DeviceUsage setContext(Reference value) { 
663      this.context = value;
664      return this;
665    }
666
667    /**
668     * @return {@link #timing} (How often the device was used.)
669     */
670    public DataType getTiming() { 
671      return this.timing;
672    }
673
674    /**
675     * @return {@link #timing} (How often the device was used.)
676     */
677    public Timing getTimingTiming() throws FHIRException { 
678      if (this.timing == null)
679        this.timing = new Timing();
680      if (!(this.timing instanceof Timing))
681        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered");
682      return (Timing) this.timing;
683    }
684
685    public boolean hasTimingTiming() { 
686      return this != null && this.timing instanceof Timing;
687    }
688
689    /**
690     * @return {@link #timing} (How often the device was used.)
691     */
692    public Period getTimingPeriod() throws FHIRException { 
693      if (this.timing == null)
694        this.timing = new Period();
695      if (!(this.timing instanceof Period))
696        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
697      return (Period) this.timing;
698    }
699
700    public boolean hasTimingPeriod() { 
701      return this != null && this.timing instanceof Period;
702    }
703
704    /**
705     * @return {@link #timing} (How often the device was used.)
706     */
707    public DateTimeType getTimingDateTimeType() throws FHIRException { 
708      if (this.timing == null)
709        this.timing = new DateTimeType();
710      if (!(this.timing instanceof DateTimeType))
711        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered");
712      return (DateTimeType) this.timing;
713    }
714
715    public boolean hasTimingDateTimeType() { 
716      return this != null && this.timing instanceof DateTimeType;
717    }
718
719    public boolean hasTiming() { 
720      return this.timing != null && !this.timing.isEmpty();
721    }
722
723    /**
724     * @param value {@link #timing} (How often the device was used.)
725     */
726    public DeviceUsage setTiming(DataType value) { 
727      if (value != null && !(value instanceof Timing || value instanceof Period || value instanceof DateTimeType))
728        throw new Error("Not the right type for DeviceUsage.timing[x]: "+value.fhirType());
729      this.timing = value;
730      return this;
731    }
732
733    /**
734     * @return {@link #dateAsserted} (The time at which the statement was recorded by informationSource.). This is the underlying object with id, value and extensions. The accessor "getDateAsserted" gives direct access to the value
735     */
736    public DateTimeType getDateAssertedElement() { 
737      if (this.dateAsserted == null)
738        if (Configuration.errorOnAutoCreate())
739          throw new Error("Attempt to auto-create DeviceUsage.dateAsserted");
740        else if (Configuration.doAutoCreate())
741          this.dateAsserted = new DateTimeType(); // bb
742      return this.dateAsserted;
743    }
744
745    public boolean hasDateAssertedElement() { 
746      return this.dateAsserted != null && !this.dateAsserted.isEmpty();
747    }
748
749    public boolean hasDateAsserted() { 
750      return this.dateAsserted != null && !this.dateAsserted.isEmpty();
751    }
752
753    /**
754     * @param value {@link #dateAsserted} (The time at which the statement was recorded by informationSource.). This is the underlying object with id, value and extensions. The accessor "getDateAsserted" gives direct access to the value
755     */
756    public DeviceUsage setDateAssertedElement(DateTimeType value) { 
757      this.dateAsserted = value;
758      return this;
759    }
760
761    /**
762     * @return The time at which the statement was recorded by informationSource.
763     */
764    public Date getDateAsserted() { 
765      return this.dateAsserted == null ? null : this.dateAsserted.getValue();
766    }
767
768    /**
769     * @param value The time at which the statement was recorded by informationSource.
770     */
771    public DeviceUsage setDateAsserted(Date value) { 
772      if (value == null)
773        this.dateAsserted = null;
774      else {
775        if (this.dateAsserted == null)
776          this.dateAsserted = new DateTimeType();
777        this.dateAsserted.setValue(value);
778      }
779      return this;
780    }
781
782    /**
783     * @return {@link #usageStatus} (The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement.)
784     */
785    public CodeableConcept getUsageStatus() { 
786      if (this.usageStatus == null)
787        if (Configuration.errorOnAutoCreate())
788          throw new Error("Attempt to auto-create DeviceUsage.usageStatus");
789        else if (Configuration.doAutoCreate())
790          this.usageStatus = new CodeableConcept(); // cc
791      return this.usageStatus;
792    }
793
794    public boolean hasUsageStatus() { 
795      return this.usageStatus != null && !this.usageStatus.isEmpty();
796    }
797
798    /**
799     * @param value {@link #usageStatus} (The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement.)
800     */
801    public DeviceUsage setUsageStatus(CodeableConcept value) { 
802      this.usageStatus = value;
803      return this;
804    }
805
806    /**
807     * @return {@link #usageReason} (The reason for asserting the usage status - for example forgot, lost, stolen, broken.)
808     */
809    public List<CodeableConcept> getUsageReason() { 
810      if (this.usageReason == null)
811        this.usageReason = new ArrayList<CodeableConcept>();
812      return this.usageReason;
813    }
814
815    /**
816     * @return Returns a reference to <code>this</code> for easy method chaining
817     */
818    public DeviceUsage setUsageReason(List<CodeableConcept> theUsageReason) { 
819      this.usageReason = theUsageReason;
820      return this;
821    }
822
823    public boolean hasUsageReason() { 
824      if (this.usageReason == null)
825        return false;
826      for (CodeableConcept item : this.usageReason)
827        if (!item.isEmpty())
828          return true;
829      return false;
830    }
831
832    public CodeableConcept addUsageReason() { //3
833      CodeableConcept t = new CodeableConcept();
834      if (this.usageReason == null)
835        this.usageReason = new ArrayList<CodeableConcept>();
836      this.usageReason.add(t);
837      return t;
838    }
839
840    public DeviceUsage addUsageReason(CodeableConcept t) { //3
841      if (t == null)
842        return this;
843      if (this.usageReason == null)
844        this.usageReason = new ArrayList<CodeableConcept>();
845      this.usageReason.add(t);
846      return this;
847    }
848
849    /**
850     * @return The first repetition of repeating field {@link #usageReason}, creating it if it does not already exist {3}
851     */
852    public CodeableConcept getUsageReasonFirstRep() { 
853      if (getUsageReason().isEmpty()) {
854        addUsageReason();
855      }
856      return getUsageReason().get(0);
857    }
858
859    /**
860     * @return {@link #informationSource} (Who reported the device was being used by the patient.)
861     */
862    public Reference getInformationSource() { 
863      if (this.informationSource == null)
864        if (Configuration.errorOnAutoCreate())
865          throw new Error("Attempt to auto-create DeviceUsage.informationSource");
866        else if (Configuration.doAutoCreate())
867          this.informationSource = new Reference(); // cc
868      return this.informationSource;
869    }
870
871    public boolean hasInformationSource() { 
872      return this.informationSource != null && !this.informationSource.isEmpty();
873    }
874
875    /**
876     * @param value {@link #informationSource} (Who reported the device was being used by the patient.)
877     */
878    public DeviceUsage setInformationSource(Reference value) { 
879      this.informationSource = value;
880      return this;
881    }
882
883    /**
884     * @return {@link #device} (Code or Reference to device used.)
885     */
886    public CodeableReference getDevice() { 
887      if (this.device == null)
888        if (Configuration.errorOnAutoCreate())
889          throw new Error("Attempt to auto-create DeviceUsage.device");
890        else if (Configuration.doAutoCreate())
891          this.device = new CodeableReference(); // cc
892      return this.device;
893    }
894
895    public boolean hasDevice() { 
896      return this.device != null && !this.device.isEmpty();
897    }
898
899    /**
900     * @param value {@link #device} (Code or Reference to device used.)
901     */
902    public DeviceUsage setDevice(CodeableReference value) { 
903      this.device = value;
904      return this;
905    }
906
907    /**
908     * @return {@link #reason} (Reason or justification for the use of the device. A coded concept, or another resource whose existence justifies this DeviceUsage.)
909     */
910    public List<CodeableReference> getReason() { 
911      if (this.reason == null)
912        this.reason = new ArrayList<CodeableReference>();
913      return this.reason;
914    }
915
916    /**
917     * @return Returns a reference to <code>this</code> for easy method chaining
918     */
919    public DeviceUsage setReason(List<CodeableReference> theReason) { 
920      this.reason = theReason;
921      return this;
922    }
923
924    public boolean hasReason() { 
925      if (this.reason == null)
926        return false;
927      for (CodeableReference item : this.reason)
928        if (!item.isEmpty())
929          return true;
930      return false;
931    }
932
933    public CodeableReference addReason() { //3
934      CodeableReference t = new CodeableReference();
935      if (this.reason == null)
936        this.reason = new ArrayList<CodeableReference>();
937      this.reason.add(t);
938      return t;
939    }
940
941    public DeviceUsage addReason(CodeableReference t) { //3
942      if (t == null)
943        return this;
944      if (this.reason == null)
945        this.reason = new ArrayList<CodeableReference>();
946      this.reason.add(t);
947      return this;
948    }
949
950    /**
951     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
952     */
953    public CodeableReference getReasonFirstRep() { 
954      if (getReason().isEmpty()) {
955        addReason();
956      }
957      return getReason().get(0);
958    }
959
960    /**
961     * @return {@link #bodySite} (Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).)
962     */
963    public CodeableReference getBodySite() { 
964      if (this.bodySite == null)
965        if (Configuration.errorOnAutoCreate())
966          throw new Error("Attempt to auto-create DeviceUsage.bodySite");
967        else if (Configuration.doAutoCreate())
968          this.bodySite = new CodeableReference(); // cc
969      return this.bodySite;
970    }
971
972    public boolean hasBodySite() { 
973      return this.bodySite != null && !this.bodySite.isEmpty();
974    }
975
976    /**
977     * @param value {@link #bodySite} (Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).)
978     */
979    public DeviceUsage setBodySite(CodeableReference value) { 
980      this.bodySite = value;
981      return this;
982    }
983
984    /**
985     * @return {@link #note} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.)
986     */
987    public List<Annotation> getNote() { 
988      if (this.note == null)
989        this.note = new ArrayList<Annotation>();
990      return this.note;
991    }
992
993    /**
994     * @return Returns a reference to <code>this</code> for easy method chaining
995     */
996    public DeviceUsage setNote(List<Annotation> theNote) { 
997      this.note = theNote;
998      return this;
999    }
1000
1001    public boolean hasNote() { 
1002      if (this.note == null)
1003        return false;
1004      for (Annotation item : this.note)
1005        if (!item.isEmpty())
1006          return true;
1007      return false;
1008    }
1009
1010    public Annotation addNote() { //3
1011      Annotation t = new Annotation();
1012      if (this.note == null)
1013        this.note = new ArrayList<Annotation>();
1014      this.note.add(t);
1015      return t;
1016    }
1017
1018    public DeviceUsage addNote(Annotation t) { //3
1019      if (t == null)
1020        return this;
1021      if (this.note == null)
1022        this.note = new ArrayList<Annotation>();
1023      this.note.add(t);
1024      return this;
1025    }
1026
1027    /**
1028     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1029     */
1030    public Annotation getNoteFirstRep() { 
1031      if (getNote().isEmpty()) {
1032        addNote();
1033      }
1034      return getNote().get(0);
1035    }
1036
1037      protected void listChildren(List<Property> children) {
1038        super.listChildren(children);
1039        children.add(new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier));
1040        children.add(new Property("basedOn", "Reference(ServiceRequest)", "A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1041        children.add(new Property("status", "code", "A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.", 0, 1, status));
1042        children.add(new Property("category", "CodeableConcept", "This attribute indicates a category for the statement - The device statement may be made in an inpatient or outpatient settting (inpatient | outpatient | community | patientspecified).", 0, java.lang.Integer.MAX_VALUE, category));
1043        children.add(new Property("patient", "Reference(Patient)", "The patient who used the device.", 0, 1, patient));
1044        children.add(new Property("derivedFrom", "Reference(ServiceRequest|Procedure|Claim|Observation|QuestionnaireResponse|DocumentReference)", "Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage.", 0, java.lang.Integer.MAX_VALUE, derivedFrom));
1045        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care that establishes the context for this device use statement.", 0, 1, context));
1046        children.add(new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing));
1047        children.add(new Property("dateAsserted", "dateTime", "The time at which the statement was recorded by informationSource.", 0, 1, dateAsserted));
1048        children.add(new Property("usageStatus", "CodeableConcept", "The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement.", 0, 1, usageStatus));
1049        children.add(new Property("usageReason", "CodeableConcept", "The reason for asserting the usage status - for example forgot, lost, stolen, broken.", 0, java.lang.Integer.MAX_VALUE, usageReason));
1050        children.add(new Property("informationSource", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Who reported the device was being used by the patient.", 0, 1, informationSource));
1051        children.add(new Property("device", "CodeableReference(Device|DeviceDefinition)", "Code or Reference to device used.", 0, 1, device));
1052        children.add(new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport|DocumentReference)", "Reason or justification for the use of the device. A coded concept, or another resource whose existence justifies this DeviceUsage.", 0, java.lang.Integer.MAX_VALUE, reason));
1053        children.add(new Property("bodySite", "CodeableReference(BodyStructure)", "Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).", 0, 1, bodySite));
1054        children.add(new Property("note", "Annotation", "Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, note));
1055      }
1056
1057      @Override
1058      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1059        switch (_hash) {
1060        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier);
1061        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(ServiceRequest)", "A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage.", 0, java.lang.Integer.MAX_VALUE, basedOn);
1062        case -892481550: /*status*/  return new Property("status", "code", "A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.", 0, 1, status);
1063        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "This attribute indicates a category for the statement - The device statement may be made in an inpatient or outpatient settting (inpatient | outpatient | community | patientspecified).", 0, java.lang.Integer.MAX_VALUE, category);
1064        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient who used the device.", 0, 1, patient);
1065        case 1077922663: /*derivedFrom*/  return new Property("derivedFrom", "Reference(ServiceRequest|Procedure|Claim|Observation|QuestionnaireResponse|DocumentReference)", "Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage.", 0, java.lang.Integer.MAX_VALUE, derivedFrom);
1066        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter or episode of care that establishes the context for this device use statement.", 0, 1, context);
1067        case 164632566: /*timing[x]*/  return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing);
1068        case -873664438: /*timing*/  return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing);
1069        case -497554124: /*timingTiming*/  return new Property("timing[x]", "Timing", "How often the device was used.", 0, 1, timing);
1070        case -615615829: /*timingPeriod*/  return new Property("timing[x]", "Period", "How often the device was used.", 0, 1, timing);
1071        case -1837458939: /*timingDateTime*/  return new Property("timing[x]", "dateTime", "How often the device was used.", 0, 1, timing);
1072        case -1980855245: /*dateAsserted*/  return new Property("dateAsserted", "dateTime", "The time at which the statement was recorded by informationSource.", 0, 1, dateAsserted);
1073        case 907197683: /*usageStatus*/  return new Property("usageStatus", "CodeableConcept", "The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement.", 0, 1, usageStatus);
1074        case 864714565: /*usageReason*/  return new Property("usageReason", "CodeableConcept", "The reason for asserting the usage status - for example forgot, lost, stolen, broken.", 0, java.lang.Integer.MAX_VALUE, usageReason);
1075        case -2123220889: /*informationSource*/  return new Property("informationSource", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Who reported the device was being used by the patient.", 0, 1, informationSource);
1076        case -1335157162: /*device*/  return new Property("device", "CodeableReference(Device|DeviceDefinition)", "Code or Reference to device used.", 0, 1, device);
1077        case -934964668: /*reason*/  return new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport|DocumentReference)", "Reason or justification for the use of the device. A coded concept, or another resource whose existence justifies this DeviceUsage.", 0, java.lang.Integer.MAX_VALUE, reason);
1078        case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableReference(BodyStructure)", "Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).", 0, 1, bodySite);
1079        case 3387378: /*note*/  return new Property("note", "Annotation", "Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, note);
1080        default: return super.getNamedProperty(_hash, _name, _checkValid);
1081        }
1082
1083      }
1084
1085      @Override
1086      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1087        switch (hash) {
1088        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1089        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
1090        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DeviceUsageStatus>
1091        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1092        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1093        case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // Reference
1094        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
1095        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
1096        case -1980855245: /*dateAsserted*/ return this.dateAsserted == null ? new Base[0] : new Base[] {this.dateAsserted}; // DateTimeType
1097        case 907197683: /*usageStatus*/ return this.usageStatus == null ? new Base[0] : new Base[] {this.usageStatus}; // CodeableConcept
1098        case 864714565: /*usageReason*/ return this.usageReason == null ? new Base[0] : this.usageReason.toArray(new Base[this.usageReason.size()]); // CodeableConcept
1099        case -2123220889: /*informationSource*/ return this.informationSource == null ? new Base[0] : new Base[] {this.informationSource}; // Reference
1100        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // CodeableReference
1101        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
1102        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableReference
1103        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1104        default: return super.getProperty(hash, name, checkValid);
1105        }
1106
1107      }
1108
1109      @Override
1110      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1111        switch (hash) {
1112        case -1618432855: // identifier
1113          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1114          return value;
1115        case -332612366: // basedOn
1116          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
1117          return value;
1118        case -892481550: // status
1119          value = new DeviceUsageStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1120          this.status = (Enumeration) value; // Enumeration<DeviceUsageStatus>
1121          return value;
1122        case 50511102: // category
1123          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1124          return value;
1125        case -791418107: // patient
1126          this.patient = TypeConvertor.castToReference(value); // Reference
1127          return value;
1128        case 1077922663: // derivedFrom
1129          this.getDerivedFrom().add(TypeConvertor.castToReference(value)); // Reference
1130          return value;
1131        case 951530927: // context
1132          this.context = TypeConvertor.castToReference(value); // Reference
1133          return value;
1134        case -873664438: // timing
1135          this.timing = TypeConvertor.castToType(value); // DataType
1136          return value;
1137        case -1980855245: // dateAsserted
1138          this.dateAsserted = TypeConvertor.castToDateTime(value); // DateTimeType
1139          return value;
1140        case 907197683: // usageStatus
1141          this.usageStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1142          return value;
1143        case 864714565: // usageReason
1144          this.getUsageReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1145          return value;
1146        case -2123220889: // informationSource
1147          this.informationSource = TypeConvertor.castToReference(value); // Reference
1148          return value;
1149        case -1335157162: // device
1150          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
1151          return value;
1152        case -934964668: // reason
1153          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
1154          return value;
1155        case 1702620169: // bodySite
1156          this.bodySite = TypeConvertor.castToCodeableReference(value); // CodeableReference
1157          return value;
1158        case 3387378: // note
1159          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
1160          return value;
1161        default: return super.setProperty(hash, name, value);
1162        }
1163
1164      }
1165
1166      @Override
1167      public Base setProperty(String name, Base value) throws FHIRException {
1168        if (name.equals("identifier")) {
1169          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1170        } else if (name.equals("basedOn")) {
1171          this.getBasedOn().add(TypeConvertor.castToReference(value));
1172        } else if (name.equals("status")) {
1173          value = new DeviceUsageStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1174          this.status = (Enumeration) value; // Enumeration<DeviceUsageStatus>
1175        } else if (name.equals("category")) {
1176          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
1177        } else if (name.equals("patient")) {
1178          this.patient = TypeConvertor.castToReference(value); // Reference
1179        } else if (name.equals("derivedFrom")) {
1180          this.getDerivedFrom().add(TypeConvertor.castToReference(value));
1181        } else if (name.equals("context")) {
1182          this.context = TypeConvertor.castToReference(value); // Reference
1183        } else if (name.equals("timing[x]")) {
1184          this.timing = TypeConvertor.castToType(value); // DataType
1185        } else if (name.equals("dateAsserted")) {
1186          this.dateAsserted = TypeConvertor.castToDateTime(value); // DateTimeType
1187        } else if (name.equals("usageStatus")) {
1188          this.usageStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1189        } else if (name.equals("usageReason")) {
1190          this.getUsageReason().add(TypeConvertor.castToCodeableConcept(value));
1191        } else if (name.equals("informationSource")) {
1192          this.informationSource = TypeConvertor.castToReference(value); // Reference
1193        } else if (name.equals("device")) {
1194          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
1195        } else if (name.equals("reason")) {
1196          this.getReason().add(TypeConvertor.castToCodeableReference(value));
1197        } else if (name.equals("bodySite")) {
1198          this.bodySite = TypeConvertor.castToCodeableReference(value); // CodeableReference
1199        } else if (name.equals("note")) {
1200          this.getNote().add(TypeConvertor.castToAnnotation(value));
1201        } else
1202          return super.setProperty(name, value);
1203        return value;
1204      }
1205
1206      @Override
1207      public Base makeProperty(int hash, String name) throws FHIRException {
1208        switch (hash) {
1209        case -1618432855:  return addIdentifier(); 
1210        case -332612366:  return addBasedOn(); 
1211        case -892481550:  return getStatusElement();
1212        case 50511102:  return addCategory(); 
1213        case -791418107:  return getPatient();
1214        case 1077922663:  return addDerivedFrom(); 
1215        case 951530927:  return getContext();
1216        case 164632566:  return getTiming();
1217        case -873664438:  return getTiming();
1218        case -1980855245:  return getDateAssertedElement();
1219        case 907197683:  return getUsageStatus();
1220        case 864714565:  return addUsageReason(); 
1221        case -2123220889:  return getInformationSource();
1222        case -1335157162:  return getDevice();
1223        case -934964668:  return addReason(); 
1224        case 1702620169:  return getBodySite();
1225        case 3387378:  return addNote(); 
1226        default: return super.makeProperty(hash, name);
1227        }
1228
1229      }
1230
1231      @Override
1232      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1233        switch (hash) {
1234        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1235        case -332612366: /*basedOn*/ return new String[] {"Reference"};
1236        case -892481550: /*status*/ return new String[] {"code"};
1237        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1238        case -791418107: /*patient*/ return new String[] {"Reference"};
1239        case 1077922663: /*derivedFrom*/ return new String[] {"Reference"};
1240        case 951530927: /*context*/ return new String[] {"Reference"};
1241        case -873664438: /*timing*/ return new String[] {"Timing", "Period", "dateTime"};
1242        case -1980855245: /*dateAsserted*/ return new String[] {"dateTime"};
1243        case 907197683: /*usageStatus*/ return new String[] {"CodeableConcept"};
1244        case 864714565: /*usageReason*/ return new String[] {"CodeableConcept"};
1245        case -2123220889: /*informationSource*/ return new String[] {"Reference"};
1246        case -1335157162: /*device*/ return new String[] {"CodeableReference"};
1247        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
1248        case 1702620169: /*bodySite*/ return new String[] {"CodeableReference"};
1249        case 3387378: /*note*/ return new String[] {"Annotation"};
1250        default: return super.getTypesForProperty(hash, name);
1251        }
1252
1253      }
1254
1255      @Override
1256      public Base addChild(String name) throws FHIRException {
1257        if (name.equals("identifier")) {
1258          return addIdentifier();
1259        }
1260        else if (name.equals("basedOn")) {
1261          return addBasedOn();
1262        }
1263        else if (name.equals("status")) {
1264          throw new FHIRException("Cannot call addChild on a primitive type DeviceUsage.status");
1265        }
1266        else if (name.equals("category")) {
1267          return addCategory();
1268        }
1269        else if (name.equals("patient")) {
1270          this.patient = new Reference();
1271          return this.patient;
1272        }
1273        else if (name.equals("derivedFrom")) {
1274          return addDerivedFrom();
1275        }
1276        else if (name.equals("context")) {
1277          this.context = new Reference();
1278          return this.context;
1279        }
1280        else if (name.equals("timingTiming")) {
1281          this.timing = new Timing();
1282          return this.timing;
1283        }
1284        else if (name.equals("timingPeriod")) {
1285          this.timing = new Period();
1286          return this.timing;
1287        }
1288        else if (name.equals("timingDateTime")) {
1289          this.timing = new DateTimeType();
1290          return this.timing;
1291        }
1292        else if (name.equals("dateAsserted")) {
1293          throw new FHIRException("Cannot call addChild on a primitive type DeviceUsage.dateAsserted");
1294        }
1295        else if (name.equals("usageStatus")) {
1296          this.usageStatus = new CodeableConcept();
1297          return this.usageStatus;
1298        }
1299        else if (name.equals("usageReason")) {
1300          return addUsageReason();
1301        }
1302        else if (name.equals("informationSource")) {
1303          this.informationSource = new Reference();
1304          return this.informationSource;
1305        }
1306        else if (name.equals("device")) {
1307          this.device = new CodeableReference();
1308          return this.device;
1309        }
1310        else if (name.equals("reason")) {
1311          return addReason();
1312        }
1313        else if (name.equals("bodySite")) {
1314          this.bodySite = new CodeableReference();
1315          return this.bodySite;
1316        }
1317        else if (name.equals("note")) {
1318          return addNote();
1319        }
1320        else
1321          return super.addChild(name);
1322      }
1323
1324  public String fhirType() {
1325    return "DeviceUsage";
1326
1327  }
1328
1329      public DeviceUsage copy() {
1330        DeviceUsage dst = new DeviceUsage();
1331        copyValues(dst);
1332        return dst;
1333      }
1334
1335      public void copyValues(DeviceUsage dst) {
1336        super.copyValues(dst);
1337        if (identifier != null) {
1338          dst.identifier = new ArrayList<Identifier>();
1339          for (Identifier i : identifier)
1340            dst.identifier.add(i.copy());
1341        };
1342        if (basedOn != null) {
1343          dst.basedOn = new ArrayList<Reference>();
1344          for (Reference i : basedOn)
1345            dst.basedOn.add(i.copy());
1346        };
1347        dst.status = status == null ? null : status.copy();
1348        if (category != null) {
1349          dst.category = new ArrayList<CodeableConcept>();
1350          for (CodeableConcept i : category)
1351            dst.category.add(i.copy());
1352        };
1353        dst.patient = patient == null ? null : patient.copy();
1354        if (derivedFrom != null) {
1355          dst.derivedFrom = new ArrayList<Reference>();
1356          for (Reference i : derivedFrom)
1357            dst.derivedFrom.add(i.copy());
1358        };
1359        dst.context = context == null ? null : context.copy();
1360        dst.timing = timing == null ? null : timing.copy();
1361        dst.dateAsserted = dateAsserted == null ? null : dateAsserted.copy();
1362        dst.usageStatus = usageStatus == null ? null : usageStatus.copy();
1363        if (usageReason != null) {
1364          dst.usageReason = new ArrayList<CodeableConcept>();
1365          for (CodeableConcept i : usageReason)
1366            dst.usageReason.add(i.copy());
1367        };
1368        dst.informationSource = informationSource == null ? null : informationSource.copy();
1369        dst.device = device == null ? null : device.copy();
1370        if (reason != null) {
1371          dst.reason = new ArrayList<CodeableReference>();
1372          for (CodeableReference i : reason)
1373            dst.reason.add(i.copy());
1374        };
1375        dst.bodySite = bodySite == null ? null : bodySite.copy();
1376        if (note != null) {
1377          dst.note = new ArrayList<Annotation>();
1378          for (Annotation i : note)
1379            dst.note.add(i.copy());
1380        };
1381      }
1382
1383      protected DeviceUsage typedCopy() {
1384        return copy();
1385      }
1386
1387      @Override
1388      public boolean equalsDeep(Base other_) {
1389        if (!super.equalsDeep(other_))
1390          return false;
1391        if (!(other_ instanceof DeviceUsage))
1392          return false;
1393        DeviceUsage o = (DeviceUsage) other_;
1394        return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(status, o.status, true)
1395           && compareDeep(category, o.category, true) && compareDeep(patient, o.patient, true) && compareDeep(derivedFrom, o.derivedFrom, true)
1396           && compareDeep(context, o.context, true) && compareDeep(timing, o.timing, true) && compareDeep(dateAsserted, o.dateAsserted, true)
1397           && compareDeep(usageStatus, o.usageStatus, true) && compareDeep(usageReason, o.usageReason, true)
1398           && compareDeep(informationSource, o.informationSource, true) && compareDeep(device, o.device, true)
1399           && compareDeep(reason, o.reason, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(note, o.note, true)
1400          ;
1401      }
1402
1403      @Override
1404      public boolean equalsShallow(Base other_) {
1405        if (!super.equalsShallow(other_))
1406          return false;
1407        if (!(other_ instanceof DeviceUsage))
1408          return false;
1409        DeviceUsage o = (DeviceUsage) other_;
1410        return compareValues(status, o.status, true) && compareValues(dateAsserted, o.dateAsserted, true);
1411      }
1412
1413      public boolean isEmpty() {
1414        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, status
1415          , category, patient, derivedFrom, context, timing, dateAsserted, usageStatus, usageReason
1416          , informationSource, device, reason, bodySite, note);
1417      }
1418
1419  @Override
1420  public ResourceType getResourceType() {
1421    return ResourceType.DeviceUsage;
1422   }
1423
1424 /**
1425   * Search parameter: <b>device</b>
1426   * <p>
1427   * Description: <b>Search by device</b><br>
1428   * Type: <b>token</b><br>
1429   * Path: <b>DeviceUsage.device.concept</b><br>
1430   * </p>
1431   */
1432  @SearchParamDefinition(name="device", path="DeviceUsage.device.concept", description="Search by device", type="token" )
1433  public static final String SP_DEVICE = "device";
1434 /**
1435   * <b>Fluent Client</b> search parameter constant for <b>device</b>
1436   * <p>
1437   * Description: <b>Search by device</b><br>
1438   * Type: <b>token</b><br>
1439   * Path: <b>DeviceUsage.device.concept</b><br>
1440   * </p>
1441   */
1442  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DEVICE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DEVICE);
1443
1444 /**
1445   * Search parameter: <b>identifier</b>
1446   * <p>
1447   * Description: <b>Search by identifier</b><br>
1448   * Type: <b>token</b><br>
1449   * Path: <b>DeviceUsage.identifier</b><br>
1450   * </p>
1451   */
1452  @SearchParamDefinition(name="identifier", path="DeviceUsage.identifier", description="Search by identifier", type="token" )
1453  public static final String SP_IDENTIFIER = "identifier";
1454 /**
1455   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1456   * <p>
1457   * Description: <b>Search by identifier</b><br>
1458   * Type: <b>token</b><br>
1459   * Path: <b>DeviceUsage.identifier</b><br>
1460   * </p>
1461   */
1462  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1463
1464 /**
1465   * Search parameter: <b>patient</b>
1466   * <p>
1467   * Description: <b>Multiple Resources: 
1468
1469* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
1470* [CarePlan](careplan.html): Who the care plan is for
1471* [CareTeam](careteam.html): Who care team is for
1472* [ClinicalImpression](clinicalimpression.html): Patient assessed
1473* [Composition](composition.html): Who and/or what the composition is about
1474* [Condition](condition.html): Who has the condition?
1475* [Consent](consent.html): Who the consent applies to
1476* [DetectedIssue](detectedissue.html): Associated patient
1477* [DeviceRequest](devicerequest.html): Individual the service is ordered for
1478* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
1479* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
1480* [DocumentManifest](documentmanifest.html): The subject of the set of documents
1481* [DocumentReference](documentreference.html): Who/what is the subject of the document
1482* [Encounter](encounter.html): The patient present at the encounter
1483* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
1484* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
1485* [Flag](flag.html): The identity of a subject to list flags for
1486* [Goal](goal.html): Who this goal is intended for
1487* [ImagingStudy](imagingstudy.html): Who the study is about
1488* [Immunization](immunization.html): The patient for the vaccination record
1489* [List](list.html): If all resources have the same subject
1490* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
1491* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
1492* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
1493* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
1494* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
1495* [Observation](observation.html): The subject that the observation is about (if patient)
1496* [Procedure](procedure.html): Search by subject - a patient
1497* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
1498* [ServiceRequest](servicerequest.html): Search by subject - a patient
1499* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
1500* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
1501</b><br>
1502   * Type: <b>reference</b><br>
1503   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.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>
1504   * </p>
1505   */
1506  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.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 assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the 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", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, ConceptMap2.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.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, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.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, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.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, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
1507  public static final String SP_PATIENT = "patient";
1508 /**
1509   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1510   * <p>
1511   * Description: <b>Multiple Resources: 
1512
1513* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
1514* [CarePlan](careplan.html): Who the care plan is for
1515* [CareTeam](careteam.html): Who care team is for
1516* [ClinicalImpression](clinicalimpression.html): Patient assessed
1517* [Composition](composition.html): Who and/or what the composition is about
1518* [Condition](condition.html): Who has the condition?
1519* [Consent](consent.html): Who the consent applies to
1520* [DetectedIssue](detectedissue.html): Associated patient
1521* [DeviceRequest](devicerequest.html): Individual the service is ordered for
1522* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
1523* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
1524* [DocumentManifest](documentmanifest.html): The subject of the set of documents
1525* [DocumentReference](documentreference.html): Who/what is the subject of the document
1526* [Encounter](encounter.html): The patient present at the encounter
1527* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
1528* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
1529* [Flag](flag.html): The identity of a subject to list flags for
1530* [Goal](goal.html): Who this goal is intended for
1531* [ImagingStudy](imagingstudy.html): Who the study is about
1532* [Immunization](immunization.html): The patient for the vaccination record
1533* [List](list.html): If all resources have the same subject
1534* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
1535* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
1536* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
1537* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
1538* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
1539* [Observation](observation.html): The subject that the observation is about (if patient)
1540* [Procedure](procedure.html): Search by subject - a patient
1541* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
1542* [ServiceRequest](servicerequest.html): Search by subject - a patient
1543* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
1544* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
1545</b><br>
1546   * Type: <b>reference</b><br>
1547   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.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>
1548   * </p>
1549   */
1550  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1551
1552/**
1553   * Constant for fluent queries to be used to add include statements. Specifies
1554   * the path value of "<b>DeviceUsage:patient</b>".
1555   */
1556  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceUsage:patient").toLocked();
1557
1558
1559}
1560