001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.
052 */
053@ResourceDef(name="NutritionOrder", profile="http://hl7.org/fhir/StructureDefinition/NutritionOrder")
054public class NutritionOrder extends DomainResource {
055
056    @Block()
057    public static class NutritionOrderOralDietComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.
060         */
061        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
062        @Description(shortDefinition="Type of oral diet or diet restrictions that describe what can be consumed orally", formalDefinition="The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet." )
063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/diet-type")
064        protected List<CodeableConcept> type;
065
066        /**
067         * The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.
068         */
069        @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
070        @Description(shortDefinition="Scheduled frequency of diet", formalDefinition="The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present." )
071        protected List<Timing> schedule;
072
073        /**
074         * Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.
075         */
076        @Child(name = "nutrient", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
077        @Description(shortDefinition="Required  nutrient modifications", formalDefinition="Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet." )
078        protected List<NutritionOrderOralDietNutrientComponent> nutrient;
079
080        /**
081         * Class that describes any texture modifications required for the patient to safely consume various types of solid foods.
082         */
083        @Child(name = "texture", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
084        @Description(shortDefinition="Required  texture modifications", formalDefinition="Class that describes any texture modifications required for the patient to safely consume various types of solid foods." )
085        protected List<NutritionOrderOralDietTextureComponent> texture;
086
087        /**
088         * The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.
089         */
090        @Child(name = "fluidConsistencyType", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
091        @Description(shortDefinition="The required consistency of fluids and liquids provided to the patient", formalDefinition="The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient." )
092        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consistency-type")
093        protected List<CodeableConcept> fluidConsistencyType;
094
095        /**
096         * Free text or additional instructions or information pertaining to the oral diet.
097         */
098        @Child(name = "instruction", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
099        @Description(shortDefinition="Instructions or additional information about the oral diet", formalDefinition="Free text or additional instructions or information pertaining to the oral diet." )
100        protected StringType instruction;
101
102        private static final long serialVersionUID = 973058412L;
103
104    /**
105     * Constructor
106     */
107      public NutritionOrderOralDietComponent() {
108        super();
109      }
110
111        /**
112         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
113         */
114        public List<CodeableConcept> getType() { 
115          if (this.type == null)
116            this.type = new ArrayList<CodeableConcept>();
117          return this.type;
118        }
119
120        /**
121         * @return Returns a reference to <code>this</code> for easy method chaining
122         */
123        public NutritionOrderOralDietComponent setType(List<CodeableConcept> theType) { 
124          this.type = theType;
125          return this;
126        }
127
128        public boolean hasType() { 
129          if (this.type == null)
130            return false;
131          for (CodeableConcept item : this.type)
132            if (!item.isEmpty())
133              return true;
134          return false;
135        }
136
137        public CodeableConcept addType() { //3
138          CodeableConcept t = new CodeableConcept();
139          if (this.type == null)
140            this.type = new ArrayList<CodeableConcept>();
141          this.type.add(t);
142          return t;
143        }
144
145        public NutritionOrderOralDietComponent addType(CodeableConcept t) { //3
146          if (t == null)
147            return this;
148          if (this.type == null)
149            this.type = new ArrayList<CodeableConcept>();
150          this.type.add(t);
151          return this;
152        }
153
154        /**
155         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
156         */
157        public CodeableConcept getTypeFirstRep() { 
158          if (getType().isEmpty()) {
159            addType();
160          }
161          return getType().get(0);
162        }
163
164        /**
165         * @return {@link #schedule} (The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.)
166         */
167        public List<Timing> getSchedule() { 
168          if (this.schedule == null)
169            this.schedule = new ArrayList<Timing>();
170          return this.schedule;
171        }
172
173        /**
174         * @return Returns a reference to <code>this</code> for easy method chaining
175         */
176        public NutritionOrderOralDietComponent setSchedule(List<Timing> theSchedule) { 
177          this.schedule = theSchedule;
178          return this;
179        }
180
181        public boolean hasSchedule() { 
182          if (this.schedule == null)
183            return false;
184          for (Timing item : this.schedule)
185            if (!item.isEmpty())
186              return true;
187          return false;
188        }
189
190        public Timing addSchedule() { //3
191          Timing t = new Timing();
192          if (this.schedule == null)
193            this.schedule = new ArrayList<Timing>();
194          this.schedule.add(t);
195          return t;
196        }
197
198        public NutritionOrderOralDietComponent addSchedule(Timing t) { //3
199          if (t == null)
200            return this;
201          if (this.schedule == null)
202            this.schedule = new ArrayList<Timing>();
203          this.schedule.add(t);
204          return this;
205        }
206
207        /**
208         * @return The first repetition of repeating field {@link #schedule}, creating it if it does not already exist {3}
209         */
210        public Timing getScheduleFirstRep() { 
211          if (getSchedule().isEmpty()) {
212            addSchedule();
213          }
214          return getSchedule().get(0);
215        }
216
217        /**
218         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.)
219         */
220        public List<NutritionOrderOralDietNutrientComponent> getNutrient() { 
221          if (this.nutrient == null)
222            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
223          return this.nutrient;
224        }
225
226        /**
227         * @return Returns a reference to <code>this</code> for easy method chaining
228         */
229        public NutritionOrderOralDietComponent setNutrient(List<NutritionOrderOralDietNutrientComponent> theNutrient) { 
230          this.nutrient = theNutrient;
231          return this;
232        }
233
234        public boolean hasNutrient() { 
235          if (this.nutrient == null)
236            return false;
237          for (NutritionOrderOralDietNutrientComponent item : this.nutrient)
238            if (!item.isEmpty())
239              return true;
240          return false;
241        }
242
243        public NutritionOrderOralDietNutrientComponent addNutrient() { //3
244          NutritionOrderOralDietNutrientComponent t = new NutritionOrderOralDietNutrientComponent();
245          if (this.nutrient == null)
246            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
247          this.nutrient.add(t);
248          return t;
249        }
250
251        public NutritionOrderOralDietComponent addNutrient(NutritionOrderOralDietNutrientComponent t) { //3
252          if (t == null)
253            return this;
254          if (this.nutrient == null)
255            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
256          this.nutrient.add(t);
257          return this;
258        }
259
260        /**
261         * @return The first repetition of repeating field {@link #nutrient}, creating it if it does not already exist {3}
262         */
263        public NutritionOrderOralDietNutrientComponent getNutrientFirstRep() { 
264          if (getNutrient().isEmpty()) {
265            addNutrient();
266          }
267          return getNutrient().get(0);
268        }
269
270        /**
271         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
272         */
273        public List<NutritionOrderOralDietTextureComponent> getTexture() { 
274          if (this.texture == null)
275            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
276          return this.texture;
277        }
278
279        /**
280         * @return Returns a reference to <code>this</code> for easy method chaining
281         */
282        public NutritionOrderOralDietComponent setTexture(List<NutritionOrderOralDietTextureComponent> theTexture) { 
283          this.texture = theTexture;
284          return this;
285        }
286
287        public boolean hasTexture() { 
288          if (this.texture == null)
289            return false;
290          for (NutritionOrderOralDietTextureComponent item : this.texture)
291            if (!item.isEmpty())
292              return true;
293          return false;
294        }
295
296        public NutritionOrderOralDietTextureComponent addTexture() { //3
297          NutritionOrderOralDietTextureComponent t = new NutritionOrderOralDietTextureComponent();
298          if (this.texture == null)
299            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
300          this.texture.add(t);
301          return t;
302        }
303
304        public NutritionOrderOralDietComponent addTexture(NutritionOrderOralDietTextureComponent t) { //3
305          if (t == null)
306            return this;
307          if (this.texture == null)
308            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
309          this.texture.add(t);
310          return this;
311        }
312
313        /**
314         * @return The first repetition of repeating field {@link #texture}, creating it if it does not already exist {3}
315         */
316        public NutritionOrderOralDietTextureComponent getTextureFirstRep() { 
317          if (getTexture().isEmpty()) {
318            addTexture();
319          }
320          return getTexture().get(0);
321        }
322
323        /**
324         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
325         */
326        public List<CodeableConcept> getFluidConsistencyType() { 
327          if (this.fluidConsistencyType == null)
328            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
329          return this.fluidConsistencyType;
330        }
331
332        /**
333         * @return Returns a reference to <code>this</code> for easy method chaining
334         */
335        public NutritionOrderOralDietComponent setFluidConsistencyType(List<CodeableConcept> theFluidConsistencyType) { 
336          this.fluidConsistencyType = theFluidConsistencyType;
337          return this;
338        }
339
340        public boolean hasFluidConsistencyType() { 
341          if (this.fluidConsistencyType == null)
342            return false;
343          for (CodeableConcept item : this.fluidConsistencyType)
344            if (!item.isEmpty())
345              return true;
346          return false;
347        }
348
349        public CodeableConcept addFluidConsistencyType() { //3
350          CodeableConcept t = new CodeableConcept();
351          if (this.fluidConsistencyType == null)
352            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
353          this.fluidConsistencyType.add(t);
354          return t;
355        }
356
357        public NutritionOrderOralDietComponent addFluidConsistencyType(CodeableConcept t) { //3
358          if (t == null)
359            return this;
360          if (this.fluidConsistencyType == null)
361            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
362          this.fluidConsistencyType.add(t);
363          return this;
364        }
365
366        /**
367         * @return The first repetition of repeating field {@link #fluidConsistencyType}, creating it if it does not already exist {3}
368         */
369        public CodeableConcept getFluidConsistencyTypeFirstRep() { 
370          if (getFluidConsistencyType().isEmpty()) {
371            addFluidConsistencyType();
372          }
373          return getFluidConsistencyType().get(0);
374        }
375
376        /**
377         * @return {@link #instruction} (Free text or additional instructions or information pertaining to the oral diet.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
378         */
379        public StringType getInstructionElement() { 
380          if (this.instruction == null)
381            if (Configuration.errorOnAutoCreate())
382              throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.instruction");
383            else if (Configuration.doAutoCreate())
384              this.instruction = new StringType(); // bb
385          return this.instruction;
386        }
387
388        public boolean hasInstructionElement() { 
389          return this.instruction != null && !this.instruction.isEmpty();
390        }
391
392        public boolean hasInstruction() { 
393          return this.instruction != null && !this.instruction.isEmpty();
394        }
395
396        /**
397         * @param value {@link #instruction} (Free text or additional instructions or information pertaining to the oral diet.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
398         */
399        public NutritionOrderOralDietComponent setInstructionElement(StringType value) { 
400          this.instruction = value;
401          return this;
402        }
403
404        /**
405         * @return Free text or additional instructions or information pertaining to the oral diet.
406         */
407        public String getInstruction() { 
408          return this.instruction == null ? null : this.instruction.getValue();
409        }
410
411        /**
412         * @param value Free text or additional instructions or information pertaining to the oral diet.
413         */
414        public NutritionOrderOralDietComponent setInstruction(String value) { 
415          if (Utilities.noString(value))
416            this.instruction = null;
417          else {
418            if (this.instruction == null)
419              this.instruction = new StringType();
420            this.instruction.setValue(value);
421          }
422          return this;
423        }
424
425        protected void listChildren(List<Property> children) {
426          super.listChildren(children);
427          children.add(new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type));
428          children.add(new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule));
429          children.add(new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient));
430          children.add(new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture));
431          children.add(new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType));
432          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction));
433        }
434
435        @Override
436        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
437          switch (_hash) {
438          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type);
439          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule);
440          case -1671151641: /*nutrient*/  return new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient);
441          case -1417816805: /*texture*/  return new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture);
442          case -525105592: /*fluidConsistencyType*/  return new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType);
443          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction);
444          default: return super.getNamedProperty(_hash, _name, _checkValid);
445          }
446
447        }
448
449      @Override
450      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
451        switch (hash) {
452        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
453        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
454        case -1671151641: /*nutrient*/ return this.nutrient == null ? new Base[0] : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionOrderOralDietNutrientComponent
455        case -1417816805: /*texture*/ return this.texture == null ? new Base[0] : this.texture.toArray(new Base[this.texture.size()]); // NutritionOrderOralDietTextureComponent
456        case -525105592: /*fluidConsistencyType*/ return this.fluidConsistencyType == null ? new Base[0] : this.fluidConsistencyType.toArray(new Base[this.fluidConsistencyType.size()]); // CodeableConcept
457        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
458        default: return super.getProperty(hash, name, checkValid);
459        }
460
461      }
462
463      @Override
464      public Base setProperty(int hash, String name, Base value) throws FHIRException {
465        switch (hash) {
466        case 3575610: // type
467          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
468          return value;
469        case -697920873: // schedule
470          this.getSchedule().add(TypeConvertor.castToTiming(value)); // Timing
471          return value;
472        case -1671151641: // nutrient
473          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value); // NutritionOrderOralDietNutrientComponent
474          return value;
475        case -1417816805: // texture
476          this.getTexture().add((NutritionOrderOralDietTextureComponent) value); // NutritionOrderOralDietTextureComponent
477          return value;
478        case -525105592: // fluidConsistencyType
479          this.getFluidConsistencyType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
480          return value;
481        case 301526158: // instruction
482          this.instruction = TypeConvertor.castToString(value); // StringType
483          return value;
484        default: return super.setProperty(hash, name, value);
485        }
486
487      }
488
489      @Override
490      public Base setProperty(String name, Base value) throws FHIRException {
491        if (name.equals("type")) {
492          this.getType().add(TypeConvertor.castToCodeableConcept(value));
493        } else if (name.equals("schedule")) {
494          this.getSchedule().add(TypeConvertor.castToTiming(value));
495        } else if (name.equals("nutrient")) {
496          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value);
497        } else if (name.equals("texture")) {
498          this.getTexture().add((NutritionOrderOralDietTextureComponent) value);
499        } else if (name.equals("fluidConsistencyType")) {
500          this.getFluidConsistencyType().add(TypeConvertor.castToCodeableConcept(value));
501        } else if (name.equals("instruction")) {
502          this.instruction = TypeConvertor.castToString(value); // StringType
503        } else
504          return super.setProperty(name, value);
505        return value;
506      }
507
508      @Override
509      public Base makeProperty(int hash, String name) throws FHIRException {
510        switch (hash) {
511        case 3575610:  return addType(); 
512        case -697920873:  return addSchedule(); 
513        case -1671151641:  return addNutrient(); 
514        case -1417816805:  return addTexture(); 
515        case -525105592:  return addFluidConsistencyType(); 
516        case 301526158:  return getInstructionElement();
517        default: return super.makeProperty(hash, name);
518        }
519
520      }
521
522      @Override
523      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
524        switch (hash) {
525        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
526        case -697920873: /*schedule*/ return new String[] {"Timing"};
527        case -1671151641: /*nutrient*/ return new String[] {};
528        case -1417816805: /*texture*/ return new String[] {};
529        case -525105592: /*fluidConsistencyType*/ return new String[] {"CodeableConcept"};
530        case 301526158: /*instruction*/ return new String[] {"string"};
531        default: return super.getTypesForProperty(hash, name);
532        }
533
534      }
535
536      @Override
537      public Base addChild(String name) throws FHIRException {
538        if (name.equals("type")) {
539          return addType();
540        }
541        else if (name.equals("schedule")) {
542          return addSchedule();
543        }
544        else if (name.equals("nutrient")) {
545          return addNutrient();
546        }
547        else if (name.equals("texture")) {
548          return addTexture();
549        }
550        else if (name.equals("fluidConsistencyType")) {
551          return addFluidConsistencyType();
552        }
553        else if (name.equals("instruction")) {
554          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.oralDiet.instruction");
555        }
556        else
557          return super.addChild(name);
558      }
559
560      public NutritionOrderOralDietComponent copy() {
561        NutritionOrderOralDietComponent dst = new NutritionOrderOralDietComponent();
562        copyValues(dst);
563        return dst;
564      }
565
566      public void copyValues(NutritionOrderOralDietComponent dst) {
567        super.copyValues(dst);
568        if (type != null) {
569          dst.type = new ArrayList<CodeableConcept>();
570          for (CodeableConcept i : type)
571            dst.type.add(i.copy());
572        };
573        if (schedule != null) {
574          dst.schedule = new ArrayList<Timing>();
575          for (Timing i : schedule)
576            dst.schedule.add(i.copy());
577        };
578        if (nutrient != null) {
579          dst.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
580          for (NutritionOrderOralDietNutrientComponent i : nutrient)
581            dst.nutrient.add(i.copy());
582        };
583        if (texture != null) {
584          dst.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
585          for (NutritionOrderOralDietTextureComponent i : texture)
586            dst.texture.add(i.copy());
587        };
588        if (fluidConsistencyType != null) {
589          dst.fluidConsistencyType = new ArrayList<CodeableConcept>();
590          for (CodeableConcept i : fluidConsistencyType)
591            dst.fluidConsistencyType.add(i.copy());
592        };
593        dst.instruction = instruction == null ? null : instruction.copy();
594      }
595
596      @Override
597      public boolean equalsDeep(Base other_) {
598        if (!super.equalsDeep(other_))
599          return false;
600        if (!(other_ instanceof NutritionOrderOralDietComponent))
601          return false;
602        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
603        return compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true) && compareDeep(nutrient, o.nutrient, true)
604           && compareDeep(texture, o.texture, true) && compareDeep(fluidConsistencyType, o.fluidConsistencyType, true)
605           && compareDeep(instruction, o.instruction, true);
606      }
607
608      @Override
609      public boolean equalsShallow(Base other_) {
610        if (!super.equalsShallow(other_))
611          return false;
612        if (!(other_ instanceof NutritionOrderOralDietComponent))
613          return false;
614        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
615        return compareValues(instruction, o.instruction, true);
616      }
617
618      public boolean isEmpty() {
619        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, schedule, nutrient
620          , texture, fluidConsistencyType, instruction);
621      }
622
623  public String fhirType() {
624    return "NutritionOrder.oralDiet";
625
626  }
627
628  }
629
630    @Block()
631    public static class NutritionOrderOralDietNutrientComponent extends BackboneElement implements IBaseBackboneElement {
632        /**
633         * The nutrient that is being modified such as carbohydrate or sodium.
634         */
635        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
636        @Description(shortDefinition="Type of nutrient that is being modified", formalDefinition="The nutrient that is being modified such as carbohydrate or sodium." )
637        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/nutrient-code")
638        protected CodeableConcept modifier;
639
640        /**
641         * The quantity of the specified nutrient to include in diet.
642         */
643        @Child(name = "amount", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
644        @Description(shortDefinition="Quantity of the specified nutrient", formalDefinition="The quantity of the specified nutrient to include in diet." )
645        protected Quantity amount;
646
647        private static final long serialVersionUID = 1042462093L;
648
649    /**
650     * Constructor
651     */
652      public NutritionOrderOralDietNutrientComponent() {
653        super();
654      }
655
656        /**
657         * @return {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
658         */
659        public CodeableConcept getModifier() { 
660          if (this.modifier == null)
661            if (Configuration.errorOnAutoCreate())
662              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.modifier");
663            else if (Configuration.doAutoCreate())
664              this.modifier = new CodeableConcept(); // cc
665          return this.modifier;
666        }
667
668        public boolean hasModifier() { 
669          return this.modifier != null && !this.modifier.isEmpty();
670        }
671
672        /**
673         * @param value {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
674         */
675        public NutritionOrderOralDietNutrientComponent setModifier(CodeableConcept value) { 
676          this.modifier = value;
677          return this;
678        }
679
680        /**
681         * @return {@link #amount} (The quantity of the specified nutrient to include in diet.)
682         */
683        public Quantity getAmount() { 
684          if (this.amount == null)
685            if (Configuration.errorOnAutoCreate())
686              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.amount");
687            else if (Configuration.doAutoCreate())
688              this.amount = new Quantity(); // cc
689          return this.amount;
690        }
691
692        public boolean hasAmount() { 
693          return this.amount != null && !this.amount.isEmpty();
694        }
695
696        /**
697         * @param value {@link #amount} (The quantity of the specified nutrient to include in diet.)
698         */
699        public NutritionOrderOralDietNutrientComponent setAmount(Quantity value) { 
700          this.amount = value;
701          return this;
702        }
703
704        protected void listChildren(List<Property> children) {
705          super.listChildren(children);
706          children.add(new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier));
707          children.add(new Property("amount", "Quantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount));
708        }
709
710        @Override
711        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
712          switch (_hash) {
713          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier);
714          case -1413853096: /*amount*/  return new Property("amount", "Quantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount);
715          default: return super.getNamedProperty(_hash, _name, _checkValid);
716          }
717
718        }
719
720      @Override
721      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
722        switch (hash) {
723        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
724        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Quantity
725        default: return super.getProperty(hash, name, checkValid);
726        }
727
728      }
729
730      @Override
731      public Base setProperty(int hash, String name, Base value) throws FHIRException {
732        switch (hash) {
733        case -615513385: // modifier
734          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
735          return value;
736        case -1413853096: // amount
737          this.amount = TypeConvertor.castToQuantity(value); // Quantity
738          return value;
739        default: return super.setProperty(hash, name, value);
740        }
741
742      }
743
744      @Override
745      public Base setProperty(String name, Base value) throws FHIRException {
746        if (name.equals("modifier")) {
747          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
748        } else if (name.equals("amount")) {
749          this.amount = TypeConvertor.castToQuantity(value); // Quantity
750        } else
751          return super.setProperty(name, value);
752        return value;
753      }
754
755      @Override
756      public Base makeProperty(int hash, String name) throws FHIRException {
757        switch (hash) {
758        case -615513385:  return getModifier();
759        case -1413853096:  return getAmount();
760        default: return super.makeProperty(hash, name);
761        }
762
763      }
764
765      @Override
766      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
767        switch (hash) {
768        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
769        case -1413853096: /*amount*/ return new String[] {"Quantity"};
770        default: return super.getTypesForProperty(hash, name);
771        }
772
773      }
774
775      @Override
776      public Base addChild(String name) throws FHIRException {
777        if (name.equals("modifier")) {
778          this.modifier = new CodeableConcept();
779          return this.modifier;
780        }
781        else if (name.equals("amount")) {
782          this.amount = new Quantity();
783          return this.amount;
784        }
785        else
786          return super.addChild(name);
787      }
788
789      public NutritionOrderOralDietNutrientComponent copy() {
790        NutritionOrderOralDietNutrientComponent dst = new NutritionOrderOralDietNutrientComponent();
791        copyValues(dst);
792        return dst;
793      }
794
795      public void copyValues(NutritionOrderOralDietNutrientComponent dst) {
796        super.copyValues(dst);
797        dst.modifier = modifier == null ? null : modifier.copy();
798        dst.amount = amount == null ? null : amount.copy();
799      }
800
801      @Override
802      public boolean equalsDeep(Base other_) {
803        if (!super.equalsDeep(other_))
804          return false;
805        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
806          return false;
807        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
808        return compareDeep(modifier, o.modifier, true) && compareDeep(amount, o.amount, true);
809      }
810
811      @Override
812      public boolean equalsShallow(Base other_) {
813        if (!super.equalsShallow(other_))
814          return false;
815        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
816          return false;
817        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
818        return true;
819      }
820
821      public boolean isEmpty() {
822        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, amount);
823      }
824
825  public String fhirType() {
826    return "NutritionOrder.oralDiet.nutrient";
827
828  }
829
830  }
831
832    @Block()
833    public static class NutritionOrderOralDietTextureComponent extends BackboneElement implements IBaseBackboneElement {
834        /**
835         * Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.
836         */
837        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
838        @Description(shortDefinition="Code to indicate how to alter the texture of the foods, e.g. pureed", formalDefinition="Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed." )
839        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/texture-code")
840        protected CodeableConcept modifier;
841
842        /**
843         * The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.
844         */
845        @Child(name = "foodType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
846        @Description(shortDefinition="Concepts that are used to identify an entity that is ingested for nutritional purposes", formalDefinition="The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types." )
847        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/modified-foodtype")
848        protected CodeableConcept foodType;
849
850        private static final long serialVersionUID = -56402817L;
851
852    /**
853     * Constructor
854     */
855      public NutritionOrderOralDietTextureComponent() {
856        super();
857      }
858
859        /**
860         * @return {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
861         */
862        public CodeableConcept getModifier() { 
863          if (this.modifier == null)
864            if (Configuration.errorOnAutoCreate())
865              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.modifier");
866            else if (Configuration.doAutoCreate())
867              this.modifier = new CodeableConcept(); // cc
868          return this.modifier;
869        }
870
871        public boolean hasModifier() { 
872          return this.modifier != null && !this.modifier.isEmpty();
873        }
874
875        /**
876         * @param value {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
877         */
878        public NutritionOrderOralDietTextureComponent setModifier(CodeableConcept value) { 
879          this.modifier = value;
880          return this;
881        }
882
883        /**
884         * @return {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
885         */
886        public CodeableConcept getFoodType() { 
887          if (this.foodType == null)
888            if (Configuration.errorOnAutoCreate())
889              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.foodType");
890            else if (Configuration.doAutoCreate())
891              this.foodType = new CodeableConcept(); // cc
892          return this.foodType;
893        }
894
895        public boolean hasFoodType() { 
896          return this.foodType != null && !this.foodType.isEmpty();
897        }
898
899        /**
900         * @param value {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
901         */
902        public NutritionOrderOralDietTextureComponent setFoodType(CodeableConcept value) { 
903          this.foodType = value;
904          return this;
905        }
906
907        protected void listChildren(List<Property> children) {
908          super.listChildren(children);
909          children.add(new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier));
910          children.add(new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType));
911        }
912
913        @Override
914        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
915          switch (_hash) {
916          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier);
917          case 379498680: /*foodType*/  return new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType);
918          default: return super.getNamedProperty(_hash, _name, _checkValid);
919          }
920
921        }
922
923      @Override
924      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
925        switch (hash) {
926        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
927        case 379498680: /*foodType*/ return this.foodType == null ? new Base[0] : new Base[] {this.foodType}; // CodeableConcept
928        default: return super.getProperty(hash, name, checkValid);
929        }
930
931      }
932
933      @Override
934      public Base setProperty(int hash, String name, Base value) throws FHIRException {
935        switch (hash) {
936        case -615513385: // modifier
937          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
938          return value;
939        case 379498680: // foodType
940          this.foodType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
941          return value;
942        default: return super.setProperty(hash, name, value);
943        }
944
945      }
946
947      @Override
948      public Base setProperty(String name, Base value) throws FHIRException {
949        if (name.equals("modifier")) {
950          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
951        } else if (name.equals("foodType")) {
952          this.foodType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
953        } else
954          return super.setProperty(name, value);
955        return value;
956      }
957
958      @Override
959      public Base makeProperty(int hash, String name) throws FHIRException {
960        switch (hash) {
961        case -615513385:  return getModifier();
962        case 379498680:  return getFoodType();
963        default: return super.makeProperty(hash, name);
964        }
965
966      }
967
968      @Override
969      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
970        switch (hash) {
971        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
972        case 379498680: /*foodType*/ return new String[] {"CodeableConcept"};
973        default: return super.getTypesForProperty(hash, name);
974        }
975
976      }
977
978      @Override
979      public Base addChild(String name) throws FHIRException {
980        if (name.equals("modifier")) {
981          this.modifier = new CodeableConcept();
982          return this.modifier;
983        }
984        else if (name.equals("foodType")) {
985          this.foodType = new CodeableConcept();
986          return this.foodType;
987        }
988        else
989          return super.addChild(name);
990      }
991
992      public NutritionOrderOralDietTextureComponent copy() {
993        NutritionOrderOralDietTextureComponent dst = new NutritionOrderOralDietTextureComponent();
994        copyValues(dst);
995        return dst;
996      }
997
998      public void copyValues(NutritionOrderOralDietTextureComponent dst) {
999        super.copyValues(dst);
1000        dst.modifier = modifier == null ? null : modifier.copy();
1001        dst.foodType = foodType == null ? null : foodType.copy();
1002      }
1003
1004      @Override
1005      public boolean equalsDeep(Base other_) {
1006        if (!super.equalsDeep(other_))
1007          return false;
1008        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1009          return false;
1010        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1011        return compareDeep(modifier, o.modifier, true) && compareDeep(foodType, o.foodType, true);
1012      }
1013
1014      @Override
1015      public boolean equalsShallow(Base other_) {
1016        if (!super.equalsShallow(other_))
1017          return false;
1018        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1019          return false;
1020        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1021        return true;
1022      }
1023
1024      public boolean isEmpty() {
1025        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, foodType);
1026      }
1027
1028  public String fhirType() {
1029    return "NutritionOrder.oralDiet.texture";
1030
1031  }
1032
1033  }
1034
1035    @Block()
1036    public static class NutritionOrderSupplementComponent extends BackboneElement implements IBaseBackboneElement {
1037        /**
1038         * The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.
1039         */
1040        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1041        @Description(shortDefinition="Type of supplement product requested", formalDefinition="The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement." )
1042        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplement-type")
1043        protected CodeableConcept type;
1044
1045        /**
1046         * The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1047         */
1048        @Child(name = "productName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1049        @Description(shortDefinition="Product or brand name of the nutritional supplement", formalDefinition="The product or brand name of the nutritional supplement such as \"Acme Protein Shake\"." )
1050        protected StringType productName;
1051
1052        /**
1053         * The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.
1054         */
1055        @Child(name = "schedule", type = {Timing.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1056        @Description(shortDefinition="Scheduled frequency of supplement", formalDefinition="The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present." )
1057        protected List<Timing> schedule;
1058
1059        /**
1060         * The amount of the nutritional supplement to be given.
1061         */
1062        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
1063        @Description(shortDefinition="Amount of the nutritional supplement", formalDefinition="The amount of the nutritional supplement to be given." )
1064        protected Quantity quantity;
1065
1066        /**
1067         * Free text or additional instructions or information pertaining to the oral supplement.
1068         */
1069        @Child(name = "instruction", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1070        @Description(shortDefinition="Instructions or additional information about the oral supplement", formalDefinition="Free text or additional instructions or information pertaining to the oral supplement." )
1071        protected StringType instruction;
1072
1073        private static final long serialVersionUID = -37646618L;
1074
1075    /**
1076     * Constructor
1077     */
1078      public NutritionOrderSupplementComponent() {
1079        super();
1080      }
1081
1082        /**
1083         * @return {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1084         */
1085        public CodeableConcept getType() { 
1086          if (this.type == null)
1087            if (Configuration.errorOnAutoCreate())
1088              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.type");
1089            else if (Configuration.doAutoCreate())
1090              this.type = new CodeableConcept(); // cc
1091          return this.type;
1092        }
1093
1094        public boolean hasType() { 
1095          return this.type != null && !this.type.isEmpty();
1096        }
1097
1098        /**
1099         * @param value {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1100         */
1101        public NutritionOrderSupplementComponent setType(CodeableConcept value) { 
1102          this.type = value;
1103          return this;
1104        }
1105
1106        /**
1107         * @return {@link #productName} (The product or brand name of the nutritional supplement such as "Acme Protein Shake".). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
1108         */
1109        public StringType getProductNameElement() { 
1110          if (this.productName == null)
1111            if (Configuration.errorOnAutoCreate())
1112              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.productName");
1113            else if (Configuration.doAutoCreate())
1114              this.productName = new StringType(); // bb
1115          return this.productName;
1116        }
1117
1118        public boolean hasProductNameElement() { 
1119          return this.productName != null && !this.productName.isEmpty();
1120        }
1121
1122        public boolean hasProductName() { 
1123          return this.productName != null && !this.productName.isEmpty();
1124        }
1125
1126        /**
1127         * @param value {@link #productName} (The product or brand name of the nutritional supplement such as "Acme Protein Shake".). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
1128         */
1129        public NutritionOrderSupplementComponent setProductNameElement(StringType value) { 
1130          this.productName = value;
1131          return this;
1132        }
1133
1134        /**
1135         * @return The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1136         */
1137        public String getProductName() { 
1138          return this.productName == null ? null : this.productName.getValue();
1139        }
1140
1141        /**
1142         * @param value The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1143         */
1144        public NutritionOrderSupplementComponent setProductName(String value) { 
1145          if (Utilities.noString(value))
1146            this.productName = null;
1147          else {
1148            if (this.productName == null)
1149              this.productName = new StringType();
1150            this.productName.setValue(value);
1151          }
1152          return this;
1153        }
1154
1155        /**
1156         * @return {@link #schedule} (The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.)
1157         */
1158        public List<Timing> getSchedule() { 
1159          if (this.schedule == null)
1160            this.schedule = new ArrayList<Timing>();
1161          return this.schedule;
1162        }
1163
1164        /**
1165         * @return Returns a reference to <code>this</code> for easy method chaining
1166         */
1167        public NutritionOrderSupplementComponent setSchedule(List<Timing> theSchedule) { 
1168          this.schedule = theSchedule;
1169          return this;
1170        }
1171
1172        public boolean hasSchedule() { 
1173          if (this.schedule == null)
1174            return false;
1175          for (Timing item : this.schedule)
1176            if (!item.isEmpty())
1177              return true;
1178          return false;
1179        }
1180
1181        public Timing addSchedule() { //3
1182          Timing t = new Timing();
1183          if (this.schedule == null)
1184            this.schedule = new ArrayList<Timing>();
1185          this.schedule.add(t);
1186          return t;
1187        }
1188
1189        public NutritionOrderSupplementComponent addSchedule(Timing t) { //3
1190          if (t == null)
1191            return this;
1192          if (this.schedule == null)
1193            this.schedule = new ArrayList<Timing>();
1194          this.schedule.add(t);
1195          return this;
1196        }
1197
1198        /**
1199         * @return The first repetition of repeating field {@link #schedule}, creating it if it does not already exist {3}
1200         */
1201        public Timing getScheduleFirstRep() { 
1202          if (getSchedule().isEmpty()) {
1203            addSchedule();
1204          }
1205          return getSchedule().get(0);
1206        }
1207
1208        /**
1209         * @return {@link #quantity} (The amount of the nutritional supplement to be given.)
1210         */
1211        public Quantity getQuantity() { 
1212          if (this.quantity == null)
1213            if (Configuration.errorOnAutoCreate())
1214              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.quantity");
1215            else if (Configuration.doAutoCreate())
1216              this.quantity = new Quantity(); // cc
1217          return this.quantity;
1218        }
1219
1220        public boolean hasQuantity() { 
1221          return this.quantity != null && !this.quantity.isEmpty();
1222        }
1223
1224        /**
1225         * @param value {@link #quantity} (The amount of the nutritional supplement to be given.)
1226         */
1227        public NutritionOrderSupplementComponent setQuantity(Quantity value) { 
1228          this.quantity = value;
1229          return this;
1230        }
1231
1232        /**
1233         * @return {@link #instruction} (Free text or additional instructions or information pertaining to the oral supplement.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1234         */
1235        public StringType getInstructionElement() { 
1236          if (this.instruction == null)
1237            if (Configuration.errorOnAutoCreate())
1238              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.instruction");
1239            else if (Configuration.doAutoCreate())
1240              this.instruction = new StringType(); // bb
1241          return this.instruction;
1242        }
1243
1244        public boolean hasInstructionElement() { 
1245          return this.instruction != null && !this.instruction.isEmpty();
1246        }
1247
1248        public boolean hasInstruction() { 
1249          return this.instruction != null && !this.instruction.isEmpty();
1250        }
1251
1252        /**
1253         * @param value {@link #instruction} (Free text or additional instructions or information pertaining to the oral supplement.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1254         */
1255        public NutritionOrderSupplementComponent setInstructionElement(StringType value) { 
1256          this.instruction = value;
1257          return this;
1258        }
1259
1260        /**
1261         * @return Free text or additional instructions or information pertaining to the oral supplement.
1262         */
1263        public String getInstruction() { 
1264          return this.instruction == null ? null : this.instruction.getValue();
1265        }
1266
1267        /**
1268         * @param value Free text or additional instructions or information pertaining to the oral supplement.
1269         */
1270        public NutritionOrderSupplementComponent setInstruction(String value) { 
1271          if (Utilities.noString(value))
1272            this.instruction = null;
1273          else {
1274            if (this.instruction == null)
1275              this.instruction = new StringType();
1276            this.instruction.setValue(value);
1277          }
1278          return this;
1279        }
1280
1281        protected void listChildren(List<Property> children) {
1282          super.listChildren(children);
1283          children.add(new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type));
1284          children.add(new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName));
1285          children.add(new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule));
1286          children.add(new Property("quantity", "Quantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity));
1287          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction));
1288        }
1289
1290        @Override
1291        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1292          switch (_hash) {
1293          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type);
1294          case -1491817446: /*productName*/  return new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName);
1295          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule);
1296          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity);
1297          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction);
1298          default: return super.getNamedProperty(_hash, _name, _checkValid);
1299          }
1300
1301        }
1302
1303      @Override
1304      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1305        switch (hash) {
1306        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1307        case -1491817446: /*productName*/ return this.productName == null ? new Base[0] : new Base[] {this.productName}; // StringType
1308        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
1309        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1310        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
1311        default: return super.getProperty(hash, name, checkValid);
1312        }
1313
1314      }
1315
1316      @Override
1317      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1318        switch (hash) {
1319        case 3575610: // type
1320          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1321          return value;
1322        case -1491817446: // productName
1323          this.productName = TypeConvertor.castToString(value); // StringType
1324          return value;
1325        case -697920873: // schedule
1326          this.getSchedule().add(TypeConvertor.castToTiming(value)); // Timing
1327          return value;
1328        case -1285004149: // quantity
1329          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1330          return value;
1331        case 301526158: // instruction
1332          this.instruction = TypeConvertor.castToString(value); // StringType
1333          return value;
1334        default: return super.setProperty(hash, name, value);
1335        }
1336
1337      }
1338
1339      @Override
1340      public Base setProperty(String name, Base value) throws FHIRException {
1341        if (name.equals("type")) {
1342          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1343        } else if (name.equals("productName")) {
1344          this.productName = TypeConvertor.castToString(value); // StringType
1345        } else if (name.equals("schedule")) {
1346          this.getSchedule().add(TypeConvertor.castToTiming(value));
1347        } else if (name.equals("quantity")) {
1348          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1349        } else if (name.equals("instruction")) {
1350          this.instruction = TypeConvertor.castToString(value); // StringType
1351        } else
1352          return super.setProperty(name, value);
1353        return value;
1354      }
1355
1356      @Override
1357      public Base makeProperty(int hash, String name) throws FHIRException {
1358        switch (hash) {
1359        case 3575610:  return getType();
1360        case -1491817446:  return getProductNameElement();
1361        case -697920873:  return addSchedule(); 
1362        case -1285004149:  return getQuantity();
1363        case 301526158:  return getInstructionElement();
1364        default: return super.makeProperty(hash, name);
1365        }
1366
1367      }
1368
1369      @Override
1370      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1371        switch (hash) {
1372        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1373        case -1491817446: /*productName*/ return new String[] {"string"};
1374        case -697920873: /*schedule*/ return new String[] {"Timing"};
1375        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1376        case 301526158: /*instruction*/ return new String[] {"string"};
1377        default: return super.getTypesForProperty(hash, name);
1378        }
1379
1380      }
1381
1382      @Override
1383      public Base addChild(String name) throws FHIRException {
1384        if (name.equals("type")) {
1385          this.type = new CodeableConcept();
1386          return this.type;
1387        }
1388        else if (name.equals("productName")) {
1389          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.supplement.productName");
1390        }
1391        else if (name.equals("schedule")) {
1392          return addSchedule();
1393        }
1394        else if (name.equals("quantity")) {
1395          this.quantity = new Quantity();
1396          return this.quantity;
1397        }
1398        else if (name.equals("instruction")) {
1399          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.supplement.instruction");
1400        }
1401        else
1402          return super.addChild(name);
1403      }
1404
1405      public NutritionOrderSupplementComponent copy() {
1406        NutritionOrderSupplementComponent dst = new NutritionOrderSupplementComponent();
1407        copyValues(dst);
1408        return dst;
1409      }
1410
1411      public void copyValues(NutritionOrderSupplementComponent dst) {
1412        super.copyValues(dst);
1413        dst.type = type == null ? null : type.copy();
1414        dst.productName = productName == null ? null : productName.copy();
1415        if (schedule != null) {
1416          dst.schedule = new ArrayList<Timing>();
1417          for (Timing i : schedule)
1418            dst.schedule.add(i.copy());
1419        };
1420        dst.quantity = quantity == null ? null : quantity.copy();
1421        dst.instruction = instruction == null ? null : instruction.copy();
1422      }
1423
1424      @Override
1425      public boolean equalsDeep(Base other_) {
1426        if (!super.equalsDeep(other_))
1427          return false;
1428        if (!(other_ instanceof NutritionOrderSupplementComponent))
1429          return false;
1430        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1431        return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true) && compareDeep(schedule, o.schedule, true)
1432           && compareDeep(quantity, o.quantity, true) && compareDeep(instruction, o.instruction, true);
1433      }
1434
1435      @Override
1436      public boolean equalsShallow(Base other_) {
1437        if (!super.equalsShallow(other_))
1438          return false;
1439        if (!(other_ instanceof NutritionOrderSupplementComponent))
1440          return false;
1441        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1442        return compareValues(productName, o.productName, true) && compareValues(instruction, o.instruction, true)
1443          ;
1444      }
1445
1446      public boolean isEmpty() {
1447        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, productName, schedule
1448          , quantity, instruction);
1449      }
1450
1451  public String fhirType() {
1452    return "NutritionOrder.supplement";
1453
1454  }
1455
1456  }
1457
1458    @Block()
1459    public static class NutritionOrderEnteralFormulaComponent extends BackboneElement implements IBaseBackboneElement {
1460        /**
1461         * The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.
1462         */
1463        @Child(name = "baseFormulaType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1464        @Description(shortDefinition="Type of enteral or infant formula", formalDefinition="The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula." )
1465        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-type")
1466        protected CodeableConcept baseFormulaType;
1467
1468        /**
1469         * The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1470         */
1471        @Child(name = "baseFormulaProductName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1472        @Description(shortDefinition="Product or brand name of the enteral or infant formula", formalDefinition="The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\"." )
1473        protected StringType baseFormulaProductName;
1474
1475        /**
1476         * Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.
1477         */
1478        @Child(name = "additiveType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1479        @Description(shortDefinition="Type of modular component to add to the feeding", formalDefinition="Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula." )
1480        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-additive")
1481        protected CodeableConcept additiveType;
1482
1483        /**
1484         * The product or brand name of the type of modular component to be added to the formula.
1485         */
1486        @Child(name = "additiveProductName", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1487        @Description(shortDefinition="Product or brand name of the modular additive", formalDefinition="The product or brand name of the type of modular component to be added to the formula." )
1488        protected StringType additiveProductName;
1489
1490        /**
1491         * The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.
1492         */
1493        @Child(name = "caloricDensity", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
1494        @Description(shortDefinition="Amount of energy per specified volume that is required", formalDefinition="The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL." )
1495        protected Quantity caloricDensity;
1496
1497        /**
1498         * The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.
1499         */
1500        @Child(name = "routeofAdministration", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1501        @Description(shortDefinition="How the formula should enter the patient's gastrointestinal tract", formalDefinition="The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube." )
1502        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/enteral-route")
1503        protected CodeableConcept routeofAdministration;
1504
1505        /**
1506         * Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.
1507         */
1508        @Child(name = "administration", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1509        @Description(shortDefinition="Formula feeding instruction as structured data", formalDefinition="Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours." )
1510        protected List<NutritionOrderEnteralFormulaAdministrationComponent> administration;
1511
1512        /**
1513         * The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.
1514         */
1515        @Child(name = "maxVolumeToDeliver", type = {Quantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
1516        @Description(shortDefinition="Upper limit on formula volume per unit of time", formalDefinition="The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours." )
1517        protected Quantity maxVolumeToDeliver;
1518
1519        /**
1520         * Free text formula administration, feeding instructions or additional instructions or information.
1521         */
1522        @Child(name = "administrationInstruction", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1523        @Description(shortDefinition="Formula feeding instructions expressed as text", formalDefinition="Free text formula administration, feeding instructions or additional instructions or information." )
1524        protected StringType administrationInstruction;
1525
1526        private static final long serialVersionUID = -124511395L;
1527
1528    /**
1529     * Constructor
1530     */
1531      public NutritionOrderEnteralFormulaComponent() {
1532        super();
1533      }
1534
1535        /**
1536         * @return {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
1537         */
1538        public CodeableConcept getBaseFormulaType() { 
1539          if (this.baseFormulaType == null)
1540            if (Configuration.errorOnAutoCreate())
1541              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaType");
1542            else if (Configuration.doAutoCreate())
1543              this.baseFormulaType = new CodeableConcept(); // cc
1544          return this.baseFormulaType;
1545        }
1546
1547        public boolean hasBaseFormulaType() { 
1548          return this.baseFormulaType != null && !this.baseFormulaType.isEmpty();
1549        }
1550
1551        /**
1552         * @param value {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
1553         */
1554        public NutritionOrderEnteralFormulaComponent setBaseFormulaType(CodeableConcept value) { 
1555          this.baseFormulaType = value;
1556          return this;
1557        }
1558
1559        /**
1560         * @return {@link #baseFormulaProductName} (The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".). This is the underlying object with id, value and extensions. The accessor "getBaseFormulaProductName" gives direct access to the value
1561         */
1562        public StringType getBaseFormulaProductNameElement() { 
1563          if (this.baseFormulaProductName == null)
1564            if (Configuration.errorOnAutoCreate())
1565              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaProductName");
1566            else if (Configuration.doAutoCreate())
1567              this.baseFormulaProductName = new StringType(); // bb
1568          return this.baseFormulaProductName;
1569        }
1570
1571        public boolean hasBaseFormulaProductNameElement() { 
1572          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1573        }
1574
1575        public boolean hasBaseFormulaProductName() { 
1576          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1577        }
1578
1579        /**
1580         * @param value {@link #baseFormulaProductName} (The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".). This is the underlying object with id, value and extensions. The accessor "getBaseFormulaProductName" gives direct access to the value
1581         */
1582        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductNameElement(StringType value) { 
1583          this.baseFormulaProductName = value;
1584          return this;
1585        }
1586
1587        /**
1588         * @return The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1589         */
1590        public String getBaseFormulaProductName() { 
1591          return this.baseFormulaProductName == null ? null : this.baseFormulaProductName.getValue();
1592        }
1593
1594        /**
1595         * @param value The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1596         */
1597        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductName(String value) { 
1598          if (Utilities.noString(value))
1599            this.baseFormulaProductName = null;
1600          else {
1601            if (this.baseFormulaProductName == null)
1602              this.baseFormulaProductName = new StringType();
1603            this.baseFormulaProductName.setValue(value);
1604          }
1605          return this;
1606        }
1607
1608        /**
1609         * @return {@link #additiveType} (Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.)
1610         */
1611        public CodeableConcept getAdditiveType() { 
1612          if (this.additiveType == null)
1613            if (Configuration.errorOnAutoCreate())
1614              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveType");
1615            else if (Configuration.doAutoCreate())
1616              this.additiveType = new CodeableConcept(); // cc
1617          return this.additiveType;
1618        }
1619
1620        public boolean hasAdditiveType() { 
1621          return this.additiveType != null && !this.additiveType.isEmpty();
1622        }
1623
1624        /**
1625         * @param value {@link #additiveType} (Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.)
1626         */
1627        public NutritionOrderEnteralFormulaComponent setAdditiveType(CodeableConcept value) { 
1628          this.additiveType = value;
1629          return this;
1630        }
1631
1632        /**
1633         * @return {@link #additiveProductName} (The product or brand name of the type of modular component to be added to the formula.). This is the underlying object with id, value and extensions. The accessor "getAdditiveProductName" gives direct access to the value
1634         */
1635        public StringType getAdditiveProductNameElement() { 
1636          if (this.additiveProductName == null)
1637            if (Configuration.errorOnAutoCreate())
1638              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveProductName");
1639            else if (Configuration.doAutoCreate())
1640              this.additiveProductName = new StringType(); // bb
1641          return this.additiveProductName;
1642        }
1643
1644        public boolean hasAdditiveProductNameElement() { 
1645          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1646        }
1647
1648        public boolean hasAdditiveProductName() { 
1649          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1650        }
1651
1652        /**
1653         * @param value {@link #additiveProductName} (The product or brand name of the type of modular component to be added to the formula.). This is the underlying object with id, value and extensions. The accessor "getAdditiveProductName" gives direct access to the value
1654         */
1655        public NutritionOrderEnteralFormulaComponent setAdditiveProductNameElement(StringType value) { 
1656          this.additiveProductName = value;
1657          return this;
1658        }
1659
1660        /**
1661         * @return The product or brand name of the type of modular component to be added to the formula.
1662         */
1663        public String getAdditiveProductName() { 
1664          return this.additiveProductName == null ? null : this.additiveProductName.getValue();
1665        }
1666
1667        /**
1668         * @param value The product or brand name of the type of modular component to be added to the formula.
1669         */
1670        public NutritionOrderEnteralFormulaComponent setAdditiveProductName(String value) { 
1671          if (Utilities.noString(value))
1672            this.additiveProductName = null;
1673          else {
1674            if (this.additiveProductName == null)
1675              this.additiveProductName = new StringType();
1676            this.additiveProductName.setValue(value);
1677          }
1678          return this;
1679        }
1680
1681        /**
1682         * @return {@link #caloricDensity} (The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.)
1683         */
1684        public Quantity getCaloricDensity() { 
1685          if (this.caloricDensity == null)
1686            if (Configuration.errorOnAutoCreate())
1687              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.caloricDensity");
1688            else if (Configuration.doAutoCreate())
1689              this.caloricDensity = new Quantity(); // cc
1690          return this.caloricDensity;
1691        }
1692
1693        public boolean hasCaloricDensity() { 
1694          return this.caloricDensity != null && !this.caloricDensity.isEmpty();
1695        }
1696
1697        /**
1698         * @param value {@link #caloricDensity} (The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.)
1699         */
1700        public NutritionOrderEnteralFormulaComponent setCaloricDensity(Quantity value) { 
1701          this.caloricDensity = value;
1702          return this;
1703        }
1704
1705        /**
1706         * @return {@link #routeofAdministration} (The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.)
1707         */
1708        public CodeableConcept getRouteofAdministration() { 
1709          if (this.routeofAdministration == null)
1710            if (Configuration.errorOnAutoCreate())
1711              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.routeofAdministration");
1712            else if (Configuration.doAutoCreate())
1713              this.routeofAdministration = new CodeableConcept(); // cc
1714          return this.routeofAdministration;
1715        }
1716
1717        public boolean hasRouteofAdministration() { 
1718          return this.routeofAdministration != null && !this.routeofAdministration.isEmpty();
1719        }
1720
1721        /**
1722         * @param value {@link #routeofAdministration} (The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.)
1723         */
1724        public NutritionOrderEnteralFormulaComponent setRouteofAdministration(CodeableConcept value) { 
1725          this.routeofAdministration = value;
1726          return this;
1727        }
1728
1729        /**
1730         * @return {@link #administration} (Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.)
1731         */
1732        public List<NutritionOrderEnteralFormulaAdministrationComponent> getAdministration() { 
1733          if (this.administration == null)
1734            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1735          return this.administration;
1736        }
1737
1738        /**
1739         * @return Returns a reference to <code>this</code> for easy method chaining
1740         */
1741        public NutritionOrderEnteralFormulaComponent setAdministration(List<NutritionOrderEnteralFormulaAdministrationComponent> theAdministration) { 
1742          this.administration = theAdministration;
1743          return this;
1744        }
1745
1746        public boolean hasAdministration() { 
1747          if (this.administration == null)
1748            return false;
1749          for (NutritionOrderEnteralFormulaAdministrationComponent item : this.administration)
1750            if (!item.isEmpty())
1751              return true;
1752          return false;
1753        }
1754
1755        public NutritionOrderEnteralFormulaAdministrationComponent addAdministration() { //3
1756          NutritionOrderEnteralFormulaAdministrationComponent t = new NutritionOrderEnteralFormulaAdministrationComponent();
1757          if (this.administration == null)
1758            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1759          this.administration.add(t);
1760          return t;
1761        }
1762
1763        public NutritionOrderEnteralFormulaComponent addAdministration(NutritionOrderEnteralFormulaAdministrationComponent t) { //3
1764          if (t == null)
1765            return this;
1766          if (this.administration == null)
1767            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1768          this.administration.add(t);
1769          return this;
1770        }
1771
1772        /**
1773         * @return The first repetition of repeating field {@link #administration}, creating it if it does not already exist {3}
1774         */
1775        public NutritionOrderEnteralFormulaAdministrationComponent getAdministrationFirstRep() { 
1776          if (getAdministration().isEmpty()) {
1777            addAdministration();
1778          }
1779          return getAdministration().get(0);
1780        }
1781
1782        /**
1783         * @return {@link #maxVolumeToDeliver} (The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.)
1784         */
1785        public Quantity getMaxVolumeToDeliver() { 
1786          if (this.maxVolumeToDeliver == null)
1787            if (Configuration.errorOnAutoCreate())
1788              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.maxVolumeToDeliver");
1789            else if (Configuration.doAutoCreate())
1790              this.maxVolumeToDeliver = new Quantity(); // cc
1791          return this.maxVolumeToDeliver;
1792        }
1793
1794        public boolean hasMaxVolumeToDeliver() { 
1795          return this.maxVolumeToDeliver != null && !this.maxVolumeToDeliver.isEmpty();
1796        }
1797
1798        /**
1799         * @param value {@link #maxVolumeToDeliver} (The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.)
1800         */
1801        public NutritionOrderEnteralFormulaComponent setMaxVolumeToDeliver(Quantity value) { 
1802          this.maxVolumeToDeliver = value;
1803          return this;
1804        }
1805
1806        /**
1807         * @return {@link #administrationInstruction} (Free text formula administration, feeding instructions or additional instructions or information.). This is the underlying object with id, value and extensions. The accessor "getAdministrationInstruction" gives direct access to the value
1808         */
1809        public StringType getAdministrationInstructionElement() { 
1810          if (this.administrationInstruction == null)
1811            if (Configuration.errorOnAutoCreate())
1812              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.administrationInstruction");
1813            else if (Configuration.doAutoCreate())
1814              this.administrationInstruction = new StringType(); // bb
1815          return this.administrationInstruction;
1816        }
1817
1818        public boolean hasAdministrationInstructionElement() { 
1819          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
1820        }
1821
1822        public boolean hasAdministrationInstruction() { 
1823          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
1824        }
1825
1826        /**
1827         * @param value {@link #administrationInstruction} (Free text formula administration, feeding instructions or additional instructions or information.). This is the underlying object with id, value and extensions. The accessor "getAdministrationInstruction" gives direct access to the value
1828         */
1829        public NutritionOrderEnteralFormulaComponent setAdministrationInstructionElement(StringType value) { 
1830          this.administrationInstruction = value;
1831          return this;
1832        }
1833
1834        /**
1835         * @return Free text formula administration, feeding instructions or additional instructions or information.
1836         */
1837        public String getAdministrationInstruction() { 
1838          return this.administrationInstruction == null ? null : this.administrationInstruction.getValue();
1839        }
1840
1841        /**
1842         * @param value Free text formula administration, feeding instructions or additional instructions or information.
1843         */
1844        public NutritionOrderEnteralFormulaComponent setAdministrationInstruction(String value) { 
1845          if (Utilities.noString(value))
1846            this.administrationInstruction = null;
1847          else {
1848            if (this.administrationInstruction == null)
1849              this.administrationInstruction = new StringType();
1850            this.administrationInstruction.setValue(value);
1851          }
1852          return this;
1853        }
1854
1855        protected void listChildren(List<Property> children) {
1856          super.listChildren(children);
1857          children.add(new Property("baseFormulaType", "CodeableConcept", "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.", 0, 1, baseFormulaType));
1858          children.add(new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName));
1859          children.add(new Property("additiveType", "CodeableConcept", "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.", 0, 1, additiveType));
1860          children.add(new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, additiveProductName));
1861          children.add(new Property("caloricDensity", "Quantity", "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.", 0, 1, caloricDensity));
1862          children.add(new Property("routeofAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeofAdministration));
1863          children.add(new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration));
1864          children.add(new Property("maxVolumeToDeliver", "Quantity", "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.", 0, 1, maxVolumeToDeliver));
1865          children.add(new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction));
1866        }
1867
1868        @Override
1869        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1870          switch (_hash) {
1871          case -138930641: /*baseFormulaType*/  return new Property("baseFormulaType", "CodeableConcept", "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.", 0, 1, baseFormulaType);
1872          case -1267705979: /*baseFormulaProductName*/  return new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName);
1873          case -470746842: /*additiveType*/  return new Property("additiveType", "CodeableConcept", "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.", 0, 1, additiveType);
1874          case 488079534: /*additiveProductName*/  return new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, additiveProductName);
1875          case 186983261: /*caloricDensity*/  return new Property("caloricDensity", "Quantity", "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.", 0, 1, caloricDensity);
1876          case -1710107042: /*routeofAdministration*/  return new Property("routeofAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeofAdministration);
1877          case 1255702622: /*administration*/  return new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration);
1878          case 2017924652: /*maxVolumeToDeliver*/  return new Property("maxVolumeToDeliver", "Quantity", "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.", 0, 1, maxVolumeToDeliver);
1879          case 427085136: /*administrationInstruction*/  return new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction);
1880          default: return super.getNamedProperty(_hash, _name, _checkValid);
1881          }
1882
1883        }
1884
1885      @Override
1886      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1887        switch (hash) {
1888        case -138930641: /*baseFormulaType*/ return this.baseFormulaType == null ? new Base[0] : new Base[] {this.baseFormulaType}; // CodeableConcept
1889        case -1267705979: /*baseFormulaProductName*/ return this.baseFormulaProductName == null ? new Base[0] : new Base[] {this.baseFormulaProductName}; // StringType
1890        case -470746842: /*additiveType*/ return this.additiveType == null ? new Base[0] : new Base[] {this.additiveType}; // CodeableConcept
1891        case 488079534: /*additiveProductName*/ return this.additiveProductName == null ? new Base[0] : new Base[] {this.additiveProductName}; // StringType
1892        case 186983261: /*caloricDensity*/ return this.caloricDensity == null ? new Base[0] : new Base[] {this.caloricDensity}; // Quantity
1893        case -1710107042: /*routeofAdministration*/ return this.routeofAdministration == null ? new Base[0] : new Base[] {this.routeofAdministration}; // CodeableConcept
1894        case 1255702622: /*administration*/ return this.administration == null ? new Base[0] : this.administration.toArray(new Base[this.administration.size()]); // NutritionOrderEnteralFormulaAdministrationComponent
1895        case 2017924652: /*maxVolumeToDeliver*/ return this.maxVolumeToDeliver == null ? new Base[0] : new Base[] {this.maxVolumeToDeliver}; // Quantity
1896        case 427085136: /*administrationInstruction*/ return this.administrationInstruction == null ? new Base[0] : new Base[] {this.administrationInstruction}; // StringType
1897        default: return super.getProperty(hash, name, checkValid);
1898        }
1899
1900      }
1901
1902      @Override
1903      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1904        switch (hash) {
1905        case -138930641: // baseFormulaType
1906          this.baseFormulaType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1907          return value;
1908        case -1267705979: // baseFormulaProductName
1909          this.baseFormulaProductName = TypeConvertor.castToString(value); // StringType
1910          return value;
1911        case -470746842: // additiveType
1912          this.additiveType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1913          return value;
1914        case 488079534: // additiveProductName
1915          this.additiveProductName = TypeConvertor.castToString(value); // StringType
1916          return value;
1917        case 186983261: // caloricDensity
1918          this.caloricDensity = TypeConvertor.castToQuantity(value); // Quantity
1919          return value;
1920        case -1710107042: // routeofAdministration
1921          this.routeofAdministration = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1922          return value;
1923        case 1255702622: // administration
1924          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value); // NutritionOrderEnteralFormulaAdministrationComponent
1925          return value;
1926        case 2017924652: // maxVolumeToDeliver
1927          this.maxVolumeToDeliver = TypeConvertor.castToQuantity(value); // Quantity
1928          return value;
1929        case 427085136: // administrationInstruction
1930          this.administrationInstruction = TypeConvertor.castToString(value); // StringType
1931          return value;
1932        default: return super.setProperty(hash, name, value);
1933        }
1934
1935      }
1936
1937      @Override
1938      public Base setProperty(String name, Base value) throws FHIRException {
1939        if (name.equals("baseFormulaType")) {
1940          this.baseFormulaType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1941        } else if (name.equals("baseFormulaProductName")) {
1942          this.baseFormulaProductName = TypeConvertor.castToString(value); // StringType
1943        } else if (name.equals("additiveType")) {
1944          this.additiveType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1945        } else if (name.equals("additiveProductName")) {
1946          this.additiveProductName = TypeConvertor.castToString(value); // StringType
1947        } else if (name.equals("caloricDensity")) {
1948          this.caloricDensity = TypeConvertor.castToQuantity(value); // Quantity
1949        } else if (name.equals("routeofAdministration")) {
1950          this.routeofAdministration = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1951        } else if (name.equals("administration")) {
1952          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value);
1953        } else if (name.equals("maxVolumeToDeliver")) {
1954          this.maxVolumeToDeliver = TypeConvertor.castToQuantity(value); // Quantity
1955        } else if (name.equals("administrationInstruction")) {
1956          this.administrationInstruction = TypeConvertor.castToString(value); // StringType
1957        } else
1958          return super.setProperty(name, value);
1959        return value;
1960      }
1961
1962      @Override
1963      public Base makeProperty(int hash, String name) throws FHIRException {
1964        switch (hash) {
1965        case -138930641:  return getBaseFormulaType();
1966        case -1267705979:  return getBaseFormulaProductNameElement();
1967        case -470746842:  return getAdditiveType();
1968        case 488079534:  return getAdditiveProductNameElement();
1969        case 186983261:  return getCaloricDensity();
1970        case -1710107042:  return getRouteofAdministration();
1971        case 1255702622:  return addAdministration(); 
1972        case 2017924652:  return getMaxVolumeToDeliver();
1973        case 427085136:  return getAdministrationInstructionElement();
1974        default: return super.makeProperty(hash, name);
1975        }
1976
1977      }
1978
1979      @Override
1980      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1981        switch (hash) {
1982        case -138930641: /*baseFormulaType*/ return new String[] {"CodeableConcept"};
1983        case -1267705979: /*baseFormulaProductName*/ return new String[] {"string"};
1984        case -470746842: /*additiveType*/ return new String[] {"CodeableConcept"};
1985        case 488079534: /*additiveProductName*/ return new String[] {"string"};
1986        case 186983261: /*caloricDensity*/ return new String[] {"Quantity"};
1987        case -1710107042: /*routeofAdministration*/ return new String[] {"CodeableConcept"};
1988        case 1255702622: /*administration*/ return new String[] {};
1989        case 2017924652: /*maxVolumeToDeliver*/ return new String[] {"Quantity"};
1990        case 427085136: /*administrationInstruction*/ return new String[] {"string"};
1991        default: return super.getTypesForProperty(hash, name);
1992        }
1993
1994      }
1995
1996      @Override
1997      public Base addChild(String name) throws FHIRException {
1998        if (name.equals("baseFormulaType")) {
1999          this.baseFormulaType = new CodeableConcept();
2000          return this.baseFormulaType;
2001        }
2002        else if (name.equals("baseFormulaProductName")) {
2003          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.enteralFormula.baseFormulaProductName");
2004        }
2005        else if (name.equals("additiveType")) {
2006          this.additiveType = new CodeableConcept();
2007          return this.additiveType;
2008        }
2009        else if (name.equals("additiveProductName")) {
2010          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.enteralFormula.additiveProductName");
2011        }
2012        else if (name.equals("caloricDensity")) {
2013          this.caloricDensity = new Quantity();
2014          return this.caloricDensity;
2015        }
2016        else if (name.equals("routeofAdministration")) {
2017          this.routeofAdministration = new CodeableConcept();
2018          return this.routeofAdministration;
2019        }
2020        else if (name.equals("administration")) {
2021          return addAdministration();
2022        }
2023        else if (name.equals("maxVolumeToDeliver")) {
2024          this.maxVolumeToDeliver = new Quantity();
2025          return this.maxVolumeToDeliver;
2026        }
2027        else if (name.equals("administrationInstruction")) {
2028          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.enteralFormula.administrationInstruction");
2029        }
2030        else
2031          return super.addChild(name);
2032      }
2033
2034      public NutritionOrderEnteralFormulaComponent copy() {
2035        NutritionOrderEnteralFormulaComponent dst = new NutritionOrderEnteralFormulaComponent();
2036        copyValues(dst);
2037        return dst;
2038      }
2039
2040      public void copyValues(NutritionOrderEnteralFormulaComponent dst) {
2041        super.copyValues(dst);
2042        dst.baseFormulaType = baseFormulaType == null ? null : baseFormulaType.copy();
2043        dst.baseFormulaProductName = baseFormulaProductName == null ? null : baseFormulaProductName.copy();
2044        dst.additiveType = additiveType == null ? null : additiveType.copy();
2045        dst.additiveProductName = additiveProductName == null ? null : additiveProductName.copy();
2046        dst.caloricDensity = caloricDensity == null ? null : caloricDensity.copy();
2047        dst.routeofAdministration = routeofAdministration == null ? null : routeofAdministration.copy();
2048        if (administration != null) {
2049          dst.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2050          for (NutritionOrderEnteralFormulaAdministrationComponent i : administration)
2051            dst.administration.add(i.copy());
2052        };
2053        dst.maxVolumeToDeliver = maxVolumeToDeliver == null ? null : maxVolumeToDeliver.copy();
2054        dst.administrationInstruction = administrationInstruction == null ? null : administrationInstruction.copy();
2055      }
2056
2057      @Override
2058      public boolean equalsDeep(Base other_) {
2059        if (!super.equalsDeep(other_))
2060          return false;
2061        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2062          return false;
2063        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2064        return compareDeep(baseFormulaType, o.baseFormulaType, true) && compareDeep(baseFormulaProductName, o.baseFormulaProductName, true)
2065           && compareDeep(additiveType, o.additiveType, true) && compareDeep(additiveProductName, o.additiveProductName, true)
2066           && compareDeep(caloricDensity, o.caloricDensity, true) && compareDeep(routeofAdministration, o.routeofAdministration, true)
2067           && compareDeep(administration, o.administration, true) && compareDeep(maxVolumeToDeliver, o.maxVolumeToDeliver, true)
2068           && compareDeep(administrationInstruction, o.administrationInstruction, true);
2069      }
2070
2071      @Override
2072      public boolean equalsShallow(Base other_) {
2073        if (!super.equalsShallow(other_))
2074          return false;
2075        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2076          return false;
2077        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2078        return compareValues(baseFormulaProductName, o.baseFormulaProductName, true) && compareValues(additiveProductName, o.additiveProductName, true)
2079           && compareValues(administrationInstruction, o.administrationInstruction, true);
2080      }
2081
2082      public boolean isEmpty() {
2083        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(baseFormulaType, baseFormulaProductName
2084          , additiveType, additiveProductName, caloricDensity, routeofAdministration, administration
2085          , maxVolumeToDeliver, administrationInstruction);
2086      }
2087
2088  public String fhirType() {
2089    return "NutritionOrder.enteralFormula";
2090
2091  }
2092
2093  }
2094
2095    @Block()
2096    public static class NutritionOrderEnteralFormulaAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
2097        /**
2098         * The time period and frequency at which the enteral formula should be delivered to the patient.
2099         */
2100        @Child(name = "schedule", type = {Timing.class}, order=1, min=0, max=1, modifier=false, summary=false)
2101        @Description(shortDefinition="Scheduled frequency of enteral feeding", formalDefinition="The time period and frequency at which the enteral formula should be delivered to the patient." )
2102        protected Timing schedule;
2103
2104        /**
2105         * The volume of formula to provide to the patient per the specified administration schedule.
2106         */
2107        @Child(name = "quantity", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
2108        @Description(shortDefinition="The volume of formula to provide", formalDefinition="The volume of formula to provide to the patient per the specified administration schedule." )
2109        protected Quantity quantity;
2110
2111        /**
2112         * The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.
2113         */
2114        @Child(name = "rate", type = {Quantity.class, Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false)
2115        @Description(shortDefinition="Speed with which the formula is provided per period of time", formalDefinition="The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule." )
2116        protected DataType rate;
2117
2118        private static final long serialVersionUID = -1312073995L;
2119
2120    /**
2121     * Constructor
2122     */
2123      public NutritionOrderEnteralFormulaAdministrationComponent() {
2124        super();
2125      }
2126
2127        /**
2128         * @return {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2129         */
2130        public Timing getSchedule() { 
2131          if (this.schedule == null)
2132            if (Configuration.errorOnAutoCreate())
2133              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.schedule");
2134            else if (Configuration.doAutoCreate())
2135              this.schedule = new Timing(); // cc
2136          return this.schedule;
2137        }
2138
2139        public boolean hasSchedule() { 
2140          return this.schedule != null && !this.schedule.isEmpty();
2141        }
2142
2143        /**
2144         * @param value {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2145         */
2146        public NutritionOrderEnteralFormulaAdministrationComponent setSchedule(Timing value) { 
2147          this.schedule = value;
2148          return this;
2149        }
2150
2151        /**
2152         * @return {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2153         */
2154        public Quantity getQuantity() { 
2155          if (this.quantity == null)
2156            if (Configuration.errorOnAutoCreate())
2157              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.quantity");
2158            else if (Configuration.doAutoCreate())
2159              this.quantity = new Quantity(); // cc
2160          return this.quantity;
2161        }
2162
2163        public boolean hasQuantity() { 
2164          return this.quantity != null && !this.quantity.isEmpty();
2165        }
2166
2167        /**
2168         * @param value {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2169         */
2170        public NutritionOrderEnteralFormulaAdministrationComponent setQuantity(Quantity value) { 
2171          this.quantity = value;
2172          return this;
2173        }
2174
2175        /**
2176         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2177         */
2178        public DataType getRate() { 
2179          return this.rate;
2180        }
2181
2182        /**
2183         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2184         */
2185        public Quantity getRateQuantity() throws FHIRException { 
2186          if (this.rate == null)
2187            this.rate = new Quantity();
2188          if (!(this.rate instanceof Quantity))
2189            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.rate.getClass().getName()+" was encountered");
2190          return (Quantity) this.rate;
2191        }
2192
2193        public boolean hasRateQuantity() { 
2194          return this != null && this.rate instanceof Quantity;
2195        }
2196
2197        /**
2198         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2199         */
2200        public Ratio getRateRatio() throws FHIRException { 
2201          if (this.rate == null)
2202            this.rate = new Ratio();
2203          if (!(this.rate instanceof Ratio))
2204            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered");
2205          return (Ratio) this.rate;
2206        }
2207
2208        public boolean hasRateRatio() { 
2209          return this != null && this.rate instanceof Ratio;
2210        }
2211
2212        public boolean hasRate() { 
2213          return this.rate != null && !this.rate.isEmpty();
2214        }
2215
2216        /**
2217         * @param value {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2218         */
2219        public NutritionOrderEnteralFormulaAdministrationComponent setRate(DataType value) { 
2220          if (value != null && !(value instanceof Quantity || value instanceof Ratio))
2221            throw new Error("Not the right type for NutritionOrder.enteralFormula.administration.rate[x]: "+value.fhirType());
2222          this.rate = value;
2223          return this;
2224        }
2225
2226        protected void listChildren(List<Property> children) {
2227          super.listChildren(children);
2228          children.add(new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1, schedule));
2229          children.add(new Property("quantity", "Quantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity));
2230          children.add(new Property("rate[x]", "Quantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate));
2231        }
2232
2233        @Override
2234        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2235          switch (_hash) {
2236          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1, schedule);
2237          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity);
2238          case 983460768: /*rate[x]*/  return new Property("rate[x]", "Quantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2239          case 3493088: /*rate*/  return new Property("rate[x]", "Quantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2240          case -1085459061: /*rateQuantity*/  return new Property("rate[x]", "Quantity", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2241          case 204021515: /*rateRatio*/  return new Property("rate[x]", "Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
2242          default: return super.getNamedProperty(_hash, _name, _checkValid);
2243          }
2244
2245        }
2246
2247      @Override
2248      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2249        switch (hash) {
2250        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // Timing
2251        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
2252        case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // DataType
2253        default: return super.getProperty(hash, name, checkValid);
2254        }
2255
2256      }
2257
2258      @Override
2259      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2260        switch (hash) {
2261        case -697920873: // schedule
2262          this.schedule = TypeConvertor.castToTiming(value); // Timing
2263          return value;
2264        case -1285004149: // quantity
2265          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
2266          return value;
2267        case 3493088: // rate
2268          this.rate = TypeConvertor.castToType(value); // DataType
2269          return value;
2270        default: return super.setProperty(hash, name, value);
2271        }
2272
2273      }
2274
2275      @Override
2276      public Base setProperty(String name, Base value) throws FHIRException {
2277        if (name.equals("schedule")) {
2278          this.schedule = TypeConvertor.castToTiming(value); // Timing
2279        } else if (name.equals("quantity")) {
2280          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
2281        } else if (name.equals("rate[x]")) {
2282          this.rate = TypeConvertor.castToType(value); // DataType
2283        } else
2284          return super.setProperty(name, value);
2285        return value;
2286      }
2287
2288      @Override
2289      public Base makeProperty(int hash, String name) throws FHIRException {
2290        switch (hash) {
2291        case -697920873:  return getSchedule();
2292        case -1285004149:  return getQuantity();
2293        case 983460768:  return getRate();
2294        case 3493088:  return getRate();
2295        default: return super.makeProperty(hash, name);
2296        }
2297
2298      }
2299
2300      @Override
2301      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2302        switch (hash) {
2303        case -697920873: /*schedule*/ return new String[] {"Timing"};
2304        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
2305        case 3493088: /*rate*/ return new String[] {"Quantity", "Ratio"};
2306        default: return super.getTypesForProperty(hash, name);
2307        }
2308
2309      }
2310
2311      @Override
2312      public Base addChild(String name) throws FHIRException {
2313        if (name.equals("schedule")) {
2314          this.schedule = new Timing();
2315          return this.schedule;
2316        }
2317        else if (name.equals("quantity")) {
2318          this.quantity = new Quantity();
2319          return this.quantity;
2320        }
2321        else if (name.equals("rateQuantity")) {
2322          this.rate = new Quantity();
2323          return this.rate;
2324        }
2325        else if (name.equals("rateRatio")) {
2326          this.rate = new Ratio();
2327          return this.rate;
2328        }
2329        else
2330          return super.addChild(name);
2331      }
2332
2333      public NutritionOrderEnteralFormulaAdministrationComponent copy() {
2334        NutritionOrderEnteralFormulaAdministrationComponent dst = new NutritionOrderEnteralFormulaAdministrationComponent();
2335        copyValues(dst);
2336        return dst;
2337      }
2338
2339      public void copyValues(NutritionOrderEnteralFormulaAdministrationComponent dst) {
2340        super.copyValues(dst);
2341        dst.schedule = schedule == null ? null : schedule.copy();
2342        dst.quantity = quantity == null ? null : quantity.copy();
2343        dst.rate = rate == null ? null : rate.copy();
2344      }
2345
2346      @Override
2347      public boolean equalsDeep(Base other_) {
2348        if (!super.equalsDeep(other_))
2349          return false;
2350        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2351          return false;
2352        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
2353        return compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true)
2354          ;
2355      }
2356
2357      @Override
2358      public boolean equalsShallow(Base other_) {
2359        if (!super.equalsShallow(other_))
2360          return false;
2361        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2362          return false;
2363        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
2364        return true;
2365      }
2366
2367      public boolean isEmpty() {
2368        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(schedule, quantity, rate
2369          );
2370      }
2371
2372  public String fhirType() {
2373    return "NutritionOrder.enteralFormula.administration";
2374
2375  }
2376
2377  }
2378
2379    /**
2380     * Identifiers assigned to this order by the order sender or by the order receiver.
2381     */
2382    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2383    @Description(shortDefinition="Identifiers assigned to this order", formalDefinition="Identifiers assigned to this order by the order sender or by the order receiver." )
2384    protected List<Identifier> identifier;
2385
2386    /**
2387     * The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2388     */
2389    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2390    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2391    protected List<CanonicalType> instantiatesCanonical;
2392
2393    /**
2394     * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2395     */
2396    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2397    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2398    protected List<UriType> instantiatesUri;
2399
2400    /**
2401     * The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2402     */
2403    @Child(name = "instantiates", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2404    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2405    protected List<UriType> instantiates;
2406
2407    /**
2408     * The workflow status of the nutrition order/request.
2409     */
2410    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
2411    @Description(shortDefinition="draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition="The workflow status of the nutrition order/request." )
2412    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
2413    protected Enumeration<RequestStatus> status;
2414
2415    /**
2416     * Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
2417     */
2418    @Child(name = "intent", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
2419    @Description(shortDefinition="proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition="Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain." )
2420    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-intent")
2421    protected Enumeration<RequestIntent> intent;
2422
2423    /**
2424     * The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.
2425     */
2426    @Child(name = "patient", type = {Patient.class}, order=6, min=1, max=1, modifier=false, summary=true)
2427    @Description(shortDefinition="The person who requires the diet, formula or nutritional supplement", formalDefinition="The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding." )
2428    protected Reference patient;
2429
2430    /**
2431     * An encounter that provides additional information about the healthcare context in which this request is made.
2432     */
2433    @Child(name = "encounter", type = {Encounter.class}, order=7, min=0, max=1, modifier=false, summary=false)
2434    @Description(shortDefinition="The encounter associated with this nutrition order", formalDefinition="An encounter that provides additional information about the healthcare context in which this request is made." )
2435    protected Reference encounter;
2436
2437    /**
2438     * The date and time that this nutrition order was requested.
2439     */
2440    @Child(name = "dateTime", type = {DateTimeType.class}, order=8, min=1, max=1, modifier=false, summary=true)
2441    @Description(shortDefinition="Date and time the nutrition order was requested", formalDefinition="The date and time that this nutrition order was requested." )
2442    protected DateTimeType dateTime;
2443
2444    /**
2445     * The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.
2446     */
2447    @Child(name = "orderer", type = {Practitioner.class, PractitionerRole.class}, order=9, min=0, max=1, modifier=false, summary=true)
2448    @Description(shortDefinition="Who ordered the diet, formula or nutritional supplement", formalDefinition="The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings." )
2449    protected Reference orderer;
2450
2451    /**
2452     * A link to a record of allergies or intolerances  which should be included in the nutrition order.
2453     */
2454    @Child(name = "allergyIntolerance", type = {AllergyIntolerance.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2455    @Description(shortDefinition="List of the patient's food and nutrition-related allergies and intolerances", formalDefinition="A link to a record of allergies or intolerances  which should be included in the nutrition order." )
2456    protected List<Reference> allergyIntolerance;
2457
2458    /**
2459     * This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.
2460     */
2461    @Child(name = "foodPreferenceModifier", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2462    @Description(shortDefinition="Order-specific modifier about the type of food that should be given", formalDefinition="This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings." )
2463    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-diet")
2464    protected List<CodeableConcept> foodPreferenceModifier;
2465
2466    /**
2467     * This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.
2468     */
2469    @Child(name = "excludeFoodModifier", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2470    @Description(shortDefinition="Order-specific modifier about the type of food that should not be given", formalDefinition="This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings." )
2471    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/food-type")
2472    protected List<CodeableConcept> excludeFoodModifier;
2473
2474    /**
2475     * Diet given orally in contrast to enteral (tube) feeding.
2476     */
2477    @Child(name = "oralDiet", type = {}, order=13, min=0, max=1, modifier=false, summary=false)
2478    @Description(shortDefinition="Oral diet components", formalDefinition="Diet given orally in contrast to enteral (tube) feeding." )
2479    protected NutritionOrderOralDietComponent oralDiet;
2480
2481    /**
2482     * Oral nutritional products given in order to add further nutritional value to the patient's diet.
2483     */
2484    @Child(name = "supplement", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2485    @Description(shortDefinition="Supplement components", formalDefinition="Oral nutritional products given in order to add further nutritional value to the patient's diet." )
2486    protected List<NutritionOrderSupplementComponent> supplement;
2487
2488    /**
2489     * Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.
2490     */
2491    @Child(name = "enteralFormula", type = {}, order=15, min=0, max=1, modifier=false, summary=false)
2492    @Description(shortDefinition="Enteral formula components", formalDefinition="Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity." )
2493    protected NutritionOrderEnteralFormulaComponent enteralFormula;
2494
2495    /**
2496     * Comments made about the nutrition order by the requester, performer, subject or other participants.
2497     */
2498    @Child(name = "note", type = {Annotation.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2499    @Description(shortDefinition="Comments", formalDefinition="Comments made about the nutrition order by the requester, performer, subject or other participants." )
2500    protected List<Annotation> note;
2501
2502    private static final long serialVersionUID = 1010528149L;
2503
2504  /**
2505   * Constructor
2506   */
2507    public NutritionOrder() {
2508      super();
2509    }
2510
2511  /**
2512   * Constructor
2513   */
2514    public NutritionOrder(RequestStatus status, RequestIntent intent, Reference patient, Date dateTime) {
2515      super();
2516      this.setStatus(status);
2517      this.setIntent(intent);
2518      this.setPatient(patient);
2519      this.setDateTime(dateTime);
2520    }
2521
2522    /**
2523     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
2524     */
2525    public List<Identifier> getIdentifier() { 
2526      if (this.identifier == null)
2527        this.identifier = new ArrayList<Identifier>();
2528      return this.identifier;
2529    }
2530
2531    /**
2532     * @return Returns a reference to <code>this</code> for easy method chaining
2533     */
2534    public NutritionOrder setIdentifier(List<Identifier> theIdentifier) { 
2535      this.identifier = theIdentifier;
2536      return this;
2537    }
2538
2539    public boolean hasIdentifier() { 
2540      if (this.identifier == null)
2541        return false;
2542      for (Identifier item : this.identifier)
2543        if (!item.isEmpty())
2544          return true;
2545      return false;
2546    }
2547
2548    public Identifier addIdentifier() { //3
2549      Identifier t = new Identifier();
2550      if (this.identifier == null)
2551        this.identifier = new ArrayList<Identifier>();
2552      this.identifier.add(t);
2553      return t;
2554    }
2555
2556    public NutritionOrder addIdentifier(Identifier t) { //3
2557      if (t == null)
2558        return this;
2559      if (this.identifier == null)
2560        this.identifier = new ArrayList<Identifier>();
2561      this.identifier.add(t);
2562      return this;
2563    }
2564
2565    /**
2566     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2567     */
2568    public Identifier getIdentifierFirstRep() { 
2569      if (getIdentifier().isEmpty()) {
2570        addIdentifier();
2571      }
2572      return getIdentifier().get(0);
2573    }
2574
2575    /**
2576     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2577     */
2578    public List<CanonicalType> getInstantiatesCanonical() { 
2579      if (this.instantiatesCanonical == null)
2580        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2581      return this.instantiatesCanonical;
2582    }
2583
2584    /**
2585     * @return Returns a reference to <code>this</code> for easy method chaining
2586     */
2587    public NutritionOrder setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
2588      this.instantiatesCanonical = theInstantiatesCanonical;
2589      return this;
2590    }
2591
2592    public boolean hasInstantiatesCanonical() { 
2593      if (this.instantiatesCanonical == null)
2594        return false;
2595      for (CanonicalType item : this.instantiatesCanonical)
2596        if (!item.isEmpty())
2597          return true;
2598      return false;
2599    }
2600
2601    /**
2602     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2603     */
2604    public CanonicalType addInstantiatesCanonicalElement() {//2 
2605      CanonicalType t = new CanonicalType();
2606      if (this.instantiatesCanonical == null)
2607        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2608      this.instantiatesCanonical.add(t);
2609      return t;
2610    }
2611
2612    /**
2613     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2614     */
2615    public NutritionOrder addInstantiatesCanonical(String value) { //1
2616      CanonicalType t = new CanonicalType();
2617      t.setValue(value);
2618      if (this.instantiatesCanonical == null)
2619        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2620      this.instantiatesCanonical.add(t);
2621      return this;
2622    }
2623
2624    /**
2625     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2626     */
2627    public boolean hasInstantiatesCanonical(String value) { 
2628      if (this.instantiatesCanonical == null)
2629        return false;
2630      for (CanonicalType v : this.instantiatesCanonical)
2631        if (v.getValue().equals(value)) // canonical
2632          return true;
2633      return false;
2634    }
2635
2636    /**
2637     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2638     */
2639    public List<UriType> getInstantiatesUri() { 
2640      if (this.instantiatesUri == null)
2641        this.instantiatesUri = new ArrayList<UriType>();
2642      return this.instantiatesUri;
2643    }
2644
2645    /**
2646     * @return Returns a reference to <code>this</code> for easy method chaining
2647     */
2648    public NutritionOrder setInstantiatesUri(List<UriType> theInstantiatesUri) { 
2649      this.instantiatesUri = theInstantiatesUri;
2650      return this;
2651    }
2652
2653    public boolean hasInstantiatesUri() { 
2654      if (this.instantiatesUri == null)
2655        return false;
2656      for (UriType item : this.instantiatesUri)
2657        if (!item.isEmpty())
2658          return true;
2659      return false;
2660    }
2661
2662    /**
2663     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2664     */
2665    public UriType addInstantiatesUriElement() {//2 
2666      UriType t = new UriType();
2667      if (this.instantiatesUri == null)
2668        this.instantiatesUri = new ArrayList<UriType>();
2669      this.instantiatesUri.add(t);
2670      return t;
2671    }
2672
2673    /**
2674     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2675     */
2676    public NutritionOrder addInstantiatesUri(String value) { //1
2677      UriType t = new UriType();
2678      t.setValue(value);
2679      if (this.instantiatesUri == null)
2680        this.instantiatesUri = new ArrayList<UriType>();
2681      this.instantiatesUri.add(t);
2682      return this;
2683    }
2684
2685    /**
2686     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2687     */
2688    public boolean hasInstantiatesUri(String value) { 
2689      if (this.instantiatesUri == null)
2690        return false;
2691      for (UriType v : this.instantiatesUri)
2692        if (v.getValue().equals(value)) // uri
2693          return true;
2694      return false;
2695    }
2696
2697    /**
2698     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2699     */
2700    public List<UriType> getInstantiates() { 
2701      if (this.instantiates == null)
2702        this.instantiates = new ArrayList<UriType>();
2703      return this.instantiates;
2704    }
2705
2706    /**
2707     * @return Returns a reference to <code>this</code> for easy method chaining
2708     */
2709    public NutritionOrder setInstantiates(List<UriType> theInstantiates) { 
2710      this.instantiates = theInstantiates;
2711      return this;
2712    }
2713
2714    public boolean hasInstantiates() { 
2715      if (this.instantiates == null)
2716        return false;
2717      for (UriType item : this.instantiates)
2718        if (!item.isEmpty())
2719          return true;
2720      return false;
2721    }
2722
2723    /**
2724     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2725     */
2726    public UriType addInstantiatesElement() {//2 
2727      UriType t = new UriType();
2728      if (this.instantiates == null)
2729        this.instantiates = new ArrayList<UriType>();
2730      this.instantiates.add(t);
2731      return t;
2732    }
2733
2734    /**
2735     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2736     */
2737    public NutritionOrder addInstantiates(String value) { //1
2738      UriType t = new UriType();
2739      t.setValue(value);
2740      if (this.instantiates == null)
2741        this.instantiates = new ArrayList<UriType>();
2742      this.instantiates.add(t);
2743      return this;
2744    }
2745
2746    /**
2747     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2748     */
2749    public boolean hasInstantiates(String value) { 
2750      if (this.instantiates == null)
2751        return false;
2752      for (UriType v : this.instantiates)
2753        if (v.getValue().equals(value)) // uri
2754          return true;
2755      return false;
2756    }
2757
2758    /**
2759     * @return {@link #status} (The workflow status of the nutrition order/request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2760     */
2761    public Enumeration<RequestStatus> getStatusElement() { 
2762      if (this.status == null)
2763        if (Configuration.errorOnAutoCreate())
2764          throw new Error("Attempt to auto-create NutritionOrder.status");
2765        else if (Configuration.doAutoCreate())
2766          this.status = new Enumeration<RequestStatus>(new RequestStatusEnumFactory()); // bb
2767      return this.status;
2768    }
2769
2770    public boolean hasStatusElement() { 
2771      return this.status != null && !this.status.isEmpty();
2772    }
2773
2774    public boolean hasStatus() { 
2775      return this.status != null && !this.status.isEmpty();
2776    }
2777
2778    /**
2779     * @param value {@link #status} (The workflow status of the nutrition order/request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2780     */
2781    public NutritionOrder setStatusElement(Enumeration<RequestStatus> value) { 
2782      this.status = value;
2783      return this;
2784    }
2785
2786    /**
2787     * @return The workflow status of the nutrition order/request.
2788     */
2789    public RequestStatus getStatus() { 
2790      return this.status == null ? null : this.status.getValue();
2791    }
2792
2793    /**
2794     * @param value The workflow status of the nutrition order/request.
2795     */
2796    public NutritionOrder setStatus(RequestStatus value) { 
2797        if (this.status == null)
2798          this.status = new Enumeration<RequestStatus>(new RequestStatusEnumFactory());
2799        this.status.setValue(value);
2800      return this;
2801    }
2802
2803    /**
2804     * @return {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
2805     */
2806    public Enumeration<RequestIntent> getIntentElement() { 
2807      if (this.intent == null)
2808        if (Configuration.errorOnAutoCreate())
2809          throw new Error("Attempt to auto-create NutritionOrder.intent");
2810        else if (Configuration.doAutoCreate())
2811          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory()); // bb
2812      return this.intent;
2813    }
2814
2815    public boolean hasIntentElement() { 
2816      return this.intent != null && !this.intent.isEmpty();
2817    }
2818
2819    public boolean hasIntent() { 
2820      return this.intent != null && !this.intent.isEmpty();
2821    }
2822
2823    /**
2824     * @param value {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
2825     */
2826    public NutritionOrder setIntentElement(Enumeration<RequestIntent> value) { 
2827      this.intent = value;
2828      return this;
2829    }
2830
2831    /**
2832     * @return Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
2833     */
2834    public RequestIntent getIntent() { 
2835      return this.intent == null ? null : this.intent.getValue();
2836    }
2837
2838    /**
2839     * @param value Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
2840     */
2841    public NutritionOrder setIntent(RequestIntent value) { 
2842        if (this.intent == null)
2843          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory());
2844        this.intent.setValue(value);
2845      return this;
2846    }
2847
2848    /**
2849     * @return {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2850     */
2851    public Reference getPatient() { 
2852      if (this.patient == null)
2853        if (Configuration.errorOnAutoCreate())
2854          throw new Error("Attempt to auto-create NutritionOrder.patient");
2855        else if (Configuration.doAutoCreate())
2856          this.patient = new Reference(); // cc
2857      return this.patient;
2858    }
2859
2860    public boolean hasPatient() { 
2861      return this.patient != null && !this.patient.isEmpty();
2862    }
2863
2864    /**
2865     * @param value {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2866     */
2867    public NutritionOrder setPatient(Reference value) { 
2868      this.patient = value;
2869      return this;
2870    }
2871
2872    /**
2873     * @return {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
2874     */
2875    public Reference getEncounter() { 
2876      if (this.encounter == null)
2877        if (Configuration.errorOnAutoCreate())
2878          throw new Error("Attempt to auto-create NutritionOrder.encounter");
2879        else if (Configuration.doAutoCreate())
2880          this.encounter = new Reference(); // cc
2881      return this.encounter;
2882    }
2883
2884    public boolean hasEncounter() { 
2885      return this.encounter != null && !this.encounter.isEmpty();
2886    }
2887
2888    /**
2889     * @param value {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
2890     */
2891    public NutritionOrder setEncounter(Reference value) { 
2892      this.encounter = value;
2893      return this;
2894    }
2895
2896    /**
2897     * @return {@link #dateTime} (The date and time that this nutrition order was requested.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
2898     */
2899    public DateTimeType getDateTimeElement() { 
2900      if (this.dateTime == null)
2901        if (Configuration.errorOnAutoCreate())
2902          throw new Error("Attempt to auto-create NutritionOrder.dateTime");
2903        else if (Configuration.doAutoCreate())
2904          this.dateTime = new DateTimeType(); // bb
2905      return this.dateTime;
2906    }
2907
2908    public boolean hasDateTimeElement() { 
2909      return this.dateTime != null && !this.dateTime.isEmpty();
2910    }
2911
2912    public boolean hasDateTime() { 
2913      return this.dateTime != null && !this.dateTime.isEmpty();
2914    }
2915
2916    /**
2917     * @param value {@link #dateTime} (The date and time that this nutrition order was requested.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
2918     */
2919    public NutritionOrder setDateTimeElement(DateTimeType value) { 
2920      this.dateTime = value;
2921      return this;
2922    }
2923
2924    /**
2925     * @return The date and time that this nutrition order was requested.
2926     */
2927    public Date getDateTime() { 
2928      return this.dateTime == null ? null : this.dateTime.getValue();
2929    }
2930
2931    /**
2932     * @param value The date and time that this nutrition order was requested.
2933     */
2934    public NutritionOrder setDateTime(Date value) { 
2935        if (this.dateTime == null)
2936          this.dateTime = new DateTimeType();
2937        this.dateTime.setValue(value);
2938      return this;
2939    }
2940
2941    /**
2942     * @return {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2943     */
2944    public Reference getOrderer() { 
2945      if (this.orderer == null)
2946        if (Configuration.errorOnAutoCreate())
2947          throw new Error("Attempt to auto-create NutritionOrder.orderer");
2948        else if (Configuration.doAutoCreate())
2949          this.orderer = new Reference(); // cc
2950      return this.orderer;
2951    }
2952
2953    public boolean hasOrderer() { 
2954      return this.orderer != null && !this.orderer.isEmpty();
2955    }
2956
2957    /**
2958     * @param value {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2959     */
2960    public NutritionOrder setOrderer(Reference value) { 
2961      this.orderer = value;
2962      return this;
2963    }
2964
2965    /**
2966     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2967     */
2968    public List<Reference> getAllergyIntolerance() { 
2969      if (this.allergyIntolerance == null)
2970        this.allergyIntolerance = new ArrayList<Reference>();
2971      return this.allergyIntolerance;
2972    }
2973
2974    /**
2975     * @return Returns a reference to <code>this</code> for easy method chaining
2976     */
2977    public NutritionOrder setAllergyIntolerance(List<Reference> theAllergyIntolerance) { 
2978      this.allergyIntolerance = theAllergyIntolerance;
2979      return this;
2980    }
2981
2982    public boolean hasAllergyIntolerance() { 
2983      if (this.allergyIntolerance == null)
2984        return false;
2985      for (Reference item : this.allergyIntolerance)
2986        if (!item.isEmpty())
2987          return true;
2988      return false;
2989    }
2990
2991    public Reference addAllergyIntolerance() { //3
2992      Reference t = new Reference();
2993      if (this.allergyIntolerance == null)
2994        this.allergyIntolerance = new ArrayList<Reference>();
2995      this.allergyIntolerance.add(t);
2996      return t;
2997    }
2998
2999    public NutritionOrder addAllergyIntolerance(Reference t) { //3
3000      if (t == null)
3001        return this;
3002      if (this.allergyIntolerance == null)
3003        this.allergyIntolerance = new ArrayList<Reference>();
3004      this.allergyIntolerance.add(t);
3005      return this;
3006    }
3007
3008    /**
3009     * @return The first repetition of repeating field {@link #allergyIntolerance}, creating it if it does not already exist {3}
3010     */
3011    public Reference getAllergyIntoleranceFirstRep() { 
3012      if (getAllergyIntolerance().isEmpty()) {
3013        addAllergyIntolerance();
3014      }
3015      return getAllergyIntolerance().get(0);
3016    }
3017
3018    /**
3019     * @return {@link #foodPreferenceModifier} (This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.)
3020     */
3021    public List<CodeableConcept> getFoodPreferenceModifier() { 
3022      if (this.foodPreferenceModifier == null)
3023        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3024      return this.foodPreferenceModifier;
3025    }
3026
3027    /**
3028     * @return Returns a reference to <code>this</code> for easy method chaining
3029     */
3030    public NutritionOrder setFoodPreferenceModifier(List<CodeableConcept> theFoodPreferenceModifier) { 
3031      this.foodPreferenceModifier = theFoodPreferenceModifier;
3032      return this;
3033    }
3034
3035    public boolean hasFoodPreferenceModifier() { 
3036      if (this.foodPreferenceModifier == null)
3037        return false;
3038      for (CodeableConcept item : this.foodPreferenceModifier)
3039        if (!item.isEmpty())
3040          return true;
3041      return false;
3042    }
3043
3044    public CodeableConcept addFoodPreferenceModifier() { //3
3045      CodeableConcept t = new CodeableConcept();
3046      if (this.foodPreferenceModifier == null)
3047        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3048      this.foodPreferenceModifier.add(t);
3049      return t;
3050    }
3051
3052    public NutritionOrder addFoodPreferenceModifier(CodeableConcept t) { //3
3053      if (t == null)
3054        return this;
3055      if (this.foodPreferenceModifier == null)
3056        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3057      this.foodPreferenceModifier.add(t);
3058      return this;
3059    }
3060
3061    /**
3062     * @return The first repetition of repeating field {@link #foodPreferenceModifier}, creating it if it does not already exist {3}
3063     */
3064    public CodeableConcept getFoodPreferenceModifierFirstRep() { 
3065      if (getFoodPreferenceModifier().isEmpty()) {
3066        addFoodPreferenceModifier();
3067      }
3068      return getFoodPreferenceModifier().get(0);
3069    }
3070
3071    /**
3072     * @return {@link #excludeFoodModifier} (This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.)
3073     */
3074    public List<CodeableConcept> getExcludeFoodModifier() { 
3075      if (this.excludeFoodModifier == null)
3076        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3077      return this.excludeFoodModifier;
3078    }
3079
3080    /**
3081     * @return Returns a reference to <code>this</code> for easy method chaining
3082     */
3083    public NutritionOrder setExcludeFoodModifier(List<CodeableConcept> theExcludeFoodModifier) { 
3084      this.excludeFoodModifier = theExcludeFoodModifier;
3085      return this;
3086    }
3087
3088    public boolean hasExcludeFoodModifier() { 
3089      if (this.excludeFoodModifier == null)
3090        return false;
3091      for (CodeableConcept item : this.excludeFoodModifier)
3092        if (!item.isEmpty())
3093          return true;
3094      return false;
3095    }
3096
3097    public CodeableConcept addExcludeFoodModifier() { //3
3098      CodeableConcept t = new CodeableConcept();
3099      if (this.excludeFoodModifier == null)
3100        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3101      this.excludeFoodModifier.add(t);
3102      return t;
3103    }
3104
3105    public NutritionOrder addExcludeFoodModifier(CodeableConcept t) { //3
3106      if (t == null)
3107        return this;
3108      if (this.excludeFoodModifier == null)
3109        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3110      this.excludeFoodModifier.add(t);
3111      return this;
3112    }
3113
3114    /**
3115     * @return The first repetition of repeating field {@link #excludeFoodModifier}, creating it if it does not already exist {3}
3116     */
3117    public CodeableConcept getExcludeFoodModifierFirstRep() { 
3118      if (getExcludeFoodModifier().isEmpty()) {
3119        addExcludeFoodModifier();
3120      }
3121      return getExcludeFoodModifier().get(0);
3122    }
3123
3124    /**
3125     * @return {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
3126     */
3127    public NutritionOrderOralDietComponent getOralDiet() { 
3128      if (this.oralDiet == null)
3129        if (Configuration.errorOnAutoCreate())
3130          throw new Error("Attempt to auto-create NutritionOrder.oralDiet");
3131        else if (Configuration.doAutoCreate())
3132          this.oralDiet = new NutritionOrderOralDietComponent(); // cc
3133      return this.oralDiet;
3134    }
3135
3136    public boolean hasOralDiet() { 
3137      return this.oralDiet != null && !this.oralDiet.isEmpty();
3138    }
3139
3140    /**
3141     * @param value {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
3142     */
3143    public NutritionOrder setOralDiet(NutritionOrderOralDietComponent value) { 
3144      this.oralDiet = value;
3145      return this;
3146    }
3147
3148    /**
3149     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
3150     */
3151    public List<NutritionOrderSupplementComponent> getSupplement() { 
3152      if (this.supplement == null)
3153        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3154      return this.supplement;
3155    }
3156
3157    /**
3158     * @return Returns a reference to <code>this</code> for easy method chaining
3159     */
3160    public NutritionOrder setSupplement(List<NutritionOrderSupplementComponent> theSupplement) { 
3161      this.supplement = theSupplement;
3162      return this;
3163    }
3164
3165    public boolean hasSupplement() { 
3166      if (this.supplement == null)
3167        return false;
3168      for (NutritionOrderSupplementComponent item : this.supplement)
3169        if (!item.isEmpty())
3170          return true;
3171      return false;
3172    }
3173
3174    public NutritionOrderSupplementComponent addSupplement() { //3
3175      NutritionOrderSupplementComponent t = new NutritionOrderSupplementComponent();
3176      if (this.supplement == null)
3177        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3178      this.supplement.add(t);
3179      return t;
3180    }
3181
3182    public NutritionOrder addSupplement(NutritionOrderSupplementComponent t) { //3
3183      if (t == null)
3184        return this;
3185      if (this.supplement == null)
3186        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3187      this.supplement.add(t);
3188      return this;
3189    }
3190
3191    /**
3192     * @return The first repetition of repeating field {@link #supplement}, creating it if it does not already exist {3}
3193     */
3194    public NutritionOrderSupplementComponent getSupplementFirstRep() { 
3195      if (getSupplement().isEmpty()) {
3196        addSupplement();
3197      }
3198      return getSupplement().get(0);
3199    }
3200
3201    /**
3202     * @return {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
3203     */
3204    public NutritionOrderEnteralFormulaComponent getEnteralFormula() { 
3205      if (this.enteralFormula == null)
3206        if (Configuration.errorOnAutoCreate())
3207          throw new Error("Attempt to auto-create NutritionOrder.enteralFormula");
3208        else if (Configuration.doAutoCreate())
3209          this.enteralFormula = new NutritionOrderEnteralFormulaComponent(); // cc
3210      return this.enteralFormula;
3211    }
3212
3213    public boolean hasEnteralFormula() { 
3214      return this.enteralFormula != null && !this.enteralFormula.isEmpty();
3215    }
3216
3217    /**
3218     * @param value {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
3219     */
3220    public NutritionOrder setEnteralFormula(NutritionOrderEnteralFormulaComponent value) { 
3221      this.enteralFormula = value;
3222      return this;
3223    }
3224
3225    /**
3226     * @return {@link #note} (Comments made about the nutrition order by the requester, performer, subject or other participants.)
3227     */
3228    public List<Annotation> getNote() { 
3229      if (this.note == null)
3230        this.note = new ArrayList<Annotation>();
3231      return this.note;
3232    }
3233
3234    /**
3235     * @return Returns a reference to <code>this</code> for easy method chaining
3236     */
3237    public NutritionOrder setNote(List<Annotation> theNote) { 
3238      this.note = theNote;
3239      return this;
3240    }
3241
3242    public boolean hasNote() { 
3243      if (this.note == null)
3244        return false;
3245      for (Annotation item : this.note)
3246        if (!item.isEmpty())
3247          return true;
3248      return false;
3249    }
3250
3251    public Annotation addNote() { //3
3252      Annotation t = new Annotation();
3253      if (this.note == null)
3254        this.note = new ArrayList<Annotation>();
3255      this.note.add(t);
3256      return t;
3257    }
3258
3259    public NutritionOrder addNote(Annotation t) { //3
3260      if (t == null)
3261        return this;
3262      if (this.note == null)
3263        this.note = new ArrayList<Annotation>();
3264      this.note.add(t);
3265      return this;
3266    }
3267
3268    /**
3269     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
3270     */
3271    public Annotation getNoteFirstRep() { 
3272      if (getNote().isEmpty()) {
3273        addNote();
3274      }
3275      return getNote().get(0);
3276    }
3277
3278      protected void listChildren(List<Property> children) {
3279        super.listChildren(children);
3280        children.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
3281        children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
3282        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
3283        children.add(new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates));
3284        children.add(new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status));
3285        children.add(new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent));
3286        children.add(new Property("patient", "Reference(Patient)", "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.", 0, 1, patient));
3287        children.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, encounter));
3288        children.add(new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime));
3289        children.add(new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer));
3290        children.add(new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance));
3291        children.add(new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier));
3292        children.add(new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier));
3293        children.add(new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet));
3294        children.add(new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement));
3295        children.add(new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula));
3296        children.add(new Property("note", "Annotation", "Comments made about the nutrition order by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
3297      }
3298
3299      @Override
3300      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3301        switch (_hash) {
3302        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier);
3303        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
3304        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
3305        case -246883639: /*instantiates*/  return new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates);
3306        case -892481550: /*status*/  return new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status);
3307        case -1183762788: /*intent*/  return new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent);
3308        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.", 0, 1, patient);
3309        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, encounter);
3310        case 1792749467: /*dateTime*/  return new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime);
3311        case -1207109509: /*orderer*/  return new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer);
3312        case -120164120: /*allergyIntolerance*/  return new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance);
3313        case 659473872: /*foodPreferenceModifier*/  return new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier);
3314        case 1760260175: /*excludeFoodModifier*/  return new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier);
3315        case 1153521250: /*oralDiet*/  return new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet);
3316        case -711993159: /*supplement*/  return new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement);
3317        case -671083805: /*enteralFormula*/  return new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula);
3318        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the nutrition order by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
3319        default: return super.getNamedProperty(_hash, _name, _checkValid);
3320        }
3321
3322      }
3323
3324      @Override
3325      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3326        switch (hash) {
3327        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3328        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
3329        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
3330        case -246883639: /*instantiates*/ return this.instantiates == null ? new Base[0] : this.instantiates.toArray(new Base[this.instantiates.size()]); // UriType
3331        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<RequestStatus>
3332        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<RequestIntent>
3333        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
3334        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3335        case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
3336        case -1207109509: /*orderer*/ return this.orderer == null ? new Base[0] : new Base[] {this.orderer}; // Reference
3337        case -120164120: /*allergyIntolerance*/ return this.allergyIntolerance == null ? new Base[0] : this.allergyIntolerance.toArray(new Base[this.allergyIntolerance.size()]); // Reference
3338        case 659473872: /*foodPreferenceModifier*/ return this.foodPreferenceModifier == null ? new Base[0] : this.foodPreferenceModifier.toArray(new Base[this.foodPreferenceModifier.size()]); // CodeableConcept
3339        case 1760260175: /*excludeFoodModifier*/ return this.excludeFoodModifier == null ? new Base[0] : this.excludeFoodModifier.toArray(new Base[this.excludeFoodModifier.size()]); // CodeableConcept
3340        case 1153521250: /*oralDiet*/ return this.oralDiet == null ? new Base[0] : new Base[] {this.oralDiet}; // NutritionOrderOralDietComponent
3341        case -711993159: /*supplement*/ return this.supplement == null ? new Base[0] : this.supplement.toArray(new Base[this.supplement.size()]); // NutritionOrderSupplementComponent
3342        case -671083805: /*enteralFormula*/ return this.enteralFormula == null ? new Base[0] : new Base[] {this.enteralFormula}; // NutritionOrderEnteralFormulaComponent
3343        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3344        default: return super.getProperty(hash, name, checkValid);
3345        }
3346
3347      }
3348
3349      @Override
3350      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3351        switch (hash) {
3352        case -1618432855: // identifier
3353          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3354          return value;
3355        case 8911915: // instantiatesCanonical
3356          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value)); // CanonicalType
3357          return value;
3358        case -1926393373: // instantiatesUri
3359          this.getInstantiatesUri().add(TypeConvertor.castToUri(value)); // UriType
3360          return value;
3361        case -246883639: // instantiates
3362          this.getInstantiates().add(TypeConvertor.castToUri(value)); // UriType
3363          return value;
3364        case -892481550: // status
3365          value = new RequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3366          this.status = (Enumeration) value; // Enumeration<RequestStatus>
3367          return value;
3368        case -1183762788: // intent
3369          value = new RequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
3370          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
3371          return value;
3372        case -791418107: // patient
3373          this.patient = TypeConvertor.castToReference(value); // Reference
3374          return value;
3375        case 1524132147: // encounter
3376          this.encounter = TypeConvertor.castToReference(value); // Reference
3377          return value;
3378        case 1792749467: // dateTime
3379          this.dateTime = TypeConvertor.castToDateTime(value); // DateTimeType
3380          return value;
3381        case -1207109509: // orderer
3382          this.orderer = TypeConvertor.castToReference(value); // Reference
3383          return value;
3384        case -120164120: // allergyIntolerance
3385          this.getAllergyIntolerance().add(TypeConvertor.castToReference(value)); // Reference
3386          return value;
3387        case 659473872: // foodPreferenceModifier
3388          this.getFoodPreferenceModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3389          return value;
3390        case 1760260175: // excludeFoodModifier
3391          this.getExcludeFoodModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3392          return value;
3393        case 1153521250: // oralDiet
3394          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3395          return value;
3396        case -711993159: // supplement
3397          this.getSupplement().add((NutritionOrderSupplementComponent) value); // NutritionOrderSupplementComponent
3398          return value;
3399        case -671083805: // enteralFormula
3400          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3401          return value;
3402        case 3387378: // note
3403          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
3404          return value;
3405        default: return super.setProperty(hash, name, value);
3406        }
3407
3408      }
3409
3410      @Override
3411      public Base setProperty(String name, Base value) throws FHIRException {
3412        if (name.equals("identifier")) {
3413          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3414        } else if (name.equals("instantiatesCanonical")) {
3415          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value));
3416        } else if (name.equals("instantiatesUri")) {
3417          this.getInstantiatesUri().add(TypeConvertor.castToUri(value));
3418        } else if (name.equals("instantiates")) {
3419          this.getInstantiates().add(TypeConvertor.castToUri(value));
3420        } else if (name.equals("status")) {
3421          value = new RequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3422          this.status = (Enumeration) value; // Enumeration<RequestStatus>
3423        } else if (name.equals("intent")) {
3424          value = new RequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
3425          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
3426        } else if (name.equals("patient")) {
3427          this.patient = TypeConvertor.castToReference(value); // Reference
3428        } else if (name.equals("encounter")) {
3429          this.encounter = TypeConvertor.castToReference(value); // Reference
3430        } else if (name.equals("dateTime")) {
3431          this.dateTime = TypeConvertor.castToDateTime(value); // DateTimeType
3432        } else if (name.equals("orderer")) {
3433          this.orderer = TypeConvertor.castToReference(value); // Reference
3434        } else if (name.equals("allergyIntolerance")) {
3435          this.getAllergyIntolerance().add(TypeConvertor.castToReference(value));
3436        } else if (name.equals("foodPreferenceModifier")) {
3437          this.getFoodPreferenceModifier().add(TypeConvertor.castToCodeableConcept(value));
3438        } else if (name.equals("excludeFoodModifier")) {
3439          this.getExcludeFoodModifier().add(TypeConvertor.castToCodeableConcept(value));
3440        } else if (name.equals("oralDiet")) {
3441          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3442        } else if (name.equals("supplement")) {
3443          this.getSupplement().add((NutritionOrderSupplementComponent) value);
3444        } else if (name.equals("enteralFormula")) {
3445          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3446        } else if (name.equals("note")) {
3447          this.getNote().add(TypeConvertor.castToAnnotation(value));
3448        } else
3449          return super.setProperty(name, value);
3450        return value;
3451      }
3452
3453      @Override
3454      public Base makeProperty(int hash, String name) throws FHIRException {
3455        switch (hash) {
3456        case -1618432855:  return addIdentifier(); 
3457        case 8911915:  return addInstantiatesCanonicalElement();
3458        case -1926393373:  return addInstantiatesUriElement();
3459        case -246883639:  return addInstantiatesElement();
3460        case -892481550:  return getStatusElement();
3461        case -1183762788:  return getIntentElement();
3462        case -791418107:  return getPatient();
3463        case 1524132147:  return getEncounter();
3464        case 1792749467:  return getDateTimeElement();
3465        case -1207109509:  return getOrderer();
3466        case -120164120:  return addAllergyIntolerance(); 
3467        case 659473872:  return addFoodPreferenceModifier(); 
3468        case 1760260175:  return addExcludeFoodModifier(); 
3469        case 1153521250:  return getOralDiet();
3470        case -711993159:  return addSupplement(); 
3471        case -671083805:  return getEnteralFormula();
3472        case 3387378:  return addNote(); 
3473        default: return super.makeProperty(hash, name);
3474        }
3475
3476      }
3477
3478      @Override
3479      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3480        switch (hash) {
3481        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3482        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
3483        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
3484        case -246883639: /*instantiates*/ return new String[] {"uri"};
3485        case -892481550: /*status*/ return new String[] {"code"};
3486        case -1183762788: /*intent*/ return new String[] {"code"};
3487        case -791418107: /*patient*/ return new String[] {"Reference"};
3488        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3489        case 1792749467: /*dateTime*/ return new String[] {"dateTime"};
3490        case -1207109509: /*orderer*/ return new String[] {"Reference"};
3491        case -120164120: /*allergyIntolerance*/ return new String[] {"Reference"};
3492        case 659473872: /*foodPreferenceModifier*/ return new String[] {"CodeableConcept"};
3493        case 1760260175: /*excludeFoodModifier*/ return new String[] {"CodeableConcept"};
3494        case 1153521250: /*oralDiet*/ return new String[] {};
3495        case -711993159: /*supplement*/ return new String[] {};
3496        case -671083805: /*enteralFormula*/ return new String[] {};
3497        case 3387378: /*note*/ return new String[] {"Annotation"};
3498        default: return super.getTypesForProperty(hash, name);
3499        }
3500
3501      }
3502
3503      @Override
3504      public Base addChild(String name) throws FHIRException {
3505        if (name.equals("identifier")) {
3506          return addIdentifier();
3507        }
3508        else if (name.equals("instantiatesCanonical")) {
3509          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesCanonical");
3510        }
3511        else if (name.equals("instantiatesUri")) {
3512          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesUri");
3513        }
3514        else if (name.equals("instantiates")) {
3515          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiates");
3516        }
3517        else if (name.equals("status")) {
3518          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.status");
3519        }
3520        else if (name.equals("intent")) {
3521          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.intent");
3522        }
3523        else if (name.equals("patient")) {
3524          this.patient = new Reference();
3525          return this.patient;
3526        }
3527        else if (name.equals("encounter")) {
3528          this.encounter = new Reference();
3529          return this.encounter;
3530        }
3531        else if (name.equals("dateTime")) {
3532          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.dateTime");
3533        }
3534        else if (name.equals("orderer")) {
3535          this.orderer = new Reference();
3536          return this.orderer;
3537        }
3538        else if (name.equals("allergyIntolerance")) {
3539          return addAllergyIntolerance();
3540        }
3541        else if (name.equals("foodPreferenceModifier")) {
3542          return addFoodPreferenceModifier();
3543        }
3544        else if (name.equals("excludeFoodModifier")) {
3545          return addExcludeFoodModifier();
3546        }
3547        else if (name.equals("oralDiet")) {
3548          this.oralDiet = new NutritionOrderOralDietComponent();
3549          return this.oralDiet;
3550        }
3551        else if (name.equals("supplement")) {
3552          return addSupplement();
3553        }
3554        else if (name.equals("enteralFormula")) {
3555          this.enteralFormula = new NutritionOrderEnteralFormulaComponent();
3556          return this.enteralFormula;
3557        }
3558        else if (name.equals("note")) {
3559          return addNote();
3560        }
3561        else
3562          return super.addChild(name);
3563      }
3564
3565  public String fhirType() {
3566    return "NutritionOrder";
3567
3568  }
3569
3570      public NutritionOrder copy() {
3571        NutritionOrder dst = new NutritionOrder();
3572        copyValues(dst);
3573        return dst;
3574      }
3575
3576      public void copyValues(NutritionOrder dst) {
3577        super.copyValues(dst);
3578        if (identifier != null) {
3579          dst.identifier = new ArrayList<Identifier>();
3580          for (Identifier i : identifier)
3581            dst.identifier.add(i.copy());
3582        };
3583        if (instantiatesCanonical != null) {
3584          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
3585          for (CanonicalType i : instantiatesCanonical)
3586            dst.instantiatesCanonical.add(i.copy());
3587        };
3588        if (instantiatesUri != null) {
3589          dst.instantiatesUri = new ArrayList<UriType>();
3590          for (UriType i : instantiatesUri)
3591            dst.instantiatesUri.add(i.copy());
3592        };
3593        if (instantiates != null) {
3594          dst.instantiates = new ArrayList<UriType>();
3595          for (UriType i : instantiates)
3596            dst.instantiates.add(i.copy());
3597        };
3598        dst.status = status == null ? null : status.copy();
3599        dst.intent = intent == null ? null : intent.copy();
3600        dst.patient = patient == null ? null : patient.copy();
3601        dst.encounter = encounter == null ? null : encounter.copy();
3602        dst.dateTime = dateTime == null ? null : dateTime.copy();
3603        dst.orderer = orderer == null ? null : orderer.copy();
3604        if (allergyIntolerance != null) {
3605          dst.allergyIntolerance = new ArrayList<Reference>();
3606          for (Reference i : allergyIntolerance)
3607            dst.allergyIntolerance.add(i.copy());
3608        };
3609        if (foodPreferenceModifier != null) {
3610          dst.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3611          for (CodeableConcept i : foodPreferenceModifier)
3612            dst.foodPreferenceModifier.add(i.copy());
3613        };
3614        if (excludeFoodModifier != null) {
3615          dst.excludeFoodModifier = new ArrayList<CodeableConcept>();
3616          for (CodeableConcept i : excludeFoodModifier)
3617            dst.excludeFoodModifier.add(i.copy());
3618        };
3619        dst.oralDiet = oralDiet == null ? null : oralDiet.copy();
3620        if (supplement != null) {
3621          dst.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3622          for (NutritionOrderSupplementComponent i : supplement)
3623            dst.supplement.add(i.copy());
3624        };
3625        dst.enteralFormula = enteralFormula == null ? null : enteralFormula.copy();
3626        if (note != null) {
3627          dst.note = new ArrayList<Annotation>();
3628          for (Annotation i : note)
3629            dst.note.add(i.copy());
3630        };
3631      }
3632
3633      protected NutritionOrder typedCopy() {
3634        return copy();
3635      }
3636
3637      @Override
3638      public boolean equalsDeep(Base other_) {
3639        if (!super.equalsDeep(other_))
3640          return false;
3641        if (!(other_ instanceof NutritionOrder))
3642          return false;
3643        NutritionOrder o = (NutritionOrder) other_;
3644        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
3645           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(instantiates, o.instantiates, true)
3646           && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true) && compareDeep(patient, o.patient, true)
3647           && compareDeep(encounter, o.encounter, true) && compareDeep(dateTime, o.dateTime, true) && compareDeep(orderer, o.orderer, true)
3648           && compareDeep(allergyIntolerance, o.allergyIntolerance, true) && compareDeep(foodPreferenceModifier, o.foodPreferenceModifier, true)
3649           && compareDeep(excludeFoodModifier, o.excludeFoodModifier, true) && compareDeep(oralDiet, o.oralDiet, true)
3650           && compareDeep(supplement, o.supplement, true) && compareDeep(enteralFormula, o.enteralFormula, true)
3651           && compareDeep(note, o.note, true);
3652      }
3653
3654      @Override
3655      public boolean equalsShallow(Base other_) {
3656        if (!super.equalsShallow(other_))
3657          return false;
3658        if (!(other_ instanceof NutritionOrder))
3659          return false;
3660        NutritionOrder o = (NutritionOrder) other_;
3661        return compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
3662           && compareValues(instantiates, o.instantiates, true) && compareValues(status, o.status, true) && compareValues(intent, o.intent, true)
3663           && compareValues(dateTime, o.dateTime, true);
3664      }
3665
3666      public boolean isEmpty() {
3667        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
3668          , instantiatesUri, instantiates, status, intent, patient, encounter, dateTime
3669          , orderer, allergyIntolerance, foodPreferenceModifier, excludeFoodModifier, oralDiet
3670          , supplement, enteralFormula, note);
3671      }
3672
3673  @Override
3674  public ResourceType getResourceType() {
3675    return ResourceType.NutritionOrder;
3676   }
3677
3678 /**
3679   * Search parameter: <b>additive</b>
3680   * <p>
3681   * Description: <b>Type of module component to add to the feeding</b><br>
3682   * Type: <b>token</b><br>
3683   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
3684   * </p>
3685   */
3686  @SearchParamDefinition(name="additive", path="NutritionOrder.enteralFormula.additiveType", description="Type of module component to add to the feeding", type="token" )
3687  public static final String SP_ADDITIVE = "additive";
3688 /**
3689   * <b>Fluent Client</b> search parameter constant for <b>additive</b>
3690   * <p>
3691   * Description: <b>Type of module component to add to the feeding</b><br>
3692   * Type: <b>token</b><br>
3693   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
3694   * </p>
3695   */
3696  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDITIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDITIVE);
3697
3698 /**
3699   * Search parameter: <b>datetime</b>
3700   * <p>
3701   * Description: <b>Return nutrition orders requested on this date</b><br>
3702   * Type: <b>date</b><br>
3703   * Path: <b>NutritionOrder.dateTime</b><br>
3704   * </p>
3705   */
3706  @SearchParamDefinition(name="datetime", path="NutritionOrder.dateTime", description="Return nutrition orders requested on this date", type="date" )
3707  public static final String SP_DATETIME = "datetime";
3708 /**
3709   * <b>Fluent Client</b> search parameter constant for <b>datetime</b>
3710   * <p>
3711   * Description: <b>Return nutrition orders requested on this date</b><br>
3712   * Type: <b>date</b><br>
3713   * Path: <b>NutritionOrder.dateTime</b><br>
3714   * </p>
3715   */
3716  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATETIME);
3717
3718 /**
3719   * Search parameter: <b>formula</b>
3720   * <p>
3721   * Description: <b>Type of enteral or infant formula</b><br>
3722   * Type: <b>token</b><br>
3723   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
3724   * </p>
3725   */
3726  @SearchParamDefinition(name="formula", path="NutritionOrder.enteralFormula.baseFormulaType", description="Type of enteral or infant formula", type="token" )
3727  public static final String SP_FORMULA = "formula";
3728 /**
3729   * <b>Fluent Client</b> search parameter constant for <b>formula</b>
3730   * <p>
3731   * Description: <b>Type of enteral or infant formula</b><br>
3732   * Type: <b>token</b><br>
3733   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
3734   * </p>
3735   */
3736  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMULA = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORMULA);
3737
3738 /**
3739   * Search parameter: <b>oraldiet</b>
3740   * <p>
3741   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
3742   * Type: <b>token</b><br>
3743   * Path: <b>NutritionOrder.oralDiet.type</b><br>
3744   * </p>
3745   */
3746  @SearchParamDefinition(name="oraldiet", path="NutritionOrder.oralDiet.type", description="Type of diet that can be consumed orally (i.e., take via the mouth).", type="token" )
3747  public static final String SP_ORALDIET = "oraldiet";
3748 /**
3749   * <b>Fluent Client</b> search parameter constant for <b>oraldiet</b>
3750   * <p>
3751   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
3752   * Type: <b>token</b><br>
3753   * Path: <b>NutritionOrder.oralDiet.type</b><br>
3754   * </p>
3755   */
3756  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORALDIET = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORALDIET);
3757
3758 /**
3759   * Search parameter: <b>provider</b>
3760   * <p>
3761   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
3762   * Type: <b>reference</b><br>
3763   * Path: <b>NutritionOrder.orderer</b><br>
3764   * </p>
3765   */
3766  @SearchParamDefinition(name="provider", path="NutritionOrder.orderer", description="The identity of the provider who placed the nutrition order", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
3767  public static final String SP_PROVIDER = "provider";
3768 /**
3769   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
3770   * <p>
3771   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
3772   * Type: <b>reference</b><br>
3773   * Path: <b>NutritionOrder.orderer</b><br>
3774   * </p>
3775   */
3776  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
3777
3778/**
3779   * Constant for fluent queries to be used to add include statements. Specifies
3780   * the path value of "<b>NutritionOrder:provider</b>".
3781   */
3782  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("NutritionOrder:provider").toLocked();
3783
3784 /**
3785   * Search parameter: <b>status</b>
3786   * <p>
3787   * Description: <b>Status of the nutrition order.</b><br>
3788   * Type: <b>token</b><br>
3789   * Path: <b>NutritionOrder.status</b><br>
3790   * </p>
3791   */
3792  @SearchParamDefinition(name="status", path="NutritionOrder.status", description="Status of the nutrition order.", type="token" )
3793  public static final String SP_STATUS = "status";
3794 /**
3795   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3796   * <p>
3797   * Description: <b>Status of the nutrition order.</b><br>
3798   * Type: <b>token</b><br>
3799   * Path: <b>NutritionOrder.status</b><br>
3800   * </p>
3801   */
3802  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3803
3804 /**
3805   * Search parameter: <b>supplement</b>
3806   * <p>
3807   * Description: <b>Type of supplement product requested</b><br>
3808   * Type: <b>token</b><br>
3809   * Path: <b>NutritionOrder.supplement.type</b><br>
3810   * </p>
3811   */
3812  @SearchParamDefinition(name="supplement", path="NutritionOrder.supplement.type", description="Type of supplement product requested", type="token" )
3813  public static final String SP_SUPPLEMENT = "supplement";
3814 /**
3815   * <b>Fluent Client</b> search parameter constant for <b>supplement</b>
3816   * <p>
3817   * Description: <b>Type of supplement product requested</b><br>
3818   * Type: <b>token</b><br>
3819   * Path: <b>NutritionOrder.supplement.type</b><br>
3820   * </p>
3821   */
3822  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUPPLEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUPPLEMENT);
3823
3824 /**
3825   * Search parameter: <b>encounter</b>
3826   * <p>
3827   * Description: <b>Multiple Resources: 
3828
3829* [Composition](composition.html): Context of the Composition
3830* [DeviceRequest](devicerequest.html): Encounter during which request was created
3831* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
3832* [Flag](flag.html): Alert relevant during encounter
3833* [List](list.html): Context in which list created
3834* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
3835* [Observation](observation.html): Encounter related to the observation
3836* [Procedure](procedure.html): The Encounter during which this Procedure was created
3837* [RiskAssessment](riskassessment.html): Where was assessment performed?
3838* [ServiceRequest](servicerequest.html): An encounter in which this request is made
3839* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
3840</b><br>
3841   * Type: <b>reference</b><br>
3842   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
3843   * </p>
3844   */
3845  @SearchParamDefinition(name="encounter", path="Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter", description="Multiple Resources: \r\n\r\n* [Composition](composition.html): Context of the Composition\r\n* [DeviceRequest](devicerequest.html): Encounter during which request was created\r\n* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made\r\n* [Flag](flag.html): Alert relevant during encounter\r\n* [List](list.html): Context in which list created\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier\r\n* [Observation](observation.html): Encounter related to the observation\r\n* [Procedure](procedure.html): The Encounter during which this Procedure was created\r\n* [RiskAssessment](riskassessment.html): Where was assessment performed?\r\n* [ServiceRequest](servicerequest.html): An encounter in which this request is made\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
3846  public static final String SP_ENCOUNTER = "encounter";
3847 /**
3848   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3849   * <p>
3850   * Description: <b>Multiple Resources: 
3851
3852* [Composition](composition.html): Context of the Composition
3853* [DeviceRequest](devicerequest.html): Encounter during which request was created
3854* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
3855* [Flag](flag.html): Alert relevant during encounter
3856* [List](list.html): Context in which list created
3857* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
3858* [Observation](observation.html): Encounter related to the observation
3859* [Procedure](procedure.html): The Encounter during which this Procedure was created
3860* [RiskAssessment](riskassessment.html): Where was assessment performed?
3861* [ServiceRequest](servicerequest.html): An encounter in which this request is made
3862* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
3863</b><br>
3864   * Type: <b>reference</b><br>
3865   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
3866   * </p>
3867   */
3868  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3869
3870/**
3871   * Constant for fluent queries to be used to add include statements. Specifies
3872   * the path value of "<b>NutritionOrder:encounter</b>".
3873   */
3874  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("NutritionOrder:encounter").toLocked();
3875
3876 /**
3877   * Search parameter: <b>identifier</b>
3878   * <p>
3879   * Description: <b>Multiple Resources: 
3880
3881* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3882* [CarePlan](careplan.html): External Ids for this plan
3883* [CareTeam](careteam.html): External Ids for this team
3884* [Composition](composition.html): Version-independent identifier for the Composition
3885* [Condition](condition.html): A unique identifier of the condition record
3886* [Consent](consent.html): Identifier for this record (external references)
3887* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3888* [DeviceRequest](devicerequest.html): Business identifier for request/order
3889* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3890* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
3891* [DocumentReference](documentreference.html): Identifier of the attachment binary
3892* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3893* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3894* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3895* [Goal](goal.html): External Ids for this goal
3896* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
3897* [Immunization](immunization.html): Business identifier
3898* [List](list.html): Business identifier
3899* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3900* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3901* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3902* [MedicationUsage](medicationusage.html): Return statements with this external identifier
3903* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3904* [Observation](observation.html): The unique id for a particular observation
3905* [Procedure](procedure.html): A unique identifier for a procedure
3906* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3907* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3908* [SupplyDelivery](supplydelivery.html): External identifier
3909* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3910* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3911</b><br>
3912   * Type: <b>token</b><br>
3913   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
3914   * </p>
3915   */
3916  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationUsage](medicationusage.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
3917  public static final String SP_IDENTIFIER = "identifier";
3918 /**
3919   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3920   * <p>
3921   * Description: <b>Multiple Resources: 
3922
3923* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3924* [CarePlan](careplan.html): External Ids for this plan
3925* [CareTeam](careteam.html): External Ids for this team
3926* [Composition](composition.html): Version-independent identifier for the Composition
3927* [Condition](condition.html): A unique identifier of the condition record
3928* [Consent](consent.html): Identifier for this record (external references)
3929* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3930* [DeviceRequest](devicerequest.html): Business identifier for request/order
3931* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3932* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
3933* [DocumentReference](documentreference.html): Identifier of the attachment binary
3934* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3935* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3936* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3937* [Goal](goal.html): External Ids for this goal
3938* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
3939* [Immunization](immunization.html): Business identifier
3940* [List](list.html): Business identifier
3941* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3942* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3943* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3944* [MedicationUsage](medicationusage.html): Return statements with this external identifier
3945* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3946* [Observation](observation.html): The unique id for a particular observation
3947* [Procedure](procedure.html): A unique identifier for a procedure
3948* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3949* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3950* [SupplyDelivery](supplydelivery.html): External identifier
3951* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3952* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3953</b><br>
3954   * Type: <b>token</b><br>
3955   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
3956   * </p>
3957   */
3958  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3959
3960 /**
3961   * Search parameter: <b>patient</b>
3962   * <p>
3963   * Description: <b>Multiple Resources: 
3964
3965* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
3966* [CarePlan](careplan.html): Who the care plan is for
3967* [CareTeam](careteam.html): Who care team is for
3968* [ClinicalImpression](clinicalimpression.html): Patient assessed
3969* [Composition](composition.html): Who and/or what the composition is about
3970* [Condition](condition.html): Who has the condition?
3971* [Consent](consent.html): Who the consent applies to
3972* [DetectedIssue](detectedissue.html): Associated patient
3973* [DeviceRequest](devicerequest.html): Individual the service is ordered for
3974* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
3975* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
3976* [DocumentManifest](documentmanifest.html): The subject of the set of documents
3977* [DocumentReference](documentreference.html): Who/what is the subject of the document
3978* [Encounter](encounter.html): The patient present at the encounter
3979* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
3980* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
3981* [Flag](flag.html): The identity of a subject to list flags for
3982* [Goal](goal.html): Who this goal is intended for
3983* [ImagingStudy](imagingstudy.html): Who the study is about
3984* [Immunization](immunization.html): The patient for the vaccination record
3985* [List](list.html): If all resources have the same subject
3986* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3987* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3988* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3989* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
3990* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
3991* [Observation](observation.html): The subject that the observation is about (if patient)
3992* [Procedure](procedure.html): Search by subject - a patient
3993* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3994* [ServiceRequest](servicerequest.html): Search by subject - a patient
3995* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3996* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3997</b><br>
3998   * Type: <b>reference</b><br>
3999   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
4000   * </p>
4001   */
4002  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
4003  public static final String SP_PATIENT = "patient";
4004 /**
4005   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4006   * <p>
4007   * Description: <b>Multiple Resources: 
4008
4009* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
4010* [CarePlan](careplan.html): Who the care plan is for
4011* [CareTeam](careteam.html): Who care team is for
4012* [ClinicalImpression](clinicalimpression.html): Patient assessed
4013* [Composition](composition.html): Who and/or what the composition is about
4014* [Condition](condition.html): Who has the condition?
4015* [Consent](consent.html): Who the consent applies to
4016* [DetectedIssue](detectedissue.html): Associated patient
4017* [DeviceRequest](devicerequest.html): Individual the service is ordered for
4018* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
4019* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
4020* [DocumentManifest](documentmanifest.html): The subject of the set of documents
4021* [DocumentReference](documentreference.html): Who/what is the subject of the document
4022* [Encounter](encounter.html): The patient present at the encounter
4023* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
4024* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
4025* [Flag](flag.html): The identity of a subject to list flags for
4026* [Goal](goal.html): Who this goal is intended for
4027* [ImagingStudy](imagingstudy.html): Who the study is about
4028* [Immunization](immunization.html): The patient for the vaccination record
4029* [List](list.html): If all resources have the same subject
4030* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
4031* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
4032* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
4033* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
4034* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
4035* [Observation](observation.html): The subject that the observation is about (if patient)
4036* [Procedure](procedure.html): Search by subject - a patient
4037* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
4038* [ServiceRequest](servicerequest.html): Search by subject - a patient
4039* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
4040* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
4041</b><br>
4042   * Type: <b>reference</b><br>
4043   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
4044   * </p>
4045   */
4046  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4047
4048/**
4049   * Constant for fluent queries to be used to add include statements. Specifies
4050   * the path value of "<b>NutritionOrder:patient</b>".
4051   */
4052  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("NutritionOrder:patient").toLocked();
4053
4054
4055}
4056