001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * This resource is primarily used for the identification and definition of a medication. It covers the ingredients and the packaging for a medication.
047 */
048@ResourceDef(name="Medication", profile="http://hl7.org/fhir/Profile/Medication")
049public class Medication extends DomainResource {
050
051    public enum MedicationStatus {
052        /**
053         * The medication is available for use
054         */
055        ACTIVE, 
056        /**
057         * The medication is not available for use
058         */
059        INACTIVE, 
060        /**
061         * The medication was entered in error
062         */
063        ENTEREDINERROR, 
064        /**
065         * added to help the parsers with the generic types
066         */
067        NULL;
068        public static MedicationStatus fromCode(String codeString) throws FHIRException {
069            if (codeString == null || "".equals(codeString))
070                return null;
071        if ("active".equals(codeString))
072          return ACTIVE;
073        if ("inactive".equals(codeString))
074          return INACTIVE;
075        if ("entered-in-error".equals(codeString))
076          return ENTEREDINERROR;
077        if (Configuration.isAcceptInvalidEnums())
078          return null;
079        else
080          throw new FHIRException("Unknown MedicationStatus code '"+codeString+"'");
081        }
082        public String toCode() {
083          switch (this) {
084            case ACTIVE: return "active";
085            case INACTIVE: return "inactive";
086            case ENTEREDINERROR: return "entered-in-error";
087            default: return "?";
088          }
089        }
090        public String getSystem() {
091          switch (this) {
092            case ACTIVE: return "http://hl7.org/fhir/medication-status";
093            case INACTIVE: return "http://hl7.org/fhir/medication-status";
094            case ENTEREDINERROR: return "http://hl7.org/fhir/medication-status";
095            default: return "?";
096          }
097        }
098        public String getDefinition() {
099          switch (this) {
100            case ACTIVE: return "The medication is available for use";
101            case INACTIVE: return "The medication is not available for use";
102            case ENTEREDINERROR: return "The medication was entered in error";
103            default: return "?";
104          }
105        }
106        public String getDisplay() {
107          switch (this) {
108            case ACTIVE: return "Active";
109            case INACTIVE: return "Inactive";
110            case ENTEREDINERROR: return "Entered in Error";
111            default: return "?";
112          }
113        }
114    }
115
116  public static class MedicationStatusEnumFactory implements EnumFactory<MedicationStatus> {
117    public MedicationStatus fromCode(String codeString) throws IllegalArgumentException {
118      if (codeString == null || "".equals(codeString))
119            if (codeString == null || "".equals(codeString))
120                return null;
121        if ("active".equals(codeString))
122          return MedicationStatus.ACTIVE;
123        if ("inactive".equals(codeString))
124          return MedicationStatus.INACTIVE;
125        if ("entered-in-error".equals(codeString))
126          return MedicationStatus.ENTEREDINERROR;
127        throw new IllegalArgumentException("Unknown MedicationStatus code '"+codeString+"'");
128        }
129        public Enumeration<MedicationStatus> fromType(Base code) throws FHIRException {
130          if (code == null)
131            return null;
132          if (code.isEmpty())
133            return new Enumeration<MedicationStatus>(this);
134          String codeString = ((PrimitiveType) code).asStringValue();
135          if (codeString == null || "".equals(codeString))
136            return null;
137        if ("active".equals(codeString))
138          return new Enumeration<MedicationStatus>(this, MedicationStatus.ACTIVE);
139        if ("inactive".equals(codeString))
140          return new Enumeration<MedicationStatus>(this, MedicationStatus.INACTIVE);
141        if ("entered-in-error".equals(codeString))
142          return new Enumeration<MedicationStatus>(this, MedicationStatus.ENTEREDINERROR);
143        throw new FHIRException("Unknown MedicationStatus code '"+codeString+"'");
144        }
145    public String toCode(MedicationStatus code) {
146      if (code == MedicationStatus.ACTIVE)
147        return "active";
148      if (code == MedicationStatus.INACTIVE)
149        return "inactive";
150      if (code == MedicationStatus.ENTEREDINERROR)
151        return "entered-in-error";
152      return "?";
153      }
154    public String toSystem(MedicationStatus code) {
155      return code.getSystem();
156      }
157    }
158
159    @Block()
160    public static class MedicationIngredientComponent extends BackboneElement implements IBaseBackboneElement {
161        /**
162         * The actual ingredient - either a substance (simple ingredient) or another medication.
163         */
164        @Child(name = "item", type = {CodeableConcept.class, Substance.class, Medication.class}, order=1, min=1, max=1, modifier=false, summary=false)
165        @Description(shortDefinition="The product contained", formalDefinition="The actual ingredient - either a substance (simple ingredient) or another medication." )
166        protected Type item;
167
168        /**
169         * Indication of whether this ingredient affects the therapeutic action of the drug.
170         */
171        @Child(name = "isActive", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
172        @Description(shortDefinition="Active ingredient indicator", formalDefinition="Indication of whether this ingredient affects the therapeutic action of the drug." )
173        protected BooleanType isActive;
174
175        /**
176         * Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.
177         */
178        @Child(name = "amount", type = {Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false)
179        @Description(shortDefinition="Quantity of ingredient present", formalDefinition="Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet." )
180        protected Ratio amount;
181
182        private static final long serialVersionUID = -1796655982L;
183
184    /**
185     * Constructor
186     */
187      public MedicationIngredientComponent() {
188        super();
189      }
190
191    /**
192     * Constructor
193     */
194      public MedicationIngredientComponent(Type item) {
195        super();
196        this.item = item;
197      }
198
199        /**
200         * @return {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication.)
201         */
202        public Type getItem() { 
203          return this.item;
204        }
205
206        /**
207         * @return {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication.)
208         */
209        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
210          if (!(this.item instanceof CodeableConcept))
211            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
212          return (CodeableConcept) this.item;
213        }
214
215        public boolean hasItemCodeableConcept() { 
216          return this.item instanceof CodeableConcept;
217        }
218
219        /**
220         * @return {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication.)
221         */
222        public Reference getItemReference() throws FHIRException { 
223          if (!(this.item instanceof Reference))
224            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
225          return (Reference) this.item;
226        }
227
228        public boolean hasItemReference() { 
229          return this.item instanceof Reference;
230        }
231
232        public boolean hasItem() { 
233          return this.item != null && !this.item.isEmpty();
234        }
235
236        /**
237         * @param value {@link #item} (The actual ingredient - either a substance (simple ingredient) or another medication.)
238         */
239        public MedicationIngredientComponent setItem(Type value) { 
240          this.item = value;
241          return this;
242        }
243
244        /**
245         * @return {@link #isActive} (Indication of whether this ingredient affects the therapeutic action of the drug.). This is the underlying object with id, value and extensions. The accessor "getIsActive" gives direct access to the value
246         */
247        public BooleanType getIsActiveElement() { 
248          if (this.isActive == null)
249            if (Configuration.errorOnAutoCreate())
250              throw new Error("Attempt to auto-create MedicationIngredientComponent.isActive");
251            else if (Configuration.doAutoCreate())
252              this.isActive = new BooleanType(); // bb
253          return this.isActive;
254        }
255
256        public boolean hasIsActiveElement() { 
257          return this.isActive != null && !this.isActive.isEmpty();
258        }
259
260        public boolean hasIsActive() { 
261          return this.isActive != null && !this.isActive.isEmpty();
262        }
263
264        /**
265         * @param value {@link #isActive} (Indication of whether this ingredient affects the therapeutic action of the drug.). This is the underlying object with id, value and extensions. The accessor "getIsActive" gives direct access to the value
266         */
267        public MedicationIngredientComponent setIsActiveElement(BooleanType value) { 
268          this.isActive = value;
269          return this;
270        }
271
272        /**
273         * @return Indication of whether this ingredient affects the therapeutic action of the drug.
274         */
275        public boolean getIsActive() { 
276          return this.isActive == null || this.isActive.isEmpty() ? false : this.isActive.getValue();
277        }
278
279        /**
280         * @param value Indication of whether this ingredient affects the therapeutic action of the drug.
281         */
282        public MedicationIngredientComponent setIsActive(boolean value) { 
283            if (this.isActive == null)
284              this.isActive = new BooleanType();
285            this.isActive.setValue(value);
286          return this;
287        }
288
289        /**
290         * @return {@link #amount} (Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.)
291         */
292        public Ratio getAmount() { 
293          if (this.amount == null)
294            if (Configuration.errorOnAutoCreate())
295              throw new Error("Attempt to auto-create MedicationIngredientComponent.amount");
296            else if (Configuration.doAutoCreate())
297              this.amount = new Ratio(); // cc
298          return this.amount;
299        }
300
301        public boolean hasAmount() { 
302          return this.amount != null && !this.amount.isEmpty();
303        }
304
305        /**
306         * @param value {@link #amount} (Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.)
307         */
308        public MedicationIngredientComponent setAmount(Ratio value) { 
309          this.amount = value;
310          return this;
311        }
312
313        protected void listChildren(List<Property> childrenList) {
314          super.listChildren(childrenList);
315          childrenList.add(new Property("item[x]", "CodeableConcept|Reference(Substance|Medication)", "The actual ingredient - either a substance (simple ingredient) or another medication.", 0, java.lang.Integer.MAX_VALUE, item));
316          childrenList.add(new Property("isActive", "boolean", "Indication of whether this ingredient affects the therapeutic action of the drug.", 0, java.lang.Integer.MAX_VALUE, isActive));
317          childrenList.add(new Property("amount", "Ratio", "Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.", 0, java.lang.Integer.MAX_VALUE, amount));
318        }
319
320      @Override
321      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
322        switch (hash) {
323        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Type
324        case -748916528: /*isActive*/ return this.isActive == null ? new Base[0] : new Base[] {this.isActive}; // BooleanType
325        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Ratio
326        default: return super.getProperty(hash, name, checkValid);
327        }
328
329      }
330
331      @Override
332      public Base setProperty(int hash, String name, Base value) throws FHIRException {
333        switch (hash) {
334        case 3242771: // item
335          this.item = castToType(value); // Type
336          return value;
337        case -748916528: // isActive
338          this.isActive = castToBoolean(value); // BooleanType
339          return value;
340        case -1413853096: // amount
341          this.amount = castToRatio(value); // Ratio
342          return value;
343        default: return super.setProperty(hash, name, value);
344        }
345
346      }
347
348      @Override
349      public Base setProperty(String name, Base value) throws FHIRException {
350        if (name.equals("item[x]")) {
351          this.item = castToType(value); // Type
352        } else if (name.equals("isActive")) {
353          this.isActive = castToBoolean(value); // BooleanType
354        } else if (name.equals("amount")) {
355          this.amount = castToRatio(value); // Ratio
356        } else
357          return super.setProperty(name, value);
358        return value;
359      }
360
361      @Override
362      public Base makeProperty(int hash, String name) throws FHIRException {
363        switch (hash) {
364        case 2116201613:  return getItem(); 
365        case 3242771:  return getItem(); 
366        case -748916528:  return getIsActiveElement();
367        case -1413853096:  return getAmount(); 
368        default: return super.makeProperty(hash, name);
369        }
370
371      }
372
373      @Override
374      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
375        switch (hash) {
376        case 3242771: /*item*/ return new String[] {"CodeableConcept", "Reference"};
377        case -748916528: /*isActive*/ return new String[] {"boolean"};
378        case -1413853096: /*amount*/ return new String[] {"Ratio"};
379        default: return super.getTypesForProperty(hash, name);
380        }
381
382      }
383
384      @Override
385      public Base addChild(String name) throws FHIRException {
386        if (name.equals("itemCodeableConcept")) {
387          this.item = new CodeableConcept();
388          return this.item;
389        }
390        else if (name.equals("itemReference")) {
391          this.item = new Reference();
392          return this.item;
393        }
394        else if (name.equals("isActive")) {
395          throw new FHIRException("Cannot call addChild on a primitive type Medication.isActive");
396        }
397        else if (name.equals("amount")) {
398          this.amount = new Ratio();
399          return this.amount;
400        }
401        else
402          return super.addChild(name);
403      }
404
405      public MedicationIngredientComponent copy() {
406        MedicationIngredientComponent dst = new MedicationIngredientComponent();
407        copyValues(dst);
408        dst.item = item == null ? null : item.copy();
409        dst.isActive = isActive == null ? null : isActive.copy();
410        dst.amount = amount == null ? null : amount.copy();
411        return dst;
412      }
413
414      @Override
415      public boolean equalsDeep(Base other) {
416        if (!super.equalsDeep(other))
417          return false;
418        if (!(other instanceof MedicationIngredientComponent))
419          return false;
420        MedicationIngredientComponent o = (MedicationIngredientComponent) other;
421        return compareDeep(item, o.item, true) && compareDeep(isActive, o.isActive, true) && compareDeep(amount, o.amount, true)
422          ;
423      }
424
425      @Override
426      public boolean equalsShallow(Base other) {
427        if (!super.equalsShallow(other))
428          return false;
429        if (!(other instanceof MedicationIngredientComponent))
430          return false;
431        MedicationIngredientComponent o = (MedicationIngredientComponent) other;
432        return compareValues(isActive, o.isActive, true);
433      }
434
435      public boolean isEmpty() {
436        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, isActive, amount);
437      }
438
439  public String fhirType() {
440    return "Medication.ingredient";
441
442  }
443
444  }
445
446    @Block()
447    public static class MedicationPackageComponent extends BackboneElement implements IBaseBackboneElement {
448        /**
449         * The kind of container that this package comes as.
450         */
451        @Child(name = "container", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
452        @Description(shortDefinition="E.g. box, vial, blister-pack", formalDefinition="The kind of container that this package comes as." )
453        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-package-form")
454        protected CodeableConcept container;
455
456        /**
457         * A set of components that go to make up the described item.
458         */
459        @Child(name = "content", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
460        @Description(shortDefinition="What is  in the package", formalDefinition="A set of components that go to make up the described item." )
461        protected List<MedicationPackageContentComponent> content;
462
463        /**
464         * Information about a group of medication produced or packaged from one production run.
465         */
466        @Child(name = "batch", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
467        @Description(shortDefinition="Identifies a single production run", formalDefinition="Information about a group of medication produced or packaged from one production run." )
468        protected List<MedicationPackageBatchComponent> batch;
469
470        private static final long serialVersionUID = -255992250L;
471
472    /**
473     * Constructor
474     */
475      public MedicationPackageComponent() {
476        super();
477      }
478
479        /**
480         * @return {@link #container} (The kind of container that this package comes as.)
481         */
482        public CodeableConcept getContainer() { 
483          if (this.container == null)
484            if (Configuration.errorOnAutoCreate())
485              throw new Error("Attempt to auto-create MedicationPackageComponent.container");
486            else if (Configuration.doAutoCreate())
487              this.container = new CodeableConcept(); // cc
488          return this.container;
489        }
490
491        public boolean hasContainer() { 
492          return this.container != null && !this.container.isEmpty();
493        }
494
495        /**
496         * @param value {@link #container} (The kind of container that this package comes as.)
497         */
498        public MedicationPackageComponent setContainer(CodeableConcept value) { 
499          this.container = value;
500          return this;
501        }
502
503        /**
504         * @return {@link #content} (A set of components that go to make up the described item.)
505         */
506        public List<MedicationPackageContentComponent> getContent() { 
507          if (this.content == null)
508            this.content = new ArrayList<MedicationPackageContentComponent>();
509          return this.content;
510        }
511
512        /**
513         * @return Returns a reference to <code>this</code> for easy method chaining
514         */
515        public MedicationPackageComponent setContent(List<MedicationPackageContentComponent> theContent) { 
516          this.content = theContent;
517          return this;
518        }
519
520        public boolean hasContent() { 
521          if (this.content == null)
522            return false;
523          for (MedicationPackageContentComponent item : this.content)
524            if (!item.isEmpty())
525              return true;
526          return false;
527        }
528
529        public MedicationPackageContentComponent addContent() { //3
530          MedicationPackageContentComponent t = new MedicationPackageContentComponent();
531          if (this.content == null)
532            this.content = new ArrayList<MedicationPackageContentComponent>();
533          this.content.add(t);
534          return t;
535        }
536
537        public MedicationPackageComponent addContent(MedicationPackageContentComponent t) { //3
538          if (t == null)
539            return this;
540          if (this.content == null)
541            this.content = new ArrayList<MedicationPackageContentComponent>();
542          this.content.add(t);
543          return this;
544        }
545
546        /**
547         * @return The first repetition of repeating field {@link #content}, creating it if it does not already exist
548         */
549        public MedicationPackageContentComponent getContentFirstRep() { 
550          if (getContent().isEmpty()) {
551            addContent();
552          }
553          return getContent().get(0);
554        }
555
556        /**
557         * @return {@link #batch} (Information about a group of medication produced or packaged from one production run.)
558         */
559        public List<MedicationPackageBatchComponent> getBatch() { 
560          if (this.batch == null)
561            this.batch = new ArrayList<MedicationPackageBatchComponent>();
562          return this.batch;
563        }
564
565        /**
566         * @return Returns a reference to <code>this</code> for easy method chaining
567         */
568        public MedicationPackageComponent setBatch(List<MedicationPackageBatchComponent> theBatch) { 
569          this.batch = theBatch;
570          return this;
571        }
572
573        public boolean hasBatch() { 
574          if (this.batch == null)
575            return false;
576          for (MedicationPackageBatchComponent item : this.batch)
577            if (!item.isEmpty())
578              return true;
579          return false;
580        }
581
582        public MedicationPackageBatchComponent addBatch() { //3
583          MedicationPackageBatchComponent t = new MedicationPackageBatchComponent();
584          if (this.batch == null)
585            this.batch = new ArrayList<MedicationPackageBatchComponent>();
586          this.batch.add(t);
587          return t;
588        }
589
590        public MedicationPackageComponent addBatch(MedicationPackageBatchComponent t) { //3
591          if (t == null)
592            return this;
593          if (this.batch == null)
594            this.batch = new ArrayList<MedicationPackageBatchComponent>();
595          this.batch.add(t);
596          return this;
597        }
598
599        /**
600         * @return The first repetition of repeating field {@link #batch}, creating it if it does not already exist
601         */
602        public MedicationPackageBatchComponent getBatchFirstRep() { 
603          if (getBatch().isEmpty()) {
604            addBatch();
605          }
606          return getBatch().get(0);
607        }
608
609        protected void listChildren(List<Property> childrenList) {
610          super.listChildren(childrenList);
611          childrenList.add(new Property("container", "CodeableConcept", "The kind of container that this package comes as.", 0, java.lang.Integer.MAX_VALUE, container));
612          childrenList.add(new Property("content", "", "A set of components that go to make up the described item.", 0, java.lang.Integer.MAX_VALUE, content));
613          childrenList.add(new Property("batch", "", "Information about a group of medication produced or packaged from one production run.", 0, java.lang.Integer.MAX_VALUE, batch));
614        }
615
616      @Override
617      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
618        switch (hash) {
619        case -410956671: /*container*/ return this.container == null ? new Base[0] : new Base[] {this.container}; // CodeableConcept
620        case 951530617: /*content*/ return this.content == null ? new Base[0] : this.content.toArray(new Base[this.content.size()]); // MedicationPackageContentComponent
621        case 93509434: /*batch*/ return this.batch == null ? new Base[0] : this.batch.toArray(new Base[this.batch.size()]); // MedicationPackageBatchComponent
622        default: return super.getProperty(hash, name, checkValid);
623        }
624
625      }
626
627      @Override
628      public Base setProperty(int hash, String name, Base value) throws FHIRException {
629        switch (hash) {
630        case -410956671: // container
631          this.container = castToCodeableConcept(value); // CodeableConcept
632          return value;
633        case 951530617: // content
634          this.getContent().add((MedicationPackageContentComponent) value); // MedicationPackageContentComponent
635          return value;
636        case 93509434: // batch
637          this.getBatch().add((MedicationPackageBatchComponent) value); // MedicationPackageBatchComponent
638          return value;
639        default: return super.setProperty(hash, name, value);
640        }
641
642      }
643
644      @Override
645      public Base setProperty(String name, Base value) throws FHIRException {
646        if (name.equals("container")) {
647          this.container = castToCodeableConcept(value); // CodeableConcept
648        } else if (name.equals("content")) {
649          this.getContent().add((MedicationPackageContentComponent) value);
650        } else if (name.equals("batch")) {
651          this.getBatch().add((MedicationPackageBatchComponent) value);
652        } else
653          return super.setProperty(name, value);
654        return value;
655      }
656
657      @Override
658      public Base makeProperty(int hash, String name) throws FHIRException {
659        switch (hash) {
660        case -410956671:  return getContainer(); 
661        case 951530617:  return addContent(); 
662        case 93509434:  return addBatch(); 
663        default: return super.makeProperty(hash, name);
664        }
665
666      }
667
668      @Override
669      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
670        switch (hash) {
671        case -410956671: /*container*/ return new String[] {"CodeableConcept"};
672        case 951530617: /*content*/ return new String[] {};
673        case 93509434: /*batch*/ return new String[] {};
674        default: return super.getTypesForProperty(hash, name);
675        }
676
677      }
678
679      @Override
680      public Base addChild(String name) throws FHIRException {
681        if (name.equals("container")) {
682          this.container = new CodeableConcept();
683          return this.container;
684        }
685        else if (name.equals("content")) {
686          return addContent();
687        }
688        else if (name.equals("batch")) {
689          return addBatch();
690        }
691        else
692          return super.addChild(name);
693      }
694
695      public MedicationPackageComponent copy() {
696        MedicationPackageComponent dst = new MedicationPackageComponent();
697        copyValues(dst);
698        dst.container = container == null ? null : container.copy();
699        if (content != null) {
700          dst.content = new ArrayList<MedicationPackageContentComponent>();
701          for (MedicationPackageContentComponent i : content)
702            dst.content.add(i.copy());
703        };
704        if (batch != null) {
705          dst.batch = new ArrayList<MedicationPackageBatchComponent>();
706          for (MedicationPackageBatchComponent i : batch)
707            dst.batch.add(i.copy());
708        };
709        return dst;
710      }
711
712      @Override
713      public boolean equalsDeep(Base other) {
714        if (!super.equalsDeep(other))
715          return false;
716        if (!(other instanceof MedicationPackageComponent))
717          return false;
718        MedicationPackageComponent o = (MedicationPackageComponent) other;
719        return compareDeep(container, o.container, true) && compareDeep(content, o.content, true) && compareDeep(batch, o.batch, true)
720          ;
721      }
722
723      @Override
724      public boolean equalsShallow(Base other) {
725        if (!super.equalsShallow(other))
726          return false;
727        if (!(other instanceof MedicationPackageComponent))
728          return false;
729        MedicationPackageComponent o = (MedicationPackageComponent) other;
730        return true;
731      }
732
733      public boolean isEmpty() {
734        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(container, content, batch
735          );
736      }
737
738  public String fhirType() {
739    return "Medication.package";
740
741  }
742
743  }
744
745    @Block()
746    public static class MedicationPackageContentComponent extends BackboneElement implements IBaseBackboneElement {
747        /**
748         * Identifies one of the items in the package.
749         */
750        @Child(name = "item", type = {CodeableConcept.class, Medication.class}, order=1, min=1, max=1, modifier=false, summary=false)
751        @Description(shortDefinition="The item in the package", formalDefinition="Identifies one of the items in the package." )
752        protected Type item;
753
754        /**
755         * The amount of the product that is in the package.
756         */
757        @Child(name = "amount", type = {SimpleQuantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
758        @Description(shortDefinition="Quantity present in the package", formalDefinition="The amount of the product that is in the package." )
759        protected SimpleQuantity amount;
760
761        private static final long serialVersionUID = 1669610080L;
762
763    /**
764     * Constructor
765     */
766      public MedicationPackageContentComponent() {
767        super();
768      }
769
770    /**
771     * Constructor
772     */
773      public MedicationPackageContentComponent(Type item) {
774        super();
775        this.item = item;
776      }
777
778        /**
779         * @return {@link #item} (Identifies one of the items in the package.)
780         */
781        public Type getItem() { 
782          return this.item;
783        }
784
785        /**
786         * @return {@link #item} (Identifies one of the items in the package.)
787         */
788        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
789          if (!(this.item instanceof CodeableConcept))
790            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
791          return (CodeableConcept) this.item;
792        }
793
794        public boolean hasItemCodeableConcept() { 
795          return this.item instanceof CodeableConcept;
796        }
797
798        /**
799         * @return {@link #item} (Identifies one of the items in the package.)
800         */
801        public Reference getItemReference() throws FHIRException { 
802          if (!(this.item instanceof Reference))
803            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
804          return (Reference) this.item;
805        }
806
807        public boolean hasItemReference() { 
808          return this.item instanceof Reference;
809        }
810
811        public boolean hasItem() { 
812          return this.item != null && !this.item.isEmpty();
813        }
814
815        /**
816         * @param value {@link #item} (Identifies one of the items in the package.)
817         */
818        public MedicationPackageContentComponent setItem(Type value) { 
819          this.item = value;
820          return this;
821        }
822
823        /**
824         * @return {@link #amount} (The amount of the product that is in the package.)
825         */
826        public SimpleQuantity getAmount() { 
827          if (this.amount == null)
828            if (Configuration.errorOnAutoCreate())
829              throw new Error("Attempt to auto-create MedicationPackageContentComponent.amount");
830            else if (Configuration.doAutoCreate())
831              this.amount = new SimpleQuantity(); // cc
832          return this.amount;
833        }
834
835        public boolean hasAmount() { 
836          return this.amount != null && !this.amount.isEmpty();
837        }
838
839        /**
840         * @param value {@link #amount} (The amount of the product that is in the package.)
841         */
842        public MedicationPackageContentComponent setAmount(SimpleQuantity value) { 
843          this.amount = value;
844          return this;
845        }
846
847        protected void listChildren(List<Property> childrenList) {
848          super.listChildren(childrenList);
849          childrenList.add(new Property("item[x]", "CodeableConcept|Reference(Medication)", "Identifies one of the items in the package.", 0, java.lang.Integer.MAX_VALUE, item));
850          childrenList.add(new Property("amount", "SimpleQuantity", "The amount of the product that is in the package.", 0, java.lang.Integer.MAX_VALUE, amount));
851        }
852
853      @Override
854      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
855        switch (hash) {
856        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Type
857        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // SimpleQuantity
858        default: return super.getProperty(hash, name, checkValid);
859        }
860
861      }
862
863      @Override
864      public Base setProperty(int hash, String name, Base value) throws FHIRException {
865        switch (hash) {
866        case 3242771: // item
867          this.item = castToType(value); // Type
868          return value;
869        case -1413853096: // amount
870          this.amount = castToSimpleQuantity(value); // SimpleQuantity
871          return value;
872        default: return super.setProperty(hash, name, value);
873        }
874
875      }
876
877      @Override
878      public Base setProperty(String name, Base value) throws FHIRException {
879        if (name.equals("item[x]")) {
880          this.item = castToType(value); // Type
881        } else if (name.equals("amount")) {
882          this.amount = castToSimpleQuantity(value); // SimpleQuantity
883        } else
884          return super.setProperty(name, value);
885        return value;
886      }
887
888      @Override
889      public Base makeProperty(int hash, String name) throws FHIRException {
890        switch (hash) {
891        case 2116201613:  return getItem(); 
892        case 3242771:  return getItem(); 
893        case -1413853096:  return getAmount(); 
894        default: return super.makeProperty(hash, name);
895        }
896
897      }
898
899      @Override
900      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
901        switch (hash) {
902        case 3242771: /*item*/ return new String[] {"CodeableConcept", "Reference"};
903        case -1413853096: /*amount*/ return new String[] {"SimpleQuantity"};
904        default: return super.getTypesForProperty(hash, name);
905        }
906
907      }
908
909      @Override
910      public Base addChild(String name) throws FHIRException {
911        if (name.equals("itemCodeableConcept")) {
912          this.item = new CodeableConcept();
913          return this.item;
914        }
915        else if (name.equals("itemReference")) {
916          this.item = new Reference();
917          return this.item;
918        }
919        else if (name.equals("amount")) {
920          this.amount = new SimpleQuantity();
921          return this.amount;
922        }
923        else
924          return super.addChild(name);
925      }
926
927      public MedicationPackageContentComponent copy() {
928        MedicationPackageContentComponent dst = new MedicationPackageContentComponent();
929        copyValues(dst);
930        dst.item = item == null ? null : item.copy();
931        dst.amount = amount == null ? null : amount.copy();
932        return dst;
933      }
934
935      @Override
936      public boolean equalsDeep(Base other) {
937        if (!super.equalsDeep(other))
938          return false;
939        if (!(other instanceof MedicationPackageContentComponent))
940          return false;
941        MedicationPackageContentComponent o = (MedicationPackageContentComponent) other;
942        return compareDeep(item, o.item, true) && compareDeep(amount, o.amount, true);
943      }
944
945      @Override
946      public boolean equalsShallow(Base other) {
947        if (!super.equalsShallow(other))
948          return false;
949        if (!(other instanceof MedicationPackageContentComponent))
950          return false;
951        MedicationPackageContentComponent o = (MedicationPackageContentComponent) other;
952        return true;
953      }
954
955      public boolean isEmpty() {
956        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, amount);
957      }
958
959  public String fhirType() {
960    return "Medication.package.content";
961
962  }
963
964  }
965
966    @Block()
967    public static class MedicationPackageBatchComponent extends BackboneElement implements IBaseBackboneElement {
968        /**
969         * The assigned lot number of a batch of the specified product.
970         */
971        @Child(name = "lotNumber", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
972        @Description(shortDefinition="Identifier assigned to batch", formalDefinition="The assigned lot number of a batch of the specified product." )
973        protected StringType lotNumber;
974
975        /**
976         * When this specific batch of product will expire.
977         */
978        @Child(name = "expirationDate", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
979        @Description(shortDefinition="When batch will expire", formalDefinition="When this specific batch of product will expire." )
980        protected DateTimeType expirationDate;
981
982        private static final long serialVersionUID = 1982738755L;
983
984    /**
985     * Constructor
986     */
987      public MedicationPackageBatchComponent() {
988        super();
989      }
990
991        /**
992         * @return {@link #lotNumber} (The assigned lot number of a batch of the specified product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
993         */
994        public StringType getLotNumberElement() { 
995          if (this.lotNumber == null)
996            if (Configuration.errorOnAutoCreate())
997              throw new Error("Attempt to auto-create MedicationPackageBatchComponent.lotNumber");
998            else if (Configuration.doAutoCreate())
999              this.lotNumber = new StringType(); // bb
1000          return this.lotNumber;
1001        }
1002
1003        public boolean hasLotNumberElement() { 
1004          return this.lotNumber != null && !this.lotNumber.isEmpty();
1005        }
1006
1007        public boolean hasLotNumber() { 
1008          return this.lotNumber != null && !this.lotNumber.isEmpty();
1009        }
1010
1011        /**
1012         * @param value {@link #lotNumber} (The assigned lot number of a batch of the specified product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
1013         */
1014        public MedicationPackageBatchComponent setLotNumberElement(StringType value) { 
1015          this.lotNumber = value;
1016          return this;
1017        }
1018
1019        /**
1020         * @return The assigned lot number of a batch of the specified product.
1021         */
1022        public String getLotNumber() { 
1023          return this.lotNumber == null ? null : this.lotNumber.getValue();
1024        }
1025
1026        /**
1027         * @param value The assigned lot number of a batch of the specified product.
1028         */
1029        public MedicationPackageBatchComponent setLotNumber(String value) { 
1030          if (Utilities.noString(value))
1031            this.lotNumber = null;
1032          else {
1033            if (this.lotNumber == null)
1034              this.lotNumber = new StringType();
1035            this.lotNumber.setValue(value);
1036          }
1037          return this;
1038        }
1039
1040        /**
1041         * @return {@link #expirationDate} (When this specific batch of product will expire.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
1042         */
1043        public DateTimeType getExpirationDateElement() { 
1044          if (this.expirationDate == null)
1045            if (Configuration.errorOnAutoCreate())
1046              throw new Error("Attempt to auto-create MedicationPackageBatchComponent.expirationDate");
1047            else if (Configuration.doAutoCreate())
1048              this.expirationDate = new DateTimeType(); // bb
1049          return this.expirationDate;
1050        }
1051
1052        public boolean hasExpirationDateElement() { 
1053          return this.expirationDate != null && !this.expirationDate.isEmpty();
1054        }
1055
1056        public boolean hasExpirationDate() { 
1057          return this.expirationDate != null && !this.expirationDate.isEmpty();
1058        }
1059
1060        /**
1061         * @param value {@link #expirationDate} (When this specific batch of product will expire.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
1062         */
1063        public MedicationPackageBatchComponent setExpirationDateElement(DateTimeType value) { 
1064          this.expirationDate = value;
1065          return this;
1066        }
1067
1068        /**
1069         * @return When this specific batch of product will expire.
1070         */
1071        public Date getExpirationDate() { 
1072          return this.expirationDate == null ? null : this.expirationDate.getValue();
1073        }
1074
1075        /**
1076         * @param value When this specific batch of product will expire.
1077         */
1078        public MedicationPackageBatchComponent setExpirationDate(Date value) { 
1079          if (value == null)
1080            this.expirationDate = null;
1081          else {
1082            if (this.expirationDate == null)
1083              this.expirationDate = new DateTimeType();
1084            this.expirationDate.setValue(value);
1085          }
1086          return this;
1087        }
1088
1089        protected void listChildren(List<Property> childrenList) {
1090          super.listChildren(childrenList);
1091          childrenList.add(new Property("lotNumber", "string", "The assigned lot number of a batch of the specified product.", 0, java.lang.Integer.MAX_VALUE, lotNumber));
1092          childrenList.add(new Property("expirationDate", "dateTime", "When this specific batch of product will expire.", 0, java.lang.Integer.MAX_VALUE, expirationDate));
1093        }
1094
1095      @Override
1096      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1097        switch (hash) {
1098        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
1099        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType
1100        default: return super.getProperty(hash, name, checkValid);
1101        }
1102
1103      }
1104
1105      @Override
1106      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1107        switch (hash) {
1108        case 462547450: // lotNumber
1109          this.lotNumber = castToString(value); // StringType
1110          return value;
1111        case -668811523: // expirationDate
1112          this.expirationDate = castToDateTime(value); // DateTimeType
1113          return value;
1114        default: return super.setProperty(hash, name, value);
1115        }
1116
1117      }
1118
1119      @Override
1120      public Base setProperty(String name, Base value) throws FHIRException {
1121        if (name.equals("lotNumber")) {
1122          this.lotNumber = castToString(value); // StringType
1123        } else if (name.equals("expirationDate")) {
1124          this.expirationDate = castToDateTime(value); // DateTimeType
1125        } else
1126          return super.setProperty(name, value);
1127        return value;
1128      }
1129
1130      @Override
1131      public Base makeProperty(int hash, String name) throws FHIRException {
1132        switch (hash) {
1133        case 462547450:  return getLotNumberElement();
1134        case -668811523:  return getExpirationDateElement();
1135        default: return super.makeProperty(hash, name);
1136        }
1137
1138      }
1139
1140      @Override
1141      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1142        switch (hash) {
1143        case 462547450: /*lotNumber*/ return new String[] {"string"};
1144        case -668811523: /*expirationDate*/ return new String[] {"dateTime"};
1145        default: return super.getTypesForProperty(hash, name);
1146        }
1147
1148      }
1149
1150      @Override
1151      public Base addChild(String name) throws FHIRException {
1152        if (name.equals("lotNumber")) {
1153          throw new FHIRException("Cannot call addChild on a primitive type Medication.lotNumber");
1154        }
1155        else if (name.equals("expirationDate")) {
1156          throw new FHIRException("Cannot call addChild on a primitive type Medication.expirationDate");
1157        }
1158        else
1159          return super.addChild(name);
1160      }
1161
1162      public MedicationPackageBatchComponent copy() {
1163        MedicationPackageBatchComponent dst = new MedicationPackageBatchComponent();
1164        copyValues(dst);
1165        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
1166        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
1167        return dst;
1168      }
1169
1170      @Override
1171      public boolean equalsDeep(Base other) {
1172        if (!super.equalsDeep(other))
1173          return false;
1174        if (!(other instanceof MedicationPackageBatchComponent))
1175          return false;
1176        MedicationPackageBatchComponent o = (MedicationPackageBatchComponent) other;
1177        return compareDeep(lotNumber, o.lotNumber, true) && compareDeep(expirationDate, o.expirationDate, true)
1178          ;
1179      }
1180
1181      @Override
1182      public boolean equalsShallow(Base other) {
1183        if (!super.equalsShallow(other))
1184          return false;
1185        if (!(other instanceof MedicationPackageBatchComponent))
1186          return false;
1187        MedicationPackageBatchComponent o = (MedicationPackageBatchComponent) other;
1188        return compareValues(lotNumber, o.lotNumber, true) && compareValues(expirationDate, o.expirationDate, true)
1189          ;
1190      }
1191
1192      public boolean isEmpty() {
1193        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(lotNumber, expirationDate
1194          );
1195      }
1196
1197  public String fhirType() {
1198    return "Medication.package.batch";
1199
1200  }
1201
1202  }
1203
1204    /**
1205     * A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.
1206     */
1207    @Child(name = "code", type = {CodeableConcept.class}, order=0, min=0, max=1, modifier=false, summary=true)
1208    @Description(shortDefinition="Codes that identify this medication", formalDefinition="A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems." )
1209    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes")
1210    protected CodeableConcept code;
1211
1212    /**
1213     * A code to indicate if the medication is in active use.
1214     */
1215    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1216    @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="A code to indicate if the medication is in active use." )
1217    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-status")
1218    protected Enumeration<MedicationStatus> status;
1219
1220    /**
1221     * Set to true if the item is attributable to a specific manufacturer.
1222     */
1223    @Child(name = "isBrand", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1224    @Description(shortDefinition="True if a brand", formalDefinition="Set to true if the item is attributable to a specific manufacturer." )
1225    protected BooleanType isBrand;
1226
1227    /**
1228     * Set to true if the medication can be obtained without an order from a prescriber.
1229     */
1230    @Child(name = "isOverTheCounter", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1231    @Description(shortDefinition="True if medication does not require a prescription", formalDefinition="Set to true if the medication can be obtained without an order from a prescriber." )
1232    protected BooleanType isOverTheCounter;
1233
1234    /**
1235     * Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.
1236     */
1237    @Child(name = "manufacturer", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=true)
1238    @Description(shortDefinition="Manufacturer of the item", formalDefinition="Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product." )
1239    protected Reference manufacturer;
1240
1241    /**
1242     * The actual object that is the target of the reference (Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.)
1243     */
1244    protected Organization manufacturerTarget;
1245
1246    /**
1247     * Describes the form of the item.  Powder; tablets; capsule.
1248     */
1249    @Child(name = "form", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1250    @Description(shortDefinition="powder | tablets | capsule +", formalDefinition="Describes the form of the item.  Powder; tablets; capsule." )
1251    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-form-codes")
1252    protected CodeableConcept form;
1253
1254    /**
1255     * Identifies a particular constituent of interest in the product.
1256     */
1257    @Child(name = "ingredient", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1258    @Description(shortDefinition="Active or inactive ingredient", formalDefinition="Identifies a particular constituent of interest in the product." )
1259    protected List<MedicationIngredientComponent> ingredient;
1260
1261    /**
1262     * Information that only applies to packages (not products).
1263     */
1264    @Child(name = "package", type = {}, order=7, min=0, max=1, modifier=false, summary=false)
1265    @Description(shortDefinition="Details about packaged medications", formalDefinition="Information that only applies to packages (not products)." )
1266    protected MedicationPackageComponent package_;
1267
1268    /**
1269     * Photo(s) or graphic representation(s) of the medication.
1270     */
1271    @Child(name = "image", type = {Attachment.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1272    @Description(shortDefinition="Picture of the medication", formalDefinition="Photo(s) or graphic representation(s) of the medication." )
1273    protected List<Attachment> image;
1274
1275    private static final long serialVersionUID = 860383645L;
1276
1277  /**
1278   * Constructor
1279   */
1280    public Medication() {
1281      super();
1282    }
1283
1284    /**
1285     * @return {@link #code} (A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.)
1286     */
1287    public CodeableConcept getCode() { 
1288      if (this.code == null)
1289        if (Configuration.errorOnAutoCreate())
1290          throw new Error("Attempt to auto-create Medication.code");
1291        else if (Configuration.doAutoCreate())
1292          this.code = new CodeableConcept(); // cc
1293      return this.code;
1294    }
1295
1296    public boolean hasCode() { 
1297      return this.code != null && !this.code.isEmpty();
1298    }
1299
1300    /**
1301     * @param value {@link #code} (A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.)
1302     */
1303    public Medication setCode(CodeableConcept value) { 
1304      this.code = value;
1305      return this;
1306    }
1307
1308    /**
1309     * @return {@link #status} (A code to indicate if the medication is in active use.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1310     */
1311    public Enumeration<MedicationStatus> getStatusElement() { 
1312      if (this.status == null)
1313        if (Configuration.errorOnAutoCreate())
1314          throw new Error("Attempt to auto-create Medication.status");
1315        else if (Configuration.doAutoCreate())
1316          this.status = new Enumeration<MedicationStatus>(new MedicationStatusEnumFactory()); // bb
1317      return this.status;
1318    }
1319
1320    public boolean hasStatusElement() { 
1321      return this.status != null && !this.status.isEmpty();
1322    }
1323
1324    public boolean hasStatus() { 
1325      return this.status != null && !this.status.isEmpty();
1326    }
1327
1328    /**
1329     * @param value {@link #status} (A code to indicate if the medication is in active use.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1330     */
1331    public Medication setStatusElement(Enumeration<MedicationStatus> value) { 
1332      this.status = value;
1333      return this;
1334    }
1335
1336    /**
1337     * @return A code to indicate if the medication is in active use.
1338     */
1339    public MedicationStatus getStatus() { 
1340      return this.status == null ? null : this.status.getValue();
1341    }
1342
1343    /**
1344     * @param value A code to indicate if the medication is in active use.
1345     */
1346    public Medication setStatus(MedicationStatus value) { 
1347      if (value == null)
1348        this.status = null;
1349      else {
1350        if (this.status == null)
1351          this.status = new Enumeration<MedicationStatus>(new MedicationStatusEnumFactory());
1352        this.status.setValue(value);
1353      }
1354      return this;
1355    }
1356
1357    /**
1358     * @return {@link #isBrand} (Set to true if the item is attributable to a specific manufacturer.). This is the underlying object with id, value and extensions. The accessor "getIsBrand" gives direct access to the value
1359     */
1360    public BooleanType getIsBrandElement() { 
1361      if (this.isBrand == null)
1362        if (Configuration.errorOnAutoCreate())
1363          throw new Error("Attempt to auto-create Medication.isBrand");
1364        else if (Configuration.doAutoCreate())
1365          this.isBrand = new BooleanType(); // bb
1366      return this.isBrand;
1367    }
1368
1369    public boolean hasIsBrandElement() { 
1370      return this.isBrand != null && !this.isBrand.isEmpty();
1371    }
1372
1373    public boolean hasIsBrand() { 
1374      return this.isBrand != null && !this.isBrand.isEmpty();
1375    }
1376
1377    /**
1378     * @param value {@link #isBrand} (Set to true if the item is attributable to a specific manufacturer.). This is the underlying object with id, value and extensions. The accessor "getIsBrand" gives direct access to the value
1379     */
1380    public Medication setIsBrandElement(BooleanType value) { 
1381      this.isBrand = value;
1382      return this;
1383    }
1384
1385    /**
1386     * @return Set to true if the item is attributable to a specific manufacturer.
1387     */
1388    public boolean getIsBrand() { 
1389      return this.isBrand == null || this.isBrand.isEmpty() ? false : this.isBrand.getValue();
1390    }
1391
1392    /**
1393     * @param value Set to true if the item is attributable to a specific manufacturer.
1394     */
1395    public Medication setIsBrand(boolean value) { 
1396        if (this.isBrand == null)
1397          this.isBrand = new BooleanType();
1398        this.isBrand.setValue(value);
1399      return this;
1400    }
1401
1402    /**
1403     * @return {@link #isOverTheCounter} (Set to true if the medication can be obtained without an order from a prescriber.). This is the underlying object with id, value and extensions. The accessor "getIsOverTheCounter" gives direct access to the value
1404     */
1405    public BooleanType getIsOverTheCounterElement() { 
1406      if (this.isOverTheCounter == null)
1407        if (Configuration.errorOnAutoCreate())
1408          throw new Error("Attempt to auto-create Medication.isOverTheCounter");
1409        else if (Configuration.doAutoCreate())
1410          this.isOverTheCounter = new BooleanType(); // bb
1411      return this.isOverTheCounter;
1412    }
1413
1414    public boolean hasIsOverTheCounterElement() { 
1415      return this.isOverTheCounter != null && !this.isOverTheCounter.isEmpty();
1416    }
1417
1418    public boolean hasIsOverTheCounter() { 
1419      return this.isOverTheCounter != null && !this.isOverTheCounter.isEmpty();
1420    }
1421
1422    /**
1423     * @param value {@link #isOverTheCounter} (Set to true if the medication can be obtained without an order from a prescriber.). This is the underlying object with id, value and extensions. The accessor "getIsOverTheCounter" gives direct access to the value
1424     */
1425    public Medication setIsOverTheCounterElement(BooleanType value) { 
1426      this.isOverTheCounter = value;
1427      return this;
1428    }
1429
1430    /**
1431     * @return Set to true if the medication can be obtained without an order from a prescriber.
1432     */
1433    public boolean getIsOverTheCounter() { 
1434      return this.isOverTheCounter == null || this.isOverTheCounter.isEmpty() ? false : this.isOverTheCounter.getValue();
1435    }
1436
1437    /**
1438     * @param value Set to true if the medication can be obtained without an order from a prescriber.
1439     */
1440    public Medication setIsOverTheCounter(boolean value) { 
1441        if (this.isOverTheCounter == null)
1442          this.isOverTheCounter = new BooleanType();
1443        this.isOverTheCounter.setValue(value);
1444      return this;
1445    }
1446
1447    /**
1448     * @return {@link #manufacturer} (Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.)
1449     */
1450    public Reference getManufacturer() { 
1451      if (this.manufacturer == null)
1452        if (Configuration.errorOnAutoCreate())
1453          throw new Error("Attempt to auto-create Medication.manufacturer");
1454        else if (Configuration.doAutoCreate())
1455          this.manufacturer = new Reference(); // cc
1456      return this.manufacturer;
1457    }
1458
1459    public boolean hasManufacturer() { 
1460      return this.manufacturer != null && !this.manufacturer.isEmpty();
1461    }
1462
1463    /**
1464     * @param value {@link #manufacturer} (Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.)
1465     */
1466    public Medication setManufacturer(Reference value) { 
1467      this.manufacturer = value;
1468      return this;
1469    }
1470
1471    /**
1472     * @return {@link #manufacturer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.)
1473     */
1474    public Organization getManufacturerTarget() { 
1475      if (this.manufacturerTarget == null)
1476        if (Configuration.errorOnAutoCreate())
1477          throw new Error("Attempt to auto-create Medication.manufacturer");
1478        else if (Configuration.doAutoCreate())
1479          this.manufacturerTarget = new Organization(); // aa
1480      return this.manufacturerTarget;
1481    }
1482
1483    /**
1484     * @param value {@link #manufacturer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.)
1485     */
1486    public Medication setManufacturerTarget(Organization value) { 
1487      this.manufacturerTarget = value;
1488      return this;
1489    }
1490
1491    /**
1492     * @return {@link #form} (Describes the form of the item.  Powder; tablets; capsule.)
1493     */
1494    public CodeableConcept getForm() { 
1495      if (this.form == null)
1496        if (Configuration.errorOnAutoCreate())
1497          throw new Error("Attempt to auto-create Medication.form");
1498        else if (Configuration.doAutoCreate())
1499          this.form = new CodeableConcept(); // cc
1500      return this.form;
1501    }
1502
1503    public boolean hasForm() { 
1504      return this.form != null && !this.form.isEmpty();
1505    }
1506
1507    /**
1508     * @param value {@link #form} (Describes the form of the item.  Powder; tablets; capsule.)
1509     */
1510    public Medication setForm(CodeableConcept value) { 
1511      this.form = value;
1512      return this;
1513    }
1514
1515    /**
1516     * @return {@link #ingredient} (Identifies a particular constituent of interest in the product.)
1517     */
1518    public List<MedicationIngredientComponent> getIngredient() { 
1519      if (this.ingredient == null)
1520        this.ingredient = new ArrayList<MedicationIngredientComponent>();
1521      return this.ingredient;
1522    }
1523
1524    /**
1525     * @return Returns a reference to <code>this</code> for easy method chaining
1526     */
1527    public Medication setIngredient(List<MedicationIngredientComponent> theIngredient) { 
1528      this.ingredient = theIngredient;
1529      return this;
1530    }
1531
1532    public boolean hasIngredient() { 
1533      if (this.ingredient == null)
1534        return false;
1535      for (MedicationIngredientComponent item : this.ingredient)
1536        if (!item.isEmpty())
1537          return true;
1538      return false;
1539    }
1540
1541    public MedicationIngredientComponent addIngredient() { //3
1542      MedicationIngredientComponent t = new MedicationIngredientComponent();
1543      if (this.ingredient == null)
1544        this.ingredient = new ArrayList<MedicationIngredientComponent>();
1545      this.ingredient.add(t);
1546      return t;
1547    }
1548
1549    public Medication addIngredient(MedicationIngredientComponent t) { //3
1550      if (t == null)
1551        return this;
1552      if (this.ingredient == null)
1553        this.ingredient = new ArrayList<MedicationIngredientComponent>();
1554      this.ingredient.add(t);
1555      return this;
1556    }
1557
1558    /**
1559     * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist
1560     */
1561    public MedicationIngredientComponent getIngredientFirstRep() { 
1562      if (getIngredient().isEmpty()) {
1563        addIngredient();
1564      }
1565      return getIngredient().get(0);
1566    }
1567
1568    /**
1569     * @return {@link #package_} (Information that only applies to packages (not products).)
1570     */
1571    public MedicationPackageComponent getPackage() { 
1572      if (this.package_ == null)
1573        if (Configuration.errorOnAutoCreate())
1574          throw new Error("Attempt to auto-create Medication.package_");
1575        else if (Configuration.doAutoCreate())
1576          this.package_ = new MedicationPackageComponent(); // cc
1577      return this.package_;
1578    }
1579
1580    public boolean hasPackage() { 
1581      return this.package_ != null && !this.package_.isEmpty();
1582    }
1583
1584    /**
1585     * @param value {@link #package_} (Information that only applies to packages (not products).)
1586     */
1587    public Medication setPackage(MedicationPackageComponent value) { 
1588      this.package_ = value;
1589      return this;
1590    }
1591
1592    /**
1593     * @return {@link #image} (Photo(s) or graphic representation(s) of the medication.)
1594     */
1595    public List<Attachment> getImage() { 
1596      if (this.image == null)
1597        this.image = new ArrayList<Attachment>();
1598      return this.image;
1599    }
1600
1601    /**
1602     * @return Returns a reference to <code>this</code> for easy method chaining
1603     */
1604    public Medication setImage(List<Attachment> theImage) { 
1605      this.image = theImage;
1606      return this;
1607    }
1608
1609    public boolean hasImage() { 
1610      if (this.image == null)
1611        return false;
1612      for (Attachment item : this.image)
1613        if (!item.isEmpty())
1614          return true;
1615      return false;
1616    }
1617
1618    public Attachment addImage() { //3
1619      Attachment t = new Attachment();
1620      if (this.image == null)
1621        this.image = new ArrayList<Attachment>();
1622      this.image.add(t);
1623      return t;
1624    }
1625
1626    public Medication addImage(Attachment t) { //3
1627      if (t == null)
1628        return this;
1629      if (this.image == null)
1630        this.image = new ArrayList<Attachment>();
1631      this.image.add(t);
1632      return this;
1633    }
1634
1635    /**
1636     * @return The first repetition of repeating field {@link #image}, creating it if it does not already exist
1637     */
1638    public Attachment getImageFirstRep() { 
1639      if (getImage().isEmpty()) {
1640        addImage();
1641      }
1642      return getImage().get(0);
1643    }
1644
1645      protected void listChildren(List<Property> childrenList) {
1646        super.listChildren(childrenList);
1647        childrenList.add(new Property("code", "CodeableConcept", "A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.", 0, java.lang.Integer.MAX_VALUE, code));
1648        childrenList.add(new Property("status", "code", "A code to indicate if the medication is in active use.", 0, java.lang.Integer.MAX_VALUE, status));
1649        childrenList.add(new Property("isBrand", "boolean", "Set to true if the item is attributable to a specific manufacturer.", 0, java.lang.Integer.MAX_VALUE, isBrand));
1650        childrenList.add(new Property("isOverTheCounter", "boolean", "Set to true if the medication can be obtained without an order from a prescriber.", 0, java.lang.Integer.MAX_VALUE, isOverTheCounter));
1651        childrenList.add(new Property("manufacturer", "Reference(Organization)", "Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
1652        childrenList.add(new Property("form", "CodeableConcept", "Describes the form of the item.  Powder; tablets; capsule.", 0, java.lang.Integer.MAX_VALUE, form));
1653        childrenList.add(new Property("ingredient", "", "Identifies a particular constituent of interest in the product.", 0, java.lang.Integer.MAX_VALUE, ingredient));
1654        childrenList.add(new Property("package", "", "Information that only applies to packages (not products).", 0, java.lang.Integer.MAX_VALUE, package_));
1655        childrenList.add(new Property("image", "Attachment", "Photo(s) or graphic representation(s) of the medication.", 0, java.lang.Integer.MAX_VALUE, image));
1656      }
1657
1658      @Override
1659      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1660        switch (hash) {
1661        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1662        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationStatus>
1663        case 2055403645: /*isBrand*/ return this.isBrand == null ? new Base[0] : new Base[] {this.isBrand}; // BooleanType
1664        case -650796023: /*isOverTheCounter*/ return this.isOverTheCounter == null ? new Base[0] : new Base[] {this.isOverTheCounter}; // BooleanType
1665        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference
1666        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
1667        case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // MedicationIngredientComponent
1668        case -807062458: /*package*/ return this.package_ == null ? new Base[0] : new Base[] {this.package_}; // MedicationPackageComponent
1669        case 100313435: /*image*/ return this.image == null ? new Base[0] : this.image.toArray(new Base[this.image.size()]); // Attachment
1670        default: return super.getProperty(hash, name, checkValid);
1671        }
1672
1673      }
1674
1675      @Override
1676      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1677        switch (hash) {
1678        case 3059181: // code
1679          this.code = castToCodeableConcept(value); // CodeableConcept
1680          return value;
1681        case -892481550: // status
1682          value = new MedicationStatusEnumFactory().fromType(castToCode(value));
1683          this.status = (Enumeration) value; // Enumeration<MedicationStatus>
1684          return value;
1685        case 2055403645: // isBrand
1686          this.isBrand = castToBoolean(value); // BooleanType
1687          return value;
1688        case -650796023: // isOverTheCounter
1689          this.isOverTheCounter = castToBoolean(value); // BooleanType
1690          return value;
1691        case -1969347631: // manufacturer
1692          this.manufacturer = castToReference(value); // Reference
1693          return value;
1694        case 3148996: // form
1695          this.form = castToCodeableConcept(value); // CodeableConcept
1696          return value;
1697        case -206409263: // ingredient
1698          this.getIngredient().add((MedicationIngredientComponent) value); // MedicationIngredientComponent
1699          return value;
1700        case -807062458: // package
1701          this.package_ = (MedicationPackageComponent) value; // MedicationPackageComponent
1702          return value;
1703        case 100313435: // image
1704          this.getImage().add(castToAttachment(value)); // Attachment
1705          return value;
1706        default: return super.setProperty(hash, name, value);
1707        }
1708
1709      }
1710
1711      @Override
1712      public Base setProperty(String name, Base value) throws FHIRException {
1713        if (name.equals("code")) {
1714          this.code = castToCodeableConcept(value); // CodeableConcept
1715        } else if (name.equals("status")) {
1716          value = new MedicationStatusEnumFactory().fromType(castToCode(value));
1717          this.status = (Enumeration) value; // Enumeration<MedicationStatus>
1718        } else if (name.equals("isBrand")) {
1719          this.isBrand = castToBoolean(value); // BooleanType
1720        } else if (name.equals("isOverTheCounter")) {
1721          this.isOverTheCounter = castToBoolean(value); // BooleanType
1722        } else if (name.equals("manufacturer")) {
1723          this.manufacturer = castToReference(value); // Reference
1724        } else if (name.equals("form")) {
1725          this.form = castToCodeableConcept(value); // CodeableConcept
1726        } else if (name.equals("ingredient")) {
1727          this.getIngredient().add((MedicationIngredientComponent) value);
1728        } else if (name.equals("package")) {
1729          this.package_ = (MedicationPackageComponent) value; // MedicationPackageComponent
1730        } else if (name.equals("image")) {
1731          this.getImage().add(castToAttachment(value));
1732        } else
1733          return super.setProperty(name, value);
1734        return value;
1735      }
1736
1737      @Override
1738      public Base makeProperty(int hash, String name) throws FHIRException {
1739        switch (hash) {
1740        case 3059181:  return getCode(); 
1741        case -892481550:  return getStatusElement();
1742        case 2055403645:  return getIsBrandElement();
1743        case -650796023:  return getIsOverTheCounterElement();
1744        case -1969347631:  return getManufacturer(); 
1745        case 3148996:  return getForm(); 
1746        case -206409263:  return addIngredient(); 
1747        case -807062458:  return getPackage(); 
1748        case 100313435:  return addImage(); 
1749        default: return super.makeProperty(hash, name);
1750        }
1751
1752      }
1753
1754      @Override
1755      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1756        switch (hash) {
1757        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1758        case -892481550: /*status*/ return new String[] {"code"};
1759        case 2055403645: /*isBrand*/ return new String[] {"boolean"};
1760        case -650796023: /*isOverTheCounter*/ return new String[] {"boolean"};
1761        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
1762        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
1763        case -206409263: /*ingredient*/ return new String[] {};
1764        case -807062458: /*package*/ return new String[] {};
1765        case 100313435: /*image*/ return new String[] {"Attachment"};
1766        default: return super.getTypesForProperty(hash, name);
1767        }
1768
1769      }
1770
1771      @Override
1772      public Base addChild(String name) throws FHIRException {
1773        if (name.equals("code")) {
1774          this.code = new CodeableConcept();
1775          return this.code;
1776        }
1777        else if (name.equals("status")) {
1778          throw new FHIRException("Cannot call addChild on a primitive type Medication.status");
1779        }
1780        else if (name.equals("isBrand")) {
1781          throw new FHIRException("Cannot call addChild on a primitive type Medication.isBrand");
1782        }
1783        else if (name.equals("isOverTheCounter")) {
1784          throw new FHIRException("Cannot call addChild on a primitive type Medication.isOverTheCounter");
1785        }
1786        else if (name.equals("manufacturer")) {
1787          this.manufacturer = new Reference();
1788          return this.manufacturer;
1789        }
1790        else if (name.equals("form")) {
1791          this.form = new CodeableConcept();
1792          return this.form;
1793        }
1794        else if (name.equals("ingredient")) {
1795          return addIngredient();
1796        }
1797        else if (name.equals("package")) {
1798          this.package_ = new MedicationPackageComponent();
1799          return this.package_;
1800        }
1801        else if (name.equals("image")) {
1802          return addImage();
1803        }
1804        else
1805          return super.addChild(name);
1806      }
1807
1808  public String fhirType() {
1809    return "Medication";
1810
1811  }
1812
1813      public Medication copy() {
1814        Medication dst = new Medication();
1815        copyValues(dst);
1816        dst.code = code == null ? null : code.copy();
1817        dst.status = status == null ? null : status.copy();
1818        dst.isBrand = isBrand == null ? null : isBrand.copy();
1819        dst.isOverTheCounter = isOverTheCounter == null ? null : isOverTheCounter.copy();
1820        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
1821        dst.form = form == null ? null : form.copy();
1822        if (ingredient != null) {
1823          dst.ingredient = new ArrayList<MedicationIngredientComponent>();
1824          for (MedicationIngredientComponent i : ingredient)
1825            dst.ingredient.add(i.copy());
1826        };
1827        dst.package_ = package_ == null ? null : package_.copy();
1828        if (image != null) {
1829          dst.image = new ArrayList<Attachment>();
1830          for (Attachment i : image)
1831            dst.image.add(i.copy());
1832        };
1833        return dst;
1834      }
1835
1836      protected Medication typedCopy() {
1837        return copy();
1838      }
1839
1840      @Override
1841      public boolean equalsDeep(Base other) {
1842        if (!super.equalsDeep(other))
1843          return false;
1844        if (!(other instanceof Medication))
1845          return false;
1846        Medication o = (Medication) other;
1847        return compareDeep(code, o.code, true) && compareDeep(status, o.status, true) && compareDeep(isBrand, o.isBrand, true)
1848           && compareDeep(isOverTheCounter, o.isOverTheCounter, true) && compareDeep(manufacturer, o.manufacturer, true)
1849           && compareDeep(form, o.form, true) && compareDeep(ingredient, o.ingredient, true) && compareDeep(package_, o.package_, true)
1850           && compareDeep(image, o.image, true);
1851      }
1852
1853      @Override
1854      public boolean equalsShallow(Base other) {
1855        if (!super.equalsShallow(other))
1856          return false;
1857        if (!(other instanceof Medication))
1858          return false;
1859        Medication o = (Medication) other;
1860        return compareValues(status, o.status, true) && compareValues(isBrand, o.isBrand, true) && compareValues(isOverTheCounter, o.isOverTheCounter, true)
1861          ;
1862      }
1863
1864      public boolean isEmpty() {
1865        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, status, isBrand, isOverTheCounter
1866          , manufacturer, form, ingredient, package_, image);
1867      }
1868
1869  @Override
1870  public ResourceType getResourceType() {
1871    return ResourceType.Medication;
1872   }
1873
1874 /**
1875   * Search parameter: <b>ingredient-code</b>
1876   * <p>
1877   * Description: <b>The product contained</b><br>
1878   * Type: <b>token</b><br>
1879   * Path: <b>Medication.ingredient.itemCodeableConcept</b><br>
1880   * </p>
1881   */
1882  @SearchParamDefinition(name="ingredient-code", path="Medication.ingredient.item.as(CodeableConcept)", description="The product contained", type="token" )
1883  public static final String SP_INGREDIENT_CODE = "ingredient-code";
1884 /**
1885   * <b>Fluent Client</b> search parameter constant for <b>ingredient-code</b>
1886   * <p>
1887   * Description: <b>The product contained</b><br>
1888   * Type: <b>token</b><br>
1889   * Path: <b>Medication.ingredient.itemCodeableConcept</b><br>
1890   * </p>
1891   */
1892  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INGREDIENT_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INGREDIENT_CODE);
1893
1894 /**
1895   * Search parameter: <b>container</b>
1896   * <p>
1897   * Description: <b>E.g. box, vial, blister-pack</b><br>
1898   * Type: <b>token</b><br>
1899   * Path: <b>Medication.package.container</b><br>
1900   * </p>
1901   */
1902  @SearchParamDefinition(name="container", path="Medication.package.container", description="E.g. box, vial, blister-pack", type="token" )
1903  public static final String SP_CONTAINER = "container";
1904 /**
1905   * <b>Fluent Client</b> search parameter constant for <b>container</b>
1906   * <p>
1907   * Description: <b>E.g. box, vial, blister-pack</b><br>
1908   * Type: <b>token</b><br>
1909   * Path: <b>Medication.package.container</b><br>
1910   * </p>
1911   */
1912  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTAINER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTAINER);
1913
1914 /**
1915   * Search parameter: <b>package-item</b>
1916   * <p>
1917   * Description: <b>The item in the package</b><br>
1918   * Type: <b>reference</b><br>
1919   * Path: <b>Medication.package.content.itemReference</b><br>
1920   * </p>
1921   */
1922  @SearchParamDefinition(name="package-item", path="Medication.package.content.item.as(Reference)", description="The item in the package", type="reference", target={Medication.class } )
1923  public static final String SP_PACKAGE_ITEM = "package-item";
1924 /**
1925   * <b>Fluent Client</b> search parameter constant for <b>package-item</b>
1926   * <p>
1927   * Description: <b>The item in the package</b><br>
1928   * Type: <b>reference</b><br>
1929   * Path: <b>Medication.package.content.itemReference</b><br>
1930   * </p>
1931   */
1932  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PACKAGE_ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PACKAGE_ITEM);
1933
1934/**
1935   * Constant for fluent queries to be used to add include statements. Specifies
1936   * the path value of "<b>Medication:package-item</b>".
1937   */
1938  public static final ca.uhn.fhir.model.api.Include INCLUDE_PACKAGE_ITEM = new ca.uhn.fhir.model.api.Include("Medication:package-item").toLocked();
1939
1940 /**
1941   * Search parameter: <b>code</b>
1942   * <p>
1943   * Description: <b>Codes that identify this medication</b><br>
1944   * Type: <b>token</b><br>
1945   * Path: <b>Medication.code</b><br>
1946   * </p>
1947   */
1948  @SearchParamDefinition(name="code", path="Medication.code", description="Codes that identify this medication", type="token" )
1949  public static final String SP_CODE = "code";
1950 /**
1951   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1952   * <p>
1953   * Description: <b>Codes that identify this medication</b><br>
1954   * Type: <b>token</b><br>
1955   * Path: <b>Medication.code</b><br>
1956   * </p>
1957   */
1958  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1959
1960 /**
1961   * Search parameter: <b>ingredient</b>
1962   * <p>
1963   * Description: <b>The product contained</b><br>
1964   * Type: <b>reference</b><br>
1965   * Path: <b>Medication.ingredient.itemReference</b><br>
1966   * </p>
1967   */
1968  @SearchParamDefinition(name="ingredient", path="Medication.ingredient.item.as(Reference)", description="The product contained", type="reference", target={Medication.class, Substance.class } )
1969  public static final String SP_INGREDIENT = "ingredient";
1970 /**
1971   * <b>Fluent Client</b> search parameter constant for <b>ingredient</b>
1972   * <p>
1973   * Description: <b>The product contained</b><br>
1974   * Type: <b>reference</b><br>
1975   * Path: <b>Medication.ingredient.itemReference</b><br>
1976   * </p>
1977   */
1978  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INGREDIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INGREDIENT);
1979
1980/**
1981   * Constant for fluent queries to be used to add include statements. Specifies
1982   * the path value of "<b>Medication:ingredient</b>".
1983   */
1984  public static final ca.uhn.fhir.model.api.Include INCLUDE_INGREDIENT = new ca.uhn.fhir.model.api.Include("Medication:ingredient").toLocked();
1985
1986 /**
1987   * Search parameter: <b>form</b>
1988   * <p>
1989   * Description: <b>powder | tablets | capsule +</b><br>
1990   * Type: <b>token</b><br>
1991   * Path: <b>Medication.form</b><br>
1992   * </p>
1993   */
1994  @SearchParamDefinition(name="form", path="Medication.form", description="powder | tablets | capsule +", type="token" )
1995  public static final String SP_FORM = "form";
1996 /**
1997   * <b>Fluent Client</b> search parameter constant for <b>form</b>
1998   * <p>
1999   * Description: <b>powder | tablets | capsule +</b><br>
2000   * Type: <b>token</b><br>
2001   * Path: <b>Medication.form</b><br>
2002   * </p>
2003   */
2004  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORM);
2005
2006 /**
2007   * Search parameter: <b>package-item-code</b>
2008   * <p>
2009   * Description: <b>The item in the package</b><br>
2010   * Type: <b>token</b><br>
2011   * Path: <b>Medication.package.content.itemCodeableConcept</b><br>
2012   * </p>
2013   */
2014  @SearchParamDefinition(name="package-item-code", path="Medication.package.content.item.as(CodeableConcept)", description="The item in the package", type="token" )
2015  public static final String SP_PACKAGE_ITEM_CODE = "package-item-code";
2016 /**
2017   * <b>Fluent Client</b> search parameter constant for <b>package-item-code</b>
2018   * <p>
2019   * Description: <b>The item in the package</b><br>
2020   * Type: <b>token</b><br>
2021   * Path: <b>Medication.package.content.itemCodeableConcept</b><br>
2022   * </p>
2023   */
2024  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PACKAGE_ITEM_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PACKAGE_ITEM_CODE);
2025
2026 /**
2027   * Search parameter: <b>manufacturer</b>
2028   * <p>
2029   * Description: <b>Manufacturer of the item</b><br>
2030   * Type: <b>reference</b><br>
2031   * Path: <b>Medication.manufacturer</b><br>
2032   * </p>
2033   */
2034  @SearchParamDefinition(name="manufacturer", path="Medication.manufacturer", description="Manufacturer of the item", type="reference", target={Organization.class } )
2035  public static final String SP_MANUFACTURER = "manufacturer";
2036 /**
2037   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
2038   * <p>
2039   * Description: <b>Manufacturer of the item</b><br>
2040   * Type: <b>reference</b><br>
2041   * Path: <b>Medication.manufacturer</b><br>
2042   * </p>
2043   */
2044  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURER);
2045
2046/**
2047   * Constant for fluent queries to be used to add include statements. Specifies
2048   * the path value of "<b>Medication:manufacturer</b>".
2049   */
2050  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include("Medication:manufacturer").toLocked();
2051
2052 /**
2053   * Search parameter: <b>over-the-counter</b>
2054   * <p>
2055   * Description: <b>True if medication does not require a prescription</b><br>
2056   * Type: <b>token</b><br>
2057   * Path: <b>Medication.isOverTheCounter</b><br>
2058   * </p>
2059   */
2060  @SearchParamDefinition(name="over-the-counter", path="Medication.isOverTheCounter", description="True if medication does not require a prescription", type="token" )
2061  public static final String SP_OVER_THE_COUNTER = "over-the-counter";
2062 /**
2063   * <b>Fluent Client</b> search parameter constant for <b>over-the-counter</b>
2064   * <p>
2065   * Description: <b>True if medication does not require a prescription</b><br>
2066   * Type: <b>token</b><br>
2067   * Path: <b>Medication.isOverTheCounter</b><br>
2068   * </p>
2069   */
2070  public static final ca.uhn.fhir.rest.gclient.TokenClientParam OVER_THE_COUNTER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_OVER_THE_COUNTER);
2071
2072 /**
2073   * Search parameter: <b>status</b>
2074   * <p>
2075   * Description: <b>active | inactive | entered-in-error</b><br>
2076   * Type: <b>token</b><br>
2077   * Path: <b>Medication.status</b><br>
2078   * </p>
2079   */
2080  @SearchParamDefinition(name="status", path="Medication.status", description="active | inactive | entered-in-error", type="token" )
2081  public static final String SP_STATUS = "status";
2082 /**
2083   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2084   * <p>
2085   * Description: <b>active | inactive | entered-in-error</b><br>
2086   * Type: <b>token</b><br>
2087   * Path: <b>Medication.status</b><br>
2088   * </p>
2089   */
2090  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2091
2092
2093}
2094