001package org.hl7.fhir.dstu3.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * An authorization for the supply of glasses and/or contact lenses to a patient.
051 */
052@ResourceDef(name="VisionPrescription", profile="http://hl7.org/fhir/Profile/VisionPrescription")
053public class VisionPrescription extends DomainResource {
054
055    public enum VisionStatus {
056        /**
057         * The instance is currently in-force.
058         */
059        ACTIVE, 
060        /**
061         * The instance is withdrawn, rescinded or reversed.
062         */
063        CANCELLED, 
064        /**
065         * A new instance the contents of which is not complete.
066         */
067        DRAFT, 
068        /**
069         * The instance was entered in error.
070         */
071        ENTEREDINERROR, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static VisionStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("active".equals(codeString))
080          return ACTIVE;
081        if ("cancelled".equals(codeString))
082          return CANCELLED;
083        if ("draft".equals(codeString))
084          return DRAFT;
085        if ("entered-in-error".equals(codeString))
086          return ENTEREDINERROR;
087        if (Configuration.isAcceptInvalidEnums())
088          return null;
089        else
090          throw new FHIRException("Unknown VisionStatus code '"+codeString+"'");
091        }
092        public String toCode() {
093          switch (this) {
094            case ACTIVE: return "active";
095            case CANCELLED: return "cancelled";
096            case DRAFT: return "draft";
097            case ENTEREDINERROR: return "entered-in-error";
098            case NULL: return null;
099            default: return "?";
100          }
101        }
102        public String getSystem() {
103          switch (this) {
104            case ACTIVE: return "http://hl7.org/fhir/fm-status";
105            case CANCELLED: return "http://hl7.org/fhir/fm-status";
106            case DRAFT: return "http://hl7.org/fhir/fm-status";
107            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
108            case NULL: return null;
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            case ACTIVE: return "The instance is currently in-force.";
115            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
116            case DRAFT: return "A new instance the contents of which is not complete.";
117            case ENTEREDINERROR: return "The instance was entered in error.";
118            case NULL: return null;
119            default: return "?";
120          }
121        }
122        public String getDisplay() {
123          switch (this) {
124            case ACTIVE: return "Active";
125            case CANCELLED: return "Cancelled";
126            case DRAFT: return "Draft";
127            case ENTEREDINERROR: return "Entered in Error";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132    }
133
134  public static class VisionStatusEnumFactory implements EnumFactory<VisionStatus> {
135    public VisionStatus fromCode(String codeString) throws IllegalArgumentException {
136      if (codeString == null || "".equals(codeString))
137            if (codeString == null || "".equals(codeString))
138                return null;
139        if ("active".equals(codeString))
140          return VisionStatus.ACTIVE;
141        if ("cancelled".equals(codeString))
142          return VisionStatus.CANCELLED;
143        if ("draft".equals(codeString))
144          return VisionStatus.DRAFT;
145        if ("entered-in-error".equals(codeString))
146          return VisionStatus.ENTEREDINERROR;
147        throw new IllegalArgumentException("Unknown VisionStatus code '"+codeString+"'");
148        }
149        public Enumeration<VisionStatus> fromType(PrimitiveType<?> code) throws FHIRException {
150          if (code == null)
151            return null;
152          if (code.isEmpty())
153            return new Enumeration<VisionStatus>(this);
154          String codeString = code.asStringValue();
155          if (codeString == null || "".equals(codeString))
156            return null;
157        if ("active".equals(codeString))
158          return new Enumeration<VisionStatus>(this, VisionStatus.ACTIVE);
159        if ("cancelled".equals(codeString))
160          return new Enumeration<VisionStatus>(this, VisionStatus.CANCELLED);
161        if ("draft".equals(codeString))
162          return new Enumeration<VisionStatus>(this, VisionStatus.DRAFT);
163        if ("entered-in-error".equals(codeString))
164          return new Enumeration<VisionStatus>(this, VisionStatus.ENTEREDINERROR);
165        throw new FHIRException("Unknown VisionStatus code '"+codeString+"'");
166        }
167    public String toCode(VisionStatus code) {
168      if (code == VisionStatus.ACTIVE)
169        return "active";
170      if (code == VisionStatus.CANCELLED)
171        return "cancelled";
172      if (code == VisionStatus.DRAFT)
173        return "draft";
174      if (code == VisionStatus.ENTEREDINERROR)
175        return "entered-in-error";
176      return "?";
177      }
178    public String toSystem(VisionStatus code) {
179      return code.getSystem();
180      }
181    }
182
183    public enum VisionEyes {
184        /**
185         * Right Eye
186         */
187        RIGHT, 
188        /**
189         * Left Eye
190         */
191        LEFT, 
192        /**
193         * added to help the parsers with the generic types
194         */
195        NULL;
196        public static VisionEyes fromCode(String codeString) throws FHIRException {
197            if (codeString == null || "".equals(codeString))
198                return null;
199        if ("right".equals(codeString))
200          return RIGHT;
201        if ("left".equals(codeString))
202          return LEFT;
203        if (Configuration.isAcceptInvalidEnums())
204          return null;
205        else
206          throw new FHIRException("Unknown VisionEyes code '"+codeString+"'");
207        }
208        public String toCode() {
209          switch (this) {
210            case RIGHT: return "right";
211            case LEFT: return "left";
212            case NULL: return null;
213            default: return "?";
214          }
215        }
216        public String getSystem() {
217          switch (this) {
218            case RIGHT: return "http://hl7.org/fhir/vision-eye-codes";
219            case LEFT: return "http://hl7.org/fhir/vision-eye-codes";
220            case NULL: return null;
221            default: return "?";
222          }
223        }
224        public String getDefinition() {
225          switch (this) {
226            case RIGHT: return "Right Eye";
227            case LEFT: return "Left Eye";
228            case NULL: return null;
229            default: return "?";
230          }
231        }
232        public String getDisplay() {
233          switch (this) {
234            case RIGHT: return "Right Eye";
235            case LEFT: return "Left Eye";
236            case NULL: return null;
237            default: return "?";
238          }
239        }
240    }
241
242  public static class VisionEyesEnumFactory implements EnumFactory<VisionEyes> {
243    public VisionEyes fromCode(String codeString) throws IllegalArgumentException {
244      if (codeString == null || "".equals(codeString))
245            if (codeString == null || "".equals(codeString))
246                return null;
247        if ("right".equals(codeString))
248          return VisionEyes.RIGHT;
249        if ("left".equals(codeString))
250          return VisionEyes.LEFT;
251        throw new IllegalArgumentException("Unknown VisionEyes code '"+codeString+"'");
252        }
253        public Enumeration<VisionEyes> fromType(PrimitiveType<?> code) throws FHIRException {
254          if (code == null)
255            return null;
256          if (code.isEmpty())
257            return new Enumeration<VisionEyes>(this);
258          String codeString = code.asStringValue();
259          if (codeString == null || "".equals(codeString))
260            return null;
261        if ("right".equals(codeString))
262          return new Enumeration<VisionEyes>(this, VisionEyes.RIGHT);
263        if ("left".equals(codeString))
264          return new Enumeration<VisionEyes>(this, VisionEyes.LEFT);
265        throw new FHIRException("Unknown VisionEyes code '"+codeString+"'");
266        }
267    public String toCode(VisionEyes code) {
268      if (code == VisionEyes.RIGHT)
269        return "right";
270      if (code == VisionEyes.LEFT)
271        return "left";
272      return "?";
273      }
274    public String toSystem(VisionEyes code) {
275      return code.getSystem();
276      }
277    }
278
279    public enum VisionBase {
280        /**
281         * top
282         */
283        UP, 
284        /**
285         * bottom
286         */
287        DOWN, 
288        /**
289         * inner edge
290         */
291        IN, 
292        /**
293         * outer edge
294         */
295        OUT, 
296        /**
297         * added to help the parsers with the generic types
298         */
299        NULL;
300        public static VisionBase fromCode(String codeString) throws FHIRException {
301            if (codeString == null || "".equals(codeString))
302                return null;
303        if ("up".equals(codeString))
304          return UP;
305        if ("down".equals(codeString))
306          return DOWN;
307        if ("in".equals(codeString))
308          return IN;
309        if ("out".equals(codeString))
310          return OUT;
311        if (Configuration.isAcceptInvalidEnums())
312          return null;
313        else
314          throw new FHIRException("Unknown VisionBase code '"+codeString+"'");
315        }
316        public String toCode() {
317          switch (this) {
318            case UP: return "up";
319            case DOWN: return "down";
320            case IN: return "in";
321            case OUT: return "out";
322            case NULL: return null;
323            default: return "?";
324          }
325        }
326        public String getSystem() {
327          switch (this) {
328            case UP: return "http://hl7.org/fhir/vision-base-codes";
329            case DOWN: return "http://hl7.org/fhir/vision-base-codes";
330            case IN: return "http://hl7.org/fhir/vision-base-codes";
331            case OUT: return "http://hl7.org/fhir/vision-base-codes";
332            case NULL: return null;
333            default: return "?";
334          }
335        }
336        public String getDefinition() {
337          switch (this) {
338            case UP: return "top";
339            case DOWN: return "bottom";
340            case IN: return "inner edge";
341            case OUT: return "outer edge";
342            case NULL: return null;
343            default: return "?";
344          }
345        }
346        public String getDisplay() {
347          switch (this) {
348            case UP: return "Up";
349            case DOWN: return "Down";
350            case IN: return "In";
351            case OUT: return "Out";
352            case NULL: return null;
353            default: return "?";
354          }
355        }
356    }
357
358  public static class VisionBaseEnumFactory implements EnumFactory<VisionBase> {
359    public VisionBase fromCode(String codeString) throws IllegalArgumentException {
360      if (codeString == null || "".equals(codeString))
361            if (codeString == null || "".equals(codeString))
362                return null;
363        if ("up".equals(codeString))
364          return VisionBase.UP;
365        if ("down".equals(codeString))
366          return VisionBase.DOWN;
367        if ("in".equals(codeString))
368          return VisionBase.IN;
369        if ("out".equals(codeString))
370          return VisionBase.OUT;
371        throw new IllegalArgumentException("Unknown VisionBase code '"+codeString+"'");
372        }
373        public Enumeration<VisionBase> fromType(PrimitiveType<?> code) throws FHIRException {
374          if (code == null)
375            return null;
376          if (code.isEmpty())
377            return new Enumeration<VisionBase>(this);
378          String codeString = code.asStringValue();
379          if (codeString == null || "".equals(codeString))
380            return null;
381        if ("up".equals(codeString))
382          return new Enumeration<VisionBase>(this, VisionBase.UP);
383        if ("down".equals(codeString))
384          return new Enumeration<VisionBase>(this, VisionBase.DOWN);
385        if ("in".equals(codeString))
386          return new Enumeration<VisionBase>(this, VisionBase.IN);
387        if ("out".equals(codeString))
388          return new Enumeration<VisionBase>(this, VisionBase.OUT);
389        throw new FHIRException("Unknown VisionBase code '"+codeString+"'");
390        }
391    public String toCode(VisionBase code) {
392      if (code == VisionBase.UP)
393        return "up";
394      if (code == VisionBase.DOWN)
395        return "down";
396      if (code == VisionBase.IN)
397        return "in";
398      if (code == VisionBase.OUT)
399        return "out";
400      return "?";
401      }
402    public String toSystem(VisionBase code) {
403      return code.getSystem();
404      }
405    }
406
407    @Block()
408    public static class VisionPrescriptionDispenseComponent extends BackboneElement implements IBaseBackboneElement {
409        /**
410         * Identifies the type of vision correction product which is required for the patient.
411         */
412        @Child(name = "product", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
413        @Description(shortDefinition="Product to be supplied", formalDefinition="Identifies the type of vision correction product which is required for the patient." )
414        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vision-product")
415        protected CodeableConcept product;
416
417        /**
418         * The eye for which the lens applies.
419         */
420        @Child(name = "eye", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
421        @Description(shortDefinition="right | left", formalDefinition="The eye for which the lens applies." )
422        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vision-eye-codes")
423        protected Enumeration<VisionEyes> eye;
424
425        /**
426         * Lens power measured in diopters (0.25 units).
427         */
428        @Child(name = "sphere", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
429        @Description(shortDefinition="Lens sphere", formalDefinition="Lens power measured in diopters (0.25 units)." )
430        protected DecimalType sphere;
431
432        /**
433         * Power adjustment for astigmatism measured in diopters (0.25 units).
434         */
435        @Child(name = "cylinder", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
436        @Description(shortDefinition="Lens cylinder", formalDefinition="Power adjustment for astigmatism measured in diopters (0.25 units)." )
437        protected DecimalType cylinder;
438
439        /**
440         * Adjustment for astigmatism measured in integer degrees.
441         */
442        @Child(name = "axis", type = {IntegerType.class}, order=5, min=0, max=1, modifier=false, summary=false)
443        @Description(shortDefinition="Lens axis", formalDefinition="Adjustment for astigmatism measured in integer degrees." )
444        protected IntegerType axis;
445
446        /**
447         * Amount of prism to compensate for eye alignment in fractional units.
448         */
449        @Child(name = "prism", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
450        @Description(shortDefinition="Lens prism", formalDefinition="Amount of prism to compensate for eye alignment in fractional units." )
451        protected DecimalType prism;
452
453        /**
454         * The relative base, or reference lens edge, for the prism.
455         */
456        @Child(name = "base", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
457        @Description(shortDefinition="up | down | in | out", formalDefinition="The relative base, or reference lens edge, for the prism." )
458        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vision-base-codes")
459        protected Enumeration<VisionBase> base;
460
461        /**
462         * Power adjustment for multifocal lenses measured in diopters (0.25 units).
463         */
464        @Child(name = "add", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=false)
465        @Description(shortDefinition="Lens add", formalDefinition="Power adjustment for multifocal lenses measured in diopters (0.25 units)." )
466        protected DecimalType add;
467
468        /**
469         * Contact lens power measured in diopters (0.25 units).
470         */
471        @Child(name = "power", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
472        @Description(shortDefinition="Contact lens power", formalDefinition="Contact lens power measured in diopters (0.25 units)." )
473        protected DecimalType power;
474
475        /**
476         * Back curvature measured in millimeters.
477         */
478        @Child(name = "backCurve", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
479        @Description(shortDefinition="Contact lens back curvature", formalDefinition="Back curvature measured in millimeters." )
480        protected DecimalType backCurve;
481
482        /**
483         * Contact lens diameter measured in millimeters.
484         */
485        @Child(name = "diameter", type = {DecimalType.class}, order=11, min=0, max=1, modifier=false, summary=false)
486        @Description(shortDefinition="Contact lens diameter", formalDefinition="Contact lens diameter measured in millimeters." )
487        protected DecimalType diameter;
488
489        /**
490         * The recommended maximum wear period for the lens.
491         */
492        @Child(name = "duration", type = {SimpleQuantity.class}, order=12, min=0, max=1, modifier=false, summary=false)
493        @Description(shortDefinition="Lens wear duration", formalDefinition="The recommended maximum wear period for the lens." )
494        protected SimpleQuantity duration;
495
496        /**
497         * Special color or pattern.
498         */
499        @Child(name = "color", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
500        @Description(shortDefinition="Color required", formalDefinition="Special color or pattern." )
501        protected StringType color;
502
503        /**
504         * Brand recommendations or restrictions.
505         */
506        @Child(name = "brand", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
507        @Description(shortDefinition="Brand required", formalDefinition="Brand recommendations or restrictions." )
508        protected StringType brand;
509
510        /**
511         * Notes for special requirements such as coatings and lens materials.
512         */
513        @Child(name = "note", type = {Annotation.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
514        @Description(shortDefinition="Notes for coatings", formalDefinition="Notes for special requirements such as coatings and lens materials." )
515        protected List<Annotation> note;
516
517        private static final long serialVersionUID = 400998008L;
518
519    /**
520     * Constructor
521     */
522      public VisionPrescriptionDispenseComponent() {
523        super();
524      }
525
526        /**
527         * @return {@link #product} (Identifies the type of vision correction product which is required for the patient.)
528         */
529        public CodeableConcept getProduct() { 
530          if (this.product == null)
531            if (Configuration.errorOnAutoCreate())
532              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.product");
533            else if (Configuration.doAutoCreate())
534              this.product = new CodeableConcept(); // cc
535          return this.product;
536        }
537
538        public boolean hasProduct() { 
539          return this.product != null && !this.product.isEmpty();
540        }
541
542        /**
543         * @param value {@link #product} (Identifies the type of vision correction product which is required for the patient.)
544         */
545        public VisionPrescriptionDispenseComponent setProduct(CodeableConcept value)  { 
546          this.product = value;
547          return this;
548        }
549
550        /**
551         * @return {@link #eye} (The eye for which the lens applies.). This is the underlying object with id, value and extensions. The accessor "getEye" gives direct access to the value
552         */
553        public Enumeration<VisionEyes> getEyeElement() { 
554          if (this.eye == null)
555            if (Configuration.errorOnAutoCreate())
556              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.eye");
557            else if (Configuration.doAutoCreate())
558              this.eye = new Enumeration<VisionEyes>(new VisionEyesEnumFactory()); // bb
559          return this.eye;
560        }
561
562        public boolean hasEyeElement() { 
563          return this.eye != null && !this.eye.isEmpty();
564        }
565
566        public boolean hasEye() { 
567          return this.eye != null && !this.eye.isEmpty();
568        }
569
570        /**
571         * @param value {@link #eye} (The eye for which the lens applies.). This is the underlying object with id, value and extensions. The accessor "getEye" gives direct access to the value
572         */
573        public VisionPrescriptionDispenseComponent setEyeElement(Enumeration<VisionEyes> value) { 
574          this.eye = value;
575          return this;
576        }
577
578        /**
579         * @return The eye for which the lens applies.
580         */
581        public VisionEyes getEye() { 
582          return this.eye == null ? null : this.eye.getValue();
583        }
584
585        /**
586         * @param value The eye for which the lens applies.
587         */
588        public VisionPrescriptionDispenseComponent setEye(VisionEyes value) { 
589          if (value == null)
590            this.eye = null;
591          else {
592            if (this.eye == null)
593              this.eye = new Enumeration<VisionEyes>(new VisionEyesEnumFactory());
594            this.eye.setValue(value);
595          }
596          return this;
597        }
598
599        /**
600         * @return {@link #sphere} (Lens power measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getSphere" gives direct access to the value
601         */
602        public DecimalType getSphereElement() { 
603          if (this.sphere == null)
604            if (Configuration.errorOnAutoCreate())
605              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.sphere");
606            else if (Configuration.doAutoCreate())
607              this.sphere = new DecimalType(); // bb
608          return this.sphere;
609        }
610
611        public boolean hasSphereElement() { 
612          return this.sphere != null && !this.sphere.isEmpty();
613        }
614
615        public boolean hasSphere() { 
616          return this.sphere != null && !this.sphere.isEmpty();
617        }
618
619        /**
620         * @param value {@link #sphere} (Lens power measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getSphere" gives direct access to the value
621         */
622        public VisionPrescriptionDispenseComponent setSphereElement(DecimalType value) { 
623          this.sphere = value;
624          return this;
625        }
626
627        /**
628         * @return Lens power measured in diopters (0.25 units).
629         */
630        public BigDecimal getSphere() { 
631          return this.sphere == null ? null : this.sphere.getValue();
632        }
633
634        /**
635         * @param value Lens power measured in diopters (0.25 units).
636         */
637        public VisionPrescriptionDispenseComponent setSphere(BigDecimal value) { 
638          if (value == null)
639            this.sphere = null;
640          else {
641            if (this.sphere == null)
642              this.sphere = new DecimalType();
643            this.sphere.setValue(value);
644          }
645          return this;
646        }
647
648        /**
649         * @param value Lens power measured in diopters (0.25 units).
650         */
651        public VisionPrescriptionDispenseComponent setSphere(long value) { 
652              this.sphere = new DecimalType();
653            this.sphere.setValue(value);
654          return this;
655        }
656
657        /**
658         * @param value Lens power measured in diopters (0.25 units).
659         */
660        public VisionPrescriptionDispenseComponent setSphere(double value) { 
661              this.sphere = new DecimalType();
662            this.sphere.setValue(value);
663          return this;
664        }
665
666        /**
667         * @return {@link #cylinder} (Power adjustment for astigmatism measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getCylinder" gives direct access to the value
668         */
669        public DecimalType getCylinderElement() { 
670          if (this.cylinder == null)
671            if (Configuration.errorOnAutoCreate())
672              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.cylinder");
673            else if (Configuration.doAutoCreate())
674              this.cylinder = new DecimalType(); // bb
675          return this.cylinder;
676        }
677
678        public boolean hasCylinderElement() { 
679          return this.cylinder != null && !this.cylinder.isEmpty();
680        }
681
682        public boolean hasCylinder() { 
683          return this.cylinder != null && !this.cylinder.isEmpty();
684        }
685
686        /**
687         * @param value {@link #cylinder} (Power adjustment for astigmatism measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getCylinder" gives direct access to the value
688         */
689        public VisionPrescriptionDispenseComponent setCylinderElement(DecimalType value) { 
690          this.cylinder = value;
691          return this;
692        }
693
694        /**
695         * @return Power adjustment for astigmatism measured in diopters (0.25 units).
696         */
697        public BigDecimal getCylinder() { 
698          return this.cylinder == null ? null : this.cylinder.getValue();
699        }
700
701        /**
702         * @param value Power adjustment for astigmatism measured in diopters (0.25 units).
703         */
704        public VisionPrescriptionDispenseComponent setCylinder(BigDecimal value) { 
705          if (value == null)
706            this.cylinder = null;
707          else {
708            if (this.cylinder == null)
709              this.cylinder = new DecimalType();
710            this.cylinder.setValue(value);
711          }
712          return this;
713        }
714
715        /**
716         * @param value Power adjustment for astigmatism measured in diopters (0.25 units).
717         */
718        public VisionPrescriptionDispenseComponent setCylinder(long value) { 
719              this.cylinder = new DecimalType();
720            this.cylinder.setValue(value);
721          return this;
722        }
723
724        /**
725         * @param value Power adjustment for astigmatism measured in diopters (0.25 units).
726         */
727        public VisionPrescriptionDispenseComponent setCylinder(double value) { 
728              this.cylinder = new DecimalType();
729            this.cylinder.setValue(value);
730          return this;
731        }
732
733        /**
734         * @return {@link #axis} (Adjustment for astigmatism measured in integer degrees.). This is the underlying object with id, value and extensions. The accessor "getAxis" gives direct access to the value
735         */
736        public IntegerType getAxisElement() { 
737          if (this.axis == null)
738            if (Configuration.errorOnAutoCreate())
739              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.axis");
740            else if (Configuration.doAutoCreate())
741              this.axis = new IntegerType(); // bb
742          return this.axis;
743        }
744
745        public boolean hasAxisElement() { 
746          return this.axis != null && !this.axis.isEmpty();
747        }
748
749        public boolean hasAxis() { 
750          return this.axis != null && !this.axis.isEmpty();
751        }
752
753        /**
754         * @param value {@link #axis} (Adjustment for astigmatism measured in integer degrees.). This is the underlying object with id, value and extensions. The accessor "getAxis" gives direct access to the value
755         */
756        public VisionPrescriptionDispenseComponent setAxisElement(IntegerType value) { 
757          this.axis = value;
758          return this;
759        }
760
761        /**
762         * @return Adjustment for astigmatism measured in integer degrees.
763         */
764        public int getAxis() { 
765          return this.axis == null || this.axis.isEmpty() ? 0 : this.axis.getValue();
766        }
767
768        /**
769         * @param value Adjustment for astigmatism measured in integer degrees.
770         */
771        public VisionPrescriptionDispenseComponent setAxis(int value) { 
772            if (this.axis == null)
773              this.axis = new IntegerType();
774            this.axis.setValue(value);
775          return this;
776        }
777
778        /**
779         * @return {@link #prism} (Amount of prism to compensate for eye alignment in fractional units.). This is the underlying object with id, value and extensions. The accessor "getPrism" gives direct access to the value
780         */
781        public DecimalType getPrismElement() { 
782          if (this.prism == null)
783            if (Configuration.errorOnAutoCreate())
784              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.prism");
785            else if (Configuration.doAutoCreate())
786              this.prism = new DecimalType(); // bb
787          return this.prism;
788        }
789
790        public boolean hasPrismElement() { 
791          return this.prism != null && !this.prism.isEmpty();
792        }
793
794        public boolean hasPrism() { 
795          return this.prism != null && !this.prism.isEmpty();
796        }
797
798        /**
799         * @param value {@link #prism} (Amount of prism to compensate for eye alignment in fractional units.). This is the underlying object with id, value and extensions. The accessor "getPrism" gives direct access to the value
800         */
801        public VisionPrescriptionDispenseComponent setPrismElement(DecimalType value) { 
802          this.prism = value;
803          return this;
804        }
805
806        /**
807         * @return Amount of prism to compensate for eye alignment in fractional units.
808         */
809        public BigDecimal getPrism() { 
810          return this.prism == null ? null : this.prism.getValue();
811        }
812
813        /**
814         * @param value Amount of prism to compensate for eye alignment in fractional units.
815         */
816        public VisionPrescriptionDispenseComponent setPrism(BigDecimal value) { 
817          if (value == null)
818            this.prism = null;
819          else {
820            if (this.prism == null)
821              this.prism = new DecimalType();
822            this.prism.setValue(value);
823          }
824          return this;
825        }
826
827        /**
828         * @param value Amount of prism to compensate for eye alignment in fractional units.
829         */
830        public VisionPrescriptionDispenseComponent setPrism(long value) { 
831              this.prism = new DecimalType();
832            this.prism.setValue(value);
833          return this;
834        }
835
836        /**
837         * @param value Amount of prism to compensate for eye alignment in fractional units.
838         */
839        public VisionPrescriptionDispenseComponent setPrism(double value) { 
840              this.prism = new DecimalType();
841            this.prism.setValue(value);
842          return this;
843        }
844
845        /**
846         * @return {@link #base} (The relative base, or reference lens edge, for the prism.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
847         */
848        public Enumeration<VisionBase> getBaseElement() { 
849          if (this.base == null)
850            if (Configuration.errorOnAutoCreate())
851              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.base");
852            else if (Configuration.doAutoCreate())
853              this.base = new Enumeration<VisionBase>(new VisionBaseEnumFactory()); // bb
854          return this.base;
855        }
856
857        public boolean hasBaseElement() { 
858          return this.base != null && !this.base.isEmpty();
859        }
860
861        public boolean hasBase() { 
862          return this.base != null && !this.base.isEmpty();
863        }
864
865        /**
866         * @param value {@link #base} (The relative base, or reference lens edge, for the prism.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
867         */
868        public VisionPrescriptionDispenseComponent setBaseElement(Enumeration<VisionBase> value) { 
869          this.base = value;
870          return this;
871        }
872
873        /**
874         * @return The relative base, or reference lens edge, for the prism.
875         */
876        public VisionBase getBase() { 
877          return this.base == null ? null : this.base.getValue();
878        }
879
880        /**
881         * @param value The relative base, or reference lens edge, for the prism.
882         */
883        public VisionPrescriptionDispenseComponent setBase(VisionBase value) { 
884          if (value == null)
885            this.base = null;
886          else {
887            if (this.base == null)
888              this.base = new Enumeration<VisionBase>(new VisionBaseEnumFactory());
889            this.base.setValue(value);
890          }
891          return this;
892        }
893
894        /**
895         * @return {@link #add} (Power adjustment for multifocal lenses measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getAdd" gives direct access to the value
896         */
897        public DecimalType getAddElement() { 
898          if (this.add == null)
899            if (Configuration.errorOnAutoCreate())
900              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.add");
901            else if (Configuration.doAutoCreate())
902              this.add = new DecimalType(); // bb
903          return this.add;
904        }
905
906        public boolean hasAddElement() { 
907          return this.add != null && !this.add.isEmpty();
908        }
909
910        public boolean hasAdd() { 
911          return this.add != null && !this.add.isEmpty();
912        }
913
914        /**
915         * @param value {@link #add} (Power adjustment for multifocal lenses measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getAdd" gives direct access to the value
916         */
917        public VisionPrescriptionDispenseComponent setAddElement(DecimalType value) { 
918          this.add = value;
919          return this;
920        }
921
922        /**
923         * @return Power adjustment for multifocal lenses measured in diopters (0.25 units).
924         */
925        public BigDecimal getAdd() { 
926          return this.add == null ? null : this.add.getValue();
927        }
928
929        /**
930         * @param value Power adjustment for multifocal lenses measured in diopters (0.25 units).
931         */
932        public VisionPrescriptionDispenseComponent setAdd(BigDecimal value) { 
933          if (value == null)
934            this.add = null;
935          else {
936            if (this.add == null)
937              this.add = new DecimalType();
938            this.add.setValue(value);
939          }
940          return this;
941        }
942
943        /**
944         * @param value Power adjustment for multifocal lenses measured in diopters (0.25 units).
945         */
946        public VisionPrescriptionDispenseComponent setAdd(long value) { 
947              this.add = new DecimalType();
948            this.add.setValue(value);
949          return this;
950        }
951
952        /**
953         * @param value Power adjustment for multifocal lenses measured in diopters (0.25 units).
954         */
955        public VisionPrescriptionDispenseComponent setAdd(double value) { 
956              this.add = new DecimalType();
957            this.add.setValue(value);
958          return this;
959        }
960
961        /**
962         * @return {@link #power} (Contact lens power measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getPower" gives direct access to the value
963         */
964        public DecimalType getPowerElement() { 
965          if (this.power == null)
966            if (Configuration.errorOnAutoCreate())
967              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.power");
968            else if (Configuration.doAutoCreate())
969              this.power = new DecimalType(); // bb
970          return this.power;
971        }
972
973        public boolean hasPowerElement() { 
974          return this.power != null && !this.power.isEmpty();
975        }
976
977        public boolean hasPower() { 
978          return this.power != null && !this.power.isEmpty();
979        }
980
981        /**
982         * @param value {@link #power} (Contact lens power measured in diopters (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getPower" gives direct access to the value
983         */
984        public VisionPrescriptionDispenseComponent setPowerElement(DecimalType value) { 
985          this.power = value;
986          return this;
987        }
988
989        /**
990         * @return Contact lens power measured in diopters (0.25 units).
991         */
992        public BigDecimal getPower() { 
993          return this.power == null ? null : this.power.getValue();
994        }
995
996        /**
997         * @param value Contact lens power measured in diopters (0.25 units).
998         */
999        public VisionPrescriptionDispenseComponent setPower(BigDecimal value) { 
1000          if (value == null)
1001            this.power = null;
1002          else {
1003            if (this.power == null)
1004              this.power = new DecimalType();
1005            this.power.setValue(value);
1006          }
1007          return this;
1008        }
1009
1010        /**
1011         * @param value Contact lens power measured in diopters (0.25 units).
1012         */
1013        public VisionPrescriptionDispenseComponent setPower(long value) { 
1014              this.power = new DecimalType();
1015            this.power.setValue(value);
1016          return this;
1017        }
1018
1019        /**
1020         * @param value Contact lens power measured in diopters (0.25 units).
1021         */
1022        public VisionPrescriptionDispenseComponent setPower(double value) { 
1023              this.power = new DecimalType();
1024            this.power.setValue(value);
1025          return this;
1026        }
1027
1028        /**
1029         * @return {@link #backCurve} (Back curvature measured in millimeters.). This is the underlying object with id, value and extensions. The accessor "getBackCurve" gives direct access to the value
1030         */
1031        public DecimalType getBackCurveElement() { 
1032          if (this.backCurve == null)
1033            if (Configuration.errorOnAutoCreate())
1034              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.backCurve");
1035            else if (Configuration.doAutoCreate())
1036              this.backCurve = new DecimalType(); // bb
1037          return this.backCurve;
1038        }
1039
1040        public boolean hasBackCurveElement() { 
1041          return this.backCurve != null && !this.backCurve.isEmpty();
1042        }
1043
1044        public boolean hasBackCurve() { 
1045          return this.backCurve != null && !this.backCurve.isEmpty();
1046        }
1047
1048        /**
1049         * @param value {@link #backCurve} (Back curvature measured in millimeters.). This is the underlying object with id, value and extensions. The accessor "getBackCurve" gives direct access to the value
1050         */
1051        public VisionPrescriptionDispenseComponent setBackCurveElement(DecimalType value) { 
1052          this.backCurve = value;
1053          return this;
1054        }
1055
1056        /**
1057         * @return Back curvature measured in millimeters.
1058         */
1059        public BigDecimal getBackCurve() { 
1060          return this.backCurve == null ? null : this.backCurve.getValue();
1061        }
1062
1063        /**
1064         * @param value Back curvature measured in millimeters.
1065         */
1066        public VisionPrescriptionDispenseComponent setBackCurve(BigDecimal value) { 
1067          if (value == null)
1068            this.backCurve = null;
1069          else {
1070            if (this.backCurve == null)
1071              this.backCurve = new DecimalType();
1072            this.backCurve.setValue(value);
1073          }
1074          return this;
1075        }
1076
1077        /**
1078         * @param value Back curvature measured in millimeters.
1079         */
1080        public VisionPrescriptionDispenseComponent setBackCurve(long value) { 
1081              this.backCurve = new DecimalType();
1082            this.backCurve.setValue(value);
1083          return this;
1084        }
1085
1086        /**
1087         * @param value Back curvature measured in millimeters.
1088         */
1089        public VisionPrescriptionDispenseComponent setBackCurve(double value) { 
1090              this.backCurve = new DecimalType();
1091            this.backCurve.setValue(value);
1092          return this;
1093        }
1094
1095        /**
1096         * @return {@link #diameter} (Contact lens diameter measured in millimeters.). This is the underlying object with id, value and extensions. The accessor "getDiameter" gives direct access to the value
1097         */
1098        public DecimalType getDiameterElement() { 
1099          if (this.diameter == null)
1100            if (Configuration.errorOnAutoCreate())
1101              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.diameter");
1102            else if (Configuration.doAutoCreate())
1103              this.diameter = new DecimalType(); // bb
1104          return this.diameter;
1105        }
1106
1107        public boolean hasDiameterElement() { 
1108          return this.diameter != null && !this.diameter.isEmpty();
1109        }
1110
1111        public boolean hasDiameter() { 
1112          return this.diameter != null && !this.diameter.isEmpty();
1113        }
1114
1115        /**
1116         * @param value {@link #diameter} (Contact lens diameter measured in millimeters.). This is the underlying object with id, value and extensions. The accessor "getDiameter" gives direct access to the value
1117         */
1118        public VisionPrescriptionDispenseComponent setDiameterElement(DecimalType value) { 
1119          this.diameter = value;
1120          return this;
1121        }
1122
1123        /**
1124         * @return Contact lens diameter measured in millimeters.
1125         */
1126        public BigDecimal getDiameter() { 
1127          return this.diameter == null ? null : this.diameter.getValue();
1128        }
1129
1130        /**
1131         * @param value Contact lens diameter measured in millimeters.
1132         */
1133        public VisionPrescriptionDispenseComponent setDiameter(BigDecimal value) { 
1134          if (value == null)
1135            this.diameter = null;
1136          else {
1137            if (this.diameter == null)
1138              this.diameter = new DecimalType();
1139            this.diameter.setValue(value);
1140          }
1141          return this;
1142        }
1143
1144        /**
1145         * @param value Contact lens diameter measured in millimeters.
1146         */
1147        public VisionPrescriptionDispenseComponent setDiameter(long value) { 
1148              this.diameter = new DecimalType();
1149            this.diameter.setValue(value);
1150          return this;
1151        }
1152
1153        /**
1154         * @param value Contact lens diameter measured in millimeters.
1155         */
1156        public VisionPrescriptionDispenseComponent setDiameter(double value) { 
1157              this.diameter = new DecimalType();
1158            this.diameter.setValue(value);
1159          return this;
1160        }
1161
1162        /**
1163         * @return {@link #duration} (The recommended maximum wear period for the lens.)
1164         */
1165        public SimpleQuantity getDuration() { 
1166          if (this.duration == null)
1167            if (Configuration.errorOnAutoCreate())
1168              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.duration");
1169            else if (Configuration.doAutoCreate())
1170              this.duration = new SimpleQuantity(); // cc
1171          return this.duration;
1172        }
1173
1174        public boolean hasDuration() { 
1175          return this.duration != null && !this.duration.isEmpty();
1176        }
1177
1178        /**
1179         * @param value {@link #duration} (The recommended maximum wear period for the lens.)
1180         */
1181        public VisionPrescriptionDispenseComponent setDuration(SimpleQuantity value)  { 
1182          this.duration = value;
1183          return this;
1184        }
1185
1186        /**
1187         * @return {@link #color} (Special color or pattern.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value
1188         */
1189        public StringType getColorElement() { 
1190          if (this.color == null)
1191            if (Configuration.errorOnAutoCreate())
1192              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.color");
1193            else if (Configuration.doAutoCreate())
1194              this.color = new StringType(); // bb
1195          return this.color;
1196        }
1197
1198        public boolean hasColorElement() { 
1199          return this.color != null && !this.color.isEmpty();
1200        }
1201
1202        public boolean hasColor() { 
1203          return this.color != null && !this.color.isEmpty();
1204        }
1205
1206        /**
1207         * @param value {@link #color} (Special color or pattern.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value
1208         */
1209        public VisionPrescriptionDispenseComponent setColorElement(StringType value) { 
1210          this.color = value;
1211          return this;
1212        }
1213
1214        /**
1215         * @return Special color or pattern.
1216         */
1217        public String getColor() { 
1218          return this.color == null ? null : this.color.getValue();
1219        }
1220
1221        /**
1222         * @param value Special color or pattern.
1223         */
1224        public VisionPrescriptionDispenseComponent setColor(String value) { 
1225          if (Utilities.noString(value))
1226            this.color = null;
1227          else {
1228            if (this.color == null)
1229              this.color = new StringType();
1230            this.color.setValue(value);
1231          }
1232          return this;
1233        }
1234
1235        /**
1236         * @return {@link #brand} (Brand recommendations or restrictions.). This is the underlying object with id, value and extensions. The accessor "getBrand" gives direct access to the value
1237         */
1238        public StringType getBrandElement() { 
1239          if (this.brand == null)
1240            if (Configuration.errorOnAutoCreate())
1241              throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.brand");
1242            else if (Configuration.doAutoCreate())
1243              this.brand = new StringType(); // bb
1244          return this.brand;
1245        }
1246
1247        public boolean hasBrandElement() { 
1248          return this.brand != null && !this.brand.isEmpty();
1249        }
1250
1251        public boolean hasBrand() { 
1252          return this.brand != null && !this.brand.isEmpty();
1253        }
1254
1255        /**
1256         * @param value {@link #brand} (Brand recommendations or restrictions.). This is the underlying object with id, value and extensions. The accessor "getBrand" gives direct access to the value
1257         */
1258        public VisionPrescriptionDispenseComponent setBrandElement(StringType value) { 
1259          this.brand = value;
1260          return this;
1261        }
1262
1263        /**
1264         * @return Brand recommendations or restrictions.
1265         */
1266        public String getBrand() { 
1267          return this.brand == null ? null : this.brand.getValue();
1268        }
1269
1270        /**
1271         * @param value Brand recommendations or restrictions.
1272         */
1273        public VisionPrescriptionDispenseComponent setBrand(String value) { 
1274          if (Utilities.noString(value))
1275            this.brand = null;
1276          else {
1277            if (this.brand == null)
1278              this.brand = new StringType();
1279            this.brand.setValue(value);
1280          }
1281          return this;
1282        }
1283
1284        /**
1285         * @return {@link #note} (Notes for special requirements such as coatings and lens materials.)
1286         */
1287        public List<Annotation> getNote() { 
1288          if (this.note == null)
1289            this.note = new ArrayList<Annotation>();
1290          return this.note;
1291        }
1292
1293        /**
1294         * @return Returns a reference to <code>this</code> for easy method chaining
1295         */
1296        public VisionPrescriptionDispenseComponent setNote(List<Annotation> theNote) { 
1297          this.note = theNote;
1298          return this;
1299        }
1300
1301        public boolean hasNote() { 
1302          if (this.note == null)
1303            return false;
1304          for (Annotation item : this.note)
1305            if (!item.isEmpty())
1306              return true;
1307          return false;
1308        }
1309
1310        public Annotation addNote() { //3
1311          Annotation t = new Annotation();
1312          if (this.note == null)
1313            this.note = new ArrayList<Annotation>();
1314          this.note.add(t);
1315          return t;
1316        }
1317
1318        public VisionPrescriptionDispenseComponent addNote(Annotation t) { //3
1319          if (t == null)
1320            return this;
1321          if (this.note == null)
1322            this.note = new ArrayList<Annotation>();
1323          this.note.add(t);
1324          return this;
1325        }
1326
1327        /**
1328         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1329         */
1330        public Annotation getNoteFirstRep() { 
1331          if (getNote().isEmpty()) {
1332            addNote();
1333          }
1334          return getNote().get(0);
1335        }
1336
1337        protected void listChildren(List<Property> children) {
1338          super.listChildren(children);
1339          children.add(new Property("product", "CodeableConcept", "Identifies the type of vision correction product which is required for the patient.", 0, 1, product));
1340          children.add(new Property("eye", "code", "The eye for which the lens applies.", 0, 1, eye));
1341          children.add(new Property("sphere", "decimal", "Lens power measured in diopters (0.25 units).", 0, 1, sphere));
1342          children.add(new Property("cylinder", "decimal", "Power adjustment for astigmatism measured in diopters (0.25 units).", 0, 1, cylinder));
1343          children.add(new Property("axis", "integer", "Adjustment for astigmatism measured in integer degrees.", 0, 1, axis));
1344          children.add(new Property("prism", "decimal", "Amount of prism to compensate for eye alignment in fractional units.", 0, 1, prism));
1345          children.add(new Property("base", "code", "The relative base, or reference lens edge, for the prism.", 0, 1, base));
1346          children.add(new Property("add", "decimal", "Power adjustment for multifocal lenses measured in diopters (0.25 units).", 0, 1, add));
1347          children.add(new Property("power", "decimal", "Contact lens power measured in diopters (0.25 units).", 0, 1, power));
1348          children.add(new Property("backCurve", "decimal", "Back curvature measured in millimeters.", 0, 1, backCurve));
1349          children.add(new Property("diameter", "decimal", "Contact lens diameter measured in millimeters.", 0, 1, diameter));
1350          children.add(new Property("duration", "SimpleQuantity", "The recommended maximum wear period for the lens.", 0, 1, duration));
1351          children.add(new Property("color", "string", "Special color or pattern.", 0, 1, color));
1352          children.add(new Property("brand", "string", "Brand recommendations or restrictions.", 0, 1, brand));
1353          children.add(new Property("note", "Annotation", "Notes for special requirements such as coatings and lens materials.", 0, java.lang.Integer.MAX_VALUE, note));
1354        }
1355
1356        @Override
1357        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1358          switch (_hash) {
1359          case -309474065: /*product*/  return new Property("product", "CodeableConcept", "Identifies the type of vision correction product which is required for the patient.", 0, 1, product);
1360          case 100913: /*eye*/  return new Property("eye", "code", "The eye for which the lens applies.", 0, 1, eye);
1361          case -895981619: /*sphere*/  return new Property("sphere", "decimal", "Lens power measured in diopters (0.25 units).", 0, 1, sphere);
1362          case -349378602: /*cylinder*/  return new Property("cylinder", "decimal", "Power adjustment for astigmatism measured in diopters (0.25 units).", 0, 1, cylinder);
1363          case 3008417: /*axis*/  return new Property("axis", "integer", "Adjustment for astigmatism measured in integer degrees.", 0, 1, axis);
1364          case 106935105: /*prism*/  return new Property("prism", "decimal", "Amount of prism to compensate for eye alignment in fractional units.", 0, 1, prism);
1365          case 3016401: /*base*/  return new Property("base", "code", "The relative base, or reference lens edge, for the prism.", 0, 1, base);
1366          case 96417: /*add*/  return new Property("add", "decimal", "Power adjustment for multifocal lenses measured in diopters (0.25 units).", 0, 1, add);
1367          case 106858757: /*power*/  return new Property("power", "decimal", "Contact lens power measured in diopters (0.25 units).", 0, 1, power);
1368          case 1309344840: /*backCurve*/  return new Property("backCurve", "decimal", "Back curvature measured in millimeters.", 0, 1, backCurve);
1369          case -233204595: /*diameter*/  return new Property("diameter", "decimal", "Contact lens diameter measured in millimeters.", 0, 1, diameter);
1370          case -1992012396: /*duration*/  return new Property("duration", "SimpleQuantity", "The recommended maximum wear period for the lens.", 0, 1, duration);
1371          case 94842723: /*color*/  return new Property("color", "string", "Special color or pattern.", 0, 1, color);
1372          case 93997959: /*brand*/  return new Property("brand", "string", "Brand recommendations or restrictions.", 0, 1, brand);
1373          case 3387378: /*note*/  return new Property("note", "Annotation", "Notes for special requirements such as coatings and lens materials.", 0, java.lang.Integer.MAX_VALUE, note);
1374          default: return super.getNamedProperty(_hash, _name, _checkValid);
1375          }
1376
1377        }
1378
1379      @Override
1380      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1381        switch (hash) {
1382        case -309474065: /*product*/ return this.product == null ? new Base[0] : new Base[] {this.product}; // CodeableConcept
1383        case 100913: /*eye*/ return this.eye == null ? new Base[0] : new Base[] {this.eye}; // Enumeration<VisionEyes>
1384        case -895981619: /*sphere*/ return this.sphere == null ? new Base[0] : new Base[] {this.sphere}; // DecimalType
1385        case -349378602: /*cylinder*/ return this.cylinder == null ? new Base[0] : new Base[] {this.cylinder}; // DecimalType
1386        case 3008417: /*axis*/ return this.axis == null ? new Base[0] : new Base[] {this.axis}; // IntegerType
1387        case 106935105: /*prism*/ return this.prism == null ? new Base[0] : new Base[] {this.prism}; // DecimalType
1388        case 3016401: /*base*/ return this.base == null ? new Base[0] : new Base[] {this.base}; // Enumeration<VisionBase>
1389        case 96417: /*add*/ return this.add == null ? new Base[0] : new Base[] {this.add}; // DecimalType
1390        case 106858757: /*power*/ return this.power == null ? new Base[0] : new Base[] {this.power}; // DecimalType
1391        case 1309344840: /*backCurve*/ return this.backCurve == null ? new Base[0] : new Base[] {this.backCurve}; // DecimalType
1392        case -233204595: /*diameter*/ return this.diameter == null ? new Base[0] : new Base[] {this.diameter}; // DecimalType
1393        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // SimpleQuantity
1394        case 94842723: /*color*/ return this.color == null ? new Base[0] : new Base[] {this.color}; // StringType
1395        case 93997959: /*brand*/ return this.brand == null ? new Base[0] : new Base[] {this.brand}; // StringType
1396        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1397        default: return super.getProperty(hash, name, checkValid);
1398        }
1399
1400      }
1401
1402      @Override
1403      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1404        switch (hash) {
1405        case -309474065: // product
1406          this.product = castToCodeableConcept(value); // CodeableConcept
1407          return value;
1408        case 100913: // eye
1409          value = new VisionEyesEnumFactory().fromType(castToCode(value));
1410          this.eye = (Enumeration) value; // Enumeration<VisionEyes>
1411          return value;
1412        case -895981619: // sphere
1413          this.sphere = castToDecimal(value); // DecimalType
1414          return value;
1415        case -349378602: // cylinder
1416          this.cylinder = castToDecimal(value); // DecimalType
1417          return value;
1418        case 3008417: // axis
1419          this.axis = castToInteger(value); // IntegerType
1420          return value;
1421        case 106935105: // prism
1422          this.prism = castToDecimal(value); // DecimalType
1423          return value;
1424        case 3016401: // base
1425          value = new VisionBaseEnumFactory().fromType(castToCode(value));
1426          this.base = (Enumeration) value; // Enumeration<VisionBase>
1427          return value;
1428        case 96417: // add
1429          this.add = castToDecimal(value); // DecimalType
1430          return value;
1431        case 106858757: // power
1432          this.power = castToDecimal(value); // DecimalType
1433          return value;
1434        case 1309344840: // backCurve
1435          this.backCurve = castToDecimal(value); // DecimalType
1436          return value;
1437        case -233204595: // diameter
1438          this.diameter = castToDecimal(value); // DecimalType
1439          return value;
1440        case -1992012396: // duration
1441          this.duration = castToSimpleQuantity(value); // SimpleQuantity
1442          return value;
1443        case 94842723: // color
1444          this.color = castToString(value); // StringType
1445          return value;
1446        case 93997959: // brand
1447          this.brand = castToString(value); // StringType
1448          return value;
1449        case 3387378: // note
1450          this.getNote().add(castToAnnotation(value)); // Annotation
1451          return value;
1452        default: return super.setProperty(hash, name, value);
1453        }
1454
1455      }
1456
1457      @Override
1458      public Base setProperty(String name, Base value) throws FHIRException {
1459        if (name.equals("product")) {
1460          this.product = castToCodeableConcept(value); // CodeableConcept
1461        } else if (name.equals("eye")) {
1462          value = new VisionEyesEnumFactory().fromType(castToCode(value));
1463          this.eye = (Enumeration) value; // Enumeration<VisionEyes>
1464        } else if (name.equals("sphere")) {
1465          this.sphere = castToDecimal(value); // DecimalType
1466        } else if (name.equals("cylinder")) {
1467          this.cylinder = castToDecimal(value); // DecimalType
1468        } else if (name.equals("axis")) {
1469          this.axis = castToInteger(value); // IntegerType
1470        } else if (name.equals("prism")) {
1471          this.prism = castToDecimal(value); // DecimalType
1472        } else if (name.equals("base")) {
1473          value = new VisionBaseEnumFactory().fromType(castToCode(value));
1474          this.base = (Enumeration) value; // Enumeration<VisionBase>
1475        } else if (name.equals("add")) {
1476          this.add = castToDecimal(value); // DecimalType
1477        } else if (name.equals("power")) {
1478          this.power = castToDecimal(value); // DecimalType
1479        } else if (name.equals("backCurve")) {
1480          this.backCurve = castToDecimal(value); // DecimalType
1481        } else if (name.equals("diameter")) {
1482          this.diameter = castToDecimal(value); // DecimalType
1483        } else if (name.equals("duration")) {
1484          this.duration = castToSimpleQuantity(value); // SimpleQuantity
1485        } else if (name.equals("color")) {
1486          this.color = castToString(value); // StringType
1487        } else if (name.equals("brand")) {
1488          this.brand = castToString(value); // StringType
1489        } else if (name.equals("note")) {
1490          this.getNote().add(castToAnnotation(value));
1491        } else
1492          return super.setProperty(name, value);
1493        return value;
1494      }
1495
1496      @Override
1497      public Base makeProperty(int hash, String name) throws FHIRException {
1498        switch (hash) {
1499        case -309474065:  return getProduct(); 
1500        case 100913:  return getEyeElement();
1501        case -895981619:  return getSphereElement();
1502        case -349378602:  return getCylinderElement();
1503        case 3008417:  return getAxisElement();
1504        case 106935105:  return getPrismElement();
1505        case 3016401:  return getBaseElement();
1506        case 96417:  return getAddElement();
1507        case 106858757:  return getPowerElement();
1508        case 1309344840:  return getBackCurveElement();
1509        case -233204595:  return getDiameterElement();
1510        case -1992012396:  return getDuration(); 
1511        case 94842723:  return getColorElement();
1512        case 93997959:  return getBrandElement();
1513        case 3387378:  return addNote(); 
1514        default: return super.makeProperty(hash, name);
1515        }
1516
1517      }
1518
1519      @Override
1520      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1521        switch (hash) {
1522        case -309474065: /*product*/ return new String[] {"CodeableConcept"};
1523        case 100913: /*eye*/ return new String[] {"code"};
1524        case -895981619: /*sphere*/ return new String[] {"decimal"};
1525        case -349378602: /*cylinder*/ return new String[] {"decimal"};
1526        case 3008417: /*axis*/ return new String[] {"integer"};
1527        case 106935105: /*prism*/ return new String[] {"decimal"};
1528        case 3016401: /*base*/ return new String[] {"code"};
1529        case 96417: /*add*/ return new String[] {"decimal"};
1530        case 106858757: /*power*/ return new String[] {"decimal"};
1531        case 1309344840: /*backCurve*/ return new String[] {"decimal"};
1532        case -233204595: /*diameter*/ return new String[] {"decimal"};
1533        case -1992012396: /*duration*/ return new String[] {"SimpleQuantity"};
1534        case 94842723: /*color*/ return new String[] {"string"};
1535        case 93997959: /*brand*/ return new String[] {"string"};
1536        case 3387378: /*note*/ return new String[] {"Annotation"};
1537        default: return super.getTypesForProperty(hash, name);
1538        }
1539
1540      }
1541
1542      @Override
1543      public Base addChild(String name) throws FHIRException {
1544        if (name.equals("product")) {
1545          this.product = new CodeableConcept();
1546          return this.product;
1547        }
1548        else if (name.equals("eye")) {
1549          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.eye");
1550        }
1551        else if (name.equals("sphere")) {
1552          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.sphere");
1553        }
1554        else if (name.equals("cylinder")) {
1555          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.cylinder");
1556        }
1557        else if (name.equals("axis")) {
1558          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.axis");
1559        }
1560        else if (name.equals("prism")) {
1561          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.prism");
1562        }
1563        else if (name.equals("base")) {
1564          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.base");
1565        }
1566        else if (name.equals("add")) {
1567          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.add");
1568        }
1569        else if (name.equals("power")) {
1570          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.power");
1571        }
1572        else if (name.equals("backCurve")) {
1573          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.backCurve");
1574        }
1575        else if (name.equals("diameter")) {
1576          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.diameter");
1577        }
1578        else if (name.equals("duration")) {
1579          this.duration = new SimpleQuantity();
1580          return this.duration;
1581        }
1582        else if (name.equals("color")) {
1583          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.color");
1584        }
1585        else if (name.equals("brand")) {
1586          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.brand");
1587        }
1588        else if (name.equals("note")) {
1589          return addNote();
1590        }
1591        else
1592          return super.addChild(name);
1593      }
1594
1595      public VisionPrescriptionDispenseComponent copy() {
1596        VisionPrescriptionDispenseComponent dst = new VisionPrescriptionDispenseComponent();
1597        copyValues(dst);
1598        dst.product = product == null ? null : product.copy();
1599        dst.eye = eye == null ? null : eye.copy();
1600        dst.sphere = sphere == null ? null : sphere.copy();
1601        dst.cylinder = cylinder == null ? null : cylinder.copy();
1602        dst.axis = axis == null ? null : axis.copy();
1603        dst.prism = prism == null ? null : prism.copy();
1604        dst.base = base == null ? null : base.copy();
1605        dst.add = add == null ? null : add.copy();
1606        dst.power = power == null ? null : power.copy();
1607        dst.backCurve = backCurve == null ? null : backCurve.copy();
1608        dst.diameter = diameter == null ? null : diameter.copy();
1609        dst.duration = duration == null ? null : duration.copy();
1610        dst.color = color == null ? null : color.copy();
1611        dst.brand = brand == null ? null : brand.copy();
1612        if (note != null) {
1613          dst.note = new ArrayList<Annotation>();
1614          for (Annotation i : note)
1615            dst.note.add(i.copy());
1616        };
1617        return dst;
1618      }
1619
1620      @Override
1621      public boolean equalsDeep(Base other_) {
1622        if (!super.equalsDeep(other_))
1623          return false;
1624        if (!(other_ instanceof VisionPrescriptionDispenseComponent))
1625          return false;
1626        VisionPrescriptionDispenseComponent o = (VisionPrescriptionDispenseComponent) other_;
1627        return compareDeep(product, o.product, true) && compareDeep(eye, o.eye, true) && compareDeep(sphere, o.sphere, true)
1628           && compareDeep(cylinder, o.cylinder, true) && compareDeep(axis, o.axis, true) && compareDeep(prism, o.prism, true)
1629           && compareDeep(base, o.base, true) && compareDeep(add, o.add, true) && compareDeep(power, o.power, true)
1630           && compareDeep(backCurve, o.backCurve, true) && compareDeep(diameter, o.diameter, true) && compareDeep(duration, o.duration, true)
1631           && compareDeep(color, o.color, true) && compareDeep(brand, o.brand, true) && compareDeep(note, o.note, true)
1632          ;
1633      }
1634
1635      @Override
1636      public boolean equalsShallow(Base other_) {
1637        if (!super.equalsShallow(other_))
1638          return false;
1639        if (!(other_ instanceof VisionPrescriptionDispenseComponent))
1640          return false;
1641        VisionPrescriptionDispenseComponent o = (VisionPrescriptionDispenseComponent) other_;
1642        return compareValues(eye, o.eye, true) && compareValues(sphere, o.sphere, true) && compareValues(cylinder, o.cylinder, true)
1643           && compareValues(axis, o.axis, true) && compareValues(prism, o.prism, true) && compareValues(base, o.base, true)
1644           && compareValues(add, o.add, true) && compareValues(power, o.power, true) && compareValues(backCurve, o.backCurve, true)
1645           && compareValues(diameter, o.diameter, true) && compareValues(color, o.color, true) && compareValues(brand, o.brand, true)
1646          ;
1647      }
1648
1649      public boolean isEmpty() {
1650        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(product, eye, sphere, cylinder
1651          , axis, prism, base, add, power, backCurve, diameter, duration, color, brand
1652          , note);
1653      }
1654
1655  public String fhirType() {
1656    return "VisionPrescription.dispense";
1657
1658  }
1659
1660  }
1661
1662    /**
1663     * Business identifier which may be used by other parties to reference or identify the prescription.
1664     */
1665    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1666    @Description(shortDefinition="Business identifier", formalDefinition="Business identifier which may be used by other parties to reference or identify the prescription." )
1667    protected List<Identifier> identifier;
1668
1669    /**
1670     * The status of the resource instance.
1671     */
1672    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1673    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
1674    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
1675    protected Enumeration<VisionStatus> status;
1676
1677    /**
1678     * A link to a resource representing the person to whom the vision products will be supplied.
1679     */
1680    @Child(name = "patient", type = {Patient.class}, order=2, min=0, max=1, modifier=false, summary=false)
1681    @Description(shortDefinition="Who prescription is for", formalDefinition="A link to a resource representing the person to whom the vision products will be supplied." )
1682    protected Reference patient;
1683
1684    /**
1685     * The actual object that is the target of the reference (A link to a resource representing the person to whom the vision products will be supplied.)
1686     */
1687    protected Patient patientTarget;
1688
1689    /**
1690     * A link to a resource that identifies the particular occurrence of contact between patient and health care provider.
1691     */
1692    @Child(name = "encounter", type = {Encounter.class}, order=3, min=0, max=1, modifier=false, summary=false)
1693    @Description(shortDefinition="Created during encounter / admission / stay", formalDefinition="A link to a resource that identifies the particular occurrence of contact between patient and health care provider." )
1694    protected Reference encounter;
1695
1696    /**
1697     * The actual object that is the target of the reference (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.)
1698     */
1699    protected Encounter encounterTarget;
1700
1701    /**
1702     * The date (and perhaps time) when the prescription was written.
1703     */
1704    @Child(name = "dateWritten", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1705    @Description(shortDefinition="When prescription was authorized", formalDefinition="The date (and perhaps time) when the prescription was written." )
1706    protected DateTimeType dateWritten;
1707
1708    /**
1709     * The healthcare professional responsible for authorizing the prescription.
1710     */
1711    @Child(name = "prescriber", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=false)
1712    @Description(shortDefinition="Who authorizes the vision product", formalDefinition="The healthcare professional responsible for authorizing the prescription." )
1713    protected Reference prescriber;
1714
1715    /**
1716     * The actual object that is the target of the reference (The healthcare professional responsible for authorizing the prescription.)
1717     */
1718    protected Practitioner prescriberTarget;
1719
1720    /**
1721     * Can be the reason or the indication for writing the prescription.
1722     */
1723    @Child(name = "reason", type = {CodeableConcept.class, Condition.class}, order=6, min=0, max=1, modifier=false, summary=false)
1724    @Description(shortDefinition="Reason or indication for writing the prescription", formalDefinition="Can be the reason or the indication for writing the prescription." )
1725    protected Type reason;
1726
1727    /**
1728     * Deals with details of the dispense part of the supply specification.
1729     */
1730    @Child(name = "dispense", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1731    @Description(shortDefinition="Vision supply authorization", formalDefinition="Deals with details of the dispense part of the supply specification." )
1732    protected List<VisionPrescriptionDispenseComponent> dispense;
1733
1734    private static final long serialVersionUID = 603347490L;
1735
1736  /**
1737   * Constructor
1738   */
1739    public VisionPrescription() {
1740      super();
1741    }
1742
1743    /**
1744     * @return {@link #identifier} (Business identifier which may be used by other parties to reference or identify the prescription.)
1745     */
1746    public List<Identifier> getIdentifier() { 
1747      if (this.identifier == null)
1748        this.identifier = new ArrayList<Identifier>();
1749      return this.identifier;
1750    }
1751
1752    /**
1753     * @return Returns a reference to <code>this</code> for easy method chaining
1754     */
1755    public VisionPrescription setIdentifier(List<Identifier> theIdentifier) { 
1756      this.identifier = theIdentifier;
1757      return this;
1758    }
1759
1760    public boolean hasIdentifier() { 
1761      if (this.identifier == null)
1762        return false;
1763      for (Identifier item : this.identifier)
1764        if (!item.isEmpty())
1765          return true;
1766      return false;
1767    }
1768
1769    public Identifier addIdentifier() { //3
1770      Identifier t = new Identifier();
1771      if (this.identifier == null)
1772        this.identifier = new ArrayList<Identifier>();
1773      this.identifier.add(t);
1774      return t;
1775    }
1776
1777    public VisionPrescription addIdentifier(Identifier t) { //3
1778      if (t == null)
1779        return this;
1780      if (this.identifier == null)
1781        this.identifier = new ArrayList<Identifier>();
1782      this.identifier.add(t);
1783      return this;
1784    }
1785
1786    /**
1787     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1788     */
1789    public Identifier getIdentifierFirstRep() { 
1790      if (getIdentifier().isEmpty()) {
1791        addIdentifier();
1792      }
1793      return getIdentifier().get(0);
1794    }
1795
1796    /**
1797     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1798     */
1799    public Enumeration<VisionStatus> getStatusElement() { 
1800      if (this.status == null)
1801        if (Configuration.errorOnAutoCreate())
1802          throw new Error("Attempt to auto-create VisionPrescription.status");
1803        else if (Configuration.doAutoCreate())
1804          this.status = new Enumeration<VisionStatus>(new VisionStatusEnumFactory()); // bb
1805      return this.status;
1806    }
1807
1808    public boolean hasStatusElement() { 
1809      return this.status != null && !this.status.isEmpty();
1810    }
1811
1812    public boolean hasStatus() { 
1813      return this.status != null && !this.status.isEmpty();
1814    }
1815
1816    /**
1817     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1818     */
1819    public VisionPrescription setStatusElement(Enumeration<VisionStatus> value) { 
1820      this.status = value;
1821      return this;
1822    }
1823
1824    /**
1825     * @return The status of the resource instance.
1826     */
1827    public VisionStatus getStatus() { 
1828      return this.status == null ? null : this.status.getValue();
1829    }
1830
1831    /**
1832     * @param value The status of the resource instance.
1833     */
1834    public VisionPrescription setStatus(VisionStatus value) { 
1835      if (value == null)
1836        this.status = null;
1837      else {
1838        if (this.status == null)
1839          this.status = new Enumeration<VisionStatus>(new VisionStatusEnumFactory());
1840        this.status.setValue(value);
1841      }
1842      return this;
1843    }
1844
1845    /**
1846     * @return {@link #patient} (A link to a resource representing the person to whom the vision products will be supplied.)
1847     */
1848    public Reference getPatient() { 
1849      if (this.patient == null)
1850        if (Configuration.errorOnAutoCreate())
1851          throw new Error("Attempt to auto-create VisionPrescription.patient");
1852        else if (Configuration.doAutoCreate())
1853          this.patient = new Reference(); // cc
1854      return this.patient;
1855    }
1856
1857    public boolean hasPatient() { 
1858      return this.patient != null && !this.patient.isEmpty();
1859    }
1860
1861    /**
1862     * @param value {@link #patient} (A link to a resource representing the person to whom the vision products will be supplied.)
1863     */
1864    public VisionPrescription setPatient(Reference value)  { 
1865      this.patient = value;
1866      return this;
1867    }
1868
1869    /**
1870     * @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. (A link to a resource representing the person to whom the vision products will be supplied.)
1871     */
1872    public Patient getPatientTarget() { 
1873      if (this.patientTarget == null)
1874        if (Configuration.errorOnAutoCreate())
1875          throw new Error("Attempt to auto-create VisionPrescription.patient");
1876        else if (Configuration.doAutoCreate())
1877          this.patientTarget = new Patient(); // aa
1878      return this.patientTarget;
1879    }
1880
1881    /**
1882     * @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. (A link to a resource representing the person to whom the vision products will be supplied.)
1883     */
1884    public VisionPrescription setPatientTarget(Patient value) { 
1885      this.patientTarget = value;
1886      return this;
1887    }
1888
1889    /**
1890     * @return {@link #encounter} (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.)
1891     */
1892    public Reference getEncounter() { 
1893      if (this.encounter == null)
1894        if (Configuration.errorOnAutoCreate())
1895          throw new Error("Attempt to auto-create VisionPrescription.encounter");
1896        else if (Configuration.doAutoCreate())
1897          this.encounter = new Reference(); // cc
1898      return this.encounter;
1899    }
1900
1901    public boolean hasEncounter() { 
1902      return this.encounter != null && !this.encounter.isEmpty();
1903    }
1904
1905    /**
1906     * @param value {@link #encounter} (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.)
1907     */
1908    public VisionPrescription setEncounter(Reference value)  { 
1909      this.encounter = value;
1910      return this;
1911    }
1912
1913    /**
1914     * @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. (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.)
1915     */
1916    public Encounter getEncounterTarget() { 
1917      if (this.encounterTarget == null)
1918        if (Configuration.errorOnAutoCreate())
1919          throw new Error("Attempt to auto-create VisionPrescription.encounter");
1920        else if (Configuration.doAutoCreate())
1921          this.encounterTarget = new Encounter(); // aa
1922      return this.encounterTarget;
1923    }
1924
1925    /**
1926     * @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. (A link to a resource that identifies the particular occurrence of contact between patient and health care provider.)
1927     */
1928    public VisionPrescription setEncounterTarget(Encounter value) { 
1929      this.encounterTarget = value;
1930      return this;
1931    }
1932
1933    /**
1934     * @return {@link #dateWritten} (The date (and perhaps time) when the prescription was written.). This is the underlying object with id, value and extensions. The accessor "getDateWritten" gives direct access to the value
1935     */
1936    public DateTimeType getDateWrittenElement() { 
1937      if (this.dateWritten == null)
1938        if (Configuration.errorOnAutoCreate())
1939          throw new Error("Attempt to auto-create VisionPrescription.dateWritten");
1940        else if (Configuration.doAutoCreate())
1941          this.dateWritten = new DateTimeType(); // bb
1942      return this.dateWritten;
1943    }
1944
1945    public boolean hasDateWrittenElement() { 
1946      return this.dateWritten != null && !this.dateWritten.isEmpty();
1947    }
1948
1949    public boolean hasDateWritten() { 
1950      return this.dateWritten != null && !this.dateWritten.isEmpty();
1951    }
1952
1953    /**
1954     * @param value {@link #dateWritten} (The date (and perhaps time) when the prescription was written.). This is the underlying object with id, value and extensions. The accessor "getDateWritten" gives direct access to the value
1955     */
1956    public VisionPrescription setDateWrittenElement(DateTimeType value) { 
1957      this.dateWritten = value;
1958      return this;
1959    }
1960
1961    /**
1962     * @return The date (and perhaps time) when the prescription was written.
1963     */
1964    public Date getDateWritten() { 
1965      return this.dateWritten == null ? null : this.dateWritten.getValue();
1966    }
1967
1968    /**
1969     * @param value The date (and perhaps time) when the prescription was written.
1970     */
1971    public VisionPrescription setDateWritten(Date value) { 
1972      if (value == null)
1973        this.dateWritten = null;
1974      else {
1975        if (this.dateWritten == null)
1976          this.dateWritten = new DateTimeType();
1977        this.dateWritten.setValue(value);
1978      }
1979      return this;
1980    }
1981
1982    /**
1983     * @return {@link #prescriber} (The healthcare professional responsible for authorizing the prescription.)
1984     */
1985    public Reference getPrescriber() { 
1986      if (this.prescriber == null)
1987        if (Configuration.errorOnAutoCreate())
1988          throw new Error("Attempt to auto-create VisionPrescription.prescriber");
1989        else if (Configuration.doAutoCreate())
1990          this.prescriber = new Reference(); // cc
1991      return this.prescriber;
1992    }
1993
1994    public boolean hasPrescriber() { 
1995      return this.prescriber != null && !this.prescriber.isEmpty();
1996    }
1997
1998    /**
1999     * @param value {@link #prescriber} (The healthcare professional responsible for authorizing the prescription.)
2000     */
2001    public VisionPrescription setPrescriber(Reference value)  { 
2002      this.prescriber = value;
2003      return this;
2004    }
2005
2006    /**
2007     * @return {@link #prescriber} 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 healthcare professional responsible for authorizing the prescription.)
2008     */
2009    public Practitioner getPrescriberTarget() { 
2010      if (this.prescriberTarget == null)
2011        if (Configuration.errorOnAutoCreate())
2012          throw new Error("Attempt to auto-create VisionPrescription.prescriber");
2013        else if (Configuration.doAutoCreate())
2014          this.prescriberTarget = new Practitioner(); // aa
2015      return this.prescriberTarget;
2016    }
2017
2018    /**
2019     * @param value {@link #prescriber} 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 healthcare professional responsible for authorizing the prescription.)
2020     */
2021    public VisionPrescription setPrescriberTarget(Practitioner value) { 
2022      this.prescriberTarget = value;
2023      return this;
2024    }
2025
2026    /**
2027     * @return {@link #reason} (Can be the reason or the indication for writing the prescription.)
2028     */
2029    public Type getReason() { 
2030      return this.reason;
2031    }
2032
2033    /**
2034     * @return {@link #reason} (Can be the reason or the indication for writing the prescription.)
2035     */
2036    public CodeableConcept getReasonCodeableConcept() throws FHIRException { 
2037      if (this.reason == null)
2038        return null;
2039      if (!(this.reason instanceof CodeableConcept))
2040        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered");
2041      return (CodeableConcept) this.reason;
2042    }
2043
2044    public boolean hasReasonCodeableConcept() { 
2045      return this != null && this.reason instanceof CodeableConcept;
2046    }
2047
2048    /**
2049     * @return {@link #reason} (Can be the reason or the indication for writing the prescription.)
2050     */
2051    public Reference getReasonReference() throws FHIRException { 
2052      if (this.reason == null)
2053        return null;
2054      if (!(this.reason instanceof Reference))
2055        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered");
2056      return (Reference) this.reason;
2057    }
2058
2059    public boolean hasReasonReference() { 
2060      return this != null && this.reason instanceof Reference;
2061    }
2062
2063    public boolean hasReason() { 
2064      return this.reason != null && !this.reason.isEmpty();
2065    }
2066
2067    /**
2068     * @param value {@link #reason} (Can be the reason or the indication for writing the prescription.)
2069     */
2070    public VisionPrescription setReason(Type value) throws FHIRFormatError { 
2071      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2072        throw new FHIRFormatError("Not the right type for VisionPrescription.reason[x]: "+value.fhirType());
2073      this.reason = value;
2074      return this;
2075    }
2076
2077    /**
2078     * @return {@link #dispense} (Deals with details of the dispense part of the supply specification.)
2079     */
2080    public List<VisionPrescriptionDispenseComponent> getDispense() { 
2081      if (this.dispense == null)
2082        this.dispense = new ArrayList<VisionPrescriptionDispenseComponent>();
2083      return this.dispense;
2084    }
2085
2086    /**
2087     * @return Returns a reference to <code>this</code> for easy method chaining
2088     */
2089    public VisionPrescription setDispense(List<VisionPrescriptionDispenseComponent> theDispense) { 
2090      this.dispense = theDispense;
2091      return this;
2092    }
2093
2094    public boolean hasDispense() { 
2095      if (this.dispense == null)
2096        return false;
2097      for (VisionPrescriptionDispenseComponent item : this.dispense)
2098        if (!item.isEmpty())
2099          return true;
2100      return false;
2101    }
2102
2103    public VisionPrescriptionDispenseComponent addDispense() { //3
2104      VisionPrescriptionDispenseComponent t = new VisionPrescriptionDispenseComponent();
2105      if (this.dispense == null)
2106        this.dispense = new ArrayList<VisionPrescriptionDispenseComponent>();
2107      this.dispense.add(t);
2108      return t;
2109    }
2110
2111    public VisionPrescription addDispense(VisionPrescriptionDispenseComponent t) { //3
2112      if (t == null)
2113        return this;
2114      if (this.dispense == null)
2115        this.dispense = new ArrayList<VisionPrescriptionDispenseComponent>();
2116      this.dispense.add(t);
2117      return this;
2118    }
2119
2120    /**
2121     * @return The first repetition of repeating field {@link #dispense}, creating it if it does not already exist
2122     */
2123    public VisionPrescriptionDispenseComponent getDispenseFirstRep() { 
2124      if (getDispense().isEmpty()) {
2125        addDispense();
2126      }
2127      return getDispense().get(0);
2128    }
2129
2130      protected void listChildren(List<Property> children) {
2131        super.listChildren(children);
2132        children.add(new Property("identifier", "Identifier", "Business identifier which may be used by other parties to reference or identify the prescription.", 0, java.lang.Integer.MAX_VALUE, identifier));
2133        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
2134        children.add(new Property("patient", "Reference(Patient)", "A link to a resource representing the person to whom the vision products will be supplied.", 0, 1, patient));
2135        children.add(new Property("encounter", "Reference(Encounter)", "A link to a resource that identifies the particular occurrence of contact between patient and health care provider.", 0, 1, encounter));
2136        children.add(new Property("dateWritten", "dateTime", "The date (and perhaps time) when the prescription was written.", 0, 1, dateWritten));
2137        children.add(new Property("prescriber", "Reference(Practitioner)", "The healthcare professional responsible for authorizing the prescription.", 0, 1, prescriber));
2138        children.add(new Property("reason[x]", "CodeableConcept|Reference(Condition)", "Can be the reason or the indication for writing the prescription.", 0, 1, reason));
2139        children.add(new Property("dispense", "", "Deals with details of the dispense part of the supply specification.", 0, java.lang.Integer.MAX_VALUE, dispense));
2140      }
2141
2142      @Override
2143      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2144        switch (_hash) {
2145        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier which may be used by other parties to reference or identify the prescription.", 0, java.lang.Integer.MAX_VALUE, identifier);
2146        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
2147        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "A link to a resource representing the person to whom the vision products will be supplied.", 0, 1, patient);
2148        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "A link to a resource that identifies the particular occurrence of contact between patient and health care provider.", 0, 1, encounter);
2149        case -1496880759: /*dateWritten*/  return new Property("dateWritten", "dateTime", "The date (and perhaps time) when the prescription was written.", 0, 1, dateWritten);
2150        case 1430631077: /*prescriber*/  return new Property("prescriber", "Reference(Practitioner)", "The healthcare professional responsible for authorizing the prescription.", 0, 1, prescriber);
2151        case -669418564: /*reason[x]*/  return new Property("reason[x]", "CodeableConcept|Reference(Condition)", "Can be the reason or the indication for writing the prescription.", 0, 1, reason);
2152        case -934964668: /*reason*/  return new Property("reason[x]", "CodeableConcept|Reference(Condition)", "Can be the reason or the indication for writing the prescription.", 0, 1, reason);
2153        case -610155331: /*reasonCodeableConcept*/  return new Property("reason[x]", "CodeableConcept|Reference(Condition)", "Can be the reason or the indication for writing the prescription.", 0, 1, reason);
2154        case -1146218137: /*reasonReference*/  return new Property("reason[x]", "CodeableConcept|Reference(Condition)", "Can be the reason or the indication for writing the prescription.", 0, 1, reason);
2155        case 284885341: /*dispense*/  return new Property("dispense", "", "Deals with details of the dispense part of the supply specification.", 0, java.lang.Integer.MAX_VALUE, dispense);
2156        default: return super.getNamedProperty(_hash, _name, _checkValid);
2157        }
2158
2159      }
2160
2161      @Override
2162      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2163        switch (hash) {
2164        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2165        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<VisionStatus>
2166        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2167        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2168        case -1496880759: /*dateWritten*/ return this.dateWritten == null ? new Base[0] : new Base[] {this.dateWritten}; // DateTimeType
2169        case 1430631077: /*prescriber*/ return this.prescriber == null ? new Base[0] : new Base[] {this.prescriber}; // Reference
2170        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Type
2171        case 284885341: /*dispense*/ return this.dispense == null ? new Base[0] : this.dispense.toArray(new Base[this.dispense.size()]); // VisionPrescriptionDispenseComponent
2172        default: return super.getProperty(hash, name, checkValid);
2173        }
2174
2175      }
2176
2177      @Override
2178      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2179        switch (hash) {
2180        case -1618432855: // identifier
2181          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2182          return value;
2183        case -892481550: // status
2184          value = new VisionStatusEnumFactory().fromType(castToCode(value));
2185          this.status = (Enumeration) value; // Enumeration<VisionStatus>
2186          return value;
2187        case -791418107: // patient
2188          this.patient = castToReference(value); // Reference
2189          return value;
2190        case 1524132147: // encounter
2191          this.encounter = castToReference(value); // Reference
2192          return value;
2193        case -1496880759: // dateWritten
2194          this.dateWritten = castToDateTime(value); // DateTimeType
2195          return value;
2196        case 1430631077: // prescriber
2197          this.prescriber = castToReference(value); // Reference
2198          return value;
2199        case -934964668: // reason
2200          this.reason = castToType(value); // Type
2201          return value;
2202        case 284885341: // dispense
2203          this.getDispense().add((VisionPrescriptionDispenseComponent) value); // VisionPrescriptionDispenseComponent
2204          return value;
2205        default: return super.setProperty(hash, name, value);
2206        }
2207
2208      }
2209
2210      @Override
2211      public Base setProperty(String name, Base value) throws FHIRException {
2212        if (name.equals("identifier")) {
2213          this.getIdentifier().add(castToIdentifier(value));
2214        } else if (name.equals("status")) {
2215          value = new VisionStatusEnumFactory().fromType(castToCode(value));
2216          this.status = (Enumeration) value; // Enumeration<VisionStatus>
2217        } else if (name.equals("patient")) {
2218          this.patient = castToReference(value); // Reference
2219        } else if (name.equals("encounter")) {
2220          this.encounter = castToReference(value); // Reference
2221        } else if (name.equals("dateWritten")) {
2222          this.dateWritten = castToDateTime(value); // DateTimeType
2223        } else if (name.equals("prescriber")) {
2224          this.prescriber = castToReference(value); // Reference
2225        } else if (name.equals("reason[x]")) {
2226          this.reason = castToType(value); // Type
2227        } else if (name.equals("dispense")) {
2228          this.getDispense().add((VisionPrescriptionDispenseComponent) value);
2229        } else
2230          return super.setProperty(name, value);
2231        return value;
2232      }
2233
2234      @Override
2235      public Base makeProperty(int hash, String name) throws FHIRException {
2236        switch (hash) {
2237        case -1618432855:  return addIdentifier(); 
2238        case -892481550:  return getStatusElement();
2239        case -791418107:  return getPatient(); 
2240        case 1524132147:  return getEncounter(); 
2241        case -1496880759:  return getDateWrittenElement();
2242        case 1430631077:  return getPrescriber(); 
2243        case -669418564:  return getReason(); 
2244        case -934964668:  return getReason(); 
2245        case 284885341:  return addDispense(); 
2246        default: return super.makeProperty(hash, name);
2247        }
2248
2249      }
2250
2251      @Override
2252      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2253        switch (hash) {
2254        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2255        case -892481550: /*status*/ return new String[] {"code"};
2256        case -791418107: /*patient*/ return new String[] {"Reference"};
2257        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2258        case -1496880759: /*dateWritten*/ return new String[] {"dateTime"};
2259        case 1430631077: /*prescriber*/ return new String[] {"Reference"};
2260        case -934964668: /*reason*/ return new String[] {"CodeableConcept", "Reference"};
2261        case 284885341: /*dispense*/ return new String[] {};
2262        default: return super.getTypesForProperty(hash, name);
2263        }
2264
2265      }
2266
2267      @Override
2268      public Base addChild(String name) throws FHIRException {
2269        if (name.equals("identifier")) {
2270          return addIdentifier();
2271        }
2272        else if (name.equals("status")) {
2273          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.status");
2274        }
2275        else if (name.equals("patient")) {
2276          this.patient = new Reference();
2277          return this.patient;
2278        }
2279        else if (name.equals("encounter")) {
2280          this.encounter = new Reference();
2281          return this.encounter;
2282        }
2283        else if (name.equals("dateWritten")) {
2284          throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.dateWritten");
2285        }
2286        else if (name.equals("prescriber")) {
2287          this.prescriber = new Reference();
2288          return this.prescriber;
2289        }
2290        else if (name.equals("reasonCodeableConcept")) {
2291          this.reason = new CodeableConcept();
2292          return this.reason;
2293        }
2294        else if (name.equals("reasonReference")) {
2295          this.reason = new Reference();
2296          return this.reason;
2297        }
2298        else if (name.equals("dispense")) {
2299          return addDispense();
2300        }
2301        else
2302          return super.addChild(name);
2303      }
2304
2305  public String fhirType() {
2306    return "VisionPrescription";
2307
2308  }
2309
2310      public VisionPrescription copy() {
2311        VisionPrescription dst = new VisionPrescription();
2312        copyValues(dst);
2313        if (identifier != null) {
2314          dst.identifier = new ArrayList<Identifier>();
2315          for (Identifier i : identifier)
2316            dst.identifier.add(i.copy());
2317        };
2318        dst.status = status == null ? null : status.copy();
2319        dst.patient = patient == null ? null : patient.copy();
2320        dst.encounter = encounter == null ? null : encounter.copy();
2321        dst.dateWritten = dateWritten == null ? null : dateWritten.copy();
2322        dst.prescriber = prescriber == null ? null : prescriber.copy();
2323        dst.reason = reason == null ? null : reason.copy();
2324        if (dispense != null) {
2325          dst.dispense = new ArrayList<VisionPrescriptionDispenseComponent>();
2326          for (VisionPrescriptionDispenseComponent i : dispense)
2327            dst.dispense.add(i.copy());
2328        };
2329        return dst;
2330      }
2331
2332      protected VisionPrescription typedCopy() {
2333        return copy();
2334      }
2335
2336      @Override
2337      public boolean equalsDeep(Base other_) {
2338        if (!super.equalsDeep(other_))
2339          return false;
2340        if (!(other_ instanceof VisionPrescription))
2341          return false;
2342        VisionPrescription o = (VisionPrescription) other_;
2343        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(patient, o.patient, true)
2344           && compareDeep(encounter, o.encounter, true) && compareDeep(dateWritten, o.dateWritten, true) && compareDeep(prescriber, o.prescriber, true)
2345           && compareDeep(reason, o.reason, true) && compareDeep(dispense, o.dispense, true);
2346      }
2347
2348      @Override
2349      public boolean equalsShallow(Base other_) {
2350        if (!super.equalsShallow(other_))
2351          return false;
2352        if (!(other_ instanceof VisionPrescription))
2353          return false;
2354        VisionPrescription o = (VisionPrescription) other_;
2355        return compareValues(status, o.status, true) && compareValues(dateWritten, o.dateWritten, true);
2356      }
2357
2358      public boolean isEmpty() {
2359        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, patient
2360          , encounter, dateWritten, prescriber, reason, dispense);
2361      }
2362
2363  @Override
2364  public ResourceType getResourceType() {
2365    return ResourceType.VisionPrescription;
2366   }
2367
2368 /**
2369   * Search parameter: <b>prescriber</b>
2370   * <p>
2371   * Description: <b>Who authorizes the vision product</b><br>
2372   * Type: <b>reference</b><br>
2373   * Path: <b>VisionPrescription.prescriber</b><br>
2374   * </p>
2375   */
2376  @SearchParamDefinition(name="prescriber", path="VisionPrescription.prescriber", description="Who authorizes the vision product", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
2377  public static final String SP_PRESCRIBER = "prescriber";
2378 /**
2379   * <b>Fluent Client</b> search parameter constant for <b>prescriber</b>
2380   * <p>
2381   * Description: <b>Who authorizes the vision product</b><br>
2382   * Type: <b>reference</b><br>
2383   * Path: <b>VisionPrescription.prescriber</b><br>
2384   * </p>
2385   */
2386  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRESCRIBER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRESCRIBER);
2387
2388/**
2389   * Constant for fluent queries to be used to add include statements. Specifies
2390   * the path value of "<b>VisionPrescription:prescriber</b>".
2391   */
2392  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRESCRIBER = new ca.uhn.fhir.model.api.Include("VisionPrescription:prescriber").toLocked();
2393
2394 /**
2395   * Search parameter: <b>identifier</b>
2396   * <p>
2397   * Description: <b>Return prescriptions with this external identifier</b><br>
2398   * Type: <b>token</b><br>
2399   * Path: <b>VisionPrescription.identifier</b><br>
2400   * </p>
2401   */
2402  @SearchParamDefinition(name="identifier", path="VisionPrescription.identifier", description="Return prescriptions with this external identifier", type="token" )
2403  public static final String SP_IDENTIFIER = "identifier";
2404 /**
2405   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2406   * <p>
2407   * Description: <b>Return prescriptions with this external identifier</b><br>
2408   * Type: <b>token</b><br>
2409   * Path: <b>VisionPrescription.identifier</b><br>
2410   * </p>
2411   */
2412  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2413
2414 /**
2415   * Search parameter: <b>patient</b>
2416   * <p>
2417   * Description: <b>The identity of a patient to list dispenses for</b><br>
2418   * Type: <b>reference</b><br>
2419   * Path: <b>VisionPrescription.patient</b><br>
2420   * </p>
2421   */
2422  @SearchParamDefinition(name="patient", path="VisionPrescription.patient", description="The identity of a patient to list dispenses for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
2423  public static final String SP_PATIENT = "patient";
2424 /**
2425   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2426   * <p>
2427   * Description: <b>The identity of a patient to list dispenses for</b><br>
2428   * Type: <b>reference</b><br>
2429   * Path: <b>VisionPrescription.patient</b><br>
2430   * </p>
2431   */
2432  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2433
2434/**
2435   * Constant for fluent queries to be used to add include statements. Specifies
2436   * the path value of "<b>VisionPrescription:patient</b>".
2437   */
2438  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("VisionPrescription:patient").toLocked();
2439
2440 /**
2441   * Search parameter: <b>datewritten</b>
2442   * <p>
2443   * Description: <b>Return prescriptions written on this date</b><br>
2444   * Type: <b>date</b><br>
2445   * Path: <b>VisionPrescription.dateWritten</b><br>
2446   * </p>
2447   */
2448  @SearchParamDefinition(name="datewritten", path="VisionPrescription.dateWritten", description="Return prescriptions written on this date", type="date" )
2449  public static final String SP_DATEWRITTEN = "datewritten";
2450 /**
2451   * <b>Fluent Client</b> search parameter constant for <b>datewritten</b>
2452   * <p>
2453   * Description: <b>Return prescriptions written on this date</b><br>
2454   * Type: <b>date</b><br>
2455   * Path: <b>VisionPrescription.dateWritten</b><br>
2456   * </p>
2457   */
2458  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATEWRITTEN = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATEWRITTEN);
2459
2460 /**
2461   * Search parameter: <b>encounter</b>
2462   * <p>
2463   * Description: <b>Return prescriptions with this encounter identifier</b><br>
2464   * Type: <b>reference</b><br>
2465   * Path: <b>VisionPrescription.encounter</b><br>
2466   * </p>
2467   */
2468  @SearchParamDefinition(name="encounter", path="VisionPrescription.encounter", description="Return prescriptions with this encounter identifier", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
2469  public static final String SP_ENCOUNTER = "encounter";
2470 /**
2471   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2472   * <p>
2473   * Description: <b>Return prescriptions with this encounter identifier</b><br>
2474   * Type: <b>reference</b><br>
2475   * Path: <b>VisionPrescription.encounter</b><br>
2476   * </p>
2477   */
2478  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2479
2480/**
2481   * Constant for fluent queries to be used to add include statements. Specifies
2482   * the path value of "<b>VisionPrescription:encounter</b>".
2483   */
2484  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("VisionPrescription:encounter").toLocked();
2485
2486
2487}