001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.
047 */
048@ResourceDef(name="QuestionnaireResponse", profile="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse")
049public class QuestionnaireResponse extends DomainResource {
050
051    public enum QuestionnaireResponseStatus {
052        /**
053         * This QuestionnaireResponse has been partially filled out with answers but changes or additions are still expected to be made to it.
054         */
055        INPROGRESS, 
056        /**
057         * This QuestionnaireResponse has been filled out with answers and the current content is regarded as definitive.
058         */
059        COMPLETED, 
060        /**
061         * This QuestionnaireResponse has been filled out with answers, then marked as complete, yet changes or additions have been made to it afterwards.
062         */
063        AMENDED, 
064        /**
065         * This QuestionnaireResponse was entered in error and voided.
066         */
067        ENTEREDINERROR, 
068        /**
069         * This QuestionnaireResponse has been partially filled out with answers but has been abandoned. It is unknown whether changes or additions are expected to be made to it.
070         */
071        STOPPED, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static QuestionnaireResponseStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("in-progress".equals(codeString))
080          return INPROGRESS;
081        if ("completed".equals(codeString))
082          return COMPLETED;
083        if ("amended".equals(codeString))
084          return AMENDED;
085        if ("entered-in-error".equals(codeString))
086          return ENTEREDINERROR;
087        if ("stopped".equals(codeString))
088          return STOPPED;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown QuestionnaireResponseStatus code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case INPROGRESS: return "in-progress";
097            case COMPLETED: return "completed";
098            case AMENDED: return "amended";
099            case ENTEREDINERROR: return "entered-in-error";
100            case STOPPED: return "stopped";
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case INPROGRESS: return "http://hl7.org/fhir/questionnaire-answers-status";
107            case COMPLETED: return "http://hl7.org/fhir/questionnaire-answers-status";
108            case AMENDED: return "http://hl7.org/fhir/questionnaire-answers-status";
109            case ENTEREDINERROR: return "http://hl7.org/fhir/questionnaire-answers-status";
110            case STOPPED: return "http://hl7.org/fhir/questionnaire-answers-status";
111            default: return "?";
112          }
113        }
114        public String getDefinition() {
115          switch (this) {
116            case INPROGRESS: return "This QuestionnaireResponse has been partially filled out with answers but changes or additions are still expected to be made to it.";
117            case COMPLETED: return "This QuestionnaireResponse has been filled out with answers and the current content is regarded as definitive.";
118            case AMENDED: return "This QuestionnaireResponse has been filled out with answers, then marked as complete, yet changes or additions have been made to it afterwards.";
119            case ENTEREDINERROR: return "This QuestionnaireResponse was entered in error and voided.";
120            case STOPPED: return "This QuestionnaireResponse has been partially filled out with answers but has been abandoned. It is unknown whether changes or additions are expected to be made to it.";
121            default: return "?";
122          }
123        }
124        public String getDisplay() {
125          switch (this) {
126            case INPROGRESS: return "In Progress";
127            case COMPLETED: return "Completed";
128            case AMENDED: return "Amended";
129            case ENTEREDINERROR: return "Entered in Error";
130            case STOPPED: return "Stopped";
131            default: return "?";
132          }
133        }
134    }
135
136  public static class QuestionnaireResponseStatusEnumFactory implements EnumFactory<QuestionnaireResponseStatus> {
137    public QuestionnaireResponseStatus fromCode(String codeString) throws IllegalArgumentException {
138      if (codeString == null || "".equals(codeString))
139            if (codeString == null || "".equals(codeString))
140                return null;
141        if ("in-progress".equals(codeString))
142          return QuestionnaireResponseStatus.INPROGRESS;
143        if ("completed".equals(codeString))
144          return QuestionnaireResponseStatus.COMPLETED;
145        if ("amended".equals(codeString))
146          return QuestionnaireResponseStatus.AMENDED;
147        if ("entered-in-error".equals(codeString))
148          return QuestionnaireResponseStatus.ENTEREDINERROR;
149        if ("stopped".equals(codeString))
150          return QuestionnaireResponseStatus.STOPPED;
151        throw new IllegalArgumentException("Unknown QuestionnaireResponseStatus code '"+codeString+"'");
152        }
153        public Enumeration<QuestionnaireResponseStatus> fromType(Base code) throws FHIRException {
154          if (code == null)
155            return null;
156          if (code.isEmpty())
157            return new Enumeration<QuestionnaireResponseStatus>(this);
158          String codeString = ((PrimitiveType) code).asStringValue();
159          if (codeString == null || "".equals(codeString))
160            return null;
161        if ("in-progress".equals(codeString))
162          return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.INPROGRESS);
163        if ("completed".equals(codeString))
164          return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.COMPLETED);
165        if ("amended".equals(codeString))
166          return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.AMENDED);
167        if ("entered-in-error".equals(codeString))
168          return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.ENTEREDINERROR);
169        if ("stopped".equals(codeString))
170          return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.STOPPED);
171        throw new FHIRException("Unknown QuestionnaireResponseStatus code '"+codeString+"'");
172        }
173    public String toCode(QuestionnaireResponseStatus code) {
174      if (code == QuestionnaireResponseStatus.INPROGRESS)
175        return "in-progress";
176      if (code == QuestionnaireResponseStatus.COMPLETED)
177        return "completed";
178      if (code == QuestionnaireResponseStatus.AMENDED)
179        return "amended";
180      if (code == QuestionnaireResponseStatus.ENTEREDINERROR)
181        return "entered-in-error";
182      if (code == QuestionnaireResponseStatus.STOPPED)
183        return "stopped";
184      return "?";
185      }
186    public String toSystem(QuestionnaireResponseStatus code) {
187      return code.getSystem();
188      }
189    }
190
191    @Block()
192    public static class QuestionnaireResponseItemComponent extends BackboneElement implements IBaseBackboneElement {
193        /**
194         * The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.
195         */
196        @Child(name = "linkId", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
197        @Description(shortDefinition="Pointer to specific item from Questionnaire", formalDefinition="The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource." )
198        protected StringType linkId;
199
200        /**
201         * A reference to an [[[ElementDefinition]]] that provides the details for the item.
202         */
203        @Child(name = "definition", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
204        @Description(shortDefinition="ElementDefinition - details for the item", formalDefinition="A reference to an [[[ElementDefinition]]] that provides the details for the item." )
205        protected UriType definition;
206
207        /**
208         * Text that is displayed above the contents of the group or as the text of the question being answered.
209         */
210        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
211        @Description(shortDefinition="Name for group or question text", formalDefinition="Text that is displayed above the contents of the group or as the text of the question being answered." )
212        protected StringType text;
213
214        /**
215         * The respondent's answer(s) to the question.
216         */
217        @Child(name = "answer", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
218        @Description(shortDefinition="The response(s) to the question", formalDefinition="The respondent's answer(s) to the question." )
219        protected List<QuestionnaireResponseItemAnswerComponent> answer;
220
221        /**
222         * Questions or sub-groups nested beneath a question or group.
223         */
224        @Child(name = "item", type = {QuestionnaireResponseItemComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
225        @Description(shortDefinition="Nested questionnaire response items", formalDefinition="Questions or sub-groups nested beneath a question or group." )
226        protected List<QuestionnaireResponseItemComponent> item;
227
228        private static final long serialVersionUID = -1395483402L;
229
230    /**
231     * Constructor
232     */
233      public QuestionnaireResponseItemComponent() {
234        super();
235      }
236
237    /**
238     * Constructor
239     */
240      public QuestionnaireResponseItemComponent(StringType linkId) {
241        super();
242        this.linkId = linkId;
243      }
244
245        /**
246         * @return {@link #linkId} (The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
247         */
248        public StringType getLinkIdElement() { 
249          if (this.linkId == null)
250            if (Configuration.errorOnAutoCreate())
251              throw new Error("Attempt to auto-create QuestionnaireResponseItemComponent.linkId");
252            else if (Configuration.doAutoCreate())
253              this.linkId = new StringType(); // bb
254          return this.linkId;
255        }
256
257        public boolean hasLinkIdElement() { 
258          return this.linkId != null && !this.linkId.isEmpty();
259        }
260
261        public boolean hasLinkId() { 
262          return this.linkId != null && !this.linkId.isEmpty();
263        }
264
265        /**
266         * @param value {@link #linkId} (The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
267         */
268        public QuestionnaireResponseItemComponent setLinkIdElement(StringType value) { 
269          this.linkId = value;
270          return this;
271        }
272
273        /**
274         * @return The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.
275         */
276        public String getLinkId() { 
277          return this.linkId == null ? null : this.linkId.getValue();
278        }
279
280        /**
281         * @param value The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.
282         */
283        public QuestionnaireResponseItemComponent setLinkId(String value) { 
284            if (this.linkId == null)
285              this.linkId = new StringType();
286            this.linkId.setValue(value);
287          return this;
288        }
289
290        /**
291         * @return {@link #definition} (A reference to an [[[ElementDefinition]]] that provides the details for the item.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
292         */
293        public UriType getDefinitionElement() { 
294          if (this.definition == null)
295            if (Configuration.errorOnAutoCreate())
296              throw new Error("Attempt to auto-create QuestionnaireResponseItemComponent.definition");
297            else if (Configuration.doAutoCreate())
298              this.definition = new UriType(); // bb
299          return this.definition;
300        }
301
302        public boolean hasDefinitionElement() { 
303          return this.definition != null && !this.definition.isEmpty();
304        }
305
306        public boolean hasDefinition() { 
307          return this.definition != null && !this.definition.isEmpty();
308        }
309
310        /**
311         * @param value {@link #definition} (A reference to an [[[ElementDefinition]]] that provides the details for the item.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
312         */
313        public QuestionnaireResponseItemComponent setDefinitionElement(UriType value) { 
314          this.definition = value;
315          return this;
316        }
317
318        /**
319         * @return A reference to an [[[ElementDefinition]]] that provides the details for the item.
320         */
321        public String getDefinition() { 
322          return this.definition == null ? null : this.definition.getValue();
323        }
324
325        /**
326         * @param value A reference to an [[[ElementDefinition]]] that provides the details for the item.
327         */
328        public QuestionnaireResponseItemComponent setDefinition(String value) { 
329          if (Utilities.noString(value))
330            this.definition = null;
331          else {
332            if (this.definition == null)
333              this.definition = new UriType();
334            this.definition.setValue(value);
335          }
336          return this;
337        }
338
339        /**
340         * @return {@link #text} (Text that is displayed above the contents of the group or as the text of the question being answered.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
341         */
342        public StringType getTextElement() { 
343          if (this.text == null)
344            if (Configuration.errorOnAutoCreate())
345              throw new Error("Attempt to auto-create QuestionnaireResponseItemComponent.text");
346            else if (Configuration.doAutoCreate())
347              this.text = new StringType(); // bb
348          return this.text;
349        }
350
351        public boolean hasTextElement() { 
352          return this.text != null && !this.text.isEmpty();
353        }
354
355        public boolean hasText() { 
356          return this.text != null && !this.text.isEmpty();
357        }
358
359        /**
360         * @param value {@link #text} (Text that is displayed above the contents of the group or as the text of the question being answered.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
361         */
362        public QuestionnaireResponseItemComponent setTextElement(StringType value) { 
363          this.text = value;
364          return this;
365        }
366
367        /**
368         * @return Text that is displayed above the contents of the group or as the text of the question being answered.
369         */
370        public String getText() { 
371          return this.text == null ? null : this.text.getValue();
372        }
373
374        /**
375         * @param value Text that is displayed above the contents of the group or as the text of the question being answered.
376         */
377        public QuestionnaireResponseItemComponent setText(String value) { 
378          if (Utilities.noString(value))
379            this.text = null;
380          else {
381            if (this.text == null)
382              this.text = new StringType();
383            this.text.setValue(value);
384          }
385          return this;
386        }
387
388        /**
389         * @return {@link #answer} (The respondent's answer(s) to the question.)
390         */
391        public List<QuestionnaireResponseItemAnswerComponent> getAnswer() { 
392          if (this.answer == null)
393            this.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
394          return this.answer;
395        }
396
397        /**
398         * @return Returns a reference to <code>this</code> for easy method chaining
399         */
400        public QuestionnaireResponseItemComponent setAnswer(List<QuestionnaireResponseItemAnswerComponent> theAnswer) { 
401          this.answer = theAnswer;
402          return this;
403        }
404
405        public boolean hasAnswer() { 
406          if (this.answer == null)
407            return false;
408          for (QuestionnaireResponseItemAnswerComponent item : this.answer)
409            if (!item.isEmpty())
410              return true;
411          return false;
412        }
413
414        public QuestionnaireResponseItemAnswerComponent addAnswer() { //3
415          QuestionnaireResponseItemAnswerComponent t = new QuestionnaireResponseItemAnswerComponent();
416          if (this.answer == null)
417            this.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
418          this.answer.add(t);
419          return t;
420        }
421
422        public QuestionnaireResponseItemComponent addAnswer(QuestionnaireResponseItemAnswerComponent t) { //3
423          if (t == null)
424            return this;
425          if (this.answer == null)
426            this.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
427          this.answer.add(t);
428          return this;
429        }
430
431        /**
432         * @return The first repetition of repeating field {@link #answer}, creating it if it does not already exist
433         */
434        public QuestionnaireResponseItemAnswerComponent getAnswerFirstRep() { 
435          if (getAnswer().isEmpty()) {
436            addAnswer();
437          }
438          return getAnswer().get(0);
439        }
440
441        /**
442         * @return {@link #item} (Questions or sub-groups nested beneath a question or group.)
443         */
444        public List<QuestionnaireResponseItemComponent> getItem() { 
445          if (this.item == null)
446            this.item = new ArrayList<QuestionnaireResponseItemComponent>();
447          return this.item;
448        }
449
450        /**
451         * @return Returns a reference to <code>this</code> for easy method chaining
452         */
453        public QuestionnaireResponseItemComponent setItem(List<QuestionnaireResponseItemComponent> theItem) { 
454          this.item = theItem;
455          return this;
456        }
457
458        public boolean hasItem() { 
459          if (this.item == null)
460            return false;
461          for (QuestionnaireResponseItemComponent item : this.item)
462            if (!item.isEmpty())
463              return true;
464          return false;
465        }
466
467        public QuestionnaireResponseItemComponent addItem() { //3
468          QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
469          if (this.item == null)
470            this.item = new ArrayList<QuestionnaireResponseItemComponent>();
471          this.item.add(t);
472          return t;
473        }
474
475        public QuestionnaireResponseItemComponent addItem(QuestionnaireResponseItemComponent t) { //3
476          if (t == null)
477            return this;
478          if (this.item == null)
479            this.item = new ArrayList<QuestionnaireResponseItemComponent>();
480          this.item.add(t);
481          return this;
482        }
483
484        /**
485         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
486         */
487        public QuestionnaireResponseItemComponent getItemFirstRep() { 
488          if (getItem().isEmpty()) {
489            addItem();
490          }
491          return getItem().get(0);
492        }
493
494        protected void listChildren(List<Property> children) {
495          super.listChildren(children);
496          children.add(new Property("linkId", "string", "The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.", 0, 1, linkId));
497          children.add(new Property("definition", "uri", "A reference to an [[[ElementDefinition]]] that provides the details for the item.", 0, 1, definition));
498          children.add(new Property("text", "string", "Text that is displayed above the contents of the group or as the text of the question being answered.", 0, 1, text));
499          children.add(new Property("answer", "", "The respondent's answer(s) to the question.", 0, java.lang.Integer.MAX_VALUE, answer));
500          children.add(new Property("item", "@QuestionnaireResponse.item", "Questions or sub-groups nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item));
501        }
502
503        @Override
504        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
505          switch (_hash) {
506          case -1102667083: /*linkId*/  return new Property("linkId", "string", "The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.", 0, 1, linkId);
507          case -1014418093: /*definition*/  return new Property("definition", "uri", "A reference to an [[[ElementDefinition]]] that provides the details for the item.", 0, 1, definition);
508          case 3556653: /*text*/  return new Property("text", "string", "Text that is displayed above the contents of the group or as the text of the question being answered.", 0, 1, text);
509          case -1412808770: /*answer*/  return new Property("answer", "", "The respondent's answer(s) to the question.", 0, java.lang.Integer.MAX_VALUE, answer);
510          case 3242771: /*item*/  return new Property("item", "@QuestionnaireResponse.item", "Questions or sub-groups nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item);
511          default: return super.getNamedProperty(_hash, _name, _checkValid);
512          }
513
514        }
515
516      @Override
517      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
518        switch (hash) {
519        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : new Base[] {this.linkId}; // StringType
520        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // UriType
521        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
522        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // QuestionnaireResponseItemAnswerComponent
523        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
524        default: return super.getProperty(hash, name, checkValid);
525        }
526
527      }
528
529      @Override
530      public Base setProperty(int hash, String name, Base value) throws FHIRException {
531        switch (hash) {
532        case -1102667083: // linkId
533          this.linkId = castToString(value); // StringType
534          return value;
535        case -1014418093: // definition
536          this.definition = castToUri(value); // UriType
537          return value;
538        case 3556653: // text
539          this.text = castToString(value); // StringType
540          return value;
541        case -1412808770: // answer
542          this.getAnswer().add((QuestionnaireResponseItemAnswerComponent) value); // QuestionnaireResponseItemAnswerComponent
543          return value;
544        case 3242771: // item
545          this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
546          return value;
547        default: return super.setProperty(hash, name, value);
548        }
549
550      }
551
552      @Override
553      public Base setProperty(String name, Base value) throws FHIRException {
554        if (name.equals("linkId")) {
555          this.linkId = castToString(value); // StringType
556        } else if (name.equals("definition")) {
557          this.definition = castToUri(value); // UriType
558        } else if (name.equals("text")) {
559          this.text = castToString(value); // StringType
560        } else if (name.equals("answer")) {
561          this.getAnswer().add((QuestionnaireResponseItemAnswerComponent) value);
562        } else if (name.equals("item")) {
563          this.getItem().add((QuestionnaireResponseItemComponent) value);
564        } else
565          return super.setProperty(name, value);
566        return value;
567      }
568
569      @Override
570      public Base makeProperty(int hash, String name) throws FHIRException {
571        switch (hash) {
572        case -1102667083:  return getLinkIdElement();
573        case -1014418093:  return getDefinitionElement();
574        case 3556653:  return getTextElement();
575        case -1412808770:  return addAnswer(); 
576        case 3242771:  return addItem(); 
577        default: return super.makeProperty(hash, name);
578        }
579
580      }
581
582      @Override
583      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
584        switch (hash) {
585        case -1102667083: /*linkId*/ return new String[] {"string"};
586        case -1014418093: /*definition*/ return new String[] {"uri"};
587        case 3556653: /*text*/ return new String[] {"string"};
588        case -1412808770: /*answer*/ return new String[] {};
589        case 3242771: /*item*/ return new String[] {"@QuestionnaireResponse.item"};
590        default: return super.getTypesForProperty(hash, name);
591        }
592
593      }
594
595      @Override
596      public Base addChild(String name) throws FHIRException {
597        if (name.equals("linkId")) {
598          throw new FHIRException("Cannot call addChild on a primitive type QuestionnaireResponse.linkId");
599        }
600        else if (name.equals("definition")) {
601          throw new FHIRException("Cannot call addChild on a primitive type QuestionnaireResponse.definition");
602        }
603        else if (name.equals("text")) {
604          throw new FHIRException("Cannot call addChild on a primitive type QuestionnaireResponse.text");
605        }
606        else if (name.equals("answer")) {
607          return addAnswer();
608        }
609        else if (name.equals("item")) {
610          return addItem();
611        }
612        else
613          return super.addChild(name);
614      }
615
616      public QuestionnaireResponseItemComponent copy() {
617        QuestionnaireResponseItemComponent dst = new QuestionnaireResponseItemComponent();
618        copyValues(dst);
619        dst.linkId = linkId == null ? null : linkId.copy();
620        dst.definition = definition == null ? null : definition.copy();
621        dst.text = text == null ? null : text.copy();
622        if (answer != null) {
623          dst.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
624          for (QuestionnaireResponseItemAnswerComponent i : answer)
625            dst.answer.add(i.copy());
626        };
627        if (item != null) {
628          dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
629          for (QuestionnaireResponseItemComponent i : item)
630            dst.item.add(i.copy());
631        };
632        return dst;
633      }
634
635      @Override
636      public boolean equalsDeep(Base other_) {
637        if (!super.equalsDeep(other_))
638          return false;
639        if (!(other_ instanceof QuestionnaireResponseItemComponent))
640          return false;
641        QuestionnaireResponseItemComponent o = (QuestionnaireResponseItemComponent) other_;
642        return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true) && compareDeep(text, o.text, true)
643           && compareDeep(answer, o.answer, true) && compareDeep(item, o.item, true);
644      }
645
646      @Override
647      public boolean equalsShallow(Base other_) {
648        if (!super.equalsShallow(other_))
649          return false;
650        if (!(other_ instanceof QuestionnaireResponseItemComponent))
651          return false;
652        QuestionnaireResponseItemComponent o = (QuestionnaireResponseItemComponent) other_;
653        return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true) && compareValues(text, o.text, true)
654          ;
655      }
656
657      public boolean isEmpty() {
658        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, text
659          , answer, item);
660      }
661
662  public String fhirType() {
663    return "QuestionnaireResponse.item";
664
665  }
666
667  }
668
669    @Block()
670    public static class QuestionnaireResponseItemAnswerComponent extends BackboneElement implements IBaseBackboneElement {
671        /**
672         * The answer (or one of the answers) provided by the respondent to the question.
673         */
674        @Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class, Quantity.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
675        @Description(shortDefinition="Single-valued answer to the question", formalDefinition="The answer (or one of the answers) provided by the respondent to the question." )
676        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
677        protected Type value;
678
679        /**
680         * Nested groups and/or questions found within this particular answer.
681         */
682        @Child(name = "item", type = {QuestionnaireResponseItemComponent.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
683        @Description(shortDefinition="Nested groups and questions", formalDefinition="Nested groups and/or questions found within this particular answer." )
684        protected List<QuestionnaireResponseItemComponent> item;
685
686        private static final long serialVersionUID = 2052422636L;
687
688    /**
689     * Constructor
690     */
691      public QuestionnaireResponseItemAnswerComponent() {
692        super();
693      }
694
695        /**
696         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
697         */
698        public Type getValue() { 
699          return this.value;
700        }
701
702        /**
703         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
704         */
705        public BooleanType getValueBooleanType() throws FHIRException { 
706          if (this.value == null)
707            this.value = new BooleanType();
708          if (!(this.value instanceof BooleanType))
709            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
710          return (BooleanType) this.value;
711        }
712
713        public boolean hasValueBooleanType() { 
714          return this != null && this.value instanceof BooleanType;
715        }
716
717        /**
718         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
719         */
720        public DecimalType getValueDecimalType() throws FHIRException { 
721          if (this.value == null)
722            this.value = new DecimalType();
723          if (!(this.value instanceof DecimalType))
724            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
725          return (DecimalType) this.value;
726        }
727
728        public boolean hasValueDecimalType() { 
729          return this != null && this.value instanceof DecimalType;
730        }
731
732        /**
733         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
734         */
735        public IntegerType getValueIntegerType() throws FHIRException { 
736          if (this.value == null)
737            this.value = new IntegerType();
738          if (!(this.value instanceof IntegerType))
739            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
740          return (IntegerType) this.value;
741        }
742
743        public boolean hasValueIntegerType() { 
744          return this != null && this.value instanceof IntegerType;
745        }
746
747        /**
748         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
749         */
750        public DateType getValueDateType() throws FHIRException { 
751          if (this.value == null)
752            this.value = new DateType();
753          if (!(this.value instanceof DateType))
754            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
755          return (DateType) this.value;
756        }
757
758        public boolean hasValueDateType() { 
759          return this != null && this.value instanceof DateType;
760        }
761
762        /**
763         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
764         */
765        public DateTimeType getValueDateTimeType() throws FHIRException { 
766          if (this.value == null)
767            this.value = new DateTimeType();
768          if (!(this.value instanceof DateTimeType))
769            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
770          return (DateTimeType) this.value;
771        }
772
773        public boolean hasValueDateTimeType() { 
774          return this != null && this.value instanceof DateTimeType;
775        }
776
777        /**
778         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
779         */
780        public TimeType getValueTimeType() throws FHIRException { 
781          if (this.value == null)
782            this.value = new TimeType();
783          if (!(this.value instanceof TimeType))
784            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
785          return (TimeType) this.value;
786        }
787
788        public boolean hasValueTimeType() { 
789          return this != null && this.value instanceof TimeType;
790        }
791
792        /**
793         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
794         */
795        public StringType getValueStringType() throws FHIRException { 
796          if (this.value == null)
797            this.value = new StringType();
798          if (!(this.value instanceof StringType))
799            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
800          return (StringType) this.value;
801        }
802
803        public boolean hasValueStringType() { 
804          return this != null && this.value instanceof StringType;
805        }
806
807        /**
808         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
809         */
810        public UriType getValueUriType() throws FHIRException { 
811          if (this.value == null)
812            this.value = new UriType();
813          if (!(this.value instanceof UriType))
814            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
815          return (UriType) this.value;
816        }
817
818        public boolean hasValueUriType() { 
819          return this != null && this.value instanceof UriType;
820        }
821
822        /**
823         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
824         */
825        public Attachment getValueAttachment() throws FHIRException { 
826          if (this.value == null)
827            this.value = new Attachment();
828          if (!(this.value instanceof Attachment))
829            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
830          return (Attachment) this.value;
831        }
832
833        public boolean hasValueAttachment() { 
834          return this != null && this.value instanceof Attachment;
835        }
836
837        /**
838         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
839         */
840        public Coding getValueCoding() throws FHIRException { 
841          if (this.value == null)
842            this.value = new Coding();
843          if (!(this.value instanceof Coding))
844            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
845          return (Coding) this.value;
846        }
847
848        public boolean hasValueCoding() { 
849          return this != null && this.value instanceof Coding;
850        }
851
852        /**
853         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
854         */
855        public Quantity getValueQuantity() throws FHIRException { 
856          if (this.value == null)
857            this.value = new Quantity();
858          if (!(this.value instanceof Quantity))
859            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
860          return (Quantity) this.value;
861        }
862
863        public boolean hasValueQuantity() { 
864          return this != null && this.value instanceof Quantity;
865        }
866
867        /**
868         * @return {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
869         */
870        public Reference getValueReference() throws FHIRException { 
871          if (this.value == null)
872            this.value = new Reference();
873          if (!(this.value instanceof Reference))
874            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
875          return (Reference) this.value;
876        }
877
878        public boolean hasValueReference() { 
879          return this != null && this.value instanceof Reference;
880        }
881
882        public boolean hasValue() { 
883          return this.value != null && !this.value.isEmpty();
884        }
885
886        /**
887         * @param value {@link #value} (The answer (or one of the answers) provided by the respondent to the question.)
888         */
889        public QuestionnaireResponseItemAnswerComponent setValue(Type value) { 
890          if (value != null && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType || value instanceof StringType || value instanceof UriType || value instanceof Attachment || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
891            throw new Error("Not the right type for QuestionnaireResponse.item.answer.value[x]: "+value.fhirType());
892          this.value = value;
893          return this;
894        }
895
896        /**
897         * @return {@link #item} (Nested groups and/or questions found within this particular answer.)
898         */
899        public List<QuestionnaireResponseItemComponent> getItem() { 
900          if (this.item == null)
901            this.item = new ArrayList<QuestionnaireResponseItemComponent>();
902          return this.item;
903        }
904
905        /**
906         * @return Returns a reference to <code>this</code> for easy method chaining
907         */
908        public QuestionnaireResponseItemAnswerComponent setItem(List<QuestionnaireResponseItemComponent> theItem) { 
909          this.item = theItem;
910          return this;
911        }
912
913        public boolean hasItem() { 
914          if (this.item == null)
915            return false;
916          for (QuestionnaireResponseItemComponent item : this.item)
917            if (!item.isEmpty())
918              return true;
919          return false;
920        }
921
922        public QuestionnaireResponseItemComponent addItem() { //3
923          QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
924          if (this.item == null)
925            this.item = new ArrayList<QuestionnaireResponseItemComponent>();
926          this.item.add(t);
927          return t;
928        }
929
930        public QuestionnaireResponseItemAnswerComponent addItem(QuestionnaireResponseItemComponent t) { //3
931          if (t == null)
932            return this;
933          if (this.item == null)
934            this.item = new ArrayList<QuestionnaireResponseItemComponent>();
935          this.item.add(t);
936          return this;
937        }
938
939        /**
940         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
941         */
942        public QuestionnaireResponseItemComponent getItemFirstRep() { 
943          if (getItem().isEmpty()) {
944            addItem();
945          }
946          return getItem().get(0);
947        }
948
949        protected void listChildren(List<Property> children) {
950          super.listChildren(children);
951          children.add(new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value));
952          children.add(new Property("item", "@QuestionnaireResponse.item", "Nested groups and/or questions found within this particular answer.", 0, java.lang.Integer.MAX_VALUE, item));
953        }
954
955        @Override
956        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
957          switch (_hash) {
958          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
959          case 111972721: /*value*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
960          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
961          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
962          case -1668204915: /*valueInteger*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
963          case -766192449: /*valueDate*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
964          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
965          case -765708322: /*valueTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
966          case -1424603934: /*valueString*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
967          case -1410172357: /*valueUri*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
968          case -475566732: /*valueAttachment*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
969          case -1887705029: /*valueCoding*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
970          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
971          case 1755241690: /*valueReference*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
972          case 3242771: /*item*/  return new Property("item", "@QuestionnaireResponse.item", "Nested groups and/or questions found within this particular answer.", 0, java.lang.Integer.MAX_VALUE, item);
973          default: return super.getNamedProperty(_hash, _name, _checkValid);
974          }
975
976        }
977
978      @Override
979      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
980        switch (hash) {
981        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
982        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
983        default: return super.getProperty(hash, name, checkValid);
984        }
985
986      }
987
988      @Override
989      public Base setProperty(int hash, String name, Base value) throws FHIRException {
990        switch (hash) {
991        case 111972721: // value
992          this.value = castToType(value); // Type
993          return value;
994        case 3242771: // item
995          this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
996          return value;
997        default: return super.setProperty(hash, name, value);
998        }
999
1000      }
1001
1002      @Override
1003      public Base setProperty(String name, Base value) throws FHIRException {
1004        if (name.equals("value[x]")) {
1005          this.value = castToType(value); // Type
1006        } else if (name.equals("item")) {
1007          this.getItem().add((QuestionnaireResponseItemComponent) value);
1008        } else
1009          return super.setProperty(name, value);
1010        return value;
1011      }
1012
1013      @Override
1014      public Base makeProperty(int hash, String name) throws FHIRException {
1015        switch (hash) {
1016        case -1410166417:  return getValue(); 
1017        case 111972721:  return getValue(); 
1018        case 3242771:  return addItem(); 
1019        default: return super.makeProperty(hash, name);
1020        }
1021
1022      }
1023
1024      @Override
1025      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1026        switch (hash) {
1027        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
1028        case 3242771: /*item*/ return new String[] {"@QuestionnaireResponse.item"};
1029        default: return super.getTypesForProperty(hash, name);
1030        }
1031
1032      }
1033
1034      @Override
1035      public Base addChild(String name) throws FHIRException {
1036        if (name.equals("valueBoolean")) {
1037          this.value = new BooleanType();
1038          return this.value;
1039        }
1040        else if (name.equals("valueDecimal")) {
1041          this.value = new DecimalType();
1042          return this.value;
1043        }
1044        else if (name.equals("valueInteger")) {
1045          this.value = new IntegerType();
1046          return this.value;
1047        }
1048        else if (name.equals("valueDate")) {
1049          this.value = new DateType();
1050          return this.value;
1051        }
1052        else if (name.equals("valueDateTime")) {
1053          this.value = new DateTimeType();
1054          return this.value;
1055        }
1056        else if (name.equals("valueTime")) {
1057          this.value = new TimeType();
1058          return this.value;
1059        }
1060        else if (name.equals("valueString")) {
1061          this.value = new StringType();
1062          return this.value;
1063        }
1064        else if (name.equals("valueUri")) {
1065          this.value = new UriType();
1066          return this.value;
1067        }
1068        else if (name.equals("valueAttachment")) {
1069          this.value = new Attachment();
1070          return this.value;
1071        }
1072        else if (name.equals("valueCoding")) {
1073          this.value = new Coding();
1074          return this.value;
1075        }
1076        else if (name.equals("valueQuantity")) {
1077          this.value = new Quantity();
1078          return this.value;
1079        }
1080        else if (name.equals("valueReference")) {
1081          this.value = new Reference();
1082          return this.value;
1083        }
1084        else if (name.equals("item")) {
1085          return addItem();
1086        }
1087        else
1088          return super.addChild(name);
1089      }
1090
1091      public QuestionnaireResponseItemAnswerComponent copy() {
1092        QuestionnaireResponseItemAnswerComponent dst = new QuestionnaireResponseItemAnswerComponent();
1093        copyValues(dst);
1094        dst.value = value == null ? null : value.copy();
1095        if (item != null) {
1096          dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
1097          for (QuestionnaireResponseItemComponent i : item)
1098            dst.item.add(i.copy());
1099        };
1100        return dst;
1101      }
1102
1103      @Override
1104      public boolean equalsDeep(Base other_) {
1105        if (!super.equalsDeep(other_))
1106          return false;
1107        if (!(other_ instanceof QuestionnaireResponseItemAnswerComponent))
1108          return false;
1109        QuestionnaireResponseItemAnswerComponent o = (QuestionnaireResponseItemAnswerComponent) other_;
1110        return compareDeep(value, o.value, true) && compareDeep(item, o.item, true);
1111      }
1112
1113      @Override
1114      public boolean equalsShallow(Base other_) {
1115        if (!super.equalsShallow(other_))
1116          return false;
1117        if (!(other_ instanceof QuestionnaireResponseItemAnswerComponent))
1118          return false;
1119        QuestionnaireResponseItemAnswerComponent o = (QuestionnaireResponseItemAnswerComponent) other_;
1120        return true;
1121      }
1122
1123      public boolean isEmpty() {
1124        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, item);
1125      }
1126
1127  public String fhirType() {
1128    return "QuestionnaireResponse.item.answer";
1129
1130  }
1131
1132  }
1133
1134    /**
1135     * A business identifier assigned to a particular completed (or partially completed) questionnaire.
1136     */
1137    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
1138    @Description(shortDefinition="Unique id for this set of answers", formalDefinition="A business identifier assigned to a particular completed (or partially completed) questionnaire." )
1139    protected Identifier identifier;
1140
1141    /**
1142     * The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.
1143     */
1144    @Child(name = "basedOn", type = {CarePlan.class, ServiceRequest.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1145    @Description(shortDefinition="Request fulfilled by this QuestionnaireResponse", formalDefinition="The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression." )
1146    protected List<Reference> basedOn;
1147    /**
1148     * The actual objects that are the target of the reference (The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.)
1149     */
1150    protected List<Resource> basedOnTarget;
1151
1152
1153    /**
1154     * A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.
1155     */
1156    @Child(name = "partOf", type = {Observation.class, Procedure.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1157    @Description(shortDefinition="Part of this action", formalDefinition="A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of." )
1158    protected List<Reference> partOf;
1159    /**
1160     * The actual objects that are the target of the reference (A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.)
1161     */
1162    protected List<Resource> partOfTarget;
1163
1164
1165    /**
1166     * The Questionnaire that defines and organizes the questions for which answers are being provided.
1167     */
1168    @Child(name = "questionnaire", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1169    @Description(shortDefinition="Form being answered", formalDefinition="The Questionnaire that defines and organizes the questions for which answers are being provided." )
1170    protected CanonicalType questionnaire;
1171
1172    /**
1173     * The position of the questionnaire response within its overall lifecycle.
1174     */
1175    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
1176    @Description(shortDefinition="in-progress | completed | amended | entered-in-error | stopped", formalDefinition="The position of the questionnaire response within its overall lifecycle." )
1177    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers-status")
1178    protected Enumeration<QuestionnaireResponseStatus> status;
1179
1180    /**
1181     * The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.
1182     */
1183    @Child(name = "subject", type = {Reference.class}, order=5, min=0, max=1, modifier=false, summary=true)
1184    @Description(shortDefinition="The subject of the questions", formalDefinition="The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information." )
1185    protected Reference subject;
1186
1187    /**
1188     * The actual object that is the target of the reference (The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.)
1189     */
1190    protected Resource subjectTarget;
1191
1192    /**
1193     * The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.
1194     */
1195    @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=true)
1196    @Description(shortDefinition="Encounter created as part of", formalDefinition="The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated." )
1197    protected Reference encounter;
1198
1199    /**
1200     * The actual object that is the target of the reference (The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.)
1201     */
1202    protected Encounter encounterTarget;
1203
1204    /**
1205     * The date and/or time that this set of answers were last changed.
1206     */
1207    @Child(name = "authored", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1208    @Description(shortDefinition="Date the answers were gathered", formalDefinition="The date and/or time that this set of answers were last changed." )
1209    protected DateTimeType authored;
1210
1211    /**
1212     * Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.
1213     */
1214    @Child(name = "author", type = {Device.class, Practitioner.class, PractitionerRole.class, Patient.class, RelatedPerson.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=true)
1215    @Description(shortDefinition="Person who received and recorded the answers", formalDefinition="Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system." )
1216    protected Reference author;
1217
1218    /**
1219     * The actual object that is the target of the reference (Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.)
1220     */
1221    protected Resource authorTarget;
1222
1223    /**
1224     * The person who answered the questions about the subject.
1225     */
1226    @Child(name = "source", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=9, min=0, max=1, modifier=false, summary=true)
1227    @Description(shortDefinition="The person who answered the questions", formalDefinition="The person who answered the questions about the subject." )
1228    protected Reference source;
1229
1230    /**
1231     * The actual object that is the target of the reference (The person who answered the questions about the subject.)
1232     */
1233    protected Resource sourceTarget;
1234
1235    /**
1236     * A group or question item from the original questionnaire for which answers are provided.
1237     */
1238    @Child(name = "item", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1239    @Description(shortDefinition="Groups and questions", formalDefinition="A group or question item from the original questionnaire for which answers are provided." )
1240    protected List<QuestionnaireResponseItemComponent> item;
1241
1242    private static final long serialVersionUID = -259908687L;
1243
1244  /**
1245   * Constructor
1246   */
1247    public QuestionnaireResponse() {
1248      super();
1249    }
1250
1251  /**
1252   * Constructor
1253   */
1254    public QuestionnaireResponse(Enumeration<QuestionnaireResponseStatus> status) {
1255      super();
1256      this.status = status;
1257    }
1258
1259    /**
1260     * @return {@link #identifier} (A business identifier assigned to a particular completed (or partially completed) questionnaire.)
1261     */
1262    public Identifier getIdentifier() { 
1263      if (this.identifier == null)
1264        if (Configuration.errorOnAutoCreate())
1265          throw new Error("Attempt to auto-create QuestionnaireResponse.identifier");
1266        else if (Configuration.doAutoCreate())
1267          this.identifier = new Identifier(); // cc
1268      return this.identifier;
1269    }
1270
1271    public boolean hasIdentifier() { 
1272      return this.identifier != null && !this.identifier.isEmpty();
1273    }
1274
1275    /**
1276     * @param value {@link #identifier} (A business identifier assigned to a particular completed (or partially completed) questionnaire.)
1277     */
1278    public QuestionnaireResponse setIdentifier(Identifier value) { 
1279      this.identifier = value;
1280      return this;
1281    }
1282
1283    /**
1284     * @return {@link #basedOn} (The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.)
1285     */
1286    public List<Reference> getBasedOn() { 
1287      if (this.basedOn == null)
1288        this.basedOn = new ArrayList<Reference>();
1289      return this.basedOn;
1290    }
1291
1292    /**
1293     * @return Returns a reference to <code>this</code> for easy method chaining
1294     */
1295    public QuestionnaireResponse setBasedOn(List<Reference> theBasedOn) { 
1296      this.basedOn = theBasedOn;
1297      return this;
1298    }
1299
1300    public boolean hasBasedOn() { 
1301      if (this.basedOn == null)
1302        return false;
1303      for (Reference item : this.basedOn)
1304        if (!item.isEmpty())
1305          return true;
1306      return false;
1307    }
1308
1309    public Reference addBasedOn() { //3
1310      Reference t = new Reference();
1311      if (this.basedOn == null)
1312        this.basedOn = new ArrayList<Reference>();
1313      this.basedOn.add(t);
1314      return t;
1315    }
1316
1317    public QuestionnaireResponse addBasedOn(Reference t) { //3
1318      if (t == null)
1319        return this;
1320      if (this.basedOn == null)
1321        this.basedOn = new ArrayList<Reference>();
1322      this.basedOn.add(t);
1323      return this;
1324    }
1325
1326    /**
1327     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
1328     */
1329    public Reference getBasedOnFirstRep() { 
1330      if (getBasedOn().isEmpty()) {
1331        addBasedOn();
1332      }
1333      return getBasedOn().get(0);
1334    }
1335
1336    /**
1337     * @deprecated Use Reference#setResource(IBaseResource) instead
1338     */
1339    @Deprecated
1340    public List<Resource> getBasedOnTarget() { 
1341      if (this.basedOnTarget == null)
1342        this.basedOnTarget = new ArrayList<Resource>();
1343      return this.basedOnTarget;
1344    }
1345
1346    /**
1347     * @return {@link #partOf} (A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.)
1348     */
1349    public List<Reference> getPartOf() { 
1350      if (this.partOf == null)
1351        this.partOf = new ArrayList<Reference>();
1352      return this.partOf;
1353    }
1354
1355    /**
1356     * @return Returns a reference to <code>this</code> for easy method chaining
1357     */
1358    public QuestionnaireResponse setPartOf(List<Reference> thePartOf) { 
1359      this.partOf = thePartOf;
1360      return this;
1361    }
1362
1363    public boolean hasPartOf() { 
1364      if (this.partOf == null)
1365        return false;
1366      for (Reference item : this.partOf)
1367        if (!item.isEmpty())
1368          return true;
1369      return false;
1370    }
1371
1372    public Reference addPartOf() { //3
1373      Reference t = new Reference();
1374      if (this.partOf == null)
1375        this.partOf = new ArrayList<Reference>();
1376      this.partOf.add(t);
1377      return t;
1378    }
1379
1380    public QuestionnaireResponse addPartOf(Reference t) { //3
1381      if (t == null)
1382        return this;
1383      if (this.partOf == null)
1384        this.partOf = new ArrayList<Reference>();
1385      this.partOf.add(t);
1386      return this;
1387    }
1388
1389    /**
1390     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist
1391     */
1392    public Reference getPartOfFirstRep() { 
1393      if (getPartOf().isEmpty()) {
1394        addPartOf();
1395      }
1396      return getPartOf().get(0);
1397    }
1398
1399    /**
1400     * @deprecated Use Reference#setResource(IBaseResource) instead
1401     */
1402    @Deprecated
1403    public List<Resource> getPartOfTarget() { 
1404      if (this.partOfTarget == null)
1405        this.partOfTarget = new ArrayList<Resource>();
1406      return this.partOfTarget;
1407    }
1408
1409    /**
1410     * @return {@link #questionnaire} (The Questionnaire that defines and organizes the questions for which answers are being provided.). This is the underlying object with id, value and extensions. The accessor "getQuestionnaire" gives direct access to the value
1411     */
1412    public CanonicalType getQuestionnaireElement() { 
1413      if (this.questionnaire == null)
1414        if (Configuration.errorOnAutoCreate())
1415          throw new Error("Attempt to auto-create QuestionnaireResponse.questionnaire");
1416        else if (Configuration.doAutoCreate())
1417          this.questionnaire = new CanonicalType(); // bb
1418      return this.questionnaire;
1419    }
1420
1421    public boolean hasQuestionnaireElement() { 
1422      return this.questionnaire != null && !this.questionnaire.isEmpty();
1423    }
1424
1425    public boolean hasQuestionnaire() { 
1426      return this.questionnaire != null && !this.questionnaire.isEmpty();
1427    }
1428
1429    /**
1430     * @param value {@link #questionnaire} (The Questionnaire that defines and organizes the questions for which answers are being provided.). This is the underlying object with id, value and extensions. The accessor "getQuestionnaire" gives direct access to the value
1431     */
1432    public QuestionnaireResponse setQuestionnaireElement(CanonicalType value) { 
1433      this.questionnaire = value;
1434      return this;
1435    }
1436
1437    /**
1438     * @return The Questionnaire that defines and organizes the questions for which answers are being provided.
1439     */
1440    public String getQuestionnaire() { 
1441      return this.questionnaire == null ? null : this.questionnaire.getValue();
1442    }
1443
1444    /**
1445     * @param value The Questionnaire that defines and organizes the questions for which answers are being provided.
1446     */
1447    public QuestionnaireResponse setQuestionnaire(String value) { 
1448      if (Utilities.noString(value))
1449        this.questionnaire = null;
1450      else {
1451        if (this.questionnaire == null)
1452          this.questionnaire = new CanonicalType();
1453        this.questionnaire.setValue(value);
1454      }
1455      return this;
1456    }
1457
1458    /**
1459     * @return {@link #status} (The position of the questionnaire response within its overall lifecycle.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1460     */
1461    public Enumeration<QuestionnaireResponseStatus> getStatusElement() { 
1462      if (this.status == null)
1463        if (Configuration.errorOnAutoCreate())
1464          throw new Error("Attempt to auto-create QuestionnaireResponse.status");
1465        else if (Configuration.doAutoCreate())
1466          this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory()); // bb
1467      return this.status;
1468    }
1469
1470    public boolean hasStatusElement() { 
1471      return this.status != null && !this.status.isEmpty();
1472    }
1473
1474    public boolean hasStatus() { 
1475      return this.status != null && !this.status.isEmpty();
1476    }
1477
1478    /**
1479     * @param value {@link #status} (The position of the questionnaire response within its overall lifecycle.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1480     */
1481    public QuestionnaireResponse setStatusElement(Enumeration<QuestionnaireResponseStatus> value) { 
1482      this.status = value;
1483      return this;
1484    }
1485
1486    /**
1487     * @return The position of the questionnaire response within its overall lifecycle.
1488     */
1489    public QuestionnaireResponseStatus getStatus() { 
1490      return this.status == null ? null : this.status.getValue();
1491    }
1492
1493    /**
1494     * @param value The position of the questionnaire response within its overall lifecycle.
1495     */
1496    public QuestionnaireResponse setStatus(QuestionnaireResponseStatus value) { 
1497        if (this.status == null)
1498          this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory());
1499        this.status.setValue(value);
1500      return this;
1501    }
1502
1503    /**
1504     * @return {@link #subject} (The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.)
1505     */
1506    public Reference getSubject() { 
1507      if (this.subject == null)
1508        if (Configuration.errorOnAutoCreate())
1509          throw new Error("Attempt to auto-create QuestionnaireResponse.subject");
1510        else if (Configuration.doAutoCreate())
1511          this.subject = new Reference(); // cc
1512      return this.subject;
1513    }
1514
1515    public boolean hasSubject() { 
1516      return this.subject != null && !this.subject.isEmpty();
1517    }
1518
1519    /**
1520     * @param value {@link #subject} (The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.)
1521     */
1522    public QuestionnaireResponse setSubject(Reference value) { 
1523      this.subject = value;
1524      return this;
1525    }
1526
1527    /**
1528     * @return {@link #subject} 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 subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.)
1529     */
1530    public Resource getSubjectTarget() { 
1531      return this.subjectTarget;
1532    }
1533
1534    /**
1535     * @param value {@link #subject} 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 subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.)
1536     */
1537    public QuestionnaireResponse setSubjectTarget(Resource value) { 
1538      this.subjectTarget = value;
1539      return this;
1540    }
1541
1542    /**
1543     * @return {@link #encounter} (The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.)
1544     */
1545    public Reference getEncounter() { 
1546      if (this.encounter == null)
1547        if (Configuration.errorOnAutoCreate())
1548          throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1549        else if (Configuration.doAutoCreate())
1550          this.encounter = new Reference(); // cc
1551      return this.encounter;
1552    }
1553
1554    public boolean hasEncounter() { 
1555      return this.encounter != null && !this.encounter.isEmpty();
1556    }
1557
1558    /**
1559     * @param value {@link #encounter} (The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.)
1560     */
1561    public QuestionnaireResponse setEncounter(Reference value) { 
1562      this.encounter = value;
1563      return this;
1564    }
1565
1566    /**
1567     * @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. (The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.)
1568     */
1569    public Encounter getEncounterTarget() { 
1570      if (this.encounterTarget == null)
1571        if (Configuration.errorOnAutoCreate())
1572          throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1573        else if (Configuration.doAutoCreate())
1574          this.encounterTarget = new Encounter(); // aa
1575      return this.encounterTarget;
1576    }
1577
1578    /**
1579     * @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. (The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.)
1580     */
1581    public QuestionnaireResponse setEncounterTarget(Encounter value) { 
1582      this.encounterTarget = value;
1583      return this;
1584    }
1585
1586    /**
1587     * @return {@link #authored} (The date and/or time that this set of answers were last changed.). This is the underlying object with id, value and extensions. The accessor "getAuthored" gives direct access to the value
1588     */
1589    public DateTimeType getAuthoredElement() { 
1590      if (this.authored == null)
1591        if (Configuration.errorOnAutoCreate())
1592          throw new Error("Attempt to auto-create QuestionnaireResponse.authored");
1593        else if (Configuration.doAutoCreate())
1594          this.authored = new DateTimeType(); // bb
1595      return this.authored;
1596    }
1597
1598    public boolean hasAuthoredElement() { 
1599      return this.authored != null && !this.authored.isEmpty();
1600    }
1601
1602    public boolean hasAuthored() { 
1603      return this.authored != null && !this.authored.isEmpty();
1604    }
1605
1606    /**
1607     * @param value {@link #authored} (The date and/or time that this set of answers were last changed.). This is the underlying object with id, value and extensions. The accessor "getAuthored" gives direct access to the value
1608     */
1609    public QuestionnaireResponse setAuthoredElement(DateTimeType value) { 
1610      this.authored = value;
1611      return this;
1612    }
1613
1614    /**
1615     * @return The date and/or time that this set of answers were last changed.
1616     */
1617    public Date getAuthored() { 
1618      return this.authored == null ? null : this.authored.getValue();
1619    }
1620
1621    /**
1622     * @param value The date and/or time that this set of answers were last changed.
1623     */
1624    public QuestionnaireResponse setAuthored(Date value) { 
1625      if (value == null)
1626        this.authored = null;
1627      else {
1628        if (this.authored == null)
1629          this.authored = new DateTimeType();
1630        this.authored.setValue(value);
1631      }
1632      return this;
1633    }
1634
1635    /**
1636     * @return {@link #author} (Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.)
1637     */
1638    public Reference getAuthor() { 
1639      if (this.author == null)
1640        if (Configuration.errorOnAutoCreate())
1641          throw new Error("Attempt to auto-create QuestionnaireResponse.author");
1642        else if (Configuration.doAutoCreate())
1643          this.author = new Reference(); // cc
1644      return this.author;
1645    }
1646
1647    public boolean hasAuthor() { 
1648      return this.author != null && !this.author.isEmpty();
1649    }
1650
1651    /**
1652     * @param value {@link #author} (Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.)
1653     */
1654    public QuestionnaireResponse setAuthor(Reference value) { 
1655      this.author = value;
1656      return this;
1657    }
1658
1659    /**
1660     * @return {@link #author} 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. (Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.)
1661     */
1662    public Resource getAuthorTarget() { 
1663      return this.authorTarget;
1664    }
1665
1666    /**
1667     * @param value {@link #author} 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. (Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.)
1668     */
1669    public QuestionnaireResponse setAuthorTarget(Resource value) { 
1670      this.authorTarget = value;
1671      return this;
1672    }
1673
1674    /**
1675     * @return {@link #source} (The person who answered the questions about the subject.)
1676     */
1677    public Reference getSource() { 
1678      if (this.source == null)
1679        if (Configuration.errorOnAutoCreate())
1680          throw new Error("Attempt to auto-create QuestionnaireResponse.source");
1681        else if (Configuration.doAutoCreate())
1682          this.source = new Reference(); // cc
1683      return this.source;
1684    }
1685
1686    public boolean hasSource() { 
1687      return this.source != null && !this.source.isEmpty();
1688    }
1689
1690    /**
1691     * @param value {@link #source} (The person who answered the questions about the subject.)
1692     */
1693    public QuestionnaireResponse setSource(Reference value) { 
1694      this.source = value;
1695      return this;
1696    }
1697
1698    /**
1699     * @return {@link #source} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person who answered the questions about the subject.)
1700     */
1701    public Resource getSourceTarget() { 
1702      return this.sourceTarget;
1703    }
1704
1705    /**
1706     * @param value {@link #source} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person who answered the questions about the subject.)
1707     */
1708    public QuestionnaireResponse setSourceTarget(Resource value) { 
1709      this.sourceTarget = value;
1710      return this;
1711    }
1712
1713    /**
1714     * @return {@link #item} (A group or question item from the original questionnaire for which answers are provided.)
1715     */
1716    public List<QuestionnaireResponseItemComponent> getItem() { 
1717      if (this.item == null)
1718        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1719      return this.item;
1720    }
1721
1722    /**
1723     * @return Returns a reference to <code>this</code> for easy method chaining
1724     */
1725    public QuestionnaireResponse setItem(List<QuestionnaireResponseItemComponent> theItem) { 
1726      this.item = theItem;
1727      return this;
1728    }
1729
1730    public boolean hasItem() { 
1731      if (this.item == null)
1732        return false;
1733      for (QuestionnaireResponseItemComponent item : this.item)
1734        if (!item.isEmpty())
1735          return true;
1736      return false;
1737    }
1738
1739    public QuestionnaireResponseItemComponent addItem() { //3
1740      QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
1741      if (this.item == null)
1742        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1743      this.item.add(t);
1744      return t;
1745    }
1746
1747    public QuestionnaireResponse addItem(QuestionnaireResponseItemComponent t) { //3
1748      if (t == null)
1749        return this;
1750      if (this.item == null)
1751        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1752      this.item.add(t);
1753      return this;
1754    }
1755
1756    /**
1757     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
1758     */
1759    public QuestionnaireResponseItemComponent getItemFirstRep() { 
1760      if (getItem().isEmpty()) {
1761        addItem();
1762      }
1763      return getItem().get(0);
1764    }
1765
1766      protected void listChildren(List<Property> children) {
1767        super.listChildren(children);
1768        children.add(new Property("identifier", "Identifier", "A business identifier assigned to a particular completed (or partially completed) questionnaire.", 0, 1, identifier));
1769        children.add(new Property("basedOn", "Reference(CarePlan|ServiceRequest)", "The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1770        children.add(new Property("partOf", "Reference(Observation|Procedure)", "A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.", 0, java.lang.Integer.MAX_VALUE, partOf));
1771        children.add(new Property("questionnaire", "canonical(Questionnaire)", "The Questionnaire that defines and organizes the questions for which answers are being provided.", 0, 1, questionnaire));
1772        children.add(new Property("status", "code", "The position of the questionnaire response within its overall lifecycle.", 0, 1, status));
1773        children.add(new Property("subject", "Reference(Any)", "The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.", 0, 1, subject));
1774        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.", 0, 1, encounter));
1775        children.add(new Property("authored", "dateTime", "The date and/or time that this set of answers were last changed.", 0, 1, authored));
1776        children.add(new Property("author", "Reference(Device|Practitioner|PractitionerRole|Patient|RelatedPerson|Organization)", "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.", 0, 1, author));
1777        children.add(new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "The person who answered the questions about the subject.", 0, 1, source));
1778        children.add(new Property("item", "", "A group or question item from the original questionnaire for which answers are provided.", 0, java.lang.Integer.MAX_VALUE, item));
1779      }
1780
1781      @Override
1782      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1783        switch (_hash) {
1784        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A business identifier assigned to a particular completed (or partially completed) questionnaire.", 0, 1, identifier);
1785        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|ServiceRequest)", "The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.", 0, java.lang.Integer.MAX_VALUE, basedOn);
1786        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Observation|Procedure)", "A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.", 0, java.lang.Integer.MAX_VALUE, partOf);
1787        case -1017049693: /*questionnaire*/  return new Property("questionnaire", "canonical(Questionnaire)", "The Questionnaire that defines and organizes the questions for which answers are being provided.", 0, 1, questionnaire);
1788        case -892481550: /*status*/  return new Property("status", "code", "The position of the questionnaire response within its overall lifecycle.", 0, 1, status);
1789        case -1867885268: /*subject*/  return new Property("subject", "Reference(Any)", "The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.", 0, 1, subject);
1790        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.", 0, 1, encounter);
1791        case 1433073514: /*authored*/  return new Property("authored", "dateTime", "The date and/or time that this set of answers were last changed.", 0, 1, authored);
1792        case -1406328437: /*author*/  return new Property("author", "Reference(Device|Practitioner|PractitionerRole|Patient|RelatedPerson|Organization)", "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.", 0, 1, author);
1793        case -896505829: /*source*/  return new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "The person who answered the questions about the subject.", 0, 1, source);
1794        case 3242771: /*item*/  return new Property("item", "", "A group or question item from the original questionnaire for which answers are provided.", 0, java.lang.Integer.MAX_VALUE, item);
1795        default: return super.getNamedProperty(_hash, _name, _checkValid);
1796        }
1797
1798      }
1799
1800      @Override
1801      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1802        switch (hash) {
1803        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1804        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
1805        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
1806        case -1017049693: /*questionnaire*/ return this.questionnaire == null ? new Base[0] : new Base[] {this.questionnaire}; // CanonicalType
1807        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<QuestionnaireResponseStatus>
1808        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1809        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1810        case 1433073514: /*authored*/ return this.authored == null ? new Base[0] : new Base[] {this.authored}; // DateTimeType
1811        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
1812        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Reference
1813        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
1814        default: return super.getProperty(hash, name, checkValid);
1815        }
1816
1817      }
1818
1819      @Override
1820      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1821        switch (hash) {
1822        case -1618432855: // identifier
1823          this.identifier = castToIdentifier(value); // Identifier
1824          return value;
1825        case -332612366: // basedOn
1826          this.getBasedOn().add(castToReference(value)); // Reference
1827          return value;
1828        case -995410646: // partOf
1829          this.getPartOf().add(castToReference(value)); // Reference
1830          return value;
1831        case -1017049693: // questionnaire
1832          this.questionnaire = castToCanonical(value); // CanonicalType
1833          return value;
1834        case -892481550: // status
1835          value = new QuestionnaireResponseStatusEnumFactory().fromType(castToCode(value));
1836          this.status = (Enumeration) value; // Enumeration<QuestionnaireResponseStatus>
1837          return value;
1838        case -1867885268: // subject
1839          this.subject = castToReference(value); // Reference
1840          return value;
1841        case 1524132147: // encounter
1842          this.encounter = castToReference(value); // Reference
1843          return value;
1844        case 1433073514: // authored
1845          this.authored = castToDateTime(value); // DateTimeType
1846          return value;
1847        case -1406328437: // author
1848          this.author = castToReference(value); // Reference
1849          return value;
1850        case -896505829: // source
1851          this.source = castToReference(value); // Reference
1852          return value;
1853        case 3242771: // item
1854          this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
1855          return value;
1856        default: return super.setProperty(hash, name, value);
1857        }
1858
1859      }
1860
1861      @Override
1862      public Base setProperty(String name, Base value) throws FHIRException {
1863        if (name.equals("identifier")) {
1864          this.identifier = castToIdentifier(value); // Identifier
1865        } else if (name.equals("basedOn")) {
1866          this.getBasedOn().add(castToReference(value));
1867        } else if (name.equals("partOf")) {
1868          this.getPartOf().add(castToReference(value));
1869        } else if (name.equals("questionnaire")) {
1870          this.questionnaire = castToCanonical(value); // CanonicalType
1871        } else if (name.equals("status")) {
1872          value = new QuestionnaireResponseStatusEnumFactory().fromType(castToCode(value));
1873          this.status = (Enumeration) value; // Enumeration<QuestionnaireResponseStatus>
1874        } else if (name.equals("subject")) {
1875          this.subject = castToReference(value); // Reference
1876        } else if (name.equals("encounter")) {
1877          this.encounter = castToReference(value); // Reference
1878        } else if (name.equals("authored")) {
1879          this.authored = castToDateTime(value); // DateTimeType
1880        } else if (name.equals("author")) {
1881          this.author = castToReference(value); // Reference
1882        } else if (name.equals("source")) {
1883          this.source = castToReference(value); // Reference
1884        } else if (name.equals("item")) {
1885          this.getItem().add((QuestionnaireResponseItemComponent) value);
1886        } else
1887          return super.setProperty(name, value);
1888        return value;
1889      }
1890
1891      @Override
1892      public Base makeProperty(int hash, String name) throws FHIRException {
1893        switch (hash) {
1894        case -1618432855:  return getIdentifier(); 
1895        case -332612366:  return addBasedOn(); 
1896        case -995410646:  return addPartOf(); 
1897        case -1017049693:  return getQuestionnaireElement();
1898        case -892481550:  return getStatusElement();
1899        case -1867885268:  return getSubject(); 
1900        case 1524132147:  return getEncounter(); 
1901        case 1433073514:  return getAuthoredElement();
1902        case -1406328437:  return getAuthor(); 
1903        case -896505829:  return getSource(); 
1904        case 3242771:  return addItem(); 
1905        default: return super.makeProperty(hash, name);
1906        }
1907
1908      }
1909
1910      @Override
1911      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1912        switch (hash) {
1913        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1914        case -332612366: /*basedOn*/ return new String[] {"Reference"};
1915        case -995410646: /*partOf*/ return new String[] {"Reference"};
1916        case -1017049693: /*questionnaire*/ return new String[] {"canonical"};
1917        case -892481550: /*status*/ return new String[] {"code"};
1918        case -1867885268: /*subject*/ return new String[] {"Reference"};
1919        case 1524132147: /*encounter*/ return new String[] {"Reference"};
1920        case 1433073514: /*authored*/ return new String[] {"dateTime"};
1921        case -1406328437: /*author*/ return new String[] {"Reference"};
1922        case -896505829: /*source*/ return new String[] {"Reference"};
1923        case 3242771: /*item*/ return new String[] {};
1924        default: return super.getTypesForProperty(hash, name);
1925        }
1926
1927      }
1928
1929      @Override
1930      public Base addChild(String name) throws FHIRException {
1931        if (name.equals("identifier")) {
1932          this.identifier = new Identifier();
1933          return this.identifier;
1934        }
1935        else if (name.equals("basedOn")) {
1936          return addBasedOn();
1937        }
1938        else if (name.equals("partOf")) {
1939          return addPartOf();
1940        }
1941        else if (name.equals("questionnaire")) {
1942          throw new FHIRException("Cannot call addChild on a primitive type QuestionnaireResponse.questionnaire");
1943        }
1944        else if (name.equals("status")) {
1945          throw new FHIRException("Cannot call addChild on a primitive type QuestionnaireResponse.status");
1946        }
1947        else if (name.equals("subject")) {
1948          this.subject = new Reference();
1949          return this.subject;
1950        }
1951        else if (name.equals("encounter")) {
1952          this.encounter = new Reference();
1953          return this.encounter;
1954        }
1955        else if (name.equals("authored")) {
1956          throw new FHIRException("Cannot call addChild on a primitive type QuestionnaireResponse.authored");
1957        }
1958        else if (name.equals("author")) {
1959          this.author = new Reference();
1960          return this.author;
1961        }
1962        else if (name.equals("source")) {
1963          this.source = new Reference();
1964          return this.source;
1965        }
1966        else if (name.equals("item")) {
1967          return addItem();
1968        }
1969        else
1970          return super.addChild(name);
1971      }
1972
1973  public String fhirType() {
1974    return "QuestionnaireResponse";
1975
1976  }
1977
1978      public QuestionnaireResponse copy() {
1979        QuestionnaireResponse dst = new QuestionnaireResponse();
1980        copyValues(dst);
1981        dst.identifier = identifier == null ? null : identifier.copy();
1982        if (basedOn != null) {
1983          dst.basedOn = new ArrayList<Reference>();
1984          for (Reference i : basedOn)
1985            dst.basedOn.add(i.copy());
1986        };
1987        if (partOf != null) {
1988          dst.partOf = new ArrayList<Reference>();
1989          for (Reference i : partOf)
1990            dst.partOf.add(i.copy());
1991        };
1992        dst.questionnaire = questionnaire == null ? null : questionnaire.copy();
1993        dst.status = status == null ? null : status.copy();
1994        dst.subject = subject == null ? null : subject.copy();
1995        dst.encounter = encounter == null ? null : encounter.copy();
1996        dst.authored = authored == null ? null : authored.copy();
1997        dst.author = author == null ? null : author.copy();
1998        dst.source = source == null ? null : source.copy();
1999        if (item != null) {
2000          dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
2001          for (QuestionnaireResponseItemComponent i : item)
2002            dst.item.add(i.copy());
2003        };
2004        return dst;
2005      }
2006
2007      protected QuestionnaireResponse typedCopy() {
2008        return copy();
2009      }
2010
2011      @Override
2012      public boolean equalsDeep(Base other_) {
2013        if (!super.equalsDeep(other_))
2014          return false;
2015        if (!(other_ instanceof QuestionnaireResponse))
2016          return false;
2017        QuestionnaireResponse o = (QuestionnaireResponse) other_;
2018        return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(partOf, o.partOf, true)
2019           && compareDeep(questionnaire, o.questionnaire, true) && compareDeep(status, o.status, true) && compareDeep(subject, o.subject, true)
2020           && compareDeep(encounter, o.encounter, true) && compareDeep(authored, o.authored, true) && compareDeep(author, o.author, true)
2021           && compareDeep(source, o.source, true) && compareDeep(item, o.item, true);
2022      }
2023
2024      @Override
2025      public boolean equalsShallow(Base other_) {
2026        if (!super.equalsShallow(other_))
2027          return false;
2028        if (!(other_ instanceof QuestionnaireResponse))
2029          return false;
2030        QuestionnaireResponse o = (QuestionnaireResponse) other_;
2031        return compareValues(status, o.status, true) && compareValues(authored, o.authored, true);
2032      }
2033
2034      public boolean isEmpty() {
2035        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, partOf
2036          , questionnaire, status, subject, encounter, authored, author, source, item
2037          );
2038      }
2039
2040  @Override
2041  public ResourceType getResourceType() {
2042    return ResourceType.QuestionnaireResponse;
2043   }
2044
2045 /**
2046   * Search parameter: <b>authored</b>
2047   * <p>
2048   * Description: <b>When the questionnaire response was last changed</b><br>
2049   * Type: <b>date</b><br>
2050   * Path: <b>QuestionnaireResponse.authored</b><br>
2051   * </p>
2052   */
2053  @SearchParamDefinition(name="authored", path="QuestionnaireResponse.authored", description="When the questionnaire response was last changed", type="date" )
2054  public static final String SP_AUTHORED = "authored";
2055 /**
2056   * <b>Fluent Client</b> search parameter constant for <b>authored</b>
2057   * <p>
2058   * Description: <b>When the questionnaire response was last changed</b><br>
2059   * Type: <b>date</b><br>
2060   * Path: <b>QuestionnaireResponse.authored</b><br>
2061   * </p>
2062   */
2063  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED);
2064
2065 /**
2066   * Search parameter: <b>identifier</b>
2067   * <p>
2068   * Description: <b>The unique identifier for the questionnaire response</b><br>
2069   * Type: <b>token</b><br>
2070   * Path: <b>QuestionnaireResponse.identifier</b><br>
2071   * </p>
2072   */
2073  @SearchParamDefinition(name="identifier", path="QuestionnaireResponse.identifier", description="The unique identifier for the questionnaire response", type="token" )
2074  public static final String SP_IDENTIFIER = "identifier";
2075 /**
2076   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2077   * <p>
2078   * Description: <b>The unique identifier for the questionnaire response</b><br>
2079   * Type: <b>token</b><br>
2080   * Path: <b>QuestionnaireResponse.identifier</b><br>
2081   * </p>
2082   */
2083  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2084
2085 /**
2086   * Search parameter: <b>questionnaire</b>
2087   * <p>
2088   * Description: <b>The questionnaire the answers are provided for</b><br>
2089   * Type: <b>reference</b><br>
2090   * Path: <b>QuestionnaireResponse.questionnaire</b><br>
2091   * </p>
2092   */
2093  @SearchParamDefinition(name="questionnaire", path="QuestionnaireResponse.questionnaire", description="The questionnaire the answers are provided for", type="reference", target={Questionnaire.class } )
2094  public static final String SP_QUESTIONNAIRE = "questionnaire";
2095 /**
2096   * <b>Fluent Client</b> search parameter constant for <b>questionnaire</b>
2097   * <p>
2098   * Description: <b>The questionnaire the answers are provided for</b><br>
2099   * Type: <b>reference</b><br>
2100   * Path: <b>QuestionnaireResponse.questionnaire</b><br>
2101   * </p>
2102   */
2103  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam QUESTIONNAIRE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_QUESTIONNAIRE);
2104
2105/**
2106   * Constant for fluent queries to be used to add include statements. Specifies
2107   * the path value of "<b>QuestionnaireResponse:questionnaire</b>".
2108   */
2109  public static final ca.uhn.fhir.model.api.Include INCLUDE_QUESTIONNAIRE = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:questionnaire").toLocked();
2110
2111 /**
2112   * Search parameter: <b>based-on</b>
2113   * <p>
2114   * Description: <b>Plan/proposal/order fulfilled by this questionnaire response</b><br>
2115   * Type: <b>reference</b><br>
2116   * Path: <b>QuestionnaireResponse.basedOn</b><br>
2117   * </p>
2118   */
2119  @SearchParamDefinition(name="based-on", path="QuestionnaireResponse.basedOn", description="Plan/proposal/order fulfilled by this questionnaire response", type="reference", target={CarePlan.class, ServiceRequest.class } )
2120  public static final String SP_BASED_ON = "based-on";
2121 /**
2122   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2123   * <p>
2124   * Description: <b>Plan/proposal/order fulfilled by this questionnaire response</b><br>
2125   * Type: <b>reference</b><br>
2126   * Path: <b>QuestionnaireResponse.basedOn</b><br>
2127   * </p>
2128   */
2129  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2130
2131/**
2132   * Constant for fluent queries to be used to add include statements. Specifies
2133   * the path value of "<b>QuestionnaireResponse:based-on</b>".
2134   */
2135  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:based-on").toLocked();
2136
2137 /**
2138   * Search parameter: <b>subject</b>
2139   * <p>
2140   * Description: <b>The subject of the questionnaire response</b><br>
2141   * Type: <b>reference</b><br>
2142   * Path: <b>QuestionnaireResponse.subject</b><br>
2143   * </p>
2144   */
2145  @SearchParamDefinition(name="subject", path="QuestionnaireResponse.subject", description="The subject of the questionnaire response", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") } )
2146  public static final String SP_SUBJECT = "subject";
2147 /**
2148   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2149   * <p>
2150   * Description: <b>The subject of the questionnaire response</b><br>
2151   * Type: <b>reference</b><br>
2152   * Path: <b>QuestionnaireResponse.subject</b><br>
2153   * </p>
2154   */
2155  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2156
2157/**
2158   * Constant for fluent queries to be used to add include statements. Specifies
2159   * the path value of "<b>QuestionnaireResponse:subject</b>".
2160   */
2161  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:subject").toLocked();
2162
2163 /**
2164   * Search parameter: <b>author</b>
2165   * <p>
2166   * Description: <b>The author of the questionnaire response</b><br>
2167   * Type: <b>reference</b><br>
2168   * Path: <b>QuestionnaireResponse.author</b><br>
2169   * </p>
2170   */
2171  @SearchParamDefinition(name="author", path="QuestionnaireResponse.author", description="The author of the questionnaire response", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2172  public static final String SP_AUTHOR = "author";
2173 /**
2174   * <b>Fluent Client</b> search parameter constant for <b>author</b>
2175   * <p>
2176   * Description: <b>The author of the questionnaire response</b><br>
2177   * Type: <b>reference</b><br>
2178   * Path: <b>QuestionnaireResponse.author</b><br>
2179   * </p>
2180   */
2181  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
2182
2183/**
2184   * Constant for fluent queries to be used to add include statements. Specifies
2185   * the path value of "<b>QuestionnaireResponse:author</b>".
2186   */
2187  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:author").toLocked();
2188
2189 /**
2190   * Search parameter: <b>patient</b>
2191   * <p>
2192   * Description: <b>The patient that is the subject of the questionnaire response</b><br>
2193   * Type: <b>reference</b><br>
2194   * Path: <b>QuestionnaireResponse.subject</b><br>
2195   * </p>
2196   */
2197  @SearchParamDefinition(name="patient", path="QuestionnaireResponse.subject.where(resolve() is Patient)", description="The patient that is the subject of the questionnaire response", type="reference", target={Patient.class } )
2198  public static final String SP_PATIENT = "patient";
2199 /**
2200   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2201   * <p>
2202   * Description: <b>The patient that is the subject of the questionnaire response</b><br>
2203   * Type: <b>reference</b><br>
2204   * Path: <b>QuestionnaireResponse.subject</b><br>
2205   * </p>
2206   */
2207  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2208
2209/**
2210   * Constant for fluent queries to be used to add include statements. Specifies
2211   * the path value of "<b>QuestionnaireResponse:patient</b>".
2212   */
2213  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:patient").toLocked();
2214
2215 /**
2216   * Search parameter: <b>part-of</b>
2217   * <p>
2218   * Description: <b>Procedure or observation this questionnaire response was performed as a part of</b><br>
2219   * Type: <b>reference</b><br>
2220   * Path: <b>QuestionnaireResponse.partOf</b><br>
2221   * </p>
2222   */
2223  @SearchParamDefinition(name="part-of", path="QuestionnaireResponse.partOf", description="Procedure or observation this questionnaire response was performed as a part of", type="reference", target={Observation.class, Procedure.class } )
2224  public static final String SP_PART_OF = "part-of";
2225 /**
2226   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
2227   * <p>
2228   * Description: <b>Procedure or observation this questionnaire response was performed as a part of</b><br>
2229   * Type: <b>reference</b><br>
2230   * Path: <b>QuestionnaireResponse.partOf</b><br>
2231   * </p>
2232   */
2233  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
2234
2235/**
2236   * Constant for fluent queries to be used to add include statements. Specifies
2237   * the path value of "<b>QuestionnaireResponse:part-of</b>".
2238   */
2239  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:part-of").toLocked();
2240
2241 /**
2242   * Search parameter: <b>encounter</b>
2243   * <p>
2244   * Description: <b>Encounter associated with the questionnaire response</b><br>
2245   * Type: <b>reference</b><br>
2246   * Path: <b>QuestionnaireResponse.encounter</b><br>
2247   * </p>
2248   */
2249  @SearchParamDefinition(name="encounter", path="QuestionnaireResponse.encounter", description="Encounter associated with the questionnaire response", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
2250  public static final String SP_ENCOUNTER = "encounter";
2251 /**
2252   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2253   * <p>
2254   * Description: <b>Encounter associated with the questionnaire response</b><br>
2255   * Type: <b>reference</b><br>
2256   * Path: <b>QuestionnaireResponse.encounter</b><br>
2257   * </p>
2258   */
2259  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2260
2261/**
2262   * Constant for fluent queries to be used to add include statements. Specifies
2263   * the path value of "<b>QuestionnaireResponse:encounter</b>".
2264   */
2265  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:encounter").toLocked();
2266
2267 /**
2268   * Search parameter: <b>source</b>
2269   * <p>
2270   * Description: <b>The individual providing the information reflected in the questionnaire respose</b><br>
2271   * Type: <b>reference</b><br>
2272   * Path: <b>QuestionnaireResponse.source</b><br>
2273   * </p>
2274   */
2275  @SearchParamDefinition(name="source", path="QuestionnaireResponse.source", description="The individual providing the information reflected in the questionnaire respose", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2276  public static final String SP_SOURCE = "source";
2277 /**
2278   * <b>Fluent Client</b> search parameter constant for <b>source</b>
2279   * <p>
2280   * Description: <b>The individual providing the information reflected in the questionnaire respose</b><br>
2281   * Type: <b>reference</b><br>
2282   * Path: <b>QuestionnaireResponse.source</b><br>
2283   * </p>
2284   */
2285  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE);
2286
2287/**
2288   * Constant for fluent queries to be used to add include statements. Specifies
2289   * the path value of "<b>QuestionnaireResponse:source</b>".
2290   */
2291  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("QuestionnaireResponse:source").toLocked();
2292
2293 /**
2294   * Search parameter: <b>status</b>
2295   * <p>
2296   * Description: <b>The status of the questionnaire response</b><br>
2297   * Type: <b>token</b><br>
2298   * Path: <b>QuestionnaireResponse.status</b><br>
2299   * </p>
2300   */
2301  @SearchParamDefinition(name="status", path="QuestionnaireResponse.status", description="The status of the questionnaire response", type="token" )
2302  public static final String SP_STATUS = "status";
2303 /**
2304   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2305   * <p>
2306   * Description: <b>The status of the questionnaire response</b><br>
2307   * Type: <b>token</b><br>
2308   * Path: <b>QuestionnaireResponse.status</b><br>
2309   * </p>
2310   */
2311  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2312
2313
2314}
2315