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