001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A record of a medication that is being consumed by a patient.   A MedicationUsage may indicate that the patient may be taking the medication now or has taken the medication in the past or will be taking the medication in the future.  The source of this information can be the patient, significant other (such as a family member or spouse), or a clinician.  A common scenario where this information is captured is during the history taking process during a patient visit or stay.   The medication information may come from sources such as the patient's memory, from a prescription bottle,  or from a list of medications the patient, clinician or other party maintains. 
052
053The primary difference between a medicationusage and a medicationadministration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medicationusage is often, if not always, less specific.  There is no required date/time when the medication was administered, in fact we only know that a source has reported the patient is taking this medication, where details such as time, quantity, or rate or even medication product may be incomplete or missing or less precise.  As stated earlier, the Medication Usage information may come from the patient's memory, from a prescription bottle or from a list of medications the patient, clinician or other party maintains.  Medication administration is more formal and is not missing detailed information.
054 */
055@ResourceDef(name="MedicationUsage", profile="http://hl7.org/fhir/StructureDefinition/MedicationUsage")
056public class MedicationUsage extends DomainResource {
057
058    public enum MedicationUsageStatusCodes {
059        /**
060         * The action of recording the medication statement is finished.
061         */
062        RECORDED, 
063        /**
064         * Some of the actions that are implied by the medication usage may have occurred.  For example, the patient may have taken some of the medication.  Clinical decision support systems should take this status into account.
065         */
066        ENTEREDINERROR, 
067        /**
068         * The medication usage is draft or preliminary.
069         */
070        DRAFT, 
071        /**
072         * added to help the parsers with the generic types
073         */
074        NULL;
075        public static MedicationUsageStatusCodes fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("recorded".equals(codeString))
079          return RECORDED;
080        if ("entered-in-error".equals(codeString))
081          return ENTEREDINERROR;
082        if ("draft".equals(codeString))
083          return DRAFT;
084        if (Configuration.isAcceptInvalidEnums())
085          return null;
086        else
087          throw new FHIRException("Unknown MedicationUsageStatusCodes code '"+codeString+"'");
088        }
089        public String toCode() {
090          switch (this) {
091            case RECORDED: return "recorded";
092            case ENTEREDINERROR: return "entered-in-error";
093            case DRAFT: return "draft";
094            default: return "?";
095          }
096        }
097        public String getSystem() {
098          switch (this) {
099            case RECORDED: return "http://hl7.org/fhir/CodeSystem/medication-usage-status";
100            case ENTEREDINERROR: return "http://hl7.org/fhir/CodeSystem/medication-usage-status";
101            case DRAFT: return "http://hl7.org/fhir/CodeSystem/medication-usage-status";
102            default: return "?";
103          }
104        }
105        public String getDefinition() {
106          switch (this) {
107            case RECORDED: return "The action of recording the medication statement is finished.";
108            case ENTEREDINERROR: return "Some of the actions that are implied by the medication usage may have occurred.  For example, the patient may have taken some of the medication.  Clinical decision support systems should take this status into account.";
109            case DRAFT: return "The medication usage is draft or preliminary.";
110            default: return "?";
111          }
112        }
113        public String getDisplay() {
114          switch (this) {
115            case RECORDED: return "Recorded";
116            case ENTEREDINERROR: return "Entered in Error";
117            case DRAFT: return "Draft";
118            default: return "?";
119          }
120        }
121    }
122
123  public static class MedicationUsageStatusCodesEnumFactory implements EnumFactory<MedicationUsageStatusCodes> {
124    public MedicationUsageStatusCodes fromCode(String codeString) throws IllegalArgumentException {
125      if (codeString == null || "".equals(codeString))
126            if (codeString == null || "".equals(codeString))
127                return null;
128        if ("recorded".equals(codeString))
129          return MedicationUsageStatusCodes.RECORDED;
130        if ("entered-in-error".equals(codeString))
131          return MedicationUsageStatusCodes.ENTEREDINERROR;
132        if ("draft".equals(codeString))
133          return MedicationUsageStatusCodes.DRAFT;
134        throw new IllegalArgumentException("Unknown MedicationUsageStatusCodes code '"+codeString+"'");
135        }
136        public Enumeration<MedicationUsageStatusCodes> fromType(Base code) throws FHIRException {
137          if (code == null)
138            return null;
139          if (code.isEmpty())
140            return new Enumeration<MedicationUsageStatusCodes>(this);
141          String codeString = ((PrimitiveType) code).asStringValue();
142          if (codeString == null || "".equals(codeString))
143            return null;
144        if ("recorded".equals(codeString))
145          return new Enumeration<MedicationUsageStatusCodes>(this, MedicationUsageStatusCodes.RECORDED);
146        if ("entered-in-error".equals(codeString))
147          return new Enumeration<MedicationUsageStatusCodes>(this, MedicationUsageStatusCodes.ENTEREDINERROR);
148        if ("draft".equals(codeString))
149          return new Enumeration<MedicationUsageStatusCodes>(this, MedicationUsageStatusCodes.DRAFT);
150        throw new FHIRException("Unknown MedicationUsageStatusCodes code '"+codeString+"'");
151        }
152    public String toCode(MedicationUsageStatusCodes code) {
153      if (code == MedicationUsageStatusCodes.RECORDED)
154        return "recorded";
155      if (code == MedicationUsageStatusCodes.ENTEREDINERROR)
156        return "entered-in-error";
157      if (code == MedicationUsageStatusCodes.DRAFT)
158        return "draft";
159      return "?";
160      }
161    public String toSystem(MedicationUsageStatusCodes code) {
162      return code.getSystem();
163      }
164    }
165
166    @Block()
167    public static class MedicationUsageAdherenceComponent extends BackboneElement implements IBaseBackboneElement {
168        /**
169         * Type of the adherence for the medication.
170         */
171        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
172        @Description(shortDefinition="Type of adherence", formalDefinition="Type of the adherence for the medication." )
173        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-usage-adherence")
174        protected CodeableConcept code;
175
176        /**
177         * Captures the reason for the current use or adherence of a medication.
178         */
179        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
180        @Description(shortDefinition="Details of the reason for the current use of the medication", formalDefinition="Captures the reason for the current use or adherence of a medication." )
181        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reason-medication-status-codes")
182        protected CodeableConcept reason;
183
184        private static final long serialVersionUID = -1479626679L;
185
186    /**
187     * Constructor
188     */
189      public MedicationUsageAdherenceComponent() {
190        super();
191      }
192
193    /**
194     * Constructor
195     */
196      public MedicationUsageAdherenceComponent(CodeableConcept code) {
197        super();
198        this.setCode(code);
199      }
200
201        /**
202         * @return {@link #code} (Type of the adherence for the medication.)
203         */
204        public CodeableConcept getCode() { 
205          if (this.code == null)
206            if (Configuration.errorOnAutoCreate())
207              throw new Error("Attempt to auto-create MedicationUsageAdherenceComponent.code");
208            else if (Configuration.doAutoCreate())
209              this.code = new CodeableConcept(); // cc
210          return this.code;
211        }
212
213        public boolean hasCode() { 
214          return this.code != null && !this.code.isEmpty();
215        }
216
217        /**
218         * @param value {@link #code} (Type of the adherence for the medication.)
219         */
220        public MedicationUsageAdherenceComponent setCode(CodeableConcept value) { 
221          this.code = value;
222          return this;
223        }
224
225        /**
226         * @return {@link #reason} (Captures the reason for the current use or adherence of a medication.)
227         */
228        public CodeableConcept getReason() { 
229          if (this.reason == null)
230            if (Configuration.errorOnAutoCreate())
231              throw new Error("Attempt to auto-create MedicationUsageAdherenceComponent.reason");
232            else if (Configuration.doAutoCreate())
233              this.reason = new CodeableConcept(); // cc
234          return this.reason;
235        }
236
237        public boolean hasReason() { 
238          return this.reason != null && !this.reason.isEmpty();
239        }
240
241        /**
242         * @param value {@link #reason} (Captures the reason for the current use or adherence of a medication.)
243         */
244        public MedicationUsageAdherenceComponent setReason(CodeableConcept value) { 
245          this.reason = value;
246          return this;
247        }
248
249        protected void listChildren(List<Property> children) {
250          super.listChildren(children);
251          children.add(new Property("code", "CodeableConcept", "Type of the adherence for the medication.", 0, 1, code));
252          children.add(new Property("reason", "CodeableConcept", "Captures the reason for the current use or adherence of a medication.", 0, 1, reason));
253        }
254
255        @Override
256        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
257          switch (_hash) {
258          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Type of the adherence for the medication.", 0, 1, code);
259          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Captures the reason for the current use or adherence of a medication.", 0, 1, reason);
260          default: return super.getNamedProperty(_hash, _name, _checkValid);
261          }
262
263        }
264
265      @Override
266      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
267        switch (hash) {
268        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
269        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
270        default: return super.getProperty(hash, name, checkValid);
271        }
272
273      }
274
275      @Override
276      public Base setProperty(int hash, String name, Base value) throws FHIRException {
277        switch (hash) {
278        case 3059181: // code
279          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
280          return value;
281        case -934964668: // reason
282          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
283          return value;
284        default: return super.setProperty(hash, name, value);
285        }
286
287      }
288
289      @Override
290      public Base setProperty(String name, Base value) throws FHIRException {
291        if (name.equals("code")) {
292          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
293        } else if (name.equals("reason")) {
294          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
295        } else
296          return super.setProperty(name, value);
297        return value;
298      }
299
300      @Override
301      public Base makeProperty(int hash, String name) throws FHIRException {
302        switch (hash) {
303        case 3059181:  return getCode();
304        case -934964668:  return getReason();
305        default: return super.makeProperty(hash, name);
306        }
307
308      }
309
310      @Override
311      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
312        switch (hash) {
313        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
314        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
315        default: return super.getTypesForProperty(hash, name);
316        }
317
318      }
319
320      @Override
321      public Base addChild(String name) throws FHIRException {
322        if (name.equals("code")) {
323          this.code = new CodeableConcept();
324          return this.code;
325        }
326        else if (name.equals("reason")) {
327          this.reason = new CodeableConcept();
328          return this.reason;
329        }
330        else
331          return super.addChild(name);
332      }
333
334      public MedicationUsageAdherenceComponent copy() {
335        MedicationUsageAdherenceComponent dst = new MedicationUsageAdherenceComponent();
336        copyValues(dst);
337        return dst;
338      }
339
340      public void copyValues(MedicationUsageAdherenceComponent dst) {
341        super.copyValues(dst);
342        dst.code = code == null ? null : code.copy();
343        dst.reason = reason == null ? null : reason.copy();
344      }
345
346      @Override
347      public boolean equalsDeep(Base other_) {
348        if (!super.equalsDeep(other_))
349          return false;
350        if (!(other_ instanceof MedicationUsageAdherenceComponent))
351          return false;
352        MedicationUsageAdherenceComponent o = (MedicationUsageAdherenceComponent) other_;
353        return compareDeep(code, o.code, true) && compareDeep(reason, o.reason, true);
354      }
355
356      @Override
357      public boolean equalsShallow(Base other_) {
358        if (!super.equalsShallow(other_))
359          return false;
360        if (!(other_ instanceof MedicationUsageAdherenceComponent))
361          return false;
362        MedicationUsageAdherenceComponent o = (MedicationUsageAdherenceComponent) other_;
363        return true;
364      }
365
366      public boolean isEmpty() {
367        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, reason);
368      }
369
370  public String fhirType() {
371    return "MedicationUsage.adherence";
372
373  }
374
375  }
376
377    /**
378     * Identifiers associated with this Medication Usage that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.
379     */
380    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
381    @Description(shortDefinition="External identifier", formalDefinition="Identifiers associated with this Medication Usage that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server." )
382    protected List<Identifier> identifier;
383
384    /**
385     * A code representing the status of recording the medication usage.
386     */
387    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
388    @Description(shortDefinition="recorded | entered-in-error | draft", formalDefinition="A code representing the status of recording the medication usage." )
389    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-usage-status")
390    protected Enumeration<MedicationUsageStatusCodes> status;
391
392    /**
393     * Type of medication usage (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).
394     */
395    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
396    @Description(shortDefinition="Type of medication usage", formalDefinition="Type of medication usage (for example, drug classification like ATC, where meds would be administered, legal category of the medication.)." )
397    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-admin-location")
398    protected List<CodeableConcept> category;
399
400    /**
401     * Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.
402     */
403    @Child(name = "medication", type = {CodeableReference.class}, order=3, min=1, max=1, modifier=false, summary=true)
404    @Description(shortDefinition="What medication was taken", formalDefinition="Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications." )
405    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes")
406    protected CodeableReference medication;
407
408    /**
409     * The person, animal or group who is/was taking the medication.
410     */
411    @Child(name = "subject", type = {Patient.class, Group.class}, order=4, min=1, max=1, modifier=false, summary=true)
412    @Description(shortDefinition="Who is/was taking  the medication", formalDefinition="The person, animal or group who is/was taking the medication." )
413    protected Reference subject;
414
415    /**
416     * The encounter that establishes the context for this MedicationUsage.
417     */
418    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true)
419    @Description(shortDefinition="Encounter associated with MedicationUsage", formalDefinition="The encounter that establishes the context for this MedicationUsage." )
420    protected Reference encounter;
421
422    /**
423     * The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).
424     */
425    @Child(name = "effective", type = {DateTimeType.class, Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
426    @Description(shortDefinition="The date/time or interval when the medication is/was/will be taken", formalDefinition="The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking)." )
427    protected DataType effective;
428
429    /**
430     * The date when the Medication Usage was asserted by the information source.
431     */
432    @Child(name = "dateAsserted", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
433    @Description(shortDefinition="When the usage was asserted?", formalDefinition="The date when the Medication Usage was asserted by the information source." )
434    protected DateTimeType dateAsserted;
435
436    /**
437     * The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationUsage is derived from other resources, e.g. Claim or MedicationRequest.
438     */
439    @Child(name = "informationSource", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
440    @Description(shortDefinition="Person or organization that provided the information about the taking of this medication", formalDefinition="The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationUsage is derived from other resources, e.g. Claim or MedicationRequest." )
441    protected Reference informationSource;
442
443    /**
444     * Allows linking the MedicationUsage to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationUsage.
445     */
446    @Child(name = "derivedFrom", type = {Reference.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
447    @Description(shortDefinition="Link to information used to derive the MedicationUsage", formalDefinition="Allows linking the MedicationUsage to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationUsage." )
448    protected List<Reference> derivedFrom;
449
450    /**
451     * A concept, Condition or observation that supports why the medication is being/was taken.
452     */
453    @Child(name = "reason", type = {CodeableReference.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
454    @Description(shortDefinition="Reason for why the medication is being/was taken", formalDefinition="A concept, Condition or observation that supports why the medication is being/was taken." )
455    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
456    protected List<CodeableReference> reason;
457
458    /**
459     * Provides extra information about the Medication Usage that is not conveyed by the other attributes.
460     */
461    @Child(name = "note", type = {Annotation.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
462    @Description(shortDefinition="Further information about the usage", formalDefinition="Provides extra information about the Medication Usage that is not conveyed by the other attributes." )
463    protected List<Annotation> note;
464
465    /**
466     * The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.
467     */
468    @Child(name = "renderedDosageInstruction", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
469    @Description(shortDefinition="Full representation of the dosage instructions", formalDefinition="The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses." )
470    protected StringType renderedDosageInstruction;
471
472    /**
473     * Indicates how the medication is/was or should be taken by the patient.
474     */
475    @Child(name = "dosage", type = {Dosage.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
476    @Description(shortDefinition="Details of how medication is/was taken or should be taken", formalDefinition="Indicates how the medication is/was or should be taken by the patient." )
477    protected List<Dosage> dosage;
478
479    /**
480     * Indicates if the medication is being consumed or administered as instructed.
481     */
482    @Child(name = "adherence", type = {}, order=14, min=0, max=1, modifier=false, summary=true)
483    @Description(shortDefinition="Indicates if the medication is being consumed or administered as instructed", formalDefinition="Indicates if the medication is being consumed or administered as instructed." )
484    protected MedicationUsageAdherenceComponent adherence;
485
486    private static final long serialVersionUID = -577376700L;
487
488  /**
489   * Constructor
490   */
491    public MedicationUsage() {
492      super();
493    }
494
495  /**
496   * Constructor
497   */
498    public MedicationUsage(MedicationUsageStatusCodes status, CodeableReference medication, Reference subject) {
499      super();
500      this.setStatus(status);
501      this.setMedication(medication);
502      this.setSubject(subject);
503    }
504
505    /**
506     * @return {@link #identifier} (Identifiers associated with this Medication Usage that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.)
507     */
508    public List<Identifier> getIdentifier() { 
509      if (this.identifier == null)
510        this.identifier = new ArrayList<Identifier>();
511      return this.identifier;
512    }
513
514    /**
515     * @return Returns a reference to <code>this</code> for easy method chaining
516     */
517    public MedicationUsage setIdentifier(List<Identifier> theIdentifier) { 
518      this.identifier = theIdentifier;
519      return this;
520    }
521
522    public boolean hasIdentifier() { 
523      if (this.identifier == null)
524        return false;
525      for (Identifier item : this.identifier)
526        if (!item.isEmpty())
527          return true;
528      return false;
529    }
530
531    public Identifier addIdentifier() { //3
532      Identifier t = new Identifier();
533      if (this.identifier == null)
534        this.identifier = new ArrayList<Identifier>();
535      this.identifier.add(t);
536      return t;
537    }
538
539    public MedicationUsage addIdentifier(Identifier t) { //3
540      if (t == null)
541        return this;
542      if (this.identifier == null)
543        this.identifier = new ArrayList<Identifier>();
544      this.identifier.add(t);
545      return this;
546    }
547
548    /**
549     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
550     */
551    public Identifier getIdentifierFirstRep() { 
552      if (getIdentifier().isEmpty()) {
553        addIdentifier();
554      }
555      return getIdentifier().get(0);
556    }
557
558    /**
559     * @return {@link #status} (A code representing the status of recording the medication usage.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
560     */
561    public Enumeration<MedicationUsageStatusCodes> getStatusElement() { 
562      if (this.status == null)
563        if (Configuration.errorOnAutoCreate())
564          throw new Error("Attempt to auto-create MedicationUsage.status");
565        else if (Configuration.doAutoCreate())
566          this.status = new Enumeration<MedicationUsageStatusCodes>(new MedicationUsageStatusCodesEnumFactory()); // bb
567      return this.status;
568    }
569
570    public boolean hasStatusElement() { 
571      return this.status != null && !this.status.isEmpty();
572    }
573
574    public boolean hasStatus() { 
575      return this.status != null && !this.status.isEmpty();
576    }
577
578    /**
579     * @param value {@link #status} (A code representing the status of recording the medication usage.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
580     */
581    public MedicationUsage setStatusElement(Enumeration<MedicationUsageStatusCodes> value) { 
582      this.status = value;
583      return this;
584    }
585
586    /**
587     * @return A code representing the status of recording the medication usage.
588     */
589    public MedicationUsageStatusCodes getStatus() { 
590      return this.status == null ? null : this.status.getValue();
591    }
592
593    /**
594     * @param value A code representing the status of recording the medication usage.
595     */
596    public MedicationUsage setStatus(MedicationUsageStatusCodes value) { 
597        if (this.status == null)
598          this.status = new Enumeration<MedicationUsageStatusCodes>(new MedicationUsageStatusCodesEnumFactory());
599        this.status.setValue(value);
600      return this;
601    }
602
603    /**
604     * @return {@link #category} (Type of medication usage (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).)
605     */
606    public List<CodeableConcept> getCategory() { 
607      if (this.category == null)
608        this.category = new ArrayList<CodeableConcept>();
609      return this.category;
610    }
611
612    /**
613     * @return Returns a reference to <code>this</code> for easy method chaining
614     */
615    public MedicationUsage setCategory(List<CodeableConcept> theCategory) { 
616      this.category = theCategory;
617      return this;
618    }
619
620    public boolean hasCategory() { 
621      if (this.category == null)
622        return false;
623      for (CodeableConcept item : this.category)
624        if (!item.isEmpty())
625          return true;
626      return false;
627    }
628
629    public CodeableConcept addCategory() { //3
630      CodeableConcept t = new CodeableConcept();
631      if (this.category == null)
632        this.category = new ArrayList<CodeableConcept>();
633      this.category.add(t);
634      return t;
635    }
636
637    public MedicationUsage addCategory(CodeableConcept t) { //3
638      if (t == null)
639        return this;
640      if (this.category == null)
641        this.category = new ArrayList<CodeableConcept>();
642      this.category.add(t);
643      return this;
644    }
645
646    /**
647     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
648     */
649    public CodeableConcept getCategoryFirstRep() { 
650      if (getCategory().isEmpty()) {
651        addCategory();
652      }
653      return getCategory().get(0);
654    }
655
656    /**
657     * @return {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.)
658     */
659    public CodeableReference getMedication() { 
660      if (this.medication == null)
661        if (Configuration.errorOnAutoCreate())
662          throw new Error("Attempt to auto-create MedicationUsage.medication");
663        else if (Configuration.doAutoCreate())
664          this.medication = new CodeableReference(); // cc
665      return this.medication;
666    }
667
668    public boolean hasMedication() { 
669      return this.medication != null && !this.medication.isEmpty();
670    }
671
672    /**
673     * @param value {@link #medication} (Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.)
674     */
675    public MedicationUsage setMedication(CodeableReference value) { 
676      this.medication = value;
677      return this;
678    }
679
680    /**
681     * @return {@link #subject} (The person, animal or group who is/was taking the medication.)
682     */
683    public Reference getSubject() { 
684      if (this.subject == null)
685        if (Configuration.errorOnAutoCreate())
686          throw new Error("Attempt to auto-create MedicationUsage.subject");
687        else if (Configuration.doAutoCreate())
688          this.subject = new Reference(); // cc
689      return this.subject;
690    }
691
692    public boolean hasSubject() { 
693      return this.subject != null && !this.subject.isEmpty();
694    }
695
696    /**
697     * @param value {@link #subject} (The person, animal or group who is/was taking the medication.)
698     */
699    public MedicationUsage setSubject(Reference value) { 
700      this.subject = value;
701      return this;
702    }
703
704    /**
705     * @return {@link #encounter} (The encounter that establishes the context for this MedicationUsage.)
706     */
707    public Reference getEncounter() { 
708      if (this.encounter == null)
709        if (Configuration.errorOnAutoCreate())
710          throw new Error("Attempt to auto-create MedicationUsage.encounter");
711        else if (Configuration.doAutoCreate())
712          this.encounter = new Reference(); // cc
713      return this.encounter;
714    }
715
716    public boolean hasEncounter() { 
717      return this.encounter != null && !this.encounter.isEmpty();
718    }
719
720    /**
721     * @param value {@link #encounter} (The encounter that establishes the context for this MedicationUsage.)
722     */
723    public MedicationUsage setEncounter(Reference value) { 
724      this.encounter = value;
725      return this;
726    }
727
728    /**
729     * @return {@link #effective} (The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).)
730     */
731    public DataType getEffective() { 
732      return this.effective;
733    }
734
735    /**
736     * @return {@link #effective} (The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).)
737     */
738    public DateTimeType getEffectiveDateTimeType() throws FHIRException { 
739      if (this.effective == null)
740        this.effective = new DateTimeType();
741      if (!(this.effective instanceof DateTimeType))
742        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effective.getClass().getName()+" was encountered");
743      return (DateTimeType) this.effective;
744    }
745
746    public boolean hasEffectiveDateTimeType() { 
747      return this != null && this.effective instanceof DateTimeType;
748    }
749
750    /**
751     * @return {@link #effective} (The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).)
752     */
753    public Period getEffectivePeriod() throws FHIRException { 
754      if (this.effective == null)
755        this.effective = new Period();
756      if (!(this.effective instanceof Period))
757        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effective.getClass().getName()+" was encountered");
758      return (Period) this.effective;
759    }
760
761    public boolean hasEffectivePeriod() { 
762      return this != null && this.effective instanceof Period;
763    }
764
765    public boolean hasEffective() { 
766      return this.effective != null && !this.effective.isEmpty();
767    }
768
769    /**
770     * @param value {@link #effective} (The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).)
771     */
772    public MedicationUsage setEffective(DataType value) { 
773      if (value != null && !(value instanceof DateTimeType || value instanceof Period))
774        throw new Error("Not the right type for MedicationUsage.effective[x]: "+value.fhirType());
775      this.effective = value;
776      return this;
777    }
778
779    /**
780     * @return {@link #dateAsserted} (The date when the Medication Usage was asserted by the information source.). This is the underlying object with id, value and extensions. The accessor "getDateAsserted" gives direct access to the value
781     */
782    public DateTimeType getDateAssertedElement() { 
783      if (this.dateAsserted == null)
784        if (Configuration.errorOnAutoCreate())
785          throw new Error("Attempt to auto-create MedicationUsage.dateAsserted");
786        else if (Configuration.doAutoCreate())
787          this.dateAsserted = new DateTimeType(); // bb
788      return this.dateAsserted;
789    }
790
791    public boolean hasDateAssertedElement() { 
792      return this.dateAsserted != null && !this.dateAsserted.isEmpty();
793    }
794
795    public boolean hasDateAsserted() { 
796      return this.dateAsserted != null && !this.dateAsserted.isEmpty();
797    }
798
799    /**
800     * @param value {@link #dateAsserted} (The date when the Medication Usage was asserted by the information source.). This is the underlying object with id, value and extensions. The accessor "getDateAsserted" gives direct access to the value
801     */
802    public MedicationUsage setDateAssertedElement(DateTimeType value) { 
803      this.dateAsserted = value;
804      return this;
805    }
806
807    /**
808     * @return The date when the Medication Usage was asserted by the information source.
809     */
810    public Date getDateAsserted() { 
811      return this.dateAsserted == null ? null : this.dateAsserted.getValue();
812    }
813
814    /**
815     * @param value The date when the Medication Usage was asserted by the information source.
816     */
817    public MedicationUsage setDateAsserted(Date value) { 
818      if (value == null)
819        this.dateAsserted = null;
820      else {
821        if (this.dateAsserted == null)
822          this.dateAsserted = new DateTimeType();
823        this.dateAsserted.setValue(value);
824      }
825      return this;
826    }
827
828    /**
829     * @return {@link #informationSource} (The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationUsage is derived from other resources, e.g. Claim or MedicationRequest.)
830     */
831    public Reference getInformationSource() { 
832      if (this.informationSource == null)
833        if (Configuration.errorOnAutoCreate())
834          throw new Error("Attempt to auto-create MedicationUsage.informationSource");
835        else if (Configuration.doAutoCreate())
836          this.informationSource = new Reference(); // cc
837      return this.informationSource;
838    }
839
840    public boolean hasInformationSource() { 
841      return this.informationSource != null && !this.informationSource.isEmpty();
842    }
843
844    /**
845     * @param value {@link #informationSource} (The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationUsage is derived from other resources, e.g. Claim or MedicationRequest.)
846     */
847    public MedicationUsage setInformationSource(Reference value) { 
848      this.informationSource = value;
849      return this;
850    }
851
852    /**
853     * @return {@link #derivedFrom} (Allows linking the MedicationUsage to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationUsage.)
854     */
855    public List<Reference> getDerivedFrom() { 
856      if (this.derivedFrom == null)
857        this.derivedFrom = new ArrayList<Reference>();
858      return this.derivedFrom;
859    }
860
861    /**
862     * @return Returns a reference to <code>this</code> for easy method chaining
863     */
864    public MedicationUsage setDerivedFrom(List<Reference> theDerivedFrom) { 
865      this.derivedFrom = theDerivedFrom;
866      return this;
867    }
868
869    public boolean hasDerivedFrom() { 
870      if (this.derivedFrom == null)
871        return false;
872      for (Reference item : this.derivedFrom)
873        if (!item.isEmpty())
874          return true;
875      return false;
876    }
877
878    public Reference addDerivedFrom() { //3
879      Reference t = new Reference();
880      if (this.derivedFrom == null)
881        this.derivedFrom = new ArrayList<Reference>();
882      this.derivedFrom.add(t);
883      return t;
884    }
885
886    public MedicationUsage addDerivedFrom(Reference t) { //3
887      if (t == null)
888        return this;
889      if (this.derivedFrom == null)
890        this.derivedFrom = new ArrayList<Reference>();
891      this.derivedFrom.add(t);
892      return this;
893    }
894
895    /**
896     * @return The first repetition of repeating field {@link #derivedFrom}, creating it if it does not already exist {3}
897     */
898    public Reference getDerivedFromFirstRep() { 
899      if (getDerivedFrom().isEmpty()) {
900        addDerivedFrom();
901      }
902      return getDerivedFrom().get(0);
903    }
904
905    /**
906     * @return {@link #reason} (A concept, Condition or observation that supports why the medication is being/was taken.)
907     */
908    public List<CodeableReference> getReason() { 
909      if (this.reason == null)
910        this.reason = new ArrayList<CodeableReference>();
911      return this.reason;
912    }
913
914    /**
915     * @return Returns a reference to <code>this</code> for easy method chaining
916     */
917    public MedicationUsage setReason(List<CodeableReference> theReason) { 
918      this.reason = theReason;
919      return this;
920    }
921
922    public boolean hasReason() { 
923      if (this.reason == null)
924        return false;
925      for (CodeableReference item : this.reason)
926        if (!item.isEmpty())
927          return true;
928      return false;
929    }
930
931    public CodeableReference addReason() { //3
932      CodeableReference t = new CodeableReference();
933      if (this.reason == null)
934        this.reason = new ArrayList<CodeableReference>();
935      this.reason.add(t);
936      return t;
937    }
938
939    public MedicationUsage addReason(CodeableReference t) { //3
940      if (t == null)
941        return this;
942      if (this.reason == null)
943        this.reason = new ArrayList<CodeableReference>();
944      this.reason.add(t);
945      return this;
946    }
947
948    /**
949     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
950     */
951    public CodeableReference getReasonFirstRep() { 
952      if (getReason().isEmpty()) {
953        addReason();
954      }
955      return getReason().get(0);
956    }
957
958    /**
959     * @return {@link #note} (Provides extra information about the Medication Usage that is not conveyed by the other attributes.)
960     */
961    public List<Annotation> getNote() { 
962      if (this.note == null)
963        this.note = new ArrayList<Annotation>();
964      return this.note;
965    }
966
967    /**
968     * @return Returns a reference to <code>this</code> for easy method chaining
969     */
970    public MedicationUsage setNote(List<Annotation> theNote) { 
971      this.note = theNote;
972      return this;
973    }
974
975    public boolean hasNote() { 
976      if (this.note == null)
977        return false;
978      for (Annotation item : this.note)
979        if (!item.isEmpty())
980          return true;
981      return false;
982    }
983
984    public Annotation addNote() { //3
985      Annotation t = new Annotation();
986      if (this.note == null)
987        this.note = new ArrayList<Annotation>();
988      this.note.add(t);
989      return t;
990    }
991
992    public MedicationUsage addNote(Annotation t) { //3
993      if (t == null)
994        return this;
995      if (this.note == null)
996        this.note = new ArrayList<Annotation>();
997      this.note.add(t);
998      return this;
999    }
1000
1001    /**
1002     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
1003     */
1004    public Annotation getNoteFirstRep() { 
1005      if (getNote().isEmpty()) {
1006        addNote();
1007      }
1008      return getNote().get(0);
1009    }
1010
1011    /**
1012     * @return {@link #renderedDosageInstruction} (The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.). This is the underlying object with id, value and extensions. The accessor "getRenderedDosageInstruction" gives direct access to the value
1013     */
1014    public StringType getRenderedDosageInstructionElement() { 
1015      if (this.renderedDosageInstruction == null)
1016        if (Configuration.errorOnAutoCreate())
1017          throw new Error("Attempt to auto-create MedicationUsage.renderedDosageInstruction");
1018        else if (Configuration.doAutoCreate())
1019          this.renderedDosageInstruction = new StringType(); // bb
1020      return this.renderedDosageInstruction;
1021    }
1022
1023    public boolean hasRenderedDosageInstructionElement() { 
1024      return this.renderedDosageInstruction != null && !this.renderedDosageInstruction.isEmpty();
1025    }
1026
1027    public boolean hasRenderedDosageInstruction() { 
1028      return this.renderedDosageInstruction != null && !this.renderedDosageInstruction.isEmpty();
1029    }
1030
1031    /**
1032     * @param value {@link #renderedDosageInstruction} (The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.). This is the underlying object with id, value and extensions. The accessor "getRenderedDosageInstruction" gives direct access to the value
1033     */
1034    public MedicationUsage setRenderedDosageInstructionElement(StringType value) { 
1035      this.renderedDosageInstruction = value;
1036      return this;
1037    }
1038
1039    /**
1040     * @return The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.
1041     */
1042    public String getRenderedDosageInstruction() { 
1043      return this.renderedDosageInstruction == null ? null : this.renderedDosageInstruction.getValue();
1044    }
1045
1046    /**
1047     * @param value The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.
1048     */
1049    public MedicationUsage setRenderedDosageInstruction(String value) { 
1050      if (Utilities.noString(value))
1051        this.renderedDosageInstruction = null;
1052      else {
1053        if (this.renderedDosageInstruction == null)
1054          this.renderedDosageInstruction = new StringType();
1055        this.renderedDosageInstruction.setValue(value);
1056      }
1057      return this;
1058    }
1059
1060    /**
1061     * @return {@link #dosage} (Indicates how the medication is/was or should be taken by the patient.)
1062     */
1063    public List<Dosage> getDosage() { 
1064      if (this.dosage == null)
1065        this.dosage = new ArrayList<Dosage>();
1066      return this.dosage;
1067    }
1068
1069    /**
1070     * @return Returns a reference to <code>this</code> for easy method chaining
1071     */
1072    public MedicationUsage setDosage(List<Dosage> theDosage) { 
1073      this.dosage = theDosage;
1074      return this;
1075    }
1076
1077    public boolean hasDosage() { 
1078      if (this.dosage == null)
1079        return false;
1080      for (Dosage item : this.dosage)
1081        if (!item.isEmpty())
1082          return true;
1083      return false;
1084    }
1085
1086    public Dosage addDosage() { //3
1087      Dosage t = new Dosage();
1088      if (this.dosage == null)
1089        this.dosage = new ArrayList<Dosage>();
1090      this.dosage.add(t);
1091      return t;
1092    }
1093
1094    public MedicationUsage addDosage(Dosage t) { //3
1095      if (t == null)
1096        return this;
1097      if (this.dosage == null)
1098        this.dosage = new ArrayList<Dosage>();
1099      this.dosage.add(t);
1100      return this;
1101    }
1102
1103    /**
1104     * @return The first repetition of repeating field {@link #dosage}, creating it if it does not already exist {3}
1105     */
1106    public Dosage getDosageFirstRep() { 
1107      if (getDosage().isEmpty()) {
1108        addDosage();
1109      }
1110      return getDosage().get(0);
1111    }
1112
1113    /**
1114     * @return {@link #adherence} (Indicates if the medication is being consumed or administered as instructed.)
1115     */
1116    public MedicationUsageAdherenceComponent getAdherence() { 
1117      if (this.adherence == null)
1118        if (Configuration.errorOnAutoCreate())
1119          throw new Error("Attempt to auto-create MedicationUsage.adherence");
1120        else if (Configuration.doAutoCreate())
1121          this.adherence = new MedicationUsageAdherenceComponent(); // cc
1122      return this.adherence;
1123    }
1124
1125    public boolean hasAdherence() { 
1126      return this.adherence != null && !this.adherence.isEmpty();
1127    }
1128
1129    /**
1130     * @param value {@link #adherence} (Indicates if the medication is being consumed or administered as instructed.)
1131     */
1132    public MedicationUsage setAdherence(MedicationUsageAdherenceComponent value) { 
1133      this.adherence = value;
1134      return this;
1135    }
1136
1137      protected void listChildren(List<Property> children) {
1138        super.listChildren(children);
1139        children.add(new Property("identifier", "Identifier", "Identifiers associated with this Medication Usage that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
1140        children.add(new Property("status", "code", "A code representing the status of recording the medication usage.", 0, 1, status));
1141        children.add(new Property("category", "CodeableConcept", "Type of medication usage (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).", 0, java.lang.Integer.MAX_VALUE, category));
1142        children.add(new Property("medication", "CodeableReference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication));
1143        children.add(new Property("subject", "Reference(Patient|Group)", "The person, animal or group who is/was taking the medication.", 0, 1, subject));
1144        children.add(new Property("encounter", "Reference(Encounter)", "The encounter that establishes the context for this MedicationUsage.", 0, 1, encounter));
1145        children.add(new Property("effective[x]", "dateTime|Period", "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).", 0, 1, effective));
1146        children.add(new Property("dateAsserted", "dateTime", "The date when the Medication Usage was asserted by the information source.", 0, 1, dateAsserted));
1147        children.add(new Property("informationSource", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationUsage is derived from other resources, e.g. Claim or MedicationRequest.", 0, 1, informationSource));
1148        children.add(new Property("derivedFrom", "Reference(Any)", "Allows linking the MedicationUsage to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationUsage.", 0, java.lang.Integer.MAX_VALUE, derivedFrom));
1149        children.add(new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport)", "A concept, Condition or observation that supports why the medication is being/was taken.", 0, java.lang.Integer.MAX_VALUE, reason));
1150        children.add(new Property("note", "Annotation", "Provides extra information about the Medication Usage that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note));
1151        children.add(new Property("renderedDosageInstruction", "string", "The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.", 0, 1, renderedDosageInstruction));
1152        children.add(new Property("dosage", "Dosage", "Indicates how the medication is/was or should be taken by the patient.", 0, java.lang.Integer.MAX_VALUE, dosage));
1153        children.add(new Property("adherence", "", "Indicates if the medication is being consumed or administered as instructed.", 0, 1, adherence));
1154      }
1155
1156      @Override
1157      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1158        switch (_hash) {
1159        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers associated with this Medication Usage that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
1160        case -892481550: /*status*/  return new Property("status", "code", "A code representing the status of recording the medication usage.", 0, 1, status);
1161        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Type of medication usage (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).", 0, java.lang.Integer.MAX_VALUE, category);
1162        case 1998965455: /*medication*/  return new Property("medication", "CodeableReference(Medication)", "Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication);
1163        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The person, animal or group who is/was taking the medication.", 0, 1, subject);
1164        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The encounter that establishes the context for this MedicationUsage.", 0, 1, encounter);
1165        case 247104889: /*effective[x]*/  return new Property("effective[x]", "dateTime|Period", "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).", 0, 1, effective);
1166        case -1468651097: /*effective*/  return new Property("effective[x]", "dateTime|Period", "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).", 0, 1, effective);
1167        case -275306910: /*effectiveDateTime*/  return new Property("effective[x]", "dateTime", "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).", 0, 1, effective);
1168        case -403934648: /*effectivePeriod*/  return new Property("effective[x]", "Period", "The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationUsage.adherence element is Not Taking).", 0, 1, effective);
1169        case -1980855245: /*dateAsserted*/  return new Property("dateAsserted", "dateTime", "The date when the Medication Usage was asserted by the information source.", 0, 1, dateAsserted);
1170        case -2123220889: /*informationSource*/  return new Property("informationSource", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationUsage is derived from other resources, e.g. Claim or MedicationRequest.", 0, 1, informationSource);
1171        case 1077922663: /*derivedFrom*/  return new Property("derivedFrom", "Reference(Any)", "Allows linking the MedicationUsage to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationUsage.", 0, java.lang.Integer.MAX_VALUE, derivedFrom);
1172        case -934964668: /*reason*/  return new Property("reason", "CodeableReference(Condition|Observation|DiagnosticReport)", "A concept, Condition or observation that supports why the medication is being/was taken.", 0, java.lang.Integer.MAX_VALUE, reason);
1173        case 3387378: /*note*/  return new Property("note", "Annotation", "Provides extra information about the Medication Usage that is not conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note);
1174        case 1718902050: /*renderedDosageInstruction*/  return new Property("renderedDosageInstruction", "string", "The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.", 0, 1, renderedDosageInstruction);
1175        case -1326018889: /*dosage*/  return new Property("dosage", "Dosage", "Indicates how the medication is/was or should be taken by the patient.", 0, java.lang.Integer.MAX_VALUE, dosage);
1176        case -231003683: /*adherence*/  return new Property("adherence", "", "Indicates if the medication is being consumed or administered as instructed.", 0, 1, adherence);
1177        default: return super.getNamedProperty(_hash, _name, _checkValid);
1178        }
1179
1180      }
1181
1182      @Override
1183      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1184        switch (hash) {
1185        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1186        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationUsageStatusCodes>
1187        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1188        case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // CodeableReference
1189        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1190        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1191        case -1468651097: /*effective*/ return this.effective == null ? new Base[0] : new Base[] {this.effective}; // DataType
1192        case -1980855245: /*dateAsserted*/ return this.dateAsserted == null ? new Base[0] : new Base[] {this.dateAsserted}; // DateTimeType
1193        case -2123220889: /*informationSource*/ return this.informationSource == null ? new Base[0] : new Base[] {this.informationSource}; // Reference
1194        case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // Reference
1195        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableReference
1196        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1197        case 1718902050: /*renderedDosageInstruction*/ return this.renderedDosageInstruction == null ? new Base[0] : new Base[] {this.renderedDosageInstruction}; // StringType
1198        case -1326018889: /*dosage*/ return this.dosage == null ? new Base[0] : this.dosage.toArray(new Base[this.dosage.size()]); // Dosage
1199        case -231003683: /*adherence*/ return this.adherence == null ? new Base[0] : new Base[] {this.adherence}; // MedicationUsageAdherenceComponent
1200        default: return super.getProperty(hash, name, checkValid);
1201        }
1202
1203      }
1204
1205      @Override
1206      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1207        switch (hash) {
1208        case -1618432855: // identifier
1209          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1210          return value;
1211        case -892481550: // status
1212          value = new MedicationUsageStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1213          this.status = (Enumeration) value; // Enumeration<MedicationUsageStatusCodes>
1214          return value;
1215        case 50511102: // category
1216          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1217          return value;
1218        case 1998965455: // medication
1219          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
1220          return value;
1221        case -1867885268: // subject
1222          this.subject = TypeConvertor.castToReference(value); // Reference
1223          return value;
1224        case 1524132147: // encounter
1225          this.encounter = TypeConvertor.castToReference(value); // Reference
1226          return value;
1227        case -1468651097: // effective
1228          this.effective = TypeConvertor.castToType(value); // DataType
1229          return value;
1230        case -1980855245: // dateAsserted
1231          this.dateAsserted = TypeConvertor.castToDateTime(value); // DateTimeType
1232          return value;
1233        case -2123220889: // informationSource
1234          this.informationSource = TypeConvertor.castToReference(value); // Reference
1235          return value;
1236        case 1077922663: // derivedFrom
1237          this.getDerivedFrom().add(TypeConvertor.castToReference(value)); // Reference
1238          return value;
1239        case -934964668: // reason
1240          this.getReason().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
1241          return value;
1242        case 3387378: // note
1243          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
1244          return value;
1245        case 1718902050: // renderedDosageInstruction
1246          this.renderedDosageInstruction = TypeConvertor.castToString(value); // StringType
1247          return value;
1248        case -1326018889: // dosage
1249          this.getDosage().add(TypeConvertor.castToDosage(value)); // Dosage
1250          return value;
1251        case -231003683: // adherence
1252          this.adherence = (MedicationUsageAdherenceComponent) value; // MedicationUsageAdherenceComponent
1253          return value;
1254        default: return super.setProperty(hash, name, value);
1255        }
1256
1257      }
1258
1259      @Override
1260      public Base setProperty(String name, Base value) throws FHIRException {
1261        if (name.equals("identifier")) {
1262          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1263        } else if (name.equals("status")) {
1264          value = new MedicationUsageStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1265          this.status = (Enumeration) value; // Enumeration<MedicationUsageStatusCodes>
1266        } else if (name.equals("category")) {
1267          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
1268        } else if (name.equals("medication")) {
1269          this.medication = TypeConvertor.castToCodeableReference(value); // CodeableReference
1270        } else if (name.equals("subject")) {
1271          this.subject = TypeConvertor.castToReference(value); // Reference
1272        } else if (name.equals("encounter")) {
1273          this.encounter = TypeConvertor.castToReference(value); // Reference
1274        } else if (name.equals("effective[x]")) {
1275          this.effective = TypeConvertor.castToType(value); // DataType
1276        } else if (name.equals("dateAsserted")) {
1277          this.dateAsserted = TypeConvertor.castToDateTime(value); // DateTimeType
1278        } else if (name.equals("informationSource")) {
1279          this.informationSource = TypeConvertor.castToReference(value); // Reference
1280        } else if (name.equals("derivedFrom")) {
1281          this.getDerivedFrom().add(TypeConvertor.castToReference(value));
1282        } else if (name.equals("reason")) {
1283          this.getReason().add(TypeConvertor.castToCodeableReference(value));
1284        } else if (name.equals("note")) {
1285          this.getNote().add(TypeConvertor.castToAnnotation(value));
1286        } else if (name.equals("renderedDosageInstruction")) {
1287          this.renderedDosageInstruction = TypeConvertor.castToString(value); // StringType
1288        } else if (name.equals("dosage")) {
1289          this.getDosage().add(TypeConvertor.castToDosage(value));
1290        } else if (name.equals("adherence")) {
1291          this.adherence = (MedicationUsageAdherenceComponent) value; // MedicationUsageAdherenceComponent
1292        } else
1293          return super.setProperty(name, value);
1294        return value;
1295      }
1296
1297      @Override
1298      public Base makeProperty(int hash, String name) throws FHIRException {
1299        switch (hash) {
1300        case -1618432855:  return addIdentifier(); 
1301        case -892481550:  return getStatusElement();
1302        case 50511102:  return addCategory(); 
1303        case 1998965455:  return getMedication();
1304        case -1867885268:  return getSubject();
1305        case 1524132147:  return getEncounter();
1306        case 247104889:  return getEffective();
1307        case -1468651097:  return getEffective();
1308        case -1980855245:  return getDateAssertedElement();
1309        case -2123220889:  return getInformationSource();
1310        case 1077922663:  return addDerivedFrom(); 
1311        case -934964668:  return addReason(); 
1312        case 3387378:  return addNote(); 
1313        case 1718902050:  return getRenderedDosageInstructionElement();
1314        case -1326018889:  return addDosage(); 
1315        case -231003683:  return getAdherence();
1316        default: return super.makeProperty(hash, name);
1317        }
1318
1319      }
1320
1321      @Override
1322      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1323        switch (hash) {
1324        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1325        case -892481550: /*status*/ return new String[] {"code"};
1326        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1327        case 1998965455: /*medication*/ return new String[] {"CodeableReference"};
1328        case -1867885268: /*subject*/ return new String[] {"Reference"};
1329        case 1524132147: /*encounter*/ return new String[] {"Reference"};
1330        case -1468651097: /*effective*/ return new String[] {"dateTime", "Period"};
1331        case -1980855245: /*dateAsserted*/ return new String[] {"dateTime"};
1332        case -2123220889: /*informationSource*/ return new String[] {"Reference"};
1333        case 1077922663: /*derivedFrom*/ return new String[] {"Reference"};
1334        case -934964668: /*reason*/ return new String[] {"CodeableReference"};
1335        case 3387378: /*note*/ return new String[] {"Annotation"};
1336        case 1718902050: /*renderedDosageInstruction*/ return new String[] {"string"};
1337        case -1326018889: /*dosage*/ return new String[] {"Dosage"};
1338        case -231003683: /*adherence*/ return new String[] {};
1339        default: return super.getTypesForProperty(hash, name);
1340        }
1341
1342      }
1343
1344      @Override
1345      public Base addChild(String name) throws FHIRException {
1346        if (name.equals("identifier")) {
1347          return addIdentifier();
1348        }
1349        else if (name.equals("status")) {
1350          throw new FHIRException("Cannot call addChild on a primitive type MedicationUsage.status");
1351        }
1352        else if (name.equals("category")) {
1353          return addCategory();
1354        }
1355        else if (name.equals("medication")) {
1356          this.medication = new CodeableReference();
1357          return this.medication;
1358        }
1359        else if (name.equals("subject")) {
1360          this.subject = new Reference();
1361          return this.subject;
1362        }
1363        else if (name.equals("encounter")) {
1364          this.encounter = new Reference();
1365          return this.encounter;
1366        }
1367        else if (name.equals("effectiveDateTime")) {
1368          this.effective = new DateTimeType();
1369          return this.effective;
1370        }
1371        else if (name.equals("effectivePeriod")) {
1372          this.effective = new Period();
1373          return this.effective;
1374        }
1375        else if (name.equals("dateAsserted")) {
1376          throw new FHIRException("Cannot call addChild on a primitive type MedicationUsage.dateAsserted");
1377        }
1378        else if (name.equals("informationSource")) {
1379          this.informationSource = new Reference();
1380          return this.informationSource;
1381        }
1382        else if (name.equals("derivedFrom")) {
1383          return addDerivedFrom();
1384        }
1385        else if (name.equals("reason")) {
1386          return addReason();
1387        }
1388        else if (name.equals("note")) {
1389          return addNote();
1390        }
1391        else if (name.equals("renderedDosageInstruction")) {
1392          throw new FHIRException("Cannot call addChild on a primitive type MedicationUsage.renderedDosageInstruction");
1393        }
1394        else if (name.equals("dosage")) {
1395          return addDosage();
1396        }
1397        else if (name.equals("adherence")) {
1398          this.adherence = new MedicationUsageAdherenceComponent();
1399          return this.adherence;
1400        }
1401        else
1402          return super.addChild(name);
1403      }
1404
1405  public String fhirType() {
1406    return "MedicationUsage";
1407
1408  }
1409
1410      public MedicationUsage copy() {
1411        MedicationUsage dst = new MedicationUsage();
1412        copyValues(dst);
1413        return dst;
1414      }
1415
1416      public void copyValues(MedicationUsage dst) {
1417        super.copyValues(dst);
1418        if (identifier != null) {
1419          dst.identifier = new ArrayList<Identifier>();
1420          for (Identifier i : identifier)
1421            dst.identifier.add(i.copy());
1422        };
1423        dst.status = status == null ? null : status.copy();
1424        if (category != null) {
1425          dst.category = new ArrayList<CodeableConcept>();
1426          for (CodeableConcept i : category)
1427            dst.category.add(i.copy());
1428        };
1429        dst.medication = medication == null ? null : medication.copy();
1430        dst.subject = subject == null ? null : subject.copy();
1431        dst.encounter = encounter == null ? null : encounter.copy();
1432        dst.effective = effective == null ? null : effective.copy();
1433        dst.dateAsserted = dateAsserted == null ? null : dateAsserted.copy();
1434        dst.informationSource = informationSource == null ? null : informationSource.copy();
1435        if (derivedFrom != null) {
1436          dst.derivedFrom = new ArrayList<Reference>();
1437          for (Reference i : derivedFrom)
1438            dst.derivedFrom.add(i.copy());
1439        };
1440        if (reason != null) {
1441          dst.reason = new ArrayList<CodeableReference>();
1442          for (CodeableReference i : reason)
1443            dst.reason.add(i.copy());
1444        };
1445        if (note != null) {
1446          dst.note = new ArrayList<Annotation>();
1447          for (Annotation i : note)
1448            dst.note.add(i.copy());
1449        };
1450        dst.renderedDosageInstruction = renderedDosageInstruction == null ? null : renderedDosageInstruction.copy();
1451        if (dosage != null) {
1452          dst.dosage = new ArrayList<Dosage>();
1453          for (Dosage i : dosage)
1454            dst.dosage.add(i.copy());
1455        };
1456        dst.adherence = adherence == null ? null : adherence.copy();
1457      }
1458
1459      protected MedicationUsage typedCopy() {
1460        return copy();
1461      }
1462
1463      @Override
1464      public boolean equalsDeep(Base other_) {
1465        if (!super.equalsDeep(other_))
1466          return false;
1467        if (!(other_ instanceof MedicationUsage))
1468          return false;
1469        MedicationUsage o = (MedicationUsage) other_;
1470        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
1471           && compareDeep(medication, o.medication, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
1472           && compareDeep(effective, o.effective, true) && compareDeep(dateAsserted, o.dateAsserted, true)
1473           && compareDeep(informationSource, o.informationSource, true) && compareDeep(derivedFrom, o.derivedFrom, true)
1474           && compareDeep(reason, o.reason, true) && compareDeep(note, o.note, true) && compareDeep(renderedDosageInstruction, o.renderedDosageInstruction, true)
1475           && compareDeep(dosage, o.dosage, true) && compareDeep(adherence, o.adherence, true);
1476      }
1477
1478      @Override
1479      public boolean equalsShallow(Base other_) {
1480        if (!super.equalsShallow(other_))
1481          return false;
1482        if (!(other_ instanceof MedicationUsage))
1483          return false;
1484        MedicationUsage o = (MedicationUsage) other_;
1485        return compareValues(status, o.status, true) && compareValues(dateAsserted, o.dateAsserted, true) && compareValues(renderedDosageInstruction, o.renderedDosageInstruction, true)
1486          ;
1487      }
1488
1489      public boolean isEmpty() {
1490        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
1491          , medication, subject, encounter, effective, dateAsserted, informationSource, derivedFrom
1492          , reason, note, renderedDosageInstruction, dosage, adherence);
1493      }
1494
1495  @Override
1496  public ResourceType getResourceType() {
1497    return ResourceType.MedicationUsage;
1498   }
1499
1500 /**
1501   * Search parameter: <b>adherence</b>
1502   * <p>
1503   * Description: <b>Returns statements based on adherence or compliance</b><br>
1504   * Type: <b>token</b><br>
1505   * Path: <b>MedicationUsage.adherence</b><br>
1506   * </p>
1507   */
1508  @SearchParamDefinition(name="adherence", path="MedicationUsage.adherence", description="Returns statements based on adherence or compliance", type="token" )
1509  public static final String SP_ADHERENCE = "adherence";
1510 /**
1511   * <b>Fluent Client</b> search parameter constant for <b>adherence</b>
1512   * <p>
1513   * Description: <b>Returns statements based on adherence or compliance</b><br>
1514   * Type: <b>token</b><br>
1515   * Path: <b>MedicationUsage.adherence</b><br>
1516   * </p>
1517   */
1518  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADHERENCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADHERENCE);
1519
1520 /**
1521   * Search parameter: <b>category</b>
1522   * <p>
1523   * Description: <b>Returns statements of this category of MedicationUsage</b><br>
1524   * Type: <b>token</b><br>
1525   * Path: <b>MedicationUsage.category</b><br>
1526   * </p>
1527   */
1528  @SearchParamDefinition(name="category", path="MedicationUsage.category", description="Returns statements of this category of MedicationUsage", type="token" )
1529  public static final String SP_CATEGORY = "category";
1530 /**
1531   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1532   * <p>
1533   * Description: <b>Returns statements of this category of MedicationUsage</b><br>
1534   * Type: <b>token</b><br>
1535   * Path: <b>MedicationUsage.category</b><br>
1536   * </p>
1537   */
1538  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1539
1540 /**
1541   * Search parameter: <b>effective</b>
1542   * <p>
1543   * Description: <b>Date when patient was taking (or not taking) the medication</b><br>
1544   * Type: <b>date</b><br>
1545   * Path: <b>MedicationUsage.effective</b><br>
1546   * </p>
1547   */
1548  @SearchParamDefinition(name="effective", path="MedicationUsage.effective", description="Date when patient was taking (or not taking) the medication", type="date" )
1549  public static final String SP_EFFECTIVE = "effective";
1550 /**
1551   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
1552   * <p>
1553   * Description: <b>Date when patient was taking (or not taking) the medication</b><br>
1554   * Type: <b>date</b><br>
1555   * Path: <b>MedicationUsage.effective</b><br>
1556   * </p>
1557   */
1558  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVE);
1559
1560 /**
1561   * Search parameter: <b>encounter</b>
1562   * <p>
1563   * Description: <b>Returns statements for a specific encounter</b><br>
1564   * Type: <b>reference</b><br>
1565   * Path: <b>MedicationUsage.encounter</b><br>
1566   * </p>
1567   */
1568  @SearchParamDefinition(name="encounter", path="MedicationUsage.encounter", description="Returns statements for a specific encounter", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
1569  public static final String SP_ENCOUNTER = "encounter";
1570 /**
1571   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
1572   * <p>
1573   * Description: <b>Returns statements for a specific encounter</b><br>
1574   * Type: <b>reference</b><br>
1575   * Path: <b>MedicationUsage.encounter</b><br>
1576   * </p>
1577   */
1578  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
1579
1580/**
1581   * Constant for fluent queries to be used to add include statements. Specifies
1582   * the path value of "<b>MedicationUsage:encounter</b>".
1583   */
1584  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("MedicationUsage:encounter").toLocked();
1585
1586 /**
1587   * Search parameter: <b>source</b>
1588   * <p>
1589   * Description: <b>Who or where the information in the statement came from</b><br>
1590   * Type: <b>reference</b><br>
1591   * Path: <b>MedicationUsage.informationSource</b><br>
1592   * </p>
1593   */
1594  @SearchParamDefinition(name="source", path="MedicationUsage.informationSource", description="Who or where the information in the statement came from", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
1595  public static final String SP_SOURCE = "source";
1596 /**
1597   * <b>Fluent Client</b> search parameter constant for <b>source</b>
1598   * <p>
1599   * Description: <b>Who or where the information in the statement came from</b><br>
1600   * Type: <b>reference</b><br>
1601   * Path: <b>MedicationUsage.informationSource</b><br>
1602   * </p>
1603   */
1604  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE);
1605
1606/**
1607   * Constant for fluent queries to be used to add include statements. Specifies
1608   * the path value of "<b>MedicationUsage:source</b>".
1609   */
1610  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("MedicationUsage:source").toLocked();
1611
1612 /**
1613   * Search parameter: <b>subject</b>
1614   * <p>
1615   * Description: <b>The identity of a patient, animal or group to list statements for</b><br>
1616   * Type: <b>reference</b><br>
1617   * Path: <b>MedicationUsage.subject</b><br>
1618   * </p>
1619   */
1620  @SearchParamDefinition(name="subject", path="MedicationUsage.subject", description="The identity of a patient, animal or group to list statements for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Group.class, Patient.class } )
1621  public static final String SP_SUBJECT = "subject";
1622 /**
1623   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1624   * <p>
1625   * Description: <b>The identity of a patient, animal or group to list statements for</b><br>
1626   * Type: <b>reference</b><br>
1627   * Path: <b>MedicationUsage.subject</b><br>
1628   * </p>
1629   */
1630  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1631
1632/**
1633   * Constant for fluent queries to be used to add include statements. Specifies
1634   * the path value of "<b>MedicationUsage:subject</b>".
1635   */
1636  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicationUsage:subject").toLocked();
1637
1638 /**
1639   * Search parameter: <b>code</b>
1640   * <p>
1641   * Description: <b>Multiple Resources: 
1642
1643* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
1644* [Condition](condition.html): Code for the condition
1645* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
1646* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
1647* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
1648* [List](list.html): What the purpose of this list is
1649* [Medication](medication.html): Returns medications for a specific code
1650* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
1651* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
1652* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
1653* [MedicationUsage](medicationusage.html): Return statements of this medication code
1654* [Observation](observation.html): The code of the observation type
1655* [Procedure](procedure.html): A code to identify a  procedure
1656* [ServiceRequest](servicerequest.html): What is being requested/ordered
1657</b><br>
1658   * Type: <b>token</b><br>
1659   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code</b><br>
1660   * </p>
1661   */
1662  @SearchParamDefinition(name="code", path="AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [Condition](condition.html): Code for the condition\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationUsage](medicationusage.html): Return statements of this medication code\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [ServiceRequest](servicerequest.html): What is being requested/ordered\r\n", type="token" )
1663  public static final String SP_CODE = "code";
1664 /**
1665   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1666   * <p>
1667   * Description: <b>Multiple Resources: 
1668
1669* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
1670* [Condition](condition.html): Code for the condition
1671* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
1672* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
1673* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
1674* [List](list.html): What the purpose of this list is
1675* [Medication](medication.html): Returns medications for a specific code
1676* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
1677* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
1678* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
1679* [MedicationUsage](medicationusage.html): Return statements of this medication code
1680* [Observation](observation.html): The code of the observation type
1681* [Procedure](procedure.html): A code to identify a  procedure
1682* [ServiceRequest](servicerequest.html): What is being requested/ordered
1683</b><br>
1684   * Type: <b>token</b><br>
1685   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationUsage.medication.concept | Observation.code | Procedure.code | ServiceRequest.code</b><br>
1686   * </p>
1687   */
1688  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1689
1690 /**
1691   * Search parameter: <b>identifier</b>
1692   * <p>
1693   * Description: <b>Multiple Resources: 
1694
1695* [AllergyIntolerance](allergyintolerance.html): External ids for this item
1696* [CarePlan](careplan.html): External Ids for this plan
1697* [CareTeam](careteam.html): External Ids for this team
1698* [Composition](composition.html): Version-independent identifier for the Composition
1699* [Condition](condition.html): A unique identifier of the condition record
1700* [Consent](consent.html): Identifier for this record (external references)
1701* [DetectedIssue](detectedissue.html): Unique id for the detected issue
1702* [DeviceRequest](devicerequest.html): Business identifier for request/order
1703* [DiagnosticReport](diagnosticreport.html): An identifier for the report
1704* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
1705* [DocumentReference](documentreference.html): Identifier of the attachment binary
1706* [Encounter](encounter.html): Identifier(s) by which this encounter is known
1707* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
1708* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
1709* [Goal](goal.html): External Ids for this goal
1710* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
1711* [Immunization](immunization.html): Business identifier
1712* [List](list.html): Business identifier
1713* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
1714* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
1715* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
1716* [MedicationUsage](medicationusage.html): Return statements with this external identifier
1717* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
1718* [Observation](observation.html): The unique id for a particular observation
1719* [Procedure](procedure.html): A unique identifier for a procedure
1720* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
1721* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
1722* [SupplyDelivery](supplydelivery.html): External identifier
1723* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
1724* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
1725</b><br>
1726   * Type: <b>token</b><br>
1727   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.content.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
1728   * </p>
1729   */
1730  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.content.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationUsage](medicationusage.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
1731  public static final String SP_IDENTIFIER = "identifier";
1732 /**
1733   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1734   * <p>
1735   * Description: <b>Multiple Resources: 
1736
1737* [AllergyIntolerance](allergyintolerance.html): External ids for this item
1738* [CarePlan](careplan.html): External Ids for this plan
1739* [CareTeam](careteam.html): External Ids for this team
1740* [Composition](composition.html): Version-independent identifier for the Composition
1741* [Condition](condition.html): A unique identifier of the condition record
1742* [Consent](consent.html): Identifier for this record (external references)
1743* [DetectedIssue](detectedissue.html): Unique id for the detected issue
1744* [DeviceRequest](devicerequest.html): Business identifier for request/order
1745* [DiagnosticReport](diagnosticreport.html): An identifier for the report
1746* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
1747* [DocumentReference](documentreference.html): Identifier of the attachment binary
1748* [Encounter](encounter.html): Identifier(s) by which this encounter is known
1749* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
1750* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
1751* [Goal](goal.html): External Ids for this goal
1752* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
1753* [Immunization](immunization.html): Business identifier
1754* [List](list.html): Business identifier
1755* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
1756* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
1757* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
1758* [MedicationUsage](medicationusage.html): Return statements with this external identifier
1759* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
1760* [Observation](observation.html): The unique id for a particular observation
1761* [Procedure](procedure.html): A unique identifier for a procedure
1762* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
1763* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
1764* [SupplyDelivery](supplydelivery.html): External identifier
1765* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
1766* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
1767</b><br>
1768   * Type: <b>token</b><br>
1769   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.content.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
1770   * </p>
1771   */
1772  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1773
1774 /**
1775   * Search parameter: <b>patient</b>
1776   * <p>
1777   * Description: <b>Multiple Resources: 
1778
1779* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
1780* [CarePlan](careplan.html): Who the care plan is for
1781* [CareTeam](careteam.html): Who care team is for
1782* [ClinicalImpression](clinicalimpression.html): Patient assessed
1783* [Composition](composition.html): Who and/or what the composition is about
1784* [Condition](condition.html): Who has the condition?
1785* [Consent](consent.html): Who the consent applies to
1786* [DetectedIssue](detectedissue.html): Associated patient
1787* [DeviceRequest](devicerequest.html): Individual the service is ordered for
1788* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
1789* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
1790* [DocumentManifest](documentmanifest.html): The subject of the set of documents
1791* [DocumentReference](documentreference.html): Who/what is the subject of the document
1792* [Encounter](encounter.html): The patient present at the encounter
1793* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
1794* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
1795* [Flag](flag.html): The identity of a subject to list flags for
1796* [Goal](goal.html): Who this goal is intended for
1797* [ImagingStudy](imagingstudy.html): Who the study is about
1798* [Immunization](immunization.html): The patient for the vaccination record
1799* [List](list.html): If all resources have the same subject
1800* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
1801* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
1802* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
1803* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
1804* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
1805* [Observation](observation.html): The subject that the observation is about (if patient)
1806* [Procedure](procedure.html): Search by subject - a patient
1807* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
1808* [ServiceRequest](servicerequest.html): Search by subject - a patient
1809* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
1810* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
1811</b><br>
1812   * Type: <b>reference</b><br>
1813   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
1814   * </p>
1815   */
1816  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, ConceptMap2.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
1817  public static final String SP_PATIENT = "patient";
1818 /**
1819   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1820   * <p>
1821   * Description: <b>Multiple Resources: 
1822
1823* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
1824* [CarePlan](careplan.html): Who the care plan is for
1825* [CareTeam](careteam.html): Who care team is for
1826* [ClinicalImpression](clinicalimpression.html): Patient assessed
1827* [Composition](composition.html): Who and/or what the composition is about
1828* [Condition](condition.html): Who has the condition?
1829* [Consent](consent.html): Who the consent applies to
1830* [DetectedIssue](detectedissue.html): Associated patient
1831* [DeviceRequest](devicerequest.html): Individual the service is ordered for
1832* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
1833* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
1834* [DocumentManifest](documentmanifest.html): The subject of the set of documents
1835* [DocumentReference](documentreference.html): Who/what is the subject of the document
1836* [Encounter](encounter.html): The patient present at the encounter
1837* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
1838* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
1839* [Flag](flag.html): The identity of a subject to list flags for
1840* [Goal](goal.html): Who this goal is intended for
1841* [ImagingStudy](imagingstudy.html): Who the study is about
1842* [Immunization](immunization.html): The patient for the vaccination record
1843* [List](list.html): If all resources have the same subject
1844* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
1845* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
1846* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
1847* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
1848* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
1849* [Observation](observation.html): The subject that the observation is about (if patient)
1850* [Procedure](procedure.html): Search by subject - a patient
1851* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
1852* [ServiceRequest](servicerequest.html): Search by subject - a patient
1853* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
1854* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
1855</b><br>
1856   * Type: <b>reference</b><br>
1857   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
1858   * </p>
1859   */
1860  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1861
1862/**
1863   * Constant for fluent queries to be used to add include statements. Specifies
1864   * the path value of "<b>MedicationUsage:patient</b>".
1865   */
1866  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationUsage:patient").toLocked();
1867
1868 /**
1869   * Search parameter: <b>medication</b>
1870   * <p>
1871   * Description: <b>Multiple Resources: 
1872
1873* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
1874* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
1875* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
1876* [MedicationUsage](medicationusage.html): Return statements of this medication reference
1877</b><br>
1878   * Type: <b>reference</b><br>
1879   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference</b><br>
1880   * </p>
1881   */
1882  @SearchParamDefinition(name="medication", path="MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference\r\n* [MedicationUsage](medicationusage.html): Return statements of this medication reference\r\n", type="reference" )
1883  public static final String SP_MEDICATION = "medication";
1884 /**
1885   * <b>Fluent Client</b> search parameter constant for <b>medication</b>
1886   * <p>
1887   * Description: <b>Multiple Resources: 
1888
1889* [MedicationAdministration](medicationadministration.html): Return administrations of this medication reference
1890* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine resource
1891* [MedicationRequest](medicationrequest.html): Return prescriptions for this medication reference
1892* [MedicationUsage](medicationusage.html): Return statements of this medication reference
1893</b><br>
1894   * Type: <b>reference</b><br>
1895   * Path: <b>MedicationAdministration.medication.reference | MedicationDispense.medication.reference | MedicationRequest.medication.reference | MedicationUsage.medication.reference</b><br>
1896   * </p>
1897   */
1898  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION);
1899
1900/**
1901   * Constant for fluent queries to be used to add include statements. Specifies
1902   * the path value of "<b>MedicationUsage:medication</b>".
1903   */
1904  public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationUsage:medication").toLocked();
1905
1906 /**
1907   * Search parameter: <b>status</b>
1908   * <p>
1909   * Description: <b>Multiple Resources: 
1910
1911* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
1912* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
1913* [MedicationRequest](medicationrequest.html): Status of the prescription
1914* [MedicationUsage](medicationusage.html): Return statements that match the given status
1915</b><br>
1916   * Type: <b>token</b><br>
1917   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status</b><br>
1918   * </p>
1919   */
1920  @SearchParamDefinition(name="status", path="MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status", description="Multiple Resources: \r\n\r\n* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status\r\n* [MedicationRequest](medicationrequest.html): Status of the prescription\r\n* [MedicationUsage](medicationusage.html): Return statements that match the given status\r\n", type="token" )
1921  public static final String SP_STATUS = "status";
1922 /**
1923   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1924   * <p>
1925   * Description: <b>Multiple Resources: 
1926
1927* [MedicationAdministration](medicationadministration.html): MedicationAdministration event status (for example one of active/paused/completed/nullified)
1928* [MedicationDispense](medicationdispense.html): Returns dispenses with a specified dispense status
1929* [MedicationRequest](medicationrequest.html): Status of the prescription
1930* [MedicationUsage](medicationusage.html): Return statements that match the given status
1931</b><br>
1932   * Type: <b>token</b><br>
1933   * Path: <b>MedicationAdministration.status | MedicationDispense.status | MedicationRequest.status | MedicationUsage.status</b><br>
1934   * </p>
1935   */
1936  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1937
1938
1939}
1940