001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048
049/**
050 * The resource ChargeItem describes the provision of healthcare provider
051 * products for a certain patient, therefore referring not only to the product,
052 * but containing in addition details of the provision, like date, time, amounts
053 * and participating organizations and persons. Main Usage of the ChargeItem is
054 * to enable the billing process and internal cost allocation.
055 */
056@ResourceDef(name = "ChargeItem", profile = "http://hl7.org/fhir/StructureDefinition/ChargeItem")
057public class ChargeItem extends DomainResource {
058
059  public enum ChargeItemStatus {
060    /**
061     * The charge item has been entered, but the charged service is not yet
062     * complete, so it shall not be billed yet but might be used in the context of
063     * pre-authorization.
064     */
065    PLANNED,
066    /**
067     * The charge item is ready for billing.
068     */
069    BILLABLE,
070    /**
071     * The charge item has been determined to be not billable (e.g. due to rules
072     * associated with the billing code).
073     */
074    NOTBILLABLE,
075    /**
076     * The processing of the charge was aborted.
077     */
078    ABORTED,
079    /**
080     * The charge item has been billed (e.g. a billing engine has generated
081     * financial transactions by applying the associated ruled for the charge item
082     * to the context of the Encounter, and placed them into Claims/Invoices.
083     */
084    BILLED,
085    /**
086     * The charge item has been entered in error and should not be processed for
087     * billing.
088     */
089    ENTEREDINERROR,
090    /**
091     * The authoring system does not know which of the status values currently
092     * applies for this charge item Note: This concept is not to be used for "other"
093     * - one of the listed statuses is presumed to apply, it's just not known which
094     * one.
095     */
096    UNKNOWN,
097    /**
098     * added to help the parsers with the generic types
099     */
100    NULL;
101
102    public static ChargeItemStatus fromCode(String codeString) throws FHIRException {
103      if (codeString == null || "".equals(codeString))
104        return null;
105      if ("planned".equals(codeString))
106        return PLANNED;
107      if ("billable".equals(codeString))
108        return BILLABLE;
109      if ("not-billable".equals(codeString))
110        return NOTBILLABLE;
111      if ("aborted".equals(codeString))
112        return ABORTED;
113      if ("billed".equals(codeString))
114        return BILLED;
115      if ("entered-in-error".equals(codeString))
116        return ENTEREDINERROR;
117      if ("unknown".equals(codeString))
118        return UNKNOWN;
119      if (Configuration.isAcceptInvalidEnums())
120        return null;
121      else
122        throw new FHIRException("Unknown ChargeItemStatus code '" + codeString + "'");
123    }
124
125    public String toCode() {
126      switch (this) {
127      case PLANNED:
128        return "planned";
129      case BILLABLE:
130        return "billable";
131      case NOTBILLABLE:
132        return "not-billable";
133      case ABORTED:
134        return "aborted";
135      case BILLED:
136        return "billed";
137      case ENTEREDINERROR:
138        return "entered-in-error";
139      case UNKNOWN:
140        return "unknown";
141      case NULL:
142        return null;
143      default:
144        return "?";
145      }
146    }
147
148    public String getSystem() {
149      switch (this) {
150      case PLANNED:
151        return "http://hl7.org/fhir/chargeitem-status";
152      case BILLABLE:
153        return "http://hl7.org/fhir/chargeitem-status";
154      case NOTBILLABLE:
155        return "http://hl7.org/fhir/chargeitem-status";
156      case ABORTED:
157        return "http://hl7.org/fhir/chargeitem-status";
158      case BILLED:
159        return "http://hl7.org/fhir/chargeitem-status";
160      case ENTEREDINERROR:
161        return "http://hl7.org/fhir/chargeitem-status";
162      case UNKNOWN:
163        return "http://hl7.org/fhir/chargeitem-status";
164      case NULL:
165        return null;
166      default:
167        return "?";
168      }
169    }
170
171    public String getDefinition() {
172      switch (this) {
173      case PLANNED:
174        return "The charge item has been entered, but the charged service is not  yet complete, so it shall not be billed yet but might be used in the context of pre-authorization.";
175      case BILLABLE:
176        return "The charge item is ready for billing.";
177      case NOTBILLABLE:
178        return "The charge item has been determined to be not billable (e.g. due to rules associated with the billing code).";
179      case ABORTED:
180        return "The processing of the charge was aborted.";
181      case BILLED:
182        return "The charge item has been billed (e.g. a billing engine has generated financial transactions by applying the associated ruled for the charge item to the context of the Encounter, and placed them into Claims/Invoices.";
183      case ENTEREDINERROR:
184        return "The charge item has been entered in error and should not be processed for billing.";
185      case UNKNOWN:
186        return "The authoring system does not know which of the status values currently applies for this charge item  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.";
187      case NULL:
188        return null;
189      default:
190        return "?";
191      }
192    }
193
194    public String getDisplay() {
195      switch (this) {
196      case PLANNED:
197        return "Planned";
198      case BILLABLE:
199        return "Billable";
200      case NOTBILLABLE:
201        return "Not billable";
202      case ABORTED:
203        return "Aborted";
204      case BILLED:
205        return "Billed";
206      case ENTEREDINERROR:
207        return "Entered in Error";
208      case UNKNOWN:
209        return "Unknown";
210      case NULL:
211        return null;
212      default:
213        return "?";
214      }
215    }
216  }
217
218  public static class ChargeItemStatusEnumFactory implements EnumFactory<ChargeItemStatus> {
219    public ChargeItemStatus fromCode(String codeString) throws IllegalArgumentException {
220      if (codeString == null || "".equals(codeString))
221        if (codeString == null || "".equals(codeString))
222          return null;
223      if ("planned".equals(codeString))
224        return ChargeItemStatus.PLANNED;
225      if ("billable".equals(codeString))
226        return ChargeItemStatus.BILLABLE;
227      if ("not-billable".equals(codeString))
228        return ChargeItemStatus.NOTBILLABLE;
229      if ("aborted".equals(codeString))
230        return ChargeItemStatus.ABORTED;
231      if ("billed".equals(codeString))
232        return ChargeItemStatus.BILLED;
233      if ("entered-in-error".equals(codeString))
234        return ChargeItemStatus.ENTEREDINERROR;
235      if ("unknown".equals(codeString))
236        return ChargeItemStatus.UNKNOWN;
237      throw new IllegalArgumentException("Unknown ChargeItemStatus code '" + codeString + "'");
238    }
239
240    public Enumeration<ChargeItemStatus> fromType(PrimitiveType<?> code) throws FHIRException {
241      if (code == null)
242        return null;
243      if (code.isEmpty())
244        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.NULL, code);
245      String codeString = code.asStringValue();
246      if (codeString == null || "".equals(codeString))
247        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.NULL, code);
248      if ("planned".equals(codeString))
249        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.PLANNED, code);
250      if ("billable".equals(codeString))
251        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.BILLABLE, code);
252      if ("not-billable".equals(codeString))
253        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.NOTBILLABLE, code);
254      if ("aborted".equals(codeString))
255        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.ABORTED, code);
256      if ("billed".equals(codeString))
257        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.BILLED, code);
258      if ("entered-in-error".equals(codeString))
259        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.ENTEREDINERROR, code);
260      if ("unknown".equals(codeString))
261        return new Enumeration<ChargeItemStatus>(this, ChargeItemStatus.UNKNOWN, code);
262      throw new FHIRException("Unknown ChargeItemStatus code '" + codeString + "'");
263    }
264
265    public String toCode(ChargeItemStatus code) {
266       if (code == ChargeItemStatus.NULL)
267           return null;
268       if (code == ChargeItemStatus.PLANNED)
269        return "planned";
270      if (code == ChargeItemStatus.BILLABLE)
271        return "billable";
272      if (code == ChargeItemStatus.NOTBILLABLE)
273        return "not-billable";
274      if (code == ChargeItemStatus.ABORTED)
275        return "aborted";
276      if (code == ChargeItemStatus.BILLED)
277        return "billed";
278      if (code == ChargeItemStatus.ENTEREDINERROR)
279        return "entered-in-error";
280      if (code == ChargeItemStatus.UNKNOWN)
281        return "unknown";
282      return "?";
283   }
284
285    public String toSystem(ChargeItemStatus code) {
286      return code.getSystem();
287    }
288  }
289
290  @Block()
291  public static class ChargeItemPerformerComponent extends BackboneElement implements IBaseBackboneElement {
292    /**
293     * Describes the type of performance or participation(e.g. primary surgeon,
294     * anesthesiologiest, etc.).
295     */
296    @Child(name = "function", type = {
297        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
298    @Description(shortDefinition = "What type of performance was done", formalDefinition = "Describes the type of performance or participation(e.g. primary surgeon, anesthesiologiest, etc.).")
299    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/performer-role")
300    protected CodeableConcept function;
301
302    /**
303     * The device, practitioner, etc. who performed or participated in the service.
304     */
305    @Child(name = "actor", type = { Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class,
306        Patient.class, Device.class,
307        RelatedPerson.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
308    @Description(shortDefinition = "Individual who was performing", formalDefinition = "The device, practitioner, etc. who performed or participated in the service.")
309    protected Reference actor;
310
311    /**
312     * The actual object that is the target of the reference (The device,
313     * practitioner, etc. who performed or participated in the service.)
314     */
315    protected Resource actorTarget;
316
317    private static final long serialVersionUID = 1424001049L;
318
319    /**
320     * Constructor
321     */
322    public ChargeItemPerformerComponent() {
323      super();
324    }
325
326    /**
327     * Constructor
328     */
329    public ChargeItemPerformerComponent(Reference actor) {
330      super();
331      this.actor = actor;
332    }
333
334    /**
335     * @return {@link #function} (Describes the type of performance or
336     *         participation(e.g. primary surgeon, anesthesiologiest, etc.).)
337     */
338    public CodeableConcept getFunction() {
339      if (this.function == null)
340        if (Configuration.errorOnAutoCreate())
341          throw new Error("Attempt to auto-create ChargeItemPerformerComponent.function");
342        else if (Configuration.doAutoCreate())
343          this.function = new CodeableConcept(); // cc
344      return this.function;
345    }
346
347    public boolean hasFunction() {
348      return this.function != null && !this.function.isEmpty();
349    }
350
351    /**
352     * @param value {@link #function} (Describes the type of performance or
353     *              participation(e.g. primary surgeon, anesthesiologiest, etc.).)
354     */
355    public ChargeItemPerformerComponent setFunction(CodeableConcept value) {
356      this.function = value;
357      return this;
358    }
359
360    /**
361     * @return {@link #actor} (The device, practitioner, etc. who performed or
362     *         participated in the service.)
363     */
364    public Reference getActor() {
365      if (this.actor == null)
366        if (Configuration.errorOnAutoCreate())
367          throw new Error("Attempt to auto-create ChargeItemPerformerComponent.actor");
368        else if (Configuration.doAutoCreate())
369          this.actor = new Reference(); // cc
370      return this.actor;
371    }
372
373    public boolean hasActor() {
374      return this.actor != null && !this.actor.isEmpty();
375    }
376
377    /**
378     * @param value {@link #actor} (The device, practitioner, etc. who performed or
379     *              participated in the service.)
380     */
381    public ChargeItemPerformerComponent setActor(Reference value) {
382      this.actor = value;
383      return this;
384    }
385
386    /**
387     * @return {@link #actor} The actual object that is the target of the reference.
388     *         The reference library doesn't populate this, but you can use it to
389     *         hold the resource if you resolve it. (The device, practitioner, etc.
390     *         who performed or participated in the service.)
391     */
392    public Resource getActorTarget() {
393      return this.actorTarget;
394    }
395
396    /**
397     * @param value {@link #actor} The actual object that is the target of the
398     *              reference. The reference library doesn't use these, but you can
399     *              use it to hold the resource if you resolve it. (The device,
400     *              practitioner, etc. who performed or participated in the
401     *              service.)
402     */
403    public ChargeItemPerformerComponent setActorTarget(Resource value) {
404      this.actorTarget = value;
405      return this;
406    }
407
408    protected void listChildren(List<Property> children) {
409      super.listChildren(children);
410      children.add(new Property("function", "CodeableConcept",
411          "Describes the type of performance or participation(e.g. primary surgeon, anesthesiologiest, etc.).", 0, 1,
412          function));
413      children.add(new Property("actor",
414          "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)",
415          "The device, practitioner, etc. who performed or participated in the service.", 0, 1, actor));
416    }
417
418    @Override
419    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
420      switch (_hash) {
421      case 1380938712:
422        /* function */ return new Property("function", "CodeableConcept",
423            "Describes the type of performance or participation(e.g. primary surgeon, anesthesiologiest, etc.).", 0, 1,
424            function);
425      case 92645877:
426        /* actor */ return new Property("actor",
427            "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)",
428            "The device, practitioner, etc. who performed or participated in the service.", 0, 1, actor);
429      default:
430        return super.getNamedProperty(_hash, _name, _checkValid);
431      }
432
433    }
434
435    @Override
436    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
437      switch (hash) {
438      case 1380938712:
439        /* function */ return this.function == null ? new Base[0] : new Base[] { this.function }; // CodeableConcept
440      case 92645877:
441        /* actor */ return this.actor == null ? new Base[0] : new Base[] { this.actor }; // Reference
442      default:
443        return super.getProperty(hash, name, checkValid);
444      }
445
446    }
447
448    @Override
449    public Base setProperty(int hash, String name, Base value) throws FHIRException {
450      switch (hash) {
451      case 1380938712: // function
452        this.function = castToCodeableConcept(value); // CodeableConcept
453        return value;
454      case 92645877: // actor
455        this.actor = castToReference(value); // Reference
456        return value;
457      default:
458        return super.setProperty(hash, name, value);
459      }
460
461    }
462
463    @Override
464    public Base setProperty(String name, Base value) throws FHIRException {
465      if (name.equals("function")) {
466        this.function = castToCodeableConcept(value); // CodeableConcept
467      } else if (name.equals("actor")) {
468        this.actor = castToReference(value); // Reference
469      } else
470        return super.setProperty(name, value);
471      return value;
472    }
473
474  @Override
475  public void removeChild(String name, Base value) throws FHIRException {
476      if (name.equals("function")) {
477        this.function = null;
478      } else if (name.equals("actor")) {
479        this.actor = null;
480      } else
481        super.removeChild(name, value);
482      
483    }
484
485    @Override
486    public Base makeProperty(int hash, String name) throws FHIRException {
487      switch (hash) {
488      case 1380938712:
489        return getFunction();
490      case 92645877:
491        return getActor();
492      default:
493        return super.makeProperty(hash, name);
494      }
495
496    }
497
498    @Override
499    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
500      switch (hash) {
501      case 1380938712:
502        /* function */ return new String[] { "CodeableConcept" };
503      case 92645877:
504        /* actor */ return new String[] { "Reference" };
505      default:
506        return super.getTypesForProperty(hash, name);
507      }
508
509    }
510
511    @Override
512    public Base addChild(String name) throws FHIRException {
513      if (name.equals("function")) {
514        this.function = new CodeableConcept();
515        return this.function;
516      } else if (name.equals("actor")) {
517        this.actor = new Reference();
518        return this.actor;
519      } else
520        return super.addChild(name);
521    }
522
523    public ChargeItemPerformerComponent copy() {
524      ChargeItemPerformerComponent dst = new ChargeItemPerformerComponent();
525      copyValues(dst);
526      return dst;
527    }
528
529    public void copyValues(ChargeItemPerformerComponent dst) {
530      super.copyValues(dst);
531      dst.function = function == null ? null : function.copy();
532      dst.actor = actor == null ? null : actor.copy();
533    }
534
535    @Override
536    public boolean equalsDeep(Base other_) {
537      if (!super.equalsDeep(other_))
538        return false;
539      if (!(other_ instanceof ChargeItemPerformerComponent))
540        return false;
541      ChargeItemPerformerComponent o = (ChargeItemPerformerComponent) other_;
542      return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
543    }
544
545    @Override
546    public boolean equalsShallow(Base other_) {
547      if (!super.equalsShallow(other_))
548        return false;
549      if (!(other_ instanceof ChargeItemPerformerComponent))
550        return false;
551      ChargeItemPerformerComponent o = (ChargeItemPerformerComponent) other_;
552      return true;
553    }
554
555    public boolean isEmpty() {
556      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
557    }
558
559    public String fhirType() {
560      return "ChargeItem.performer";
561
562    }
563
564  }
565
566  /**
567   * Identifiers assigned to this event performer or other systems.
568   */
569  @Child(name = "identifier", type = {
570      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
571  @Description(shortDefinition = "Business Identifier for item", formalDefinition = "Identifiers assigned to this event performer or other systems.")
572  protected List<Identifier> identifier;
573
574  /**
575   * References the (external) source of pricing information, rules of application
576   * for the code this ChargeItem uses.
577   */
578  @Child(name = "definitionUri", type = {
579      UriType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
580  @Description(shortDefinition = "Defining information about the code of this charge item", formalDefinition = "References the (external) source of pricing information, rules of application for the code this ChargeItem uses.")
581  protected List<UriType> definitionUri;
582
583  /**
584   * References the source of pricing information, rules of application for the
585   * code this ChargeItem uses.
586   */
587  @Child(name = "definitionCanonical", type = {
588      CanonicalType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
589  @Description(shortDefinition = "Resource defining the code of this ChargeItem", formalDefinition = "References the source of pricing information, rules of application for the code this ChargeItem uses.")
590  protected List<CanonicalType> definitionCanonical;
591
592  /**
593   * The current state of the ChargeItem.
594   */
595  @Child(name = "status", type = { CodeType.class }, order = 3, min = 1, max = 1, modifier = true, summary = true)
596  @Description(shortDefinition = "planned | billable | not-billable | aborted | billed | entered-in-error | unknown", formalDefinition = "The current state of the ChargeItem.")
597  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/chargeitem-status")
598  protected Enumeration<ChargeItemStatus> status;
599
600  /**
601   * ChargeItems can be grouped to larger ChargeItems covering the whole set.
602   */
603  @Child(name = "partOf", type = {
604      ChargeItem.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
605  @Description(shortDefinition = "Part of referenced ChargeItem", formalDefinition = "ChargeItems can be grouped to larger ChargeItems covering the whole set.")
606  protected List<Reference> partOf;
607  /**
608   * The actual objects that are the target of the reference (ChargeItems can be
609   * grouped to larger ChargeItems covering the whole set.)
610   */
611  protected List<ChargeItem> partOfTarget;
612
613  /**
614   * A code that identifies the charge, like a billing code.
615   */
616  @Child(name = "code", type = { CodeableConcept.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
617  @Description(shortDefinition = "A code that identifies the charge, like a billing code", formalDefinition = "A code that identifies the charge, like a billing code.")
618  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/chargeitem-billingcodes")
619  protected CodeableConcept code;
620
621  /**
622   * The individual or set of individuals the action is being or was performed on.
623   */
624  @Child(name = "subject", type = { Patient.class,
625      Group.class }, order = 6, min = 1, max = 1, modifier = false, summary = true)
626  @Description(shortDefinition = "Individual service was done for/to", formalDefinition = "The individual or set of individuals the action is being or was performed on.")
627  protected Reference subject;
628
629  /**
630   * The actual object that is the target of the reference (The individual or set
631   * of individuals the action is being or was performed on.)
632   */
633  protected Resource subjectTarget;
634
635  /**
636   * The encounter or episode of care that establishes the context for this event.
637   */
638  @Child(name = "context", type = { Encounter.class,
639      EpisodeOfCare.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
640  @Description(shortDefinition = "Encounter / Episode associated with event", formalDefinition = "The encounter or episode of care that establishes the context for this event.")
641  protected Reference context;
642
643  /**
644   * The actual object that is the target of the reference (The encounter or
645   * episode of care that establishes the context for this event.)
646   */
647  protected Resource contextTarget;
648
649  /**
650   * Date/time(s) or duration when the charged service was applied.
651   */
652  @Child(name = "occurrence", type = { DateTimeType.class, Period.class,
653      Timing.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
654  @Description(shortDefinition = "When the charged service was applied", formalDefinition = "Date/time(s) or duration when the charged service was applied.")
655  protected Type occurrence;
656
657  /**
658   * Indicates who or what performed or participated in the charged service.
659   */
660  @Child(name = "performer", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
661  @Description(shortDefinition = "Who performed charged service", formalDefinition = "Indicates who or what performed or participated in the charged service.")
662  protected List<ChargeItemPerformerComponent> performer;
663
664  /**
665   * The organization requesting the service.
666   */
667  @Child(name = "performingOrganization", type = {
668      Organization.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
669  @Description(shortDefinition = "Organization providing the charged service", formalDefinition = "The organization requesting the service.")
670  protected Reference performingOrganization;
671
672  /**
673   * The actual object that is the target of the reference (The organization
674   * requesting the service.)
675   */
676  protected Organization performingOrganizationTarget;
677
678  /**
679   * The organization performing the service.
680   */
681  @Child(name = "requestingOrganization", type = {
682      Organization.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
683  @Description(shortDefinition = "Organization requesting the charged service", formalDefinition = "The organization performing the service.")
684  protected Reference requestingOrganization;
685
686  /**
687   * The actual object that is the target of the reference (The organization
688   * performing the service.)
689   */
690  protected Organization requestingOrganizationTarget;
691
692  /**
693   * The financial cost center permits the tracking of charge attribution.
694   */
695  @Child(name = "costCenter", type = {
696      Organization.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
697  @Description(shortDefinition = "Organization that has ownership of the (potential, future) revenue", formalDefinition = "The financial cost center permits the tracking of charge attribution.")
698  protected Reference costCenter;
699
700  /**
701   * The actual object that is the target of the reference (The financial cost
702   * center permits the tracking of charge attribution.)
703   */
704  protected Organization costCenterTarget;
705
706  /**
707   * Quantity of which the charge item has been serviced.
708   */
709  @Child(name = "quantity", type = { Quantity.class }, order = 13, min = 0, max = 1, modifier = false, summary = true)
710  @Description(shortDefinition = "Quantity of which the charge item has been serviced", formalDefinition = "Quantity of which the charge item has been serviced.")
711  protected Quantity quantity;
712
713  /**
714   * The anatomical location where the related service has been applied.
715   */
716  @Child(name = "bodysite", type = {
717      CodeableConcept.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
718  @Description(shortDefinition = "Anatomical location, if relevant", formalDefinition = "The anatomical location where the related service has been applied.")
719  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/body-site")
720  protected List<CodeableConcept> bodysite;
721
722  /**
723   * Factor overriding the factor determined by the rules associated with the
724   * code.
725   */
726  @Child(name = "factorOverride", type = {
727      DecimalType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
728  @Description(shortDefinition = "Factor overriding the associated rules", formalDefinition = "Factor overriding the factor determined by the rules associated with the code.")
729  protected DecimalType factorOverride;
730
731  /**
732   * Total price of the charge overriding the list price associated with the code.
733   */
734  @Child(name = "priceOverride", type = {
735      Money.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
736  @Description(shortDefinition = "Price overriding the associated rules", formalDefinition = "Total price of the charge overriding the list price associated with the code.")
737  protected Money priceOverride;
738
739  /**
740   * If the list price or the rule-based factor associated with the code is
741   * overridden, this attribute can capture a text to indicate the reason for this
742   * action.
743   */
744  @Child(name = "overrideReason", type = {
745      StringType.class }, order = 17, min = 0, max = 1, modifier = false, summary = false)
746  @Description(shortDefinition = "Reason for overriding the list price/factor", formalDefinition = "If the list price or the rule-based factor associated with the code is overridden, this attribute can capture a text to indicate the  reason for this action.")
747  protected StringType overrideReason;
748
749  /**
750   * The device, practitioner, etc. who entered the charge item.
751   */
752  @Child(name = "enterer", type = { Practitioner.class, PractitionerRole.class, Organization.class, Patient.class,
753      Device.class, RelatedPerson.class }, order = 18, min = 0, max = 1, modifier = false, summary = true)
754  @Description(shortDefinition = "Individual who was entering", formalDefinition = "The device, practitioner, etc. who entered the charge item.")
755  protected Reference enterer;
756
757  /**
758   * The actual object that is the target of the reference (The device,
759   * practitioner, etc. who entered the charge item.)
760   */
761  protected Resource entererTarget;
762
763  /**
764   * Date the charge item was entered.
765   */
766  @Child(name = "enteredDate", type = {
767      DateTimeType.class }, order = 19, min = 0, max = 1, modifier = false, summary = true)
768  @Description(shortDefinition = "Date the charge item was entered", formalDefinition = "Date the charge item was entered.")
769  protected DateTimeType enteredDate;
770
771  /**
772   * Describes why the event occurred in coded or textual form.
773   */
774  @Child(name = "reason", type = {
775      CodeableConcept.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
776  @Description(shortDefinition = "Why was the charged  service rendered?", formalDefinition = "Describes why the event occurred in coded or textual form.")
777  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10")
778  protected List<CodeableConcept> reason;
779
780  /**
781   * Indicated the rendered service that caused this charge.
782   */
783  @Child(name = "service", type = { DiagnosticReport.class, ImagingStudy.class, Immunization.class,
784      MedicationAdministration.class, MedicationDispense.class, Observation.class, Procedure.class,
785      SupplyDelivery.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
786  @Description(shortDefinition = "Which rendered service is being charged?", formalDefinition = "Indicated the rendered service that caused this charge.")
787  protected List<Reference> service;
788  /**
789   * The actual objects that are the target of the reference (Indicated the
790   * rendered service that caused this charge.)
791   */
792  protected List<Resource> serviceTarget;
793
794  /**
795   * Identifies the device, food, drug or other product being charged either by
796   * type code or reference to an instance.
797   */
798  @Child(name = "product", type = { Device.class, Medication.class, Substance.class,
799      CodeableConcept.class }, order = 22, min = 0, max = 1, modifier = false, summary = false)
800  @Description(shortDefinition = "Product charged", formalDefinition = "Identifies the device, food, drug or other product being charged either by type code or reference to an instance.")
801  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/device-kind")
802  protected Type product;
803
804  /**
805   * Account into which this ChargeItems belongs.
806   */
807  @Child(name = "account", type = {
808      Account.class }, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
809  @Description(shortDefinition = "Account to place this charge", formalDefinition = "Account into which this ChargeItems belongs.")
810  protected List<Reference> account;
811  /**
812   * The actual objects that are the target of the reference (Account into which
813   * this ChargeItems belongs.)
814   */
815  protected List<Account> accountTarget;
816
817  /**
818   * Comments made about the event by the performer, subject or other
819   * participants.
820   */
821  @Child(name = "note", type = {
822      Annotation.class }, order = 24, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
823  @Description(shortDefinition = "Comments made about the ChargeItem", formalDefinition = "Comments made about the event by the performer, subject or other participants.")
824  protected List<Annotation> note;
825
826  /**
827   * Further information supporting this charge.
828   */
829  @Child(name = "supportingInformation", type = {
830      Reference.class }, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
831  @Description(shortDefinition = "Further information supporting this charge", formalDefinition = "Further information supporting this charge.")
832  protected List<Reference> supportingInformation;
833  /**
834   * The actual objects that are the target of the reference (Further information
835   * supporting this charge.)
836   */
837  protected List<Resource> supportingInformationTarget;
838
839  private static final long serialVersionUID = 1748644267L;
840
841  /**
842   * Constructor
843   */
844  public ChargeItem() {
845    super();
846  }
847
848  /**
849   * Constructor
850   */
851  public ChargeItem(Enumeration<ChargeItemStatus> status, CodeableConcept code, Reference subject) {
852    super();
853    this.status = status;
854    this.code = code;
855    this.subject = subject;
856  }
857
858  /**
859   * @return {@link #identifier} (Identifiers assigned to this event performer or
860   *         other systems.)
861   */
862  public List<Identifier> getIdentifier() {
863    if (this.identifier == null)
864      this.identifier = new ArrayList<Identifier>();
865    return this.identifier;
866  }
867
868  /**
869   * @return Returns a reference to <code>this</code> for easy method chaining
870   */
871  public ChargeItem setIdentifier(List<Identifier> theIdentifier) {
872    this.identifier = theIdentifier;
873    return this;
874  }
875
876  public boolean hasIdentifier() {
877    if (this.identifier == null)
878      return false;
879    for (Identifier item : this.identifier)
880      if (!item.isEmpty())
881        return true;
882    return false;
883  }
884
885  public Identifier addIdentifier() { // 3
886    Identifier t = new Identifier();
887    if (this.identifier == null)
888      this.identifier = new ArrayList<Identifier>();
889    this.identifier.add(t);
890    return t;
891  }
892
893  public ChargeItem addIdentifier(Identifier t) { // 3
894    if (t == null)
895      return this;
896    if (this.identifier == null)
897      this.identifier = new ArrayList<Identifier>();
898    this.identifier.add(t);
899    return this;
900  }
901
902  /**
903   * @return The first repetition of repeating field {@link #identifier}, creating
904   *         it if it does not already exist
905   */
906  public Identifier getIdentifierFirstRep() {
907    if (getIdentifier().isEmpty()) {
908      addIdentifier();
909    }
910    return getIdentifier().get(0);
911  }
912
913  /**
914   * @return {@link #definitionUri} (References the (external) source of pricing
915   *         information, rules of application for the code this ChargeItem uses.)
916   */
917  public List<UriType> getDefinitionUri() {
918    if (this.definitionUri == null)
919      this.definitionUri = new ArrayList<UriType>();
920    return this.definitionUri;
921  }
922
923  /**
924   * @return Returns a reference to <code>this</code> for easy method chaining
925   */
926  public ChargeItem setDefinitionUri(List<UriType> theDefinitionUri) {
927    this.definitionUri = theDefinitionUri;
928    return this;
929  }
930
931  public boolean hasDefinitionUri() {
932    if (this.definitionUri == null)
933      return false;
934    for (UriType item : this.definitionUri)
935      if (!item.isEmpty())
936        return true;
937    return false;
938  }
939
940  /**
941   * @return {@link #definitionUri} (References the (external) source of pricing
942   *         information, rules of application for the code this ChargeItem uses.)
943   */
944  public UriType addDefinitionUriElement() {// 2
945    UriType t = new UriType();
946    if (this.definitionUri == null)
947      this.definitionUri = new ArrayList<UriType>();
948    this.definitionUri.add(t);
949    return t;
950  }
951
952  /**
953   * @param value {@link #definitionUri} (References the (external) source of
954   *              pricing information, rules of application for the code this
955   *              ChargeItem uses.)
956   */
957  public ChargeItem addDefinitionUri(String value) { // 1
958    UriType t = new UriType();
959    t.setValue(value);
960    if (this.definitionUri == null)
961      this.definitionUri = new ArrayList<UriType>();
962    this.definitionUri.add(t);
963    return this;
964  }
965
966  /**
967   * @param value {@link #definitionUri} (References the (external) source of
968   *              pricing information, rules of application for the code this
969   *              ChargeItem uses.)
970   */
971  public boolean hasDefinitionUri(String value) {
972    if (this.definitionUri == null)
973      return false;
974    for (UriType v : this.definitionUri)
975      if (v.getValue().equals(value)) // uri
976        return true;
977    return false;
978  }
979
980  /**
981   * @return {@link #definitionCanonical} (References the source of pricing
982   *         information, rules of application for the code this ChargeItem uses.)
983   */
984  public List<CanonicalType> getDefinitionCanonical() {
985    if (this.definitionCanonical == null)
986      this.definitionCanonical = new ArrayList<CanonicalType>();
987    return this.definitionCanonical;
988  }
989
990  /**
991   * @return Returns a reference to <code>this</code> for easy method chaining
992   */
993  public ChargeItem setDefinitionCanonical(List<CanonicalType> theDefinitionCanonical) {
994    this.definitionCanonical = theDefinitionCanonical;
995    return this;
996  }
997
998  public boolean hasDefinitionCanonical() {
999    if (this.definitionCanonical == null)
1000      return false;
1001    for (CanonicalType item : this.definitionCanonical)
1002      if (!item.isEmpty())
1003        return true;
1004    return false;
1005  }
1006
1007  /**
1008   * @return {@link #definitionCanonical} (References the source of pricing
1009   *         information, rules of application for the code this ChargeItem uses.)
1010   */
1011  public CanonicalType addDefinitionCanonicalElement() {// 2
1012    CanonicalType t = new CanonicalType();
1013    if (this.definitionCanonical == null)
1014      this.definitionCanonical = new ArrayList<CanonicalType>();
1015    this.definitionCanonical.add(t);
1016    return t;
1017  }
1018
1019  /**
1020   * @param value {@link #definitionCanonical} (References the source of pricing
1021   *              information, rules of application for the code this ChargeItem
1022   *              uses.)
1023   */
1024  public ChargeItem addDefinitionCanonical(String value) { // 1
1025    CanonicalType t = new CanonicalType();
1026    t.setValue(value);
1027    if (this.definitionCanonical == null)
1028      this.definitionCanonical = new ArrayList<CanonicalType>();
1029    this.definitionCanonical.add(t);
1030    return this;
1031  }
1032
1033  /**
1034   * @param value {@link #definitionCanonical} (References the source of pricing
1035   *              information, rules of application for the code this ChargeItem
1036   *              uses.)
1037   */
1038  public boolean hasDefinitionCanonical(String value) {
1039    if (this.definitionCanonical == null)
1040      return false;
1041    for (CanonicalType v : this.definitionCanonical)
1042      if (v.getValue().equals(value)) // canonical(ChargeItemDefinition)
1043        return true;
1044    return false;
1045  }
1046
1047  /**
1048   * @return {@link #status} (The current state of the ChargeItem.). This is the
1049   *         underlying object with id, value and extensions. The accessor
1050   *         "getStatus" gives direct access to the value
1051   */
1052  public Enumeration<ChargeItemStatus> getStatusElement() {
1053    if (this.status == null)
1054      if (Configuration.errorOnAutoCreate())
1055        throw new Error("Attempt to auto-create ChargeItem.status");
1056      else if (Configuration.doAutoCreate())
1057        this.status = new Enumeration<ChargeItemStatus>(new ChargeItemStatusEnumFactory()); // bb
1058    return this.status;
1059  }
1060
1061  public boolean hasStatusElement() {
1062    return this.status != null && !this.status.isEmpty();
1063  }
1064
1065  public boolean hasStatus() {
1066    return this.status != null && !this.status.isEmpty();
1067  }
1068
1069  /**
1070   * @param value {@link #status} (The current state of the ChargeItem.). This is
1071   *              the underlying object with id, value and extensions. The
1072   *              accessor "getStatus" gives direct access to the value
1073   */
1074  public ChargeItem setStatusElement(Enumeration<ChargeItemStatus> value) {
1075    this.status = value;
1076    return this;
1077  }
1078
1079  /**
1080   * @return The current state of the ChargeItem.
1081   */
1082  public ChargeItemStatus getStatus() {
1083    return this.status == null ? null : this.status.getValue();
1084  }
1085
1086  /**
1087   * @param value The current state of the ChargeItem.
1088   */
1089  public ChargeItem setStatus(ChargeItemStatus value) {
1090    if (this.status == null)
1091      this.status = new Enumeration<ChargeItemStatus>(new ChargeItemStatusEnumFactory());
1092    this.status.setValue(value);
1093    return this;
1094  }
1095
1096  /**
1097   * @return {@link #partOf} (ChargeItems can be grouped to larger ChargeItems
1098   *         covering the whole set.)
1099   */
1100  public List<Reference> getPartOf() {
1101    if (this.partOf == null)
1102      this.partOf = new ArrayList<Reference>();
1103    return this.partOf;
1104  }
1105
1106  /**
1107   * @return Returns a reference to <code>this</code> for easy method chaining
1108   */
1109  public ChargeItem setPartOf(List<Reference> thePartOf) {
1110    this.partOf = thePartOf;
1111    return this;
1112  }
1113
1114  public boolean hasPartOf() {
1115    if (this.partOf == null)
1116      return false;
1117    for (Reference item : this.partOf)
1118      if (!item.isEmpty())
1119        return true;
1120    return false;
1121  }
1122
1123  public Reference addPartOf() { // 3
1124    Reference t = new Reference();
1125    if (this.partOf == null)
1126      this.partOf = new ArrayList<Reference>();
1127    this.partOf.add(t);
1128    return t;
1129  }
1130
1131  public ChargeItem addPartOf(Reference t) { // 3
1132    if (t == null)
1133      return this;
1134    if (this.partOf == null)
1135      this.partOf = new ArrayList<Reference>();
1136    this.partOf.add(t);
1137    return this;
1138  }
1139
1140  /**
1141   * @return The first repetition of repeating field {@link #partOf}, creating it
1142   *         if it does not already exist
1143   */
1144  public Reference getPartOfFirstRep() {
1145    if (getPartOf().isEmpty()) {
1146      addPartOf();
1147    }
1148    return getPartOf().get(0);
1149  }
1150
1151  /**
1152   * @deprecated Use Reference#setResource(IBaseResource) instead
1153   */
1154  @Deprecated
1155  public List<ChargeItem> getPartOfTarget() {
1156    if (this.partOfTarget == null)
1157      this.partOfTarget = new ArrayList<ChargeItem>();
1158    return this.partOfTarget;
1159  }
1160
1161  /**
1162   * @deprecated Use Reference#setResource(IBaseResource) instead
1163   */
1164  @Deprecated
1165  public ChargeItem addPartOfTarget() {
1166    ChargeItem r = new ChargeItem();
1167    if (this.partOfTarget == null)
1168      this.partOfTarget = new ArrayList<ChargeItem>();
1169    this.partOfTarget.add(r);
1170    return r;
1171  }
1172
1173  /**
1174   * @return {@link #code} (A code that identifies the charge, like a billing
1175   *         code.)
1176   */
1177  public CodeableConcept getCode() {
1178    if (this.code == null)
1179      if (Configuration.errorOnAutoCreate())
1180        throw new Error("Attempt to auto-create ChargeItem.code");
1181      else if (Configuration.doAutoCreate())
1182        this.code = new CodeableConcept(); // cc
1183    return this.code;
1184  }
1185
1186  public boolean hasCode() {
1187    return this.code != null && !this.code.isEmpty();
1188  }
1189
1190  /**
1191   * @param value {@link #code} (A code that identifies the charge, like a billing
1192   *              code.)
1193   */
1194  public ChargeItem setCode(CodeableConcept value) {
1195    this.code = value;
1196    return this;
1197  }
1198
1199  /**
1200   * @return {@link #subject} (The individual or set of individuals the action is
1201   *         being or was performed on.)
1202   */
1203  public Reference getSubject() {
1204    if (this.subject == null)
1205      if (Configuration.errorOnAutoCreate())
1206        throw new Error("Attempt to auto-create ChargeItem.subject");
1207      else if (Configuration.doAutoCreate())
1208        this.subject = new Reference(); // cc
1209    return this.subject;
1210  }
1211
1212  public boolean hasSubject() {
1213    return this.subject != null && !this.subject.isEmpty();
1214  }
1215
1216  /**
1217   * @param value {@link #subject} (The individual or set of individuals the
1218   *              action is being or was performed on.)
1219   */
1220  public ChargeItem setSubject(Reference value) {
1221    this.subject = value;
1222    return this;
1223  }
1224
1225  /**
1226   * @return {@link #subject} The actual object that is the target of the
1227   *         reference. The reference library doesn't populate this, but you can
1228   *         use it to hold the resource if you resolve it. (The individual or set
1229   *         of individuals the action is being or was performed on.)
1230   */
1231  public Resource getSubjectTarget() {
1232    return this.subjectTarget;
1233  }
1234
1235  /**
1236   * @param value {@link #subject} The actual object that is the target of the
1237   *              reference. The reference library doesn't use these, but you can
1238   *              use it to hold the resource if you resolve it. (The individual
1239   *              or set of individuals the action is being or was performed on.)
1240   */
1241  public ChargeItem setSubjectTarget(Resource value) {
1242    this.subjectTarget = value;
1243    return this;
1244  }
1245
1246  /**
1247   * @return {@link #context} (The encounter or episode of care that establishes
1248   *         the context for this event.)
1249   */
1250  public Reference getContext() {
1251    if (this.context == null)
1252      if (Configuration.errorOnAutoCreate())
1253        throw new Error("Attempt to auto-create ChargeItem.context");
1254      else if (Configuration.doAutoCreate())
1255        this.context = new Reference(); // cc
1256    return this.context;
1257  }
1258
1259  public boolean hasContext() {
1260    return this.context != null && !this.context.isEmpty();
1261  }
1262
1263  /**
1264   * @param value {@link #context} (The encounter or episode of care that
1265   *              establishes the context for this event.)
1266   */
1267  public ChargeItem setContext(Reference value) {
1268    this.context = value;
1269    return this;
1270  }
1271
1272  /**
1273   * @return {@link #context} The actual object that is the target of the
1274   *         reference. The reference library doesn't populate this, but you can
1275   *         use it to hold the resource if you resolve it. (The encounter or
1276   *         episode of care that establishes the context for this event.)
1277   */
1278  public Resource getContextTarget() {
1279    return this.contextTarget;
1280  }
1281
1282  /**
1283   * @param value {@link #context} The actual object that is the target of the
1284   *              reference. The reference library doesn't use these, but you can
1285   *              use it to hold the resource if you resolve it. (The encounter or
1286   *              episode of care that establishes the context for this event.)
1287   */
1288  public ChargeItem setContextTarget(Resource value) {
1289    this.contextTarget = value;
1290    return this;
1291  }
1292
1293  /**
1294   * @return {@link #occurrence} (Date/time(s) or duration when the charged
1295   *         service was applied.)
1296   */
1297  public Type getOccurrence() {
1298    return this.occurrence;
1299  }
1300
1301  /**
1302   * @return {@link #occurrence} (Date/time(s) or duration when the charged
1303   *         service was applied.)
1304   */
1305  public DateTimeType getOccurrenceDateTimeType() throws FHIRException {
1306    if (this.occurrence == null)
1307      this.occurrence = new DateTimeType();
1308    if (!(this.occurrence instanceof DateTimeType))
1309      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1310          + this.occurrence.getClass().getName() + " was encountered");
1311    return (DateTimeType) this.occurrence;
1312  }
1313
1314  public boolean hasOccurrenceDateTimeType() {
1315    return this != null && this.occurrence instanceof DateTimeType;
1316  }
1317
1318  /**
1319   * @return {@link #occurrence} (Date/time(s) or duration when the charged
1320   *         service was applied.)
1321   */
1322  public Period getOccurrencePeriod() throws FHIRException {
1323    if (this.occurrence == null)
1324      this.occurrence = new Period();
1325    if (!(this.occurrence instanceof Period))
1326      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.occurrence.getClass().getName()
1327          + " was encountered");
1328    return (Period) this.occurrence;
1329  }
1330
1331  public boolean hasOccurrencePeriod() {
1332    return this != null && this.occurrence instanceof Period;
1333  }
1334
1335  /**
1336   * @return {@link #occurrence} (Date/time(s) or duration when the charged
1337   *         service was applied.)
1338   */
1339  public Timing getOccurrenceTiming() throws FHIRException {
1340    if (this.occurrence == null)
1341      this.occurrence = new Timing();
1342    if (!(this.occurrence instanceof Timing))
1343      throw new FHIRException("Type mismatch: the type Timing was expected, but " + this.occurrence.getClass().getName()
1344          + " was encountered");
1345    return (Timing) this.occurrence;
1346  }
1347
1348  public boolean hasOccurrenceTiming() {
1349    return this != null && this.occurrence instanceof Timing;
1350  }
1351
1352  public boolean hasOccurrence() {
1353    return this.occurrence != null && !this.occurrence.isEmpty();
1354  }
1355
1356  /**
1357   * @param value {@link #occurrence} (Date/time(s) or duration when the charged
1358   *              service was applied.)
1359   */
1360  public ChargeItem setOccurrence(Type value) {
1361    if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
1362      throw new Error("Not the right type for ChargeItem.occurrence[x]: " + value.fhirType());
1363    this.occurrence = value;
1364    return this;
1365  }
1366
1367  /**
1368   * @return {@link #performer} (Indicates who or what performed or participated
1369   *         in the charged service.)
1370   */
1371  public List<ChargeItemPerformerComponent> getPerformer() {
1372    if (this.performer == null)
1373      this.performer = new ArrayList<ChargeItemPerformerComponent>();
1374    return this.performer;
1375  }
1376
1377  /**
1378   * @return Returns a reference to <code>this</code> for easy method chaining
1379   */
1380  public ChargeItem setPerformer(List<ChargeItemPerformerComponent> thePerformer) {
1381    this.performer = thePerformer;
1382    return this;
1383  }
1384
1385  public boolean hasPerformer() {
1386    if (this.performer == null)
1387      return false;
1388    for (ChargeItemPerformerComponent item : this.performer)
1389      if (!item.isEmpty())
1390        return true;
1391    return false;
1392  }
1393
1394  public ChargeItemPerformerComponent addPerformer() { // 3
1395    ChargeItemPerformerComponent t = new ChargeItemPerformerComponent();
1396    if (this.performer == null)
1397      this.performer = new ArrayList<ChargeItemPerformerComponent>();
1398    this.performer.add(t);
1399    return t;
1400  }
1401
1402  public ChargeItem addPerformer(ChargeItemPerformerComponent t) { // 3
1403    if (t == null)
1404      return this;
1405    if (this.performer == null)
1406      this.performer = new ArrayList<ChargeItemPerformerComponent>();
1407    this.performer.add(t);
1408    return this;
1409  }
1410
1411  /**
1412   * @return The first repetition of repeating field {@link #performer}, creating
1413   *         it if it does not already exist
1414   */
1415  public ChargeItemPerformerComponent getPerformerFirstRep() {
1416    if (getPerformer().isEmpty()) {
1417      addPerformer();
1418    }
1419    return getPerformer().get(0);
1420  }
1421
1422  /**
1423   * @return {@link #performingOrganization} (The organization requesting the
1424   *         service.)
1425   */
1426  public Reference getPerformingOrganization() {
1427    if (this.performingOrganization == null)
1428      if (Configuration.errorOnAutoCreate())
1429        throw new Error("Attempt to auto-create ChargeItem.performingOrganization");
1430      else if (Configuration.doAutoCreate())
1431        this.performingOrganization = new Reference(); // cc
1432    return this.performingOrganization;
1433  }
1434
1435  public boolean hasPerformingOrganization() {
1436    return this.performingOrganization != null && !this.performingOrganization.isEmpty();
1437  }
1438
1439  /**
1440   * @param value {@link #performingOrganization} (The organization requesting the
1441   *              service.)
1442   */
1443  public ChargeItem setPerformingOrganization(Reference value) {
1444    this.performingOrganization = value;
1445    return this;
1446  }
1447
1448  /**
1449   * @return {@link #performingOrganization} The actual object that is the target
1450   *         of the reference. The reference library doesn't populate this, but
1451   *         you can use it to hold the resource if you resolve it. (The
1452   *         organization requesting the service.)
1453   */
1454  public Organization getPerformingOrganizationTarget() {
1455    if (this.performingOrganizationTarget == null)
1456      if (Configuration.errorOnAutoCreate())
1457        throw new Error("Attempt to auto-create ChargeItem.performingOrganization");
1458      else if (Configuration.doAutoCreate())
1459        this.performingOrganizationTarget = new Organization(); // aa
1460    return this.performingOrganizationTarget;
1461  }
1462
1463  /**
1464   * @param value {@link #performingOrganization} The actual object that is the
1465   *              target of the reference. The reference library doesn't use
1466   *              these, but you can use it to hold the resource if you resolve
1467   *              it. (The organization requesting the service.)
1468   */
1469  public ChargeItem setPerformingOrganizationTarget(Organization value) {
1470    this.performingOrganizationTarget = value;
1471    return this;
1472  }
1473
1474  /**
1475   * @return {@link #requestingOrganization} (The organization performing the
1476   *         service.)
1477   */
1478  public Reference getRequestingOrganization() {
1479    if (this.requestingOrganization == null)
1480      if (Configuration.errorOnAutoCreate())
1481        throw new Error("Attempt to auto-create ChargeItem.requestingOrganization");
1482      else if (Configuration.doAutoCreate())
1483        this.requestingOrganization = new Reference(); // cc
1484    return this.requestingOrganization;
1485  }
1486
1487  public boolean hasRequestingOrganization() {
1488    return this.requestingOrganization != null && !this.requestingOrganization.isEmpty();
1489  }
1490
1491  /**
1492   * @param value {@link #requestingOrganization} (The organization performing the
1493   *              service.)
1494   */
1495  public ChargeItem setRequestingOrganization(Reference value) {
1496    this.requestingOrganization = value;
1497    return this;
1498  }
1499
1500  /**
1501   * @return {@link #requestingOrganization} The actual object that is the target
1502   *         of the reference. The reference library doesn't populate this, but
1503   *         you can use it to hold the resource if you resolve it. (The
1504   *         organization performing the service.)
1505   */
1506  public Organization getRequestingOrganizationTarget() {
1507    if (this.requestingOrganizationTarget == null)
1508      if (Configuration.errorOnAutoCreate())
1509        throw new Error("Attempt to auto-create ChargeItem.requestingOrganization");
1510      else if (Configuration.doAutoCreate())
1511        this.requestingOrganizationTarget = new Organization(); // aa
1512    return this.requestingOrganizationTarget;
1513  }
1514
1515  /**
1516   * @param value {@link #requestingOrganization} The actual object that is the
1517   *              target of the reference. The reference library doesn't use
1518   *              these, but you can use it to hold the resource if you resolve
1519   *              it. (The organization performing the service.)
1520   */
1521  public ChargeItem setRequestingOrganizationTarget(Organization value) {
1522    this.requestingOrganizationTarget = value;
1523    return this;
1524  }
1525
1526  /**
1527   * @return {@link #costCenter} (The financial cost center permits the tracking
1528   *         of charge attribution.)
1529   */
1530  public Reference getCostCenter() {
1531    if (this.costCenter == null)
1532      if (Configuration.errorOnAutoCreate())
1533        throw new Error("Attempt to auto-create ChargeItem.costCenter");
1534      else if (Configuration.doAutoCreate())
1535        this.costCenter = new Reference(); // cc
1536    return this.costCenter;
1537  }
1538
1539  public boolean hasCostCenter() {
1540    return this.costCenter != null && !this.costCenter.isEmpty();
1541  }
1542
1543  /**
1544   * @param value {@link #costCenter} (The financial cost center permits the
1545   *              tracking of charge attribution.)
1546   */
1547  public ChargeItem setCostCenter(Reference value) {
1548    this.costCenter = value;
1549    return this;
1550  }
1551
1552  /**
1553   * @return {@link #costCenter} The actual object that is the target of the
1554   *         reference. The reference library doesn't populate this, but you can
1555   *         use it to hold the resource if you resolve it. (The financial cost
1556   *         center permits the tracking of charge attribution.)
1557   */
1558  public Organization getCostCenterTarget() {
1559    if (this.costCenterTarget == null)
1560      if (Configuration.errorOnAutoCreate())
1561        throw new Error("Attempt to auto-create ChargeItem.costCenter");
1562      else if (Configuration.doAutoCreate())
1563        this.costCenterTarget = new Organization(); // aa
1564    return this.costCenterTarget;
1565  }
1566
1567  /**
1568   * @param value {@link #costCenter} The actual object that is the target of the
1569   *              reference. The reference library doesn't use these, but you can
1570   *              use it to hold the resource if you resolve it. (The financial
1571   *              cost center permits the tracking of charge attribution.)
1572   */
1573  public ChargeItem setCostCenterTarget(Organization value) {
1574    this.costCenterTarget = value;
1575    return this;
1576  }
1577
1578  /**
1579   * @return {@link #quantity} (Quantity of which the charge item has been
1580   *         serviced.)
1581   */
1582  public Quantity getQuantity() {
1583    if (this.quantity == null)
1584      if (Configuration.errorOnAutoCreate())
1585        throw new Error("Attempt to auto-create ChargeItem.quantity");
1586      else if (Configuration.doAutoCreate())
1587        this.quantity = new Quantity(); // cc
1588    return this.quantity;
1589  }
1590
1591  public boolean hasQuantity() {
1592    return this.quantity != null && !this.quantity.isEmpty();
1593  }
1594
1595  /**
1596   * @param value {@link #quantity} (Quantity of which the charge item has been
1597   *              serviced.)
1598   */
1599  public ChargeItem setQuantity(Quantity value) {
1600    this.quantity = value;
1601    return this;
1602  }
1603
1604  /**
1605   * @return {@link #bodysite} (The anatomical location where the related service
1606   *         has been applied.)
1607   */
1608  public List<CodeableConcept> getBodysite() {
1609    if (this.bodysite == null)
1610      this.bodysite = new ArrayList<CodeableConcept>();
1611    return this.bodysite;
1612  }
1613
1614  /**
1615   * @return Returns a reference to <code>this</code> for easy method chaining
1616   */
1617  public ChargeItem setBodysite(List<CodeableConcept> theBodysite) {
1618    this.bodysite = theBodysite;
1619    return this;
1620  }
1621
1622  public boolean hasBodysite() {
1623    if (this.bodysite == null)
1624      return false;
1625    for (CodeableConcept item : this.bodysite)
1626      if (!item.isEmpty())
1627        return true;
1628    return false;
1629  }
1630
1631  public CodeableConcept addBodysite() { // 3
1632    CodeableConcept t = new CodeableConcept();
1633    if (this.bodysite == null)
1634      this.bodysite = new ArrayList<CodeableConcept>();
1635    this.bodysite.add(t);
1636    return t;
1637  }
1638
1639  public ChargeItem addBodysite(CodeableConcept t) { // 3
1640    if (t == null)
1641      return this;
1642    if (this.bodysite == null)
1643      this.bodysite = new ArrayList<CodeableConcept>();
1644    this.bodysite.add(t);
1645    return this;
1646  }
1647
1648  /**
1649   * @return The first repetition of repeating field {@link #bodysite}, creating
1650   *         it if it does not already exist
1651   */
1652  public CodeableConcept getBodysiteFirstRep() {
1653    if (getBodysite().isEmpty()) {
1654      addBodysite();
1655    }
1656    return getBodysite().get(0);
1657  }
1658
1659  /**
1660   * @return {@link #factorOverride} (Factor overriding the factor determined by
1661   *         the rules associated with the code.). This is the underlying object
1662   *         with id, value and extensions. The accessor "getFactorOverride" gives
1663   *         direct access to the value
1664   */
1665  public DecimalType getFactorOverrideElement() {
1666    if (this.factorOverride == null)
1667      if (Configuration.errorOnAutoCreate())
1668        throw new Error("Attempt to auto-create ChargeItem.factorOverride");
1669      else if (Configuration.doAutoCreate())
1670        this.factorOverride = new DecimalType(); // bb
1671    return this.factorOverride;
1672  }
1673
1674  public boolean hasFactorOverrideElement() {
1675    return this.factorOverride != null && !this.factorOverride.isEmpty();
1676  }
1677
1678  public boolean hasFactorOverride() {
1679    return this.factorOverride != null && !this.factorOverride.isEmpty();
1680  }
1681
1682  /**
1683   * @param value {@link #factorOverride} (Factor overriding the factor determined
1684   *              by the rules associated with the code.). This is the underlying
1685   *              object with id, value and extensions. The accessor
1686   *              "getFactorOverride" gives direct access to the value
1687   */
1688  public ChargeItem setFactorOverrideElement(DecimalType value) {
1689    this.factorOverride = value;
1690    return this;
1691  }
1692
1693  /**
1694   * @return Factor overriding the factor determined by the rules associated with
1695   *         the code.
1696   */
1697  public BigDecimal getFactorOverride() {
1698    return this.factorOverride == null ? null : this.factorOverride.getValue();
1699  }
1700
1701  /**
1702   * @param value Factor overriding the factor determined by the rules associated
1703   *              with the code.
1704   */
1705  public ChargeItem setFactorOverride(BigDecimal value) {
1706    if (value == null)
1707      this.factorOverride = null;
1708    else {
1709      if (this.factorOverride == null)
1710        this.factorOverride = new DecimalType();
1711      this.factorOverride.setValue(value);
1712    }
1713    return this;
1714  }
1715
1716  /**
1717   * @param value Factor overriding the factor determined by the rules associated
1718   *              with the code.
1719   */
1720  public ChargeItem setFactorOverride(long value) {
1721    this.factorOverride = new DecimalType();
1722    this.factorOverride.setValue(value);
1723    return this;
1724  }
1725
1726  /**
1727   * @param value Factor overriding the factor determined by the rules associated
1728   *              with the code.
1729   */
1730  public ChargeItem setFactorOverride(double value) {
1731    this.factorOverride = new DecimalType();
1732    this.factorOverride.setValue(value);
1733    return this;
1734  }
1735
1736  /**
1737   * @return {@link #priceOverride} (Total price of the charge overriding the list
1738   *         price associated with the code.)
1739   */
1740  public Money getPriceOverride() {
1741    if (this.priceOverride == null)
1742      if (Configuration.errorOnAutoCreate())
1743        throw new Error("Attempt to auto-create ChargeItem.priceOverride");
1744      else if (Configuration.doAutoCreate())
1745        this.priceOverride = new Money(); // cc
1746    return this.priceOverride;
1747  }
1748
1749  public boolean hasPriceOverride() {
1750    return this.priceOverride != null && !this.priceOverride.isEmpty();
1751  }
1752
1753  /**
1754   * @param value {@link #priceOverride} (Total price of the charge overriding the
1755   *              list price associated with the code.)
1756   */
1757  public ChargeItem setPriceOverride(Money value) {
1758    this.priceOverride = value;
1759    return this;
1760  }
1761
1762  /**
1763   * @return {@link #overrideReason} (If the list price or the rule-based factor
1764   *         associated with the code is overridden, this attribute can capture a
1765   *         text to indicate the reason for this action.). This is the underlying
1766   *         object with id, value and extensions. The accessor
1767   *         "getOverrideReason" gives direct access to the value
1768   */
1769  public StringType getOverrideReasonElement() {
1770    if (this.overrideReason == null)
1771      if (Configuration.errorOnAutoCreate())
1772        throw new Error("Attempt to auto-create ChargeItem.overrideReason");
1773      else if (Configuration.doAutoCreate())
1774        this.overrideReason = new StringType(); // bb
1775    return this.overrideReason;
1776  }
1777
1778  public boolean hasOverrideReasonElement() {
1779    return this.overrideReason != null && !this.overrideReason.isEmpty();
1780  }
1781
1782  public boolean hasOverrideReason() {
1783    return this.overrideReason != null && !this.overrideReason.isEmpty();
1784  }
1785
1786  /**
1787   * @param value {@link #overrideReason} (If the list price or the rule-based
1788   *              factor associated with the code is overridden, this attribute
1789   *              can capture a text to indicate the reason for this action.).
1790   *              This is the underlying object with id, value and extensions. The
1791   *              accessor "getOverrideReason" gives direct access to the value
1792   */
1793  public ChargeItem setOverrideReasonElement(StringType value) {
1794    this.overrideReason = value;
1795    return this;
1796  }
1797
1798  /**
1799   * @return If the list price or the rule-based factor associated with the code
1800   *         is overridden, this attribute can capture a text to indicate the
1801   *         reason for this action.
1802   */
1803  public String getOverrideReason() {
1804    return this.overrideReason == null ? null : this.overrideReason.getValue();
1805  }
1806
1807  /**
1808   * @param value If the list price or the rule-based factor associated with the
1809   *              code is overridden, this attribute can capture a text to
1810   *              indicate the reason for this action.
1811   */
1812  public ChargeItem setOverrideReason(String value) {
1813    if (Utilities.noString(value))
1814      this.overrideReason = null;
1815    else {
1816      if (this.overrideReason == null)
1817        this.overrideReason = new StringType();
1818      this.overrideReason.setValue(value);
1819    }
1820    return this;
1821  }
1822
1823  /**
1824   * @return {@link #enterer} (The device, practitioner, etc. who entered the
1825   *         charge item.)
1826   */
1827  public Reference getEnterer() {
1828    if (this.enterer == null)
1829      if (Configuration.errorOnAutoCreate())
1830        throw new Error("Attempt to auto-create ChargeItem.enterer");
1831      else if (Configuration.doAutoCreate())
1832        this.enterer = new Reference(); // cc
1833    return this.enterer;
1834  }
1835
1836  public boolean hasEnterer() {
1837    return this.enterer != null && !this.enterer.isEmpty();
1838  }
1839
1840  /**
1841   * @param value {@link #enterer} (The device, practitioner, etc. who entered the
1842   *              charge item.)
1843   */
1844  public ChargeItem setEnterer(Reference value) {
1845    this.enterer = value;
1846    return this;
1847  }
1848
1849  /**
1850   * @return {@link #enterer} The actual object that is the target of the
1851   *         reference. The reference library doesn't populate this, but you can
1852   *         use it to hold the resource if you resolve it. (The device,
1853   *         practitioner, etc. who entered the charge item.)
1854   */
1855  public Resource getEntererTarget() {
1856    return this.entererTarget;
1857  }
1858
1859  /**
1860   * @param value {@link #enterer} The actual object that is the target of the
1861   *              reference. The reference library doesn't use these, but you can
1862   *              use it to hold the resource if you resolve it. (The device,
1863   *              practitioner, etc. who entered the charge item.)
1864   */
1865  public ChargeItem setEntererTarget(Resource value) {
1866    this.entererTarget = value;
1867    return this;
1868  }
1869
1870  /**
1871   * @return {@link #enteredDate} (Date the charge item was entered.). This is the
1872   *         underlying object with id, value and extensions. The accessor
1873   *         "getEnteredDate" gives direct access to the value
1874   */
1875  public DateTimeType getEnteredDateElement() {
1876    if (this.enteredDate == null)
1877      if (Configuration.errorOnAutoCreate())
1878        throw new Error("Attempt to auto-create ChargeItem.enteredDate");
1879      else if (Configuration.doAutoCreate())
1880        this.enteredDate = new DateTimeType(); // bb
1881    return this.enteredDate;
1882  }
1883
1884  public boolean hasEnteredDateElement() {
1885    return this.enteredDate != null && !this.enteredDate.isEmpty();
1886  }
1887
1888  public boolean hasEnteredDate() {
1889    return this.enteredDate != null && !this.enteredDate.isEmpty();
1890  }
1891
1892  /**
1893   * @param value {@link #enteredDate} (Date the charge item was entered.). This
1894   *              is the underlying object with id, value and extensions. The
1895   *              accessor "getEnteredDate" gives direct access to the value
1896   */
1897  public ChargeItem setEnteredDateElement(DateTimeType value) {
1898    this.enteredDate = value;
1899    return this;
1900  }
1901
1902  /**
1903   * @return Date the charge item was entered.
1904   */
1905  public Date getEnteredDate() {
1906    return this.enteredDate == null ? null : this.enteredDate.getValue();
1907  }
1908
1909  /**
1910   * @param value Date the charge item was entered.
1911   */
1912  public ChargeItem setEnteredDate(Date value) {
1913    if (value == null)
1914      this.enteredDate = null;
1915    else {
1916      if (this.enteredDate == null)
1917        this.enteredDate = new DateTimeType();
1918      this.enteredDate.setValue(value);
1919    }
1920    return this;
1921  }
1922
1923  /**
1924   * @return {@link #reason} (Describes why the event occurred in coded or textual
1925   *         form.)
1926   */
1927  public List<CodeableConcept> getReason() {
1928    if (this.reason == null)
1929      this.reason = new ArrayList<CodeableConcept>();
1930    return this.reason;
1931  }
1932
1933  /**
1934   * @return Returns a reference to <code>this</code> for easy method chaining
1935   */
1936  public ChargeItem setReason(List<CodeableConcept> theReason) {
1937    this.reason = theReason;
1938    return this;
1939  }
1940
1941  public boolean hasReason() {
1942    if (this.reason == null)
1943      return false;
1944    for (CodeableConcept item : this.reason)
1945      if (!item.isEmpty())
1946        return true;
1947    return false;
1948  }
1949
1950  public CodeableConcept addReason() { // 3
1951    CodeableConcept t = new CodeableConcept();
1952    if (this.reason == null)
1953      this.reason = new ArrayList<CodeableConcept>();
1954    this.reason.add(t);
1955    return t;
1956  }
1957
1958  public ChargeItem addReason(CodeableConcept t) { // 3
1959    if (t == null)
1960      return this;
1961    if (this.reason == null)
1962      this.reason = new ArrayList<CodeableConcept>();
1963    this.reason.add(t);
1964    return this;
1965  }
1966
1967  /**
1968   * @return The first repetition of repeating field {@link #reason}, creating it
1969   *         if it does not already exist
1970   */
1971  public CodeableConcept getReasonFirstRep() {
1972    if (getReason().isEmpty()) {
1973      addReason();
1974    }
1975    return getReason().get(0);
1976  }
1977
1978  /**
1979   * @return {@link #service} (Indicated the rendered service that caused this
1980   *         charge.)
1981   */
1982  public List<Reference> getService() {
1983    if (this.service == null)
1984      this.service = new ArrayList<Reference>();
1985    return this.service;
1986  }
1987
1988  /**
1989   * @return Returns a reference to <code>this</code> for easy method chaining
1990   */
1991  public ChargeItem setService(List<Reference> theService) {
1992    this.service = theService;
1993    return this;
1994  }
1995
1996  public boolean hasService() {
1997    if (this.service == null)
1998      return false;
1999    for (Reference item : this.service)
2000      if (!item.isEmpty())
2001        return true;
2002    return false;
2003  }
2004
2005  public Reference addService() { // 3
2006    Reference t = new Reference();
2007    if (this.service == null)
2008      this.service = new ArrayList<Reference>();
2009    this.service.add(t);
2010    return t;
2011  }
2012
2013  public ChargeItem addService(Reference t) { // 3
2014    if (t == null)
2015      return this;
2016    if (this.service == null)
2017      this.service = new ArrayList<Reference>();
2018    this.service.add(t);
2019    return this;
2020  }
2021
2022  /**
2023   * @return The first repetition of repeating field {@link #service}, creating it
2024   *         if it does not already exist
2025   */
2026  public Reference getServiceFirstRep() {
2027    if (getService().isEmpty()) {
2028      addService();
2029    }
2030    return getService().get(0);
2031  }
2032
2033  /**
2034   * @deprecated Use Reference#setResource(IBaseResource) instead
2035   */
2036  @Deprecated
2037  public List<Resource> getServiceTarget() {
2038    if (this.serviceTarget == null)
2039      this.serviceTarget = new ArrayList<Resource>();
2040    return this.serviceTarget;
2041  }
2042
2043  /**
2044   * @return {@link #product} (Identifies the device, food, drug or other product
2045   *         being charged either by type code or reference to an instance.)
2046   */
2047  public Type getProduct() {
2048    return this.product;
2049  }
2050
2051  /**
2052   * @return {@link #product} (Identifies the device, food, drug or other product
2053   *         being charged either by type code or reference to an instance.)
2054   */
2055  public Reference getProductReference() throws FHIRException {
2056    if (this.product == null)
2057      this.product = new Reference();
2058    if (!(this.product instanceof Reference))
2059      throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.product.getClass().getName()
2060          + " was encountered");
2061    return (Reference) this.product;
2062  }
2063
2064  public boolean hasProductReference() {
2065    return this != null && this.product instanceof Reference;
2066  }
2067
2068  /**
2069   * @return {@link #product} (Identifies the device, food, drug or other product
2070   *         being charged either by type code or reference to an instance.)
2071   */
2072  public CodeableConcept getProductCodeableConcept() throws FHIRException {
2073    if (this.product == null)
2074      this.product = new CodeableConcept();
2075    if (!(this.product instanceof CodeableConcept))
2076      throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2077          + this.product.getClass().getName() + " was encountered");
2078    return (CodeableConcept) this.product;
2079  }
2080
2081  public boolean hasProductCodeableConcept() {
2082    return this != null && this.product instanceof CodeableConcept;
2083  }
2084
2085  public boolean hasProduct() {
2086    return this.product != null && !this.product.isEmpty();
2087  }
2088
2089  /**
2090   * @param value {@link #product} (Identifies the device, food, drug or other
2091   *              product being charged either by type code or reference to an
2092   *              instance.)
2093   */
2094  public ChargeItem setProduct(Type value) {
2095    if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
2096      throw new Error("Not the right type for ChargeItem.product[x]: " + value.fhirType());
2097    this.product = value;
2098    return this;
2099  }
2100
2101  /**
2102   * @return {@link #account} (Account into which this ChargeItems belongs.)
2103   */
2104  public List<Reference> getAccount() {
2105    if (this.account == null)
2106      this.account = new ArrayList<Reference>();
2107    return this.account;
2108  }
2109
2110  /**
2111   * @return Returns a reference to <code>this</code> for easy method chaining
2112   */
2113  public ChargeItem setAccount(List<Reference> theAccount) {
2114    this.account = theAccount;
2115    return this;
2116  }
2117
2118  public boolean hasAccount() {
2119    if (this.account == null)
2120      return false;
2121    for (Reference item : this.account)
2122      if (!item.isEmpty())
2123        return true;
2124    return false;
2125  }
2126
2127  public Reference addAccount() { // 3
2128    Reference t = new Reference();
2129    if (this.account == null)
2130      this.account = new ArrayList<Reference>();
2131    this.account.add(t);
2132    return t;
2133  }
2134
2135  public ChargeItem addAccount(Reference t) { // 3
2136    if (t == null)
2137      return this;
2138    if (this.account == null)
2139      this.account = new ArrayList<Reference>();
2140    this.account.add(t);
2141    return this;
2142  }
2143
2144  /**
2145   * @return The first repetition of repeating field {@link #account}, creating it
2146   *         if it does not already exist
2147   */
2148  public Reference getAccountFirstRep() {
2149    if (getAccount().isEmpty()) {
2150      addAccount();
2151    }
2152    return getAccount().get(0);
2153  }
2154
2155  /**
2156   * @deprecated Use Reference#setResource(IBaseResource) instead
2157   */
2158  @Deprecated
2159  public List<Account> getAccountTarget() {
2160    if (this.accountTarget == null)
2161      this.accountTarget = new ArrayList<Account>();
2162    return this.accountTarget;
2163  }
2164
2165  /**
2166   * @deprecated Use Reference#setResource(IBaseResource) instead
2167   */
2168  @Deprecated
2169  public Account addAccountTarget() {
2170    Account r = new Account();
2171    if (this.accountTarget == null)
2172      this.accountTarget = new ArrayList<Account>();
2173    this.accountTarget.add(r);
2174    return r;
2175  }
2176
2177  /**
2178   * @return {@link #note} (Comments made about the event by the performer,
2179   *         subject or other participants.)
2180   */
2181  public List<Annotation> getNote() {
2182    if (this.note == null)
2183      this.note = new ArrayList<Annotation>();
2184    return this.note;
2185  }
2186
2187  /**
2188   * @return Returns a reference to <code>this</code> for easy method chaining
2189   */
2190  public ChargeItem setNote(List<Annotation> theNote) {
2191    this.note = theNote;
2192    return this;
2193  }
2194
2195  public boolean hasNote() {
2196    if (this.note == null)
2197      return false;
2198    for (Annotation item : this.note)
2199      if (!item.isEmpty())
2200        return true;
2201    return false;
2202  }
2203
2204  public Annotation addNote() { // 3
2205    Annotation t = new Annotation();
2206    if (this.note == null)
2207      this.note = new ArrayList<Annotation>();
2208    this.note.add(t);
2209    return t;
2210  }
2211
2212  public ChargeItem addNote(Annotation t) { // 3
2213    if (t == null)
2214      return this;
2215    if (this.note == null)
2216      this.note = new ArrayList<Annotation>();
2217    this.note.add(t);
2218    return this;
2219  }
2220
2221  /**
2222   * @return The first repetition of repeating field {@link #note}, creating it if
2223   *         it does not already exist
2224   */
2225  public Annotation getNoteFirstRep() {
2226    if (getNote().isEmpty()) {
2227      addNote();
2228    }
2229    return getNote().get(0);
2230  }
2231
2232  /**
2233   * @return {@link #supportingInformation} (Further information supporting this
2234   *         charge.)
2235   */
2236  public List<Reference> getSupportingInformation() {
2237    if (this.supportingInformation == null)
2238      this.supportingInformation = new ArrayList<Reference>();
2239    return this.supportingInformation;
2240  }
2241
2242  /**
2243   * @return Returns a reference to <code>this</code> for easy method chaining
2244   */
2245  public ChargeItem setSupportingInformation(List<Reference> theSupportingInformation) {
2246    this.supportingInformation = theSupportingInformation;
2247    return this;
2248  }
2249
2250  public boolean hasSupportingInformation() {
2251    if (this.supportingInformation == null)
2252      return false;
2253    for (Reference item : this.supportingInformation)
2254      if (!item.isEmpty())
2255        return true;
2256    return false;
2257  }
2258
2259  public Reference addSupportingInformation() { // 3
2260    Reference t = new Reference();
2261    if (this.supportingInformation == null)
2262      this.supportingInformation = new ArrayList<Reference>();
2263    this.supportingInformation.add(t);
2264    return t;
2265  }
2266
2267  public ChargeItem addSupportingInformation(Reference t) { // 3
2268    if (t == null)
2269      return this;
2270    if (this.supportingInformation == null)
2271      this.supportingInformation = new ArrayList<Reference>();
2272    this.supportingInformation.add(t);
2273    return this;
2274  }
2275
2276  /**
2277   * @return The first repetition of repeating field
2278   *         {@link #supportingInformation}, creating it if it does not already
2279   *         exist
2280   */
2281  public Reference getSupportingInformationFirstRep() {
2282    if (getSupportingInformation().isEmpty()) {
2283      addSupportingInformation();
2284    }
2285    return getSupportingInformation().get(0);
2286  }
2287
2288  /**
2289   * @deprecated Use Reference#setResource(IBaseResource) instead
2290   */
2291  @Deprecated
2292  public List<Resource> getSupportingInformationTarget() {
2293    if (this.supportingInformationTarget == null)
2294      this.supportingInformationTarget = new ArrayList<Resource>();
2295    return this.supportingInformationTarget;
2296  }
2297
2298  protected void listChildren(List<Property> children) {
2299    super.listChildren(children);
2300    children.add(new Property("identifier", "Identifier",
2301        "Identifiers assigned to this event performer or other systems.", 0, java.lang.Integer.MAX_VALUE, identifier));
2302    children.add(new Property("definitionUri", "uri",
2303        "References the (external) source of pricing information, rules of application for the code this ChargeItem uses.",
2304        0, java.lang.Integer.MAX_VALUE, definitionUri));
2305    children.add(new Property("definitionCanonical", "canonical(ChargeItemDefinition)",
2306        "References the source of pricing information, rules of application for the code this ChargeItem uses.", 0,
2307        java.lang.Integer.MAX_VALUE, definitionCanonical));
2308    children.add(new Property("status", "code", "The current state of the ChargeItem.", 0, 1, status));
2309    children.add(new Property("partOf", "Reference(ChargeItem)",
2310        "ChargeItems can be grouped to larger ChargeItems covering the whole set.", 0, java.lang.Integer.MAX_VALUE,
2311        partOf));
2312    children.add(
2313        new Property("code", "CodeableConcept", "A code that identifies the charge, like a billing code.", 0, 1, code));
2314    children.add(new Property("subject", "Reference(Patient|Group)",
2315        "The individual or set of individuals the action is being or was performed on.", 0, 1, subject));
2316    children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)",
2317        "The encounter or episode of care that establishes the context for this event.", 0, 1, context));
2318    children.add(new Property("occurrence[x]", "dateTime|Period|Timing",
2319        "Date/time(s) or duration when the charged service was applied.", 0, 1, occurrence));
2320    children
2321        .add(new Property("performer", "", "Indicates who or what performed or participated in the charged service.", 0,
2322            java.lang.Integer.MAX_VALUE, performer));
2323    children.add(new Property("performingOrganization", "Reference(Organization)",
2324        "The organization requesting the service.", 0, 1, performingOrganization));
2325    children.add(new Property("requestingOrganization", "Reference(Organization)",
2326        "The organization performing the service.", 0, 1, requestingOrganization));
2327    children.add(new Property("costCenter", "Reference(Organization)",
2328        "The financial cost center permits the tracking of charge attribution.", 0, 1, costCenter));
2329    children.add(
2330        new Property("quantity", "Quantity", "Quantity of which the charge item has been serviced.", 0, 1, quantity));
2331    children.add(new Property("bodysite", "CodeableConcept",
2332        "The anatomical location where the related service has been applied.", 0, java.lang.Integer.MAX_VALUE,
2333        bodysite));
2334    children.add(new Property("factorOverride", "decimal",
2335        "Factor overriding the factor determined by the rules associated with the code.", 0, 1, factorOverride));
2336    children.add(new Property("priceOverride", "Money",
2337        "Total price of the charge overriding the list price associated with the code.", 0, 1, priceOverride));
2338    children.add(new Property("overrideReason", "string",
2339        "If the list price or the rule-based factor associated with the code is overridden, this attribute can capture a text to indicate the  reason for this action.",
2340        0, 1, overrideReason));
2341    children.add(
2342        new Property("enterer", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson)",
2343            "The device, practitioner, etc. who entered the charge item.", 0, 1, enterer));
2344    children.add(new Property("enteredDate", "dateTime", "Date the charge item was entered.", 0, 1, enteredDate));
2345    children.add(new Property("reason", "CodeableConcept", "Describes why the event occurred in coded or textual form.",
2346        0, java.lang.Integer.MAX_VALUE, reason));
2347    children.add(new Property("service",
2348        "Reference(DiagnosticReport|ImagingStudy|Immunization|MedicationAdministration|MedicationDispense|Observation|Procedure|SupplyDelivery)",
2349        "Indicated the rendered service that caused this charge.", 0, java.lang.Integer.MAX_VALUE, service));
2350    children.add(new Property("product[x]", "Reference(Device|Medication|Substance)|CodeableConcept",
2351        "Identifies the device, food, drug or other product being charged either by type code or reference to an instance.",
2352        0, 1, product));
2353    children.add(new Property("account", "Reference(Account)", "Account into which this ChargeItems belongs.", 0,
2354        java.lang.Integer.MAX_VALUE, account));
2355    children.add(new Property("note", "Annotation",
2356        "Comments made about the event by the performer, subject or other participants.", 0,
2357        java.lang.Integer.MAX_VALUE, note));
2358    children.add(new Property("supportingInformation", "Reference(Any)", "Further information supporting this charge.",
2359        0, java.lang.Integer.MAX_VALUE, supportingInformation));
2360  }
2361
2362  @Override
2363  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2364    switch (_hash) {
2365    case -1618432855:
2366      /* identifier */ return new Property("identifier", "Identifier",
2367          "Identifiers assigned to this event performer or other systems.", 0, java.lang.Integer.MAX_VALUE, identifier);
2368    case -1139428583:
2369      /* definitionUri */ return new Property("definitionUri", "uri",
2370          "References the (external) source of pricing information, rules of application for the code this ChargeItem uses.",
2371          0, java.lang.Integer.MAX_VALUE, definitionUri);
2372    case 933485793:
2373      /* definitionCanonical */ return new Property("definitionCanonical", "canonical(ChargeItemDefinition)",
2374          "References the source of pricing information, rules of application for the code this ChargeItem uses.", 0,
2375          java.lang.Integer.MAX_VALUE, definitionCanonical);
2376    case -892481550:
2377      /* status */ return new Property("status", "code", "The current state of the ChargeItem.", 0, 1, status);
2378    case -995410646:
2379      /* partOf */ return new Property("partOf", "Reference(ChargeItem)",
2380          "ChargeItems can be grouped to larger ChargeItems covering the whole set.", 0, java.lang.Integer.MAX_VALUE,
2381          partOf);
2382    case 3059181:
2383      /* code */ return new Property("code", "CodeableConcept",
2384          "A code that identifies the charge, like a billing code.", 0, 1, code);
2385    case -1867885268:
2386      /* subject */ return new Property("subject", "Reference(Patient|Group)",
2387          "The individual or set of individuals the action is being or was performed on.", 0, 1, subject);
2388    case 951530927:
2389      /* context */ return new Property("context", "Reference(Encounter|EpisodeOfCare)",
2390          "The encounter or episode of care that establishes the context for this event.", 0, 1, context);
2391    case -2022646513:
2392      /* occurrence[x] */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2393          "Date/time(s) or duration when the charged service was applied.", 0, 1, occurrence);
2394    case 1687874001:
2395      /* occurrence */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2396          "Date/time(s) or duration when the charged service was applied.", 0, 1, occurrence);
2397    case -298443636:
2398      /* occurrenceDateTime */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2399          "Date/time(s) or duration when the charged service was applied.", 0, 1, occurrence);
2400    case 1397156594:
2401      /* occurrencePeriod */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2402          "Date/time(s) or duration when the charged service was applied.", 0, 1, occurrence);
2403    case 1515218299:
2404      /* occurrenceTiming */ return new Property("occurrence[x]", "dateTime|Period|Timing",
2405          "Date/time(s) or duration when the charged service was applied.", 0, 1, occurrence);
2406    case 481140686:
2407      /* performer */ return new Property("performer", "",
2408          "Indicates who or what performed or participated in the charged service.", 0, java.lang.Integer.MAX_VALUE,
2409          performer);
2410    case 1273192628:
2411      /* performingOrganization */ return new Property("performingOrganization", "Reference(Organization)",
2412          "The organization requesting the service.", 0, 1, performingOrganization);
2413    case 1279054790:
2414      /* requestingOrganization */ return new Property("requestingOrganization", "Reference(Organization)",
2415          "The organization performing the service.", 0, 1, requestingOrganization);
2416    case -593192318:
2417      /* costCenter */ return new Property("costCenter", "Reference(Organization)",
2418          "The financial cost center permits the tracking of charge attribution.", 0, 1, costCenter);
2419    case -1285004149:
2420      /* quantity */ return new Property("quantity", "Quantity", "Quantity of which the charge item has been serviced.",
2421          0, 1, quantity);
2422    case 1703573481:
2423      /* bodysite */ return new Property("bodysite", "CodeableConcept",
2424          "The anatomical location where the related service has been applied.", 0, java.lang.Integer.MAX_VALUE,
2425          bodysite);
2426    case -451233221:
2427      /* factorOverride */ return new Property("factorOverride", "decimal",
2428          "Factor overriding the factor determined by the rules associated with the code.", 0, 1, factorOverride);
2429    case -216803275:
2430      /* priceOverride */ return new Property("priceOverride", "Money",
2431          "Total price of the charge overriding the list price associated with the code.", 0, 1, priceOverride);
2432    case -742878928:
2433      /* overrideReason */ return new Property("overrideReason", "string",
2434          "If the list price or the rule-based factor associated with the code is overridden, this attribute can capture a text to indicate the  reason for this action.",
2435          0, 1, overrideReason);
2436    case -1591951995:
2437      /* enterer */ return new Property("enterer",
2438          "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson)",
2439          "The device, practitioner, etc. who entered the charge item.", 0, 1, enterer);
2440    case 555978181:
2441      /* enteredDate */ return new Property("enteredDate", "dateTime", "Date the charge item was entered.", 0, 1,
2442          enteredDate);
2443    case -934964668:
2444      /* reason */ return new Property("reason", "CodeableConcept",
2445          "Describes why the event occurred in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reason);
2446    case 1984153269:
2447      /* service */ return new Property("service",
2448          "Reference(DiagnosticReport|ImagingStudy|Immunization|MedicationAdministration|MedicationDispense|Observation|Procedure|SupplyDelivery)",
2449          "Indicated the rendered service that caused this charge.", 0, java.lang.Integer.MAX_VALUE, service);
2450    case 1753005361:
2451      /* product[x] */ return new Property("product[x]", "Reference(Device|Medication|Substance)|CodeableConcept",
2452          "Identifies the device, food, drug or other product being charged either by type code or reference to an instance.",
2453          0, 1, product);
2454    case -309474065:
2455      /* product */ return new Property("product[x]", "Reference(Device|Medication|Substance)|CodeableConcept",
2456          "Identifies the device, food, drug or other product being charged either by type code or reference to an instance.",
2457          0, 1, product);
2458    case -669667556:
2459      /* productReference */ return new Property("product[x]", "Reference(Device|Medication|Substance)|CodeableConcept",
2460          "Identifies the device, food, drug or other product being charged either by type code or reference to an instance.",
2461          0, 1, product);
2462    case 906854066:
2463      /* productCodeableConcept */ return new Property("product[x]",
2464          "Reference(Device|Medication|Substance)|CodeableConcept",
2465          "Identifies the device, food, drug or other product being charged either by type code or reference to an instance.",
2466          0, 1, product);
2467    case -1177318867:
2468      /* account */ return new Property("account", "Reference(Account)", "Account into which this ChargeItems belongs.",
2469          0, java.lang.Integer.MAX_VALUE, account);
2470    case 3387378:
2471      /* note */ return new Property("note", "Annotation",
2472          "Comments made about the event by the performer, subject or other participants.", 0,
2473          java.lang.Integer.MAX_VALUE, note);
2474    case -1248768647:
2475      /* supportingInformation */ return new Property("supportingInformation", "Reference(Any)",
2476          "Further information supporting this charge.", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
2477    default:
2478      return super.getNamedProperty(_hash, _name, _checkValid);
2479    }
2480
2481  }
2482
2483  @Override
2484  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2485    switch (hash) {
2486    case -1618432855:
2487      /* identifier */ return this.identifier == null ? new Base[0]
2488          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2489    case -1139428583:
2490      /* definitionUri */ return this.definitionUri == null ? new Base[0]
2491          : this.definitionUri.toArray(new Base[this.definitionUri.size()]); // UriType
2492    case 933485793:
2493      /* definitionCanonical */ return this.definitionCanonical == null ? new Base[0]
2494          : this.definitionCanonical.toArray(new Base[this.definitionCanonical.size()]); // CanonicalType
2495    case -892481550:
2496      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ChargeItemStatus>
2497    case -995410646:
2498      /* partOf */ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2499    case 3059181:
2500      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2501    case -1867885268:
2502      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2503    case 951530927:
2504      /* context */ return this.context == null ? new Base[0] : new Base[] { this.context }; // Reference
2505    case 1687874001:
2506      /* occurrence */ return this.occurrence == null ? new Base[0] : new Base[] { this.occurrence }; // Type
2507    case 481140686:
2508      /* performer */ return this.performer == null ? new Base[0]
2509          : this.performer.toArray(new Base[this.performer.size()]); // ChargeItemPerformerComponent
2510    case 1273192628:
2511      /* performingOrganization */ return this.performingOrganization == null ? new Base[0]
2512          : new Base[] { this.performingOrganization }; // Reference
2513    case 1279054790:
2514      /* requestingOrganization */ return this.requestingOrganization == null ? new Base[0]
2515          : new Base[] { this.requestingOrganization }; // Reference
2516    case -593192318:
2517      /* costCenter */ return this.costCenter == null ? new Base[0] : new Base[] { this.costCenter }; // Reference
2518    case -1285004149:
2519      /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
2520    case 1703573481:
2521      /* bodysite */ return this.bodysite == null ? new Base[0] : this.bodysite.toArray(new Base[this.bodysite.size()]); // CodeableConcept
2522    case -451233221:
2523      /* factorOverride */ return this.factorOverride == null ? new Base[0] : new Base[] { this.factorOverride }; // DecimalType
2524    case -216803275:
2525      /* priceOverride */ return this.priceOverride == null ? new Base[0] : new Base[] { this.priceOverride }; // Money
2526    case -742878928:
2527      /* overrideReason */ return this.overrideReason == null ? new Base[0] : new Base[] { this.overrideReason }; // StringType
2528    case -1591951995:
2529      /* enterer */ return this.enterer == null ? new Base[0] : new Base[] { this.enterer }; // Reference
2530    case 555978181:
2531      /* enteredDate */ return this.enteredDate == null ? new Base[0] : new Base[] { this.enteredDate }; // DateTimeType
2532    case -934964668:
2533      /* reason */ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
2534    case 1984153269:
2535      /* service */ return this.service == null ? new Base[0] : this.service.toArray(new Base[this.service.size()]); // Reference
2536    case -309474065:
2537      /* product */ return this.product == null ? new Base[0] : new Base[] { this.product }; // Type
2538    case -1177318867:
2539      /* account */ return this.account == null ? new Base[0] : this.account.toArray(new Base[this.account.size()]); // Reference
2540    case 3387378:
2541      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2542    case -1248768647:
2543      /* supportingInformation */ return this.supportingInformation == null ? new Base[0]
2544          : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
2545    default:
2546      return super.getProperty(hash, name, checkValid);
2547    }
2548
2549  }
2550
2551  @Override
2552  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2553    switch (hash) {
2554    case -1618432855: // identifier
2555      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2556      return value;
2557    case -1139428583: // definitionUri
2558      this.getDefinitionUri().add(castToUri(value)); // UriType
2559      return value;
2560    case 933485793: // definitionCanonical
2561      this.getDefinitionCanonical().add(castToCanonical(value)); // CanonicalType
2562      return value;
2563    case -892481550: // status
2564      value = new ChargeItemStatusEnumFactory().fromType(castToCode(value));
2565      this.status = (Enumeration) value; // Enumeration<ChargeItemStatus>
2566      return value;
2567    case -995410646: // partOf
2568      this.getPartOf().add(castToReference(value)); // Reference
2569      return value;
2570    case 3059181: // code
2571      this.code = castToCodeableConcept(value); // CodeableConcept
2572      return value;
2573    case -1867885268: // subject
2574      this.subject = castToReference(value); // Reference
2575      return value;
2576    case 951530927: // context
2577      this.context = castToReference(value); // Reference
2578      return value;
2579    case 1687874001: // occurrence
2580      this.occurrence = castToType(value); // Type
2581      return value;
2582    case 481140686: // performer
2583      this.getPerformer().add((ChargeItemPerformerComponent) value); // ChargeItemPerformerComponent
2584      return value;
2585    case 1273192628: // performingOrganization
2586      this.performingOrganization = castToReference(value); // Reference
2587      return value;
2588    case 1279054790: // requestingOrganization
2589      this.requestingOrganization = castToReference(value); // Reference
2590      return value;
2591    case -593192318: // costCenter
2592      this.costCenter = castToReference(value); // Reference
2593      return value;
2594    case -1285004149: // quantity
2595      this.quantity = castToQuantity(value); // Quantity
2596      return value;
2597    case 1703573481: // bodysite
2598      this.getBodysite().add(castToCodeableConcept(value)); // CodeableConcept
2599      return value;
2600    case -451233221: // factorOverride
2601      this.factorOverride = castToDecimal(value); // DecimalType
2602      return value;
2603    case -216803275: // priceOverride
2604      this.priceOverride = castToMoney(value); // Money
2605      return value;
2606    case -742878928: // overrideReason
2607      this.overrideReason = castToString(value); // StringType
2608      return value;
2609    case -1591951995: // enterer
2610      this.enterer = castToReference(value); // Reference
2611      return value;
2612    case 555978181: // enteredDate
2613      this.enteredDate = castToDateTime(value); // DateTimeType
2614      return value;
2615    case -934964668: // reason
2616      this.getReason().add(castToCodeableConcept(value)); // CodeableConcept
2617      return value;
2618    case 1984153269: // service
2619      this.getService().add(castToReference(value)); // Reference
2620      return value;
2621    case -309474065: // product
2622      this.product = castToType(value); // Type
2623      return value;
2624    case -1177318867: // account
2625      this.getAccount().add(castToReference(value)); // Reference
2626      return value;
2627    case 3387378: // note
2628      this.getNote().add(castToAnnotation(value)); // Annotation
2629      return value;
2630    case -1248768647: // supportingInformation
2631      this.getSupportingInformation().add(castToReference(value)); // Reference
2632      return value;
2633    default:
2634      return super.setProperty(hash, name, value);
2635    }
2636
2637  }
2638
2639  @Override
2640  public Base setProperty(String name, Base value) throws FHIRException {
2641    if (name.equals("identifier")) {
2642      this.getIdentifier().add(castToIdentifier(value));
2643    } else if (name.equals("definitionUri")) {
2644      this.getDefinitionUri().add(castToUri(value));
2645    } else if (name.equals("definitionCanonical")) {
2646      this.getDefinitionCanonical().add(castToCanonical(value));
2647    } else if (name.equals("status")) {
2648      value = new ChargeItemStatusEnumFactory().fromType(castToCode(value));
2649      this.status = (Enumeration) value; // Enumeration<ChargeItemStatus>
2650    } else if (name.equals("partOf")) {
2651      this.getPartOf().add(castToReference(value));
2652    } else if (name.equals("code")) {
2653      this.code = castToCodeableConcept(value); // CodeableConcept
2654    } else if (name.equals("subject")) {
2655      this.subject = castToReference(value); // Reference
2656    } else if (name.equals("context")) {
2657      this.context = castToReference(value); // Reference
2658    } else if (name.equals("occurrence[x]")) {
2659      this.occurrence = castToType(value); // Type
2660    } else if (name.equals("performer")) {
2661      this.getPerformer().add((ChargeItemPerformerComponent) value);
2662    } else if (name.equals("performingOrganization")) {
2663      this.performingOrganization = castToReference(value); // Reference
2664    } else if (name.equals("requestingOrganization")) {
2665      this.requestingOrganization = castToReference(value); // Reference
2666    } else if (name.equals("costCenter")) {
2667      this.costCenter = castToReference(value); // Reference
2668    } else if (name.equals("quantity")) {
2669      this.quantity = castToQuantity(value); // Quantity
2670    } else if (name.equals("bodysite")) {
2671      this.getBodysite().add(castToCodeableConcept(value));
2672    } else if (name.equals("factorOverride")) {
2673      this.factorOverride = castToDecimal(value); // DecimalType
2674    } else if (name.equals("priceOverride")) {
2675      this.priceOverride = castToMoney(value); // Money
2676    } else if (name.equals("overrideReason")) {
2677      this.overrideReason = castToString(value); // StringType
2678    } else if (name.equals("enterer")) {
2679      this.enterer = castToReference(value); // Reference
2680    } else if (name.equals("enteredDate")) {
2681      this.enteredDate = castToDateTime(value); // DateTimeType
2682    } else if (name.equals("reason")) {
2683      this.getReason().add(castToCodeableConcept(value));
2684    } else if (name.equals("service")) {
2685      this.getService().add(castToReference(value));
2686    } else if (name.equals("product[x]")) {
2687      this.product = castToType(value); // Type
2688    } else if (name.equals("account")) {
2689      this.getAccount().add(castToReference(value));
2690    } else if (name.equals("note")) {
2691      this.getNote().add(castToAnnotation(value));
2692    } else if (name.equals("supportingInformation")) {
2693      this.getSupportingInformation().add(castToReference(value));
2694    } else
2695      return super.setProperty(name, value);
2696    return value;
2697  }
2698
2699  @Override
2700  public void removeChild(String name, Base value) throws FHIRException {
2701    if (name.equals("identifier")) {
2702      this.getIdentifier().remove(castToIdentifier(value));
2703    } else if (name.equals("definitionUri")) {
2704      this.getDefinitionUri().remove(castToUri(value));
2705    } else if (name.equals("definitionCanonical")) {
2706      this.getDefinitionCanonical().remove(castToCanonical(value));
2707    } else if (name.equals("status")) {
2708      this.status = null;
2709    } else if (name.equals("partOf")) {
2710      this.getPartOf().remove(castToReference(value));
2711    } else if (name.equals("code")) {
2712      this.code = null;
2713    } else if (name.equals("subject")) {
2714      this.subject = null;
2715    } else if (name.equals("context")) {
2716      this.context = null;
2717    } else if (name.equals("occurrence[x]")) {
2718      this.occurrence = null;
2719    } else if (name.equals("performer")) {
2720      this.getPerformer().remove((ChargeItemPerformerComponent) value);
2721    } else if (name.equals("performingOrganization")) {
2722      this.performingOrganization = null;
2723    } else if (name.equals("requestingOrganization")) {
2724      this.requestingOrganization = null;
2725    } else if (name.equals("costCenter")) {
2726      this.costCenter = null;
2727    } else if (name.equals("quantity")) {
2728      this.quantity = null;
2729    } else if (name.equals("bodysite")) {
2730      this.getBodysite().remove(castToCodeableConcept(value));
2731    } else if (name.equals("factorOverride")) {
2732      this.factorOverride = null;
2733    } else if (name.equals("priceOverride")) {
2734      this.priceOverride = null;
2735    } else if (name.equals("overrideReason")) {
2736      this.overrideReason = null;
2737    } else if (name.equals("enterer")) {
2738      this.enterer = null;
2739    } else if (name.equals("enteredDate")) {
2740      this.enteredDate = null;
2741    } else if (name.equals("reason")) {
2742      this.getReason().remove(castToCodeableConcept(value));
2743    } else if (name.equals("service")) {
2744      this.getService().remove(castToReference(value));
2745    } else if (name.equals("product[x]")) {
2746      this.product = null;
2747    } else if (name.equals("account")) {
2748      this.getAccount().remove(castToReference(value));
2749    } else if (name.equals("note")) {
2750      this.getNote().remove(castToAnnotation(value));
2751    } else if (name.equals("supportingInformation")) {
2752      this.getSupportingInformation().remove(castToReference(value));
2753    } else
2754      super.removeChild(name, value);
2755    
2756  }
2757
2758  @Override
2759  public Base makeProperty(int hash, String name) throws FHIRException {
2760    switch (hash) {
2761    case -1618432855:
2762      return addIdentifier();
2763    case -1139428583:
2764      return addDefinitionUriElement();
2765    case 933485793:
2766      return addDefinitionCanonicalElement();
2767    case -892481550:
2768      return getStatusElement();
2769    case -995410646:
2770      return addPartOf();
2771    case 3059181:
2772      return getCode();
2773    case -1867885268:
2774      return getSubject();
2775    case 951530927:
2776      return getContext();
2777    case -2022646513:
2778      return getOccurrence();
2779    case 1687874001:
2780      return getOccurrence();
2781    case 481140686:
2782      return addPerformer();
2783    case 1273192628:
2784      return getPerformingOrganization();
2785    case 1279054790:
2786      return getRequestingOrganization();
2787    case -593192318:
2788      return getCostCenter();
2789    case -1285004149:
2790      return getQuantity();
2791    case 1703573481:
2792      return addBodysite();
2793    case -451233221:
2794      return getFactorOverrideElement();
2795    case -216803275:
2796      return getPriceOverride();
2797    case -742878928:
2798      return getOverrideReasonElement();
2799    case -1591951995:
2800      return getEnterer();
2801    case 555978181:
2802      return getEnteredDateElement();
2803    case -934964668:
2804      return addReason();
2805    case 1984153269:
2806      return addService();
2807    case 1753005361:
2808      return getProduct();
2809    case -309474065:
2810      return getProduct();
2811    case -1177318867:
2812      return addAccount();
2813    case 3387378:
2814      return addNote();
2815    case -1248768647:
2816      return addSupportingInformation();
2817    default:
2818      return super.makeProperty(hash, name);
2819    }
2820
2821  }
2822
2823  @Override
2824  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2825    switch (hash) {
2826    case -1618432855:
2827      /* identifier */ return new String[] { "Identifier" };
2828    case -1139428583:
2829      /* definitionUri */ return new String[] { "uri" };
2830    case 933485793:
2831      /* definitionCanonical */ return new String[] { "canonical" };
2832    case -892481550:
2833      /* status */ return new String[] { "code" };
2834    case -995410646:
2835      /* partOf */ return new String[] { "Reference" };
2836    case 3059181:
2837      /* code */ return new String[] { "CodeableConcept" };
2838    case -1867885268:
2839      /* subject */ return new String[] { "Reference" };
2840    case 951530927:
2841      /* context */ return new String[] { "Reference" };
2842    case 1687874001:
2843      /* occurrence */ return new String[] { "dateTime", "Period", "Timing" };
2844    case 481140686:
2845      /* performer */ return new String[] {};
2846    case 1273192628:
2847      /* performingOrganization */ return new String[] { "Reference" };
2848    case 1279054790:
2849      /* requestingOrganization */ return new String[] { "Reference" };
2850    case -593192318:
2851      /* costCenter */ return new String[] { "Reference" };
2852    case -1285004149:
2853      /* quantity */ return new String[] { "Quantity" };
2854    case 1703573481:
2855      /* bodysite */ return new String[] { "CodeableConcept" };
2856    case -451233221:
2857      /* factorOverride */ return new String[] { "decimal" };
2858    case -216803275:
2859      /* priceOverride */ return new String[] { "Money" };
2860    case -742878928:
2861      /* overrideReason */ return new String[] { "string" };
2862    case -1591951995:
2863      /* enterer */ return new String[] { "Reference" };
2864    case 555978181:
2865      /* enteredDate */ return new String[] { "dateTime" };
2866    case -934964668:
2867      /* reason */ return new String[] { "CodeableConcept" };
2868    case 1984153269:
2869      /* service */ return new String[] { "Reference" };
2870    case -309474065:
2871      /* product */ return new String[] { "Reference", "CodeableConcept" };
2872    case -1177318867:
2873      /* account */ return new String[] { "Reference" };
2874    case 3387378:
2875      /* note */ return new String[] { "Annotation" };
2876    case -1248768647:
2877      /* supportingInformation */ return new String[] { "Reference" };
2878    default:
2879      return super.getTypesForProperty(hash, name);
2880    }
2881
2882  }
2883
2884  @Override
2885  public Base addChild(String name) throws FHIRException {
2886    if (name.equals("identifier")) {
2887      return addIdentifier();
2888    } else if (name.equals("definitionUri")) {
2889      throw new FHIRException("Cannot call addChild on a singleton property ChargeItem.definitionUri");
2890    } else if (name.equals("definitionCanonical")) {
2891      throw new FHIRException("Cannot call addChild on a singleton property ChargeItem.definitionCanonical");
2892    } else if (name.equals("status")) {
2893      throw new FHIRException("Cannot call addChild on a singleton property ChargeItem.status");
2894    } else if (name.equals("partOf")) {
2895      return addPartOf();
2896    } else if (name.equals("code")) {
2897      this.code = new CodeableConcept();
2898      return this.code;
2899    } else if (name.equals("subject")) {
2900      this.subject = new Reference();
2901      return this.subject;
2902    } else if (name.equals("context")) {
2903      this.context = new Reference();
2904      return this.context;
2905    } else if (name.equals("occurrenceDateTime")) {
2906      this.occurrence = new DateTimeType();
2907      return this.occurrence;
2908    } else if (name.equals("occurrencePeriod")) {
2909      this.occurrence = new Period();
2910      return this.occurrence;
2911    } else if (name.equals("occurrenceTiming")) {
2912      this.occurrence = new Timing();
2913      return this.occurrence;
2914    } else if (name.equals("performer")) {
2915      return addPerformer();
2916    } else if (name.equals("performingOrganization")) {
2917      this.performingOrganization = new Reference();
2918      return this.performingOrganization;
2919    } else if (name.equals("requestingOrganization")) {
2920      this.requestingOrganization = new Reference();
2921      return this.requestingOrganization;
2922    } else if (name.equals("costCenter")) {
2923      this.costCenter = new Reference();
2924      return this.costCenter;
2925    } else if (name.equals("quantity")) {
2926      this.quantity = new Quantity();
2927      return this.quantity;
2928    } else if (name.equals("bodysite")) {
2929      return addBodysite();
2930    } else if (name.equals("factorOverride")) {
2931      throw new FHIRException("Cannot call addChild on a singleton property ChargeItem.factorOverride");
2932    } else if (name.equals("priceOverride")) {
2933      this.priceOverride = new Money();
2934      return this.priceOverride;
2935    } else if (name.equals("overrideReason")) {
2936      throw new FHIRException("Cannot call addChild on a singleton property ChargeItem.overrideReason");
2937    } else if (name.equals("enterer")) {
2938      this.enterer = new Reference();
2939      return this.enterer;
2940    } else if (name.equals("enteredDate")) {
2941      throw new FHIRException("Cannot call addChild on a singleton property ChargeItem.enteredDate");
2942    } else if (name.equals("reason")) {
2943      return addReason();
2944    } else if (name.equals("service")) {
2945      return addService();
2946    } else if (name.equals("productReference")) {
2947      this.product = new Reference();
2948      return this.product;
2949    } else if (name.equals("productCodeableConcept")) {
2950      this.product = new CodeableConcept();
2951      return this.product;
2952    } else if (name.equals("account")) {
2953      return addAccount();
2954    } else if (name.equals("note")) {
2955      return addNote();
2956    } else if (name.equals("supportingInformation")) {
2957      return addSupportingInformation();
2958    } else
2959      return super.addChild(name);
2960  }
2961
2962  public String fhirType() {
2963    return "ChargeItem";
2964
2965  }
2966
2967  public ChargeItem copy() {
2968    ChargeItem dst = new ChargeItem();
2969    copyValues(dst);
2970    return dst;
2971  }
2972
2973  public void copyValues(ChargeItem dst) {
2974    super.copyValues(dst);
2975    if (identifier != null) {
2976      dst.identifier = new ArrayList<Identifier>();
2977      for (Identifier i : identifier)
2978        dst.identifier.add(i.copy());
2979    }
2980    ;
2981    if (definitionUri != null) {
2982      dst.definitionUri = new ArrayList<UriType>();
2983      for (UriType i : definitionUri)
2984        dst.definitionUri.add(i.copy());
2985    }
2986    ;
2987    if (definitionCanonical != null) {
2988      dst.definitionCanonical = new ArrayList<CanonicalType>();
2989      for (CanonicalType i : definitionCanonical)
2990        dst.definitionCanonical.add(i.copy());
2991    }
2992    ;
2993    dst.status = status == null ? null : status.copy();
2994    if (partOf != null) {
2995      dst.partOf = new ArrayList<Reference>();
2996      for (Reference i : partOf)
2997        dst.partOf.add(i.copy());
2998    }
2999    ;
3000    dst.code = code == null ? null : code.copy();
3001    dst.subject = subject == null ? null : subject.copy();
3002    dst.context = context == null ? null : context.copy();
3003    dst.occurrence = occurrence == null ? null : occurrence.copy();
3004    if (performer != null) {
3005      dst.performer = new ArrayList<ChargeItemPerformerComponent>();
3006      for (ChargeItemPerformerComponent i : performer)
3007        dst.performer.add(i.copy());
3008    }
3009    ;
3010    dst.performingOrganization = performingOrganization == null ? null : performingOrganization.copy();
3011    dst.requestingOrganization = requestingOrganization == null ? null : requestingOrganization.copy();
3012    dst.costCenter = costCenter == null ? null : costCenter.copy();
3013    dst.quantity = quantity == null ? null : quantity.copy();
3014    if (bodysite != null) {
3015      dst.bodysite = new ArrayList<CodeableConcept>();
3016      for (CodeableConcept i : bodysite)
3017        dst.bodysite.add(i.copy());
3018    }
3019    ;
3020    dst.factorOverride = factorOverride == null ? null : factorOverride.copy();
3021    dst.priceOverride = priceOverride == null ? null : priceOverride.copy();
3022    dst.overrideReason = overrideReason == null ? null : overrideReason.copy();
3023    dst.enterer = enterer == null ? null : enterer.copy();
3024    dst.enteredDate = enteredDate == null ? null : enteredDate.copy();
3025    if (reason != null) {
3026      dst.reason = new ArrayList<CodeableConcept>();
3027      for (CodeableConcept i : reason)
3028        dst.reason.add(i.copy());
3029    }
3030    ;
3031    if (service != null) {
3032      dst.service = new ArrayList<Reference>();
3033      for (Reference i : service)
3034        dst.service.add(i.copy());
3035    }
3036    ;
3037    dst.product = product == null ? null : product.copy();
3038    if (account != null) {
3039      dst.account = new ArrayList<Reference>();
3040      for (Reference i : account)
3041        dst.account.add(i.copy());
3042    }
3043    ;
3044    if (note != null) {
3045      dst.note = new ArrayList<Annotation>();
3046      for (Annotation i : note)
3047        dst.note.add(i.copy());
3048    }
3049    ;
3050    if (supportingInformation != null) {
3051      dst.supportingInformation = new ArrayList<Reference>();
3052      for (Reference i : supportingInformation)
3053        dst.supportingInformation.add(i.copy());
3054    }
3055    ;
3056  }
3057
3058  protected ChargeItem typedCopy() {
3059    return copy();
3060  }
3061
3062  @Override
3063  public boolean equalsDeep(Base other_) {
3064    if (!super.equalsDeep(other_))
3065      return false;
3066    if (!(other_ instanceof ChargeItem))
3067      return false;
3068    ChargeItem o = (ChargeItem) other_;
3069    return compareDeep(identifier, o.identifier, true) && compareDeep(definitionUri, o.definitionUri, true)
3070        && compareDeep(definitionCanonical, o.definitionCanonical, true) && compareDeep(status, o.status, true)
3071        && compareDeep(partOf, o.partOf, true) && compareDeep(code, o.code, true)
3072        && compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true)
3073        && compareDeep(occurrence, o.occurrence, true) && compareDeep(performer, o.performer, true)
3074        && compareDeep(performingOrganization, o.performingOrganization, true)
3075        && compareDeep(requestingOrganization, o.requestingOrganization, true)
3076        && compareDeep(costCenter, o.costCenter, true) && compareDeep(quantity, o.quantity, true)
3077        && compareDeep(bodysite, o.bodysite, true) && compareDeep(factorOverride, o.factorOverride, true)
3078        && compareDeep(priceOverride, o.priceOverride, true) && compareDeep(overrideReason, o.overrideReason, true)
3079        && compareDeep(enterer, o.enterer, true) && compareDeep(enteredDate, o.enteredDate, true)
3080        && compareDeep(reason, o.reason, true) && compareDeep(service, o.service, true)
3081        && compareDeep(product, o.product, true) && compareDeep(account, o.account, true)
3082        && compareDeep(note, o.note, true) && compareDeep(supportingInformation, o.supportingInformation, true);
3083  }
3084
3085  @Override
3086  public boolean equalsShallow(Base other_) {
3087    if (!super.equalsShallow(other_))
3088      return false;
3089    if (!(other_ instanceof ChargeItem))
3090      return false;
3091    ChargeItem o = (ChargeItem) other_;
3092    return compareValues(definitionUri, o.definitionUri, true) && compareValues(status, o.status, true)
3093        && compareValues(factorOverride, o.factorOverride, true)
3094        && compareValues(overrideReason, o.overrideReason, true) && compareValues(enteredDate, o.enteredDate, true);
3095  }
3096
3097  public boolean isEmpty() {
3098    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definitionUri, definitionCanonical,
3099        status, partOf, code, subject, context, occurrence, performer, performingOrganization, requestingOrganization,
3100        costCenter, quantity, bodysite, factorOverride, priceOverride, overrideReason, enterer, enteredDate, reason,
3101        service, product, account, note, supportingInformation);
3102  }
3103
3104  @Override
3105  public ResourceType getResourceType() {
3106    return ResourceType.ChargeItem;
3107  }
3108
3109  /**
3110   * Search parameter: <b>identifier</b>
3111   * <p>
3112   * Description: <b>Business Identifier for item</b><br>
3113   * Type: <b>token</b><br>
3114   * Path: <b>ChargeItem.identifier</b><br>
3115   * </p>
3116   */
3117  @SearchParamDefinition(name = "identifier", path = "ChargeItem.identifier", description = "Business Identifier for item", type = "token")
3118  public static final String SP_IDENTIFIER = "identifier";
3119  /**
3120   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3121   * <p>
3122   * Description: <b>Business Identifier for item</b><br>
3123   * Type: <b>token</b><br>
3124   * Path: <b>ChargeItem.identifier</b><br>
3125   * </p>
3126   */
3127  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3128      SP_IDENTIFIER);
3129
3130  /**
3131   * Search parameter: <b>performing-organization</b>
3132   * <p>
3133   * Description: <b>Organization providing the charged service</b><br>
3134   * Type: <b>reference</b><br>
3135   * Path: <b>ChargeItem.performingOrganization</b><br>
3136   * </p>
3137   */
3138  @SearchParamDefinition(name = "performing-organization", path = "ChargeItem.performingOrganization", description = "Organization providing the charged service", type = "reference", target = {
3139      Organization.class })
3140  public static final String SP_PERFORMING_ORGANIZATION = "performing-organization";
3141  /**
3142   * <b>Fluent Client</b> search parameter constant for
3143   * <b>performing-organization</b>
3144   * <p>
3145   * Description: <b>Organization providing the charged service</b><br>
3146   * Type: <b>reference</b><br>
3147   * Path: <b>ChargeItem.performingOrganization</b><br>
3148   * </p>
3149   */
3150  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMING_ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3151      SP_PERFORMING_ORGANIZATION);
3152
3153  /**
3154   * Constant for fluent queries to be used to add include statements. Specifies
3155   * the path value of "<b>ChargeItem:performing-organization</b>".
3156   */
3157  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMING_ORGANIZATION = new ca.uhn.fhir.model.api.Include(
3158      "ChargeItem:performing-organization").toLocked();
3159
3160  /**
3161   * Search parameter: <b>code</b>
3162   * <p>
3163   * Description: <b>A code that identifies the charge, like a billing
3164   * code</b><br>
3165   * Type: <b>token</b><br>
3166   * Path: <b>ChargeItem.code</b><br>
3167   * </p>
3168   */
3169  @SearchParamDefinition(name = "code", path = "ChargeItem.code", description = "A code that identifies the charge, like a billing code", type = "token")
3170  public static final String SP_CODE = "code";
3171  /**
3172   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3173   * <p>
3174   * Description: <b>A code that identifies the charge, like a billing
3175   * code</b><br>
3176   * Type: <b>token</b><br>
3177   * Path: <b>ChargeItem.code</b><br>
3178   * </p>
3179   */
3180  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3181      SP_CODE);
3182
3183  /**
3184   * Search parameter: <b>quantity</b>
3185   * <p>
3186   * Description: <b>Quantity of which the charge item has been serviced</b><br>
3187   * Type: <b>quantity</b><br>
3188   * Path: <b>ChargeItem.quantity</b><br>
3189   * </p>
3190   */
3191  @SearchParamDefinition(name = "quantity", path = "ChargeItem.quantity", description = "Quantity of which the charge item has been serviced", type = "quantity")
3192  public static final String SP_QUANTITY = "quantity";
3193  /**
3194   * <b>Fluent Client</b> search parameter constant for <b>quantity</b>
3195   * <p>
3196   * Description: <b>Quantity of which the charge item has been serviced</b><br>
3197   * Type: <b>quantity</b><br>
3198   * Path: <b>ChargeItem.quantity</b><br>
3199   * </p>
3200   */
3201  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(
3202      SP_QUANTITY);
3203
3204  /**
3205   * Search parameter: <b>subject</b>
3206   * <p>
3207   * Description: <b>Individual service was done for/to</b><br>
3208   * Type: <b>reference</b><br>
3209   * Path: <b>ChargeItem.subject</b><br>
3210   * </p>
3211   */
3212  @SearchParamDefinition(name = "subject", path = "ChargeItem.subject", description = "Individual service was done for/to", type = "reference", providesMembershipIn = {
3213      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Group.class, Patient.class })
3214  public static final String SP_SUBJECT = "subject";
3215  /**
3216   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3217   * <p>
3218   * Description: <b>Individual service was done for/to</b><br>
3219   * Type: <b>reference</b><br>
3220   * Path: <b>ChargeItem.subject</b><br>
3221   * </p>
3222   */
3223  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3224      SP_SUBJECT);
3225
3226  /**
3227   * Constant for fluent queries to be used to add include statements. Specifies
3228   * the path value of "<b>ChargeItem:subject</b>".
3229   */
3230  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
3231      "ChargeItem:subject").toLocked();
3232
3233  /**
3234   * Search parameter: <b>occurrence</b>
3235   * <p>
3236   * Description: <b>When the charged service was applied</b><br>
3237   * Type: <b>date</b><br>
3238   * Path: <b>ChargeItem.occurrence[x]</b><br>
3239   * </p>
3240   */
3241  @SearchParamDefinition(name = "occurrence", path = "ChargeItem.occurrence", description = "When the charged service was applied", type = "date")
3242  public static final String SP_OCCURRENCE = "occurrence";
3243  /**
3244   * <b>Fluent Client</b> search parameter constant for <b>occurrence</b>
3245   * <p>
3246   * Description: <b>When the charged service was applied</b><br>
3247   * Type: <b>date</b><br>
3248   * Path: <b>ChargeItem.occurrence[x]</b><br>
3249   * </p>
3250   */
3251  public static final ca.uhn.fhir.rest.gclient.DateClientParam OCCURRENCE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3252      SP_OCCURRENCE);
3253
3254  /**
3255   * Search parameter: <b>entered-date</b>
3256   * <p>
3257   * Description: <b>Date the charge item was entered</b><br>
3258   * Type: <b>date</b><br>
3259   * Path: <b>ChargeItem.enteredDate</b><br>
3260   * </p>
3261   */
3262  @SearchParamDefinition(name = "entered-date", path = "ChargeItem.enteredDate", description = "Date the charge item was entered", type = "date")
3263  public static final String SP_ENTERED_DATE = "entered-date";
3264  /**
3265   * <b>Fluent Client</b> search parameter constant for <b>entered-date</b>
3266   * <p>
3267   * Description: <b>Date the charge item was entered</b><br>
3268   * Type: <b>date</b><br>
3269   * Path: <b>ChargeItem.enteredDate</b><br>
3270   * </p>
3271   */
3272  public static final ca.uhn.fhir.rest.gclient.DateClientParam ENTERED_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3273      SP_ENTERED_DATE);
3274
3275  /**
3276   * Search parameter: <b>performer-function</b>
3277   * <p>
3278   * Description: <b>What type of performance was done</b><br>
3279   * Type: <b>token</b><br>
3280   * Path: <b>ChargeItem.performer.function</b><br>
3281   * </p>
3282   */
3283  @SearchParamDefinition(name = "performer-function", path = "ChargeItem.performer.function", description = "What type of performance was done", type = "token")
3284  public static final String SP_PERFORMER_FUNCTION = "performer-function";
3285  /**
3286   * <b>Fluent Client</b> search parameter constant for <b>performer-function</b>
3287   * <p>
3288   * Description: <b>What type of performance was done</b><br>
3289   * Type: <b>token</b><br>
3290   * Path: <b>ChargeItem.performer.function</b><br>
3291   * </p>
3292   */
3293  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PERFORMER_FUNCTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3294      SP_PERFORMER_FUNCTION);
3295
3296  /**
3297   * Search parameter: <b>patient</b>
3298   * <p>
3299   * Description: <b>Individual service was done for/to</b><br>
3300   * Type: <b>reference</b><br>
3301   * Path: <b>ChargeItem.subject</b><br>
3302   * </p>
3303   */
3304  @SearchParamDefinition(name = "patient", path = "ChargeItem.subject.where(resolve() is Patient)", description = "Individual service was done for/to", type = "reference", target = {
3305      Patient.class })
3306  public static final String SP_PATIENT = "patient";
3307  /**
3308   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3309   * <p>
3310   * Description: <b>Individual service was done for/to</b><br>
3311   * Type: <b>reference</b><br>
3312   * Path: <b>ChargeItem.subject</b><br>
3313   * </p>
3314   */
3315  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3316      SP_PATIENT);
3317
3318  /**
3319   * Constant for fluent queries to be used to add include statements. Specifies
3320   * the path value of "<b>ChargeItem:patient</b>".
3321   */
3322  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
3323      "ChargeItem:patient").toLocked();
3324
3325  /**
3326   * Search parameter: <b>factor-override</b>
3327   * <p>
3328   * Description: <b>Factor overriding the associated rules</b><br>
3329   * Type: <b>number</b><br>
3330   * Path: <b>ChargeItem.factorOverride</b><br>
3331   * </p>
3332   */
3333  @SearchParamDefinition(name = "factor-override", path = "ChargeItem.factorOverride", description = "Factor overriding the associated rules", type = "number")
3334  public static final String SP_FACTOR_OVERRIDE = "factor-override";
3335  /**
3336   * <b>Fluent Client</b> search parameter constant for <b>factor-override</b>
3337   * <p>
3338   * Description: <b>Factor overriding the associated rules</b><br>
3339   * Type: <b>number</b><br>
3340   * Path: <b>ChargeItem.factorOverride</b><br>
3341   * </p>
3342   */
3343  public static final ca.uhn.fhir.rest.gclient.NumberClientParam FACTOR_OVERRIDE = new ca.uhn.fhir.rest.gclient.NumberClientParam(
3344      SP_FACTOR_OVERRIDE);
3345
3346  /**
3347   * Search parameter: <b>service</b>
3348   * <p>
3349   * Description: <b>Which rendered service is being charged?</b><br>
3350   * Type: <b>reference</b><br>
3351   * Path: <b>ChargeItem.service</b><br>
3352   * </p>
3353   */
3354  @SearchParamDefinition(name = "service", path = "ChargeItem.service", description = "Which rendered service is being charged?", type = "reference", target = {
3355      DiagnosticReport.class, ImagingStudy.class, Immunization.class, MedicationAdministration.class,
3356      MedicationDispense.class, Observation.class, Procedure.class, SupplyDelivery.class })
3357  public static final String SP_SERVICE = "service";
3358  /**
3359   * <b>Fluent Client</b> search parameter constant for <b>service</b>
3360   * <p>
3361   * Description: <b>Which rendered service is being charged?</b><br>
3362   * Type: <b>reference</b><br>
3363   * Path: <b>ChargeItem.service</b><br>
3364   * </p>
3365   */
3366  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SERVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3367      SP_SERVICE);
3368
3369  /**
3370   * Constant for fluent queries to be used to add include statements. Specifies
3371   * the path value of "<b>ChargeItem:service</b>".
3372   */
3373  public static final ca.uhn.fhir.model.api.Include INCLUDE_SERVICE = new ca.uhn.fhir.model.api.Include(
3374      "ChargeItem:service").toLocked();
3375
3376  /**
3377   * Search parameter: <b>price-override</b>
3378   * <p>
3379   * Description: <b>Price overriding the associated rules</b><br>
3380   * Type: <b>quantity</b><br>
3381   * Path: <b>ChargeItem.priceOverride</b><br>
3382   * </p>
3383   */
3384  @SearchParamDefinition(name = "price-override", path = "ChargeItem.priceOverride", description = "Price overriding the associated rules", type = "quantity")
3385  public static final String SP_PRICE_OVERRIDE = "price-override";
3386  /**
3387   * <b>Fluent Client</b> search parameter constant for <b>price-override</b>
3388   * <p>
3389   * Description: <b>Price overriding the associated rules</b><br>
3390   * Type: <b>quantity</b><br>
3391   * Path: <b>ChargeItem.priceOverride</b><br>
3392   * </p>
3393   */
3394  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam PRICE_OVERRIDE = new ca.uhn.fhir.rest.gclient.QuantityClientParam(
3395      SP_PRICE_OVERRIDE);
3396
3397  /**
3398   * Search parameter: <b>context</b>
3399   * <p>
3400   * Description: <b>Encounter / Episode associated with event</b><br>
3401   * Type: <b>reference</b><br>
3402   * Path: <b>ChargeItem.context</b><br>
3403   * </p>
3404   */
3405  @SearchParamDefinition(name = "context", path = "ChargeItem.context", description = "Encounter / Episode associated with event", type = "reference", providesMembershipIn = {
3406      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class,
3407          EpisodeOfCare.class })
3408  public static final String SP_CONTEXT = "context";
3409  /**
3410   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3411   * <p>
3412   * Description: <b>Encounter / Episode associated with event</b><br>
3413   * Type: <b>reference</b><br>
3414   * Path: <b>ChargeItem.context</b><br>
3415   * </p>
3416   */
3417  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3418      SP_CONTEXT);
3419
3420  /**
3421   * Constant for fluent queries to be used to add include statements. Specifies
3422   * the path value of "<b>ChargeItem:context</b>".
3423   */
3424  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include(
3425      "ChargeItem:context").toLocked();
3426
3427  /**
3428   * Search parameter: <b>enterer</b>
3429   * <p>
3430   * Description: <b>Individual who was entering</b><br>
3431   * Type: <b>reference</b><br>
3432   * Path: <b>ChargeItem.enterer</b><br>
3433   * </p>
3434   */
3435  @SearchParamDefinition(name = "enterer", path = "ChargeItem.enterer", description = "Individual who was entering", type = "reference", providesMembershipIn = {
3436      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3437      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
3438      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class,
3439          Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
3440  public static final String SP_ENTERER = "enterer";
3441  /**
3442   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
3443   * <p>
3444   * Description: <b>Individual who was entering</b><br>
3445   * Type: <b>reference</b><br>
3446   * Path: <b>ChargeItem.enterer</b><br>
3447   * </p>
3448   */
3449  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3450      SP_ENTERER);
3451
3452  /**
3453   * Constant for fluent queries to be used to add include statements. Specifies
3454   * the path value of "<b>ChargeItem:enterer</b>".
3455   */
3456  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include(
3457      "ChargeItem:enterer").toLocked();
3458
3459  /**
3460   * Search parameter: <b>performer-actor</b>
3461   * <p>
3462   * Description: <b>Individual who was performing</b><br>
3463   * Type: <b>reference</b><br>
3464   * Path: <b>ChargeItem.performer.actor</b><br>
3465   * </p>
3466   */
3467  @SearchParamDefinition(name = "performer-actor", path = "ChargeItem.performer.actor", description = "Individual who was performing", type = "reference", providesMembershipIn = {
3468      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3469      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
3470      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { CareTeam.class, Device.class,
3471          Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
3472  public static final String SP_PERFORMER_ACTOR = "performer-actor";
3473  /**
3474   * <b>Fluent Client</b> search parameter constant for <b>performer-actor</b>
3475   * <p>
3476   * Description: <b>Individual who was performing</b><br>
3477   * Type: <b>reference</b><br>
3478   * Path: <b>ChargeItem.performer.actor</b><br>
3479   * </p>
3480   */
3481  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER_ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3482      SP_PERFORMER_ACTOR);
3483
3484  /**
3485   * Constant for fluent queries to be used to add include statements. Specifies
3486   * the path value of "<b>ChargeItem:performer-actor</b>".
3487   */
3488  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER_ACTOR = new ca.uhn.fhir.model.api.Include(
3489      "ChargeItem:performer-actor").toLocked();
3490
3491  /**
3492   * Search parameter: <b>account</b>
3493   * <p>
3494   * Description: <b>Account to place this charge</b><br>
3495   * Type: <b>reference</b><br>
3496   * Path: <b>ChargeItem.account</b><br>
3497   * </p>
3498   */
3499  @SearchParamDefinition(name = "account", path = "ChargeItem.account", description = "Account to place this charge", type = "reference", target = {
3500      Account.class })
3501  public static final String SP_ACCOUNT = "account";
3502  /**
3503   * <b>Fluent Client</b> search parameter constant for <b>account</b>
3504   * <p>
3505   * Description: <b>Account to place this charge</b><br>
3506   * Type: <b>reference</b><br>
3507   * Path: <b>ChargeItem.account</b><br>
3508   * </p>
3509   */
3510  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACCOUNT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3511      SP_ACCOUNT);
3512
3513  /**
3514   * Constant for fluent queries to be used to add include statements. Specifies
3515   * the path value of "<b>ChargeItem:account</b>".
3516   */
3517  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACCOUNT = new ca.uhn.fhir.model.api.Include(
3518      "ChargeItem:account").toLocked();
3519
3520  /**
3521   * Search parameter: <b>requesting-organization</b>
3522   * <p>
3523   * Description: <b>Organization requesting the charged service</b><br>
3524   * Type: <b>reference</b><br>
3525   * Path: <b>ChargeItem.requestingOrganization</b><br>
3526   * </p>
3527   */
3528  @SearchParamDefinition(name = "requesting-organization", path = "ChargeItem.requestingOrganization", description = "Organization requesting the charged service", type = "reference", target = {
3529      Organization.class })
3530  public static final String SP_REQUESTING_ORGANIZATION = "requesting-organization";
3531  /**
3532   * <b>Fluent Client</b> search parameter constant for
3533   * <b>requesting-organization</b>
3534   * <p>
3535   * Description: <b>Organization requesting the charged service</b><br>
3536   * Type: <b>reference</b><br>
3537   * Path: <b>ChargeItem.requestingOrganization</b><br>
3538   * </p>
3539   */
3540  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTING_ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3541      SP_REQUESTING_ORGANIZATION);
3542
3543  /**
3544   * Constant for fluent queries to be used to add include statements. Specifies
3545   * the path value of "<b>ChargeItem:requesting-organization</b>".
3546   */
3547  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTING_ORGANIZATION = new ca.uhn.fhir.model.api.Include(
3548      "ChargeItem:requesting-organization").toLocked();
3549
3550}