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 Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
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            case NULL: return null;
121            default: return "?";
122          }
123        }
124        public String getSystem() {
125          switch (this) {
126            case ACTIVE: return "http://hl7.org/fhir/deviceusage-status";
127            case COMPLETED: return "http://hl7.org/fhir/deviceusage-status";
128            case NOTDONE: return "http://hl7.org/fhir/deviceusage-status";
129            case ENTEREDINERROR: return "http://hl7.org/fhir/deviceusage-status";
130            case INTENDED: return "http://hl7.org/fhir/deviceusage-status";
131            case STOPPED: return "http://hl7.org/fhir/deviceusage-status";
132            case ONHOLD: return "http://hl7.org/fhir/deviceusage-status";
133            case NULL: return null;
134            default: return "?";
135          }
136        }
137        public String getDefinition() {
138          switch (this) {
139            case ACTIVE: return "The device is still being used.";
140            case COMPLETED: return "The device is no longer being used.";
141            case NOTDONE: return "The device was not used.";
142            case ENTEREDINERROR: return "The statement was recorded incorrectly.";
143            case INTENDED: return "The device may be used at some time in the future.";
144            case STOPPED: return "Actions implied by the statement have been permanently halted, before all of them occurred.";
145            case ONHOLD: return "Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
146            case NULL: return null;
147            default: return "?";
148          }
149        }
150        public String getDisplay() {
151          switch (this) {
152            case ACTIVE: return "Active";
153            case COMPLETED: return "Completed";
154            case NOTDONE: return "Not done";
155            case ENTEREDINERROR: return "Entered in Error";
156            case INTENDED: return "Intended";
157            case STOPPED: return "Stopped";
158            case ONHOLD: return "On Hold";
159            case NULL: return null;
160            default: return "?";
161          }
162        }
163    }
164
165  public static class DeviceUsageStatusEnumFactory implements EnumFactory<DeviceUsageStatus> {
166    public DeviceUsageStatus fromCode(String codeString) throws IllegalArgumentException {
167      if (codeString == null || "".equals(codeString))
168            if (codeString == null || "".equals(codeString))
169                return null;
170        if ("active".equals(codeString))
171          return DeviceUsageStatus.ACTIVE;
172        if ("completed".equals(codeString))
173          return DeviceUsageStatus.COMPLETED;
174        if ("not-done".equals(codeString))
175          return DeviceUsageStatus.NOTDONE;
176        if ("entered-in-error".equals(codeString))
177          return DeviceUsageStatus.ENTEREDINERROR;
178        if ("intended".equals(codeString))
179          return DeviceUsageStatus.INTENDED;
180        if ("stopped".equals(codeString))
181          return DeviceUsageStatus.STOPPED;
182        if ("on-hold".equals(codeString))
183          return DeviceUsageStatus.ONHOLD;
184        throw new IllegalArgumentException("Unknown DeviceUsageStatus code '"+codeString+"'");
185        }
186        public Enumeration<DeviceUsageStatus> fromType(PrimitiveType<?> code) throws FHIRException {
187          if (code == null)
188            return null;
189          if (code.isEmpty())
190            return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.NULL, code);
191          String codeString = ((PrimitiveType) code).asStringValue();
192          if (codeString == null || "".equals(codeString))
193            return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.NULL, code);
194        if ("active".equals(codeString))
195          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.ACTIVE, code);
196        if ("completed".equals(codeString))
197          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.COMPLETED, code);
198        if ("not-done".equals(codeString))
199          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.NOTDONE, code);
200        if ("entered-in-error".equals(codeString))
201          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.ENTEREDINERROR, code);
202        if ("intended".equals(codeString))
203          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.INTENDED, code);
204        if ("stopped".equals(codeString))
205          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.STOPPED, code);
206        if ("on-hold".equals(codeString))
207          return new Enumeration<DeviceUsageStatus>(this, DeviceUsageStatus.ONHOLD, code);
208        throw new FHIRException("Unknown DeviceUsageStatus code '"+codeString+"'");
209        }
210    public String toCode(DeviceUsageStatus code) {
211      if (code == DeviceUsageStatus.ACTIVE)
212        return "active";
213      if (code == DeviceUsageStatus.COMPLETED)
214        return "completed";
215      if (code == DeviceUsageStatus.NOTDONE)
216        return "not-done";
217      if (code == DeviceUsageStatus.ENTEREDINERROR)
218        return "entered-in-error";
219      if (code == DeviceUsageStatus.INTENDED)
220        return "intended";
221      if (code == DeviceUsageStatus.STOPPED)
222        return "stopped";
223      if (code == DeviceUsageStatus.ONHOLD)
224        return "on-hold";
225      return "?";
226      }
227    public String toSystem(DeviceUsageStatus code) {
228      return code.getSystem();
229      }
230    }
231
232    @Block()
233    public static class DeviceUsageAdherenceComponent extends BackboneElement implements IBaseBackboneElement {
234        /**
235         * Type of adherence.
236         */
237        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
238        @Description(shortDefinition="always | never | sometimes", formalDefinition="Type of adherence." )
239        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/deviceusage-adherence-code")
240        protected CodeableConcept code;
241
242        /**
243         * Reason for adherence type.
244         */
245        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
246        @Description(shortDefinition="lost | stolen | prescribed | broken | burned | forgot", formalDefinition="Reason for adherence type." )
247        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/deviceusage-adherence-reason")
248        protected List<CodeableConcept> reason;
249
250        private static final long serialVersionUID = -1932336797L;
251
252    /**
253     * Constructor
254     */
255      public DeviceUsageAdherenceComponent() {
256        super();
257      }
258
259    /**
260     * Constructor
261     */
262      public DeviceUsageAdherenceComponent(CodeableConcept code, CodeableConcept reason) {
263        super();
264        this.setCode(code);
265        this.addReason(reason);
266      }
267
268        /**
269         * @return {@link #code} (Type of adherence.)
270         */
271        public CodeableConcept getCode() { 
272          if (this.code == null)
273            if (Configuration.errorOnAutoCreate())
274              throw new Error("Attempt to auto-create DeviceUsageAdherenceComponent.code");
275            else if (Configuration.doAutoCreate())
276              this.code = new CodeableConcept(); // cc
277          return this.code;
278        }
279
280        public boolean hasCode() { 
281          return this.code != null && !this.code.isEmpty();
282        }
283
284        /**
285         * @param value {@link #code} (Type of adherence.)
286         */
287        public DeviceUsageAdherenceComponent setCode(CodeableConcept value) { 
288          this.code = value;
289          return this;
290        }
291
292        /**
293         * @return {@link #reason} (Reason for adherence type.)
294         */
295        public List<CodeableConcept> getReason() { 
296          if (this.reason == null)
297            this.reason = new ArrayList<CodeableConcept>();
298          return this.reason;
299        }
300
301        /**
302         * @return Returns a reference to <code>this</code> for easy method chaining
303         */
304        public DeviceUsageAdherenceComponent setReason(List<CodeableConcept> theReason) { 
305          this.reason = theReason;
306          return this;
307        }
308
309        public boolean hasReason() { 
310          if (this.reason == null)
311            return false;
312          for (CodeableConcept item : this.reason)
313            if (!item.isEmpty())
314              return true;
315          return false;
316        }
317
318        public CodeableConcept addReason() { //3
319          CodeableConcept t = new CodeableConcept();
320          if (this.reason == null)
321            this.reason = new ArrayList<CodeableConcept>();
322          this.reason.add(t);
323          return t;
324        }
325
326        public DeviceUsageAdherenceComponent addReason(CodeableConcept t) { //3
327          if (t == null)
328            return this;
329          if (this.reason == null)
330            this.reason = new ArrayList<CodeableConcept>();
331          this.reason.add(t);
332          return this;
333        }
334
335        /**
336         * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
337         */
338        public CodeableConcept getReasonFirstRep() { 
339          if (getReason().isEmpty()) {
340            addReason();
341          }
342          return getReason().get(0);
343        }
344
345        protected void listChildren(List<Property> children) {
346          super.listChildren(children);
347          children.add(new Property("code", "CodeableConcept", "Type of adherence.", 0, 1, code));
348          children.add(new Property("reason", "CodeableConcept", "Reason for adherence type.", 0, java.lang.Integer.MAX_VALUE, reason));
349        }
350
351        @Override
352        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
353          switch (_hash) {
354          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Type of adherence.", 0, 1, code);
355          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Reason for adherence type.", 0, java.lang.Integer.MAX_VALUE, reason);
356          default: return super.getNamedProperty(_hash, _name, _checkValid);
357          }
358
359        }
360
361      @Override
362      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
363        switch (hash) {
364        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
365        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
366        default: return super.getProperty(hash, name, checkValid);
367        }
368
369      }
370
371      @Override
372      public Base setProperty(int hash, String name, Base value) throws FHIRException {
373        switch (hash) {
374        case 3059181: // code
375          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
376          return value;
377        case -934964668: // reason
378          this.getReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
379          return value;
380        default: return super.setProperty(hash, name, value);
381        }
382
383      }
384
385      @Override
386      public Base setProperty(String name, Base value) throws FHIRException {
387        if (name.equals("code")) {
388          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
389        } else if (name.equals("reason")) {
390          this.getReason().add(TypeConvertor.castToCodeableConcept(value));
391        } else
392          return super.setProperty(name, value);
393        return value;
394      }
395
396      @Override
397      public Base makeProperty(int hash, String name) throws FHIRException {
398        switch (hash) {
399        case 3059181:  return getCode();
400        case -934964668:  return addReason(); 
401        default: return super.makeProperty(hash, name);
402        }
403
404      }
405
406      @Override
407      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
408        switch (hash) {
409        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
410        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
411        default: return super.getTypesForProperty(hash, name);
412        }
413
414      }
415
416      @Override
417      public Base addChild(String name) throws FHIRException {
418        if (name.equals("code")) {
419          this.code = new CodeableConcept();
420          return this.code;
421        }
422        else if (name.equals("reason")) {
423          return addReason();
424        }
425        else
426          return super.addChild(name);
427      }
428
429      public DeviceUsageAdherenceComponent copy() {
430        DeviceUsageAdherenceComponent dst = new DeviceUsageAdherenceComponent();
431        copyValues(dst);
432        return dst;
433      }
434
435      public void copyValues(DeviceUsageAdherenceComponent dst) {
436        super.copyValues(dst);
437        dst.code = code == null ? null : code.copy();
438        if (reason != null) {
439          dst.reason = new ArrayList<CodeableConcept>();
440          for (CodeableConcept i : reason)
441            dst.reason.add(i.copy());
442        };
443      }
444
445      @Override
446      public boolean equalsDeep(Base other_) {
447        if (!super.equalsDeep(other_))
448          return false;
449        if (!(other_ instanceof DeviceUsageAdherenceComponent))
450          return false;
451        DeviceUsageAdherenceComponent o = (DeviceUsageAdherenceComponent) other_;
452        return compareDeep(code, o.code, true) && compareDeep(reason, o.reason, true);
453      }
454
455      @Override
456      public boolean equalsShallow(Base other_) {
457        if (!super.equalsShallow(other_))
458          return false;
459        if (!(other_ instanceof DeviceUsageAdherenceComponent))
460          return false;
461        DeviceUsageAdherenceComponent o = (DeviceUsageAdherenceComponent) other_;
462        return true;
463      }
464
465      public boolean isEmpty() {
466        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, reason);
467      }
468
469  public String fhirType() {
470    return "DeviceUsage.adherence";
471
472  }
473
474  }
475
476    /**
477     * An external identifier for this statement such as an IRI.
478     */
479    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
480    @Description(shortDefinition="External identifier for this record", formalDefinition="An external identifier for this statement such as an IRI." )
481    protected List<Identifier> identifier;
482
483    /**
484     * A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage.
485     */
486    @Child(name = "basedOn", type = {ServiceRequest.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
487    @Description(shortDefinition="Fulfills plan, proposal or order", formalDefinition="A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage." )
488    protected List<Reference> basedOn;
489
490    /**
491     * 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.
492     */
493    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
494    @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." )
495    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/deviceusage-status")
496    protected Enumeration<DeviceUsageStatus> status;
497
498    /**
499     * This attribute indicates a category for the statement - The device statement may be made in an inpatient or outpatient settting (inpatient | outpatient | community | patientspecified).
500     */
501    @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
502    @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)." )
503    protected List<CodeableConcept> category;
504
505    /**
506     * The patient who used the device.
507     */
508    @Child(name = "patient", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true)
509    @Description(shortDefinition="Patient using device", formalDefinition="The patient who used the device." )
510    protected Reference patient;
511
512    /**
513     * Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage.
514     */
515    @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)
516    @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." )
517    protected List<Reference> derivedFrom;
518
519    /**
520     * The encounter or episode of care that establishes the context for this device use statement.
521     */
522    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=6, min=0, max=1, modifier=false, summary=true)
523    @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." )
524    protected Reference context;
525
526    /**
527     * How often the device was used.
528     */
529    @Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
530    @Description(shortDefinition="How often  the device was used", formalDefinition="How often the device was used." )
531    protected DataType timing;
532
533    /**
534     * The time at which the statement was recorded by informationSource.
535     */
536    @Child(name = "dateAsserted", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
537    @Description(shortDefinition="When the statement was made (and recorded)", formalDefinition="The time at which the statement was recorded by informationSource." )
538    protected DateTimeType dateAsserted;
539
540    /**
541     * The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement.
542     */
543    @Child(name = "usageStatus", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
544    @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." )
545    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/deviceusage-status")
546    protected CodeableConcept usageStatus;
547
548    /**
549     * The reason for asserting the usage status - for example forgot, lost, stolen, broken.
550     */
551    @Child(name = "usageReason", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
552    @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." )
553    protected List<CodeableConcept> usageReason;
554
555    /**
556     * This indicates how or if the device is being used.
557     */
558    @Child(name = "adherence", type = {}, order=11, min=0, max=1, modifier=false, summary=false)
559    @Description(shortDefinition="How device is being used", formalDefinition="This indicates how or if the device is being used." )
560    protected DeviceUsageAdherenceComponent adherence;
561
562    /**
563     * Who reported the device was being used by the patient.
564     */
565    @Child(name = "informationSource", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Organization.class}, order=12, min=0, max=1, modifier=false, summary=true)
566    @Description(shortDefinition="Who made the statement", formalDefinition="Who reported the device was being used by the patient." )
567    protected Reference informationSource;
568
569    /**
570     * Code or Reference to device used.
571     */
572    @Child(name = "device", type = {CodeableReference.class}, order=13, min=1, max=1, modifier=false, summary=true)
573    @Description(shortDefinition="Code or Reference to device used", formalDefinition="Code or Reference to device used." )
574    protected CodeableReference device;
575
576    /**
577     * Reason or justification for the use of the device. A coded concept, or another resource whose existence justifies this DeviceUsage.
578     */
579    @Child(name = "reason", type = {CodeableReference.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
580    @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." )
581    protected List<CodeableReference> reason;
582
583    /**
584     * Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).
585     */
586    @Child(name = "bodySite", type = {CodeableReference.class}, order=15, min=0, max=1, modifier=false, summary=true)
587    @Description(shortDefinition="Target body site", formalDefinition="Indicates the anotomic location on the subject's body where the device was used ( i.e. the target)." )
588    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
589    protected CodeableReference bodySite;
590
591    /**
592     * 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.
593     */
594    @Child(name = "note", type = {Annotation.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
595    @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." )
596    protected List<Annotation> note;
597
598    private static final long serialVersionUID = -10803928L;
599
600  /**
601   * Constructor
602   */
603    public DeviceUsage() {
604      super();
605    }
606
607  /**
608   * Constructor
609   */
610    public DeviceUsage(DeviceUsageStatus status, Reference patient, CodeableReference device) {
611      super();
612      this.setStatus(status);
613      this.setPatient(patient);
614      this.setDevice(device);
615    }
616
617    /**
618     * @return {@link #identifier} (An external identifier for this statement such as an IRI.)
619     */
620    public List<Identifier> getIdentifier() { 
621      if (this.identifier == null)
622        this.identifier = new ArrayList<Identifier>();
623      return this.identifier;
624    }
625
626    /**
627     * @return Returns a reference to <code>this</code> for easy method chaining
628     */
629    public DeviceUsage setIdentifier(List<Identifier> theIdentifier) { 
630      this.identifier = theIdentifier;
631      return this;
632    }
633
634    public boolean hasIdentifier() { 
635      if (this.identifier == null)
636        return false;
637      for (Identifier item : this.identifier)
638        if (!item.isEmpty())
639          return true;
640      return false;
641    }
642
643    public Identifier addIdentifier() { //3
644      Identifier t = new Identifier();
645      if (this.identifier == null)
646        this.identifier = new ArrayList<Identifier>();
647      this.identifier.add(t);
648      return t;
649    }
650
651    public DeviceUsage addIdentifier(Identifier t) { //3
652      if (t == null)
653        return this;
654      if (this.identifier == null)
655        this.identifier = new ArrayList<Identifier>();
656      this.identifier.add(t);
657      return this;
658    }
659
660    /**
661     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
662     */
663    public Identifier getIdentifierFirstRep() { 
664      if (getIdentifier().isEmpty()) {
665        addIdentifier();
666      }
667      return getIdentifier().get(0);
668    }
669
670    /**
671     * @return {@link #basedOn} (A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage.)
672     */
673    public List<Reference> getBasedOn() { 
674      if (this.basedOn == null)
675        this.basedOn = new ArrayList<Reference>();
676      return this.basedOn;
677    }
678
679    /**
680     * @return Returns a reference to <code>this</code> for easy method chaining
681     */
682    public DeviceUsage setBasedOn(List<Reference> theBasedOn) { 
683      this.basedOn = theBasedOn;
684      return this;
685    }
686
687    public boolean hasBasedOn() { 
688      if (this.basedOn == null)
689        return false;
690      for (Reference item : this.basedOn)
691        if (!item.isEmpty())
692          return true;
693      return false;
694    }
695
696    public Reference addBasedOn() { //3
697      Reference t = new Reference();
698      if (this.basedOn == null)
699        this.basedOn = new ArrayList<Reference>();
700      this.basedOn.add(t);
701      return t;
702    }
703
704    public DeviceUsage addBasedOn(Reference t) { //3
705      if (t == null)
706        return this;
707      if (this.basedOn == null)
708        this.basedOn = new ArrayList<Reference>();
709      this.basedOn.add(t);
710      return this;
711    }
712
713    /**
714     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
715     */
716    public Reference getBasedOnFirstRep() { 
717      if (getBasedOn().isEmpty()) {
718        addBasedOn();
719      }
720      return getBasedOn().get(0);
721    }
722
723    /**
724     * @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
725     */
726    public Enumeration<DeviceUsageStatus> getStatusElement() { 
727      if (this.status == null)
728        if (Configuration.errorOnAutoCreate())
729          throw new Error("Attempt to auto-create DeviceUsage.status");
730        else if (Configuration.doAutoCreate())
731          this.status = new Enumeration<DeviceUsageStatus>(new DeviceUsageStatusEnumFactory()); // bb
732      return this.status;
733    }
734
735    public boolean hasStatusElement() { 
736      return this.status != null && !this.status.isEmpty();
737    }
738
739    public boolean hasStatus() { 
740      return this.status != null && !this.status.isEmpty();
741    }
742
743    /**
744     * @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
745     */
746    public DeviceUsage setStatusElement(Enumeration<DeviceUsageStatus> value) { 
747      this.status = value;
748      return this;
749    }
750
751    /**
752     * @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.
753     */
754    public DeviceUsageStatus getStatus() { 
755      return this.status == null ? null : this.status.getValue();
756    }
757
758    /**
759     * @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.
760     */
761    public DeviceUsage setStatus(DeviceUsageStatus value) { 
762        if (this.status == null)
763          this.status = new Enumeration<DeviceUsageStatus>(new DeviceUsageStatusEnumFactory());
764        this.status.setValue(value);
765      return this;
766    }
767
768    /**
769     * @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).)
770     */
771    public List<CodeableConcept> getCategory() { 
772      if (this.category == null)
773        this.category = new ArrayList<CodeableConcept>();
774      return this.category;
775    }
776
777    /**
778     * @return Returns a reference to <code>this</code> for easy method chaining
779     */
780    public DeviceUsage setCategory(List<CodeableConcept> theCategory) { 
781      this.category = theCategory;
782      return this;
783    }
784
785    public boolean hasCategory() { 
786      if (this.category == null)
787        return false;
788      for (CodeableConcept item : this.category)
789        if (!item.isEmpty())
790          return true;
791      return false;
792    }
793
794    public CodeableConcept addCategory() { //3
795      CodeableConcept t = new CodeableConcept();
796      if (this.category == null)
797        this.category = new ArrayList<CodeableConcept>();
798      this.category.add(t);
799      return t;
800    }
801
802    public DeviceUsage addCategory(CodeableConcept t) { //3
803      if (t == null)
804        return this;
805      if (this.category == null)
806        this.category = new ArrayList<CodeableConcept>();
807      this.category.add(t);
808      return this;
809    }
810
811    /**
812     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
813     */
814    public CodeableConcept getCategoryFirstRep() { 
815      if (getCategory().isEmpty()) {
816        addCategory();
817      }
818      return getCategory().get(0);
819    }
820
821    /**
822     * @return {@link #patient} (The patient who used the device.)
823     */
824    public Reference getPatient() { 
825      if (this.patient == null)
826        if (Configuration.errorOnAutoCreate())
827          throw new Error("Attempt to auto-create DeviceUsage.patient");
828        else if (Configuration.doAutoCreate())
829          this.patient = new Reference(); // cc
830      return this.patient;
831    }
832
833    public boolean hasPatient() { 
834      return this.patient != null && !this.patient.isEmpty();
835    }
836
837    /**
838     * @param value {@link #patient} (The patient who used the device.)
839     */
840    public DeviceUsage setPatient(Reference value) { 
841      this.patient = value;
842      return this;
843    }
844
845    /**
846     * @return {@link #derivedFrom} (Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage.)
847     */
848    public List<Reference> getDerivedFrom() { 
849      if (this.derivedFrom == null)
850        this.derivedFrom = new ArrayList<Reference>();
851      return this.derivedFrom;
852    }
853
854    /**
855     * @return Returns a reference to <code>this</code> for easy method chaining
856     */
857    public DeviceUsage setDerivedFrom(List<Reference> theDerivedFrom) { 
858      this.derivedFrom = theDerivedFrom;
859      return this;
860    }
861
862    public boolean hasDerivedFrom() { 
863      if (this.derivedFrom == null)
864        return false;
865      for (Reference item : this.derivedFrom)
866        if (!item.isEmpty())
867          return true;
868      return false;
869    }
870
871    public Reference addDerivedFrom() { //3
872      Reference t = new Reference();
873      if (this.derivedFrom == null)
874        this.derivedFrom = new ArrayList<Reference>();
875      this.derivedFrom.add(t);
876      return t;
877    }
878
879    public DeviceUsage addDerivedFrom(Reference t) { //3
880      if (t == null)
881        return this;
882      if (this.derivedFrom == null)
883        this.derivedFrom = new ArrayList<Reference>();
884      this.derivedFrom.add(t);
885      return this;
886    }
887
888    /**
889     * @return The first repetition of repeating field {@link #derivedFrom}, creating it if it does not already exist {3}
890     */
891    public Reference getDerivedFromFirstRep() { 
892      if (getDerivedFrom().isEmpty()) {
893        addDerivedFrom();
894      }
895      return getDerivedFrom().get(0);
896    }
897
898    /**
899     * @return {@link #context} (The encounter or episode of care that establishes the context for this device use statement.)
900     */
901    public Reference getContext() { 
902      if (this.context == null)
903        if (Configuration.errorOnAutoCreate())
904          throw new Error("Attempt to auto-create DeviceUsage.context");
905        else if (Configuration.doAutoCreate())
906          this.context = new Reference(); // cc
907      return this.context;
908    }
909
910    public boolean hasContext() { 
911      return this.context != null && !this.context.isEmpty();
912    }
913
914    /**
915     * @param value {@link #context} (The encounter or episode of care that establishes the context for this device use statement.)
916     */
917    public DeviceUsage setContext(Reference value) { 
918      this.context = value;
919      return this;
920    }
921
922    /**
923     * @return {@link #timing} (How often the device was used.)
924     */
925    public DataType getTiming() { 
926      return this.timing;
927    }
928
929    /**
930     * @return {@link #timing} (How often the device was used.)
931     */
932    public Timing getTimingTiming() throws FHIRException { 
933      if (this.timing == null)
934        this.timing = new Timing();
935      if (!(this.timing instanceof Timing))
936        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered");
937      return (Timing) this.timing;
938    }
939
940    public boolean hasTimingTiming() { 
941      return this != null && this.timing instanceof Timing;
942    }
943
944    /**
945     * @return {@link #timing} (How often the device was used.)
946     */
947    public Period getTimingPeriod() throws FHIRException { 
948      if (this.timing == null)
949        this.timing = new Period();
950      if (!(this.timing instanceof Period))
951        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
952      return (Period) this.timing;
953    }
954
955    public boolean hasTimingPeriod() { 
956      return this != null && this.timing instanceof Period;
957    }
958
959    /**
960     * @return {@link #timing} (How often the device was used.)
961     */
962    public DateTimeType getTimingDateTimeType() throws FHIRException { 
963      if (this.timing == null)
964        this.timing = new DateTimeType();
965      if (!(this.timing instanceof DateTimeType))
966        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered");
967      return (DateTimeType) this.timing;
968    }
969
970    public boolean hasTimingDateTimeType() { 
971      return this != null && this.timing instanceof DateTimeType;
972    }
973
974    public boolean hasTiming() { 
975      return this.timing != null && !this.timing.isEmpty();
976    }
977
978    /**
979     * @param value {@link #timing} (How often the device was used.)
980     */
981    public DeviceUsage setTiming(DataType value) { 
982      if (value != null && !(value instanceof Timing || value instanceof Period || value instanceof DateTimeType))
983        throw new FHIRException("Not the right type for DeviceUsage.timing[x]: "+value.fhirType());
984      this.timing = value;
985      return this;
986    }
987
988    /**
989     * @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
990     */
991    public DateTimeType getDateAssertedElement() { 
992      if (this.dateAsserted == null)
993        if (Configuration.errorOnAutoCreate())
994          throw new Error("Attempt to auto-create DeviceUsage.dateAsserted");
995        else if (Configuration.doAutoCreate())
996          this.dateAsserted = new DateTimeType(); // bb
997      return this.dateAsserted;
998    }
999
1000    public boolean hasDateAssertedElement() { 
1001      return this.dateAsserted != null && !this.dateAsserted.isEmpty();
1002    }
1003
1004    public boolean hasDateAsserted() { 
1005      return this.dateAsserted != null && !this.dateAsserted.isEmpty();
1006    }
1007
1008    /**
1009     * @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
1010     */
1011    public DeviceUsage setDateAssertedElement(DateTimeType value) { 
1012      this.dateAsserted = value;
1013      return this;
1014    }
1015
1016    /**
1017     * @return The time at which the statement was recorded by informationSource.
1018     */
1019    public Date getDateAsserted() { 
1020      return this.dateAsserted == null ? null : this.dateAsserted.getValue();
1021    }
1022
1023    /**
1024     * @param value The time at which the statement was recorded by informationSource.
1025     */
1026    public DeviceUsage setDateAsserted(Date value) { 
1027      if (value == null)
1028        this.dateAsserted = null;
1029      else {
1030        if (this.dateAsserted == null)
1031          this.dateAsserted = new DateTimeType();
1032        this.dateAsserted.setValue(value);
1033      }
1034      return this;
1035    }
1036
1037    /**
1038     * @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.)
1039     */
1040    public CodeableConcept getUsageStatus() { 
1041      if (this.usageStatus == null)
1042        if (Configuration.errorOnAutoCreate())
1043          throw new Error("Attempt to auto-create DeviceUsage.usageStatus");
1044        else if (Configuration.doAutoCreate())
1045          this.usageStatus = new CodeableConcept(); // cc
1046      return this.usageStatus;
1047    }
1048
1049    public boolean hasUsageStatus() { 
1050      return this.usageStatus != null && !this.usageStatus.isEmpty();
1051    }
1052
1053    /**
1054     * @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.)
1055     */
1056    public DeviceUsage setUsageStatus(CodeableConcept value) { 
1057      this.usageStatus = value;
1058      return this;
1059    }
1060
1061    /**
1062     * @return {@link #usageReason} (The reason for asserting the usage status - for example forgot, lost, stolen, broken.)
1063     */
1064    public List<CodeableConcept> getUsageReason() { 
1065      if (this.usageReason == null)
1066        this.usageReason = new ArrayList<CodeableConcept>();
1067      return this.usageReason;
1068    }
1069
1070    /**
1071     * @return Returns a reference to <code>this</code> for easy method chaining
1072     */
1073    public DeviceUsage setUsageReason(List<CodeableConcept> theUsageReason) { 
1074      this.usageReason = theUsageReason;
1075      return this;
1076    }
1077
1078    public boolean hasUsageReason() { 
1079      if (this.usageReason == null)
1080        return false;
1081      for (CodeableConcept item : this.usageReason)
1082        if (!item.isEmpty())
1083          return true;
1084      return false;
1085    }
1086
1087    public CodeableConcept addUsageReason() { //3
1088      CodeableConcept t = new CodeableConcept();
1089      if (this.usageReason == null)
1090        this.usageReason = new ArrayList<CodeableConcept>();
1091      this.usageReason.add(t);
1092      return t;
1093    }
1094
1095    public DeviceUsage addUsageReason(CodeableConcept t) { //3
1096      if (t == null)
1097        return this;
1098      if (this.usageReason == null)
1099        this.usageReason = new ArrayList<CodeableConcept>();
1100      this.usageReason.add(t);
1101      return this;
1102    }
1103
1104    /**
1105     * @return The first repetition of repeating field {@link #usageReason}, creating it if it does not already exist {3}
1106     */
1107    public CodeableConcept getUsageReasonFirstRep() { 
1108      if (getUsageReason().isEmpty()) {
1109        addUsageReason();
1110      }
1111      return getUsageReason().get(0);
1112    }
1113
1114    /**
1115     * @return {@link #adherence} (This indicates how or if the device is being used.)
1116     */
1117    public DeviceUsageAdherenceComponent getAdherence() { 
1118      if (this.adherence == null)
1119        if (Configuration.errorOnAutoCreate())
1120          throw new Error("Attempt to auto-create DeviceUsage.adherence");
1121        else if (Configuration.doAutoCreate())
1122          this.adherence = new DeviceUsageAdherenceComponent(); // cc
1123      return this.adherence;
1124    }
1125
1126    public boolean hasAdherence() { 
1127      return this.adherence != null && !this.adherence.isEmpty();
1128    }
1129
1130    /**
1131     * @param value {@link #adherence} (This indicates how or if the device is being used.)
1132     */
1133    public DeviceUsage setAdherence(DeviceUsageAdherenceComponent value) { 
1134      this.adherence = value;
1135      return this;
1136    }
1137
1138    /**
1139     * @return {@link #informationSource} (Who reported the device was being used by the patient.)
1140     */
1141    public Reference getInformationSource() { 
1142      if (this.informationSource == null)
1143        if (Configuration.errorOnAutoCreate())
1144          throw new Error("Attempt to auto-create DeviceUsage.informationSource");
1145        else if (Configuration.doAutoCreate())
1146          this.informationSource = new Reference(); // cc
1147      return this.informationSource;
1148    }
1149
1150    public boolean hasInformationSource() { 
1151      return this.informationSource != null && !this.informationSource.isEmpty();
1152    }
1153
1154    /**
1155     * @param value {@link #informationSource} (Who reported the device was being used by the patient.)
1156     */
1157    public DeviceUsage setInformationSource(Reference value) { 
1158      this.informationSource = value;
1159      return this;
1160    }
1161
1162    /**
1163     * @return {@link #device} (Code or Reference to device used.)
1164     */
1165    public CodeableReference getDevice() { 
1166      if (this.device == null)
1167        if (Configuration.errorOnAutoCreate())
1168          throw new Error("Attempt to auto-create DeviceUsage.device");
1169        else if (Configuration.doAutoCreate())
1170          this.device = new CodeableReference(); // cc
1171      return this.device;
1172    }
1173
1174    public boolean hasDevice() { 
1175      return this.device != null && !this.device.isEmpty();
1176    }
1177
1178    /**
1179     * @param value {@link #device} (Code or Reference to device used.)
1180     */
1181    public DeviceUsage setDevice(CodeableReference value) { 
1182      this.device = value;
1183      return this;
1184    }
1185
1186    /**
1187     * @return {@link #reason} (Reason or justification for the use of the device. A coded concept, or another resource whose existence justifies this DeviceUsage.)
1188     */
1189    public List<CodeableReference> getReason() { 
1190      if (this.reason == null)
1191        this.reason = new ArrayList<CodeableReference>();
1192      return this.reason;
1193    }
1194
1195    /**
1196     * @return Returns a reference to <code>this</code> for easy method chaining
1197     */
1198    public DeviceUsage setReason(List<CodeableReference> theReason) { 
1199      this.reason = theReason;
1200      return this;
1201    }
1202
1203    public boolean hasReason() { 
1204      if (this.reason == null)
1205        return false;
1206      for (CodeableReference item : this.reason)
1207        if (!item.isEmpty())
1208          return true;
1209      return false;
1210    }
1211
1212    public CodeableReference addReason() { //3
1213      CodeableReference t = new CodeableReference();
1214      if (this.reason == null)
1215        this.reason = new ArrayList<CodeableReference>();
1216      this.reason.add(t);
1217      return t;
1218    }
1219
1220    public DeviceUsage addReason(CodeableReference t) { //3
1221      if (t == null)
1222        return this;
1223      if (this.reason == null)
1224        this.reason = new ArrayList<CodeableReference>();
1225      this.reason.add(t);
1226      return this;
1227    }
1228
1229    /**
1230     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
1231     */
1232    public CodeableReference getReasonFirstRep() { 
1233      if (getReason().isEmpty()) {
1234        addReason();
1235      }
1236      return getReason().get(0);
1237    }
1238
1239    /**
1240     * @return {@link #bodySite} (Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).)
1241     */
1242    public CodeableReference getBodySite() { 
1243      if (this.bodySite == null)
1244        if (Configuration.errorOnAutoCreate())
1245          throw new Error("Attempt to auto-create DeviceUsage.bodySite");
1246        else if (Configuration.doAutoCreate())
1247          this.bodySite = new CodeableReference(); // cc
1248      return this.bodySite;
1249    }
1250
1251    public boolean hasBodySite() { 
1252      return this.bodySite != null && !this.bodySite.isEmpty();
1253    }
1254
1255    /**
1256     * @param value {@link #bodySite} (Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).)
1257     */
1258    public DeviceUsage setBodySite(CodeableReference value) { 
1259      this.bodySite = value;
1260      return this;
1261    }
1262
1263    /**
1264     * @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.)
1265     */
1266    public List<Annotation> getNote() { 
1267      if (this.note == null)
1268        this.note = new ArrayList<Annotation>();
1269      return this.note;
1270    }
1271
1272    /**
1273     * @return Returns a reference to <code>this</code> for easy method chaining
1274     */
1275    public DeviceUsage setNote(List<Annotation> theNote) { 
1276      this.note = theNote;
1277      return this;
1278    }
1279
1280    public boolean hasNote() { 
1281      if (this.note == null)
1282        return false;
1283      for (Annotation item : this.note)
1284        if (!item.isEmpty())
1285          return true;
1286      return false;
1287    }
1288
1289    public Annotation addNote() { //3
1290      Annotation t = new Annotation();
1291      if (this.note == null)
1292        this.note = new ArrayList<Annotation>();
1293      this.note.add(t);
1294      return t;
1295    }
1296
1297    public DeviceUsage addNote(Annotation t) { //3
1298      if (t == null)
1299        return this;
1300      if (this.note == null)
1301        this.note = new ArrayList<Annotation>();
1302      this.note.add(t);
1303      return this;
1304    }
1305
1306    /**
1307     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1308     */
1309    public Annotation getNoteFirstRep() { 
1310      if (getNote().isEmpty()) {
1311        addNote();
1312      }
1313      return getNote().get(0);
1314    }
1315
1316      protected void listChildren(List<Property> children) {
1317        super.listChildren(children);
1318        children.add(new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier));
1319        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));
1320        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));
1321        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));
1322        children.add(new Property("patient", "Reference(Patient)", "The patient who used the device.", 0, 1, patient));
1323        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));
1324        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));
1325        children.add(new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing));
1326        children.add(new Property("dateAsserted", "dateTime", "The time at which the statement was recorded by informationSource.", 0, 1, dateAsserted));
1327        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));
1328        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));
1329        children.add(new Property("adherence", "", "This indicates how or if the device is being used.", 0, 1, adherence));
1330        children.add(new Property("informationSource", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Who reported the device was being used by the patient.", 0, 1, informationSource));
1331        children.add(new Property("device", "CodeableReference(Device|DeviceDefinition)", "Code or Reference to device used.", 0, 1, device));
1332        children.add(new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport|DocumentReference|Procedure)", "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));
1333        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));
1334        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));
1335      }
1336
1337      @Override
1338      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1339        switch (_hash) {
1340        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);
1341        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);
1342        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);
1343        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);
1344        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient who used the device.", 0, 1, patient);
1345        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);
1346        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);
1347        case 164632566: /*timing[x]*/  return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing);
1348        case -873664438: /*timing*/  return new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, 1, timing);
1349        case -497554124: /*timingTiming*/  return new Property("timing[x]", "Timing", "How often the device was used.", 0, 1, timing);
1350        case -615615829: /*timingPeriod*/  return new Property("timing[x]", "Period", "How often the device was used.", 0, 1, timing);
1351        case -1837458939: /*timingDateTime*/  return new Property("timing[x]", "dateTime", "How often the device was used.", 0, 1, timing);
1352        case -1980855245: /*dateAsserted*/  return new Property("dateAsserted", "dateTime", "The time at which the statement was recorded by informationSource.", 0, 1, dateAsserted);
1353        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);
1354        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);
1355        case -231003683: /*adherence*/  return new Property("adherence", "", "This indicates how or if the device is being used.", 0, 1, adherence);
1356        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);
1357        case -1335157162: /*device*/  return new Property("device", "CodeableReference(Device|DeviceDefinition)", "Code or Reference to device used.", 0, 1, device);
1358        case -934964668: /*reason*/  return new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport|DocumentReference|Procedure)", "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);
1359        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);
1360        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);
1361        default: return super.getNamedProperty(_hash, _name, _checkValid);
1362        }
1363
1364      }
1365
1366      @Override
1367      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1368        switch (hash) {
1369        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1370        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
1371        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DeviceUsageStatus>
1372        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1373        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1374        case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // Reference
1375        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
1376        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
1377        case -1980855245: /*dateAsserted*/ return this.dateAsserted == null ? new Base[0] : new Base[] {this.dateAsserted}; // DateTimeType
1378        case 907197683: /*usageStatus*/ return this.usageStatus == null ? new Base[0] : new Base[] {this.usageStatus}; // CodeableConcept
1379        case 864714565: /*usageReason*/ return this.usageReason == null ? new Base[0] : this.usageReason.toArray(new Base[this.usageReason.size()]); // CodeableConcept
1380        case -231003683: /*adherence*/ return this.adherence == null ? new Base[0] : new Base[] {this.adherence}; // DeviceUsageAdherenceComponent
1381        case -2123220889: /*informationSource*/ return this.informationSource == null ? new Base[0] : new Base[] {this.informationSource}; // Reference
1382        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // CodeableReference
1383        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
1384        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableReference
1385        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1386        default: return super.getProperty(hash, name, checkValid);
1387        }
1388
1389      }
1390
1391      @Override
1392      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1393        switch (hash) {
1394        case -1618432855: // identifier
1395          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1396          return value;
1397        case -332612366: // basedOn
1398          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
1399          return value;
1400        case -892481550: // status
1401          value = new DeviceUsageStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1402          this.status = (Enumeration) value; // Enumeration<DeviceUsageStatus>
1403          return value;
1404        case 50511102: // category
1405          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1406          return value;
1407        case -791418107: // patient
1408          this.patient = TypeConvertor.castToReference(value); // Reference
1409          return value;
1410        case 1077922663: // derivedFrom
1411          this.getDerivedFrom().add(TypeConvertor.castToReference(value)); // Reference
1412          return value;
1413        case 951530927: // context
1414          this.context = TypeConvertor.castToReference(value); // Reference
1415          return value;
1416        case -873664438: // timing
1417          this.timing = TypeConvertor.castToType(value); // DataType
1418          return value;
1419        case -1980855245: // dateAsserted
1420          this.dateAsserted = TypeConvertor.castToDateTime(value); // DateTimeType
1421          return value;
1422        case 907197683: // usageStatus
1423          this.usageStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1424          return value;
1425        case 864714565: // usageReason
1426          this.getUsageReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1427          return value;
1428        case -231003683: // adherence
1429          this.adherence = (DeviceUsageAdherenceComponent) value; // DeviceUsageAdherenceComponent
1430          return value;
1431        case -2123220889: // informationSource
1432          this.informationSource = TypeConvertor.castToReference(value); // Reference
1433          return value;
1434        case -1335157162: // device
1435          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
1436          return value;
1437        case -934964668: // reason
1438          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
1439          return value;
1440        case 1702620169: // bodySite
1441          this.bodySite = TypeConvertor.castToCodeableReference(value); // CodeableReference
1442          return value;
1443        case 3387378: // note
1444          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
1445          return value;
1446        default: return super.setProperty(hash, name, value);
1447        }
1448
1449      }
1450
1451      @Override
1452      public Base setProperty(String name, Base value) throws FHIRException {
1453        if (name.equals("identifier")) {
1454          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1455        } else if (name.equals("basedOn")) {
1456          this.getBasedOn().add(TypeConvertor.castToReference(value));
1457        } else if (name.equals("status")) {
1458          value = new DeviceUsageStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1459          this.status = (Enumeration) value; // Enumeration<DeviceUsageStatus>
1460        } else if (name.equals("category")) {
1461          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
1462        } else if (name.equals("patient")) {
1463          this.patient = TypeConvertor.castToReference(value); // Reference
1464        } else if (name.equals("derivedFrom")) {
1465          this.getDerivedFrom().add(TypeConvertor.castToReference(value));
1466        } else if (name.equals("context")) {
1467          this.context = TypeConvertor.castToReference(value); // Reference
1468        } else if (name.equals("timing[x]")) {
1469          this.timing = TypeConvertor.castToType(value); // DataType
1470        } else if (name.equals("dateAsserted")) {
1471          this.dateAsserted = TypeConvertor.castToDateTime(value); // DateTimeType
1472        } else if (name.equals("usageStatus")) {
1473          this.usageStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1474        } else if (name.equals("usageReason")) {
1475          this.getUsageReason().add(TypeConvertor.castToCodeableConcept(value));
1476        } else if (name.equals("adherence")) {
1477          this.adherence = (DeviceUsageAdherenceComponent) value; // DeviceUsageAdherenceComponent
1478        } else if (name.equals("informationSource")) {
1479          this.informationSource = TypeConvertor.castToReference(value); // Reference
1480        } else if (name.equals("device")) {
1481          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
1482        } else if (name.equals("reason")) {
1483          this.getReason().add(TypeConvertor.castToCodeableReference(value));
1484        } else if (name.equals("bodySite")) {
1485          this.bodySite = TypeConvertor.castToCodeableReference(value); // CodeableReference
1486        } else if (name.equals("note")) {
1487          this.getNote().add(TypeConvertor.castToAnnotation(value));
1488        } else
1489          return super.setProperty(name, value);
1490        return value;
1491      }
1492
1493      @Override
1494      public Base makeProperty(int hash, String name) throws FHIRException {
1495        switch (hash) {
1496        case -1618432855:  return addIdentifier(); 
1497        case -332612366:  return addBasedOn(); 
1498        case -892481550:  return getStatusElement();
1499        case 50511102:  return addCategory(); 
1500        case -791418107:  return getPatient();
1501        case 1077922663:  return addDerivedFrom(); 
1502        case 951530927:  return getContext();
1503        case 164632566:  return getTiming();
1504        case -873664438:  return getTiming();
1505        case -1980855245:  return getDateAssertedElement();
1506        case 907197683:  return getUsageStatus();
1507        case 864714565:  return addUsageReason(); 
1508        case -231003683:  return getAdherence();
1509        case -2123220889:  return getInformationSource();
1510        case -1335157162:  return getDevice();
1511        case -934964668:  return addReason(); 
1512        case 1702620169:  return getBodySite();
1513        case 3387378:  return addNote(); 
1514        default: return super.makeProperty(hash, name);
1515        }
1516
1517      }
1518
1519      @Override
1520      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1521        switch (hash) {
1522        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1523        case -332612366: /*basedOn*/ return new String[] {"Reference"};
1524        case -892481550: /*status*/ return new String[] {"code"};
1525        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1526        case -791418107: /*patient*/ return new String[] {"Reference"};
1527        case 1077922663: /*derivedFrom*/ return new String[] {"Reference"};
1528        case 951530927: /*context*/ return new String[] {"Reference"};
1529        case -873664438: /*timing*/ return new String[] {"Timing", "Period", "dateTime"};
1530        case -1980855245: /*dateAsserted*/ return new String[] {"dateTime"};
1531        case 907197683: /*usageStatus*/ return new String[] {"CodeableConcept"};
1532        case 864714565: /*usageReason*/ return new String[] {"CodeableConcept"};
1533        case -231003683: /*adherence*/ return new String[] {};
1534        case -2123220889: /*informationSource*/ return new String[] {"Reference"};
1535        case -1335157162: /*device*/ return new String[] {"CodeableReference"};
1536        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
1537        case 1702620169: /*bodySite*/ return new String[] {"CodeableReference"};
1538        case 3387378: /*note*/ return new String[] {"Annotation"};
1539        default: return super.getTypesForProperty(hash, name);
1540        }
1541
1542      }
1543
1544      @Override
1545      public Base addChild(String name) throws FHIRException {
1546        if (name.equals("identifier")) {
1547          return addIdentifier();
1548        }
1549        else if (name.equals("basedOn")) {
1550          return addBasedOn();
1551        }
1552        else if (name.equals("status")) {
1553          throw new FHIRException("Cannot call addChild on a singleton property DeviceUsage.status");
1554        }
1555        else if (name.equals("category")) {
1556          return addCategory();
1557        }
1558        else if (name.equals("patient")) {
1559          this.patient = new Reference();
1560          return this.patient;
1561        }
1562        else if (name.equals("derivedFrom")) {
1563          return addDerivedFrom();
1564        }
1565        else if (name.equals("context")) {
1566          this.context = new Reference();
1567          return this.context;
1568        }
1569        else if (name.equals("timingTiming")) {
1570          this.timing = new Timing();
1571          return this.timing;
1572        }
1573        else if (name.equals("timingPeriod")) {
1574          this.timing = new Period();
1575          return this.timing;
1576        }
1577        else if (name.equals("timingDateTime")) {
1578          this.timing = new DateTimeType();
1579          return this.timing;
1580        }
1581        else if (name.equals("dateAsserted")) {
1582          throw new FHIRException("Cannot call addChild on a singleton property DeviceUsage.dateAsserted");
1583        }
1584        else if (name.equals("usageStatus")) {
1585          this.usageStatus = new CodeableConcept();
1586          return this.usageStatus;
1587        }
1588        else if (name.equals("usageReason")) {
1589          return addUsageReason();
1590        }
1591        else if (name.equals("adherence")) {
1592          this.adherence = new DeviceUsageAdherenceComponent();
1593          return this.adherence;
1594        }
1595        else if (name.equals("informationSource")) {
1596          this.informationSource = new Reference();
1597          return this.informationSource;
1598        }
1599        else if (name.equals("device")) {
1600          this.device = new CodeableReference();
1601          return this.device;
1602        }
1603        else if (name.equals("reason")) {
1604          return addReason();
1605        }
1606        else if (name.equals("bodySite")) {
1607          this.bodySite = new CodeableReference();
1608          return this.bodySite;
1609        }
1610        else if (name.equals("note")) {
1611          return addNote();
1612        }
1613        else
1614          return super.addChild(name);
1615      }
1616
1617  public String fhirType() {
1618    return "DeviceUsage";
1619
1620  }
1621
1622      public DeviceUsage copy() {
1623        DeviceUsage dst = new DeviceUsage();
1624        copyValues(dst);
1625        return dst;
1626      }
1627
1628      public void copyValues(DeviceUsage dst) {
1629        super.copyValues(dst);
1630        if (identifier != null) {
1631          dst.identifier = new ArrayList<Identifier>();
1632          for (Identifier i : identifier)
1633            dst.identifier.add(i.copy());
1634        };
1635        if (basedOn != null) {
1636          dst.basedOn = new ArrayList<Reference>();
1637          for (Reference i : basedOn)
1638            dst.basedOn.add(i.copy());
1639        };
1640        dst.status = status == null ? null : status.copy();
1641        if (category != null) {
1642          dst.category = new ArrayList<CodeableConcept>();
1643          for (CodeableConcept i : category)
1644            dst.category.add(i.copy());
1645        };
1646        dst.patient = patient == null ? null : patient.copy();
1647        if (derivedFrom != null) {
1648          dst.derivedFrom = new ArrayList<Reference>();
1649          for (Reference i : derivedFrom)
1650            dst.derivedFrom.add(i.copy());
1651        };
1652        dst.context = context == null ? null : context.copy();
1653        dst.timing = timing == null ? null : timing.copy();
1654        dst.dateAsserted = dateAsserted == null ? null : dateAsserted.copy();
1655        dst.usageStatus = usageStatus == null ? null : usageStatus.copy();
1656        if (usageReason != null) {
1657          dst.usageReason = new ArrayList<CodeableConcept>();
1658          for (CodeableConcept i : usageReason)
1659            dst.usageReason.add(i.copy());
1660        };
1661        dst.adherence = adherence == null ? null : adherence.copy();
1662        dst.informationSource = informationSource == null ? null : informationSource.copy();
1663        dst.device = device == null ? null : device.copy();
1664        if (reason != null) {
1665          dst.reason = new ArrayList<CodeableReference>();
1666          for (CodeableReference i : reason)
1667            dst.reason.add(i.copy());
1668        };
1669        dst.bodySite = bodySite == null ? null : bodySite.copy();
1670        if (note != null) {
1671          dst.note = new ArrayList<Annotation>();
1672          for (Annotation i : note)
1673            dst.note.add(i.copy());
1674        };
1675      }
1676
1677      protected DeviceUsage typedCopy() {
1678        return copy();
1679      }
1680
1681      @Override
1682      public boolean equalsDeep(Base other_) {
1683        if (!super.equalsDeep(other_))
1684          return false;
1685        if (!(other_ instanceof DeviceUsage))
1686          return false;
1687        DeviceUsage o = (DeviceUsage) other_;
1688        return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(status, o.status, true)
1689           && compareDeep(category, o.category, true) && compareDeep(patient, o.patient, true) && compareDeep(derivedFrom, o.derivedFrom, true)
1690           && compareDeep(context, o.context, true) && compareDeep(timing, o.timing, true) && compareDeep(dateAsserted, o.dateAsserted, true)
1691           && compareDeep(usageStatus, o.usageStatus, true) && compareDeep(usageReason, o.usageReason, true)
1692           && compareDeep(adherence, o.adherence, true) && compareDeep(informationSource, o.informationSource, true)
1693           && compareDeep(device, o.device, true) && compareDeep(reason, o.reason, true) && compareDeep(bodySite, o.bodySite, true)
1694           && compareDeep(note, o.note, true);
1695      }
1696
1697      @Override
1698      public boolean equalsShallow(Base other_) {
1699        if (!super.equalsShallow(other_))
1700          return false;
1701        if (!(other_ instanceof DeviceUsage))
1702          return false;
1703        DeviceUsage o = (DeviceUsage) other_;
1704        return compareValues(status, o.status, true) && compareValues(dateAsserted, o.dateAsserted, true);
1705      }
1706
1707      public boolean isEmpty() {
1708        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, status
1709          , category, patient, derivedFrom, context, timing, dateAsserted, usageStatus, usageReason
1710          , adherence, informationSource, device, reason, bodySite, note);
1711      }
1712
1713  @Override
1714  public ResourceType getResourceType() {
1715    return ResourceType.DeviceUsage;
1716   }
1717
1718 /**
1719   * Search parameter: <b>device</b>
1720   * <p>
1721   * Description: <b>Search by device</b><br>
1722   * Type: <b>token</b><br>
1723   * Path: <b>DeviceUsage.device.concept</b><br>
1724   * </p>
1725   */
1726  @SearchParamDefinition(name="device", path="DeviceUsage.device.concept", description="Search by device", type="token" )
1727  public static final String SP_DEVICE = "device";
1728 /**
1729   * <b>Fluent Client</b> search parameter constant for <b>device</b>
1730   * <p>
1731   * Description: <b>Search by device</b><br>
1732   * Type: <b>token</b><br>
1733   * Path: <b>DeviceUsage.device.concept</b><br>
1734   * </p>
1735   */
1736  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DEVICE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DEVICE);
1737
1738 /**
1739   * Search parameter: <b>status</b>
1740   * <p>
1741   * Description: <b>The status of the device usage</b><br>
1742   * Type: <b>token</b><br>
1743   * Path: <b>DeviceUsage.status</b><br>
1744   * </p>
1745   */
1746  @SearchParamDefinition(name="status", path="DeviceUsage.status", description="The status of the device usage", type="token" )
1747  public static final String SP_STATUS = "status";
1748 /**
1749   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1750   * <p>
1751   * Description: <b>The status of the device usage</b><br>
1752   * Type: <b>token</b><br>
1753   * Path: <b>DeviceUsage.status</b><br>
1754   * </p>
1755   */
1756  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1757
1758 /**
1759   * Search parameter: <b>identifier</b>
1760   * <p>
1761   * Description: <b>Multiple Resources: 
1762
1763* [Account](account.html): Account number
1764* [AdverseEvent](adverseevent.html): Business identifier for the event
1765* [AllergyIntolerance](allergyintolerance.html): External ids for this item
1766* [Appointment](appointment.html): An Identifier of the Appointment
1767* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response
1768* [Basic](basic.html): Business identifier
1769* [BodyStructure](bodystructure.html): Bodystructure identifier
1770* [CarePlan](careplan.html): External Ids for this plan
1771* [CareTeam](careteam.html): External Ids for this team
1772* [ChargeItem](chargeitem.html): Business Identifier for item
1773* [Claim](claim.html): The primary identifier of the financial resource
1774* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse
1775* [ClinicalImpression](clinicalimpression.html): Business identifier
1776* [Communication](communication.html): Unique identifier
1777* [CommunicationRequest](communicationrequest.html): Unique identifier
1778* [Composition](composition.html): Version-independent identifier for the Composition
1779* [Condition](condition.html): A unique identifier of the condition record
1780* [Consent](consent.html): Identifier for this record (external references)
1781* [Contract](contract.html): The identity of the contract
1782* [Coverage](coverage.html): The primary identifier of the insured and the coverage
1783* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility
1784* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier
1785* [DetectedIssue](detectedissue.html): Unique id for the detected issue
1786* [DeviceRequest](devicerequest.html): Business identifier for request/order
1787* [DeviceUsage](deviceusage.html): Search by identifier
1788* [DiagnosticReport](diagnosticreport.html): An identifier for the report
1789* [DocumentReference](documentreference.html): Identifier of the attachment binary
1790* [Encounter](encounter.html): Identifier(s) by which this encounter is known
1791* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment
1792* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
1793* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit
1794* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
1795* [Flag](flag.html): Business identifier
1796* [Goal](goal.html): External Ids for this goal
1797* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response
1798* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection
1799* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
1800* [Immunization](immunization.html): Business identifier
1801* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation
1802* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier
1803* [Invoice](invoice.html): Business Identifier for item
1804* [List](list.html): Business identifier
1805* [MeasureReport](measurereport.html): External identifier of the measure report to be returned
1806* [Medication](medication.html): Returns medications with this external identifier
1807* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
1808* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
1809* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
1810* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
1811* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence
1812* [NutritionIntake](nutritionintake.html): Return statements with this external identifier
1813* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
1814* [Observation](observation.html): The unique id for a particular observation
1815* [Person](person.html): A person Identifier
1816* [Procedure](procedure.html): A unique identifier for a procedure
1817* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response
1818* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson
1819* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration
1820* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study
1821* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
1822* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
1823* [Specimen](specimen.html): The unique identifier associated with the specimen
1824* [SupplyDelivery](supplydelivery.html): External identifier
1825* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
1826* [Task](task.html): Search for a task instance by its business identifier
1827* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
1828</b><br>
1829   * Type: <b>token</b><br>
1830   * Path: <b>Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier</b><br>
1831   * </p>
1832   */
1833  @SearchParamDefinition(name="identifier", path="Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [Account](account.html): Account number\r\n* [AdverseEvent](adverseevent.html): Business identifier for the event\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [Appointment](appointment.html): An Identifier of the Appointment\r\n* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response\r\n* [Basic](basic.html): Business identifier\r\n* [BodyStructure](bodystructure.html): Bodystructure identifier\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [ChargeItem](chargeitem.html): Business Identifier for item\r\n* [Claim](claim.html): The primary identifier of the financial resource\r\n* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse\r\n* [ClinicalImpression](clinicalimpression.html): Business identifier\r\n* [Communication](communication.html): Unique identifier\r\n* [CommunicationRequest](communicationrequest.html): Unique identifier\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* [Contract](contract.html): The identity of the contract\r\n* [Coverage](coverage.html): The primary identifier of the insured and the coverage\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DeviceUsage](deviceusage.html): Search by identifier\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Flag](flag.html): Business identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response\r\n* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier\r\n* [Invoice](invoice.html): Business Identifier for item\r\n* [List](list.html): Business identifier\r\n* [MeasureReport](measurereport.html): External identifier of the measure report to be returned\r\n* [Medication](medication.html): Returns medications with this external 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* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence\r\n* [NutritionIntake](nutritionintake.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* [Person](person.html): A person Identifier\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response\r\n* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson\r\n* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration\r\n* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [Specimen](specimen.html): The unique identifier associated with the specimen\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [Task](task.html): Search for a task instance by its business identifier\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
1834  public static final String SP_IDENTIFIER = "identifier";
1835 /**
1836   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1837   * <p>
1838   * Description: <b>Multiple Resources: 
1839
1840* [Account](account.html): Account number
1841* [AdverseEvent](adverseevent.html): Business identifier for the event
1842* [AllergyIntolerance](allergyintolerance.html): External ids for this item
1843* [Appointment](appointment.html): An Identifier of the Appointment
1844* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response
1845* [Basic](basic.html): Business identifier
1846* [BodyStructure](bodystructure.html): Bodystructure identifier
1847* [CarePlan](careplan.html): External Ids for this plan
1848* [CareTeam](careteam.html): External Ids for this team
1849* [ChargeItem](chargeitem.html): Business Identifier for item
1850* [Claim](claim.html): The primary identifier of the financial resource
1851* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse
1852* [ClinicalImpression](clinicalimpression.html): Business identifier
1853* [Communication](communication.html): Unique identifier
1854* [CommunicationRequest](communicationrequest.html): Unique identifier
1855* [Composition](composition.html): Version-independent identifier for the Composition
1856* [Condition](condition.html): A unique identifier of the condition record
1857* [Consent](consent.html): Identifier for this record (external references)
1858* [Contract](contract.html): The identity of the contract
1859* [Coverage](coverage.html): The primary identifier of the insured and the coverage
1860* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility
1861* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier
1862* [DetectedIssue](detectedissue.html): Unique id for the detected issue
1863* [DeviceRequest](devicerequest.html): Business identifier for request/order
1864* [DeviceUsage](deviceusage.html): Search by identifier
1865* [DiagnosticReport](diagnosticreport.html): An identifier for the report
1866* [DocumentReference](documentreference.html): Identifier of the attachment binary
1867* [Encounter](encounter.html): Identifier(s) by which this encounter is known
1868* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment
1869* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
1870* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit
1871* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
1872* [Flag](flag.html): Business identifier
1873* [Goal](goal.html): External Ids for this goal
1874* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response
1875* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection
1876* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
1877* [Immunization](immunization.html): Business identifier
1878* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation
1879* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier
1880* [Invoice](invoice.html): Business Identifier for item
1881* [List](list.html): Business identifier
1882* [MeasureReport](measurereport.html): External identifier of the measure report to be returned
1883* [Medication](medication.html): Returns medications with this external identifier
1884* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
1885* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
1886* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
1887* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
1888* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence
1889* [NutritionIntake](nutritionintake.html): Return statements with this external identifier
1890* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
1891* [Observation](observation.html): The unique id for a particular observation
1892* [Person](person.html): A person Identifier
1893* [Procedure](procedure.html): A unique identifier for a procedure
1894* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response
1895* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson
1896* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration
1897* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study
1898* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
1899* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
1900* [Specimen](specimen.html): The unique identifier associated with the specimen
1901* [SupplyDelivery](supplydelivery.html): External identifier
1902* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
1903* [Task](task.html): Search for a task instance by its business identifier
1904* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
1905</b><br>
1906   * Type: <b>token</b><br>
1907   * Path: <b>Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier</b><br>
1908   * </p>
1909   */
1910  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1911
1912 /**
1913   * Search parameter: <b>patient</b>
1914   * <p>
1915   * Description: <b>Multiple Resources: 
1916
1917* [Account](account.html): The entity that caused the expenses
1918* [AdverseEvent](adverseevent.html): Subject impacted by event
1919* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
1920* [Appointment](appointment.html): One of the individuals of the appointment is this patient
1921* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
1922* [AuditEvent](auditevent.html): Where the activity involved patient data
1923* [Basic](basic.html): Identifies the focus of this resource
1924* [BodyStructure](bodystructure.html): Who this is about
1925* [CarePlan](careplan.html): Who the care plan is for
1926* [CareTeam](careteam.html): Who care team is for
1927* [ChargeItem](chargeitem.html): Individual service was done for/to
1928* [Claim](claim.html): Patient receiving the products or services
1929* [ClaimResponse](claimresponse.html): The subject of care
1930* [ClinicalImpression](clinicalimpression.html): Patient assessed
1931* [Communication](communication.html): Focus of message
1932* [CommunicationRequest](communicationrequest.html): Focus of message
1933* [Composition](composition.html): Who and/or what the composition is about
1934* [Condition](condition.html): Who has the condition?
1935* [Consent](consent.html): Who the consent applies to
1936* [Contract](contract.html): The identity of the subject of the contract (if a patient)
1937* [Coverage](coverage.html): Retrieve coverages for a patient
1938* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
1939* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
1940* [DetectedIssue](detectedissue.html): Associated patient
1941* [DeviceRequest](devicerequest.html): Individual the service is ordered for
1942* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
1943* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
1944* [DocumentReference](documentreference.html): Who/what is the subject of the document
1945* [Encounter](encounter.html): The patient present at the encounter
1946* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
1947* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
1948* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
1949* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
1950* [Flag](flag.html): The identity of a subject to list flags for
1951* [Goal](goal.html): Who this goal is intended for
1952* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
1953* [ImagingSelection](imagingselection.html): Who the study is about
1954* [ImagingStudy](imagingstudy.html): Who the study is about
1955* [Immunization](immunization.html): The patient for the vaccination record
1956* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
1957* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
1958* [Invoice](invoice.html): Recipient(s) of goods and services
1959* [List](list.html): If all resources have the same subject
1960* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
1961* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
1962* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
1963* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
1964* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
1965* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
1966* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
1967* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
1968* [Observation](observation.html): The subject that the observation is about (if patient)
1969* [Person](person.html): The Person links to this Patient
1970* [Procedure](procedure.html): Search by subject - a patient
1971* [Provenance](provenance.html): Where the activity involved patient data
1972* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
1973* [RelatedPerson](relatedperson.html): The patient this related person is related to
1974* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
1975* [ResearchSubject](researchsubject.html): Who or what is part of study
1976* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
1977* [ServiceRequest](servicerequest.html): Search by subject - a patient
1978* [Specimen](specimen.html): The patient the specimen comes from
1979* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
1980* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
1981* [Task](task.html): Search by patient
1982* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
1983</b><br>
1984   * Type: <b>reference</b><br>
1985   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.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) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
1986   * </p>
1987   */
1988  @SearchParamDefinition(name="patient", path="Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.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) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [Account](account.html): The entity that caused the expenses\r\n* [AdverseEvent](adverseevent.html): Subject impacted by event\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [Appointment](appointment.html): One of the individuals of the appointment is this patient\r\n* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient\r\n* [AuditEvent](auditevent.html): Where the activity involved patient data\r\n* [Basic](basic.html): Identifies the focus of this resource\r\n* [BodyStructure](bodystructure.html): Who this is about\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ChargeItem](chargeitem.html): Individual service was done for/to\r\n* [Claim](claim.html): Patient receiving the products or services\r\n* [ClaimResponse](claimresponse.html): The subject of care\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Communication](communication.html): Focus of message\r\n* [CommunicationRequest](communicationrequest.html): Focus of message\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* [Contract](contract.html): The identity of the subject of the contract (if a patient)\r\n* [Coverage](coverage.html): Retrieve coverages for a patient\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient\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* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient\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* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results\r\n* [ImagingSelection](imagingselection.html): Who the study is about\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for\r\n* [Invoice](invoice.html): Recipient(s) of goods and services\r\n* [List](list.html): If all resources have the same subject\r\n* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for\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* [MolecularSequence](molecularsequence.html): The subject that the sequence is about\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Person](person.html): The Person links to this Patient\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [Provenance](provenance.html): Where the activity involved patient data\r\n* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response\r\n* [RelatedPerson](relatedperson.html): The patient this related person is related to\r\n* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations\r\n* [ResearchSubject](researchsubject.html): Who or what is part of study\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [Specimen](specimen.html): The patient the specimen comes from\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined\r\n* [Task](task.html): Search by patient\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={Patient.class } )
1989  public static final String SP_PATIENT = "patient";
1990 /**
1991   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1992   * <p>
1993   * Description: <b>Multiple Resources: 
1994
1995* [Account](account.html): The entity that caused the expenses
1996* [AdverseEvent](adverseevent.html): Subject impacted by event
1997* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
1998* [Appointment](appointment.html): One of the individuals of the appointment is this patient
1999* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
2000* [AuditEvent](auditevent.html): Where the activity involved patient data
2001* [Basic](basic.html): Identifies the focus of this resource
2002* [BodyStructure](bodystructure.html): Who this is about
2003* [CarePlan](careplan.html): Who the care plan is for
2004* [CareTeam](careteam.html): Who care team is for
2005* [ChargeItem](chargeitem.html): Individual service was done for/to
2006* [Claim](claim.html): Patient receiving the products or services
2007* [ClaimResponse](claimresponse.html): The subject of care
2008* [ClinicalImpression](clinicalimpression.html): Patient assessed
2009* [Communication](communication.html): Focus of message
2010* [CommunicationRequest](communicationrequest.html): Focus of message
2011* [Composition](composition.html): Who and/or what the composition is about
2012* [Condition](condition.html): Who has the condition?
2013* [Consent](consent.html): Who the consent applies to
2014* [Contract](contract.html): The identity of the subject of the contract (if a patient)
2015* [Coverage](coverage.html): Retrieve coverages for a patient
2016* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
2017* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
2018* [DetectedIssue](detectedissue.html): Associated patient
2019* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2020* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
2021* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2022* [DocumentReference](documentreference.html): Who/what is the subject of the document
2023* [Encounter](encounter.html): The patient present at the encounter
2024* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
2025* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2026* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
2027* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2028* [Flag](flag.html): The identity of a subject to list flags for
2029* [Goal](goal.html): Who this goal is intended for
2030* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
2031* [ImagingSelection](imagingselection.html): Who the study is about
2032* [ImagingStudy](imagingstudy.html): Who the study is about
2033* [Immunization](immunization.html): The patient for the vaccination record
2034* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
2035* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
2036* [Invoice](invoice.html): Recipient(s) of goods and services
2037* [List](list.html): If all resources have the same subject
2038* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
2039* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2040* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2041* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2042* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
2043* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
2044* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
2045* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
2046* [Observation](observation.html): The subject that the observation is about (if patient)
2047* [Person](person.html): The Person links to this Patient
2048* [Procedure](procedure.html): Search by subject - a patient
2049* [Provenance](provenance.html): Where the activity involved patient data
2050* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
2051* [RelatedPerson](relatedperson.html): The patient this related person is related to
2052* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
2053* [ResearchSubject](researchsubject.html): Who or what is part of study
2054* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2055* [ServiceRequest](servicerequest.html): Search by subject - a patient
2056* [Specimen](specimen.html): The patient the specimen comes from
2057* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2058* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
2059* [Task](task.html): Search by patient
2060* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2061</b><br>
2062   * Type: <b>reference</b><br>
2063   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.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) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
2064   * </p>
2065   */
2066  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2067
2068/**
2069   * Constant for fluent queries to be used to add include statements. Specifies
2070   * the path value of "<b>DeviceUsage:patient</b>".
2071   */
2072  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceUsage:patient").toLocked();
2073
2074
2075}
2076