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