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