001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.r5.model.Enumerations.*;
059import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.instance.model.api.ICompositeType;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069
070/**
071 * This resource is primarily used for the identification and definition of a medication for the purposes of prescribing, dispensing, and administering a medication as well as for making statements about medication use.
072 */
073@ResourceDef(name="Medication", profile="http://hl7.org/fhir/StructureDefinition/Medication")
074public class Medication extends DomainResource {
075
076    public enum MedicationStatusCodes {
077        /**
078         * The medication is available for use.
079         */
080        ACTIVE, 
081        /**
082         * The medication is not available for use.
083         */
084        INACTIVE, 
085        /**
086         * The medication was entered in error.
087         */
088        ENTEREDINERROR, 
089        /**
090         * added to help the parsers with the generic types
091         */
092        NULL;
093        public static MedicationStatusCodes fromCode(String codeString) throws FHIRException {
094            if (codeString == null || "".equals(codeString))
095                return null;
096        if ("active".equals(codeString))
097          return ACTIVE;
098        if ("inactive".equals(codeString))
099          return INACTIVE;
100        if ("entered-in-error".equals(codeString))
101          return ENTEREDINERROR;
102        if (Configuration.isAcceptInvalidEnums())
103          return null;
104        else
105          throw new FHIRException("Unknown MedicationStatusCodes code '"+codeString+"'");
106        }
107        public String toCode() {
108          switch (this) {
109            case ACTIVE: return "active";
110            case INACTIVE: return "inactive";
111            case ENTEREDINERROR: return "entered-in-error";
112            default: return "?";
113          }
114        }
115        public String getSystem() {
116          switch (this) {
117            case ACTIVE: return "http://hl7.org/fhir/CodeSystem/medication-status";
118            case INACTIVE: return "http://hl7.org/fhir/CodeSystem/medication-status";
119            case ENTEREDINERROR: return "http://hl7.org/fhir/CodeSystem/medication-status";
120            default: return "?";
121          }
122        }
123        public String getDefinition() {
124          switch (this) {
125            case ACTIVE: return "The medication is available for use.";
126            case INACTIVE: return "The medication is not available for use.";
127            case ENTEREDINERROR: return "The medication was entered in error.";
128            default: return "?";
129          }
130        }
131        public String getDisplay() {
132          switch (this) {
133            case ACTIVE: return "Active";
134            case INACTIVE: return "Inactive";
135            case ENTEREDINERROR: return "Entered in Error";
136            default: return "?";
137          }
138        }
139    }
140
141  public static class MedicationStatusCodesEnumFactory implements EnumFactory<MedicationStatusCodes> {
142    public MedicationStatusCodes fromCode(String codeString) throws IllegalArgumentException {
143      if (codeString == null || "".equals(codeString))
144            if (codeString == null || "".equals(codeString))
145                return null;
146        if ("active".equals(codeString))
147          return MedicationStatusCodes.ACTIVE;
148        if ("inactive".equals(codeString))
149          return MedicationStatusCodes.INACTIVE;
150        if ("entered-in-error".equals(codeString))
151          return MedicationStatusCodes.ENTEREDINERROR;
152        throw new IllegalArgumentException("Unknown MedicationStatusCodes code '"+codeString+"'");
153        }
154        public Enumeration<MedicationStatusCodes> fromType(Base code) throws FHIRException {
155          if (code == null)
156            return null;
157          if (code.isEmpty())
158            return new Enumeration<MedicationStatusCodes>(this);
159          String codeString = ((PrimitiveType) code).asStringValue();
160          if (codeString == null || "".equals(codeString))
161            return null;
162        if ("active".equals(codeString))
163          return new Enumeration<MedicationStatusCodes>(this, MedicationStatusCodes.ACTIVE);
164        if ("inactive".equals(codeString))
165          return new Enumeration<MedicationStatusCodes>(this, MedicationStatusCodes.INACTIVE);
166        if ("entered-in-error".equals(codeString))
167          return new Enumeration<MedicationStatusCodes>(this, MedicationStatusCodes.ENTEREDINERROR);
168        throw new FHIRException("Unknown MedicationStatusCodes code '"+codeString+"'");
169        }
170    public String toCode(MedicationStatusCodes code) {
171      if (code == MedicationStatusCodes.ACTIVE)
172        return "active";
173      if (code == MedicationStatusCodes.INACTIVE)
174        return "inactive";
175      if (code == MedicationStatusCodes.ENTEREDINERROR)
176        return "entered-in-error";
177      return "?";
178      }
179    public String toSystem(MedicationStatusCodes code) {
180      return code.getSystem();
181      }
182    }
183
184    @Block()
185    public static class MedicationIngredientComponent extends BackboneElement implements IBaseBackboneElement {
186        /**
187         * The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).
188         */
189        @Child(name = "item", type = {CodeableConcept.class, Substance.class, Medication.class}, order=1, min=1, max=1, modifier=false, summary=false)
190        @Description(shortDefinition="The ingredient (substance or medication) that the ingredient.strength relates to", formalDefinition="The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication)." )
191        protected DataType item;
192
193        /**
194         * Indication of whether this ingredient affects the therapeutic action of the drug.
195         */
196        @Child(name = "isActive", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
197        @Description(shortDefinition="Active ingredient indicator", formalDefinition="Indication of whether this ingredient affects the therapeutic action of the drug." )
198        protected BooleanType isActive;
199
200        /**
201         * 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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.
202         */
203        @Child(name = "strength", type = {Ratio.class, CodeableConcept.class, Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
204        @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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet." )
205        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-ingredientstrength")
206        protected DataType strength;
207
208        private static final long serialVersionUID = 1297277898L;
209
210    /**
211     * Constructor
212     */
213      public MedicationIngredientComponent() {
214        super();
215      }
216
217    /**
218     * Constructor
219     */
220      public MedicationIngredientComponent(DataType item) {
221        super();
222        this.setItem(item);
223      }
224
225        /**
226         * @return {@link #item} (The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).)
227         */
228        public DataType getItem() { 
229          return this.item;
230        }
231
232        /**
233         * @return {@link #item} (The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).)
234         */
235        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
236          if (this.item == null)
237            this.item = new CodeableConcept();
238          if (!(this.item instanceof CodeableConcept))
239            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
240          return (CodeableConcept) this.item;
241        }
242
243        public boolean hasItemCodeableConcept() { 
244          return this != null && this.item instanceof CodeableConcept;
245        }
246
247        /**
248         * @return {@link #item} (The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).)
249         */
250        public Reference getItemReference() throws FHIRException { 
251          if (this.item == null)
252            this.item = new Reference();
253          if (!(this.item instanceof Reference))
254            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
255          return (Reference) this.item;
256        }
257
258        public boolean hasItemReference() { 
259          return this != null && this.item instanceof Reference;
260        }
261
262        public boolean hasItem() { 
263          return this.item != null && !this.item.isEmpty();
264        }
265
266        /**
267         * @param value {@link #item} (The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).)
268         */
269        public MedicationIngredientComponent setItem(DataType value) { 
270          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
271            throw new Error("Not the right type for Medication.ingredient.item[x]: "+value.fhirType());
272          this.item = value;
273          return this;
274        }
275
276        /**
277         * @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
278         */
279        public BooleanType getIsActiveElement() { 
280          if (this.isActive == null)
281            if (Configuration.errorOnAutoCreate())
282              throw new Error("Attempt to auto-create MedicationIngredientComponent.isActive");
283            else if (Configuration.doAutoCreate())
284              this.isActive = new BooleanType(); // bb
285          return this.isActive;
286        }
287
288        public boolean hasIsActiveElement() { 
289          return this.isActive != null && !this.isActive.isEmpty();
290        }
291
292        public boolean hasIsActive() { 
293          return this.isActive != null && !this.isActive.isEmpty();
294        }
295
296        /**
297         * @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
298         */
299        public MedicationIngredientComponent setIsActiveElement(BooleanType value) { 
300          this.isActive = value;
301          return this;
302        }
303
304        /**
305         * @return Indication of whether this ingredient affects the therapeutic action of the drug.
306         */
307        public boolean getIsActive() { 
308          return this.isActive == null || this.isActive.isEmpty() ? false : this.isActive.getValue();
309        }
310
311        /**
312         * @param value Indication of whether this ingredient affects the therapeutic action of the drug.
313         */
314        public MedicationIngredientComponent setIsActive(boolean value) { 
315            if (this.isActive == null)
316              this.isActive = new BooleanType();
317            this.isActive.setValue(value);
318          return this;
319        }
320
321        /**
322         * @return {@link #strength} (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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.)
323         */
324        public DataType getStrength() { 
325          return this.strength;
326        }
327
328        /**
329         * @return {@link #strength} (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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.)
330         */
331        public Ratio getStrengthRatio() throws FHIRException { 
332          if (this.strength == null)
333            this.strength = new Ratio();
334          if (!(this.strength instanceof Ratio))
335            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.strength.getClass().getName()+" was encountered");
336          return (Ratio) this.strength;
337        }
338
339        public boolean hasStrengthRatio() { 
340          return this != null && this.strength instanceof Ratio;
341        }
342
343        /**
344         * @return {@link #strength} (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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.)
345         */
346        public CodeableConcept getStrengthCodeableConcept() throws FHIRException { 
347          if (this.strength == null)
348            this.strength = new CodeableConcept();
349          if (!(this.strength instanceof CodeableConcept))
350            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.strength.getClass().getName()+" was encountered");
351          return (CodeableConcept) this.strength;
352        }
353
354        public boolean hasStrengthCodeableConcept() { 
355          return this != null && this.strength instanceof CodeableConcept;
356        }
357
358        /**
359         * @return {@link #strength} (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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.)
360         */
361        public Quantity getStrengthQuantity() throws FHIRException { 
362          if (this.strength == null)
363            this.strength = new Quantity();
364          if (!(this.strength instanceof Quantity))
365            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.strength.getClass().getName()+" was encountered");
366          return (Quantity) this.strength;
367        }
368
369        public boolean hasStrengthQuantity() { 
370          return this != null && this.strength instanceof Quantity;
371        }
372
373        public boolean hasStrength() { 
374          return this.strength != null && !this.strength.isEmpty();
375        }
376
377        /**
378         * @param value {@link #strength} (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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.)
379         */
380        public MedicationIngredientComponent setStrength(DataType value) { 
381          if (value != null && !(value instanceof Ratio || value instanceof CodeableConcept || value instanceof Quantity))
382            throw new Error("Not the right type for Medication.ingredient.strength[x]: "+value.fhirType());
383          this.strength = value;
384          return this;
385        }
386
387        protected void listChildren(List<Property> children) {
388          super.listChildren(children);
389          children.add(new Property("item[x]", "CodeableConcept|Reference(Substance|Medication)", "The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).", 0, 1, item));
390          children.add(new Property("isActive", "boolean", "Indication of whether this ingredient affects the therapeutic action of the drug.", 0, 1, isActive));
391          children.add(new Property("strength[x]", "Ratio|CodeableConcept|Quantity", "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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.", 0, 1, strength));
392        }
393
394        @Override
395        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
396          switch (_hash) {
397          case 2116201613: /*item[x]*/  return new Property("item[x]", "CodeableConcept|Reference(Substance|Medication)", "The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).", 0, 1, item);
398          case 3242771: /*item*/  return new Property("item[x]", "CodeableConcept|Reference(Substance|Medication)", "The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).", 0, 1, item);
399          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "CodeableConcept", "The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).", 0, 1, item);
400          case 1376364920: /*itemReference*/  return new Property("item[x]", "Reference(Substance|Medication)", "The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).", 0, 1, item);
401          case -748916528: /*isActive*/  return new Property("isActive", "boolean", "Indication of whether this ingredient affects the therapeutic action of the drug.", 0, 1, isActive);
402          case 127377567: /*strength[x]*/  return new Property("strength[x]", "Ratio|CodeableConcept|Quantity", "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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.", 0, 1, strength);
403          case 1791316033: /*strength*/  return new Property("strength[x]", "Ratio|CodeableConcept|Quantity", "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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.", 0, 1, strength);
404          case 2141786186: /*strengthRatio*/  return new Property("strength[x]", "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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.", 0, 1, strength);
405          case -1455903456: /*strengthCodeableConcept*/  return new Property("strength[x]", "CodeableConcept", "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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.", 0, 1, strength);
406          case -1793570836: /*strengthQuantity*/  return new Property("strength[x]", "Quantity", "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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.", 0, 1, strength);
407          default: return super.getNamedProperty(_hash, _name, _checkValid);
408          }
409
410        }
411
412      @Override
413      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
414        switch (hash) {
415        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // DataType
416        case -748916528: /*isActive*/ return this.isActive == null ? new Base[0] : new Base[] {this.isActive}; // BooleanType
417        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // DataType
418        default: return super.getProperty(hash, name, checkValid);
419        }
420
421      }
422
423      @Override
424      public Base setProperty(int hash, String name, Base value) throws FHIRException {
425        switch (hash) {
426        case 3242771: // item
427          this.item = TypeConvertor.castToType(value); // DataType
428          return value;
429        case -748916528: // isActive
430          this.isActive = TypeConvertor.castToBoolean(value); // BooleanType
431          return value;
432        case 1791316033: // strength
433          this.strength = TypeConvertor.castToType(value); // DataType
434          return value;
435        default: return super.setProperty(hash, name, value);
436        }
437
438      }
439
440      @Override
441      public Base setProperty(String name, Base value) throws FHIRException {
442        if (name.equals("item[x]")) {
443          this.item = TypeConvertor.castToType(value); // DataType
444        } else if (name.equals("isActive")) {
445          this.isActive = TypeConvertor.castToBoolean(value); // BooleanType
446        } else if (name.equals("strength[x]")) {
447          this.strength = TypeConvertor.castToType(value); // DataType
448        } else
449          return super.setProperty(name, value);
450        return value;
451      }
452
453      @Override
454      public Base makeProperty(int hash, String name) throws FHIRException {
455        switch (hash) {
456        case 2116201613:  return getItem();
457        case 3242771:  return getItem();
458        case -748916528:  return getIsActiveElement();
459        case 127377567:  return getStrength();
460        case 1791316033:  return getStrength();
461        default: return super.makeProperty(hash, name);
462        }
463
464      }
465
466      @Override
467      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
468        switch (hash) {
469        case 3242771: /*item*/ return new String[] {"CodeableConcept", "Reference"};
470        case -748916528: /*isActive*/ return new String[] {"boolean"};
471        case 1791316033: /*strength*/ return new String[] {"Ratio", "CodeableConcept", "Quantity"};
472        default: return super.getTypesForProperty(hash, name);
473        }
474
475      }
476
477      @Override
478      public Base addChild(String name) throws FHIRException {
479        if (name.equals("itemCodeableConcept")) {
480          this.item = new CodeableConcept();
481          return this.item;
482        }
483        else if (name.equals("itemReference")) {
484          this.item = new Reference();
485          return this.item;
486        }
487        else if (name.equals("isActive")) {
488          throw new FHIRException("Cannot call addChild on a primitive type Medication.ingredient.isActive");
489        }
490        else if (name.equals("strengthRatio")) {
491          this.strength = new Ratio();
492          return this.strength;
493        }
494        else if (name.equals("strengthCodeableConcept")) {
495          this.strength = new CodeableConcept();
496          return this.strength;
497        }
498        else if (name.equals("strengthQuantity")) {
499          this.strength = new Quantity();
500          return this.strength;
501        }
502        else
503          return super.addChild(name);
504      }
505
506      public MedicationIngredientComponent copy() {
507        MedicationIngredientComponent dst = new MedicationIngredientComponent();
508        copyValues(dst);
509        return dst;
510      }
511
512      public void copyValues(MedicationIngredientComponent dst) {
513        super.copyValues(dst);
514        dst.item = item == null ? null : item.copy();
515        dst.isActive = isActive == null ? null : isActive.copy();
516        dst.strength = strength == null ? null : strength.copy();
517      }
518
519      @Override
520      public boolean equalsDeep(Base other_) {
521        if (!super.equalsDeep(other_))
522          return false;
523        if (!(other_ instanceof MedicationIngredientComponent))
524          return false;
525        MedicationIngredientComponent o = (MedicationIngredientComponent) other_;
526        return compareDeep(item, o.item, true) && compareDeep(isActive, o.isActive, true) && compareDeep(strength, o.strength, true)
527          ;
528      }
529
530      @Override
531      public boolean equalsShallow(Base other_) {
532        if (!super.equalsShallow(other_))
533          return false;
534        if (!(other_ instanceof MedicationIngredientComponent))
535          return false;
536        MedicationIngredientComponent o = (MedicationIngredientComponent) other_;
537        return compareValues(isActive, o.isActive, true);
538      }
539
540      public boolean isEmpty() {
541        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, isActive, strength
542          );
543      }
544
545  public String fhirType() {
546    return "Medication.ingredient";
547
548  }
549
550  }
551
552    @Block()
553    public static class MedicationBatchComponent extends BackboneElement implements IBaseBackboneElement {
554        /**
555         * The assigned lot number of a batch of the specified product.
556         */
557        @Child(name = "lotNumber", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
558        @Description(shortDefinition="Identifier assigned to batch", formalDefinition="The assigned lot number of a batch of the specified product." )
559        protected StringType lotNumber;
560
561        /**
562         * When this specific batch of product will expire.
563         */
564        @Child(name = "expirationDate", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
565        @Description(shortDefinition="When batch will expire", formalDefinition="When this specific batch of product will expire." )
566        protected DateTimeType expirationDate;
567
568        private static final long serialVersionUID = 1982738755L;
569
570    /**
571     * Constructor
572     */
573      public MedicationBatchComponent() {
574        super();
575      }
576
577        /**
578         * @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
579         */
580        public StringType getLotNumberElement() { 
581          if (this.lotNumber == null)
582            if (Configuration.errorOnAutoCreate())
583              throw new Error("Attempt to auto-create MedicationBatchComponent.lotNumber");
584            else if (Configuration.doAutoCreate())
585              this.lotNumber = new StringType(); // bb
586          return this.lotNumber;
587        }
588
589        public boolean hasLotNumberElement() { 
590          return this.lotNumber != null && !this.lotNumber.isEmpty();
591        }
592
593        public boolean hasLotNumber() { 
594          return this.lotNumber != null && !this.lotNumber.isEmpty();
595        }
596
597        /**
598         * @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
599         */
600        public MedicationBatchComponent setLotNumberElement(StringType value) { 
601          this.lotNumber = value;
602          return this;
603        }
604
605        /**
606         * @return The assigned lot number of a batch of the specified product.
607         */
608        public String getLotNumber() { 
609          return this.lotNumber == null ? null : this.lotNumber.getValue();
610        }
611
612        /**
613         * @param value The assigned lot number of a batch of the specified product.
614         */
615        public MedicationBatchComponent setLotNumber(String value) { 
616          if (Utilities.noString(value))
617            this.lotNumber = null;
618          else {
619            if (this.lotNumber == null)
620              this.lotNumber = new StringType();
621            this.lotNumber.setValue(value);
622          }
623          return this;
624        }
625
626        /**
627         * @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
628         */
629        public DateTimeType getExpirationDateElement() { 
630          if (this.expirationDate == null)
631            if (Configuration.errorOnAutoCreate())
632              throw new Error("Attempt to auto-create MedicationBatchComponent.expirationDate");
633            else if (Configuration.doAutoCreate())
634              this.expirationDate = new DateTimeType(); // bb
635          return this.expirationDate;
636        }
637
638        public boolean hasExpirationDateElement() { 
639          return this.expirationDate != null && !this.expirationDate.isEmpty();
640        }
641
642        public boolean hasExpirationDate() { 
643          return this.expirationDate != null && !this.expirationDate.isEmpty();
644        }
645
646        /**
647         * @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
648         */
649        public MedicationBatchComponent setExpirationDateElement(DateTimeType value) { 
650          this.expirationDate = value;
651          return this;
652        }
653
654        /**
655         * @return When this specific batch of product will expire.
656         */
657        public Date getExpirationDate() { 
658          return this.expirationDate == null ? null : this.expirationDate.getValue();
659        }
660
661        /**
662         * @param value When this specific batch of product will expire.
663         */
664        public MedicationBatchComponent setExpirationDate(Date value) { 
665          if (value == null)
666            this.expirationDate = null;
667          else {
668            if (this.expirationDate == null)
669              this.expirationDate = new DateTimeType();
670            this.expirationDate.setValue(value);
671          }
672          return this;
673        }
674
675        protected void listChildren(List<Property> children) {
676          super.listChildren(children);
677          children.add(new Property("lotNumber", "string", "The assigned lot number of a batch of the specified product.", 0, 1, lotNumber));
678          children.add(new Property("expirationDate", "dateTime", "When this specific batch of product will expire.", 0, 1, expirationDate));
679        }
680
681        @Override
682        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
683          switch (_hash) {
684          case 462547450: /*lotNumber*/  return new Property("lotNumber", "string", "The assigned lot number of a batch of the specified product.", 0, 1, lotNumber);
685          case -668811523: /*expirationDate*/  return new Property("expirationDate", "dateTime", "When this specific batch of product will expire.", 0, 1, expirationDate);
686          default: return super.getNamedProperty(_hash, _name, _checkValid);
687          }
688
689        }
690
691      @Override
692      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
693        switch (hash) {
694        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
695        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType
696        default: return super.getProperty(hash, name, checkValid);
697        }
698
699      }
700
701      @Override
702      public Base setProperty(int hash, String name, Base value) throws FHIRException {
703        switch (hash) {
704        case 462547450: // lotNumber
705          this.lotNumber = TypeConvertor.castToString(value); // StringType
706          return value;
707        case -668811523: // expirationDate
708          this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType
709          return value;
710        default: return super.setProperty(hash, name, value);
711        }
712
713      }
714
715      @Override
716      public Base setProperty(String name, Base value) throws FHIRException {
717        if (name.equals("lotNumber")) {
718          this.lotNumber = TypeConvertor.castToString(value); // StringType
719        } else if (name.equals("expirationDate")) {
720          this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType
721        } else
722          return super.setProperty(name, value);
723        return value;
724      }
725
726      @Override
727      public Base makeProperty(int hash, String name) throws FHIRException {
728        switch (hash) {
729        case 462547450:  return getLotNumberElement();
730        case -668811523:  return getExpirationDateElement();
731        default: return super.makeProperty(hash, name);
732        }
733
734      }
735
736      @Override
737      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
738        switch (hash) {
739        case 462547450: /*lotNumber*/ return new String[] {"string"};
740        case -668811523: /*expirationDate*/ return new String[] {"dateTime"};
741        default: return super.getTypesForProperty(hash, name);
742        }
743
744      }
745
746      @Override
747      public Base addChild(String name) throws FHIRException {
748        if (name.equals("lotNumber")) {
749          throw new FHIRException("Cannot call addChild on a primitive type Medication.batch.lotNumber");
750        }
751        else if (name.equals("expirationDate")) {
752          throw new FHIRException("Cannot call addChild on a primitive type Medication.batch.expirationDate");
753        }
754        else
755          return super.addChild(name);
756      }
757
758      public MedicationBatchComponent copy() {
759        MedicationBatchComponent dst = new MedicationBatchComponent();
760        copyValues(dst);
761        return dst;
762      }
763
764      public void copyValues(MedicationBatchComponent dst) {
765        super.copyValues(dst);
766        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
767        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
768      }
769
770      @Override
771      public boolean equalsDeep(Base other_) {
772        if (!super.equalsDeep(other_))
773          return false;
774        if (!(other_ instanceof MedicationBatchComponent))
775          return false;
776        MedicationBatchComponent o = (MedicationBatchComponent) other_;
777        return compareDeep(lotNumber, o.lotNumber, true) && compareDeep(expirationDate, o.expirationDate, true)
778          ;
779      }
780
781      @Override
782      public boolean equalsShallow(Base other_) {
783        if (!super.equalsShallow(other_))
784          return false;
785        if (!(other_ instanceof MedicationBatchComponent))
786          return false;
787        MedicationBatchComponent o = (MedicationBatchComponent) other_;
788        return compareValues(lotNumber, o.lotNumber, true) && compareValues(expirationDate, o.expirationDate, true)
789          ;
790      }
791
792      public boolean isEmpty() {
793        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(lotNumber, expirationDate
794          );
795      }
796
797  public String fhirType() {
798    return "Medication.batch";
799
800  }
801
802  }
803
804    /**
805     * Business identifier for this medication.
806     */
807    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
808    @Description(shortDefinition="Business identifier for this medication", formalDefinition="Business identifier for this medication." )
809    protected List<Identifier> identifier;
810
811    /**
812     * 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.
813     */
814    @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
815    @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." )
816    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes")
817    protected CodeableConcept code;
818
819    /**
820     * A code to indicate if the medication is in active use.
821     */
822    @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true)
823    @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="A code to indicate if the medication is in active use." )
824    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-status")
825    protected Enumeration<MedicationStatusCodes> status;
826
827    /**
828     * Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.
829     */
830    @Child(name = "manufacturer", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
831    @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." )
832    protected Reference manufacturer;
833
834    /**
835     * Describes the form of the item.  Powder; tablets; capsule.
836     */
837    @Child(name = "doseForm", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
838    @Description(shortDefinition="powder | tablets | capsule +", formalDefinition="Describes the form of the item.  Powder; tablets; capsule." )
839    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-form-codes")
840    protected CodeableConcept doseForm;
841
842    /**
843     * Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).
844     */
845    @Child(name = "amount", type = {Ratio.class}, order=5, min=0, max=1, modifier=false, summary=true)
846    @Description(shortDefinition="Amount of drug in package", formalDefinition="Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.)." )
847    protected Ratio amount;
848
849    /**
850     * Identifies a particular constituent of interest in the product.
851     */
852    @Child(name = "ingredient", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
853    @Description(shortDefinition="Active or inactive ingredient", formalDefinition="Identifies a particular constituent of interest in the product." )
854    protected List<MedicationIngredientComponent> ingredient;
855
856    /**
857     * Information that only applies to packages (not products).
858     */
859    @Child(name = "batch", type = {}, order=7, min=0, max=1, modifier=false, summary=false)
860    @Description(shortDefinition="Details about packaged medications", formalDefinition="Information that only applies to packages (not products)." )
861    protected MedicationBatchComponent batch;
862
863    private static final long serialVersionUID = 1712967281L;
864
865  /**
866   * Constructor
867   */
868    public Medication() {
869      super();
870    }
871
872    /**
873     * @return {@link #identifier} (Business identifier for this medication.)
874     */
875    public List<Identifier> getIdentifier() { 
876      if (this.identifier == null)
877        this.identifier = new ArrayList<Identifier>();
878      return this.identifier;
879    }
880
881    /**
882     * @return Returns a reference to <code>this</code> for easy method chaining
883     */
884    public Medication setIdentifier(List<Identifier> theIdentifier) { 
885      this.identifier = theIdentifier;
886      return this;
887    }
888
889    public boolean hasIdentifier() { 
890      if (this.identifier == null)
891        return false;
892      for (Identifier item : this.identifier)
893        if (!item.isEmpty())
894          return true;
895      return false;
896    }
897
898    public Identifier addIdentifier() { //3
899      Identifier t = new Identifier();
900      if (this.identifier == null)
901        this.identifier = new ArrayList<Identifier>();
902      this.identifier.add(t);
903      return t;
904    }
905
906    public Medication addIdentifier(Identifier t) { //3
907      if (t == null)
908        return this;
909      if (this.identifier == null)
910        this.identifier = new ArrayList<Identifier>();
911      this.identifier.add(t);
912      return this;
913    }
914
915    /**
916     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
917     */
918    public Identifier getIdentifierFirstRep() { 
919      if (getIdentifier().isEmpty()) {
920        addIdentifier();
921      }
922      return getIdentifier().get(0);
923    }
924
925    /**
926     * @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.)
927     */
928    public CodeableConcept getCode() { 
929      if (this.code == null)
930        if (Configuration.errorOnAutoCreate())
931          throw new Error("Attempt to auto-create Medication.code");
932        else if (Configuration.doAutoCreate())
933          this.code = new CodeableConcept(); // cc
934      return this.code;
935    }
936
937    public boolean hasCode() { 
938      return this.code != null && !this.code.isEmpty();
939    }
940
941    /**
942     * @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.)
943     */
944    public Medication setCode(CodeableConcept value) { 
945      this.code = value;
946      return this;
947    }
948
949    /**
950     * @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
951     */
952    public Enumeration<MedicationStatusCodes> getStatusElement() { 
953      if (this.status == null)
954        if (Configuration.errorOnAutoCreate())
955          throw new Error("Attempt to auto-create Medication.status");
956        else if (Configuration.doAutoCreate())
957          this.status = new Enumeration<MedicationStatusCodes>(new MedicationStatusCodesEnumFactory()); // bb
958      return this.status;
959    }
960
961    public boolean hasStatusElement() { 
962      return this.status != null && !this.status.isEmpty();
963    }
964
965    public boolean hasStatus() { 
966      return this.status != null && !this.status.isEmpty();
967    }
968
969    /**
970     * @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
971     */
972    public Medication setStatusElement(Enumeration<MedicationStatusCodes> value) { 
973      this.status = value;
974      return this;
975    }
976
977    /**
978     * @return A code to indicate if the medication is in active use.
979     */
980    public MedicationStatusCodes getStatus() { 
981      return this.status == null ? null : this.status.getValue();
982    }
983
984    /**
985     * @param value A code to indicate if the medication is in active use.
986     */
987    public Medication setStatus(MedicationStatusCodes value) { 
988      if (value == null)
989        this.status = null;
990      else {
991        if (this.status == null)
992          this.status = new Enumeration<MedicationStatusCodes>(new MedicationStatusCodesEnumFactory());
993        this.status.setValue(value);
994      }
995      return this;
996    }
997
998    /**
999     * @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.)
1000     */
1001    public Reference getManufacturer() { 
1002      if (this.manufacturer == null)
1003        if (Configuration.errorOnAutoCreate())
1004          throw new Error("Attempt to auto-create Medication.manufacturer");
1005        else if (Configuration.doAutoCreate())
1006          this.manufacturer = new Reference(); // cc
1007      return this.manufacturer;
1008    }
1009
1010    public boolean hasManufacturer() { 
1011      return this.manufacturer != null && !this.manufacturer.isEmpty();
1012    }
1013
1014    /**
1015     * @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.)
1016     */
1017    public Medication setManufacturer(Reference value) { 
1018      this.manufacturer = value;
1019      return this;
1020    }
1021
1022    /**
1023     * @return {@link #doseForm} (Describes the form of the item.  Powder; tablets; capsule.)
1024     */
1025    public CodeableConcept getDoseForm() { 
1026      if (this.doseForm == null)
1027        if (Configuration.errorOnAutoCreate())
1028          throw new Error("Attempt to auto-create Medication.doseForm");
1029        else if (Configuration.doAutoCreate())
1030          this.doseForm = new CodeableConcept(); // cc
1031      return this.doseForm;
1032    }
1033
1034    public boolean hasDoseForm() { 
1035      return this.doseForm != null && !this.doseForm.isEmpty();
1036    }
1037
1038    /**
1039     * @param value {@link #doseForm} (Describes the form of the item.  Powder; tablets; capsule.)
1040     */
1041    public Medication setDoseForm(CodeableConcept value) { 
1042      this.doseForm = value;
1043      return this;
1044    }
1045
1046    /**
1047     * @return {@link #amount} (Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).)
1048     */
1049    public Ratio getAmount() { 
1050      if (this.amount == null)
1051        if (Configuration.errorOnAutoCreate())
1052          throw new Error("Attempt to auto-create Medication.amount");
1053        else if (Configuration.doAutoCreate())
1054          this.amount = new Ratio(); // cc
1055      return this.amount;
1056    }
1057
1058    public boolean hasAmount() { 
1059      return this.amount != null && !this.amount.isEmpty();
1060    }
1061
1062    /**
1063     * @param value {@link #amount} (Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).)
1064     */
1065    public Medication setAmount(Ratio value) { 
1066      this.amount = value;
1067      return this;
1068    }
1069
1070    /**
1071     * @return {@link #ingredient} (Identifies a particular constituent of interest in the product.)
1072     */
1073    public List<MedicationIngredientComponent> getIngredient() { 
1074      if (this.ingredient == null)
1075        this.ingredient = new ArrayList<MedicationIngredientComponent>();
1076      return this.ingredient;
1077    }
1078
1079    /**
1080     * @return Returns a reference to <code>this</code> for easy method chaining
1081     */
1082    public Medication setIngredient(List<MedicationIngredientComponent> theIngredient) { 
1083      this.ingredient = theIngredient;
1084      return this;
1085    }
1086
1087    public boolean hasIngredient() { 
1088      if (this.ingredient == null)
1089        return false;
1090      for (MedicationIngredientComponent item : this.ingredient)
1091        if (!item.isEmpty())
1092          return true;
1093      return false;
1094    }
1095
1096    public MedicationIngredientComponent addIngredient() { //3
1097      MedicationIngredientComponent t = new MedicationIngredientComponent();
1098      if (this.ingredient == null)
1099        this.ingredient = new ArrayList<MedicationIngredientComponent>();
1100      this.ingredient.add(t);
1101      return t;
1102    }
1103
1104    public Medication addIngredient(MedicationIngredientComponent t) { //3
1105      if (t == null)
1106        return this;
1107      if (this.ingredient == null)
1108        this.ingredient = new ArrayList<MedicationIngredientComponent>();
1109      this.ingredient.add(t);
1110      return this;
1111    }
1112
1113    /**
1114     * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist {3}
1115     */
1116    public MedicationIngredientComponent getIngredientFirstRep() { 
1117      if (getIngredient().isEmpty()) {
1118        addIngredient();
1119      }
1120      return getIngredient().get(0);
1121    }
1122
1123    /**
1124     * @return {@link #batch} (Information that only applies to packages (not products).)
1125     */
1126    public MedicationBatchComponent getBatch() { 
1127      if (this.batch == null)
1128        if (Configuration.errorOnAutoCreate())
1129          throw new Error("Attempt to auto-create Medication.batch");
1130        else if (Configuration.doAutoCreate())
1131          this.batch = new MedicationBatchComponent(); // cc
1132      return this.batch;
1133    }
1134
1135    public boolean hasBatch() { 
1136      return this.batch != null && !this.batch.isEmpty();
1137    }
1138
1139    /**
1140     * @param value {@link #batch} (Information that only applies to packages (not products).)
1141     */
1142    public Medication setBatch(MedicationBatchComponent value) { 
1143      this.batch = value;
1144      return this;
1145    }
1146
1147      protected void listChildren(List<Property> children) {
1148        super.listChildren(children);
1149        children.add(new Property("identifier", "Identifier", "Business identifier for this medication.", 0, java.lang.Integer.MAX_VALUE, identifier));
1150        children.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, 1, code));
1151        children.add(new Property("status", "code", "A code to indicate if the medication is in active use.", 0, 1, status));
1152        children.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, 1, manufacturer));
1153        children.add(new Property("doseForm", "CodeableConcept", "Describes the form of the item.  Powder; tablets; capsule.", 0, 1, doseForm));
1154        children.add(new Property("amount", "Ratio", "Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).", 0, 1, amount));
1155        children.add(new Property("ingredient", "", "Identifies a particular constituent of interest in the product.", 0, java.lang.Integer.MAX_VALUE, ingredient));
1156        children.add(new Property("batch", "", "Information that only applies to packages (not products).", 0, 1, batch));
1157      }
1158
1159      @Override
1160      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1161        switch (_hash) {
1162        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier for this medication.", 0, java.lang.Integer.MAX_VALUE, identifier);
1163        case 3059181: /*code*/  return 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, 1, code);
1164        case -892481550: /*status*/  return new Property("status", "code", "A code to indicate if the medication is in active use.", 0, 1, status);
1165        case -1969347631: /*manufacturer*/  return 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, 1, manufacturer);
1166        case 1303858817: /*doseForm*/  return new Property("doseForm", "CodeableConcept", "Describes the form of the item.  Powder; tablets; capsule.", 0, 1, doseForm);
1167        case -1413853096: /*amount*/  return new Property("amount", "Ratio", "Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).", 0, 1, amount);
1168        case -206409263: /*ingredient*/  return new Property("ingredient", "", "Identifies a particular constituent of interest in the product.", 0, java.lang.Integer.MAX_VALUE, ingredient);
1169        case 93509434: /*batch*/  return new Property("batch", "", "Information that only applies to packages (not products).", 0, 1, batch);
1170        default: return super.getNamedProperty(_hash, _name, _checkValid);
1171        }
1172
1173      }
1174
1175      @Override
1176      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1177        switch (hash) {
1178        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1179        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1180        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MedicationStatusCodes>
1181        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference
1182        case 1303858817: /*doseForm*/ return this.doseForm == null ? new Base[0] : new Base[] {this.doseForm}; // CodeableConcept
1183        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Ratio
1184        case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // MedicationIngredientComponent
1185        case 93509434: /*batch*/ return this.batch == null ? new Base[0] : new Base[] {this.batch}; // MedicationBatchComponent
1186        default: return super.getProperty(hash, name, checkValid);
1187        }
1188
1189      }
1190
1191      @Override
1192      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1193        switch (hash) {
1194        case -1618432855: // identifier
1195          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1196          return value;
1197        case 3059181: // code
1198          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1199          return value;
1200        case -892481550: // status
1201          value = new MedicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1202          this.status = (Enumeration) value; // Enumeration<MedicationStatusCodes>
1203          return value;
1204        case -1969347631: // manufacturer
1205          this.manufacturer = TypeConvertor.castToReference(value); // Reference
1206          return value;
1207        case 1303858817: // doseForm
1208          this.doseForm = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1209          return value;
1210        case -1413853096: // amount
1211          this.amount = TypeConvertor.castToRatio(value); // Ratio
1212          return value;
1213        case -206409263: // ingredient
1214          this.getIngredient().add((MedicationIngredientComponent) value); // MedicationIngredientComponent
1215          return value;
1216        case 93509434: // batch
1217          this.batch = (MedicationBatchComponent) value; // MedicationBatchComponent
1218          return value;
1219        default: return super.setProperty(hash, name, value);
1220        }
1221
1222      }
1223
1224      @Override
1225      public Base setProperty(String name, Base value) throws FHIRException {
1226        if (name.equals("identifier")) {
1227          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1228        } else if (name.equals("code")) {
1229          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1230        } else if (name.equals("status")) {
1231          value = new MedicationStatusCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
1232          this.status = (Enumeration) value; // Enumeration<MedicationStatusCodes>
1233        } else if (name.equals("manufacturer")) {
1234          this.manufacturer = TypeConvertor.castToReference(value); // Reference
1235        } else if (name.equals("doseForm")) {
1236          this.doseForm = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1237        } else if (name.equals("amount")) {
1238          this.amount = TypeConvertor.castToRatio(value); // Ratio
1239        } else if (name.equals("ingredient")) {
1240          this.getIngredient().add((MedicationIngredientComponent) value);
1241        } else if (name.equals("batch")) {
1242          this.batch = (MedicationBatchComponent) value; // MedicationBatchComponent
1243        } else
1244          return super.setProperty(name, value);
1245        return value;
1246      }
1247
1248      @Override
1249      public Base makeProperty(int hash, String name) throws FHIRException {
1250        switch (hash) {
1251        case -1618432855:  return addIdentifier(); 
1252        case 3059181:  return getCode();
1253        case -892481550:  return getStatusElement();
1254        case -1969347631:  return getManufacturer();
1255        case 1303858817:  return getDoseForm();
1256        case -1413853096:  return getAmount();
1257        case -206409263:  return addIngredient(); 
1258        case 93509434:  return getBatch();
1259        default: return super.makeProperty(hash, name);
1260        }
1261
1262      }
1263
1264      @Override
1265      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1266        switch (hash) {
1267        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1268        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1269        case -892481550: /*status*/ return new String[] {"code"};
1270        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
1271        case 1303858817: /*doseForm*/ return new String[] {"CodeableConcept"};
1272        case -1413853096: /*amount*/ return new String[] {"Ratio"};
1273        case -206409263: /*ingredient*/ return new String[] {};
1274        case 93509434: /*batch*/ return new String[] {};
1275        default: return super.getTypesForProperty(hash, name);
1276        }
1277
1278      }
1279
1280      @Override
1281      public Base addChild(String name) throws FHIRException {
1282        if (name.equals("identifier")) {
1283          return addIdentifier();
1284        }
1285        else if (name.equals("code")) {
1286          this.code = new CodeableConcept();
1287          return this.code;
1288        }
1289        else if (name.equals("status")) {
1290          throw new FHIRException("Cannot call addChild on a primitive type Medication.status");
1291        }
1292        else if (name.equals("manufacturer")) {
1293          this.manufacturer = new Reference();
1294          return this.manufacturer;
1295        }
1296        else if (name.equals("doseForm")) {
1297          this.doseForm = new CodeableConcept();
1298          return this.doseForm;
1299        }
1300        else if (name.equals("amount")) {
1301          this.amount = new Ratio();
1302          return this.amount;
1303        }
1304        else if (name.equals("ingredient")) {
1305          return addIngredient();
1306        }
1307        else if (name.equals("batch")) {
1308          this.batch = new MedicationBatchComponent();
1309          return this.batch;
1310        }
1311        else
1312          return super.addChild(name);
1313      }
1314
1315  public String fhirType() {
1316    return "Medication";
1317
1318  }
1319
1320      public Medication copy() {
1321        Medication dst = new Medication();
1322        copyValues(dst);
1323        return dst;
1324      }
1325
1326      public void copyValues(Medication dst) {
1327        super.copyValues(dst);
1328        if (identifier != null) {
1329          dst.identifier = new ArrayList<Identifier>();
1330          for (Identifier i : identifier)
1331            dst.identifier.add(i.copy());
1332        };
1333        dst.code = code == null ? null : code.copy();
1334        dst.status = status == null ? null : status.copy();
1335        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
1336        dst.doseForm = doseForm == null ? null : doseForm.copy();
1337        dst.amount = amount == null ? null : amount.copy();
1338        if (ingredient != null) {
1339          dst.ingredient = new ArrayList<MedicationIngredientComponent>();
1340          for (MedicationIngredientComponent i : ingredient)
1341            dst.ingredient.add(i.copy());
1342        };
1343        dst.batch = batch == null ? null : batch.copy();
1344      }
1345
1346      protected Medication typedCopy() {
1347        return copy();
1348      }
1349
1350      @Override
1351      public boolean equalsDeep(Base other_) {
1352        if (!super.equalsDeep(other_))
1353          return false;
1354        if (!(other_ instanceof Medication))
1355          return false;
1356        Medication o = (Medication) other_;
1357        return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(status, o.status, true)
1358           && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(doseForm, o.doseForm, true) && compareDeep(amount, o.amount, true)
1359           && compareDeep(ingredient, o.ingredient, true) && compareDeep(batch, o.batch, true);
1360      }
1361
1362      @Override
1363      public boolean equalsShallow(Base other_) {
1364        if (!super.equalsShallow(other_))
1365          return false;
1366        if (!(other_ instanceof Medication))
1367          return false;
1368        Medication o = (Medication) other_;
1369        return compareValues(status, o.status, true);
1370      }
1371
1372      public boolean isEmpty() {
1373        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, code, status
1374          , manufacturer, doseForm, amount, ingredient, batch);
1375      }
1376
1377  @Override
1378  public ResourceType getResourceType() {
1379    return ResourceType.Medication;
1380   }
1381
1382 /**
1383   * Search parameter: <b>expiration-date</b>
1384   * <p>
1385   * Description: <b>Returns medications in a batch with this expiration date</b><br>
1386   * Type: <b>date</b><br>
1387   * Path: <b>Medication.batch.expirationDate</b><br>
1388   * </p>
1389   */
1390  @SearchParamDefinition(name="expiration-date", path="Medication.batch.expirationDate", description="Returns medications in a batch with this expiration date", type="date" )
1391  public static final String SP_EXPIRATION_DATE = "expiration-date";
1392 /**
1393   * <b>Fluent Client</b> search parameter constant for <b>expiration-date</b>
1394   * <p>
1395   * Description: <b>Returns medications in a batch with this expiration date</b><br>
1396   * Type: <b>date</b><br>
1397   * Path: <b>Medication.batch.expirationDate</b><br>
1398   * </p>
1399   */
1400  public static final ca.uhn.fhir.rest.gclient.DateClientParam EXPIRATION_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EXPIRATION_DATE);
1401
1402 /**
1403   * Search parameter: <b>form</b>
1404   * <p>
1405   * Description: <b>Returns medications for a specific dose form</b><br>
1406   * Type: <b>token</b><br>
1407   * Path: <b>null</b><br>
1408   * </p>
1409   */
1410  @SearchParamDefinition(name="form", path="", description="Returns medications for a specific dose form", type="token" )
1411  public static final String SP_FORM = "form";
1412 /**
1413   * <b>Fluent Client</b> search parameter constant for <b>form</b>
1414   * <p>
1415   * Description: <b>Returns medications for a specific dose form</b><br>
1416   * Type: <b>token</b><br>
1417   * Path: <b>null</b><br>
1418   * </p>
1419   */
1420  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORM);
1421
1422 /**
1423   * Search parameter: <b>identifier</b>
1424   * <p>
1425   * Description: <b>Returns medications with this external identifier</b><br>
1426   * Type: <b>token</b><br>
1427   * Path: <b>Medication.identifier</b><br>
1428   * </p>
1429   */
1430  @SearchParamDefinition(name="identifier", path="Medication.identifier", description="Returns medications with this external identifier", type="token" )
1431  public static final String SP_IDENTIFIER = "identifier";
1432 /**
1433   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1434   * <p>
1435   * Description: <b>Returns medications with this external identifier</b><br>
1436   * Type: <b>token</b><br>
1437   * Path: <b>Medication.identifier</b><br>
1438   * </p>
1439   */
1440  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1441
1442 /**
1443   * Search parameter: <b>ingredient-code</b>
1444   * <p>
1445   * Description: <b>Returns medications for this ingredient code</b><br>
1446   * Type: <b>token</b><br>
1447   * Path: <b>(Medication.ingredient.item as CodeableConcept)</b><br>
1448   * </p>
1449   */
1450  @SearchParamDefinition(name="ingredient-code", path="(Medication.ingredient.item as CodeableConcept)", description="Returns medications for this ingredient code", type="token" )
1451  public static final String SP_INGREDIENT_CODE = "ingredient-code";
1452 /**
1453   * <b>Fluent Client</b> search parameter constant for <b>ingredient-code</b>
1454   * <p>
1455   * Description: <b>Returns medications for this ingredient code</b><br>
1456   * Type: <b>token</b><br>
1457   * Path: <b>(Medication.ingredient.item as CodeableConcept)</b><br>
1458   * </p>
1459   */
1460  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INGREDIENT_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INGREDIENT_CODE);
1461
1462 /**
1463   * Search parameter: <b>ingredient</b>
1464   * <p>
1465   * Description: <b>Returns medications for this ingredient reference</b><br>
1466   * Type: <b>reference</b><br>
1467   * Path: <b>(Medication.ingredient.item as Reference)</b><br>
1468   * </p>
1469   */
1470  @SearchParamDefinition(name="ingredient", path="(Medication.ingredient.item as Reference)", description="Returns medications for this ingredient reference", type="reference", target={Medication.class, Substance.class } )
1471  public static final String SP_INGREDIENT = "ingredient";
1472 /**
1473   * <b>Fluent Client</b> search parameter constant for <b>ingredient</b>
1474   * <p>
1475   * Description: <b>Returns medications for this ingredient reference</b><br>
1476   * Type: <b>reference</b><br>
1477   * Path: <b>(Medication.ingredient.item as Reference)</b><br>
1478   * </p>
1479   */
1480  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INGREDIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INGREDIENT);
1481
1482/**
1483   * Constant for fluent queries to be used to add include statements. Specifies
1484   * the path value of "<b>Medication:ingredient</b>".
1485   */
1486  public static final ca.uhn.fhir.model.api.Include INCLUDE_INGREDIENT = new ca.uhn.fhir.model.api.Include("Medication:ingredient").toLocked();
1487
1488 /**
1489   * Search parameter: <b>lot-number</b>
1490   * <p>
1491   * Description: <b>Returns medications in a batch with this lot number</b><br>
1492   * Type: <b>token</b><br>
1493   * Path: <b>Medication.batch.lotNumber</b><br>
1494   * </p>
1495   */
1496  @SearchParamDefinition(name="lot-number", path="Medication.batch.lotNumber", description="Returns medications in a batch with this lot number", type="token" )
1497  public static final String SP_LOT_NUMBER = "lot-number";
1498 /**
1499   * <b>Fluent Client</b> search parameter constant for <b>lot-number</b>
1500   * <p>
1501   * Description: <b>Returns medications in a batch with this lot number</b><br>
1502   * Type: <b>token</b><br>
1503   * Path: <b>Medication.batch.lotNumber</b><br>
1504   * </p>
1505   */
1506  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOT_NUMBER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LOT_NUMBER);
1507
1508 /**
1509   * Search parameter: <b>manufacturer</b>
1510   * <p>
1511   * Description: <b>Returns medications made or sold for this manufacturer</b><br>
1512   * Type: <b>reference</b><br>
1513   * Path: <b>Medication.manufacturer</b><br>
1514   * </p>
1515   */
1516  @SearchParamDefinition(name="manufacturer", path="Medication.manufacturer", description="Returns medications made or sold for this manufacturer", type="reference", target={Organization.class } )
1517  public static final String SP_MANUFACTURER = "manufacturer";
1518 /**
1519   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
1520   * <p>
1521   * Description: <b>Returns medications made or sold for this manufacturer</b><br>
1522   * Type: <b>reference</b><br>
1523   * Path: <b>Medication.manufacturer</b><br>
1524   * </p>
1525   */
1526  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURER);
1527
1528/**
1529   * Constant for fluent queries to be used to add include statements. Specifies
1530   * the path value of "<b>Medication:manufacturer</b>".
1531   */
1532  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include("Medication:manufacturer").toLocked();
1533
1534 /**
1535   * Search parameter: <b>status</b>
1536   * <p>
1537   * Description: <b>Returns medications for this status</b><br>
1538   * Type: <b>token</b><br>
1539   * Path: <b>Medication.status</b><br>
1540   * </p>
1541   */
1542  @SearchParamDefinition(name="status", path="Medication.status", description="Returns medications for this status", type="token" )
1543  public static final String SP_STATUS = "status";
1544 /**
1545   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1546   * <p>
1547   * Description: <b>Returns medications for this status</b><br>
1548   * Type: <b>token</b><br>
1549   * Path: <b>Medication.status</b><br>
1550   * </p>
1551   */
1552  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1553
1554 /**
1555   * Search parameter: <b>code</b>
1556   * <p>
1557   * Description: <b>Multiple Resources: 
1558
1559* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
1560* [Condition](condition.html): Code for the condition
1561* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
1562* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
1563* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
1564* [List](list.html): What the purpose of this list is
1565* [Medication](medication.html): Returns medications for a specific code
1566* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
1567* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
1568* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
1569* [MedicationUsage](medicationusage.html): Return statements of this medication code
1570* [Observation](observation.html): The code of the observation type
1571* [Procedure](procedure.html): A code to identify a  procedure
1572* [ServiceRequest](servicerequest.html): What is being requested/ordered
1573</b><br>
1574   * Type: <b>token</b><br>
1575   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationUsage.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code</b><br>
1576   * </p>
1577   */
1578  @SearchParamDefinition(name="code", path="AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationUsage.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [Condition](condition.html): Code for the condition\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationUsage](medicationusage.html): Return statements of this medication code\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [ServiceRequest](servicerequest.html): What is being requested/ordered\r\n", type="token" )
1579  public static final String SP_CODE = "code";
1580 /**
1581   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1582   * <p>
1583   * Description: <b>Multiple Resources: 
1584
1585* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
1586* [Condition](condition.html): Code for the condition
1587* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
1588* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
1589* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
1590* [List](list.html): What the purpose of this list is
1591* [Medication](medication.html): Returns medications for a specific code
1592* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
1593* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
1594* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
1595* [MedicationUsage](medicationusage.html): Return statements of this medication code
1596* [Observation](observation.html): The code of the observation type
1597* [Procedure](procedure.html): A code to identify a  procedure
1598* [ServiceRequest](servicerequest.html): What is being requested/ordered
1599</b><br>
1600   * Type: <b>token</b><br>
1601   * Path: <b>AllergyIntolerance.code | AllergyIntolerance.reaction.substance | Condition.code | (DeviceRequest.code as CodeableConcept) | DiagnosticReport.code | FamilyMemberHistory.condition.code | List.code | Medication.code | (MedicationAdministration.medication as CodeableConcept) | (MedicationDispense.medication as CodeableConcept) | (MedicationRequest.medication as CodeableConcept) | (MedicationUsage.medication as CodeableConcept) | Observation.code | Procedure.code | ServiceRequest.code</b><br>
1602   * </p>
1603   */
1604  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1605
1606
1607}
1608