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