001package org.hl7.fhir.dstu3.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.ArrayList;
036import java.util.List;
037
038import org.hl7.fhir.exceptions.FHIRException;
039import org.hl7.fhir.exceptions.FHIRFormatError;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041
042import ca.uhn.fhir.model.api.annotation.Block;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047/**
048 * An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.
049 */
050@ResourceDef(name="Procedure", profile="http://hl7.org/fhir/Profile/Procedure")
051public class Procedure extends DomainResource {
052
053    public enum ProcedureStatus {
054        /**
055         * The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation).  Preparation stages may be tracked for billing purposes.
056         */
057        PREPARATION, 
058        /**
059         * The event is currently occurring
060         */
061        INPROGRESS, 
062        /**
063         * The event has been temporarily stopped but is expected to resume in the future
064         */
065        SUSPENDED, 
066        /**
067         * The event was  prior to the full completion of the intended actions
068         */
069        ABORTED, 
070        /**
071         * The event has now concluded
072         */
073        COMPLETED, 
074        /**
075         * This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".)
076         */
077        ENTEREDINERROR, 
078        /**
079         * The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known which one.
080         */
081        UNKNOWN, 
082        /**
083         * added to help the parsers with the generic types
084         */
085        NULL;
086        public static ProcedureStatus fromCode(String codeString) throws FHIRException {
087            if (codeString == null || "".equals(codeString))
088                return null;
089        if ("preparation".equals(codeString))
090          return PREPARATION;
091        if ("in-progress".equals(codeString))
092          return INPROGRESS;
093        if ("suspended".equals(codeString))
094          return SUSPENDED;
095        if ("aborted".equals(codeString))
096          return ABORTED;
097        if ("completed".equals(codeString))
098          return COMPLETED;
099        if ("entered-in-error".equals(codeString))
100          return ENTEREDINERROR;
101        if ("unknown".equals(codeString))
102          return UNKNOWN;
103        if (Configuration.isAcceptInvalidEnums())
104          return null;
105        else
106          throw new FHIRException("Unknown ProcedureStatus code '"+codeString+"'");
107        }
108        public String toCode() {
109          switch (this) {
110            case PREPARATION: return "preparation";
111            case INPROGRESS: return "in-progress";
112            case SUSPENDED: return "suspended";
113            case ABORTED: return "aborted";
114            case COMPLETED: return "completed";
115            case ENTEREDINERROR: return "entered-in-error";
116            case UNKNOWN: return "unknown";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getSystem() {
122          switch (this) {
123            case PREPARATION: return "http://hl7.org/fhir/event-status";
124            case INPROGRESS: return "http://hl7.org/fhir/event-status";
125            case SUSPENDED: return "http://hl7.org/fhir/event-status";
126            case ABORTED: return "http://hl7.org/fhir/event-status";
127            case COMPLETED: return "http://hl7.org/fhir/event-status";
128            case ENTEREDINERROR: return "http://hl7.org/fhir/event-status";
129            case UNKNOWN: return "http://hl7.org/fhir/event-status";
130            case NULL: return null;
131            default: return "?";
132          }
133        }
134        public String getDefinition() {
135          switch (this) {
136            case PREPARATION: return "The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation).  Preparation stages may be tracked for billing purposes.";
137            case INPROGRESS: return "The event is currently occurring";
138            case SUSPENDED: return "The event has been temporarily stopped but is expected to resume in the future";
139            case ABORTED: return "The event was  prior to the full completion of the intended actions";
140            case COMPLETED: return "The event has now concluded";
141            case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".)";
142            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just not known which one.";
143            case NULL: return null;
144            default: return "?";
145          }
146        }
147        public String getDisplay() {
148          switch (this) {
149            case PREPARATION: return "Preparation";
150            case INPROGRESS: return "In Progress";
151            case SUSPENDED: return "Suspended";
152            case ABORTED: return "Aborted";
153            case COMPLETED: return "Completed";
154            case ENTEREDINERROR: return "Entered in Error";
155            case UNKNOWN: return "Unknown";
156            case NULL: return null;
157            default: return "?";
158          }
159        }
160    }
161
162  public static class ProcedureStatusEnumFactory implements EnumFactory<ProcedureStatus> {
163    public ProcedureStatus fromCode(String codeString) throws IllegalArgumentException {
164      if (codeString == null || "".equals(codeString))
165            if (codeString == null || "".equals(codeString))
166                return null;
167        if ("preparation".equals(codeString))
168          return ProcedureStatus.PREPARATION;
169        if ("in-progress".equals(codeString))
170          return ProcedureStatus.INPROGRESS;
171        if ("suspended".equals(codeString))
172          return ProcedureStatus.SUSPENDED;
173        if ("aborted".equals(codeString))
174          return ProcedureStatus.ABORTED;
175        if ("completed".equals(codeString))
176          return ProcedureStatus.COMPLETED;
177        if ("entered-in-error".equals(codeString))
178          return ProcedureStatus.ENTEREDINERROR;
179        if ("unknown".equals(codeString))
180          return ProcedureStatus.UNKNOWN;
181        throw new IllegalArgumentException("Unknown ProcedureStatus code '"+codeString+"'");
182        }
183        public Enumeration<ProcedureStatus> fromType(PrimitiveType<?> code) throws FHIRException {
184          if (code == null)
185            return null;
186          if (code.isEmpty())
187            return new Enumeration<ProcedureStatus>(this);
188          String codeString = code.asStringValue();
189          if (codeString == null || "".equals(codeString))
190            return null;
191        if ("preparation".equals(codeString))
192          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.PREPARATION);
193        if ("in-progress".equals(codeString))
194          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.INPROGRESS);
195        if ("suspended".equals(codeString))
196          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.SUSPENDED);
197        if ("aborted".equals(codeString))
198          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.ABORTED);
199        if ("completed".equals(codeString))
200          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.COMPLETED);
201        if ("entered-in-error".equals(codeString))
202          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.ENTEREDINERROR);
203        if ("unknown".equals(codeString))
204          return new Enumeration<ProcedureStatus>(this, ProcedureStatus.UNKNOWN);
205        throw new FHIRException("Unknown ProcedureStatus code '"+codeString+"'");
206        }
207    public String toCode(ProcedureStatus code) {
208       if (code == ProcedureStatus.NULL)
209           return null;
210       if (code == ProcedureStatus.PREPARATION)
211        return "preparation";
212      if (code == ProcedureStatus.INPROGRESS)
213        return "in-progress";
214      if (code == ProcedureStatus.SUSPENDED)
215        return "suspended";
216      if (code == ProcedureStatus.ABORTED)
217        return "aborted";
218      if (code == ProcedureStatus.COMPLETED)
219        return "completed";
220      if (code == ProcedureStatus.ENTEREDINERROR)
221        return "entered-in-error";
222      if (code == ProcedureStatus.UNKNOWN)
223        return "unknown";
224      return "?";
225   }
226    public String toSystem(ProcedureStatus code) {
227      return code.getSystem();
228      }
229    }
230
231    @Block()
232    public static class ProcedurePerformerComponent extends BackboneElement implements IBaseBackboneElement {
233        /**
234         * For example: surgeon, anaethetist, endoscopist.
235         */
236        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
237        @Description(shortDefinition="The role the actor was in", formalDefinition="For example: surgeon, anaethetist, endoscopist." )
238        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/performer-role")
239        protected CodeableConcept role;
240
241        /**
242         * The practitioner who was involved in the procedure.
243         */
244        @Child(name = "actor", type = {Practitioner.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=2, min=1, max=1, modifier=false, summary=true)
245        @Description(shortDefinition="The reference to the practitioner", formalDefinition="The practitioner who was involved in the procedure." )
246        protected Reference actor;
247
248        /**
249         * The actual object that is the target of the reference (The practitioner who was involved in the procedure.)
250         */
251        protected Resource actorTarget;
252
253        /**
254         * The organization the device or practitioner was acting on behalf of.
255         */
256        @Child(name = "onBehalfOf", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
257        @Description(shortDefinition="Organization the device or practitioner was acting for", formalDefinition="The organization the device or practitioner was acting on behalf of." )
258        protected Reference onBehalfOf;
259
260        /**
261         * The actual object that is the target of the reference (The organization the device or practitioner was acting on behalf of.)
262         */
263        protected Organization onBehalfOfTarget;
264
265        private static final long serialVersionUID = 213950062L;
266
267    /**
268     * Constructor
269     */
270      public ProcedurePerformerComponent() {
271        super();
272      }
273
274    /**
275     * Constructor
276     */
277      public ProcedurePerformerComponent(Reference actor) {
278        super();
279        this.actor = actor;
280      }
281
282        /**
283         * @return {@link #role} (For example: surgeon, anaethetist, endoscopist.)
284         */
285        public CodeableConcept getRole() { 
286          if (this.role == null)
287            if (Configuration.errorOnAutoCreate())
288              throw new Error("Attempt to auto-create ProcedurePerformerComponent.role");
289            else if (Configuration.doAutoCreate())
290              this.role = new CodeableConcept(); // cc
291          return this.role;
292        }
293
294        public boolean hasRole() { 
295          return this.role != null && !this.role.isEmpty();
296        }
297
298        /**
299         * @param value {@link #role} (For example: surgeon, anaethetist, endoscopist.)
300         */
301        public ProcedurePerformerComponent setRole(CodeableConcept value)  { 
302          this.role = value;
303          return this;
304        }
305
306        /**
307         * @return {@link #actor} (The practitioner who was involved in the procedure.)
308         */
309        public Reference getActor() { 
310          if (this.actor == null)
311            if (Configuration.errorOnAutoCreate())
312              throw new Error("Attempt to auto-create ProcedurePerformerComponent.actor");
313            else if (Configuration.doAutoCreate())
314              this.actor = new Reference(); // cc
315          return this.actor;
316        }
317
318        public boolean hasActor() { 
319          return this.actor != null && !this.actor.isEmpty();
320        }
321
322        /**
323         * @param value {@link #actor} (The practitioner who was involved in the procedure.)
324         */
325        public ProcedurePerformerComponent setActor(Reference value)  { 
326          this.actor = value;
327          return this;
328        }
329
330        /**
331         * @return {@link #actor} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who was involved in the procedure.)
332         */
333        public Resource getActorTarget() { 
334          return this.actorTarget;
335        }
336
337        /**
338         * @param value {@link #actor} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who was involved in the procedure.)
339         */
340        public ProcedurePerformerComponent setActorTarget(Resource value) { 
341          this.actorTarget = value;
342          return this;
343        }
344
345        /**
346         * @return {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
347         */
348        public Reference getOnBehalfOf() { 
349          if (this.onBehalfOf == null)
350            if (Configuration.errorOnAutoCreate())
351              throw new Error("Attempt to auto-create ProcedurePerformerComponent.onBehalfOf");
352            else if (Configuration.doAutoCreate())
353              this.onBehalfOf = new Reference(); // cc
354          return this.onBehalfOf;
355        }
356
357        public boolean hasOnBehalfOf() { 
358          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
359        }
360
361        /**
362         * @param value {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of.)
363         */
364        public ProcedurePerformerComponent setOnBehalfOf(Reference value)  { 
365          this.onBehalfOf = value;
366          return this;
367        }
368
369        /**
370         * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.)
371         */
372        public Organization getOnBehalfOfTarget() { 
373          if (this.onBehalfOfTarget == null)
374            if (Configuration.errorOnAutoCreate())
375              throw new Error("Attempt to auto-create ProcedurePerformerComponent.onBehalfOf");
376            else if (Configuration.doAutoCreate())
377              this.onBehalfOfTarget = new Organization(); // aa
378          return this.onBehalfOfTarget;
379        }
380
381        /**
382         * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization the device or practitioner was acting on behalf of.)
383         */
384        public ProcedurePerformerComponent setOnBehalfOfTarget(Organization value) { 
385          this.onBehalfOfTarget = value;
386          return this;
387        }
388
389        protected void listChildren(List<Property> children) {
390          super.listChildren(children);
391          children.add(new Property("role", "CodeableConcept", "For example: surgeon, anaethetist, endoscopist.", 0, 1, role));
392          children.add(new Property("actor", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The practitioner who was involved in the procedure.", 0, 1, actor));
393          children.add(new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf));
394        }
395
396        @Override
397        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
398          switch (_hash) {
399          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "For example: surgeon, anaethetist, endoscopist.", 0, 1, role);
400          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|Organization|Patient|RelatedPerson|Device)", "The practitioner who was involved in the procedure.", 0, 1, actor);
401          case -14402964: /*onBehalfOf*/  return new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of.", 0, 1, onBehalfOf);
402          default: return super.getNamedProperty(_hash, _name, _checkValid);
403          }
404
405        }
406
407      @Override
408      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
409        switch (hash) {
410        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
411        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
412        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
413        default: return super.getProperty(hash, name, checkValid);
414        }
415
416      }
417
418      @Override
419      public Base setProperty(int hash, String name, Base value) throws FHIRException {
420        switch (hash) {
421        case 3506294: // role
422          this.role = castToCodeableConcept(value); // CodeableConcept
423          return value;
424        case 92645877: // actor
425          this.actor = castToReference(value); // Reference
426          return value;
427        case -14402964: // onBehalfOf
428          this.onBehalfOf = castToReference(value); // Reference
429          return value;
430        default: return super.setProperty(hash, name, value);
431        }
432
433      }
434
435      @Override
436      public Base setProperty(String name, Base value) throws FHIRException {
437        if (name.equals("role")) {
438          this.role = castToCodeableConcept(value); // CodeableConcept
439        } else if (name.equals("actor")) {
440          this.actor = castToReference(value); // Reference
441        } else if (name.equals("onBehalfOf")) {
442          this.onBehalfOf = castToReference(value); // Reference
443        } else
444          return super.setProperty(name, value);
445        return value;
446      }
447
448      @Override
449      public Base makeProperty(int hash, String name) throws FHIRException {
450        switch (hash) {
451        case 3506294:  return getRole(); 
452        case 92645877:  return getActor(); 
453        case -14402964:  return getOnBehalfOf(); 
454        default: return super.makeProperty(hash, name);
455        }
456
457      }
458
459      @Override
460      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
461        switch (hash) {
462        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
463        case 92645877: /*actor*/ return new String[] {"Reference"};
464        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
465        default: return super.getTypesForProperty(hash, name);
466        }
467
468      }
469
470      @Override
471      public Base addChild(String name) throws FHIRException {
472        if (name.equals("role")) {
473          this.role = new CodeableConcept();
474          return this.role;
475        }
476        else if (name.equals("actor")) {
477          this.actor = new Reference();
478          return this.actor;
479        }
480        else if (name.equals("onBehalfOf")) {
481          this.onBehalfOf = new Reference();
482          return this.onBehalfOf;
483        }
484        else
485          return super.addChild(name);
486      }
487
488      public ProcedurePerformerComponent copy() {
489        ProcedurePerformerComponent dst = new ProcedurePerformerComponent();
490        copyValues(dst);
491        dst.role = role == null ? null : role.copy();
492        dst.actor = actor == null ? null : actor.copy();
493        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
494        return dst;
495      }
496
497      @Override
498      public boolean equalsDeep(Base other_) {
499        if (!super.equalsDeep(other_))
500          return false;
501        if (!(other_ instanceof ProcedurePerformerComponent))
502          return false;
503        ProcedurePerformerComponent o = (ProcedurePerformerComponent) other_;
504        return compareDeep(role, o.role, true) && compareDeep(actor, o.actor, true) && compareDeep(onBehalfOf, o.onBehalfOf, true)
505          ;
506      }
507
508      @Override
509      public boolean equalsShallow(Base other_) {
510        if (!super.equalsShallow(other_))
511          return false;
512        if (!(other_ instanceof ProcedurePerformerComponent))
513          return false;
514        ProcedurePerformerComponent o = (ProcedurePerformerComponent) other_;
515        return true;
516      }
517
518      public boolean isEmpty() {
519        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, actor, onBehalfOf
520          );
521      }
522
523  public String fhirType() {
524    return "Procedure.performer";
525
526  }
527
528  }
529
530    @Block()
531    public static class ProcedureFocalDeviceComponent extends BackboneElement implements IBaseBackboneElement {
532        /**
533         * The kind of change that happened to the device during the procedure.
534         */
535        @Child(name = "action", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
536        @Description(shortDefinition="Kind of change to device", formalDefinition="The kind of change that happened to the device during the procedure." )
537        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-action")
538        protected CodeableConcept action;
539
540        /**
541         * The device that was manipulated (changed) during the procedure.
542         */
543        @Child(name = "manipulated", type = {Device.class}, order=2, min=1, max=1, modifier=false, summary=false)
544        @Description(shortDefinition="Device that was changed", formalDefinition="The device that was manipulated (changed) during the procedure." )
545        protected Reference manipulated;
546
547        /**
548         * The actual object that is the target of the reference (The device that was manipulated (changed) during the procedure.)
549         */
550        protected Device manipulatedTarget;
551
552        private static final long serialVersionUID = 1779937807L;
553
554    /**
555     * Constructor
556     */
557      public ProcedureFocalDeviceComponent() {
558        super();
559      }
560
561    /**
562     * Constructor
563     */
564      public ProcedureFocalDeviceComponent(Reference manipulated) {
565        super();
566        this.manipulated = manipulated;
567      }
568
569        /**
570         * @return {@link #action} (The kind of change that happened to the device during the procedure.)
571         */
572        public CodeableConcept getAction() { 
573          if (this.action == null)
574            if (Configuration.errorOnAutoCreate())
575              throw new Error("Attempt to auto-create ProcedureFocalDeviceComponent.action");
576            else if (Configuration.doAutoCreate())
577              this.action = new CodeableConcept(); // cc
578          return this.action;
579        }
580
581        public boolean hasAction() { 
582          return this.action != null && !this.action.isEmpty();
583        }
584
585        /**
586         * @param value {@link #action} (The kind of change that happened to the device during the procedure.)
587         */
588        public ProcedureFocalDeviceComponent setAction(CodeableConcept value)  { 
589          this.action = value;
590          return this;
591        }
592
593        /**
594         * @return {@link #manipulated} (The device that was manipulated (changed) during the procedure.)
595         */
596        public Reference getManipulated() { 
597          if (this.manipulated == null)
598            if (Configuration.errorOnAutoCreate())
599              throw new Error("Attempt to auto-create ProcedureFocalDeviceComponent.manipulated");
600            else if (Configuration.doAutoCreate())
601              this.manipulated = new Reference(); // cc
602          return this.manipulated;
603        }
604
605        public boolean hasManipulated() { 
606          return this.manipulated != null && !this.manipulated.isEmpty();
607        }
608
609        /**
610         * @param value {@link #manipulated} (The device that was manipulated (changed) during the procedure.)
611         */
612        public ProcedureFocalDeviceComponent setManipulated(Reference value)  { 
613          this.manipulated = value;
614          return this;
615        }
616
617        /**
618         * @return {@link #manipulated} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The device that was manipulated (changed) during the procedure.)
619         */
620        public Device getManipulatedTarget() { 
621          if (this.manipulatedTarget == null)
622            if (Configuration.errorOnAutoCreate())
623              throw new Error("Attempt to auto-create ProcedureFocalDeviceComponent.manipulated");
624            else if (Configuration.doAutoCreate())
625              this.manipulatedTarget = new Device(); // aa
626          return this.manipulatedTarget;
627        }
628
629        /**
630         * @param value {@link #manipulated} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The device that was manipulated (changed) during the procedure.)
631         */
632        public ProcedureFocalDeviceComponent setManipulatedTarget(Device value) { 
633          this.manipulatedTarget = value;
634          return this;
635        }
636
637        protected void listChildren(List<Property> children) {
638          super.listChildren(children);
639          children.add(new Property("action", "CodeableConcept", "The kind of change that happened to the device during the procedure.", 0, 1, action));
640          children.add(new Property("manipulated", "Reference(Device)", "The device that was manipulated (changed) during the procedure.", 0, 1, manipulated));
641        }
642
643        @Override
644        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
645          switch (_hash) {
646          case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "The kind of change that happened to the device during the procedure.", 0, 1, action);
647          case 947372650: /*manipulated*/  return new Property("manipulated", "Reference(Device)", "The device that was manipulated (changed) during the procedure.", 0, 1, manipulated);
648          default: return super.getNamedProperty(_hash, _name, _checkValid);
649          }
650
651        }
652
653      @Override
654      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
655        switch (hash) {
656        case -1422950858: /*action*/ return this.action == null ? new Base[0] : new Base[] {this.action}; // CodeableConcept
657        case 947372650: /*manipulated*/ return this.manipulated == null ? new Base[0] : new Base[] {this.manipulated}; // Reference
658        default: return super.getProperty(hash, name, checkValid);
659        }
660
661      }
662
663      @Override
664      public Base setProperty(int hash, String name, Base value) throws FHIRException {
665        switch (hash) {
666        case -1422950858: // action
667          this.action = castToCodeableConcept(value); // CodeableConcept
668          return value;
669        case 947372650: // manipulated
670          this.manipulated = castToReference(value); // Reference
671          return value;
672        default: return super.setProperty(hash, name, value);
673        }
674
675      }
676
677      @Override
678      public Base setProperty(String name, Base value) throws FHIRException {
679        if (name.equals("action")) {
680          this.action = castToCodeableConcept(value); // CodeableConcept
681        } else if (name.equals("manipulated")) {
682          this.manipulated = castToReference(value); // Reference
683        } else
684          return super.setProperty(name, value);
685        return value;
686      }
687
688      @Override
689      public Base makeProperty(int hash, String name) throws FHIRException {
690        switch (hash) {
691        case -1422950858:  return getAction(); 
692        case 947372650:  return getManipulated(); 
693        default: return super.makeProperty(hash, name);
694        }
695
696      }
697
698      @Override
699      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
700        switch (hash) {
701        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
702        case 947372650: /*manipulated*/ return new String[] {"Reference"};
703        default: return super.getTypesForProperty(hash, name);
704        }
705
706      }
707
708      @Override
709      public Base addChild(String name) throws FHIRException {
710        if (name.equals("action")) {
711          this.action = new CodeableConcept();
712          return this.action;
713        }
714        else if (name.equals("manipulated")) {
715          this.manipulated = new Reference();
716          return this.manipulated;
717        }
718        else
719          return super.addChild(name);
720      }
721
722      public ProcedureFocalDeviceComponent copy() {
723        ProcedureFocalDeviceComponent dst = new ProcedureFocalDeviceComponent();
724        copyValues(dst);
725        dst.action = action == null ? null : action.copy();
726        dst.manipulated = manipulated == null ? null : manipulated.copy();
727        return dst;
728      }
729
730      @Override
731      public boolean equalsDeep(Base other_) {
732        if (!super.equalsDeep(other_))
733          return false;
734        if (!(other_ instanceof ProcedureFocalDeviceComponent))
735          return false;
736        ProcedureFocalDeviceComponent o = (ProcedureFocalDeviceComponent) other_;
737        return compareDeep(action, o.action, true) && compareDeep(manipulated, o.manipulated, true);
738      }
739
740      @Override
741      public boolean equalsShallow(Base other_) {
742        if (!super.equalsShallow(other_))
743          return false;
744        if (!(other_ instanceof ProcedureFocalDeviceComponent))
745          return false;
746        ProcedureFocalDeviceComponent o = (ProcedureFocalDeviceComponent) other_;
747        return true;
748      }
749
750      public boolean isEmpty() {
751        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(action, manipulated);
752      }
753
754  public String fhirType() {
755    return "Procedure.focalDevice";
756
757  }
758
759  }
760
761    /**
762     * This records identifiers associated with this procedure that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
763     */
764    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
765    @Description(shortDefinition="External Identifiers for this procedure", formalDefinition="This records identifiers associated with this procedure that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
766    protected List<Identifier> identifier;
767
768    /**
769     * A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure.
770     */
771    @Child(name = "definition", type = {PlanDefinition.class, ActivityDefinition.class, HealthcareService.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
772    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure." )
773    protected List<Reference> definition;
774    /**
775     * The actual objects that are the target of the reference (A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure.)
776     */
777    protected List<Resource> definitionTarget;
778
779
780    /**
781     * A reference to a resource that contains details of the request for this procedure.
782     */
783    @Child(name = "basedOn", type = {CarePlan.class, ProcedureRequest.class, ReferralRequest.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
784    @Description(shortDefinition="A request for this procedure", formalDefinition="A reference to a resource that contains details of the request for this procedure." )
785    protected List<Reference> basedOn;
786    /**
787     * The actual objects that are the target of the reference (A reference to a resource that contains details of the request for this procedure.)
788     */
789    protected List<Resource> basedOnTarget;
790
791
792    /**
793     * A larger event of which this particular procedure is a component or step.
794     */
795    @Child(name = "partOf", type = {Procedure.class, Observation.class, MedicationAdministration.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
796    @Description(shortDefinition="Part of referenced event", formalDefinition="A larger event of which this particular procedure is a component or step." )
797    protected List<Reference> partOf;
798    /**
799     * The actual objects that are the target of the reference (A larger event of which this particular procedure is a component or step.)
800     */
801    protected List<Resource> partOfTarget;
802
803
804    /**
805     * A code specifying the state of the procedure. Generally this will be in-progress or completed state.
806     */
807    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
808    @Description(shortDefinition="preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown", formalDefinition="A code specifying the state of the procedure. Generally this will be in-progress or completed state." )
809    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/event-status")
810    protected Enumeration<ProcedureStatus> status;
811
812    /**
813     * Set this to true if the record is saying that the procedure was NOT performed.
814     */
815    @Child(name = "notDone", type = {BooleanType.class}, order=5, min=0, max=1, modifier=true, summary=true)
816    @Description(shortDefinition="True if procedure was not performed as scheduled", formalDefinition="Set this to true if the record is saying that the procedure was NOT performed." )
817    protected BooleanType notDone;
818
819    /**
820     * A code indicating why the procedure was not performed.
821     */
822    @Child(name = "notDoneReason", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
823    @Description(shortDefinition="Reason procedure was not performed", formalDefinition="A code indicating why the procedure was not performed." )
824    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-not-performed-reason")
825    protected CodeableConcept notDoneReason;
826
827    /**
828     * A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").
829     */
830    @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
831    @Description(shortDefinition="Classification of the procedure", formalDefinition="A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\")." )
832    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-category")
833    protected CodeableConcept category;
834
835    /**
836     * The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").
837     */
838    @Child(name = "code", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
839    @Description(shortDefinition="Identification of the procedure", formalDefinition="The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. \"Laparoscopic Appendectomy\")." )
840    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-code")
841    protected CodeableConcept code;
842
843    /**
844     * The person, animal or group on which the procedure was performed.
845     */
846    @Child(name = "subject", type = {Patient.class, Group.class}, order=9, min=1, max=1, modifier=false, summary=true)
847    @Description(shortDefinition="Who the procedure was performed on", formalDefinition="The person, animal or group on which the procedure was performed." )
848    protected Reference subject;
849
850    /**
851     * The actual object that is the target of the reference (The person, animal or group on which the procedure was performed.)
852     */
853    protected Resource subjectTarget;
854
855    /**
856     * The encounter during which the procedure was performed.
857     */
858    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=10, min=0, max=1, modifier=false, summary=true)
859    @Description(shortDefinition="Encounter or episode associated with the procedure", formalDefinition="The encounter during which the procedure was performed." )
860    protected Reference context;
861
862    /**
863     * The actual object that is the target of the reference (The encounter during which the procedure was performed.)
864     */
865    protected Resource contextTarget;
866
867    /**
868     * The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.
869     */
870    @Child(name = "performed", type = {DateTimeType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=true)
871    @Description(shortDefinition="Date/Period the procedure was performed", formalDefinition="The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured." )
872    protected Type performed;
873
874    /**
875     * Limited to 'real' people rather than equipment.
876     */
877    @Child(name = "performer", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
878    @Description(shortDefinition="The people who performed the procedure", formalDefinition="Limited to 'real' people rather than equipment." )
879    protected List<ProcedurePerformerComponent> performer;
880
881    /**
882     * The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.
883     */
884    @Child(name = "location", type = {Location.class}, order=13, min=0, max=1, modifier=false, summary=true)
885    @Description(shortDefinition="Where the procedure happened", formalDefinition="The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant." )
886    protected Reference location;
887
888    /**
889     * The actual object that is the target of the reference (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
890     */
891    protected Location locationTarget;
892
893    /**
894     * The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.
895     */
896    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
897    @Description(shortDefinition="Coded reason procedure performed", formalDefinition="The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text." )
898    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-reason")
899    protected List<CodeableConcept> reasonCode;
900
901    /**
902     * The condition that is the reason why the procedure was performed.
903     */
904    @Child(name = "reasonReference", type = {Condition.class, Observation.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
905    @Description(shortDefinition="Condition that is the reason the procedure performed", formalDefinition="The condition that is the reason why the procedure was performed." )
906    protected List<Reference> reasonReference;
907    /**
908     * The actual objects that are the target of the reference (The condition that is the reason why the procedure was performed.)
909     */
910    protected List<Resource> reasonReferenceTarget;
911
912
913    /**
914     * Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.
915     */
916    @Child(name = "bodySite", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
917    @Description(shortDefinition="Target body sites", formalDefinition="Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion." )
918    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
919    protected List<CodeableConcept> bodySite;
920
921    /**
922     * The outcome of the procedure - did it resolve reasons for the procedure being performed?
923     */
924    @Child(name = "outcome", type = {CodeableConcept.class}, order=17, min=0, max=1, modifier=false, summary=true)
925    @Description(shortDefinition="The result of procedure", formalDefinition="The outcome of the procedure - did it resolve reasons for the procedure being performed?" )
926    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-outcome")
927    protected CodeableConcept outcome;
928
929    /**
930     * This could be a histology result, pathology report, surgical report, etc..
931     */
932    @Child(name = "report", type = {DiagnosticReport.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
933    @Description(shortDefinition="Any report resulting from the procedure", formalDefinition="This could be a histology result, pathology report, surgical report, etc.." )
934    protected List<Reference> report;
935    /**
936     * The actual objects that are the target of the reference (This could be a histology result, pathology report, surgical report, etc..)
937     */
938    protected List<DiagnosticReport> reportTarget;
939
940
941    /**
942     * Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.
943     */
944    @Child(name = "complication", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
945    @Description(shortDefinition="Complication following the procedure", formalDefinition="Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues." )
946    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
947    protected List<CodeableConcept> complication;
948
949    /**
950     * Any complications that occurred during the procedure, or in the immediate post-performance period.
951     */
952    @Child(name = "complicationDetail", type = {Condition.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
953    @Description(shortDefinition="A condition that is a result of the procedure", formalDefinition="Any complications that occurred during the procedure, or in the immediate post-performance period." )
954    protected List<Reference> complicationDetail;
955    /**
956     * The actual objects that are the target of the reference (Any complications that occurred during the procedure, or in the immediate post-performance period.)
957     */
958    protected List<Condition> complicationDetailTarget;
959
960
961    /**
962     * If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used.
963     */
964    @Child(name = "followUp", type = {CodeableConcept.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
965    @Description(shortDefinition="Instructions for follow up", formalDefinition="If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used." )
966    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-followup")
967    protected List<CodeableConcept> followUp;
968
969    /**
970     * Any other notes about the procedure.  E.g. the operative notes.
971     */
972    @Child(name = "note", type = {Annotation.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
973    @Description(shortDefinition="Additional information about the procedure", formalDefinition="Any other notes about the procedure.  E.g. the operative notes." )
974    protected List<Annotation> note;
975
976    /**
977     * A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.
978     */
979    @Child(name = "focalDevice", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
980    @Description(shortDefinition="Device changed in procedure", formalDefinition="A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure." )
981    protected List<ProcedureFocalDeviceComponent> focalDevice;
982
983    /**
984     * Identifies medications, devices and any other substance used as part of the procedure.
985     */
986    @Child(name = "usedReference", type = {Device.class, Medication.class, Substance.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
987    @Description(shortDefinition="Items used during procedure", formalDefinition="Identifies medications, devices and any other substance used as part of the procedure." )
988    protected List<Reference> usedReference;
989    /**
990     * The actual objects that are the target of the reference (Identifies medications, devices and any other substance used as part of the procedure.)
991     */
992    protected List<Resource> usedReferenceTarget;
993
994
995    /**
996     * Identifies coded items that were used as part of the procedure.
997     */
998    @Child(name = "usedCode", type = {CodeableConcept.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
999    @Description(shortDefinition="Coded items used during the procedure", formalDefinition="Identifies coded items that were used as part of the procedure." )
1000    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-kind")
1001    protected List<CodeableConcept> usedCode;
1002
1003    private static final long serialVersionUID = 7729906L;
1004
1005  /**
1006   * Constructor
1007   */
1008    public Procedure() {
1009      super();
1010    }
1011
1012  /**
1013   * Constructor
1014   */
1015    public Procedure(Enumeration<ProcedureStatus> status, Reference subject) {
1016      super();
1017      this.status = status;
1018      this.subject = subject;
1019    }
1020
1021    /**
1022     * @return {@link #identifier} (This records identifiers associated with this procedure that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
1023     */
1024    public List<Identifier> getIdentifier() { 
1025      if (this.identifier == null)
1026        this.identifier = new ArrayList<Identifier>();
1027      return this.identifier;
1028    }
1029
1030    /**
1031     * @return Returns a reference to <code>this</code> for easy method chaining
1032     */
1033    public Procedure setIdentifier(List<Identifier> theIdentifier) { 
1034      this.identifier = theIdentifier;
1035      return this;
1036    }
1037
1038    public boolean hasIdentifier() { 
1039      if (this.identifier == null)
1040        return false;
1041      for (Identifier item : this.identifier)
1042        if (!item.isEmpty())
1043          return true;
1044      return false;
1045    }
1046
1047    public Identifier addIdentifier() { //3
1048      Identifier t = new Identifier();
1049      if (this.identifier == null)
1050        this.identifier = new ArrayList<Identifier>();
1051      this.identifier.add(t);
1052      return t;
1053    }
1054
1055    public Procedure addIdentifier(Identifier t) { //3
1056      if (t == null)
1057        return this;
1058      if (this.identifier == null)
1059        this.identifier = new ArrayList<Identifier>();
1060      this.identifier.add(t);
1061      return this;
1062    }
1063
1064    /**
1065     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1066     */
1067    public Identifier getIdentifierFirstRep() { 
1068      if (getIdentifier().isEmpty()) {
1069        addIdentifier();
1070      }
1071      return getIdentifier().get(0);
1072    }
1073
1074    /**
1075     * @return {@link #definition} (A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure.)
1076     */
1077    public List<Reference> getDefinition() { 
1078      if (this.definition == null)
1079        this.definition = new ArrayList<Reference>();
1080      return this.definition;
1081    }
1082
1083    /**
1084     * @return Returns a reference to <code>this</code> for easy method chaining
1085     */
1086    public Procedure setDefinition(List<Reference> theDefinition) { 
1087      this.definition = theDefinition;
1088      return this;
1089    }
1090
1091    public boolean hasDefinition() { 
1092      if (this.definition == null)
1093        return false;
1094      for (Reference item : this.definition)
1095        if (!item.isEmpty())
1096          return true;
1097      return false;
1098    }
1099
1100    public Reference addDefinition() { //3
1101      Reference t = new Reference();
1102      if (this.definition == null)
1103        this.definition = new ArrayList<Reference>();
1104      this.definition.add(t);
1105      return t;
1106    }
1107
1108    public Procedure addDefinition(Reference t) { //3
1109      if (t == null)
1110        return this;
1111      if (this.definition == null)
1112        this.definition = new ArrayList<Reference>();
1113      this.definition.add(t);
1114      return this;
1115    }
1116
1117    /**
1118     * @return The first repetition of repeating field {@link #definition}, creating it if it does not already exist
1119     */
1120    public Reference getDefinitionFirstRep() { 
1121      if (getDefinition().isEmpty()) {
1122        addDefinition();
1123      }
1124      return getDefinition().get(0);
1125    }
1126
1127    /**
1128     * @return {@link #basedOn} (A reference to a resource that contains details of the request for this procedure.)
1129     */
1130    public List<Reference> getBasedOn() { 
1131      if (this.basedOn == null)
1132        this.basedOn = new ArrayList<Reference>();
1133      return this.basedOn;
1134    }
1135
1136    /**
1137     * @return Returns a reference to <code>this</code> for easy method chaining
1138     */
1139    public Procedure setBasedOn(List<Reference> theBasedOn) { 
1140      this.basedOn = theBasedOn;
1141      return this;
1142    }
1143
1144    public boolean hasBasedOn() { 
1145      if (this.basedOn == null)
1146        return false;
1147      for (Reference item : this.basedOn)
1148        if (!item.isEmpty())
1149          return true;
1150      return false;
1151    }
1152
1153    public Reference addBasedOn() { //3
1154      Reference t = new Reference();
1155      if (this.basedOn == null)
1156        this.basedOn = new ArrayList<Reference>();
1157      this.basedOn.add(t);
1158      return t;
1159    }
1160
1161    public Procedure addBasedOn(Reference t) { //3
1162      if (t == null)
1163        return this;
1164      if (this.basedOn == null)
1165        this.basedOn = new ArrayList<Reference>();
1166      this.basedOn.add(t);
1167      return this;
1168    }
1169
1170    /**
1171     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
1172     */
1173    public Reference getBasedOnFirstRep() { 
1174      if (getBasedOn().isEmpty()) {
1175        addBasedOn();
1176      }
1177      return getBasedOn().get(0);
1178    }
1179
1180    /**
1181     * @return {@link #partOf} (A larger event of which this particular procedure is a component or step.)
1182     */
1183    public List<Reference> getPartOf() { 
1184      if (this.partOf == null)
1185        this.partOf = new ArrayList<Reference>();
1186      return this.partOf;
1187    }
1188
1189    /**
1190     * @return Returns a reference to <code>this</code> for easy method chaining
1191     */
1192    public Procedure setPartOf(List<Reference> thePartOf) { 
1193      this.partOf = thePartOf;
1194      return this;
1195    }
1196
1197    public boolean hasPartOf() { 
1198      if (this.partOf == null)
1199        return false;
1200      for (Reference item : this.partOf)
1201        if (!item.isEmpty())
1202          return true;
1203      return false;
1204    }
1205
1206    public Reference addPartOf() { //3
1207      Reference t = new Reference();
1208      if (this.partOf == null)
1209        this.partOf = new ArrayList<Reference>();
1210      this.partOf.add(t);
1211      return t;
1212    }
1213
1214    public Procedure addPartOf(Reference t) { //3
1215      if (t == null)
1216        return this;
1217      if (this.partOf == null)
1218        this.partOf = new ArrayList<Reference>();
1219      this.partOf.add(t);
1220      return this;
1221    }
1222
1223    /**
1224     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist
1225     */
1226    public Reference getPartOfFirstRep() { 
1227      if (getPartOf().isEmpty()) {
1228        addPartOf();
1229      }
1230      return getPartOf().get(0);
1231    }
1232
1233    /**
1234     * @return {@link #status} (A code specifying the state of the procedure. Generally this will be in-progress or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1235     */
1236    public Enumeration<ProcedureStatus> getStatusElement() { 
1237      if (this.status == null)
1238        if (Configuration.errorOnAutoCreate())
1239          throw new Error("Attempt to auto-create Procedure.status");
1240        else if (Configuration.doAutoCreate())
1241          this.status = new Enumeration<ProcedureStatus>(new ProcedureStatusEnumFactory()); // bb
1242      return this.status;
1243    }
1244
1245    public boolean hasStatusElement() { 
1246      return this.status != null && !this.status.isEmpty();
1247    }
1248
1249    public boolean hasStatus() { 
1250      return this.status != null && !this.status.isEmpty();
1251    }
1252
1253    /**
1254     * @param value {@link #status} (A code specifying the state of the procedure. Generally this will be in-progress or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1255     */
1256    public Procedure setStatusElement(Enumeration<ProcedureStatus> value) { 
1257      this.status = value;
1258      return this;
1259    }
1260
1261    /**
1262     * @return A code specifying the state of the procedure. Generally this will be in-progress or completed state.
1263     */
1264    public ProcedureStatus getStatus() { 
1265      return this.status == null ? null : this.status.getValue();
1266    }
1267
1268    /**
1269     * @param value A code specifying the state of the procedure. Generally this will be in-progress or completed state.
1270     */
1271    public Procedure setStatus(ProcedureStatus value) { 
1272        if (this.status == null)
1273          this.status = new Enumeration<ProcedureStatus>(new ProcedureStatusEnumFactory());
1274        this.status.setValue(value);
1275      return this;
1276    }
1277
1278    /**
1279     * @return {@link #notDone} (Set this to true if the record is saying that the procedure was NOT performed.). This is the underlying object with id, value and extensions. The accessor "getNotDone" gives direct access to the value
1280     */
1281    public BooleanType getNotDoneElement() { 
1282      if (this.notDone == null)
1283        if (Configuration.errorOnAutoCreate())
1284          throw new Error("Attempt to auto-create Procedure.notDone");
1285        else if (Configuration.doAutoCreate())
1286          this.notDone = new BooleanType(); // bb
1287      return this.notDone;
1288    }
1289
1290    public boolean hasNotDoneElement() { 
1291      return this.notDone != null && !this.notDone.isEmpty();
1292    }
1293
1294    public boolean hasNotDone() { 
1295      return this.notDone != null && !this.notDone.isEmpty();
1296    }
1297
1298    /**
1299     * @param value {@link #notDone} (Set this to true if the record is saying that the procedure was NOT performed.). This is the underlying object with id, value and extensions. The accessor "getNotDone" gives direct access to the value
1300     */
1301    public Procedure setNotDoneElement(BooleanType value) { 
1302      this.notDone = value;
1303      return this;
1304    }
1305
1306    /**
1307     * @return Set this to true if the record is saying that the procedure was NOT performed.
1308     */
1309    public boolean getNotDone() { 
1310      return this.notDone == null || this.notDone.isEmpty() ? false : this.notDone.getValue();
1311    }
1312
1313    /**
1314     * @param value Set this to true if the record is saying that the procedure was NOT performed.
1315     */
1316    public Procedure setNotDone(boolean value) { 
1317        if (this.notDone == null)
1318          this.notDone = new BooleanType();
1319        this.notDone.setValue(value);
1320      return this;
1321    }
1322
1323    /**
1324     * @return {@link #notDoneReason} (A code indicating why the procedure was not performed.)
1325     */
1326    public CodeableConcept getNotDoneReason() { 
1327      if (this.notDoneReason == null)
1328        if (Configuration.errorOnAutoCreate())
1329          throw new Error("Attempt to auto-create Procedure.notDoneReason");
1330        else if (Configuration.doAutoCreate())
1331          this.notDoneReason = new CodeableConcept(); // cc
1332      return this.notDoneReason;
1333    }
1334
1335    public boolean hasNotDoneReason() { 
1336      return this.notDoneReason != null && !this.notDoneReason.isEmpty();
1337    }
1338
1339    /**
1340     * @param value {@link #notDoneReason} (A code indicating why the procedure was not performed.)
1341     */
1342    public Procedure setNotDoneReason(CodeableConcept value)  { 
1343      this.notDoneReason = value;
1344      return this;
1345    }
1346
1347    /**
1348     * @return {@link #category} (A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").)
1349     */
1350    public CodeableConcept getCategory() { 
1351      if (this.category == null)
1352        if (Configuration.errorOnAutoCreate())
1353          throw new Error("Attempt to auto-create Procedure.category");
1354        else if (Configuration.doAutoCreate())
1355          this.category = new CodeableConcept(); // cc
1356      return this.category;
1357    }
1358
1359    public boolean hasCategory() { 
1360      return this.category != null && !this.category.isEmpty();
1361    }
1362
1363    /**
1364     * @param value {@link #category} (A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").)
1365     */
1366    public Procedure setCategory(CodeableConcept value)  { 
1367      this.category = value;
1368      return this;
1369    }
1370
1371    /**
1372     * @return {@link #code} (The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").)
1373     */
1374    public CodeableConcept getCode() { 
1375      if (this.code == null)
1376        if (Configuration.errorOnAutoCreate())
1377          throw new Error("Attempt to auto-create Procedure.code");
1378        else if (Configuration.doAutoCreate())
1379          this.code = new CodeableConcept(); // cc
1380      return this.code;
1381    }
1382
1383    public boolean hasCode() { 
1384      return this.code != null && !this.code.isEmpty();
1385    }
1386
1387    /**
1388     * @param value {@link #code} (The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").)
1389     */
1390    public Procedure setCode(CodeableConcept value)  { 
1391      this.code = value;
1392      return this;
1393    }
1394
1395    /**
1396     * @return {@link #subject} (The person, animal or group on which the procedure was performed.)
1397     */
1398    public Reference getSubject() { 
1399      if (this.subject == null)
1400        if (Configuration.errorOnAutoCreate())
1401          throw new Error("Attempt to auto-create Procedure.subject");
1402        else if (Configuration.doAutoCreate())
1403          this.subject = new Reference(); // cc
1404      return this.subject;
1405    }
1406
1407    public boolean hasSubject() { 
1408      return this.subject != null && !this.subject.isEmpty();
1409    }
1410
1411    /**
1412     * @param value {@link #subject} (The person, animal or group on which the procedure was performed.)
1413     */
1414    public Procedure setSubject(Reference value)  { 
1415      this.subject = value;
1416      return this;
1417    }
1418
1419    /**
1420     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person, animal or group on which the procedure was performed.)
1421     */
1422    public Resource getSubjectTarget() { 
1423      return this.subjectTarget;
1424    }
1425
1426    /**
1427     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person, animal or group on which the procedure was performed.)
1428     */
1429    public Procedure setSubjectTarget(Resource value) { 
1430      this.subjectTarget = value;
1431      return this;
1432    }
1433
1434    /**
1435     * @return {@link #context} (The encounter during which the procedure was performed.)
1436     */
1437    public Reference getContext() { 
1438      if (this.context == null)
1439        if (Configuration.errorOnAutoCreate())
1440          throw new Error("Attempt to auto-create Procedure.context");
1441        else if (Configuration.doAutoCreate())
1442          this.context = new Reference(); // cc
1443      return this.context;
1444    }
1445
1446    public boolean hasContext() { 
1447      return this.context != null && !this.context.isEmpty();
1448    }
1449
1450    /**
1451     * @param value {@link #context} (The encounter during which the procedure was performed.)
1452     */
1453    public Procedure setContext(Reference value)  { 
1454      this.context = value;
1455      return this;
1456    }
1457
1458    /**
1459     * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The encounter during which the procedure was performed.)
1460     */
1461    public Resource getContextTarget() { 
1462      return this.contextTarget;
1463    }
1464
1465    /**
1466     * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The encounter during which the procedure was performed.)
1467     */
1468    public Procedure setContextTarget(Resource value) { 
1469      this.contextTarget = value;
1470      return this;
1471    }
1472
1473    /**
1474     * @return {@link #performed} (The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1475     */
1476    public Type getPerformed() { 
1477      return this.performed;
1478    }
1479
1480    /**
1481     * @return {@link #performed} (The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1482     */
1483    public DateTimeType getPerformedDateTimeType() throws FHIRException { 
1484      if (this.performed == null)
1485        return null;
1486      if (!(this.performed instanceof DateTimeType))
1487        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.performed.getClass().getName()+" was encountered");
1488      return (DateTimeType) this.performed;
1489    }
1490
1491    public boolean hasPerformedDateTimeType() {
1492        return this.performed instanceof DateTimeType;
1493    }
1494
1495    /**
1496     * @return {@link #performed} (The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1497     */
1498    public Period getPerformedPeriod() throws FHIRException { 
1499      if (this.performed == null)
1500        return null;
1501      if (!(this.performed instanceof Period))
1502        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.performed.getClass().getName()+" was encountered");
1503      return (Period) this.performed;
1504    }
1505
1506    public boolean hasPerformedPeriod() {
1507        return this.performed instanceof Period;
1508    }
1509
1510    public boolean hasPerformed() { 
1511      return this.performed != null && !this.performed.isEmpty();
1512    }
1513
1514    /**
1515     * @param value {@link #performed} (The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.)
1516     */
1517    public Procedure setPerformed(Type value) throws FHIRFormatError { 
1518      if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1519        throw new FHIRFormatError("Not the right type for Procedure.performed[x]: "+value.fhirType());
1520      this.performed = value;
1521      return this;
1522    }
1523
1524    /**
1525     * @return {@link #performer} (Limited to 'real' people rather than equipment.)
1526     */
1527    public List<ProcedurePerformerComponent> getPerformer() { 
1528      if (this.performer == null)
1529        this.performer = new ArrayList<ProcedurePerformerComponent>();
1530      return this.performer;
1531    }
1532
1533    /**
1534     * @return Returns a reference to <code>this</code> for easy method chaining
1535     */
1536    public Procedure setPerformer(List<ProcedurePerformerComponent> thePerformer) { 
1537      this.performer = thePerformer;
1538      return this;
1539    }
1540
1541    public boolean hasPerformer() { 
1542      if (this.performer == null)
1543        return false;
1544      for (ProcedurePerformerComponent item : this.performer)
1545        if (!item.isEmpty())
1546          return true;
1547      return false;
1548    }
1549
1550    public ProcedurePerformerComponent addPerformer() { //3
1551      ProcedurePerformerComponent t = new ProcedurePerformerComponent();
1552      if (this.performer == null)
1553        this.performer = new ArrayList<ProcedurePerformerComponent>();
1554      this.performer.add(t);
1555      return t;
1556    }
1557
1558    public Procedure addPerformer(ProcedurePerformerComponent t) { //3
1559      if (t == null)
1560        return this;
1561      if (this.performer == null)
1562        this.performer = new ArrayList<ProcedurePerformerComponent>();
1563      this.performer.add(t);
1564      return this;
1565    }
1566
1567    /**
1568     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist
1569     */
1570    public ProcedurePerformerComponent getPerformerFirstRep() { 
1571      if (getPerformer().isEmpty()) {
1572        addPerformer();
1573      }
1574      return getPerformer().get(0);
1575    }
1576
1577    /**
1578     * @return {@link #location} (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1579     */
1580    public Reference getLocation() { 
1581      if (this.location == null)
1582        if (Configuration.errorOnAutoCreate())
1583          throw new Error("Attempt to auto-create Procedure.location");
1584        else if (Configuration.doAutoCreate())
1585          this.location = new Reference(); // cc
1586      return this.location;
1587    }
1588
1589    public boolean hasLocation() { 
1590      return this.location != null && !this.location.isEmpty();
1591    }
1592
1593    /**
1594     * @param value {@link #location} (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1595     */
1596    public Procedure setLocation(Reference value)  { 
1597      this.location = value;
1598      return this;
1599    }
1600
1601    /**
1602     * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1603     */
1604    public Location getLocationTarget() { 
1605      if (this.locationTarget == null)
1606        if (Configuration.errorOnAutoCreate())
1607          throw new Error("Attempt to auto-create Procedure.location");
1608        else if (Configuration.doAutoCreate())
1609          this.locationTarget = new Location(); // aa
1610      return this.locationTarget;
1611    }
1612
1613    /**
1614     * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.)
1615     */
1616    public Procedure setLocationTarget(Location value) { 
1617      this.locationTarget = value;
1618      return this;
1619    }
1620
1621    /**
1622     * @return {@link #reasonCode} (The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.)
1623     */
1624    public List<CodeableConcept> getReasonCode() { 
1625      if (this.reasonCode == null)
1626        this.reasonCode = new ArrayList<CodeableConcept>();
1627      return this.reasonCode;
1628    }
1629
1630    /**
1631     * @return Returns a reference to <code>this</code> for easy method chaining
1632     */
1633    public Procedure setReasonCode(List<CodeableConcept> theReasonCode) { 
1634      this.reasonCode = theReasonCode;
1635      return this;
1636    }
1637
1638    public boolean hasReasonCode() { 
1639      if (this.reasonCode == null)
1640        return false;
1641      for (CodeableConcept item : this.reasonCode)
1642        if (!item.isEmpty())
1643          return true;
1644      return false;
1645    }
1646
1647    public CodeableConcept addReasonCode() { //3
1648      CodeableConcept t = new CodeableConcept();
1649      if (this.reasonCode == null)
1650        this.reasonCode = new ArrayList<CodeableConcept>();
1651      this.reasonCode.add(t);
1652      return t;
1653    }
1654
1655    public Procedure addReasonCode(CodeableConcept t) { //3
1656      if (t == null)
1657        return this;
1658      if (this.reasonCode == null)
1659        this.reasonCode = new ArrayList<CodeableConcept>();
1660      this.reasonCode.add(t);
1661      return this;
1662    }
1663
1664    /**
1665     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1666     */
1667    public CodeableConcept getReasonCodeFirstRep() { 
1668      if (getReasonCode().isEmpty()) {
1669        addReasonCode();
1670      }
1671      return getReasonCode().get(0);
1672    }
1673
1674    /**
1675     * @return {@link #reasonReference} (The condition that is the reason why the procedure was performed.)
1676     */
1677    public List<Reference> getReasonReference() { 
1678      if (this.reasonReference == null)
1679        this.reasonReference = new ArrayList<Reference>();
1680      return this.reasonReference;
1681    }
1682
1683    /**
1684     * @return Returns a reference to <code>this</code> for easy method chaining
1685     */
1686    public Procedure setReasonReference(List<Reference> theReasonReference) { 
1687      this.reasonReference = theReasonReference;
1688      return this;
1689    }
1690
1691    public boolean hasReasonReference() { 
1692      if (this.reasonReference == null)
1693        return false;
1694      for (Reference item : this.reasonReference)
1695        if (!item.isEmpty())
1696          return true;
1697      return false;
1698    }
1699
1700    public Reference addReasonReference() { //3
1701      Reference t = new Reference();
1702      if (this.reasonReference == null)
1703        this.reasonReference = new ArrayList<Reference>();
1704      this.reasonReference.add(t);
1705      return t;
1706    }
1707
1708    public Procedure addReasonReference(Reference t) { //3
1709      if (t == null)
1710        return this;
1711      if (this.reasonReference == null)
1712        this.reasonReference = new ArrayList<Reference>();
1713      this.reasonReference.add(t);
1714      return this;
1715    }
1716
1717    /**
1718     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1719     */
1720    public Reference getReasonReferenceFirstRep() { 
1721      if (getReasonReference().isEmpty()) {
1722        addReasonReference();
1723      }
1724      return getReasonReference().get(0);
1725    }
1726
1727    /**
1728     * @return {@link #bodySite} (Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.)
1729     */
1730    public List<CodeableConcept> getBodySite() { 
1731      if (this.bodySite == null)
1732        this.bodySite = new ArrayList<CodeableConcept>();
1733      return this.bodySite;
1734    }
1735
1736    /**
1737     * @return Returns a reference to <code>this</code> for easy method chaining
1738     */
1739    public Procedure setBodySite(List<CodeableConcept> theBodySite) { 
1740      this.bodySite = theBodySite;
1741      return this;
1742    }
1743
1744    public boolean hasBodySite() { 
1745      if (this.bodySite == null)
1746        return false;
1747      for (CodeableConcept item : this.bodySite)
1748        if (!item.isEmpty())
1749          return true;
1750      return false;
1751    }
1752
1753    public CodeableConcept addBodySite() { //3
1754      CodeableConcept t = new CodeableConcept();
1755      if (this.bodySite == null)
1756        this.bodySite = new ArrayList<CodeableConcept>();
1757      this.bodySite.add(t);
1758      return t;
1759    }
1760
1761    public Procedure addBodySite(CodeableConcept t) { //3
1762      if (t == null)
1763        return this;
1764      if (this.bodySite == null)
1765        this.bodySite = new ArrayList<CodeableConcept>();
1766      this.bodySite.add(t);
1767      return this;
1768    }
1769
1770    /**
1771     * @return The first repetition of repeating field {@link #bodySite}, creating it if it does not already exist
1772     */
1773    public CodeableConcept getBodySiteFirstRep() { 
1774      if (getBodySite().isEmpty()) {
1775        addBodySite();
1776      }
1777      return getBodySite().get(0);
1778    }
1779
1780    /**
1781     * @return {@link #outcome} (The outcome of the procedure - did it resolve reasons for the procedure being performed?)
1782     */
1783    public CodeableConcept getOutcome() { 
1784      if (this.outcome == null)
1785        if (Configuration.errorOnAutoCreate())
1786          throw new Error("Attempt to auto-create Procedure.outcome");
1787        else if (Configuration.doAutoCreate())
1788          this.outcome = new CodeableConcept(); // cc
1789      return this.outcome;
1790    }
1791
1792    public boolean hasOutcome() { 
1793      return this.outcome != null && !this.outcome.isEmpty();
1794    }
1795
1796    /**
1797     * @param value {@link #outcome} (The outcome of the procedure - did it resolve reasons for the procedure being performed?)
1798     */
1799    public Procedure setOutcome(CodeableConcept value)  { 
1800      this.outcome = value;
1801      return this;
1802    }
1803
1804    /**
1805     * @return {@link #report} (This could be a histology result, pathology report, surgical report, etc..)
1806     */
1807    public List<Reference> getReport() { 
1808      if (this.report == null)
1809        this.report = new ArrayList<Reference>();
1810      return this.report;
1811    }
1812
1813    /**
1814     * @return Returns a reference to <code>this</code> for easy method chaining
1815     */
1816    public Procedure setReport(List<Reference> theReport) { 
1817      this.report = theReport;
1818      return this;
1819    }
1820
1821    public boolean hasReport() { 
1822      if (this.report == null)
1823        return false;
1824      for (Reference item : this.report)
1825        if (!item.isEmpty())
1826          return true;
1827      return false;
1828    }
1829
1830    public Reference addReport() { //3
1831      Reference t = new Reference();
1832      if (this.report == null)
1833        this.report = new ArrayList<Reference>();
1834      this.report.add(t);
1835      return t;
1836    }
1837
1838    public Procedure addReport(Reference t) { //3
1839      if (t == null)
1840        return this;
1841      if (this.report == null)
1842        this.report = new ArrayList<Reference>();
1843      this.report.add(t);
1844      return this;
1845    }
1846
1847    /**
1848     * @return The first repetition of repeating field {@link #report}, creating it if it does not already exist
1849     */
1850    public Reference getReportFirstRep() { 
1851      if (getReport().isEmpty()) {
1852        addReport();
1853      }
1854      return getReport().get(0);
1855    }
1856
1857    /**
1858     * @return {@link #complication} (Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.)
1859     */
1860    public List<CodeableConcept> getComplication() { 
1861      if (this.complication == null)
1862        this.complication = new ArrayList<CodeableConcept>();
1863      return this.complication;
1864    }
1865
1866    /**
1867     * @return Returns a reference to <code>this</code> for easy method chaining
1868     */
1869    public Procedure setComplication(List<CodeableConcept> theComplication) { 
1870      this.complication = theComplication;
1871      return this;
1872    }
1873
1874    public boolean hasComplication() { 
1875      if (this.complication == null)
1876        return false;
1877      for (CodeableConcept item : this.complication)
1878        if (!item.isEmpty())
1879          return true;
1880      return false;
1881    }
1882
1883    public CodeableConcept addComplication() { //3
1884      CodeableConcept t = new CodeableConcept();
1885      if (this.complication == null)
1886        this.complication = new ArrayList<CodeableConcept>();
1887      this.complication.add(t);
1888      return t;
1889    }
1890
1891    public Procedure addComplication(CodeableConcept t) { //3
1892      if (t == null)
1893        return this;
1894      if (this.complication == null)
1895        this.complication = new ArrayList<CodeableConcept>();
1896      this.complication.add(t);
1897      return this;
1898    }
1899
1900    /**
1901     * @return The first repetition of repeating field {@link #complication}, creating it if it does not already exist
1902     */
1903    public CodeableConcept getComplicationFirstRep() { 
1904      if (getComplication().isEmpty()) {
1905        addComplication();
1906      }
1907      return getComplication().get(0);
1908    }
1909
1910    /**
1911     * @return {@link #complicationDetail} (Any complications that occurred during the procedure, or in the immediate post-performance period.)
1912     */
1913    public List<Reference> getComplicationDetail() { 
1914      if (this.complicationDetail == null)
1915        this.complicationDetail = new ArrayList<Reference>();
1916      return this.complicationDetail;
1917    }
1918
1919    /**
1920     * @return Returns a reference to <code>this</code> for easy method chaining
1921     */
1922    public Procedure setComplicationDetail(List<Reference> theComplicationDetail) { 
1923      this.complicationDetail = theComplicationDetail;
1924      return this;
1925    }
1926
1927    public boolean hasComplicationDetail() { 
1928      if (this.complicationDetail == null)
1929        return false;
1930      for (Reference item : this.complicationDetail)
1931        if (!item.isEmpty())
1932          return true;
1933      return false;
1934    }
1935
1936    public Reference addComplicationDetail() { //3
1937      Reference t = new Reference();
1938      if (this.complicationDetail == null)
1939        this.complicationDetail = new ArrayList<Reference>();
1940      this.complicationDetail.add(t);
1941      return t;
1942    }
1943
1944    public Procedure addComplicationDetail(Reference t) { //3
1945      if (t == null)
1946        return this;
1947      if (this.complicationDetail == null)
1948        this.complicationDetail = new ArrayList<Reference>();
1949      this.complicationDetail.add(t);
1950      return this;
1951    }
1952
1953    /**
1954     * @return The first repetition of repeating field {@link #complicationDetail}, creating it if it does not already exist
1955     */
1956    public Reference getComplicationDetailFirstRep() { 
1957      if (getComplicationDetail().isEmpty()) {
1958        addComplicationDetail();
1959      }
1960      return getComplicationDetail().get(0);
1961    }
1962
1963    /**
1964     * @return {@link #followUp} (If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used.)
1965     */
1966    public List<CodeableConcept> getFollowUp() { 
1967      if (this.followUp == null)
1968        this.followUp = new ArrayList<CodeableConcept>();
1969      return this.followUp;
1970    }
1971
1972    /**
1973     * @return Returns a reference to <code>this</code> for easy method chaining
1974     */
1975    public Procedure setFollowUp(List<CodeableConcept> theFollowUp) { 
1976      this.followUp = theFollowUp;
1977      return this;
1978    }
1979
1980    public boolean hasFollowUp() { 
1981      if (this.followUp == null)
1982        return false;
1983      for (CodeableConcept item : this.followUp)
1984        if (!item.isEmpty())
1985          return true;
1986      return false;
1987    }
1988
1989    public CodeableConcept addFollowUp() { //3
1990      CodeableConcept t = new CodeableConcept();
1991      if (this.followUp == null)
1992        this.followUp = new ArrayList<CodeableConcept>();
1993      this.followUp.add(t);
1994      return t;
1995    }
1996
1997    public Procedure addFollowUp(CodeableConcept t) { //3
1998      if (t == null)
1999        return this;
2000      if (this.followUp == null)
2001        this.followUp = new ArrayList<CodeableConcept>();
2002      this.followUp.add(t);
2003      return this;
2004    }
2005
2006    /**
2007     * @return The first repetition of repeating field {@link #followUp}, creating it if it does not already exist
2008     */
2009    public CodeableConcept getFollowUpFirstRep() { 
2010      if (getFollowUp().isEmpty()) {
2011        addFollowUp();
2012      }
2013      return getFollowUp().get(0);
2014    }
2015
2016    /**
2017     * @return {@link #note} (Any other notes about the procedure.  E.g. the operative notes.)
2018     */
2019    public List<Annotation> getNote() { 
2020      if (this.note == null)
2021        this.note = new ArrayList<Annotation>();
2022      return this.note;
2023    }
2024
2025    /**
2026     * @return Returns a reference to <code>this</code> for easy method chaining
2027     */
2028    public Procedure setNote(List<Annotation> theNote) { 
2029      this.note = theNote;
2030      return this;
2031    }
2032
2033    public boolean hasNote() { 
2034      if (this.note == null)
2035        return false;
2036      for (Annotation item : this.note)
2037        if (!item.isEmpty())
2038          return true;
2039      return false;
2040    }
2041
2042    public Annotation addNote() { //3
2043      Annotation t = new Annotation();
2044      if (this.note == null)
2045        this.note = new ArrayList<Annotation>();
2046      this.note.add(t);
2047      return t;
2048    }
2049
2050    public Procedure addNote(Annotation t) { //3
2051      if (t == null)
2052        return this;
2053      if (this.note == null)
2054        this.note = new ArrayList<Annotation>();
2055      this.note.add(t);
2056      return this;
2057    }
2058
2059    /**
2060     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2061     */
2062    public Annotation getNoteFirstRep() { 
2063      if (getNote().isEmpty()) {
2064        addNote();
2065      }
2066      return getNote().get(0);
2067    }
2068
2069    /**
2070     * @return {@link #focalDevice} (A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.)
2071     */
2072    public List<ProcedureFocalDeviceComponent> getFocalDevice() { 
2073      if (this.focalDevice == null)
2074        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2075      return this.focalDevice;
2076    }
2077
2078    /**
2079     * @return Returns a reference to <code>this</code> for easy method chaining
2080     */
2081    public Procedure setFocalDevice(List<ProcedureFocalDeviceComponent> theFocalDevice) { 
2082      this.focalDevice = theFocalDevice;
2083      return this;
2084    }
2085
2086    public boolean hasFocalDevice() { 
2087      if (this.focalDevice == null)
2088        return false;
2089      for (ProcedureFocalDeviceComponent item : this.focalDevice)
2090        if (!item.isEmpty())
2091          return true;
2092      return false;
2093    }
2094
2095    public ProcedureFocalDeviceComponent addFocalDevice() { //3
2096      ProcedureFocalDeviceComponent t = new ProcedureFocalDeviceComponent();
2097      if (this.focalDevice == null)
2098        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2099      this.focalDevice.add(t);
2100      return t;
2101    }
2102
2103    public Procedure addFocalDevice(ProcedureFocalDeviceComponent t) { //3
2104      if (t == null)
2105        return this;
2106      if (this.focalDevice == null)
2107        this.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2108      this.focalDevice.add(t);
2109      return this;
2110    }
2111
2112    /**
2113     * @return The first repetition of repeating field {@link #focalDevice}, creating it if it does not already exist
2114     */
2115    public ProcedureFocalDeviceComponent getFocalDeviceFirstRep() { 
2116      if (getFocalDevice().isEmpty()) {
2117        addFocalDevice();
2118      }
2119      return getFocalDevice().get(0);
2120    }
2121
2122    /**
2123     * @return {@link #usedReference} (Identifies medications, devices and any other substance used as part of the procedure.)
2124     */
2125    public List<Reference> getUsedReference() { 
2126      if (this.usedReference == null)
2127        this.usedReference = new ArrayList<Reference>();
2128      return this.usedReference;
2129    }
2130
2131    /**
2132     * @return Returns a reference to <code>this</code> for easy method chaining
2133     */
2134    public Procedure setUsedReference(List<Reference> theUsedReference) { 
2135      this.usedReference = theUsedReference;
2136      return this;
2137    }
2138
2139    public boolean hasUsedReference() { 
2140      if (this.usedReference == null)
2141        return false;
2142      for (Reference item : this.usedReference)
2143        if (!item.isEmpty())
2144          return true;
2145      return false;
2146    }
2147
2148    public Reference addUsedReference() { //3
2149      Reference t = new Reference();
2150      if (this.usedReference == null)
2151        this.usedReference = new ArrayList<Reference>();
2152      this.usedReference.add(t);
2153      return t;
2154    }
2155
2156    public Procedure addUsedReference(Reference t) { //3
2157      if (t == null)
2158        return this;
2159      if (this.usedReference == null)
2160        this.usedReference = new ArrayList<Reference>();
2161      this.usedReference.add(t);
2162      return this;
2163    }
2164
2165    /**
2166     * @return The first repetition of repeating field {@link #usedReference}, creating it if it does not already exist
2167     */
2168    public Reference getUsedReferenceFirstRep() { 
2169      if (getUsedReference().isEmpty()) {
2170        addUsedReference();
2171      }
2172      return getUsedReference().get(0);
2173    }
2174
2175    /**
2176     * @return {@link #usedCode} (Identifies coded items that were used as part of the procedure.)
2177     */
2178    public List<CodeableConcept> getUsedCode() { 
2179      if (this.usedCode == null)
2180        this.usedCode = new ArrayList<CodeableConcept>();
2181      return this.usedCode;
2182    }
2183
2184    /**
2185     * @return Returns a reference to <code>this</code> for easy method chaining
2186     */
2187    public Procedure setUsedCode(List<CodeableConcept> theUsedCode) { 
2188      this.usedCode = theUsedCode;
2189      return this;
2190    }
2191
2192    public boolean hasUsedCode() { 
2193      if (this.usedCode == null)
2194        return false;
2195      for (CodeableConcept item : this.usedCode)
2196        if (!item.isEmpty())
2197          return true;
2198      return false;
2199    }
2200
2201    public CodeableConcept addUsedCode() { //3
2202      CodeableConcept t = new CodeableConcept();
2203      if (this.usedCode == null)
2204        this.usedCode = new ArrayList<CodeableConcept>();
2205      this.usedCode.add(t);
2206      return t;
2207    }
2208
2209    public Procedure addUsedCode(CodeableConcept t) { //3
2210      if (t == null)
2211        return this;
2212      if (this.usedCode == null)
2213        this.usedCode = new ArrayList<CodeableConcept>();
2214      this.usedCode.add(t);
2215      return this;
2216    }
2217
2218    /**
2219     * @return The first repetition of repeating field {@link #usedCode}, creating it if it does not already exist
2220     */
2221    public CodeableConcept getUsedCodeFirstRep() { 
2222      if (getUsedCode().isEmpty()) {
2223        addUsedCode();
2224      }
2225      return getUsedCode().get(0);
2226    }
2227
2228      protected void listChildren(List<Property> children) {
2229        super.listChildren(children);
2230        children.add(new Property("identifier", "Identifier", "This records identifiers associated with this procedure that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
2231        children.add(new Property("definition", "Reference(PlanDefinition|ActivityDefinition|HealthcareService)", "A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure.", 0, java.lang.Integer.MAX_VALUE, definition));
2232        children.add(new Property("basedOn", "Reference(CarePlan|ProcedureRequest|ReferralRequest)", "A reference to a resource that contains details of the request for this procedure.", 0, java.lang.Integer.MAX_VALUE, basedOn));
2233        children.add(new Property("partOf", "Reference(Procedure|Observation|MedicationAdministration)", "A larger event of which this particular procedure is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf));
2234        children.add(new Property("status", "code", "A code specifying the state of the procedure. Generally this will be in-progress or completed state.", 0, 1, status));
2235        children.add(new Property("notDone", "boolean", "Set this to true if the record is saying that the procedure was NOT performed.", 0, 1, notDone));
2236        children.add(new Property("notDoneReason", "CodeableConcept", "A code indicating why the procedure was not performed.", 0, 1, notDoneReason));
2237        children.add(new Property("category", "CodeableConcept", "A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\").", 0, 1, category));
2238        children.add(new Property("code", "CodeableConcept", "The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. \"Laparoscopic Appendectomy\").", 0, 1, code));
2239        children.add(new Property("subject", "Reference(Patient|Group)", "The person, animal or group on which the procedure was performed.", 0, 1, subject));
2240        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter during which the procedure was performed.", 0, 1, context));
2241        children.add(new Property("performed[x]", "dateTime|Period", "The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed));
2242        children.add(new Property("performer", "", "Limited to 'real' people rather than equipment.", 0, java.lang.Integer.MAX_VALUE, performer));
2243        children.add(new Property("location", "Reference(Location)", "The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.", 0, 1, location));
2244        children.add(new Property("reasonCode", "CodeableConcept", "The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2245        children.add(new Property("reasonReference", "Reference(Condition|Observation)", "The condition that is the reason why the procedure was performed.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2246        children.add(new Property("bodySite", "CodeableConcept", "Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.", 0, java.lang.Integer.MAX_VALUE, bodySite));
2247        children.add(new Property("outcome", "CodeableConcept", "The outcome of the procedure - did it resolve reasons for the procedure being performed?", 0, 1, outcome));
2248        children.add(new Property("report", "Reference(DiagnosticReport)", "This could be a histology result, pathology report, surgical report, etc..", 0, java.lang.Integer.MAX_VALUE, report));
2249        children.add(new Property("complication", "CodeableConcept", "Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.", 0, java.lang.Integer.MAX_VALUE, complication));
2250        children.add(new Property("complicationDetail", "Reference(Condition)", "Any complications that occurred during the procedure, or in the immediate post-performance period.", 0, java.lang.Integer.MAX_VALUE, complicationDetail));
2251        children.add(new Property("followUp", "CodeableConcept", "If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used.", 0, java.lang.Integer.MAX_VALUE, followUp));
2252        children.add(new Property("note", "Annotation", "Any other notes about the procedure.  E.g. the operative notes.", 0, java.lang.Integer.MAX_VALUE, note));
2253        children.add(new Property("focalDevice", "", "A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.", 0, java.lang.Integer.MAX_VALUE, focalDevice));
2254        children.add(new Property("usedReference", "Reference(Device|Medication|Substance)", "Identifies medications, devices and any other substance used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedReference));
2255        children.add(new Property("usedCode", "CodeableConcept", "Identifies coded items that were used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedCode));
2256      }
2257
2258      @Override
2259      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2260        switch (_hash) {
2261        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "This records identifiers associated with this procedure that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier);
2262        case -1014418093: /*definition*/  return new Property("definition", "Reference(PlanDefinition|ActivityDefinition|HealthcareService)", "A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure.", 0, java.lang.Integer.MAX_VALUE, definition);
2263        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|ProcedureRequest|ReferralRequest)", "A reference to a resource that contains details of the request for this procedure.", 0, java.lang.Integer.MAX_VALUE, basedOn);
2264        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Procedure|Observation|MedicationAdministration)", "A larger event of which this particular procedure is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf);
2265        case -892481550: /*status*/  return new Property("status", "code", "A code specifying the state of the procedure. Generally this will be in-progress or completed state.", 0, 1, status);
2266        case 2128257269: /*notDone*/  return new Property("notDone", "boolean", "Set this to true if the record is saying that the procedure was NOT performed.", 0, 1, notDone);
2267        case -1973169255: /*notDoneReason*/  return new Property("notDoneReason", "CodeableConcept", "A code indicating why the procedure was not performed.", 0, 1, notDoneReason);
2268        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\").", 0, 1, category);
2269        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. \"Laparoscopic Appendectomy\").", 0, 1, code);
2270        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The person, animal or group on which the procedure was performed.", 0, 1, subject);
2271        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The encounter during which the procedure was performed.", 0, 1, context);
2272        case 1355984064: /*performed[x]*/  return new Property("performed[x]", "dateTime|Period", "The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2273        case 481140672: /*performed*/  return new Property("performed[x]", "dateTime|Period", "The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2274        case 1118270331: /*performedDateTime*/  return new Property("performed[x]", "dateTime|Period", "The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2275        case 1622094241: /*performedPeriod*/  return new Property("performed[x]", "dateTime|Period", "The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.", 0, 1, performed);
2276        case 481140686: /*performer*/  return new Property("performer", "", "Limited to 'real' people rather than equipment.", 0, java.lang.Integer.MAX_VALUE, performer);
2277        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.", 0, 1, location);
2278        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2279        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation)", "The condition that is the reason why the procedure was performed.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2280        case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.", 0, java.lang.Integer.MAX_VALUE, bodySite);
2281        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "The outcome of the procedure - did it resolve reasons for the procedure being performed?", 0, 1, outcome);
2282        case -934521548: /*report*/  return new Property("report", "Reference(DiagnosticReport)", "This could be a histology result, pathology report, surgical report, etc..", 0, java.lang.Integer.MAX_VALUE, report);
2283        case -1644401602: /*complication*/  return new Property("complication", "CodeableConcept", "Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.", 0, java.lang.Integer.MAX_VALUE, complication);
2284        case -1685272017: /*complicationDetail*/  return new Property("complicationDetail", "Reference(Condition)", "Any complications that occurred during the procedure, or in the immediate post-performance period.", 0, java.lang.Integer.MAX_VALUE, complicationDetail);
2285        case 301801004: /*followUp*/  return new Property("followUp", "CodeableConcept", "If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used.", 0, java.lang.Integer.MAX_VALUE, followUp);
2286        case 3387378: /*note*/  return new Property("note", "Annotation", "Any other notes about the procedure.  E.g. the operative notes.", 0, java.lang.Integer.MAX_VALUE, note);
2287        case -1129235173: /*focalDevice*/  return new Property("focalDevice", "", "A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.", 0, java.lang.Integer.MAX_VALUE, focalDevice);
2288        case -504932338: /*usedReference*/  return new Property("usedReference", "Reference(Device|Medication|Substance)", "Identifies medications, devices and any other substance used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedReference);
2289        case -279910582: /*usedCode*/  return new Property("usedCode", "CodeableConcept", "Identifies coded items that were used as part of the procedure.", 0, java.lang.Integer.MAX_VALUE, usedCode);
2290        default: return super.getNamedProperty(_hash, _name, _checkValid);
2291        }
2292
2293      }
2294
2295      @Override
2296      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2297        switch (hash) {
2298        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2299        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : this.definition.toArray(new Base[this.definition.size()]); // Reference
2300        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2301        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2302        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ProcedureStatus>
2303        case 2128257269: /*notDone*/ return this.notDone == null ? new Base[0] : new Base[] {this.notDone}; // BooleanType
2304        case -1973169255: /*notDoneReason*/ return this.notDoneReason == null ? new Base[0] : new Base[] {this.notDoneReason}; // CodeableConcept
2305        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
2306        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2307        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2308        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
2309        case 481140672: /*performed*/ return this.performed == null ? new Base[0] : new Base[] {this.performed}; // Type
2310        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // ProcedurePerformerComponent
2311        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2312        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2313        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2314        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // CodeableConcept
2315        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
2316        case -934521548: /*report*/ return this.report == null ? new Base[0] : this.report.toArray(new Base[this.report.size()]); // Reference
2317        case -1644401602: /*complication*/ return this.complication == null ? new Base[0] : this.complication.toArray(new Base[this.complication.size()]); // CodeableConcept
2318        case -1685272017: /*complicationDetail*/ return this.complicationDetail == null ? new Base[0] : this.complicationDetail.toArray(new Base[this.complicationDetail.size()]); // Reference
2319        case 301801004: /*followUp*/ return this.followUp == null ? new Base[0] : this.followUp.toArray(new Base[this.followUp.size()]); // CodeableConcept
2320        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2321        case -1129235173: /*focalDevice*/ return this.focalDevice == null ? new Base[0] : this.focalDevice.toArray(new Base[this.focalDevice.size()]); // ProcedureFocalDeviceComponent
2322        case -504932338: /*usedReference*/ return this.usedReference == null ? new Base[0] : this.usedReference.toArray(new Base[this.usedReference.size()]); // Reference
2323        case -279910582: /*usedCode*/ return this.usedCode == null ? new Base[0] : this.usedCode.toArray(new Base[this.usedCode.size()]); // CodeableConcept
2324        default: return super.getProperty(hash, name, checkValid);
2325        }
2326
2327      }
2328
2329      @Override
2330      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2331        switch (hash) {
2332        case -1618432855: // identifier
2333          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2334          return value;
2335        case -1014418093: // definition
2336          this.getDefinition().add(castToReference(value)); // Reference
2337          return value;
2338        case -332612366: // basedOn
2339          this.getBasedOn().add(castToReference(value)); // Reference
2340          return value;
2341        case -995410646: // partOf
2342          this.getPartOf().add(castToReference(value)); // Reference
2343          return value;
2344        case -892481550: // status
2345          value = new ProcedureStatusEnumFactory().fromType(castToCode(value));
2346          this.status = (Enumeration) value; // Enumeration<ProcedureStatus>
2347          return value;
2348        case 2128257269: // notDone
2349          this.notDone = castToBoolean(value); // BooleanType
2350          return value;
2351        case -1973169255: // notDoneReason
2352          this.notDoneReason = castToCodeableConcept(value); // CodeableConcept
2353          return value;
2354        case 50511102: // category
2355          this.category = castToCodeableConcept(value); // CodeableConcept
2356          return value;
2357        case 3059181: // code
2358          this.code = castToCodeableConcept(value); // CodeableConcept
2359          return value;
2360        case -1867885268: // subject
2361          this.subject = castToReference(value); // Reference
2362          return value;
2363        case 951530927: // context
2364          this.context = castToReference(value); // Reference
2365          return value;
2366        case 481140672: // performed
2367          this.performed = castToType(value); // Type
2368          return value;
2369        case 481140686: // performer
2370          this.getPerformer().add((ProcedurePerformerComponent) value); // ProcedurePerformerComponent
2371          return value;
2372        case 1901043637: // location
2373          this.location = castToReference(value); // Reference
2374          return value;
2375        case 722137681: // reasonCode
2376          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2377          return value;
2378        case -1146218137: // reasonReference
2379          this.getReasonReference().add(castToReference(value)); // Reference
2380          return value;
2381        case 1702620169: // bodySite
2382          this.getBodySite().add(castToCodeableConcept(value)); // CodeableConcept
2383          return value;
2384        case -1106507950: // outcome
2385          this.outcome = castToCodeableConcept(value); // CodeableConcept
2386          return value;
2387        case -934521548: // report
2388          this.getReport().add(castToReference(value)); // Reference
2389          return value;
2390        case -1644401602: // complication
2391          this.getComplication().add(castToCodeableConcept(value)); // CodeableConcept
2392          return value;
2393        case -1685272017: // complicationDetail
2394          this.getComplicationDetail().add(castToReference(value)); // Reference
2395          return value;
2396        case 301801004: // followUp
2397          this.getFollowUp().add(castToCodeableConcept(value)); // CodeableConcept
2398          return value;
2399        case 3387378: // note
2400          this.getNote().add(castToAnnotation(value)); // Annotation
2401          return value;
2402        case -1129235173: // focalDevice
2403          this.getFocalDevice().add((ProcedureFocalDeviceComponent) value); // ProcedureFocalDeviceComponent
2404          return value;
2405        case -504932338: // usedReference
2406          this.getUsedReference().add(castToReference(value)); // Reference
2407          return value;
2408        case -279910582: // usedCode
2409          this.getUsedCode().add(castToCodeableConcept(value)); // CodeableConcept
2410          return value;
2411        default: return super.setProperty(hash, name, value);
2412        }
2413
2414      }
2415
2416      @Override
2417      public Base setProperty(String name, Base value) throws FHIRException {
2418        if (name.equals("identifier")) {
2419          this.getIdentifier().add(castToIdentifier(value));
2420        } else if (name.equals("definition")) {
2421          this.getDefinition().add(castToReference(value));
2422        } else if (name.equals("basedOn")) {
2423          this.getBasedOn().add(castToReference(value));
2424        } else if (name.equals("partOf")) {
2425          this.getPartOf().add(castToReference(value));
2426        } else if (name.equals("status")) {
2427          value = new ProcedureStatusEnumFactory().fromType(castToCode(value));
2428          this.status = (Enumeration) value; // Enumeration<ProcedureStatus>
2429        } else if (name.equals("notDone")) {
2430          this.notDone = castToBoolean(value); // BooleanType
2431        } else if (name.equals("notDoneReason")) {
2432          this.notDoneReason = castToCodeableConcept(value); // CodeableConcept
2433        } else if (name.equals("category")) {
2434          this.category = castToCodeableConcept(value); // CodeableConcept
2435        } else if (name.equals("code")) {
2436          this.code = castToCodeableConcept(value); // CodeableConcept
2437        } else if (name.equals("subject")) {
2438          this.subject = castToReference(value); // Reference
2439        } else if (name.equals("context")) {
2440          this.context = castToReference(value); // Reference
2441        } else if (name.equals("performed[x]")) {
2442          this.performed = castToType(value); // Type
2443        } else if (name.equals("performer")) {
2444          this.getPerformer().add((ProcedurePerformerComponent) value);
2445        } else if (name.equals("location")) {
2446          this.location = castToReference(value); // Reference
2447        } else if (name.equals("reasonCode")) {
2448          this.getReasonCode().add(castToCodeableConcept(value));
2449        } else if (name.equals("reasonReference")) {
2450          this.getReasonReference().add(castToReference(value));
2451        } else if (name.equals("bodySite")) {
2452          this.getBodySite().add(castToCodeableConcept(value));
2453        } else if (name.equals("outcome")) {
2454          this.outcome = castToCodeableConcept(value); // CodeableConcept
2455        } else if (name.equals("report")) {
2456          this.getReport().add(castToReference(value));
2457        } else if (name.equals("complication")) {
2458          this.getComplication().add(castToCodeableConcept(value));
2459        } else if (name.equals("complicationDetail")) {
2460          this.getComplicationDetail().add(castToReference(value));
2461        } else if (name.equals("followUp")) {
2462          this.getFollowUp().add(castToCodeableConcept(value));
2463        } else if (name.equals("note")) {
2464          this.getNote().add(castToAnnotation(value));
2465        } else if (name.equals("focalDevice")) {
2466          this.getFocalDevice().add((ProcedureFocalDeviceComponent) value);
2467        } else if (name.equals("usedReference")) {
2468          this.getUsedReference().add(castToReference(value));
2469        } else if (name.equals("usedCode")) {
2470          this.getUsedCode().add(castToCodeableConcept(value));
2471        } else
2472          return super.setProperty(name, value);
2473        return value;
2474      }
2475
2476      @Override
2477      public Base makeProperty(int hash, String name) throws FHIRException {
2478        switch (hash) {
2479        case -1618432855:  return addIdentifier(); 
2480        case -1014418093:  return addDefinition(); 
2481        case -332612366:  return addBasedOn(); 
2482        case -995410646:  return addPartOf(); 
2483        case -892481550:  return getStatusElement();
2484        case 2128257269:  return getNotDoneElement();
2485        case -1973169255:  return getNotDoneReason(); 
2486        case 50511102:  return getCategory(); 
2487        case 3059181:  return getCode(); 
2488        case -1867885268:  return getSubject(); 
2489        case 951530927:  return getContext(); 
2490        case 1355984064:  return getPerformed(); 
2491        case 481140672:  return getPerformed(); 
2492        case 481140686:  return addPerformer(); 
2493        case 1901043637:  return getLocation(); 
2494        case 722137681:  return addReasonCode(); 
2495        case -1146218137:  return addReasonReference(); 
2496        case 1702620169:  return addBodySite(); 
2497        case -1106507950:  return getOutcome(); 
2498        case -934521548:  return addReport(); 
2499        case -1644401602:  return addComplication(); 
2500        case -1685272017:  return addComplicationDetail(); 
2501        case 301801004:  return addFollowUp(); 
2502        case 3387378:  return addNote(); 
2503        case -1129235173:  return addFocalDevice(); 
2504        case -504932338:  return addUsedReference(); 
2505        case -279910582:  return addUsedCode(); 
2506        default: return super.makeProperty(hash, name);
2507        }
2508
2509      }
2510
2511      @Override
2512      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2513        switch (hash) {
2514        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2515        case -1014418093: /*definition*/ return new String[] {"Reference"};
2516        case -332612366: /*basedOn*/ return new String[] {"Reference"};
2517        case -995410646: /*partOf*/ return new String[] {"Reference"};
2518        case -892481550: /*status*/ return new String[] {"code"};
2519        case 2128257269: /*notDone*/ return new String[] {"boolean"};
2520        case -1973169255: /*notDoneReason*/ return new String[] {"CodeableConcept"};
2521        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2522        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2523        case -1867885268: /*subject*/ return new String[] {"Reference"};
2524        case 951530927: /*context*/ return new String[] {"Reference"};
2525        case 481140672: /*performed*/ return new String[] {"dateTime", "Period"};
2526        case 481140686: /*performer*/ return new String[] {};
2527        case 1901043637: /*location*/ return new String[] {"Reference"};
2528        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2529        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2530        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
2531        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
2532        case -934521548: /*report*/ return new String[] {"Reference"};
2533        case -1644401602: /*complication*/ return new String[] {"CodeableConcept"};
2534        case -1685272017: /*complicationDetail*/ return new String[] {"Reference"};
2535        case 301801004: /*followUp*/ return new String[] {"CodeableConcept"};
2536        case 3387378: /*note*/ return new String[] {"Annotation"};
2537        case -1129235173: /*focalDevice*/ return new String[] {};
2538        case -504932338: /*usedReference*/ return new String[] {"Reference"};
2539        case -279910582: /*usedCode*/ return new String[] {"CodeableConcept"};
2540        default: return super.getTypesForProperty(hash, name);
2541        }
2542
2543      }
2544
2545      @Override
2546      public Base addChild(String name) throws FHIRException {
2547        if (name.equals("identifier")) {
2548          return addIdentifier();
2549        }
2550        else if (name.equals("definition")) {
2551          return addDefinition();
2552        }
2553        else if (name.equals("basedOn")) {
2554          return addBasedOn();
2555        }
2556        else if (name.equals("partOf")) {
2557          return addPartOf();
2558        }
2559        else if (name.equals("status")) {
2560          throw new FHIRException("Cannot call addChild on a singleton property Procedure.status");
2561        }
2562        else if (name.equals("notDone")) {
2563          throw new FHIRException("Cannot call addChild on a singleton property Procedure.notDone");
2564        }
2565        else if (name.equals("notDoneReason")) {
2566          this.notDoneReason = new CodeableConcept();
2567          return this.notDoneReason;
2568        }
2569        else if (name.equals("category")) {
2570          this.category = new CodeableConcept();
2571          return this.category;
2572        }
2573        else if (name.equals("code")) {
2574          this.code = new CodeableConcept();
2575          return this.code;
2576        }
2577        else if (name.equals("subject")) {
2578          this.subject = new Reference();
2579          return this.subject;
2580        }
2581        else if (name.equals("context")) {
2582          this.context = new Reference();
2583          return this.context;
2584        }
2585        else if (name.equals("performedDateTime")) {
2586          this.performed = new DateTimeType();
2587          return this.performed;
2588        }
2589        else if (name.equals("performedPeriod")) {
2590          this.performed = new Period();
2591          return this.performed;
2592        }
2593        else if (name.equals("performer")) {
2594          return addPerformer();
2595        }
2596        else if (name.equals("location")) {
2597          this.location = new Reference();
2598          return this.location;
2599        }
2600        else if (name.equals("reasonCode")) {
2601          return addReasonCode();
2602        }
2603        else if (name.equals("reasonReference")) {
2604          return addReasonReference();
2605        }
2606        else if (name.equals("bodySite")) {
2607          return addBodySite();
2608        }
2609        else if (name.equals("outcome")) {
2610          this.outcome = new CodeableConcept();
2611          return this.outcome;
2612        }
2613        else if (name.equals("report")) {
2614          return addReport();
2615        }
2616        else if (name.equals("complication")) {
2617          return addComplication();
2618        }
2619        else if (name.equals("complicationDetail")) {
2620          return addComplicationDetail();
2621        }
2622        else if (name.equals("followUp")) {
2623          return addFollowUp();
2624        }
2625        else if (name.equals("note")) {
2626          return addNote();
2627        }
2628        else if (name.equals("focalDevice")) {
2629          return addFocalDevice();
2630        }
2631        else if (name.equals("usedReference")) {
2632          return addUsedReference();
2633        }
2634        else if (name.equals("usedCode")) {
2635          return addUsedCode();
2636        }
2637        else
2638          return super.addChild(name);
2639      }
2640
2641  public String fhirType() {
2642    return "Procedure";
2643
2644  }
2645
2646      public Procedure copy() {
2647        Procedure dst = new Procedure();
2648        copyValues(dst);
2649        if (identifier != null) {
2650          dst.identifier = new ArrayList<Identifier>();
2651          for (Identifier i : identifier)
2652            dst.identifier.add(i.copy());
2653        };
2654        if (definition != null) {
2655          dst.definition = new ArrayList<Reference>();
2656          for (Reference i : definition)
2657            dst.definition.add(i.copy());
2658        };
2659        if (basedOn != null) {
2660          dst.basedOn = new ArrayList<Reference>();
2661          for (Reference i : basedOn)
2662            dst.basedOn.add(i.copy());
2663        };
2664        if (partOf != null) {
2665          dst.partOf = new ArrayList<Reference>();
2666          for (Reference i : partOf)
2667            dst.partOf.add(i.copy());
2668        };
2669        dst.status = status == null ? null : status.copy();
2670        dst.notDone = notDone == null ? null : notDone.copy();
2671        dst.notDoneReason = notDoneReason == null ? null : notDoneReason.copy();
2672        dst.category = category == null ? null : category.copy();
2673        dst.code = code == null ? null : code.copy();
2674        dst.subject = subject == null ? null : subject.copy();
2675        dst.context = context == null ? null : context.copy();
2676        dst.performed = performed == null ? null : performed.copy();
2677        if (performer != null) {
2678          dst.performer = new ArrayList<ProcedurePerformerComponent>();
2679          for (ProcedurePerformerComponent i : performer)
2680            dst.performer.add(i.copy());
2681        };
2682        dst.location = location == null ? null : location.copy();
2683        if (reasonCode != null) {
2684          dst.reasonCode = new ArrayList<CodeableConcept>();
2685          for (CodeableConcept i : reasonCode)
2686            dst.reasonCode.add(i.copy());
2687        };
2688        if (reasonReference != null) {
2689          dst.reasonReference = new ArrayList<Reference>();
2690          for (Reference i : reasonReference)
2691            dst.reasonReference.add(i.copy());
2692        };
2693        if (bodySite != null) {
2694          dst.bodySite = new ArrayList<CodeableConcept>();
2695          for (CodeableConcept i : bodySite)
2696            dst.bodySite.add(i.copy());
2697        };
2698        dst.outcome = outcome == null ? null : outcome.copy();
2699        if (report != null) {
2700          dst.report = new ArrayList<Reference>();
2701          for (Reference i : report)
2702            dst.report.add(i.copy());
2703        };
2704        if (complication != null) {
2705          dst.complication = new ArrayList<CodeableConcept>();
2706          for (CodeableConcept i : complication)
2707            dst.complication.add(i.copy());
2708        };
2709        if (complicationDetail != null) {
2710          dst.complicationDetail = new ArrayList<Reference>();
2711          for (Reference i : complicationDetail)
2712            dst.complicationDetail.add(i.copy());
2713        };
2714        if (followUp != null) {
2715          dst.followUp = new ArrayList<CodeableConcept>();
2716          for (CodeableConcept i : followUp)
2717            dst.followUp.add(i.copy());
2718        };
2719        if (note != null) {
2720          dst.note = new ArrayList<Annotation>();
2721          for (Annotation i : note)
2722            dst.note.add(i.copy());
2723        };
2724        if (focalDevice != null) {
2725          dst.focalDevice = new ArrayList<ProcedureFocalDeviceComponent>();
2726          for (ProcedureFocalDeviceComponent i : focalDevice)
2727            dst.focalDevice.add(i.copy());
2728        };
2729        if (usedReference != null) {
2730          dst.usedReference = new ArrayList<Reference>();
2731          for (Reference i : usedReference)
2732            dst.usedReference.add(i.copy());
2733        };
2734        if (usedCode != null) {
2735          dst.usedCode = new ArrayList<CodeableConcept>();
2736          for (CodeableConcept i : usedCode)
2737            dst.usedCode.add(i.copy());
2738        };
2739        return dst;
2740      }
2741
2742      protected Procedure typedCopy() {
2743        return copy();
2744      }
2745
2746      @Override
2747      public boolean equalsDeep(Base other_) {
2748        if (!super.equalsDeep(other_))
2749          return false;
2750        if (!(other_ instanceof Procedure))
2751          return false;
2752        Procedure o = (Procedure) other_;
2753        return compareDeep(identifier, o.identifier, true) && compareDeep(definition, o.definition, true)
2754           && compareDeep(basedOn, o.basedOn, true) && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true)
2755           && compareDeep(notDone, o.notDone, true) && compareDeep(notDoneReason, o.notDoneReason, true) && compareDeep(category, o.category, true)
2756           && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true)
2757           && compareDeep(performed, o.performed, true) && compareDeep(performer, o.performer, true) && compareDeep(location, o.location, true)
2758           && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
2759           && compareDeep(bodySite, o.bodySite, true) && compareDeep(outcome, o.outcome, true) && compareDeep(report, o.report, true)
2760           && compareDeep(complication, o.complication, true) && compareDeep(complicationDetail, o.complicationDetail, true)
2761           && compareDeep(followUp, o.followUp, true) && compareDeep(note, o.note, true) && compareDeep(focalDevice, o.focalDevice, true)
2762           && compareDeep(usedReference, o.usedReference, true) && compareDeep(usedCode, o.usedCode, true)
2763          ;
2764      }
2765
2766      @Override
2767      public boolean equalsShallow(Base other_) {
2768        if (!super.equalsShallow(other_))
2769          return false;
2770        if (!(other_ instanceof Procedure))
2771          return false;
2772        Procedure o = (Procedure) other_;
2773        return compareValues(status, o.status, true) && compareValues(notDone, o.notDone, true);
2774      }
2775
2776      public boolean isEmpty() {
2777        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definition, basedOn
2778          , partOf, status, notDone, notDoneReason, category, code, subject, context, performed
2779          , performer, location, reasonCode, reasonReference, bodySite, outcome, report
2780          , complication, complicationDetail, followUp, note, focalDevice, usedReference, usedCode
2781          );
2782      }
2783
2784  @Override
2785  public ResourceType getResourceType() {
2786    return ResourceType.Procedure;
2787   }
2788
2789 /**
2790   * Search parameter: <b>date</b>
2791   * <p>
2792   * Description: <b>Date/Period the procedure was performed</b><br>
2793   * Type: <b>date</b><br>
2794   * Path: <b>Procedure.performed[x]</b><br>
2795   * </p>
2796   */
2797  @SearchParamDefinition(name="date", path="Procedure.performed", description="Date/Period the procedure was performed", type="date" )
2798  public static final String SP_DATE = "date";
2799 /**
2800   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2801   * <p>
2802   * Description: <b>Date/Period the procedure was performed</b><br>
2803   * Type: <b>date</b><br>
2804   * Path: <b>Procedure.performed[x]</b><br>
2805   * </p>
2806   */
2807  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2808
2809 /**
2810   * Search parameter: <b>identifier</b>
2811   * <p>
2812   * Description: <b>A unique identifier for a procedure</b><br>
2813   * Type: <b>token</b><br>
2814   * Path: <b>Procedure.identifier</b><br>
2815   * </p>
2816   */
2817  @SearchParamDefinition(name="identifier", path="Procedure.identifier", description="A unique identifier for a procedure", type="token" )
2818  public static final String SP_IDENTIFIER = "identifier";
2819 /**
2820   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2821   * <p>
2822   * Description: <b>A unique identifier for a procedure</b><br>
2823   * Type: <b>token</b><br>
2824   * Path: <b>Procedure.identifier</b><br>
2825   * </p>
2826   */
2827  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2828
2829 /**
2830   * Search parameter: <b>code</b>
2831   * <p>
2832   * Description: <b>A code to identify a  procedure</b><br>
2833   * Type: <b>token</b><br>
2834   * Path: <b>Procedure.code</b><br>
2835   * </p>
2836   */
2837  @SearchParamDefinition(name="code", path="Procedure.code", description="A code to identify a  procedure", type="token" )
2838  public static final String SP_CODE = "code";
2839 /**
2840   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2841   * <p>
2842   * Description: <b>A code to identify a  procedure</b><br>
2843   * Type: <b>token</b><br>
2844   * Path: <b>Procedure.code</b><br>
2845   * </p>
2846   */
2847  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
2848
2849 /**
2850   * Search parameter: <b>performer</b>
2851   * <p>
2852   * Description: <b>The reference to the practitioner</b><br>
2853   * Type: <b>reference</b><br>
2854   * Path: <b>Procedure.performer.actor</b><br>
2855   * </p>
2856   */
2857  @SearchParamDefinition(name="performer", path="Procedure.performer.actor", description="The reference to the practitioner", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
2858  public static final String SP_PERFORMER = "performer";
2859 /**
2860   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2861   * <p>
2862   * Description: <b>The reference to the practitioner</b><br>
2863   * Type: <b>reference</b><br>
2864   * Path: <b>Procedure.performer.actor</b><br>
2865   * </p>
2866   */
2867  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
2868
2869/**
2870   * Constant for fluent queries to be used to add include statements. Specifies
2871   * the path value of "<b>Procedure:performer</b>".
2872   */
2873  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("Procedure:performer").toLocked();
2874
2875 /**
2876   * Search parameter: <b>subject</b>
2877   * <p>
2878   * Description: <b>Search by subject</b><br>
2879   * Type: <b>reference</b><br>
2880   * Path: <b>Procedure.subject</b><br>
2881   * </p>
2882   */
2883  @SearchParamDefinition(name="subject", path="Procedure.subject", description="Search by subject", type="reference", target={Group.class, Patient.class } )
2884  public static final String SP_SUBJECT = "subject";
2885 /**
2886   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2887   * <p>
2888   * Description: <b>Search by subject</b><br>
2889   * Type: <b>reference</b><br>
2890   * Path: <b>Procedure.subject</b><br>
2891   * </p>
2892   */
2893  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2894
2895/**
2896   * Constant for fluent queries to be used to add include statements. Specifies
2897   * the path value of "<b>Procedure:subject</b>".
2898   */
2899  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Procedure:subject").toLocked();
2900
2901 /**
2902   * Search parameter: <b>part-of</b>
2903   * <p>
2904   * Description: <b>Part of referenced event</b><br>
2905   * Type: <b>reference</b><br>
2906   * Path: <b>Procedure.partOf</b><br>
2907   * </p>
2908   */
2909  @SearchParamDefinition(name="part-of", path="Procedure.partOf", description="Part of referenced event", type="reference", target={MedicationAdministration.class, Observation.class, Procedure.class } )
2910  public static final String SP_PART_OF = "part-of";
2911 /**
2912   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
2913   * <p>
2914   * Description: <b>Part of referenced event</b><br>
2915   * Type: <b>reference</b><br>
2916   * Path: <b>Procedure.partOf</b><br>
2917   * </p>
2918   */
2919  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
2920
2921/**
2922   * Constant for fluent queries to be used to add include statements. Specifies
2923   * the path value of "<b>Procedure:part-of</b>".
2924   */
2925  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("Procedure:part-of").toLocked();
2926
2927 /**
2928   * Search parameter: <b>encounter</b>
2929   * <p>
2930   * Description: <b>Search by encounter</b><br>
2931   * Type: <b>reference</b><br>
2932   * Path: <b>Procedure.context</b><br>
2933   * </p>
2934   */
2935  @SearchParamDefinition(name="encounter", path="Procedure.context", description="Search by encounter", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
2936  public static final String SP_ENCOUNTER = "encounter";
2937 /**
2938   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2939   * <p>
2940   * Description: <b>Search by encounter</b><br>
2941   * Type: <b>reference</b><br>
2942   * Path: <b>Procedure.context</b><br>
2943   * </p>
2944   */
2945  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2946
2947/**
2948   * Constant for fluent queries to be used to add include statements. Specifies
2949   * the path value of "<b>Procedure:encounter</b>".
2950   */
2951  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Procedure:encounter").toLocked();
2952
2953 /**
2954   * Search parameter: <b>based-on</b>
2955   * <p>
2956   * Description: <b>A request for this procedure</b><br>
2957   * Type: <b>reference</b><br>
2958   * Path: <b>Procedure.basedOn</b><br>
2959   * </p>
2960   */
2961  @SearchParamDefinition(name="based-on", path="Procedure.basedOn", description="A request for this procedure", type="reference", target={CarePlan.class, ProcedureRequest.class, ReferralRequest.class } )
2962  public static final String SP_BASED_ON = "based-on";
2963 /**
2964   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2965   * <p>
2966   * Description: <b>A request for this procedure</b><br>
2967   * Type: <b>reference</b><br>
2968   * Path: <b>Procedure.basedOn</b><br>
2969   * </p>
2970   */
2971  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2972
2973/**
2974   * Constant for fluent queries to be used to add include statements. Specifies
2975   * the path value of "<b>Procedure:based-on</b>".
2976   */
2977  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Procedure:based-on").toLocked();
2978
2979 /**
2980   * Search parameter: <b>patient</b>
2981   * <p>
2982   * Description: <b>Search by subject - a patient</b><br>
2983   * Type: <b>reference</b><br>
2984   * Path: <b>Procedure.subject</b><br>
2985   * </p>
2986   */
2987  @SearchParamDefinition(name="patient", path="Procedure.subject", description="Search by subject - a patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
2988  public static final String SP_PATIENT = "patient";
2989 /**
2990   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2991   * <p>
2992   * Description: <b>Search by subject - a patient</b><br>
2993   * Type: <b>reference</b><br>
2994   * Path: <b>Procedure.subject</b><br>
2995   * </p>
2996   */
2997  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2998
2999/**
3000   * Constant for fluent queries to be used to add include statements. Specifies
3001   * the path value of "<b>Procedure:patient</b>".
3002   */
3003  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Procedure:patient").toLocked();
3004
3005 /**
3006   * Search parameter: <b>context</b>
3007   * <p>
3008   * Description: <b>Encounter or episode associated with the procedure</b><br>
3009   * Type: <b>reference</b><br>
3010   * Path: <b>Procedure.context</b><br>
3011   * </p>
3012   */
3013  @SearchParamDefinition(name="context", path="Procedure.context", description="Encounter or episode associated with the procedure", type="reference", target={Encounter.class, EpisodeOfCare.class } )
3014  public static final String SP_CONTEXT = "context";
3015 /**
3016   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3017   * <p>
3018   * Description: <b>Encounter or episode associated with the procedure</b><br>
3019   * Type: <b>reference</b><br>
3020   * Path: <b>Procedure.context</b><br>
3021   * </p>
3022   */
3023  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
3024
3025/**
3026   * Constant for fluent queries to be used to add include statements. Specifies
3027   * the path value of "<b>Procedure:context</b>".
3028   */
3029  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("Procedure:context").toLocked();
3030
3031 /**
3032   * Search parameter: <b>location</b>
3033   * <p>
3034   * Description: <b>Where the procedure happened</b><br>
3035   * Type: <b>reference</b><br>
3036   * Path: <b>Procedure.location</b><br>
3037   * </p>
3038   */
3039  @SearchParamDefinition(name="location", path="Procedure.location", description="Where the procedure happened", type="reference", target={Location.class } )
3040  public static final String SP_LOCATION = "location";
3041 /**
3042   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3043   * <p>
3044   * Description: <b>Where the procedure happened</b><br>
3045   * Type: <b>reference</b><br>
3046   * Path: <b>Procedure.location</b><br>
3047   * </p>
3048   */
3049  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3050
3051/**
3052   * Constant for fluent queries to be used to add include statements. Specifies
3053   * the path value of "<b>Procedure:location</b>".
3054   */
3055  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Procedure:location").toLocked();
3056
3057 /**
3058   * Search parameter: <b>definition</b>
3059   * <p>
3060   * Description: <b>Instantiates protocol or definition</b><br>
3061   * Type: <b>reference</b><br>
3062   * Path: <b>Procedure.definition</b><br>
3063   * </p>
3064   */
3065  @SearchParamDefinition(name="definition", path="Procedure.definition", description="Instantiates protocol or definition", type="reference", target={ActivityDefinition.class, HealthcareService.class, PlanDefinition.class } )
3066  public static final String SP_DEFINITION = "definition";
3067 /**
3068   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
3069   * <p>
3070   * Description: <b>Instantiates protocol or definition</b><br>
3071   * Type: <b>reference</b><br>
3072   * Path: <b>Procedure.definition</b><br>
3073   * </p>
3074   */
3075  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEFINITION);
3076
3077/**
3078   * Constant for fluent queries to be used to add include statements. Specifies
3079   * the path value of "<b>Procedure:definition</b>".
3080   */
3081  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEFINITION = new ca.uhn.fhir.model.api.Include("Procedure:definition").toLocked();
3082
3083 /**
3084   * Search parameter: <b>category</b>
3085   * <p>
3086   * Description: <b>Classification of the procedure</b><br>
3087   * Type: <b>token</b><br>
3088   * Path: <b>Procedure.category</b><br>
3089   * </p>
3090   */
3091  @SearchParamDefinition(name="category", path="Procedure.category", description="Classification of the procedure", type="token" )
3092  public static final String SP_CATEGORY = "category";
3093 /**
3094   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3095   * <p>
3096   * Description: <b>Classification of the procedure</b><br>
3097   * Type: <b>token</b><br>
3098   * Path: <b>Procedure.category</b><br>
3099   * </p>
3100   */
3101  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3102
3103 /**
3104   * Search parameter: <b>status</b>
3105   * <p>
3106   * Description: <b>preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown</b><br>
3107   * Type: <b>token</b><br>
3108   * Path: <b>Procedure.status</b><br>
3109   * </p>
3110   */
3111  @SearchParamDefinition(name="status", path="Procedure.status", description="preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown", type="token" )
3112  public static final String SP_STATUS = "status";
3113 /**
3114   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3115   * <p>
3116   * Description: <b>preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown</b><br>
3117   * Type: <b>token</b><br>
3118   * Path: <b>Procedure.status</b><br>
3119   * </p>
3120   */
3121  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3122
3123
3124}