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