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