001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046/**
047 * A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.
048 */
049@ResourceDef(name="NutritionOrder", profile="http://hl7.org/fhir/Profile/NutritionOrder")
050public class NutritionOrder extends DomainResource {
051
052    public enum NutritionOrderStatus {
053        /**
054         * The request has been proposed.
055         */
056        PROPOSED, 
057        /**
058         * The request is in preliminary form prior to being sent.
059         */
060        DRAFT, 
061        /**
062         * The request has been planned.
063         */
064        PLANNED, 
065        /**
066         * The request has been placed.
067         */
068        REQUESTED, 
069        /**
070         * The request is 'actionable', but not all actions that are implied by it have occurred yet.
071         */
072        ACTIVE, 
073        /**
074         * Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called "suspended".
075         */
076        ONHOLD, 
077        /**
078         * All actions that are implied by the order have occurred and no continuation is planned (this will rarely be made explicit).
079         */
080        COMPLETED, 
081        /**
082         * The request has been withdrawn and is no longer actionable.
083         */
084        CANCELLED, 
085        /**
086         * The request was entered in error and voided.
087         */
088        ENTEREDINERROR, 
089        /**
090         * added to help the parsers
091         */
092        NULL;
093        public static NutritionOrderStatus fromCode(String codeString) throws FHIRException {
094            if (codeString == null || "".equals(codeString))
095                return null;
096        if ("proposed".equals(codeString))
097          return PROPOSED;
098        if ("draft".equals(codeString))
099          return DRAFT;
100        if ("planned".equals(codeString))
101          return PLANNED;
102        if ("requested".equals(codeString))
103          return REQUESTED;
104        if ("active".equals(codeString))
105          return ACTIVE;
106        if ("on-hold".equals(codeString))
107          return ONHOLD;
108        if ("completed".equals(codeString))
109          return COMPLETED;
110        if ("cancelled".equals(codeString))
111          return CANCELLED;
112        if ("entered-in-error".equals(codeString))
113          return ENTEREDINERROR;
114        throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
115        }
116        public String toCode() {
117          switch (this) {
118            case PROPOSED: return "proposed";
119            case DRAFT: return "draft";
120            case PLANNED: return "planned";
121            case REQUESTED: return "requested";
122            case ACTIVE: return "active";
123            case ONHOLD: return "on-hold";
124            case COMPLETED: return "completed";
125            case CANCELLED: return "cancelled";
126            case ENTEREDINERROR: return "entered-in-error";
127            default: return "?";
128          }
129        }
130        public String getSystem() {
131          switch (this) {
132            case PROPOSED: return "http://hl7.org/fhir/nutrition-order-status";
133            case DRAFT: return "http://hl7.org/fhir/nutrition-order-status";
134            case PLANNED: return "http://hl7.org/fhir/nutrition-order-status";
135            case REQUESTED: return "http://hl7.org/fhir/nutrition-order-status";
136            case ACTIVE: return "http://hl7.org/fhir/nutrition-order-status";
137            case ONHOLD: return "http://hl7.org/fhir/nutrition-order-status";
138            case COMPLETED: return "http://hl7.org/fhir/nutrition-order-status";
139            case CANCELLED: return "http://hl7.org/fhir/nutrition-order-status";
140            case ENTEREDINERROR: return "http://hl7.org/fhir/nutrition-order-status";
141            default: return "?";
142          }
143        }
144        public String getDefinition() {
145          switch (this) {
146            case PROPOSED: return "The request has been proposed.";
147            case DRAFT: return "The request is in preliminary form prior to being sent.";
148            case PLANNED: return "The request has been planned.";
149            case REQUESTED: return "The request has been placed.";
150            case ACTIVE: return "The request is 'actionable', but not all actions that are implied by it have occurred yet.";
151            case ONHOLD: return "Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
152            case COMPLETED: return "All actions that are implied by the order have occurred and no continuation is planned (this will rarely be made explicit).";
153            case CANCELLED: return "The request has been withdrawn and is no longer actionable.";
154            case ENTEREDINERROR: return "The request was entered in error and voided.";
155            default: return "?";
156          }
157        }
158        public String getDisplay() {
159          switch (this) {
160            case PROPOSED: return "Proposed";
161            case DRAFT: return "Draft";
162            case PLANNED: return "Planned";
163            case REQUESTED: return "Requested";
164            case ACTIVE: return "Active";
165            case ONHOLD: return "On-Hold";
166            case COMPLETED: return "Completed";
167            case CANCELLED: return "Cancelled";
168            case ENTEREDINERROR: return "Entered in Error";
169            default: return "?";
170          }
171        }
172    }
173
174  public static class NutritionOrderStatusEnumFactory implements EnumFactory<NutritionOrderStatus> {
175    public NutritionOrderStatus fromCode(String codeString) throws IllegalArgumentException {
176      if (codeString == null || "".equals(codeString))
177            if (codeString == null || "".equals(codeString))
178                return null;
179        if ("proposed".equals(codeString))
180          return NutritionOrderStatus.PROPOSED;
181        if ("draft".equals(codeString))
182          return NutritionOrderStatus.DRAFT;
183        if ("planned".equals(codeString))
184          return NutritionOrderStatus.PLANNED;
185        if ("requested".equals(codeString))
186          return NutritionOrderStatus.REQUESTED;
187        if ("active".equals(codeString))
188          return NutritionOrderStatus.ACTIVE;
189        if ("on-hold".equals(codeString))
190          return NutritionOrderStatus.ONHOLD;
191        if ("completed".equals(codeString))
192          return NutritionOrderStatus.COMPLETED;
193        if ("cancelled".equals(codeString))
194          return NutritionOrderStatus.CANCELLED;
195        if ("entered-in-error".equals(codeString))
196          return NutritionOrderStatus.ENTEREDINERROR;
197        throw new IllegalArgumentException("Unknown NutritionOrderStatus code '"+codeString+"'");
198        }
199        public Enumeration<NutritionOrderStatus> fromType(Base code) throws FHIRException {
200          if (code == null || code.isEmpty())
201            return null;
202          String codeString = ((PrimitiveType) code).asStringValue();
203          if (codeString == null || "".equals(codeString))
204            return null;
205        if ("proposed".equals(codeString))
206          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.PROPOSED);
207        if ("draft".equals(codeString))
208          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.DRAFT);
209        if ("planned".equals(codeString))
210          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.PLANNED);
211        if ("requested".equals(codeString))
212          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.REQUESTED);
213        if ("active".equals(codeString))
214          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ACTIVE);
215        if ("on-hold".equals(codeString))
216          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ONHOLD);
217        if ("completed".equals(codeString))
218          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.COMPLETED);
219        if ("cancelled".equals(codeString))
220          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.CANCELLED);
221        if ("entered-in-error".equals(codeString))
222          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ENTEREDINERROR);
223        throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
224        }
225    public String toCode(NutritionOrderStatus code) {
226      if (code == NutritionOrderStatus.PROPOSED)
227        return "proposed";
228      if (code == NutritionOrderStatus.DRAFT)
229        return "draft";
230      if (code == NutritionOrderStatus.PLANNED)
231        return "planned";
232      if (code == NutritionOrderStatus.REQUESTED)
233        return "requested";
234      if (code == NutritionOrderStatus.ACTIVE)
235        return "active";
236      if (code == NutritionOrderStatus.ONHOLD)
237        return "on-hold";
238      if (code == NutritionOrderStatus.COMPLETED)
239        return "completed";
240      if (code == NutritionOrderStatus.CANCELLED)
241        return "cancelled";
242      if (code == NutritionOrderStatus.ENTEREDINERROR)
243        return "entered-in-error";
244      return "?";
245      }
246    public String toSystem(NutritionOrderStatus code) {
247      return code.getSystem();
248      }
249    }
250
251    @Block()
252    public static class NutritionOrderOralDietComponent extends BackboneElement implements IBaseBackboneElement {
253        /**
254         * The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.
255         */
256        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
257        @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." )
258        protected List<CodeableConcept> type;
259
260        /**
261         * The time period and frequency at which the diet should be given.
262         */
263        @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
264        @Description(shortDefinition="Scheduled frequency of diet", formalDefinition="The time period and frequency at which the diet should be given." )
265        protected List<Timing> schedule;
266
267        /**
268         * Class that defines the quantity and type of nutrient modifications required for the oral diet.
269         */
270        @Child(name = "nutrient", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
271        @Description(shortDefinition="Required  nutrient modifications", formalDefinition="Class that defines the quantity and type of nutrient modifications required for the oral diet." )
272        protected List<NutritionOrderOralDietNutrientComponent> nutrient;
273
274        /**
275         * Class that describes any texture modifications required for the patient to safely consume various types of solid foods.
276         */
277        @Child(name = "texture", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
278        @Description(shortDefinition="Required  texture modifications", formalDefinition="Class that describes any texture modifications required for the patient to safely consume various types of solid foods." )
279        protected List<NutritionOrderOralDietTextureComponent> texture;
280
281        /**
282         * The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.
283         */
284        @Child(name = "fluidConsistencyType", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
285        @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." )
286        protected List<CodeableConcept> fluidConsistencyType;
287
288        /**
289         * Free text or additional instructions or information pertaining to the oral diet.
290         */
291        @Child(name = "instruction", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
292        @Description(shortDefinition="Instructions or additional information about the oral diet", formalDefinition="Free text or additional instructions or information pertaining to the oral diet." )
293        protected StringType instruction;
294
295        private static final long serialVersionUID = 973058412L;
296
297    /**
298     * Constructor
299     */
300      public NutritionOrderOralDietComponent() {
301        super();
302      }
303
304        /**
305         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
306         */
307        public List<CodeableConcept> getType() { 
308          if (this.type == null)
309            this.type = new ArrayList<CodeableConcept>();
310          return this.type;
311        }
312
313        public boolean hasType() { 
314          if (this.type == null)
315            return false;
316          for (CodeableConcept item : this.type)
317            if (!item.isEmpty())
318              return true;
319          return false;
320        }
321
322        /**
323         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
324         */
325    // syntactic sugar
326        public CodeableConcept addType() { //3
327          CodeableConcept t = new CodeableConcept();
328          if (this.type == null)
329            this.type = new ArrayList<CodeableConcept>();
330          this.type.add(t);
331          return t;
332        }
333
334    // syntactic sugar
335        public NutritionOrderOralDietComponent addType(CodeableConcept t) { //3
336          if (t == null)
337            return this;
338          if (this.type == null)
339            this.type = new ArrayList<CodeableConcept>();
340          this.type.add(t);
341          return this;
342        }
343
344        /**
345         * @return {@link #schedule} (The time period and frequency at which the diet should be given.)
346         */
347        public List<Timing> getSchedule() { 
348          if (this.schedule == null)
349            this.schedule = new ArrayList<Timing>();
350          return this.schedule;
351        }
352
353        public boolean hasSchedule() { 
354          if (this.schedule == null)
355            return false;
356          for (Timing item : this.schedule)
357            if (!item.isEmpty())
358              return true;
359          return false;
360        }
361
362        /**
363         * @return {@link #schedule} (The time period and frequency at which the diet should be given.)
364         */
365    // syntactic sugar
366        public Timing addSchedule() { //3
367          Timing t = new Timing();
368          if (this.schedule == null)
369            this.schedule = new ArrayList<Timing>();
370          this.schedule.add(t);
371          return t;
372        }
373
374    // syntactic sugar
375        public NutritionOrderOralDietComponent addSchedule(Timing t) { //3
376          if (t == null)
377            return this;
378          if (this.schedule == null)
379            this.schedule = new ArrayList<Timing>();
380          this.schedule.add(t);
381          return this;
382        }
383
384        /**
385         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications required for the oral diet.)
386         */
387        public List<NutritionOrderOralDietNutrientComponent> getNutrient() { 
388          if (this.nutrient == null)
389            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
390          return this.nutrient;
391        }
392
393        public boolean hasNutrient() { 
394          if (this.nutrient == null)
395            return false;
396          for (NutritionOrderOralDietNutrientComponent item : this.nutrient)
397            if (!item.isEmpty())
398              return true;
399          return false;
400        }
401
402        /**
403         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications required for the oral diet.)
404         */
405    // syntactic sugar
406        public NutritionOrderOralDietNutrientComponent addNutrient() { //3
407          NutritionOrderOralDietNutrientComponent t = new NutritionOrderOralDietNutrientComponent();
408          if (this.nutrient == null)
409            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
410          this.nutrient.add(t);
411          return t;
412        }
413
414    // syntactic sugar
415        public NutritionOrderOralDietComponent addNutrient(NutritionOrderOralDietNutrientComponent t) { //3
416          if (t == null)
417            return this;
418          if (this.nutrient == null)
419            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
420          this.nutrient.add(t);
421          return this;
422        }
423
424        /**
425         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
426         */
427        public List<NutritionOrderOralDietTextureComponent> getTexture() { 
428          if (this.texture == null)
429            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
430          return this.texture;
431        }
432
433        public boolean hasTexture() { 
434          if (this.texture == null)
435            return false;
436          for (NutritionOrderOralDietTextureComponent item : this.texture)
437            if (!item.isEmpty())
438              return true;
439          return false;
440        }
441
442        /**
443         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
444         */
445    // syntactic sugar
446        public NutritionOrderOralDietTextureComponent addTexture() { //3
447          NutritionOrderOralDietTextureComponent t = new NutritionOrderOralDietTextureComponent();
448          if (this.texture == null)
449            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
450          this.texture.add(t);
451          return t;
452        }
453
454    // syntactic sugar
455        public NutritionOrderOralDietComponent addTexture(NutritionOrderOralDietTextureComponent t) { //3
456          if (t == null)
457            return this;
458          if (this.texture == null)
459            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
460          this.texture.add(t);
461          return this;
462        }
463
464        /**
465         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
466         */
467        public List<CodeableConcept> getFluidConsistencyType() { 
468          if (this.fluidConsistencyType == null)
469            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
470          return this.fluidConsistencyType;
471        }
472
473        public boolean hasFluidConsistencyType() { 
474          if (this.fluidConsistencyType == null)
475            return false;
476          for (CodeableConcept item : this.fluidConsistencyType)
477            if (!item.isEmpty())
478              return true;
479          return false;
480        }
481
482        /**
483         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
484         */
485    // syntactic sugar
486        public CodeableConcept addFluidConsistencyType() { //3
487          CodeableConcept t = new CodeableConcept();
488          if (this.fluidConsistencyType == null)
489            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
490          this.fluidConsistencyType.add(t);
491          return t;
492        }
493
494    // syntactic sugar
495        public NutritionOrderOralDietComponent addFluidConsistencyType(CodeableConcept t) { //3
496          if (t == null)
497            return this;
498          if (this.fluidConsistencyType == null)
499            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
500          this.fluidConsistencyType.add(t);
501          return this;
502        }
503
504        /**
505         * @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
506         */
507        public StringType getInstructionElement() { 
508          if (this.instruction == null)
509            if (Configuration.errorOnAutoCreate())
510              throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.instruction");
511            else if (Configuration.doAutoCreate())
512              this.instruction = new StringType(); // bb
513          return this.instruction;
514        }
515
516        public boolean hasInstructionElement() { 
517          return this.instruction != null && !this.instruction.isEmpty();
518        }
519
520        public boolean hasInstruction() { 
521          return this.instruction != null && !this.instruction.isEmpty();
522        }
523
524        /**
525         * @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
526         */
527        public NutritionOrderOralDietComponent setInstructionElement(StringType value) { 
528          this.instruction = value;
529          return this;
530        }
531
532        /**
533         * @return Free text or additional instructions or information pertaining to the oral diet.
534         */
535        public String getInstruction() { 
536          return this.instruction == null ? null : this.instruction.getValue();
537        }
538
539        /**
540         * @param value Free text or additional instructions or information pertaining to the oral diet.
541         */
542        public NutritionOrderOralDietComponent setInstruction(String value) { 
543          if (Utilities.noString(value))
544            this.instruction = null;
545          else {
546            if (this.instruction == null)
547              this.instruction = new StringType();
548            this.instruction.setValue(value);
549          }
550          return this;
551        }
552
553        protected void listChildren(List<Property> childrenList) {
554          super.listChildren(childrenList);
555          childrenList.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));
556          childrenList.add(new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.", 0, java.lang.Integer.MAX_VALUE, schedule));
557          childrenList.add(new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient));
558          childrenList.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));
559          childrenList.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));
560          childrenList.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, java.lang.Integer.MAX_VALUE, instruction));
561        }
562
563      @Override
564      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
565        switch (hash) {
566        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
567        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
568        case -1671151641: /*nutrient*/ return this.nutrient == null ? new Base[0] : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionOrderOralDietNutrientComponent
569        case -1417816805: /*texture*/ return this.texture == null ? new Base[0] : this.texture.toArray(new Base[this.texture.size()]); // NutritionOrderOralDietTextureComponent
570        case -525105592: /*fluidConsistencyType*/ return this.fluidConsistencyType == null ? new Base[0] : this.fluidConsistencyType.toArray(new Base[this.fluidConsistencyType.size()]); // CodeableConcept
571        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
572        default: return super.getProperty(hash, name, checkValid);
573        }
574
575      }
576
577      @Override
578      public void setProperty(int hash, String name, Base value) throws FHIRException {
579        switch (hash) {
580        case 3575610: // type
581          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
582          break;
583        case -697920873: // schedule
584          this.getSchedule().add(castToTiming(value)); // Timing
585          break;
586        case -1671151641: // nutrient
587          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value); // NutritionOrderOralDietNutrientComponent
588          break;
589        case -1417816805: // texture
590          this.getTexture().add((NutritionOrderOralDietTextureComponent) value); // NutritionOrderOralDietTextureComponent
591          break;
592        case -525105592: // fluidConsistencyType
593          this.getFluidConsistencyType().add(castToCodeableConcept(value)); // CodeableConcept
594          break;
595        case 301526158: // instruction
596          this.instruction = castToString(value); // StringType
597          break;
598        default: super.setProperty(hash, name, value);
599        }
600
601      }
602
603      @Override
604      public void setProperty(String name, Base value) throws FHIRException {
605        if (name.equals("type"))
606          this.getType().add(castToCodeableConcept(value));
607        else if (name.equals("schedule"))
608          this.getSchedule().add(castToTiming(value));
609        else if (name.equals("nutrient"))
610          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value);
611        else if (name.equals("texture"))
612          this.getTexture().add((NutritionOrderOralDietTextureComponent) value);
613        else if (name.equals("fluidConsistencyType"))
614          this.getFluidConsistencyType().add(castToCodeableConcept(value));
615        else if (name.equals("instruction"))
616          this.instruction = castToString(value); // StringType
617        else
618          super.setProperty(name, value);
619      }
620
621      @Override
622      public Base makeProperty(int hash, String name) throws FHIRException {
623        switch (hash) {
624        case 3575610:  return addType(); // CodeableConcept
625        case -697920873:  return addSchedule(); // Timing
626        case -1671151641:  return addNutrient(); // NutritionOrderOralDietNutrientComponent
627        case -1417816805:  return addTexture(); // NutritionOrderOralDietTextureComponent
628        case -525105592:  return addFluidConsistencyType(); // CodeableConcept
629        case 301526158: throw new FHIRException("Cannot make property instruction as it is not a complex type"); // StringType
630        default: return super.makeProperty(hash, name);
631        }
632
633      }
634
635      @Override
636      public Base addChild(String name) throws FHIRException {
637        if (name.equals("type")) {
638          return addType();
639        }
640        else if (name.equals("schedule")) {
641          return addSchedule();
642        }
643        else if (name.equals("nutrient")) {
644          return addNutrient();
645        }
646        else if (name.equals("texture")) {
647          return addTexture();
648        }
649        else if (name.equals("fluidConsistencyType")) {
650          return addFluidConsistencyType();
651        }
652        else if (name.equals("instruction")) {
653          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
654        }
655        else
656          return super.addChild(name);
657      }
658
659      public NutritionOrderOralDietComponent copy() {
660        NutritionOrderOralDietComponent dst = new NutritionOrderOralDietComponent();
661        copyValues(dst);
662        if (type != null) {
663          dst.type = new ArrayList<CodeableConcept>();
664          for (CodeableConcept i : type)
665            dst.type.add(i.copy());
666        };
667        if (schedule != null) {
668          dst.schedule = new ArrayList<Timing>();
669          for (Timing i : schedule)
670            dst.schedule.add(i.copy());
671        };
672        if (nutrient != null) {
673          dst.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
674          for (NutritionOrderOralDietNutrientComponent i : nutrient)
675            dst.nutrient.add(i.copy());
676        };
677        if (texture != null) {
678          dst.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
679          for (NutritionOrderOralDietTextureComponent i : texture)
680            dst.texture.add(i.copy());
681        };
682        if (fluidConsistencyType != null) {
683          dst.fluidConsistencyType = new ArrayList<CodeableConcept>();
684          for (CodeableConcept i : fluidConsistencyType)
685            dst.fluidConsistencyType.add(i.copy());
686        };
687        dst.instruction = instruction == null ? null : instruction.copy();
688        return dst;
689      }
690
691      @Override
692      public boolean equalsDeep(Base other) {
693        if (!super.equalsDeep(other))
694          return false;
695        if (!(other instanceof NutritionOrderOralDietComponent))
696          return false;
697        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other;
698        return compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true) && compareDeep(nutrient, o.nutrient, true)
699           && compareDeep(texture, o.texture, true) && compareDeep(fluidConsistencyType, o.fluidConsistencyType, true)
700           && compareDeep(instruction, o.instruction, true);
701      }
702
703      @Override
704      public boolean equalsShallow(Base other) {
705        if (!super.equalsShallow(other))
706          return false;
707        if (!(other instanceof NutritionOrderOralDietComponent))
708          return false;
709        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other;
710        return compareValues(instruction, o.instruction, true);
711      }
712
713      public boolean isEmpty() {
714        return super.isEmpty() && (type == null || type.isEmpty()) && (schedule == null || schedule.isEmpty())
715           && (nutrient == null || nutrient.isEmpty()) && (texture == null || texture.isEmpty()) && (fluidConsistencyType == null || fluidConsistencyType.isEmpty())
716           && (instruction == null || instruction.isEmpty());
717      }
718
719  public String fhirType() {
720    return "NutritionOrder.oralDiet";
721
722  }
723
724  }
725
726    @Block()
727    public static class NutritionOrderOralDietNutrientComponent extends BackboneElement implements IBaseBackboneElement {
728        /**
729         * The nutrient that is being modified such as carbohydrate or sodium.
730         */
731        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
732        @Description(shortDefinition="Type of nutrient that is being modified", formalDefinition="The nutrient that is being modified such as carbohydrate or sodium." )
733        protected CodeableConcept modifier;
734
735        /**
736         * The quantity of the specified nutrient to include in diet.
737         */
738        @Child(name = "amount", type = {SimpleQuantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
739        @Description(shortDefinition="Quantity of the specified nutrient", formalDefinition="The quantity of the specified nutrient to include in diet." )
740        protected SimpleQuantity amount;
741
742        private static final long serialVersionUID = 465107295L;
743
744    /**
745     * Constructor
746     */
747      public NutritionOrderOralDietNutrientComponent() {
748        super();
749      }
750
751        /**
752         * @return {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
753         */
754        public CodeableConcept getModifier() { 
755          if (this.modifier == null)
756            if (Configuration.errorOnAutoCreate())
757              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.modifier");
758            else if (Configuration.doAutoCreate())
759              this.modifier = new CodeableConcept(); // cc
760          return this.modifier;
761        }
762
763        public boolean hasModifier() { 
764          return this.modifier != null && !this.modifier.isEmpty();
765        }
766
767        /**
768         * @param value {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
769         */
770        public NutritionOrderOralDietNutrientComponent setModifier(CodeableConcept value) { 
771          this.modifier = value;
772          return this;
773        }
774
775        /**
776         * @return {@link #amount} (The quantity of the specified nutrient to include in diet.)
777         */
778        public SimpleQuantity getAmount() { 
779          if (this.amount == null)
780            if (Configuration.errorOnAutoCreate())
781              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.amount");
782            else if (Configuration.doAutoCreate())
783              this.amount = new SimpleQuantity(); // cc
784          return this.amount;
785        }
786
787        public boolean hasAmount() { 
788          return this.amount != null && !this.amount.isEmpty();
789        }
790
791        /**
792         * @param value {@link #amount} (The quantity of the specified nutrient to include in diet.)
793         */
794        public NutritionOrderOralDietNutrientComponent setAmount(SimpleQuantity value) { 
795          this.amount = value;
796          return this;
797        }
798
799        protected void listChildren(List<Property> childrenList) {
800          super.listChildren(childrenList);
801          childrenList.add(new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, java.lang.Integer.MAX_VALUE, modifier));
802          childrenList.add(new Property("amount", "SimpleQuantity", "The quantity of the specified nutrient to include in diet.", 0, java.lang.Integer.MAX_VALUE, amount));
803        }
804
805      @Override
806      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
807        switch (hash) {
808        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
809        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // SimpleQuantity
810        default: return super.getProperty(hash, name, checkValid);
811        }
812
813      }
814
815      @Override
816      public void setProperty(int hash, String name, Base value) throws FHIRException {
817        switch (hash) {
818        case -615513385: // modifier
819          this.modifier = castToCodeableConcept(value); // CodeableConcept
820          break;
821        case -1413853096: // amount
822          this.amount = castToSimpleQuantity(value); // SimpleQuantity
823          break;
824        default: super.setProperty(hash, name, value);
825        }
826
827      }
828
829      @Override
830      public void setProperty(String name, Base value) throws FHIRException {
831        if (name.equals("modifier"))
832          this.modifier = castToCodeableConcept(value); // CodeableConcept
833        else if (name.equals("amount"))
834          this.amount = castToSimpleQuantity(value); // SimpleQuantity
835        else
836          super.setProperty(name, value);
837      }
838
839      @Override
840      public Base makeProperty(int hash, String name) throws FHIRException {
841        switch (hash) {
842        case -615513385:  return getModifier(); // CodeableConcept
843        case -1413853096:  return getAmount(); // SimpleQuantity
844        default: return super.makeProperty(hash, name);
845        }
846
847      }
848
849      @Override
850      public Base addChild(String name) throws FHIRException {
851        if (name.equals("modifier")) {
852          this.modifier = new CodeableConcept();
853          return this.modifier;
854        }
855        else if (name.equals("amount")) {
856          this.amount = new SimpleQuantity();
857          return this.amount;
858        }
859        else
860          return super.addChild(name);
861      }
862
863      public NutritionOrderOralDietNutrientComponent copy() {
864        NutritionOrderOralDietNutrientComponent dst = new NutritionOrderOralDietNutrientComponent();
865        copyValues(dst);
866        dst.modifier = modifier == null ? null : modifier.copy();
867        dst.amount = amount == null ? null : amount.copy();
868        return dst;
869      }
870
871      @Override
872      public boolean equalsDeep(Base other) {
873        if (!super.equalsDeep(other))
874          return false;
875        if (!(other instanceof NutritionOrderOralDietNutrientComponent))
876          return false;
877        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other;
878        return compareDeep(modifier, o.modifier, true) && compareDeep(amount, o.amount, true);
879      }
880
881      @Override
882      public boolean equalsShallow(Base other) {
883        if (!super.equalsShallow(other))
884          return false;
885        if (!(other instanceof NutritionOrderOralDietNutrientComponent))
886          return false;
887        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other;
888        return true;
889      }
890
891      public boolean isEmpty() {
892        return super.isEmpty() && (modifier == null || modifier.isEmpty()) && (amount == null || amount.isEmpty())
893          ;
894      }
895
896  public String fhirType() {
897    return "NutritionOrder.oralDiet.nutrient";
898
899  }
900
901  }
902
903    @Block()
904    public static class NutritionOrderOralDietTextureComponent extends BackboneElement implements IBaseBackboneElement {
905        /**
906         * Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.
907         */
908        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
909        @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." )
910        protected CodeableConcept modifier;
911
912        /**
913         * The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.
914         */
915        @Child(name = "foodType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
916        @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." )
917        protected CodeableConcept foodType;
918
919        private static final long serialVersionUID = -56402817L;
920
921    /**
922     * Constructor
923     */
924      public NutritionOrderOralDietTextureComponent() {
925        super();
926      }
927
928        /**
929         * @return {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
930         */
931        public CodeableConcept getModifier() { 
932          if (this.modifier == null)
933            if (Configuration.errorOnAutoCreate())
934              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.modifier");
935            else if (Configuration.doAutoCreate())
936              this.modifier = new CodeableConcept(); // cc
937          return this.modifier;
938        }
939
940        public boolean hasModifier() { 
941          return this.modifier != null && !this.modifier.isEmpty();
942        }
943
944        /**
945         * @param value {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
946         */
947        public NutritionOrderOralDietTextureComponent setModifier(CodeableConcept value) { 
948          this.modifier = value;
949          return this;
950        }
951
952        /**
953         * @return {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
954         */
955        public CodeableConcept getFoodType() { 
956          if (this.foodType == null)
957            if (Configuration.errorOnAutoCreate())
958              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.foodType");
959            else if (Configuration.doAutoCreate())
960              this.foodType = new CodeableConcept(); // cc
961          return this.foodType;
962        }
963
964        public boolean hasFoodType() { 
965          return this.foodType != null && !this.foodType.isEmpty();
966        }
967
968        /**
969         * @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.)
970         */
971        public NutritionOrderOralDietTextureComponent setFoodType(CodeableConcept value) { 
972          this.foodType = value;
973          return this;
974        }
975
976        protected void listChildren(List<Property> childrenList) {
977          super.listChildren(childrenList);
978          childrenList.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, java.lang.Integer.MAX_VALUE, modifier));
979          childrenList.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, java.lang.Integer.MAX_VALUE, foodType));
980        }
981
982      @Override
983      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
984        switch (hash) {
985        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
986        case 379498680: /*foodType*/ return this.foodType == null ? new Base[0] : new Base[] {this.foodType}; // CodeableConcept
987        default: return super.getProperty(hash, name, checkValid);
988        }
989
990      }
991
992      @Override
993      public void setProperty(int hash, String name, Base value) throws FHIRException {
994        switch (hash) {
995        case -615513385: // modifier
996          this.modifier = castToCodeableConcept(value); // CodeableConcept
997          break;
998        case 379498680: // foodType
999          this.foodType = castToCodeableConcept(value); // CodeableConcept
1000          break;
1001        default: super.setProperty(hash, name, value);
1002        }
1003
1004      }
1005
1006      @Override
1007      public void setProperty(String name, Base value) throws FHIRException {
1008        if (name.equals("modifier"))
1009          this.modifier = castToCodeableConcept(value); // CodeableConcept
1010        else if (name.equals("foodType"))
1011          this.foodType = castToCodeableConcept(value); // CodeableConcept
1012        else
1013          super.setProperty(name, value);
1014      }
1015
1016      @Override
1017      public Base makeProperty(int hash, String name) throws FHIRException {
1018        switch (hash) {
1019        case -615513385:  return getModifier(); // CodeableConcept
1020        case 379498680:  return getFoodType(); // CodeableConcept
1021        default: return super.makeProperty(hash, name);
1022        }
1023
1024      }
1025
1026      @Override
1027      public Base addChild(String name) throws FHIRException {
1028        if (name.equals("modifier")) {
1029          this.modifier = new CodeableConcept();
1030          return this.modifier;
1031        }
1032        else if (name.equals("foodType")) {
1033          this.foodType = new CodeableConcept();
1034          return this.foodType;
1035        }
1036        else
1037          return super.addChild(name);
1038      }
1039
1040      public NutritionOrderOralDietTextureComponent copy() {
1041        NutritionOrderOralDietTextureComponent dst = new NutritionOrderOralDietTextureComponent();
1042        copyValues(dst);
1043        dst.modifier = modifier == null ? null : modifier.copy();
1044        dst.foodType = foodType == null ? null : foodType.copy();
1045        return dst;
1046      }
1047
1048      @Override
1049      public boolean equalsDeep(Base other) {
1050        if (!super.equalsDeep(other))
1051          return false;
1052        if (!(other instanceof NutritionOrderOralDietTextureComponent))
1053          return false;
1054        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other;
1055        return compareDeep(modifier, o.modifier, true) && compareDeep(foodType, o.foodType, true);
1056      }
1057
1058      @Override
1059      public boolean equalsShallow(Base other) {
1060        if (!super.equalsShallow(other))
1061          return false;
1062        if (!(other instanceof NutritionOrderOralDietTextureComponent))
1063          return false;
1064        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other;
1065        return true;
1066      }
1067
1068      public boolean isEmpty() {
1069        return super.isEmpty() && (modifier == null || modifier.isEmpty()) && (foodType == null || foodType.isEmpty())
1070          ;
1071      }
1072
1073  public String fhirType() {
1074    return "NutritionOrder.oralDiet.texture";
1075
1076  }
1077
1078  }
1079
1080    @Block()
1081    public static class NutritionOrderSupplementComponent extends BackboneElement implements IBaseBackboneElement {
1082        /**
1083         * The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.
1084         */
1085        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1086        @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." )
1087        protected CodeableConcept type;
1088
1089        /**
1090         * The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1091         */
1092        @Child(name = "productName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1093        @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\"." )
1094        protected StringType productName;
1095
1096        /**
1097         * The time period and frequency at which the supplement(s) should be given.
1098         */
1099        @Child(name = "schedule", type = {Timing.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1100        @Description(shortDefinition="Scheduled frequency of supplement", formalDefinition="The time period and frequency at which the supplement(s) should be given." )
1101        protected List<Timing> schedule;
1102
1103        /**
1104         * The amount of the nutritional supplement to be given.
1105         */
1106        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
1107        @Description(shortDefinition="Amount of the nutritional supplement", formalDefinition="The amount of the nutritional supplement to be given." )
1108        protected SimpleQuantity quantity;
1109
1110        /**
1111         * Free text or additional instructions or information pertaining to the oral supplement.
1112         */
1113        @Child(name = "instruction", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1114        @Description(shortDefinition="Instructions or additional information about the oral supplement", formalDefinition="Free text or additional instructions or information pertaining to the oral supplement." )
1115        protected StringType instruction;
1116
1117        private static final long serialVersionUID = 297545236L;
1118
1119    /**
1120     * Constructor
1121     */
1122      public NutritionOrderSupplementComponent() {
1123        super();
1124      }
1125
1126        /**
1127         * @return {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1128         */
1129        public CodeableConcept getType() { 
1130          if (this.type == null)
1131            if (Configuration.errorOnAutoCreate())
1132              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.type");
1133            else if (Configuration.doAutoCreate())
1134              this.type = new CodeableConcept(); // cc
1135          return this.type;
1136        }
1137
1138        public boolean hasType() { 
1139          return this.type != null && !this.type.isEmpty();
1140        }
1141
1142        /**
1143         * @param value {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1144         */
1145        public NutritionOrderSupplementComponent setType(CodeableConcept value) { 
1146          this.type = value;
1147          return this;
1148        }
1149
1150        /**
1151         * @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
1152         */
1153        public StringType getProductNameElement() { 
1154          if (this.productName == null)
1155            if (Configuration.errorOnAutoCreate())
1156              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.productName");
1157            else if (Configuration.doAutoCreate())
1158              this.productName = new StringType(); // bb
1159          return this.productName;
1160        }
1161
1162        public boolean hasProductNameElement() { 
1163          return this.productName != null && !this.productName.isEmpty();
1164        }
1165
1166        public boolean hasProductName() { 
1167          return this.productName != null && !this.productName.isEmpty();
1168        }
1169
1170        /**
1171         * @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
1172         */
1173        public NutritionOrderSupplementComponent setProductNameElement(StringType value) { 
1174          this.productName = value;
1175          return this;
1176        }
1177
1178        /**
1179         * @return The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1180         */
1181        public String getProductName() { 
1182          return this.productName == null ? null : this.productName.getValue();
1183        }
1184
1185        /**
1186         * @param value The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1187         */
1188        public NutritionOrderSupplementComponent setProductName(String value) { 
1189          if (Utilities.noString(value))
1190            this.productName = null;
1191          else {
1192            if (this.productName == null)
1193              this.productName = new StringType();
1194            this.productName.setValue(value);
1195          }
1196          return this;
1197        }
1198
1199        /**
1200         * @return {@link #schedule} (The time period and frequency at which the supplement(s) should be given.)
1201         */
1202        public List<Timing> getSchedule() { 
1203          if (this.schedule == null)
1204            this.schedule = new ArrayList<Timing>();
1205          return this.schedule;
1206        }
1207
1208        public boolean hasSchedule() { 
1209          if (this.schedule == null)
1210            return false;
1211          for (Timing item : this.schedule)
1212            if (!item.isEmpty())
1213              return true;
1214          return false;
1215        }
1216
1217        /**
1218         * @return {@link #schedule} (The time period and frequency at which the supplement(s) should be given.)
1219         */
1220    // syntactic sugar
1221        public Timing addSchedule() { //3
1222          Timing t = new Timing();
1223          if (this.schedule == null)
1224            this.schedule = new ArrayList<Timing>();
1225          this.schedule.add(t);
1226          return t;
1227        }
1228
1229    // syntactic sugar
1230        public NutritionOrderSupplementComponent addSchedule(Timing t) { //3
1231          if (t == null)
1232            return this;
1233          if (this.schedule == null)
1234            this.schedule = new ArrayList<Timing>();
1235          this.schedule.add(t);
1236          return this;
1237        }
1238
1239        /**
1240         * @return {@link #quantity} (The amount of the nutritional supplement to be given.)
1241         */
1242        public SimpleQuantity getQuantity() { 
1243          if (this.quantity == null)
1244            if (Configuration.errorOnAutoCreate())
1245              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.quantity");
1246            else if (Configuration.doAutoCreate())
1247              this.quantity = new SimpleQuantity(); // cc
1248          return this.quantity;
1249        }
1250
1251        public boolean hasQuantity() { 
1252          return this.quantity != null && !this.quantity.isEmpty();
1253        }
1254
1255        /**
1256         * @param value {@link #quantity} (The amount of the nutritional supplement to be given.)
1257         */
1258        public NutritionOrderSupplementComponent setQuantity(SimpleQuantity value) { 
1259          this.quantity = value;
1260          return this;
1261        }
1262
1263        /**
1264         * @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
1265         */
1266        public StringType getInstructionElement() { 
1267          if (this.instruction == null)
1268            if (Configuration.errorOnAutoCreate())
1269              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.instruction");
1270            else if (Configuration.doAutoCreate())
1271              this.instruction = new StringType(); // bb
1272          return this.instruction;
1273        }
1274
1275        public boolean hasInstructionElement() { 
1276          return this.instruction != null && !this.instruction.isEmpty();
1277        }
1278
1279        public boolean hasInstruction() { 
1280          return this.instruction != null && !this.instruction.isEmpty();
1281        }
1282
1283        /**
1284         * @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
1285         */
1286        public NutritionOrderSupplementComponent setInstructionElement(StringType value) { 
1287          this.instruction = value;
1288          return this;
1289        }
1290
1291        /**
1292         * @return Free text or additional instructions or information pertaining to the oral supplement.
1293         */
1294        public String getInstruction() { 
1295          return this.instruction == null ? null : this.instruction.getValue();
1296        }
1297
1298        /**
1299         * @param value Free text or additional instructions or information pertaining to the oral supplement.
1300         */
1301        public NutritionOrderSupplementComponent setInstruction(String value) { 
1302          if (Utilities.noString(value))
1303            this.instruction = null;
1304          else {
1305            if (this.instruction == null)
1306              this.instruction = new StringType();
1307            this.instruction.setValue(value);
1308          }
1309          return this;
1310        }
1311
1312        protected void listChildren(List<Property> childrenList) {
1313          super.listChildren(childrenList);
1314          childrenList.add(new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, java.lang.Integer.MAX_VALUE, type));
1315          childrenList.add(new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, java.lang.Integer.MAX_VALUE, productName));
1316          childrenList.add(new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.", 0, java.lang.Integer.MAX_VALUE, schedule));
1317          childrenList.add(new Property("quantity", "SimpleQuantity", "The amount of the nutritional supplement to be given.", 0, java.lang.Integer.MAX_VALUE, quantity));
1318          childrenList.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, java.lang.Integer.MAX_VALUE, instruction));
1319        }
1320
1321      @Override
1322      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1323        switch (hash) {
1324        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1325        case -1491817446: /*productName*/ return this.productName == null ? new Base[0] : new Base[] {this.productName}; // StringType
1326        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
1327        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
1328        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
1329        default: return super.getProperty(hash, name, checkValid);
1330        }
1331
1332      }
1333
1334      @Override
1335      public void setProperty(int hash, String name, Base value) throws FHIRException {
1336        switch (hash) {
1337        case 3575610: // type
1338          this.type = castToCodeableConcept(value); // CodeableConcept
1339          break;
1340        case -1491817446: // productName
1341          this.productName = castToString(value); // StringType
1342          break;
1343        case -697920873: // schedule
1344          this.getSchedule().add(castToTiming(value)); // Timing
1345          break;
1346        case -1285004149: // quantity
1347          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1348          break;
1349        case 301526158: // instruction
1350          this.instruction = castToString(value); // StringType
1351          break;
1352        default: super.setProperty(hash, name, value);
1353        }
1354
1355      }
1356
1357      @Override
1358      public void setProperty(String name, Base value) throws FHIRException {
1359        if (name.equals("type"))
1360          this.type = castToCodeableConcept(value); // CodeableConcept
1361        else if (name.equals("productName"))
1362          this.productName = castToString(value); // StringType
1363        else if (name.equals("schedule"))
1364          this.getSchedule().add(castToTiming(value));
1365        else if (name.equals("quantity"))
1366          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1367        else if (name.equals("instruction"))
1368          this.instruction = castToString(value); // StringType
1369        else
1370          super.setProperty(name, value);
1371      }
1372
1373      @Override
1374      public Base makeProperty(int hash, String name) throws FHIRException {
1375        switch (hash) {
1376        case 3575610:  return getType(); // CodeableConcept
1377        case -1491817446: throw new FHIRException("Cannot make property productName as it is not a complex type"); // StringType
1378        case -697920873:  return addSchedule(); // Timing
1379        case -1285004149:  return getQuantity(); // SimpleQuantity
1380        case 301526158: throw new FHIRException("Cannot make property instruction as it is not a complex type"); // StringType
1381        default: return super.makeProperty(hash, name);
1382        }
1383
1384      }
1385
1386      @Override
1387      public Base addChild(String name) throws FHIRException {
1388        if (name.equals("type")) {
1389          this.type = new CodeableConcept();
1390          return this.type;
1391        }
1392        else if (name.equals("productName")) {
1393          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.productName");
1394        }
1395        else if (name.equals("schedule")) {
1396          return addSchedule();
1397        }
1398        else if (name.equals("quantity")) {
1399          this.quantity = new SimpleQuantity();
1400          return this.quantity;
1401        }
1402        else if (name.equals("instruction")) {
1403          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
1404        }
1405        else
1406          return super.addChild(name);
1407      }
1408
1409      public NutritionOrderSupplementComponent copy() {
1410        NutritionOrderSupplementComponent dst = new NutritionOrderSupplementComponent();
1411        copyValues(dst);
1412        dst.type = type == null ? null : type.copy();
1413        dst.productName = productName == null ? null : productName.copy();
1414        if (schedule != null) {
1415          dst.schedule = new ArrayList<Timing>();
1416          for (Timing i : schedule)
1417            dst.schedule.add(i.copy());
1418        };
1419        dst.quantity = quantity == null ? null : quantity.copy();
1420        dst.instruction = instruction == null ? null : instruction.copy();
1421        return dst;
1422      }
1423
1424      @Override
1425      public boolean equalsDeep(Base other) {
1426        if (!super.equalsDeep(other))
1427          return false;
1428        if (!(other instanceof NutritionOrderSupplementComponent))
1429          return false;
1430        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other;
1431        return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true) && compareDeep(schedule, o.schedule, true)
1432           && compareDeep(quantity, o.quantity, true) && compareDeep(instruction, o.instruction, true);
1433      }
1434
1435      @Override
1436      public boolean equalsShallow(Base other) {
1437        if (!super.equalsShallow(other))
1438          return false;
1439        if (!(other instanceof NutritionOrderSupplementComponent))
1440          return false;
1441        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other;
1442        return compareValues(productName, o.productName, true) && compareValues(instruction, o.instruction, true)
1443          ;
1444      }
1445
1446      public boolean isEmpty() {
1447        return super.isEmpty() && (type == null || type.isEmpty()) && (productName == null || productName.isEmpty())
1448           && (schedule == null || schedule.isEmpty()) && (quantity == null || quantity.isEmpty()) && (instruction == null || instruction.isEmpty())
1449          ;
1450      }
1451
1452  public String fhirType() {
1453    return "NutritionOrder.supplement";
1454
1455  }
1456
1457  }
1458
1459    @Block()
1460    public static class NutritionOrderEnteralFormulaComponent extends BackboneElement implements IBaseBackboneElement {
1461        /**
1462         * The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.
1463         */
1464        @Child(name = "baseFormulaType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1465        @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." )
1466        protected CodeableConcept baseFormulaType;
1467
1468        /**
1469         * The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1470         */
1471        @Child(name = "baseFormulaProductName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1472        @Description(shortDefinition="Product or brand name of the enteral or infant formula", formalDefinition="The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\"." )
1473        protected StringType baseFormulaProductName;
1474
1475        /**
1476         * Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.
1477         */
1478        @Child(name = "additiveType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1479        @Description(shortDefinition="Type of modular component to add to the feeding", formalDefinition="Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula." )
1480        protected CodeableConcept additiveType;
1481
1482        /**
1483         * The product or brand name of the type of modular component to be added to the formula.
1484         */
1485        @Child(name = "additiveProductName", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1486        @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." )
1487        protected StringType additiveProductName;
1488
1489        /**
1490         * 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.
1491         */
1492        @Child(name = "caloricDensity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
1493        @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." )
1494        protected SimpleQuantity caloricDensity;
1495
1496        /**
1497         * The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.
1498         */
1499        @Child(name = "routeofAdministration", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1500        @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." )
1501        protected CodeableConcept routeofAdministration;
1502
1503        /**
1504         * 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.
1505         */
1506        @Child(name = "administration", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1507        @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." )
1508        protected List<NutritionOrderEnteralFormulaAdministrationComponent> administration;
1509
1510        /**
1511         * 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.
1512         */
1513        @Child(name = "maxVolumeToDeliver", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
1514        @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." )
1515        protected SimpleQuantity maxVolumeToDeliver;
1516
1517        /**
1518         * Free text formula administration, feeding instructions or additional instructions or information.
1519         */
1520        @Child(name = "administrationInstruction", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1521        @Description(shortDefinition="Formula feeding instructions expressed as text", formalDefinition="Free text formula administration, feeding instructions or additional instructions or information." )
1522        protected StringType administrationInstruction;
1523
1524        private static final long serialVersionUID = 292116061L;
1525
1526    /**
1527     * Constructor
1528     */
1529      public NutritionOrderEnteralFormulaComponent() {
1530        super();
1531      }
1532
1533        /**
1534         * @return {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
1535         */
1536        public CodeableConcept getBaseFormulaType() { 
1537          if (this.baseFormulaType == null)
1538            if (Configuration.errorOnAutoCreate())
1539              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaType");
1540            else if (Configuration.doAutoCreate())
1541              this.baseFormulaType = new CodeableConcept(); // cc
1542          return this.baseFormulaType;
1543        }
1544
1545        public boolean hasBaseFormulaType() { 
1546          return this.baseFormulaType != null && !this.baseFormulaType.isEmpty();
1547        }
1548
1549        /**
1550         * @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.)
1551         */
1552        public NutritionOrderEnteralFormulaComponent setBaseFormulaType(CodeableConcept value) { 
1553          this.baseFormulaType = value;
1554          return this;
1555        }
1556
1557        /**
1558         * @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
1559         */
1560        public StringType getBaseFormulaProductNameElement() { 
1561          if (this.baseFormulaProductName == null)
1562            if (Configuration.errorOnAutoCreate())
1563              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaProductName");
1564            else if (Configuration.doAutoCreate())
1565              this.baseFormulaProductName = new StringType(); // bb
1566          return this.baseFormulaProductName;
1567        }
1568
1569        public boolean hasBaseFormulaProductNameElement() { 
1570          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1571        }
1572
1573        public boolean hasBaseFormulaProductName() { 
1574          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1575        }
1576
1577        /**
1578         * @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
1579         */
1580        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductNameElement(StringType value) { 
1581          this.baseFormulaProductName = value;
1582          return this;
1583        }
1584
1585        /**
1586         * @return The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1587         */
1588        public String getBaseFormulaProductName() { 
1589          return this.baseFormulaProductName == null ? null : this.baseFormulaProductName.getValue();
1590        }
1591
1592        /**
1593         * @param value The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1594         */
1595        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductName(String value) { 
1596          if (Utilities.noString(value))
1597            this.baseFormulaProductName = null;
1598          else {
1599            if (this.baseFormulaProductName == null)
1600              this.baseFormulaProductName = new StringType();
1601            this.baseFormulaProductName.setValue(value);
1602          }
1603          return this;
1604        }
1605
1606        /**
1607         * @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.)
1608         */
1609        public CodeableConcept getAdditiveType() { 
1610          if (this.additiveType == null)
1611            if (Configuration.errorOnAutoCreate())
1612              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveType");
1613            else if (Configuration.doAutoCreate())
1614              this.additiveType = new CodeableConcept(); // cc
1615          return this.additiveType;
1616        }
1617
1618        public boolean hasAdditiveType() { 
1619          return this.additiveType != null && !this.additiveType.isEmpty();
1620        }
1621
1622        /**
1623         * @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.)
1624         */
1625        public NutritionOrderEnteralFormulaComponent setAdditiveType(CodeableConcept value) { 
1626          this.additiveType = value;
1627          return this;
1628        }
1629
1630        /**
1631         * @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
1632         */
1633        public StringType getAdditiveProductNameElement() { 
1634          if (this.additiveProductName == null)
1635            if (Configuration.errorOnAutoCreate())
1636              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveProductName");
1637            else if (Configuration.doAutoCreate())
1638              this.additiveProductName = new StringType(); // bb
1639          return this.additiveProductName;
1640        }
1641
1642        public boolean hasAdditiveProductNameElement() { 
1643          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1644        }
1645
1646        public boolean hasAdditiveProductName() { 
1647          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1648        }
1649
1650        /**
1651         * @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
1652         */
1653        public NutritionOrderEnteralFormulaComponent setAdditiveProductNameElement(StringType value) { 
1654          this.additiveProductName = value;
1655          return this;
1656        }
1657
1658        /**
1659         * @return The product or brand name of the type of modular component to be added to the formula.
1660         */
1661        public String getAdditiveProductName() { 
1662          return this.additiveProductName == null ? null : this.additiveProductName.getValue();
1663        }
1664
1665        /**
1666         * @param value The product or brand name of the type of modular component to be added to the formula.
1667         */
1668        public NutritionOrderEnteralFormulaComponent setAdditiveProductName(String value) { 
1669          if (Utilities.noString(value))
1670            this.additiveProductName = null;
1671          else {
1672            if (this.additiveProductName == null)
1673              this.additiveProductName = new StringType();
1674            this.additiveProductName.setValue(value);
1675          }
1676          return this;
1677        }
1678
1679        /**
1680         * @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.)
1681         */
1682        public SimpleQuantity getCaloricDensity() { 
1683          if (this.caloricDensity == null)
1684            if (Configuration.errorOnAutoCreate())
1685              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.caloricDensity");
1686            else if (Configuration.doAutoCreate())
1687              this.caloricDensity = new SimpleQuantity(); // cc
1688          return this.caloricDensity;
1689        }
1690
1691        public boolean hasCaloricDensity() { 
1692          return this.caloricDensity != null && !this.caloricDensity.isEmpty();
1693        }
1694
1695        /**
1696         * @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.)
1697         */
1698        public NutritionOrderEnteralFormulaComponent setCaloricDensity(SimpleQuantity value) { 
1699          this.caloricDensity = value;
1700          return this;
1701        }
1702
1703        /**
1704         * @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.)
1705         */
1706        public CodeableConcept getRouteofAdministration() { 
1707          if (this.routeofAdministration == null)
1708            if (Configuration.errorOnAutoCreate())
1709              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.routeofAdministration");
1710            else if (Configuration.doAutoCreate())
1711              this.routeofAdministration = new CodeableConcept(); // cc
1712          return this.routeofAdministration;
1713        }
1714
1715        public boolean hasRouteofAdministration() { 
1716          return this.routeofAdministration != null && !this.routeofAdministration.isEmpty();
1717        }
1718
1719        /**
1720         * @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.)
1721         */
1722        public NutritionOrderEnteralFormulaComponent setRouteofAdministration(CodeableConcept value) { 
1723          this.routeofAdministration = value;
1724          return this;
1725        }
1726
1727        /**
1728         * @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.)
1729         */
1730        public List<NutritionOrderEnteralFormulaAdministrationComponent> getAdministration() { 
1731          if (this.administration == null)
1732            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1733          return this.administration;
1734        }
1735
1736        public boolean hasAdministration() { 
1737          if (this.administration == null)
1738            return false;
1739          for (NutritionOrderEnteralFormulaAdministrationComponent item : this.administration)
1740            if (!item.isEmpty())
1741              return true;
1742          return false;
1743        }
1744
1745        /**
1746         * @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.)
1747         */
1748    // syntactic sugar
1749        public NutritionOrderEnteralFormulaAdministrationComponent addAdministration() { //3
1750          NutritionOrderEnteralFormulaAdministrationComponent t = new NutritionOrderEnteralFormulaAdministrationComponent();
1751          if (this.administration == null)
1752            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1753          this.administration.add(t);
1754          return t;
1755        }
1756
1757    // syntactic sugar
1758        public NutritionOrderEnteralFormulaComponent addAdministration(NutritionOrderEnteralFormulaAdministrationComponent t) { //3
1759          if (t == null)
1760            return this;
1761          if (this.administration == null)
1762            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1763          this.administration.add(t);
1764          return this;
1765        }
1766
1767        /**
1768         * @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.)
1769         */
1770        public SimpleQuantity getMaxVolumeToDeliver() { 
1771          if (this.maxVolumeToDeliver == null)
1772            if (Configuration.errorOnAutoCreate())
1773              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.maxVolumeToDeliver");
1774            else if (Configuration.doAutoCreate())
1775              this.maxVolumeToDeliver = new SimpleQuantity(); // cc
1776          return this.maxVolumeToDeliver;
1777        }
1778
1779        public boolean hasMaxVolumeToDeliver() { 
1780          return this.maxVolumeToDeliver != null && !this.maxVolumeToDeliver.isEmpty();
1781        }
1782
1783        /**
1784         * @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.)
1785         */
1786        public NutritionOrderEnteralFormulaComponent setMaxVolumeToDeliver(SimpleQuantity value) { 
1787          this.maxVolumeToDeliver = value;
1788          return this;
1789        }
1790
1791        /**
1792         * @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
1793         */
1794        public StringType getAdministrationInstructionElement() { 
1795          if (this.administrationInstruction == null)
1796            if (Configuration.errorOnAutoCreate())
1797              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.administrationInstruction");
1798            else if (Configuration.doAutoCreate())
1799              this.administrationInstruction = new StringType(); // bb
1800          return this.administrationInstruction;
1801        }
1802
1803        public boolean hasAdministrationInstructionElement() { 
1804          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
1805        }
1806
1807        public boolean hasAdministrationInstruction() { 
1808          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
1809        }
1810
1811        /**
1812         * @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
1813         */
1814        public NutritionOrderEnteralFormulaComponent setAdministrationInstructionElement(StringType value) { 
1815          this.administrationInstruction = value;
1816          return this;
1817        }
1818
1819        /**
1820         * @return Free text formula administration, feeding instructions or additional instructions or information.
1821         */
1822        public String getAdministrationInstruction() { 
1823          return this.administrationInstruction == null ? null : this.administrationInstruction.getValue();
1824        }
1825
1826        /**
1827         * @param value Free text formula administration, feeding instructions or additional instructions or information.
1828         */
1829        public NutritionOrderEnteralFormulaComponent setAdministrationInstruction(String value) { 
1830          if (Utilities.noString(value))
1831            this.administrationInstruction = null;
1832          else {
1833            if (this.administrationInstruction == null)
1834              this.administrationInstruction = new StringType();
1835            this.administrationInstruction.setValue(value);
1836          }
1837          return this;
1838        }
1839
1840        protected void listChildren(List<Property> childrenList) {
1841          super.listChildren(childrenList);
1842          childrenList.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, java.lang.Integer.MAX_VALUE, baseFormulaType));
1843          childrenList.add(new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, java.lang.Integer.MAX_VALUE, baseFormulaProductName));
1844          childrenList.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, java.lang.Integer.MAX_VALUE, additiveType));
1845          childrenList.add(new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, java.lang.Integer.MAX_VALUE, additiveProductName));
1846          childrenList.add(new Property("caloricDensity", "SimpleQuantity", "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, java.lang.Integer.MAX_VALUE, caloricDensity));
1847          childrenList.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, java.lang.Integer.MAX_VALUE, routeofAdministration));
1848          childrenList.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));
1849          childrenList.add(new Property("maxVolumeToDeliver", "SimpleQuantity", "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, java.lang.Integer.MAX_VALUE, maxVolumeToDeliver));
1850          childrenList.add(new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, java.lang.Integer.MAX_VALUE, administrationInstruction));
1851        }
1852
1853      @Override
1854      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1855        switch (hash) {
1856        case -138930641: /*baseFormulaType*/ return this.baseFormulaType == null ? new Base[0] : new Base[] {this.baseFormulaType}; // CodeableConcept
1857        case -1267705979: /*baseFormulaProductName*/ return this.baseFormulaProductName == null ? new Base[0] : new Base[] {this.baseFormulaProductName}; // StringType
1858        case -470746842: /*additiveType*/ return this.additiveType == null ? new Base[0] : new Base[] {this.additiveType}; // CodeableConcept
1859        case 488079534: /*additiveProductName*/ return this.additiveProductName == null ? new Base[0] : new Base[] {this.additiveProductName}; // StringType
1860        case 186983261: /*caloricDensity*/ return this.caloricDensity == null ? new Base[0] : new Base[] {this.caloricDensity}; // SimpleQuantity
1861        case -1710107042: /*routeofAdministration*/ return this.routeofAdministration == null ? new Base[0] : new Base[] {this.routeofAdministration}; // CodeableConcept
1862        case 1255702622: /*administration*/ return this.administration == null ? new Base[0] : this.administration.toArray(new Base[this.administration.size()]); // NutritionOrderEnteralFormulaAdministrationComponent
1863        case 2017924652: /*maxVolumeToDeliver*/ return this.maxVolumeToDeliver == null ? new Base[0] : new Base[] {this.maxVolumeToDeliver}; // SimpleQuantity
1864        case 427085136: /*administrationInstruction*/ return this.administrationInstruction == null ? new Base[0] : new Base[] {this.administrationInstruction}; // StringType
1865        default: return super.getProperty(hash, name, checkValid);
1866        }
1867
1868      }
1869
1870      @Override
1871      public void setProperty(int hash, String name, Base value) throws FHIRException {
1872        switch (hash) {
1873        case -138930641: // baseFormulaType
1874          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
1875          break;
1876        case -1267705979: // baseFormulaProductName
1877          this.baseFormulaProductName = castToString(value); // StringType
1878          break;
1879        case -470746842: // additiveType
1880          this.additiveType = castToCodeableConcept(value); // CodeableConcept
1881          break;
1882        case 488079534: // additiveProductName
1883          this.additiveProductName = castToString(value); // StringType
1884          break;
1885        case 186983261: // caloricDensity
1886          this.caloricDensity = castToSimpleQuantity(value); // SimpleQuantity
1887          break;
1888        case -1710107042: // routeofAdministration
1889          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
1890          break;
1891        case 1255702622: // administration
1892          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value); // NutritionOrderEnteralFormulaAdministrationComponent
1893          break;
1894        case 2017924652: // maxVolumeToDeliver
1895          this.maxVolumeToDeliver = castToSimpleQuantity(value); // SimpleQuantity
1896          break;
1897        case 427085136: // administrationInstruction
1898          this.administrationInstruction = castToString(value); // StringType
1899          break;
1900        default: super.setProperty(hash, name, value);
1901        }
1902
1903      }
1904
1905      @Override
1906      public void setProperty(String name, Base value) throws FHIRException {
1907        if (name.equals("baseFormulaType"))
1908          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
1909        else if (name.equals("baseFormulaProductName"))
1910          this.baseFormulaProductName = castToString(value); // StringType
1911        else if (name.equals("additiveType"))
1912          this.additiveType = castToCodeableConcept(value); // CodeableConcept
1913        else if (name.equals("additiveProductName"))
1914          this.additiveProductName = castToString(value); // StringType
1915        else if (name.equals("caloricDensity"))
1916          this.caloricDensity = castToSimpleQuantity(value); // SimpleQuantity
1917        else if (name.equals("routeofAdministration"))
1918          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
1919        else if (name.equals("administration"))
1920          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value);
1921        else if (name.equals("maxVolumeToDeliver"))
1922          this.maxVolumeToDeliver = castToSimpleQuantity(value); // SimpleQuantity
1923        else if (name.equals("administrationInstruction"))
1924          this.administrationInstruction = castToString(value); // StringType
1925        else
1926          super.setProperty(name, value);
1927      }
1928
1929      @Override
1930      public Base makeProperty(int hash, String name) throws FHIRException {
1931        switch (hash) {
1932        case -138930641:  return getBaseFormulaType(); // CodeableConcept
1933        case -1267705979: throw new FHIRException("Cannot make property baseFormulaProductName as it is not a complex type"); // StringType
1934        case -470746842:  return getAdditiveType(); // CodeableConcept
1935        case 488079534: throw new FHIRException("Cannot make property additiveProductName as it is not a complex type"); // StringType
1936        case 186983261:  return getCaloricDensity(); // SimpleQuantity
1937        case -1710107042:  return getRouteofAdministration(); // CodeableConcept
1938        case 1255702622:  return addAdministration(); // NutritionOrderEnteralFormulaAdministrationComponent
1939        case 2017924652:  return getMaxVolumeToDeliver(); // SimpleQuantity
1940        case 427085136: throw new FHIRException("Cannot make property administrationInstruction as it is not a complex type"); // StringType
1941        default: return super.makeProperty(hash, name);
1942        }
1943
1944      }
1945
1946      @Override
1947      public Base addChild(String name) throws FHIRException {
1948        if (name.equals("baseFormulaType")) {
1949          this.baseFormulaType = new CodeableConcept();
1950          return this.baseFormulaType;
1951        }
1952        else if (name.equals("baseFormulaProductName")) {
1953          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.baseFormulaProductName");
1954        }
1955        else if (name.equals("additiveType")) {
1956          this.additiveType = new CodeableConcept();
1957          return this.additiveType;
1958        }
1959        else if (name.equals("additiveProductName")) {
1960          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.additiveProductName");
1961        }
1962        else if (name.equals("caloricDensity")) {
1963          this.caloricDensity = new SimpleQuantity();
1964          return this.caloricDensity;
1965        }
1966        else if (name.equals("routeofAdministration")) {
1967          this.routeofAdministration = new CodeableConcept();
1968          return this.routeofAdministration;
1969        }
1970        else if (name.equals("administration")) {
1971          return addAdministration();
1972        }
1973        else if (name.equals("maxVolumeToDeliver")) {
1974          this.maxVolumeToDeliver = new SimpleQuantity();
1975          return this.maxVolumeToDeliver;
1976        }
1977        else if (name.equals("administrationInstruction")) {
1978          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.administrationInstruction");
1979        }
1980        else
1981          return super.addChild(name);
1982      }
1983
1984      public NutritionOrderEnteralFormulaComponent copy() {
1985        NutritionOrderEnteralFormulaComponent dst = new NutritionOrderEnteralFormulaComponent();
1986        copyValues(dst);
1987        dst.baseFormulaType = baseFormulaType == null ? null : baseFormulaType.copy();
1988        dst.baseFormulaProductName = baseFormulaProductName == null ? null : baseFormulaProductName.copy();
1989        dst.additiveType = additiveType == null ? null : additiveType.copy();
1990        dst.additiveProductName = additiveProductName == null ? null : additiveProductName.copy();
1991        dst.caloricDensity = caloricDensity == null ? null : caloricDensity.copy();
1992        dst.routeofAdministration = routeofAdministration == null ? null : routeofAdministration.copy();
1993        if (administration != null) {
1994          dst.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1995          for (NutritionOrderEnteralFormulaAdministrationComponent i : administration)
1996            dst.administration.add(i.copy());
1997        };
1998        dst.maxVolumeToDeliver = maxVolumeToDeliver == null ? null : maxVolumeToDeliver.copy();
1999        dst.administrationInstruction = administrationInstruction == null ? null : administrationInstruction.copy();
2000        return dst;
2001      }
2002
2003      @Override
2004      public boolean equalsDeep(Base other) {
2005        if (!super.equalsDeep(other))
2006          return false;
2007        if (!(other instanceof NutritionOrderEnteralFormulaComponent))
2008          return false;
2009        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other;
2010        return compareDeep(baseFormulaType, o.baseFormulaType, true) && compareDeep(baseFormulaProductName, o.baseFormulaProductName, true)
2011           && compareDeep(additiveType, o.additiveType, true) && compareDeep(additiveProductName, o.additiveProductName, true)
2012           && compareDeep(caloricDensity, o.caloricDensity, true) && compareDeep(routeofAdministration, o.routeofAdministration, true)
2013           && compareDeep(administration, o.administration, true) && compareDeep(maxVolumeToDeliver, o.maxVolumeToDeliver, true)
2014           && compareDeep(administrationInstruction, o.administrationInstruction, true);
2015      }
2016
2017      @Override
2018      public boolean equalsShallow(Base other) {
2019        if (!super.equalsShallow(other))
2020          return false;
2021        if (!(other instanceof NutritionOrderEnteralFormulaComponent))
2022          return false;
2023        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other;
2024        return compareValues(baseFormulaProductName, o.baseFormulaProductName, true) && compareValues(additiveProductName, o.additiveProductName, true)
2025           && compareValues(administrationInstruction, o.administrationInstruction, true);
2026      }
2027
2028      public boolean isEmpty() {
2029        return super.isEmpty() && (baseFormulaType == null || baseFormulaType.isEmpty()) && (baseFormulaProductName == null || baseFormulaProductName.isEmpty())
2030           && (additiveType == null || additiveType.isEmpty()) && (additiveProductName == null || additiveProductName.isEmpty())
2031           && (caloricDensity == null || caloricDensity.isEmpty()) && (routeofAdministration == null || routeofAdministration.isEmpty())
2032           && (administration == null || administration.isEmpty()) && (maxVolumeToDeliver == null || maxVolumeToDeliver.isEmpty())
2033           && (administrationInstruction == null || administrationInstruction.isEmpty());
2034      }
2035
2036  public String fhirType() {
2037    return "NutritionOrder.enteralFormula";
2038
2039  }
2040
2041  }
2042
2043    @Block()
2044    public static class NutritionOrderEnteralFormulaAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
2045        /**
2046         * The time period and frequency at which the enteral formula should be delivered to the patient.
2047         */
2048        @Child(name = "schedule", type = {Timing.class}, order=1, min=0, max=1, modifier=false, summary=false)
2049        @Description(shortDefinition="Scheduled frequency of enteral feeding", formalDefinition="The time period and frequency at which the enteral formula should be delivered to the patient." )
2050        protected Timing schedule;
2051
2052        /**
2053         * The volume of formula to provide to the patient per the specified administration schedule.
2054         */
2055        @Child(name = "quantity", type = {SimpleQuantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
2056        @Description(shortDefinition="The volume of formula to provide", formalDefinition="The volume of formula to provide to the patient per the specified administration schedule." )
2057        protected SimpleQuantity quantity;
2058
2059        /**
2060         * The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.
2061         */
2062        @Child(name = "rate", type = {SimpleQuantity.class, Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false)
2063        @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." )
2064        protected Type rate;
2065
2066        private static final long serialVersionUID = 1895031997L;
2067
2068    /**
2069     * Constructor
2070     */
2071      public NutritionOrderEnteralFormulaAdministrationComponent() {
2072        super();
2073      }
2074
2075        /**
2076         * @return {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2077         */
2078        public Timing getSchedule() { 
2079          if (this.schedule == null)
2080            if (Configuration.errorOnAutoCreate())
2081              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.schedule");
2082            else if (Configuration.doAutoCreate())
2083              this.schedule = new Timing(); // cc
2084          return this.schedule;
2085        }
2086
2087        public boolean hasSchedule() { 
2088          return this.schedule != null && !this.schedule.isEmpty();
2089        }
2090
2091        /**
2092         * @param value {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2093         */
2094        public NutritionOrderEnteralFormulaAdministrationComponent setSchedule(Timing value) { 
2095          this.schedule = value;
2096          return this;
2097        }
2098
2099        /**
2100         * @return {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2101         */
2102        public SimpleQuantity getQuantity() { 
2103          if (this.quantity == null)
2104            if (Configuration.errorOnAutoCreate())
2105              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.quantity");
2106            else if (Configuration.doAutoCreate())
2107              this.quantity = new SimpleQuantity(); // cc
2108          return this.quantity;
2109        }
2110
2111        public boolean hasQuantity() { 
2112          return this.quantity != null && !this.quantity.isEmpty();
2113        }
2114
2115        /**
2116         * @param value {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2117         */
2118        public NutritionOrderEnteralFormulaAdministrationComponent setQuantity(SimpleQuantity value) { 
2119          this.quantity = value;
2120          return this;
2121        }
2122
2123        /**
2124         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2125         */
2126        public Type getRate() { 
2127          return this.rate;
2128        }
2129
2130        /**
2131         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2132         */
2133        public SimpleQuantity getRateSimpleQuantity() throws FHIRException { 
2134          if (!(this.rate instanceof SimpleQuantity))
2135            throw new FHIRException("Type mismatch: the type SimpleQuantity was expected, but "+this.rate.getClass().getName()+" was encountered");
2136          return (SimpleQuantity) this.rate;
2137        }
2138
2139        public boolean hasRateSimpleQuantity() { 
2140          return this.rate instanceof SimpleQuantity;
2141        }
2142
2143        /**
2144         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2145         */
2146        public Ratio getRateRatio() throws FHIRException { 
2147          if (!(this.rate instanceof Ratio))
2148            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered");
2149          return (Ratio) this.rate;
2150        }
2151
2152        public boolean hasRateRatio() { 
2153          return this.rate instanceof Ratio;
2154        }
2155
2156        public boolean hasRate() { 
2157          return this.rate != null && !this.rate.isEmpty();
2158        }
2159
2160        /**
2161         * @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.)
2162         */
2163        public NutritionOrderEnteralFormulaAdministrationComponent setRate(Type value) { 
2164          this.rate = value;
2165          return this;
2166        }
2167
2168        protected void listChildren(List<Property> childrenList) {
2169          super.listChildren(childrenList);
2170          childrenList.add(new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, java.lang.Integer.MAX_VALUE, schedule));
2171          childrenList.add(new Property("quantity", "SimpleQuantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, java.lang.Integer.MAX_VALUE, quantity));
2172          childrenList.add(new Property("rate[x]", "SimpleQuantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, java.lang.Integer.MAX_VALUE, rate));
2173        }
2174
2175      @Override
2176      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2177        switch (hash) {
2178        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // Timing
2179        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
2180        case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // Type
2181        default: return super.getProperty(hash, name, checkValid);
2182        }
2183
2184      }
2185
2186      @Override
2187      public void setProperty(int hash, String name, Base value) throws FHIRException {
2188        switch (hash) {
2189        case -697920873: // schedule
2190          this.schedule = castToTiming(value); // Timing
2191          break;
2192        case -1285004149: // quantity
2193          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2194          break;
2195        case 3493088: // rate
2196          this.rate = (Type) value; // Type
2197          break;
2198        default: super.setProperty(hash, name, value);
2199        }
2200
2201      }
2202
2203      @Override
2204      public void setProperty(String name, Base value) throws FHIRException {
2205        if (name.equals("schedule"))
2206          this.schedule = castToTiming(value); // Timing
2207        else if (name.equals("quantity"))
2208          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2209        else if (name.equals("rate[x]"))
2210          this.rate = (Type) value; // Type
2211        else
2212          super.setProperty(name, value);
2213      }
2214
2215      @Override
2216      public Base makeProperty(int hash, String name) throws FHIRException {
2217        switch (hash) {
2218        case -697920873:  return getSchedule(); // Timing
2219        case -1285004149:  return getQuantity(); // SimpleQuantity
2220        case 983460768:  return getRate(); // Type
2221        default: return super.makeProperty(hash, name);
2222        }
2223
2224      }
2225
2226      @Override
2227      public Base addChild(String name) throws FHIRException {
2228        if (name.equals("schedule")) {
2229          this.schedule = new Timing();
2230          return this.schedule;
2231        }
2232        else if (name.equals("quantity")) {
2233          this.quantity = new SimpleQuantity();
2234          return this.quantity;
2235        }
2236        else if (name.equals("rateSimpleQuantity")) {
2237          this.rate = new SimpleQuantity();
2238          return this.rate;
2239        }
2240        else if (name.equals("rateRatio")) {
2241          this.rate = new Ratio();
2242          return this.rate;
2243        }
2244        else
2245          return super.addChild(name);
2246      }
2247
2248      public NutritionOrderEnteralFormulaAdministrationComponent copy() {
2249        NutritionOrderEnteralFormulaAdministrationComponent dst = new NutritionOrderEnteralFormulaAdministrationComponent();
2250        copyValues(dst);
2251        dst.schedule = schedule == null ? null : schedule.copy();
2252        dst.quantity = quantity == null ? null : quantity.copy();
2253        dst.rate = rate == null ? null : rate.copy();
2254        return dst;
2255      }
2256
2257      @Override
2258      public boolean equalsDeep(Base other) {
2259        if (!super.equalsDeep(other))
2260          return false;
2261        if (!(other instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2262          return false;
2263        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other;
2264        return compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true)
2265          ;
2266      }
2267
2268      @Override
2269      public boolean equalsShallow(Base other) {
2270        if (!super.equalsShallow(other))
2271          return false;
2272        if (!(other instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2273          return false;
2274        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other;
2275        return true;
2276      }
2277
2278      public boolean isEmpty() {
2279        return super.isEmpty() && (schedule == null || schedule.isEmpty()) && (quantity == null || quantity.isEmpty())
2280           && (rate == null || rate.isEmpty());
2281      }
2282
2283  public String fhirType() {
2284    return "NutritionOrder.enteralFormula.administration";
2285
2286  }
2287
2288  }
2289
2290    /**
2291     * Identifiers assigned to this order by the order sender or by the order receiver.
2292     */
2293    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2294    @Description(shortDefinition="Identifiers assigned to this order", formalDefinition="Identifiers assigned to this order by the order sender or by the order receiver." )
2295    protected List<Identifier> identifier;
2296
2297    /**
2298     * The workflow status of the nutrition order/request.
2299     */
2300    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
2301    @Description(shortDefinition="proposed | draft | planned | requested | active | on-hold | completed | cancelled | entered-in-error", formalDefinition="The workflow status of the nutrition order/request." )
2302    protected Enumeration<NutritionOrderStatus> status;
2303
2304    /**
2305     * The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.
2306     */
2307    @Child(name = "patient", type = {Patient.class}, order=2, min=1, max=1, modifier=false, summary=true)
2308    @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." )
2309    protected Reference patient;
2310
2311    /**
2312     * The actual object that is the target of the reference (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2313     */
2314    protected Patient patientTarget;
2315
2316    /**
2317     * An encounter that provides additional information about the healthcare context in which this request is made.
2318     */
2319    @Child(name = "encounter", type = {Encounter.class}, order=3, min=0, max=1, modifier=false, summary=false)
2320    @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." )
2321    protected Reference encounter;
2322
2323    /**
2324     * The actual object that is the target of the reference (An encounter that provides additional information about the healthcare context in which this request is made.)
2325     */
2326    protected Encounter encounterTarget;
2327
2328    /**
2329     * The date and time that this nutrition order was requested.
2330     */
2331    @Child(name = "dateTime", type = {DateTimeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
2332    @Description(shortDefinition="Date and time the nutrition order was requested", formalDefinition="The date and time that this nutrition order was requested." )
2333    protected DateTimeType dateTime;
2334
2335    /**
2336     * The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.
2337     */
2338    @Child(name = "orderer", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true)
2339    @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." )
2340    protected Reference orderer;
2341
2342    /**
2343     * The actual object that is the target of the reference (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2344     */
2345    protected Practitioner ordererTarget;
2346
2347    /**
2348     * A link to a record of allergies or intolerances  which should be included in the nutrition order.
2349     */
2350    @Child(name = "allergyIntolerance", type = {AllergyIntolerance.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2351    @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." )
2352    protected List<Reference> allergyIntolerance;
2353    /**
2354     * The actual objects that are the target of the reference (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2355     */
2356    protected List<AllergyIntolerance> allergyIntoleranceTarget;
2357
2358
2359    /**
2360     * 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.
2361     */
2362    @Child(name = "foodPreferenceModifier", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2363    @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." )
2364    protected List<CodeableConcept> foodPreferenceModifier;
2365
2366    /**
2367     * This modifier is used to convey order-specific modifiers about the type of food 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.
2368     */
2369    @Child(name = "excludeFoodModifier", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2370    @Description(shortDefinition="Order-specific modifier about the type of food that should not be given", formalDefinition="This modifier is used to convey order-specific modifiers about the type of food 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." )
2371    protected List<CodeableConcept> excludeFoodModifier;
2372
2373    /**
2374     * Diet given orally in contrast to enteral (tube) feeding.
2375     */
2376    @Child(name = "oralDiet", type = {}, order=9, min=0, max=1, modifier=false, summary=false)
2377    @Description(shortDefinition="Oral diet components", formalDefinition="Diet given orally in contrast to enteral (tube) feeding." )
2378    protected NutritionOrderOralDietComponent oralDiet;
2379
2380    /**
2381     * Oral nutritional products given in order to add further nutritional value to the patient's diet.
2382     */
2383    @Child(name = "supplement", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2384    @Description(shortDefinition="Supplement components", formalDefinition="Oral nutritional products given in order to add further nutritional value to the patient's diet." )
2385    protected List<NutritionOrderSupplementComponent> supplement;
2386
2387    /**
2388     * Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.
2389     */
2390    @Child(name = "enteralFormula", type = {}, order=11, min=0, max=1, modifier=false, summary=false)
2391    @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." )
2392    protected NutritionOrderEnteralFormulaComponent enteralFormula;
2393
2394    private static final long serialVersionUID = 1429947433L;
2395
2396  /**
2397   * Constructor
2398   */
2399    public NutritionOrder() {
2400      super();
2401    }
2402
2403  /**
2404   * Constructor
2405   */
2406    public NutritionOrder(Reference patient, DateTimeType dateTime) {
2407      super();
2408      this.patient = patient;
2409      this.dateTime = dateTime;
2410    }
2411
2412    /**
2413     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
2414     */
2415    public List<Identifier> getIdentifier() { 
2416      if (this.identifier == null)
2417        this.identifier = new ArrayList<Identifier>();
2418      return this.identifier;
2419    }
2420
2421    public boolean hasIdentifier() { 
2422      if (this.identifier == null)
2423        return false;
2424      for (Identifier item : this.identifier)
2425        if (!item.isEmpty())
2426          return true;
2427      return false;
2428    }
2429
2430    /**
2431     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
2432     */
2433    // syntactic sugar
2434    public Identifier addIdentifier() { //3
2435      Identifier t = new Identifier();
2436      if (this.identifier == null)
2437        this.identifier = new ArrayList<Identifier>();
2438      this.identifier.add(t);
2439      return t;
2440    }
2441
2442    // syntactic sugar
2443    public NutritionOrder addIdentifier(Identifier t) { //3
2444      if (t == null)
2445        return this;
2446      if (this.identifier == null)
2447        this.identifier = new ArrayList<Identifier>();
2448      this.identifier.add(t);
2449      return this;
2450    }
2451
2452    /**
2453     * @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
2454     */
2455    public Enumeration<NutritionOrderStatus> getStatusElement() { 
2456      if (this.status == null)
2457        if (Configuration.errorOnAutoCreate())
2458          throw new Error("Attempt to auto-create NutritionOrder.status");
2459        else if (Configuration.doAutoCreate())
2460          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory()); // bb
2461      return this.status;
2462    }
2463
2464    public boolean hasStatusElement() { 
2465      return this.status != null && !this.status.isEmpty();
2466    }
2467
2468    public boolean hasStatus() { 
2469      return this.status != null && !this.status.isEmpty();
2470    }
2471
2472    /**
2473     * @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
2474     */
2475    public NutritionOrder setStatusElement(Enumeration<NutritionOrderStatus> value) { 
2476      this.status = value;
2477      return this;
2478    }
2479
2480    /**
2481     * @return The workflow status of the nutrition order/request.
2482     */
2483    public NutritionOrderStatus getStatus() { 
2484      return this.status == null ? null : this.status.getValue();
2485    }
2486
2487    /**
2488     * @param value The workflow status of the nutrition order/request.
2489     */
2490    public NutritionOrder setStatus(NutritionOrderStatus value) { 
2491      if (value == null)
2492        this.status = null;
2493      else {
2494        if (this.status == null)
2495          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory());
2496        this.status.setValue(value);
2497      }
2498      return this;
2499    }
2500
2501    /**
2502     * @return {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2503     */
2504    public Reference getPatient() { 
2505      if (this.patient == null)
2506        if (Configuration.errorOnAutoCreate())
2507          throw new Error("Attempt to auto-create NutritionOrder.patient");
2508        else if (Configuration.doAutoCreate())
2509          this.patient = new Reference(); // cc
2510      return this.patient;
2511    }
2512
2513    public boolean hasPatient() { 
2514      return this.patient != null && !this.patient.isEmpty();
2515    }
2516
2517    /**
2518     * @param value {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2519     */
2520    public NutritionOrder setPatient(Reference value) { 
2521      this.patient = value;
2522      return this;
2523    }
2524
2525    /**
2526     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2527     */
2528    public Patient getPatientTarget() { 
2529      if (this.patientTarget == null)
2530        if (Configuration.errorOnAutoCreate())
2531          throw new Error("Attempt to auto-create NutritionOrder.patient");
2532        else if (Configuration.doAutoCreate())
2533          this.patientTarget = new Patient(); // aa
2534      return this.patientTarget;
2535    }
2536
2537    /**
2538     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2539     */
2540    public NutritionOrder setPatientTarget(Patient value) { 
2541      this.patientTarget = value;
2542      return this;
2543    }
2544
2545    /**
2546     * @return {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
2547     */
2548    public Reference getEncounter() { 
2549      if (this.encounter == null)
2550        if (Configuration.errorOnAutoCreate())
2551          throw new Error("Attempt to auto-create NutritionOrder.encounter");
2552        else if (Configuration.doAutoCreate())
2553          this.encounter = new Reference(); // cc
2554      return this.encounter;
2555    }
2556
2557    public boolean hasEncounter() { 
2558      return this.encounter != null && !this.encounter.isEmpty();
2559    }
2560
2561    /**
2562     * @param value {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
2563     */
2564    public NutritionOrder setEncounter(Reference value) { 
2565      this.encounter = value;
2566      return this;
2567    }
2568
2569    /**
2570     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
2571     */
2572    public Encounter getEncounterTarget() { 
2573      if (this.encounterTarget == null)
2574        if (Configuration.errorOnAutoCreate())
2575          throw new Error("Attempt to auto-create NutritionOrder.encounter");
2576        else if (Configuration.doAutoCreate())
2577          this.encounterTarget = new Encounter(); // aa
2578      return this.encounterTarget;
2579    }
2580
2581    /**
2582     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
2583     */
2584    public NutritionOrder setEncounterTarget(Encounter value) { 
2585      this.encounterTarget = value;
2586      return this;
2587    }
2588
2589    /**
2590     * @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
2591     */
2592    public DateTimeType getDateTimeElement() { 
2593      if (this.dateTime == null)
2594        if (Configuration.errorOnAutoCreate())
2595          throw new Error("Attempt to auto-create NutritionOrder.dateTime");
2596        else if (Configuration.doAutoCreate())
2597          this.dateTime = new DateTimeType(); // bb
2598      return this.dateTime;
2599    }
2600
2601    public boolean hasDateTimeElement() { 
2602      return this.dateTime != null && !this.dateTime.isEmpty();
2603    }
2604
2605    public boolean hasDateTime() { 
2606      return this.dateTime != null && !this.dateTime.isEmpty();
2607    }
2608
2609    /**
2610     * @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
2611     */
2612    public NutritionOrder setDateTimeElement(DateTimeType value) { 
2613      this.dateTime = value;
2614      return this;
2615    }
2616
2617    /**
2618     * @return The date and time that this nutrition order was requested.
2619     */
2620    public Date getDateTime() { 
2621      return this.dateTime == null ? null : this.dateTime.getValue();
2622    }
2623
2624    /**
2625     * @param value The date and time that this nutrition order was requested.
2626     */
2627    public NutritionOrder setDateTime(Date value) { 
2628        if (this.dateTime == null)
2629          this.dateTime = new DateTimeType();
2630        this.dateTime.setValue(value);
2631      return this;
2632    }
2633
2634    /**
2635     * @return {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2636     */
2637    public Reference getOrderer() { 
2638      if (this.orderer == null)
2639        if (Configuration.errorOnAutoCreate())
2640          throw new Error("Attempt to auto-create NutritionOrder.orderer");
2641        else if (Configuration.doAutoCreate())
2642          this.orderer = new Reference(); // cc
2643      return this.orderer;
2644    }
2645
2646    public boolean hasOrderer() { 
2647      return this.orderer != null && !this.orderer.isEmpty();
2648    }
2649
2650    /**
2651     * @param value {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2652     */
2653    public NutritionOrder setOrderer(Reference value) { 
2654      this.orderer = value;
2655      return this;
2656    }
2657
2658    /**
2659     * @return {@link #orderer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2660     */
2661    public Practitioner getOrdererTarget() { 
2662      if (this.ordererTarget == null)
2663        if (Configuration.errorOnAutoCreate())
2664          throw new Error("Attempt to auto-create NutritionOrder.orderer");
2665        else if (Configuration.doAutoCreate())
2666          this.ordererTarget = new Practitioner(); // aa
2667      return this.ordererTarget;
2668    }
2669
2670    /**
2671     * @param value {@link #orderer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2672     */
2673    public NutritionOrder setOrdererTarget(Practitioner value) { 
2674      this.ordererTarget = value;
2675      return this;
2676    }
2677
2678    /**
2679     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2680     */
2681    public List<Reference> getAllergyIntolerance() { 
2682      if (this.allergyIntolerance == null)
2683        this.allergyIntolerance = new ArrayList<Reference>();
2684      return this.allergyIntolerance;
2685    }
2686
2687    public boolean hasAllergyIntolerance() { 
2688      if (this.allergyIntolerance == null)
2689        return false;
2690      for (Reference item : this.allergyIntolerance)
2691        if (!item.isEmpty())
2692          return true;
2693      return false;
2694    }
2695
2696    /**
2697     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2698     */
2699    // syntactic sugar
2700    public Reference addAllergyIntolerance() { //3
2701      Reference t = new Reference();
2702      if (this.allergyIntolerance == null)
2703        this.allergyIntolerance = new ArrayList<Reference>();
2704      this.allergyIntolerance.add(t);
2705      return t;
2706    }
2707
2708    // syntactic sugar
2709    public NutritionOrder addAllergyIntolerance(Reference t) { //3
2710      if (t == null)
2711        return this;
2712      if (this.allergyIntolerance == null)
2713        this.allergyIntolerance = new ArrayList<Reference>();
2714      this.allergyIntolerance.add(t);
2715      return this;
2716    }
2717
2718    /**
2719     * @return {@link #allergyIntolerance} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2720     */
2721    public List<AllergyIntolerance> getAllergyIntoleranceTarget() { 
2722      if (this.allergyIntoleranceTarget == null)
2723        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
2724      return this.allergyIntoleranceTarget;
2725    }
2726
2727    // syntactic sugar
2728    /**
2729     * @return {@link #allergyIntolerance} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2730     */
2731    public AllergyIntolerance addAllergyIntoleranceTarget() { 
2732      AllergyIntolerance r = new AllergyIntolerance();
2733      if (this.allergyIntoleranceTarget == null)
2734        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
2735      this.allergyIntoleranceTarget.add(r);
2736      return r;
2737    }
2738
2739    /**
2740     * @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.)
2741     */
2742    public List<CodeableConcept> getFoodPreferenceModifier() { 
2743      if (this.foodPreferenceModifier == null)
2744        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
2745      return this.foodPreferenceModifier;
2746    }
2747
2748    public boolean hasFoodPreferenceModifier() { 
2749      if (this.foodPreferenceModifier == null)
2750        return false;
2751      for (CodeableConcept item : this.foodPreferenceModifier)
2752        if (!item.isEmpty())
2753          return true;
2754      return false;
2755    }
2756
2757    /**
2758     * @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.)
2759     */
2760    // syntactic sugar
2761    public CodeableConcept addFoodPreferenceModifier() { //3
2762      CodeableConcept t = new CodeableConcept();
2763      if (this.foodPreferenceModifier == null)
2764        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
2765      this.foodPreferenceModifier.add(t);
2766      return t;
2767    }
2768
2769    // syntactic sugar
2770    public NutritionOrder addFoodPreferenceModifier(CodeableConcept t) { //3
2771      if (t == null)
2772        return this;
2773      if (this.foodPreferenceModifier == null)
2774        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
2775      this.foodPreferenceModifier.add(t);
2776      return this;
2777    }
2778
2779    /**
2780     * @return {@link #excludeFoodModifier} (This modifier is used to convey order-specific modifiers about the type of food 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.)
2781     */
2782    public List<CodeableConcept> getExcludeFoodModifier() { 
2783      if (this.excludeFoodModifier == null)
2784        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
2785      return this.excludeFoodModifier;
2786    }
2787
2788    public boolean hasExcludeFoodModifier() { 
2789      if (this.excludeFoodModifier == null)
2790        return false;
2791      for (CodeableConcept item : this.excludeFoodModifier)
2792        if (!item.isEmpty())
2793          return true;
2794      return false;
2795    }
2796
2797    /**
2798     * @return {@link #excludeFoodModifier} (This modifier is used to convey order-specific modifiers about the type of food 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.)
2799     */
2800    // syntactic sugar
2801    public CodeableConcept addExcludeFoodModifier() { //3
2802      CodeableConcept t = new CodeableConcept();
2803      if (this.excludeFoodModifier == null)
2804        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
2805      this.excludeFoodModifier.add(t);
2806      return t;
2807    }
2808
2809    // syntactic sugar
2810    public NutritionOrder addExcludeFoodModifier(CodeableConcept t) { //3
2811      if (t == null)
2812        return this;
2813      if (this.excludeFoodModifier == null)
2814        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
2815      this.excludeFoodModifier.add(t);
2816      return this;
2817    }
2818
2819    /**
2820     * @return {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
2821     */
2822    public NutritionOrderOralDietComponent getOralDiet() { 
2823      if (this.oralDiet == null)
2824        if (Configuration.errorOnAutoCreate())
2825          throw new Error("Attempt to auto-create NutritionOrder.oralDiet");
2826        else if (Configuration.doAutoCreate())
2827          this.oralDiet = new NutritionOrderOralDietComponent(); // cc
2828      return this.oralDiet;
2829    }
2830
2831    public boolean hasOralDiet() { 
2832      return this.oralDiet != null && !this.oralDiet.isEmpty();
2833    }
2834
2835    /**
2836     * @param value {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
2837     */
2838    public NutritionOrder setOralDiet(NutritionOrderOralDietComponent value) { 
2839      this.oralDiet = value;
2840      return this;
2841    }
2842
2843    /**
2844     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
2845     */
2846    public List<NutritionOrderSupplementComponent> getSupplement() { 
2847      if (this.supplement == null)
2848        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
2849      return this.supplement;
2850    }
2851
2852    public boolean hasSupplement() { 
2853      if (this.supplement == null)
2854        return false;
2855      for (NutritionOrderSupplementComponent item : this.supplement)
2856        if (!item.isEmpty())
2857          return true;
2858      return false;
2859    }
2860
2861    /**
2862     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
2863     */
2864    // syntactic sugar
2865    public NutritionOrderSupplementComponent addSupplement() { //3
2866      NutritionOrderSupplementComponent t = new NutritionOrderSupplementComponent();
2867      if (this.supplement == null)
2868        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
2869      this.supplement.add(t);
2870      return t;
2871    }
2872
2873    // syntactic sugar
2874    public NutritionOrder addSupplement(NutritionOrderSupplementComponent t) { //3
2875      if (t == null)
2876        return this;
2877      if (this.supplement == null)
2878        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
2879      this.supplement.add(t);
2880      return this;
2881    }
2882
2883    /**
2884     * @return {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
2885     */
2886    public NutritionOrderEnteralFormulaComponent getEnteralFormula() { 
2887      if (this.enteralFormula == null)
2888        if (Configuration.errorOnAutoCreate())
2889          throw new Error("Attempt to auto-create NutritionOrder.enteralFormula");
2890        else if (Configuration.doAutoCreate())
2891          this.enteralFormula = new NutritionOrderEnteralFormulaComponent(); // cc
2892      return this.enteralFormula;
2893    }
2894
2895    public boolean hasEnteralFormula() { 
2896      return this.enteralFormula != null && !this.enteralFormula.isEmpty();
2897    }
2898
2899    /**
2900     * @param value {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
2901     */
2902    public NutritionOrder setEnteralFormula(NutritionOrderEnteralFormulaComponent value) { 
2903      this.enteralFormula = value;
2904      return this;
2905    }
2906
2907      protected void listChildren(List<Property> childrenList) {
2908        super.listChildren(childrenList);
2909        childrenList.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));
2910        childrenList.add(new Property("status", "code", "The workflow status of the nutrition order/request.", 0, java.lang.Integer.MAX_VALUE, status));
2911        childrenList.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, java.lang.Integer.MAX_VALUE, patient));
2912        childrenList.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, java.lang.Integer.MAX_VALUE, encounter));
2913        childrenList.add(new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, java.lang.Integer.MAX_VALUE, dateTime));
2914        childrenList.add(new Property("orderer", "Reference(Practitioner)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, java.lang.Integer.MAX_VALUE, orderer));
2915        childrenList.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));
2916        childrenList.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));
2917        childrenList.add(new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food 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));
2918        childrenList.add(new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, java.lang.Integer.MAX_VALUE, oralDiet));
2919        childrenList.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));
2920        childrenList.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, java.lang.Integer.MAX_VALUE, enteralFormula));
2921      }
2922
2923      @Override
2924      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2925        switch (hash) {
2926        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2927        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<NutritionOrderStatus>
2928        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2929        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2930        case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
2931        case -1207109509: /*orderer*/ return this.orderer == null ? new Base[0] : new Base[] {this.orderer}; // Reference
2932        case -120164120: /*allergyIntolerance*/ return this.allergyIntolerance == null ? new Base[0] : this.allergyIntolerance.toArray(new Base[this.allergyIntolerance.size()]); // Reference
2933        case 659473872: /*foodPreferenceModifier*/ return this.foodPreferenceModifier == null ? new Base[0] : this.foodPreferenceModifier.toArray(new Base[this.foodPreferenceModifier.size()]); // CodeableConcept
2934        case 1760260175: /*excludeFoodModifier*/ return this.excludeFoodModifier == null ? new Base[0] : this.excludeFoodModifier.toArray(new Base[this.excludeFoodModifier.size()]); // CodeableConcept
2935        case 1153521250: /*oralDiet*/ return this.oralDiet == null ? new Base[0] : new Base[] {this.oralDiet}; // NutritionOrderOralDietComponent
2936        case -711993159: /*supplement*/ return this.supplement == null ? new Base[0] : this.supplement.toArray(new Base[this.supplement.size()]); // NutritionOrderSupplementComponent
2937        case -671083805: /*enteralFormula*/ return this.enteralFormula == null ? new Base[0] : new Base[] {this.enteralFormula}; // NutritionOrderEnteralFormulaComponent
2938        default: return super.getProperty(hash, name, checkValid);
2939        }
2940
2941      }
2942
2943      @Override
2944      public void setProperty(int hash, String name, Base value) throws FHIRException {
2945        switch (hash) {
2946        case -1618432855: // identifier
2947          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2948          break;
2949        case -892481550: // status
2950          this.status = new NutritionOrderStatusEnumFactory().fromType(value); // Enumeration<NutritionOrderStatus>
2951          break;
2952        case -791418107: // patient
2953          this.patient = castToReference(value); // Reference
2954          break;
2955        case 1524132147: // encounter
2956          this.encounter = castToReference(value); // Reference
2957          break;
2958        case 1792749467: // dateTime
2959          this.dateTime = castToDateTime(value); // DateTimeType
2960          break;
2961        case -1207109509: // orderer
2962          this.orderer = castToReference(value); // Reference
2963          break;
2964        case -120164120: // allergyIntolerance
2965          this.getAllergyIntolerance().add(castToReference(value)); // Reference
2966          break;
2967        case 659473872: // foodPreferenceModifier
2968          this.getFoodPreferenceModifier().add(castToCodeableConcept(value)); // CodeableConcept
2969          break;
2970        case 1760260175: // excludeFoodModifier
2971          this.getExcludeFoodModifier().add(castToCodeableConcept(value)); // CodeableConcept
2972          break;
2973        case 1153521250: // oralDiet
2974          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
2975          break;
2976        case -711993159: // supplement
2977          this.getSupplement().add((NutritionOrderSupplementComponent) value); // NutritionOrderSupplementComponent
2978          break;
2979        case -671083805: // enteralFormula
2980          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
2981          break;
2982        default: super.setProperty(hash, name, value);
2983        }
2984
2985      }
2986
2987      @Override
2988      public void setProperty(String name, Base value) throws FHIRException {
2989        if (name.equals("identifier"))
2990          this.getIdentifier().add(castToIdentifier(value));
2991        else if (name.equals("status"))
2992          this.status = new NutritionOrderStatusEnumFactory().fromType(value); // Enumeration<NutritionOrderStatus>
2993        else if (name.equals("patient"))
2994          this.patient = castToReference(value); // Reference
2995        else if (name.equals("encounter"))
2996          this.encounter = castToReference(value); // Reference
2997        else if (name.equals("dateTime"))
2998          this.dateTime = castToDateTime(value); // DateTimeType
2999        else if (name.equals("orderer"))
3000          this.orderer = castToReference(value); // Reference
3001        else if (name.equals("allergyIntolerance"))
3002          this.getAllergyIntolerance().add(castToReference(value));
3003        else if (name.equals("foodPreferenceModifier"))
3004          this.getFoodPreferenceModifier().add(castToCodeableConcept(value));
3005        else if (name.equals("excludeFoodModifier"))
3006          this.getExcludeFoodModifier().add(castToCodeableConcept(value));
3007        else if (name.equals("oralDiet"))
3008          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3009        else if (name.equals("supplement"))
3010          this.getSupplement().add((NutritionOrderSupplementComponent) value);
3011        else if (name.equals("enteralFormula"))
3012          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3013        else
3014          super.setProperty(name, value);
3015      }
3016
3017      @Override
3018      public Base makeProperty(int hash, String name) throws FHIRException {
3019        switch (hash) {
3020        case -1618432855:  return addIdentifier(); // Identifier
3021        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<NutritionOrderStatus>
3022        case -791418107:  return getPatient(); // Reference
3023        case 1524132147:  return getEncounter(); // Reference
3024        case 1792749467: throw new FHIRException("Cannot make property dateTime as it is not a complex type"); // DateTimeType
3025        case -1207109509:  return getOrderer(); // Reference
3026        case -120164120:  return addAllergyIntolerance(); // Reference
3027        case 659473872:  return addFoodPreferenceModifier(); // CodeableConcept
3028        case 1760260175:  return addExcludeFoodModifier(); // CodeableConcept
3029        case 1153521250:  return getOralDiet(); // NutritionOrderOralDietComponent
3030        case -711993159:  return addSupplement(); // NutritionOrderSupplementComponent
3031        case -671083805:  return getEnteralFormula(); // NutritionOrderEnteralFormulaComponent
3032        default: return super.makeProperty(hash, name);
3033        }
3034
3035      }
3036
3037      @Override
3038      public Base addChild(String name) throws FHIRException {
3039        if (name.equals("identifier")) {
3040          return addIdentifier();
3041        }
3042        else if (name.equals("status")) {
3043          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.status");
3044        }
3045        else if (name.equals("patient")) {
3046          this.patient = new Reference();
3047          return this.patient;
3048        }
3049        else if (name.equals("encounter")) {
3050          this.encounter = new Reference();
3051          return this.encounter;
3052        }
3053        else if (name.equals("dateTime")) {
3054          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.dateTime");
3055        }
3056        else if (name.equals("orderer")) {
3057          this.orderer = new Reference();
3058          return this.orderer;
3059        }
3060        else if (name.equals("allergyIntolerance")) {
3061          return addAllergyIntolerance();
3062        }
3063        else if (name.equals("foodPreferenceModifier")) {
3064          return addFoodPreferenceModifier();
3065        }
3066        else if (name.equals("excludeFoodModifier")) {
3067          return addExcludeFoodModifier();
3068        }
3069        else if (name.equals("oralDiet")) {
3070          this.oralDiet = new NutritionOrderOralDietComponent();
3071          return this.oralDiet;
3072        }
3073        else if (name.equals("supplement")) {
3074          return addSupplement();
3075        }
3076        else if (name.equals("enteralFormula")) {
3077          this.enteralFormula = new NutritionOrderEnteralFormulaComponent();
3078          return this.enteralFormula;
3079        }
3080        else
3081          return super.addChild(name);
3082      }
3083
3084  public String fhirType() {
3085    return "NutritionOrder";
3086
3087  }
3088
3089      public NutritionOrder copy() {
3090        NutritionOrder dst = new NutritionOrder();
3091        copyValues(dst);
3092        if (identifier != null) {
3093          dst.identifier = new ArrayList<Identifier>();
3094          for (Identifier i : identifier)
3095            dst.identifier.add(i.copy());
3096        };
3097        dst.status = status == null ? null : status.copy();
3098        dst.patient = patient == null ? null : patient.copy();
3099        dst.encounter = encounter == null ? null : encounter.copy();
3100        dst.dateTime = dateTime == null ? null : dateTime.copy();
3101        dst.orderer = orderer == null ? null : orderer.copy();
3102        if (allergyIntolerance != null) {
3103          dst.allergyIntolerance = new ArrayList<Reference>();
3104          for (Reference i : allergyIntolerance)
3105            dst.allergyIntolerance.add(i.copy());
3106        };
3107        if (foodPreferenceModifier != null) {
3108          dst.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3109          for (CodeableConcept i : foodPreferenceModifier)
3110            dst.foodPreferenceModifier.add(i.copy());
3111        };
3112        if (excludeFoodModifier != null) {
3113          dst.excludeFoodModifier = new ArrayList<CodeableConcept>();
3114          for (CodeableConcept i : excludeFoodModifier)
3115            dst.excludeFoodModifier.add(i.copy());
3116        };
3117        dst.oralDiet = oralDiet == null ? null : oralDiet.copy();
3118        if (supplement != null) {
3119          dst.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3120          for (NutritionOrderSupplementComponent i : supplement)
3121            dst.supplement.add(i.copy());
3122        };
3123        dst.enteralFormula = enteralFormula == null ? null : enteralFormula.copy();
3124        return dst;
3125      }
3126
3127      protected NutritionOrder typedCopy() {
3128        return copy();
3129      }
3130
3131      @Override
3132      public boolean equalsDeep(Base other) {
3133        if (!super.equalsDeep(other))
3134          return false;
3135        if (!(other instanceof NutritionOrder))
3136          return false;
3137        NutritionOrder o = (NutritionOrder) other;
3138        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(patient, o.patient, true)
3139           && compareDeep(encounter, o.encounter, true) && compareDeep(dateTime, o.dateTime, true) && compareDeep(orderer, o.orderer, true)
3140           && compareDeep(allergyIntolerance, o.allergyIntolerance, true) && compareDeep(foodPreferenceModifier, o.foodPreferenceModifier, true)
3141           && compareDeep(excludeFoodModifier, o.excludeFoodModifier, true) && compareDeep(oralDiet, o.oralDiet, true)
3142           && compareDeep(supplement, o.supplement, true) && compareDeep(enteralFormula, o.enteralFormula, true)
3143          ;
3144      }
3145
3146      @Override
3147      public boolean equalsShallow(Base other) {
3148        if (!super.equalsShallow(other))
3149          return false;
3150        if (!(other instanceof NutritionOrder))
3151          return false;
3152        NutritionOrder o = (NutritionOrder) other;
3153        return compareValues(status, o.status, true) && compareValues(dateTime, o.dateTime, true);
3154      }
3155
3156      public boolean isEmpty() {
3157        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
3158           && (patient == null || patient.isEmpty()) && (encounter == null || encounter.isEmpty()) && (dateTime == null || dateTime.isEmpty())
3159           && (orderer == null || orderer.isEmpty()) && (allergyIntolerance == null || allergyIntolerance.isEmpty())
3160           && (foodPreferenceModifier == null || foodPreferenceModifier.isEmpty()) && (excludeFoodModifier == null || excludeFoodModifier.isEmpty())
3161           && (oralDiet == null || oralDiet.isEmpty()) && (supplement == null || supplement.isEmpty())
3162           && (enteralFormula == null || enteralFormula.isEmpty());
3163      }
3164
3165  @Override
3166  public ResourceType getResourceType() {
3167    return ResourceType.NutritionOrder;
3168   }
3169
3170 /**
3171   * Search parameter: <b>patient</b>
3172   * <p>
3173   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
3174   * Type: <b>reference</b><br>
3175   * Path: <b>NutritionOrder.patient</b><br>
3176   * </p>
3177   */
3178  @SearchParamDefinition(name="patient", path="NutritionOrder.patient", description="The identity of the person who requires the diet, formula or nutritional supplement", type="reference" )
3179  public static final String SP_PATIENT = "patient";
3180 /**
3181   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3182   * <p>
3183   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
3184   * Type: <b>reference</b><br>
3185   * Path: <b>NutritionOrder.patient</b><br>
3186   * </p>
3187   */
3188  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3189
3190/**
3191   * Constant for fluent queries to be used to add include statements. Specifies
3192   * the path value of "<b>NutritionOrder:patient</b>".
3193   */
3194  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("NutritionOrder:patient").toLocked();
3195
3196 /**
3197   * Search parameter: <b>status</b>
3198   * <p>
3199   * Description: <b>Status of the nutrition order.</b><br>
3200   * Type: <b>token</b><br>
3201   * Path: <b>NutritionOrder.status</b><br>
3202   * </p>
3203   */
3204  @SearchParamDefinition(name="status", path="NutritionOrder.status", description="Status of the nutrition order.", type="token" )
3205  public static final String SP_STATUS = "status";
3206 /**
3207   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3208   * <p>
3209   * Description: <b>Status of the nutrition order.</b><br>
3210   * Type: <b>token</b><br>
3211   * Path: <b>NutritionOrder.status</b><br>
3212   * </p>
3213   */
3214  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3215
3216 /**
3217   * Search parameter: <b>supplement</b>
3218   * <p>
3219   * Description: <b>Type of supplement product requested</b><br>
3220   * Type: <b>token</b><br>
3221   * Path: <b>NutritionOrder.supplement.type</b><br>
3222   * </p>
3223   */
3224  @SearchParamDefinition(name="supplement", path="NutritionOrder.supplement.type", description="Type of supplement product requested", type="token" )
3225  public static final String SP_SUPPLEMENT = "supplement";
3226 /**
3227   * <b>Fluent Client</b> search parameter constant for <b>supplement</b>
3228   * <p>
3229   * Description: <b>Type of supplement product requested</b><br>
3230   * Type: <b>token</b><br>
3231   * Path: <b>NutritionOrder.supplement.type</b><br>
3232   * </p>
3233   */
3234  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUPPLEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUPPLEMENT);
3235
3236 /**
3237   * Search parameter: <b>oraldiet</b>
3238   * <p>
3239   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
3240   * Type: <b>token</b><br>
3241   * Path: <b>NutritionOrder.oralDiet.type</b><br>
3242   * </p>
3243   */
3244  @SearchParamDefinition(name="oraldiet", path="NutritionOrder.oralDiet.type", description="Type of diet that can be consumed orally (i.e., take via the mouth).", type="token" )
3245  public static final String SP_ORALDIET = "oraldiet";
3246 /**
3247   * <b>Fluent Client</b> search parameter constant for <b>oraldiet</b>
3248   * <p>
3249   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
3250   * Type: <b>token</b><br>
3251   * Path: <b>NutritionOrder.oralDiet.type</b><br>
3252   * </p>
3253   */
3254  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORALDIET = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORALDIET);
3255
3256 /**
3257   * Search parameter: <b>provider</b>
3258   * <p>
3259   * Description: <b>The identify of the provider who placed the nutrition order</b><br>
3260   * Type: <b>reference</b><br>
3261   * Path: <b>NutritionOrder.orderer</b><br>
3262   * </p>
3263   */
3264  @SearchParamDefinition(name="provider", path="NutritionOrder.orderer", description="The identify of the provider who placed the nutrition order", type="reference" )
3265  public static final String SP_PROVIDER = "provider";
3266 /**
3267   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
3268   * <p>
3269   * Description: <b>The identify of the provider who placed the nutrition order</b><br>
3270   * Type: <b>reference</b><br>
3271   * Path: <b>NutritionOrder.orderer</b><br>
3272   * </p>
3273   */
3274  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
3275
3276/**
3277   * Constant for fluent queries to be used to add include statements. Specifies
3278   * the path value of "<b>NutritionOrder:provider</b>".
3279   */
3280  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("NutritionOrder:provider").toLocked();
3281
3282 /**
3283   * Search parameter: <b>encounter</b>
3284   * <p>
3285   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
3286   * Type: <b>reference</b><br>
3287   * Path: <b>NutritionOrder.encounter</b><br>
3288   * </p>
3289   */
3290  @SearchParamDefinition(name="encounter", path="NutritionOrder.encounter", description="Return nutrition orders with this encounter identifier", type="reference" )
3291  public static final String SP_ENCOUNTER = "encounter";
3292 /**
3293   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3294   * <p>
3295   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
3296   * Type: <b>reference</b><br>
3297   * Path: <b>NutritionOrder.encounter</b><br>
3298   * </p>
3299   */
3300  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3301
3302/**
3303   * Constant for fluent queries to be used to add include statements. Specifies
3304   * the path value of "<b>NutritionOrder:encounter</b>".
3305   */
3306  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("NutritionOrder:encounter").toLocked();
3307
3308 /**
3309   * Search parameter: <b>datetime</b>
3310   * <p>
3311   * Description: <b>Return nutrition orders requested on this date</b><br>
3312   * Type: <b>date</b><br>
3313   * Path: <b>NutritionOrder.dateTime</b><br>
3314   * </p>
3315   */
3316  @SearchParamDefinition(name="datetime", path="NutritionOrder.dateTime", description="Return nutrition orders requested on this date", type="date" )
3317  public static final String SP_DATETIME = "datetime";
3318 /**
3319   * <b>Fluent Client</b> search parameter constant for <b>datetime</b>
3320   * <p>
3321   * Description: <b>Return nutrition orders requested on this date</b><br>
3322   * Type: <b>date</b><br>
3323   * Path: <b>NutritionOrder.dateTime</b><br>
3324   * </p>
3325   */
3326  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATETIME);
3327
3328 /**
3329   * Search parameter: <b>additive</b>
3330   * <p>
3331   * Description: <b>Type of module component to add to the feeding</b><br>
3332   * Type: <b>token</b><br>
3333   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
3334   * </p>
3335   */
3336  @SearchParamDefinition(name="additive", path="NutritionOrder.enteralFormula.additiveType", description="Type of module component to add to the feeding", type="token" )
3337  public static final String SP_ADDITIVE = "additive";
3338 /**
3339   * <b>Fluent Client</b> search parameter constant for <b>additive</b>
3340   * <p>
3341   * Description: <b>Type of module component to add to the feeding</b><br>
3342   * Type: <b>token</b><br>
3343   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
3344   * </p>
3345   */
3346  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDITIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDITIVE);
3347
3348 /**
3349   * Search parameter: <b>identifier</b>
3350   * <p>
3351   * Description: <b>Return nutrition orders with this external identifier</b><br>
3352   * Type: <b>token</b><br>
3353   * Path: <b>NutritionOrder.identifier</b><br>
3354   * </p>
3355   */
3356  @SearchParamDefinition(name="identifier", path="NutritionOrder.identifier", description="Return nutrition orders with this external identifier", type="token" )
3357  public static final String SP_IDENTIFIER = "identifier";
3358 /**
3359   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3360   * <p>
3361   * Description: <b>Return nutrition orders with this external identifier</b><br>
3362   * Type: <b>token</b><br>
3363   * Path: <b>NutritionOrder.identifier</b><br>
3364   * </p>
3365   */
3366  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3367
3368 /**
3369   * Search parameter: <b>formula</b>
3370   * <p>
3371   * Description: <b>Type of enteral or infant formula</b><br>
3372   * Type: <b>token</b><br>
3373   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
3374   * </p>
3375   */
3376  @SearchParamDefinition(name="formula", path="NutritionOrder.enteralFormula.baseFormulaType", description="Type of enteral or infant formula", type="token" )
3377  public static final String SP_FORMULA = "formula";
3378 /**
3379   * <b>Fluent Client</b> search parameter constant for <b>formula</b>
3380   * <p>
3381   * Description: <b>Type of enteral or infant formula</b><br>
3382   * Type: <b>token</b><br>
3383   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
3384   * </p>
3385   */
3386  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMULA = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORMULA);
3387
3388
3389}
3390