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