001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017package ca.uhn.fhir.model.dstu2.resource;
018
019import java.math.BigDecimal;
020import java.net.URI;
021import java.util.*;
022import ca.uhn.fhir.model.api.*;
023import ca.uhn.fhir.model.api.annotation.*;
024import ca.uhn.fhir.rest.gclient.*;
025
026import ca.uhn.fhir.model.dstu2.valueset.AccountStatusEnum;
027import ca.uhn.fhir.model.dstu2.valueset.ActionListEnum;
028import ca.uhn.fhir.model.dstu2.composite.AddressDt;
029import ca.uhn.fhir.model.dstu2.valueset.AdjudicationCodesEnum;
030import ca.uhn.fhir.model.dstu2.valueset.AdjudicationErrorCodesEnum;
031import ca.uhn.fhir.model.dstu2.valueset.AdjustmentReasonCodesEnum;
032import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
033import ca.uhn.fhir.model.dstu2.valueset.AdmitSourceEnum;
034import ca.uhn.fhir.model.dstu2.resource.AllergyIntolerance;
035import ca.uhn.fhir.model.dstu2.valueset.AllergyIntoleranceCategoryEnum;
036import ca.uhn.fhir.model.dstu2.valueset.AllergyIntoleranceCertaintyEnum;
037import ca.uhn.fhir.model.dstu2.valueset.AllergyIntoleranceCriticalityEnum;
038import ca.uhn.fhir.model.dstu2.valueset.AllergyIntoleranceSeverityEnum;
039import ca.uhn.fhir.model.dstu2.valueset.AllergyIntoleranceStatusEnum;
040import ca.uhn.fhir.model.dstu2.valueset.AllergyIntoleranceTypeEnum;
041import ca.uhn.fhir.model.dstu2.composite.AnnotationDt;
042import ca.uhn.fhir.model.dstu2.valueset.AnswerFormatEnum;
043import ca.uhn.fhir.model.dstu2.resource.Appointment;
044import ca.uhn.fhir.model.dstu2.valueset.AppointmentStatusEnum;
045import ca.uhn.fhir.model.dstu2.valueset.AssertionDirectionTypeEnum;
046import ca.uhn.fhir.model.dstu2.valueset.AssertionOperatorTypeEnum;
047import ca.uhn.fhir.model.dstu2.valueset.AssertionResponseTypesEnum;
048import ca.uhn.fhir.model.dstu2.composite.AttachmentDt;
049import ca.uhn.fhir.model.dstu2.valueset.AuditEventActionEnum;
050import ca.uhn.fhir.model.dstu2.valueset.AuditEventObjectLifecycleEnum;
051import ca.uhn.fhir.model.dstu2.valueset.AuditEventObjectRoleEnum;
052import ca.uhn.fhir.model.dstu2.valueset.AuditEventObjectTypeEnum;
053import ca.uhn.fhir.model.dstu2.valueset.AuditEventOutcomeEnum;
054import ca.uhn.fhir.model.dstu2.valueset.AuditEventParticipantNetworkTypeEnum;
055import ca.uhn.fhir.model.dstu2.valueset.AuditEventSourceTypeEnum;
056import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum;
057import ca.uhn.fhir.model.dstu2.resource.BodySite;
058import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
059import ca.uhn.fhir.model.dstu2.resource.CarePlan;
060import ca.uhn.fhir.model.dstu2.valueset.CarePlanActivityStatusEnum;
061import ca.uhn.fhir.model.dstu2.valueset.CarePlanRelationshipEnum;
062import ca.uhn.fhir.model.dstu2.valueset.CarePlanStatusEnum;
063import ca.uhn.fhir.model.dstu2.resource.Claim;
064import ca.uhn.fhir.model.dstu2.resource.ClaimResponse;
065import ca.uhn.fhir.model.dstu2.valueset.ClaimTypeEnum;
066import ca.uhn.fhir.model.dstu2.resource.ClinicalImpression;
067import ca.uhn.fhir.model.dstu2.valueset.ClinicalImpressionStatusEnum;
068import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
069import ca.uhn.fhir.model.dstu2.composite.CodingDt;
070import ca.uhn.fhir.model.dstu2.resource.CommunicationRequest;
071import ca.uhn.fhir.model.dstu2.valueset.CommunicationRequestStatusEnum;
072import ca.uhn.fhir.model.dstu2.valueset.CommunicationStatusEnum;
073import ca.uhn.fhir.model.dstu2.resource.Composition;
074import ca.uhn.fhir.model.dstu2.valueset.CompositionAttestationModeEnum;
075import ca.uhn.fhir.model.dstu2.valueset.CompositionStatusEnum;
076import ca.uhn.fhir.model.dstu2.valueset.ConceptMapEquivalenceEnum;
077import ca.uhn.fhir.model.dstu2.resource.Condition;
078import ca.uhn.fhir.model.dstu2.valueset.ConditionCategoryCodesEnum;
079import ca.uhn.fhir.model.dstu2.valueset.ConditionClinicalStatusCodesEnum;
080import ca.uhn.fhir.model.dstu2.valueset.ConditionVerificationStatusEnum;
081import ca.uhn.fhir.model.dstu2.valueset.ConditionalDeleteStatusEnum;
082import ca.uhn.fhir.model.dstu2.resource.Conformance;
083import ca.uhn.fhir.model.dstu2.valueset.ConformanceEventModeEnum;
084import ca.uhn.fhir.model.dstu2.valueset.ConformanceResourceStatusEnum;
085import ca.uhn.fhir.model.dstu2.valueset.ConformanceStatementKindEnum;
086import ca.uhn.fhir.model.dstu2.composite.ContactPointDt;
087import ca.uhn.fhir.model.dstu2.valueset.ContentTypeEnum;
088import ca.uhn.fhir.model.dstu2.resource.Contract;
089import ca.uhn.fhir.model.dstu2.resource.Coverage;
090import ca.uhn.fhir.model.dstu2.valueset.DataElementStringencyEnum;
091import ca.uhn.fhir.model.dstu2.valueset.DaysOfWeekEnum;
092import ca.uhn.fhir.model.dstu2.valueset.DetectedIssueSeverityEnum;
093import ca.uhn.fhir.model.dstu2.resource.Device;
094import ca.uhn.fhir.model.dstu2.resource.DeviceComponent;
095import ca.uhn.fhir.model.dstu2.resource.DeviceMetric;
096import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricCalibrationStateEnum;
097import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricCalibrationTypeEnum;
098import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricCategoryEnum;
099import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricColorEnum;
100import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricOperationalStatusEnum;
101import ca.uhn.fhir.model.dstu2.valueset.DeviceStatusEnum;
102import ca.uhn.fhir.model.dstu2.resource.DeviceUseRequest;
103import ca.uhn.fhir.model.dstu2.valueset.DeviceUseRequestPriorityEnum;
104import ca.uhn.fhir.model.dstu2.valueset.DeviceUseRequestStatusEnum;
105import ca.uhn.fhir.model.dstu2.resource.DiagnosticOrder;
106import ca.uhn.fhir.model.dstu2.valueset.DiagnosticOrderPriorityEnum;
107import ca.uhn.fhir.model.dstu2.valueset.DiagnosticOrderStatusEnum;
108import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport;
109import ca.uhn.fhir.model.dstu2.valueset.DiagnosticReportStatusEnum;
110import ca.uhn.fhir.model.dstu2.valueset.DigitalMediaTypeEnum;
111import ca.uhn.fhir.model.dstu2.valueset.DocumentModeEnum;
112import ca.uhn.fhir.model.dstu2.resource.DocumentReference;
113import ca.uhn.fhir.model.dstu2.valueset.DocumentReferenceStatusEnum;
114import ca.uhn.fhir.model.dstu2.valueset.DocumentRelationshipTypeEnum;
115import ca.uhn.fhir.model.dstu2.composite.ElementDefinitionDt;
116import ca.uhn.fhir.model.dstu2.resource.EligibilityRequest;
117import ca.uhn.fhir.model.dstu2.resource.Encounter;
118import ca.uhn.fhir.model.dstu2.valueset.EncounterClassEnum;
119import ca.uhn.fhir.model.dstu2.valueset.EncounterLocationStatusEnum;
120import ca.uhn.fhir.model.dstu2.valueset.EncounterStateEnum;
121import ca.uhn.fhir.model.dstu2.resource.EnrollmentRequest;
122import ca.uhn.fhir.model.dstu2.resource.EpisodeOfCare;
123import ca.uhn.fhir.model.dstu2.valueset.EpisodeOfCareStatusEnum;
124import ca.uhn.fhir.model.dstu2.valueset.ExtensionContextEnum;
125import ca.uhn.fhir.model.dstu2.valueset.FamilyHistoryStatusEnum;
126import ca.uhn.fhir.model.dstu2.resource.FamilyMemberHistory;
127import ca.uhn.fhir.model.dstu2.valueset.FilterOperatorEnum;
128import ca.uhn.fhir.model.dstu2.valueset.FlagStatusEnum;
129import ca.uhn.fhir.model.dstu2.resource.Goal;
130import ca.uhn.fhir.model.dstu2.valueset.GoalPriorityEnum;
131import ca.uhn.fhir.model.dstu2.valueset.GoalStatusEnum;
132import ca.uhn.fhir.model.dstu2.resource.Group;
133import ca.uhn.fhir.model.dstu2.valueset.GroupTypeEnum;
134import ca.uhn.fhir.model.dstu2.valueset.GuideDependencyTypeEnum;
135import ca.uhn.fhir.model.dstu2.valueset.GuidePageKindEnum;
136import ca.uhn.fhir.model.dstu2.valueset.GuideResourcePurposeEnum;
137import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
138import ca.uhn.fhir.model.dstu2.resource.HealthcareService;
139import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
140import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
141import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum;
142import ca.uhn.fhir.model.dstu2.valueset.IdentityAssuranceLevelEnum;
143import ca.uhn.fhir.model.dstu2.resource.ImagingObjectSelection;
144import ca.uhn.fhir.model.dstu2.resource.ImagingStudy;
145import ca.uhn.fhir.model.dstu2.resource.Immunization;
146import ca.uhn.fhir.model.dstu2.valueset.InstanceAvailabilityEnum;
147import ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum;
148import ca.uhn.fhir.model.dstu2.valueset.IssueTypeEnum;
149import ca.uhn.fhir.model.dstu2.valueset.KOStitleEnum;
150import ca.uhn.fhir.model.dstu2.valueset.LinkTypeEnum;
151import ca.uhn.fhir.model.dstu2.valueset.ListModeEnum;
152import ca.uhn.fhir.model.dstu2.valueset.ListOrderCodesEnum;
153import ca.uhn.fhir.model.dstu2.valueset.ListStatusEnum;
154import ca.uhn.fhir.model.dstu2.resource.Location;
155import ca.uhn.fhir.model.dstu2.valueset.LocationModeEnum;
156import ca.uhn.fhir.model.dstu2.valueset.LocationStatusEnum;
157import ca.uhn.fhir.model.dstu2.valueset.LocationTypeEnum;
158import ca.uhn.fhir.model.dstu2.valueset.MaritalStatusCodesEnum;
159import ca.uhn.fhir.model.dstu2.valueset.MeasmntPrincipleEnum;
160import ca.uhn.fhir.model.dstu2.resource.Media;
161import ca.uhn.fhir.model.dstu2.resource.Medication;
162import ca.uhn.fhir.model.dstu2.valueset.MedicationAdministrationStatusEnum;
163import ca.uhn.fhir.model.dstu2.valueset.MedicationDispenseStatusEnum;
164import ca.uhn.fhir.model.dstu2.resource.MedicationOrder;
165import ca.uhn.fhir.model.dstu2.valueset.MedicationOrderStatusEnum;
166import ca.uhn.fhir.model.dstu2.resource.MedicationStatement;
167import ca.uhn.fhir.model.dstu2.valueset.MedicationStatementStatusEnum;
168import ca.uhn.fhir.model.dstu2.valueset.MessageEventEnum;
169import ca.uhn.fhir.model.dstu2.valueset.MessageSignificanceCategoryEnum;
170import ca.uhn.fhir.model.dstu2.valueset.MessageTransportEnum;
171import ca.uhn.fhir.model.dstu2.resource.NamingSystem;
172import ca.uhn.fhir.model.dstu2.valueset.NamingSystemIdentifierTypeEnum;
173import ca.uhn.fhir.model.dstu2.valueset.NamingSystemTypeEnum;
174import ca.uhn.fhir.model.dstu2.valueset.NoteTypeEnum;
175import ca.uhn.fhir.model.dstu2.resource.NutritionOrder;
176import ca.uhn.fhir.model.dstu2.valueset.NutritionOrderStatusEnum;
177import ca.uhn.fhir.model.dstu2.resource.Observation;
178import ca.uhn.fhir.model.dstu2.valueset.ObservationRelationshipTypeEnum;
179import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
180import ca.uhn.fhir.model.dstu2.resource.OperationDefinition;
181import ca.uhn.fhir.model.dstu2.valueset.OperationKindEnum;
182import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
183import ca.uhn.fhir.model.dstu2.valueset.OperationParameterUseEnum;
184import ca.uhn.fhir.model.dstu2.resource.Order;
185import ca.uhn.fhir.model.dstu2.valueset.OrderStatusEnum;
186import ca.uhn.fhir.model.dstu2.resource.Organization;
187import ca.uhn.fhir.model.dstu2.valueset.ParticipantRequiredEnum;
188import ca.uhn.fhir.model.dstu2.valueset.ParticipantStatusEnum;
189import ca.uhn.fhir.model.dstu2.valueset.ParticipantTypeEnum;
190import ca.uhn.fhir.model.dstu2.valueset.ParticipationStatusEnum;
191import ca.uhn.fhir.model.dstu2.resource.Patient;
192import ca.uhn.fhir.model.dstu2.valueset.PayeeTypeCodesEnum;
193import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
194import ca.uhn.fhir.model.dstu2.resource.Person;
195import ca.uhn.fhir.model.dstu2.resource.Practitioner;
196import ca.uhn.fhir.model.dstu2.resource.Procedure;
197import ca.uhn.fhir.model.dstu2.resource.ProcedureRequest;
198import ca.uhn.fhir.model.dstu2.valueset.ProcedureRequestPriorityEnum;
199import ca.uhn.fhir.model.dstu2.valueset.ProcedureRequestStatusEnum;
200import ca.uhn.fhir.model.dstu2.valueset.ProcedureStatusEnum;
201import ca.uhn.fhir.model.dstu2.resource.ProcessRequest;
202import ca.uhn.fhir.model.dstu2.valueset.ProvenanceEntityRoleEnum;
203import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
204import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
205import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
206import ca.uhn.fhir.model.dstu2.valueset.QuestionnaireResponseStatusEnum;
207import ca.uhn.fhir.model.dstu2.valueset.QuestionnaireStatusEnum;
208import ca.uhn.fhir.model.dstu2.composite.RangeDt;
209import ca.uhn.fhir.model.dstu2.composite.RatioDt;
210import ca.uhn.fhir.model.dstu2.valueset.ReferralMethodEnum;
211import ca.uhn.fhir.model.dstu2.resource.ReferralRequest;
212import ca.uhn.fhir.model.dstu2.valueset.ReferralStatusEnum;
213import ca.uhn.fhir.model.dstu2.resource.RelatedPerson;
214import ca.uhn.fhir.model.dstu2.valueset.RemittanceOutcomeEnum;
215import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum;
216import ca.uhn.fhir.model.dstu2.valueset.ResourceVersionPolicyEnum;
217import ca.uhn.fhir.model.dstu2.valueset.ResponseTypeEnum;
218import ca.uhn.fhir.model.dstu2.valueset.RestfulConformanceModeEnum;
219import ca.uhn.fhir.model.dstu2.valueset.RestfulSecurityServiceEnum;
220import ca.uhn.fhir.model.dstu2.resource.RiskAssessment;
221import ca.uhn.fhir.model.dstu2.valueset.RulesetCodesEnum;
222import ca.uhn.fhir.model.dstu2.composite.SampledDataDt;
223import ca.uhn.fhir.model.dstu2.resource.Schedule;
224import ca.uhn.fhir.model.dstu2.valueset.SearchEntryModeEnum;
225import ca.uhn.fhir.model.dstu2.valueset.SearchModifierCodeEnum;
226import ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum;
227import ca.uhn.fhir.model.dstu2.valueset.ServiceProvisionConditionsEnum;
228import ca.uhn.fhir.model.dstu2.composite.SignatureDt;
229import ca.uhn.fhir.model.dstu2.resource.Slot;
230import ca.uhn.fhir.model.dstu2.valueset.SlotStatusEnum;
231import ca.uhn.fhir.model.dstu2.resource.Specimen;
232import ca.uhn.fhir.model.dstu2.valueset.SpecimenStatusEnum;
233import ca.uhn.fhir.model.dstu2.resource.StructureDefinition;
234import ca.uhn.fhir.model.dstu2.valueset.StructureDefinitionKindEnum;
235import ca.uhn.fhir.model.dstu2.valueset.SubscriptionChannelTypeEnum;
236import ca.uhn.fhir.model.dstu2.valueset.SubscriptionStatusEnum;
237import ca.uhn.fhir.model.dstu2.resource.Substance;
238import ca.uhn.fhir.model.dstu2.valueset.SubstanceCategoryCodesEnum;
239import ca.uhn.fhir.model.dstu2.valueset.SupplyDeliveryStatusEnum;
240import ca.uhn.fhir.model.dstu2.resource.SupplyRequest;
241import ca.uhn.fhir.model.dstu2.valueset.SupplyRequestStatusEnum;
242import ca.uhn.fhir.model.dstu2.valueset.SystemRestfulInteractionEnum;
243import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
244import ca.uhn.fhir.model.dstu2.composite.TimingDt;
245import ca.uhn.fhir.model.dstu2.valueset.TransactionModeEnum;
246import ca.uhn.fhir.model.dstu2.valueset.TypeRestfulInteractionEnum;
247import ca.uhn.fhir.model.dstu2.valueset.UnknownContentCodeEnum;
248import ca.uhn.fhir.model.dstu2.valueset.UseEnum;
249import ca.uhn.fhir.model.dstu2.resource.ValueSet;
250import ca.uhn.fhir.model.dstu2.valueset.VisionBaseEnum;
251import ca.uhn.fhir.model.dstu2.valueset.VisionEyesEnum;
252import ca.uhn.fhir.model.dstu2.resource.VisionPrescription;
253import ca.uhn.fhir.model.dstu2.valueset.XPathUsageTypeEnum;
254import ca.uhn.fhir.model.api.IResource;
255import ca.uhn.fhir.model.dstu2.composite.AgeDt;
256import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt;
257import ca.uhn.fhir.model.dstu2.composite.DurationDt;
258import ca.uhn.fhir.model.dstu2.composite.MoneyDt;
259import ca.uhn.fhir.model.dstu2.composite.NarrativeDt;
260import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
261import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt;
262import ca.uhn.fhir.model.primitive.Base64BinaryDt;
263import ca.uhn.fhir.model.primitive.BooleanDt;
264import ca.uhn.fhir.model.primitive.BoundCodeDt;
265import ca.uhn.fhir.model.primitive.CodeDt;
266import ca.uhn.fhir.model.primitive.DateDt;
267import ca.uhn.fhir.model.primitive.DateTimeDt;
268import ca.uhn.fhir.model.primitive.DecimalDt;
269import ca.uhn.fhir.model.primitive.IdDt;
270import ca.uhn.fhir.model.primitive.InstantDt;
271import ca.uhn.fhir.model.primitive.IntegerDt;
272import ca.uhn.fhir.model.primitive.OidDt;
273import ca.uhn.fhir.model.primitive.PositiveIntDt;
274import ca.uhn.fhir.model.primitive.StringDt;
275import ca.uhn.fhir.model.primitive.TimeDt;
276import ca.uhn.fhir.model.primitive.UnsignedIntDt;
277import ca.uhn.fhir.model.primitive.UriDt;
278
279
280/**
281 * HAPI/FHIR <b>Encounter</b> Resource
282 * (workflow.encounter)
283 *
284 * <p>
285 * <b>Definition:</b>
286 * An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.
287 * </p> 
288 *
289 * <p>
290 * <b>Requirements:</b>
291 * 
292 * </p> 
293 *
294 * <p>
295 * <b>Profile Definition:</b>
296 * <a href="http://hl7.org/fhir/profiles/Encounter">http://hl7.org/fhir/profiles/Encounter</a> 
297 * </p>
298 *
299 */
300@ResourceDef(name="Encounter", profile="http://hl7.org/fhir/profiles/Encounter", id="encounter")
301public class Encounter extends ca.uhn.fhir.model.dstu2.resource.BaseResource
302    implements  IResource 
303    {
304
305        /**
306         * Search parameter constant for <b>identifier</b>
307         * <p>
308         * Description: <b></b><br>
309         * Type: <b>token</b><br>
310         * Path: <b>Encounter.identifier</b><br>
311         * </p>
312         */
313        @SearchParamDefinition(name="identifier", path="Encounter.identifier", description="", type="token" 
314 )
315        public static final String SP_IDENTIFIER = "identifier";
316
317        /**
318         * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
319         * <p>
320         * Description: <b></b><br>
321         * Type: <b>token</b><br>
322         * Path: <b>Encounter.identifier</b><br>
323         * </p>
324         */
325        public static final TokenClientParam IDENTIFIER = new TokenClientParam(SP_IDENTIFIER);
326
327        /**
328         * Search parameter constant for <b>status</b>
329         * <p>
330         * Description: <b></b><br>
331         * Type: <b>token</b><br>
332         * Path: <b>Encounter.status</b><br>
333         * </p>
334         */
335        @SearchParamDefinition(name="status", path="Encounter.status", description="", type="token" 
336 )
337        public static final String SP_STATUS = "status";
338
339        /**
340         * <b>Fluent Client</b> search parameter constant for <b>status</b>
341         * <p>
342         * Description: <b></b><br>
343         * Type: <b>token</b><br>
344         * Path: <b>Encounter.status</b><br>
345         * </p>
346         */
347        public static final TokenClientParam STATUS = new TokenClientParam(SP_STATUS);
348
349        /**
350         * Search parameter constant for <b>date</b>
351         * <p>
352         * Description: <b>A date within the period the Encounter lasted</b><br>
353         * Type: <b>date</b><br>
354         * Path: <b>Encounter.period</b><br>
355         * </p>
356         */
357        @SearchParamDefinition(name="date", path="Encounter.period", description="A date within the period the Encounter lasted", type="date" 
358 )
359        public static final String SP_DATE = "date";
360
361        /**
362         * <b>Fluent Client</b> search parameter constant for <b>date</b>
363         * <p>
364         * Description: <b>A date within the period the Encounter lasted</b><br>
365         * Type: <b>date</b><br>
366         * Path: <b>Encounter.period</b><br>
367         * </p>
368         */
369        public static final DateClientParam DATE = new DateClientParam(SP_DATE);
370
371        /**
372         * Search parameter constant for <b>patient</b>
373         * <p>
374         * Description: <b></b><br>
375         * Type: <b>reference</b><br>
376         * Path: <b>Encounter.patient</b><br>
377         * </p>
378         */
379        @SearchParamDefinition(name="patient", path="Encounter.patient", description="", type="reference" 
380, providesMembershipIn={
381 @Compartment(name="Patient")   }
382, target={
383 ca.uhn.fhir.model.dstu2.resource.Patient.class         }
384 )
385        public static final String SP_PATIENT = "patient";
386
387        /**
388         * <b>Fluent Client</b> search parameter constant for <b>patient</b>
389         * <p>
390         * Description: <b></b><br>
391         * Type: <b>reference</b><br>
392         * Path: <b>Encounter.patient</b><br>
393         * </p>
394         */
395        public static final ReferenceClientParam PATIENT = new ReferenceClientParam(SP_PATIENT);
396
397        /**
398         * Search parameter constant for <b>appointment</b>
399         * <p>
400         * Description: <b></b><br>
401         * Type: <b>reference</b><br>
402         * Path: <b>Encounter.appointment</b><br>
403         * </p>
404         */
405        @SearchParamDefinition(name="appointment", path="Encounter.appointment", description="", type="reference" 
406, target={
407 ca.uhn.fhir.model.dstu2.resource.Appointment.class     }
408 )
409        public static final String SP_APPOINTMENT = "appointment";
410
411        /**
412         * <b>Fluent Client</b> search parameter constant for <b>appointment</b>
413         * <p>
414         * Description: <b></b><br>
415         * Type: <b>reference</b><br>
416         * Path: <b>Encounter.appointment</b><br>
417         * </p>
418         */
419        public static final ReferenceClientParam APPOINTMENT = new ReferenceClientParam(SP_APPOINTMENT);
420
421        /**
422         * Search parameter constant for <b>length</b>
423         * <p>
424         * Description: <b>Length of encounter in days</b><br>
425         * Type: <b>number</b><br>
426         * Path: <b>Encounter.length</b><br>
427         * </p>
428         */
429        @SearchParamDefinition(name="length", path="Encounter.length", description="Length of encounter in days", type="number" 
430 )
431        public static final String SP_LENGTH = "length";
432
433        /**
434         * <b>Fluent Client</b> search parameter constant for <b>length</b>
435         * <p>
436         * Description: <b>Length of encounter in days</b><br>
437         * Type: <b>number</b><br>
438         * Path: <b>Encounter.length</b><br>
439         * </p>
440         */
441        public static final NumberClientParam LENGTH = new NumberClientParam(SP_LENGTH);
442
443        /**
444         * Search parameter constant for <b>reason</b>
445         * <p>
446         * Description: <b></b><br>
447         * Type: <b>token</b><br>
448         * Path: <b>Encounter.reason</b><br>
449         * </p>
450         */
451        @SearchParamDefinition(name="reason", path="Encounter.reason", description="", type="token" 
452 )
453        public static final String SP_REASON = "reason";
454
455        /**
456         * <b>Fluent Client</b> search parameter constant for <b>reason</b>
457         * <p>
458         * Description: <b></b><br>
459         * Type: <b>token</b><br>
460         * Path: <b>Encounter.reason</b><br>
461         * </p>
462         */
463        public static final TokenClientParam REASON = new TokenClientParam(SP_REASON);
464
465        /**
466         * Search parameter constant for <b>indication</b>
467         * <p>
468         * Description: <b></b><br>
469         * Type: <b>reference</b><br>
470         * Path: <b>Encounter.indication</b><br>
471         * </p>
472         */
473        @SearchParamDefinition(name="indication", path="Encounter.indication", description="", type="reference" 
474 )
475        public static final String SP_INDICATION = "indication";
476
477        /**
478         * <b>Fluent Client</b> search parameter constant for <b>indication</b>
479         * <p>
480         * Description: <b></b><br>
481         * Type: <b>reference</b><br>
482         * Path: <b>Encounter.indication</b><br>
483         * </p>
484         */
485        public static final ReferenceClientParam INDICATION = new ReferenceClientParam(SP_INDICATION);
486
487        /**
488         * Search parameter constant for <b>condition</b>
489         * <p>
490         * Description: <b></b><br>
491         * Type: <b>reference</b><br>
492         * Path: <b>Encounter.indication</b><br>
493         * </p>
494         */
495        @SearchParamDefinition(name="condition", path="Encounter.indication", description="", type="reference" 
496, target={
497 ca.uhn.fhir.model.dstu2.resource.Condition.class       }
498 )
499        public static final String SP_CONDITION = "condition";
500
501        /**
502         * <b>Fluent Client</b> search parameter constant for <b>condition</b>
503         * <p>
504         * Description: <b></b><br>
505         * Type: <b>reference</b><br>
506         * Path: <b>Encounter.indication</b><br>
507         * </p>
508         */
509        public static final ReferenceClientParam CONDITION = new ReferenceClientParam(SP_CONDITION);
510
511        /**
512         * Search parameter constant for <b>procedure</b>
513         * <p>
514         * Description: <b></b><br>
515         * Type: <b>reference</b><br>
516         * Path: <b>Encounter.indication</b><br>
517         * </p>
518         */
519        @SearchParamDefinition(name="procedure", path="Encounter.indication", description="", type="reference" 
520, target={
521 ca.uhn.fhir.model.dstu2.resource.Procedure.class       }
522 )
523        public static final String SP_PROCEDURE = "procedure";
524
525        /**
526         * <b>Fluent Client</b> search parameter constant for <b>procedure</b>
527         * <p>
528         * Description: <b></b><br>
529         * Type: <b>reference</b><br>
530         * Path: <b>Encounter.indication</b><br>
531         * </p>
532         */
533        public static final ReferenceClientParam PROCEDURE = new ReferenceClientParam(SP_PROCEDURE);
534
535        /**
536         * Search parameter constant for <b>location</b>
537         * <p>
538         * Description: <b></b><br>
539         * Type: <b>reference</b><br>
540         * Path: <b>Encounter.location.location</b><br>
541         * </p>
542         */
543        @SearchParamDefinition(name="location", path="Encounter.location.location", description="", type="reference" 
544, target={
545 ca.uhn.fhir.model.dstu2.resource.Location.class        }
546 )
547        public static final String SP_LOCATION = "location";
548
549        /**
550         * <b>Fluent Client</b> search parameter constant for <b>location</b>
551         * <p>
552         * Description: <b></b><br>
553         * Type: <b>reference</b><br>
554         * Path: <b>Encounter.location.location</b><br>
555         * </p>
556         */
557        public static final ReferenceClientParam LOCATION = new ReferenceClientParam(SP_LOCATION);
558
559        /**
560         * Search parameter constant for <b>location-period</b>
561         * <p>
562         * Description: <b></b><br>
563         * Type: <b>date</b><br>
564         * Path: <b>Encounter.location.period</b><br>
565         * </p>
566         */
567        @SearchParamDefinition(name="location-period", path="Encounter.location.period", description="", type="date" 
568 )
569        public static final String SP_LOCATION_PERIOD = "location-period";
570
571        /**
572         * <b>Fluent Client</b> search parameter constant for <b>location-period</b>
573         * <p>
574         * Description: <b></b><br>
575         * Type: <b>date</b><br>
576         * Path: <b>Encounter.location.period</b><br>
577         * </p>
578         */
579        public static final DateClientParam LOCATION_PERIOD = new DateClientParam(SP_LOCATION_PERIOD);
580
581        /**
582         * Search parameter constant for <b>type</b>
583         * <p>
584         * Description: <b></b><br>
585         * Type: <b>token</b><br>
586         * Path: <b>Encounter.type</b><br>
587         * </p>
588         */
589        @SearchParamDefinition(name="type", path="Encounter.type", description="", type="token" 
590 )
591        public static final String SP_TYPE = "type";
592
593        /**
594         * <b>Fluent Client</b> search parameter constant for <b>type</b>
595         * <p>
596         * Description: <b></b><br>
597         * Type: <b>token</b><br>
598         * Path: <b>Encounter.type</b><br>
599         * </p>
600         */
601        public static final TokenClientParam TYPE = new TokenClientParam(SP_TYPE);
602
603        /**
604         * Search parameter constant for <b>special-arrangement</b>
605         * <p>
606         * Description: <b></b><br>
607         * Type: <b>token</b><br>
608         * Path: <b>Encounter.hospitalization.specialArrangement</b><br>
609         * </p>
610         */
611        @SearchParamDefinition(name="special-arrangement", path="Encounter.hospitalization.specialArrangement", description="", type="token" 
612 )
613        public static final String SP_SPECIAL_ARRANGEMENT = "special-arrangement";
614
615        /**
616         * <b>Fluent Client</b> search parameter constant for <b>special-arrangement</b>
617         * <p>
618         * Description: <b></b><br>
619         * Type: <b>token</b><br>
620         * Path: <b>Encounter.hospitalization.specialArrangement</b><br>
621         * </p>
622         */
623        public static final TokenClientParam SPECIAL_ARRANGEMENT = new TokenClientParam(SP_SPECIAL_ARRANGEMENT);
624
625        /**
626         * Search parameter constant for <b>part-of</b>
627         * <p>
628         * Description: <b></b><br>
629         * Type: <b>reference</b><br>
630         * Path: <b>Encounter.partOf</b><br>
631         * </p>
632         */
633        @SearchParamDefinition(name="part-of", path="Encounter.partOf", description="", type="reference" 
634, target={
635 ca.uhn.fhir.model.dstu2.resource.Encounter.class       }
636 )
637        public static final String SP_PART_OF = "part-of";
638
639        /**
640         * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
641         * <p>
642         * Description: <b></b><br>
643         * Type: <b>reference</b><br>
644         * Path: <b>Encounter.partOf</b><br>
645         * </p>
646         */
647        public static final ReferenceClientParam PART_OF = new ReferenceClientParam(SP_PART_OF);
648
649        /**
650         * Search parameter constant for <b>participant</b>
651         * <p>
652         * Description: <b></b><br>
653         * Type: <b>reference</b><br>
654         * Path: <b>Encounter.participant.individual</b><br>
655         * </p>
656         */
657        @SearchParamDefinition(name="participant", path="Encounter.participant.individual", description="", type="reference" 
658, providesMembershipIn={
659 @Compartment(name="RelatedPerson") ,  @Compartment(name="Practitioner")        }
660 )
661        public static final String SP_PARTICIPANT = "participant";
662
663        /**
664         * <b>Fluent Client</b> search parameter constant for <b>participant</b>
665         * <p>
666         * Description: <b></b><br>
667         * Type: <b>reference</b><br>
668         * Path: <b>Encounter.participant.individual</b><br>
669         * </p>
670         */
671        public static final ReferenceClientParam PARTICIPANT = new ReferenceClientParam(SP_PARTICIPANT);
672
673        /**
674         * Search parameter constant for <b>participant-type</b>
675         * <p>
676         * Description: <b></b><br>
677         * Type: <b>token</b><br>
678         * Path: <b>Encounter.participant.type</b><br>
679         * </p>
680         */
681        @SearchParamDefinition(name="participant-type", path="Encounter.participant.type", description="", type="token" 
682 )
683        public static final String SP_PARTICIPANT_TYPE = "participant-type";
684
685        /**
686         * <b>Fluent Client</b> search parameter constant for <b>participant-type</b>
687         * <p>
688         * Description: <b></b><br>
689         * Type: <b>token</b><br>
690         * Path: <b>Encounter.participant.type</b><br>
691         * </p>
692         */
693        public static final TokenClientParam PARTICIPANT_TYPE = new TokenClientParam(SP_PARTICIPANT_TYPE);
694
695        /**
696         * Search parameter constant for <b>episodeofcare</b>
697         * <p>
698         * Description: <b></b><br>
699         * Type: <b>reference</b><br>
700         * Path: <b>Encounter.episodeOfCare</b><br>
701         * </p>
702         */
703        @SearchParamDefinition(name="episodeofcare", path="Encounter.episodeOfCare", description="", type="reference" 
704, target={
705 ca.uhn.fhir.model.dstu2.resource.EpisodeOfCare.class   }
706 )
707        public static final String SP_EPISODEOFCARE = "episodeofcare";
708
709        /**
710         * <b>Fluent Client</b> search parameter constant for <b>episodeofcare</b>
711         * <p>
712         * Description: <b></b><br>
713         * Type: <b>reference</b><br>
714         * Path: <b>Encounter.episodeOfCare</b><br>
715         * </p>
716         */
717        public static final ReferenceClientParam EPISODEOFCARE = new ReferenceClientParam(SP_EPISODEOFCARE);
718
719        /**
720         * Search parameter constant for <b>incomingreferral</b>
721         * <p>
722         * Description: <b></b><br>
723         * Type: <b>reference</b><br>
724         * Path: <b>Encounter.incomingReferral</b><br>
725         * </p>
726         */
727        @SearchParamDefinition(name="incomingreferral", path="Encounter.incomingReferral", description="", type="reference" 
728, target={
729 ca.uhn.fhir.model.dstu2.resource.ReferralRequest.class         }
730 )
731        public static final String SP_INCOMINGREFERRAL = "incomingreferral";
732
733        /**
734         * <b>Fluent Client</b> search parameter constant for <b>incomingreferral</b>
735         * <p>
736         * Description: <b></b><br>
737         * Type: <b>reference</b><br>
738         * Path: <b>Encounter.incomingReferral</b><br>
739         * </p>
740         */
741        public static final ReferenceClientParam INCOMINGREFERRAL = new ReferenceClientParam(SP_INCOMINGREFERRAL);
742
743        /**
744         * Search parameter constant for <b>practitioner</b>
745         * <p>
746         * Description: <b></b><br>
747         * Type: <b>reference</b><br>
748         * Path: <b>Encounter.participant.individual</b><br>
749         * </p>
750         */
751        @SearchParamDefinition(name="practitioner", path="Encounter.participant.individual", description="", type="reference" 
752, providesMembershipIn={
753 @Compartment(name="Practitioner")      }
754, target={
755 ca.uhn.fhir.model.dstu2.resource.Practitioner.class    }
756 )
757        public static final String SP_PRACTITIONER = "practitioner";
758
759        /**
760         * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
761         * <p>
762         * Description: <b></b><br>
763         * Type: <b>reference</b><br>
764         * Path: <b>Encounter.participant.individual</b><br>
765         * </p>
766         */
767        public static final ReferenceClientParam PRACTITIONER = new ReferenceClientParam(SP_PRACTITIONER);
768
769
770        /**
771         * Constant for fluent queries to be used to add include statements. Specifies
772         * the path value of "<b>Encounter:appointment</b>".
773         */
774        public static final Include INCLUDE_APPOINTMENT = new Include("Encounter:appointment");
775
776        /**
777         * Constant for fluent queries to be used to add include statements. Specifies
778         * the path value of "<b>Encounter:condition</b>".
779         */
780        public static final Include INCLUDE_CONDITION = new Include("Encounter:condition");
781
782        /**
783         * Constant for fluent queries to be used to add include statements. Specifies
784         * the path value of "<b>Encounter:episodeofcare</b>".
785         */
786        public static final Include INCLUDE_EPISODEOFCARE = new Include("Encounter:episodeofcare");
787
788        /**
789         * Constant for fluent queries to be used to add include statements. Specifies
790         * the path value of "<b>Encounter:incomingreferral</b>".
791         */
792        public static final Include INCLUDE_INCOMINGREFERRAL = new Include("Encounter:incomingreferral");
793
794        /**
795         * Constant for fluent queries to be used to add include statements. Specifies
796         * the path value of "<b>Encounter:indication</b>".
797         */
798        public static final Include INCLUDE_INDICATION = new Include("Encounter:indication");
799
800        /**
801         * Constant for fluent queries to be used to add include statements. Specifies
802         * the path value of "<b>Encounter:location</b>".
803         */
804        public static final Include INCLUDE_LOCATION = new Include("Encounter:location");
805
806        /**
807         * Constant for fluent queries to be used to add include statements. Specifies
808         * the path value of "<b>Encounter:part-of</b>".
809         */
810        public static final Include INCLUDE_PART_OF = new Include("Encounter:part-of");
811
812        /**
813         * Constant for fluent queries to be used to add include statements. Specifies
814         * the path value of "<b>Encounter:participant</b>".
815         */
816        public static final Include INCLUDE_PARTICIPANT = new Include("Encounter:participant");
817
818        /**
819         * Constant for fluent queries to be used to add include statements. Specifies
820         * the path value of "<b>Encounter:patient</b>".
821         */
822        public static final Include INCLUDE_PATIENT = new Include("Encounter:patient");
823
824        /**
825         * Constant for fluent queries to be used to add include statements. Specifies
826         * the path value of "<b>Encounter:practitioner</b>".
827         */
828        public static final Include INCLUDE_PRACTITIONER = new Include("Encounter:practitioner");
829
830        /**
831         * Constant for fluent queries to be used to add include statements. Specifies
832         * the path value of "<b>Encounter:procedure</b>".
833         */
834        public static final Include INCLUDE_PROCEDURE = new Include("Encounter:procedure");
835
836
837        @Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false)       
838        @Description(
839                shortDefinition="id",
840                formalDefinition=""
841        )
842        private java.util.List<IdentifierDt> myIdentifier;
843        
844        @Child(name="status", type=CodeDt.class, order=1, min=1, max=1, summary=true, modifier=true)    
845        @Description(
846                shortDefinition="status",
847                formalDefinition=""
848        )
849        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/encounter-state")
850        private BoundCodeDt<EncounterStateEnum> myStatus;
851        
852        @Child(name="statusHistory", order=2, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)    
853        @Description(
854                shortDefinition="",
855                formalDefinition="The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them"
856        )
857        private java.util.List<StatusHistory> myStatusHistory;
858        
859        @Child(name="class", type=CodeDt.class, order=3, min=0, max=1, summary=true, modifier=false)    
860        @Description(
861                shortDefinition="class",
862                formalDefinition=""
863        )
864        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/encounter-class")
865        private BoundCodeDt<EncounterClassEnum> myClassElement;
866        
867        @Child(name="type", type=CodeableConceptDt.class, order=4, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false)        
868        @Description(
869                shortDefinition="class",
870                formalDefinition="Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)"
871        )
872        private java.util.List<CodeableConceptDt> myType;
873        
874        @Child(name="priority", type=CodeableConceptDt.class, order=5, min=0, max=1, summary=false, modifier=false)     
875        @Description(
876                shortDefinition="grade",
877                formalDefinition=""
878        )
879        private CodeableConceptDt myPriority;
880        
881        @Child(name="patient", order=6, min=0, max=1, summary=true, modifier=false, type={
882                ca.uhn.fhir.model.dstu2.resource.Patient.class
883        })
884        @Description(
885                shortDefinition="who.focus",
886                formalDefinition=""
887        )
888        private ResourceReferenceDt myPatient;
889        
890        @Child(name="episodeOfCare", order=7, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false, type={
891                ca.uhn.fhir.model.dstu2.resource.EpisodeOfCare.class
892        })
893        @Description(
894                shortDefinition="context",
895                formalDefinition="Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years)"
896        )
897        private java.util.List<ResourceReferenceDt> myEpisodeOfCare;
898        
899        @Child(name="incomingReferral", order=8, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
900                ca.uhn.fhir.model.dstu2.resource.ReferralRequest.class
901        })
902        @Description(
903                shortDefinition="",
904                formalDefinition="The referral request this encounter satisfies (incoming referral)"
905        )
906        private java.util.List<ResourceReferenceDt> myIncomingReferral;
907        
908        @Child(name="participant", order=9, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false)       
909        @Description(
910                shortDefinition="",
911                formalDefinition="The list of people responsible for providing the service"
912        )
913        private java.util.List<Participant> myParticipant;
914        
915        @Child(name="appointment", order=10, min=0, max=1, summary=true, modifier=false, type={
916                ca.uhn.fhir.model.dstu2.resource.Appointment.class
917        })
918        @Description(
919                shortDefinition="",
920                formalDefinition=""
921        )
922        private ResourceReferenceDt myAppointment;
923        
924        @Child(name="period", type=PeriodDt.class, order=11, min=0, max=1, summary=false, modifier=false)       
925        @Description(
926                shortDefinition="when.done",
927                formalDefinition="The start and end time of the encounter"
928        )
929        private PeriodDt myPeriod;
930        
931        @Child(name="length", type=DurationDt.class, order=12, min=0, max=1, summary=false, modifier=false)     
932        @Description(
933                shortDefinition="",
934                formalDefinition="Quantity of time the encounter lasted. This excludes the time during leaves of absence."
935        )
936        private DurationDt myLength;
937        
938        @Child(name="reason", type=CodeableConceptDt.class, order=13, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false)     
939        @Description(
940                shortDefinition="why",
941                formalDefinition="Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis"
942        )
943        private java.util.List<CodeableConceptDt> myReason;
944        
945        @Child(name="indication", order=14, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
946                ca.uhn.fhir.model.dstu2.resource.Condition.class, 
947                ca.uhn.fhir.model.dstu2.resource.Procedure.class
948        })
949        @Description(
950                shortDefinition="why",
951                formalDefinition="Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure"
952        )
953        private java.util.List<ResourceReferenceDt> myIndication;
954        
955        @Child(name="hospitalization", order=15, min=0, max=1, summary=false, modifier=false)   
956        @Description(
957                shortDefinition="",
958                formalDefinition=""
959        )
960        private Hospitalization myHospitalization;
961        
962        @Child(name="location", order=16, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)        
963        @Description(
964                shortDefinition="",
965                formalDefinition="List of locations where  the patient has been during this encounter"
966        )
967        private java.util.List<Location> myLocation;
968        
969        @Child(name="serviceProvider", order=17, min=0, max=1, summary=false, modifier=false, type={
970                ca.uhn.fhir.model.dstu2.resource.Organization.class
971        })
972        @Description(
973                shortDefinition="",
974                formalDefinition="An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization."
975        )
976        private ResourceReferenceDt myServiceProvider;
977        
978        @Child(name="partOf", order=18, min=0, max=1, summary=false, modifier=false, type={
979                ca.uhn.fhir.model.dstu2.resource.Encounter.class
980        })
981        @Description(
982                shortDefinition="",
983                formalDefinition="Another Encounter of which this encounter is a part of (administratively or in time)."
984        )
985        private ResourceReferenceDt myPartOf;
986        
987
988        @Override
989        public boolean isEmpty() {
990                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myIdentifier,  myStatus,  myStatusHistory,  myClassElement,  myType,  myPriority,  myPatient,  myEpisodeOfCare,  myIncomingReferral,  myParticipant,  myAppointment,  myPeriod,  myLength,  myReason,  myIndication,  myHospitalization,  myLocation,  myServiceProvider,  myPartOf);
991        }
992        
993        @Override
994        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
995                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myStatus, myStatusHistory, myClassElement, myType, myPriority, myPatient, myEpisodeOfCare, myIncomingReferral, myParticipant, myAppointment, myPeriod, myLength, myReason, myIndication, myHospitalization, myLocation, myServiceProvider, myPartOf);
996        }
997
998        /**
999         * Gets the value(s) for <b>identifier</b> (id).
1000         * creating it if it does
1001         * not exist. Will not return <code>null</code>.
1002         *
1003     * <p>
1004     * <b>Definition:</b>
1005     * 
1006     * </p> 
1007         */
1008        public java.util.List<IdentifierDt> getIdentifier() {  
1009                if (myIdentifier == null) {
1010                        myIdentifier = new java.util.ArrayList<IdentifierDt>();
1011                }
1012                return myIdentifier;
1013        }
1014
1015        /**
1016         * Sets the value(s) for <b>identifier</b> (id)
1017         *
1018     * <p>
1019     * <b>Definition:</b>
1020     * 
1021     * </p> 
1022         */
1023        public Encounter setIdentifier(java.util.List<IdentifierDt> theValue) {
1024                myIdentifier = theValue;
1025                return this;
1026        }
1027        
1028        
1029
1030        /**
1031         * Adds and returns a new value for <b>identifier</b> (id)
1032         *
1033     * <p>
1034     * <b>Definition:</b>
1035     * 
1036     * </p> 
1037         */
1038        public IdentifierDt addIdentifier() {
1039                IdentifierDt newType = new IdentifierDt();
1040                getIdentifier().add(newType);
1041                return newType; 
1042        }
1043
1044        /**
1045         * Adds a given new value for <b>identifier</b> (id)
1046         *
1047         * <p>
1048         * <b>Definition:</b>
1049         * 
1050         * </p>
1051         * @param theValue The identifier to add (must not be <code>null</code>)
1052         */
1053        public Encounter addIdentifier(IdentifierDt theValue) {
1054                if (theValue == null) {
1055                        throw new NullPointerException("theValue must not be null");
1056                }
1057                getIdentifier().add(theValue);
1058                return this;
1059        }
1060
1061        /**
1062         * Gets the first repetition for <b>identifier</b> (id),
1063         * creating it if it does not already exist.
1064         *
1065     * <p>
1066     * <b>Definition:</b>
1067     * 
1068     * </p> 
1069         */
1070        public IdentifierDt getIdentifierFirstRep() {
1071                if (getIdentifier().isEmpty()) {
1072                        return addIdentifier();
1073                }
1074                return getIdentifier().get(0); 
1075        }
1076  
1077        /**
1078         * Gets the value(s) for <b>status</b> (status).
1079         * creating it if it does
1080         * not exist. Will not return <code>null</code>.
1081         *
1082     * <p>
1083     * <b>Definition:</b>
1084     * 
1085     * </p> 
1086         */
1087        public BoundCodeDt<EncounterStateEnum> getStatusElement() {  
1088                if (myStatus == null) {
1089                        myStatus = new BoundCodeDt<EncounterStateEnum>(EncounterStateEnum.VALUESET_BINDER);
1090                }
1091                return myStatus;
1092        }
1093
1094        
1095        /**
1096         * Gets the value(s) for <b>status</b> (status).
1097         * creating it if it does
1098         * not exist. This method may return <code>null</code>.
1099         *
1100     * <p>
1101     * <b>Definition:</b>
1102     * 
1103     * </p> 
1104         */
1105        public String getStatus() {  
1106                return getStatusElement().getValue();
1107        }
1108
1109        /**
1110         * Sets the value(s) for <b>status</b> (status)
1111         *
1112     * <p>
1113     * <b>Definition:</b>
1114     * 
1115     * </p> 
1116         */
1117        public Encounter setStatus(BoundCodeDt<EncounterStateEnum> theValue) {
1118                myStatus = theValue;
1119                return this;
1120        }
1121        
1122        
1123
1124        /**
1125         * Sets the value(s) for <b>status</b> (status)
1126         *
1127     * <p>
1128     * <b>Definition:</b>
1129     * 
1130     * </p> 
1131         */
1132        public Encounter setStatus(EncounterStateEnum theValue) {
1133                setStatus(new BoundCodeDt<EncounterStateEnum>(EncounterStateEnum.VALUESET_BINDER, theValue));
1134                
1135/*
1136                getStatusElement().setValueAsEnum(theValue);
1137*/
1138                return this;
1139        }
1140
1141  
1142        /**
1143         * Gets the value(s) for <b>statusHistory</b> ().
1144         * creating it if it does
1145         * not exist. Will not return <code>null</code>.
1146         *
1147     * <p>
1148     * <b>Definition:</b>
1149     * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them
1150     * </p> 
1151         */
1152        public java.util.List<StatusHistory> getStatusHistory() {  
1153                if (myStatusHistory == null) {
1154                        myStatusHistory = new java.util.ArrayList<StatusHistory>();
1155                }
1156                return myStatusHistory;
1157        }
1158
1159        /**
1160         * Sets the value(s) for <b>statusHistory</b> ()
1161         *
1162     * <p>
1163     * <b>Definition:</b>
1164     * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them
1165     * </p> 
1166         */
1167        public Encounter setStatusHistory(java.util.List<StatusHistory> theValue) {
1168                myStatusHistory = theValue;
1169                return this;
1170        }
1171        
1172        
1173
1174        /**
1175         * Adds and returns a new value for <b>statusHistory</b> ()
1176         *
1177     * <p>
1178     * <b>Definition:</b>
1179     * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them
1180     * </p> 
1181         */
1182        public StatusHistory addStatusHistory() {
1183                StatusHistory newType = new StatusHistory();
1184                getStatusHistory().add(newType);
1185                return newType; 
1186        }
1187
1188        /**
1189         * Adds a given new value for <b>statusHistory</b> ()
1190         *
1191         * <p>
1192         * <b>Definition:</b>
1193         * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them
1194         * </p>
1195         * @param theValue The statusHistory to add (must not be <code>null</code>)
1196         */
1197        public Encounter addStatusHistory(StatusHistory theValue) {
1198                if (theValue == null) {
1199                        throw new NullPointerException("theValue must not be null");
1200                }
1201                getStatusHistory().add(theValue);
1202                return this;
1203        }
1204
1205        /**
1206         * Gets the first repetition for <b>statusHistory</b> (),
1207         * creating it if it does not already exist.
1208         *
1209     * <p>
1210     * <b>Definition:</b>
1211     * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them
1212     * </p> 
1213         */
1214        public StatusHistory getStatusHistoryFirstRep() {
1215                if (getStatusHistory().isEmpty()) {
1216                        return addStatusHistory();
1217                }
1218                return getStatusHistory().get(0); 
1219        }
1220  
1221        /**
1222         * Gets the value(s) for <b>class</b> (class).
1223         * creating it if it does
1224         * not exist. Will not return <code>null</code>.
1225         *
1226     * <p>
1227     * <b>Definition:</b>
1228     * 
1229     * </p> 
1230         */
1231        public BoundCodeDt<EncounterClassEnum> getClassElementElement() {  
1232                if (myClassElement == null) {
1233                        myClassElement = new BoundCodeDt<EncounterClassEnum>(EncounterClassEnum.VALUESET_BINDER);
1234                }
1235                return myClassElement;
1236        }
1237
1238        
1239        /**
1240         * Gets the value(s) for <b>class</b> (class).
1241         * creating it if it does
1242         * not exist. This method may return <code>null</code>.
1243         *
1244     * <p>
1245     * <b>Definition:</b>
1246     * 
1247     * </p> 
1248         */
1249        public String getClassElement() {  
1250                return getClassElementElement().getValue();
1251        }
1252
1253        /**
1254         * Sets the value(s) for <b>class</b> (class)
1255         *
1256     * <p>
1257     * <b>Definition:</b>
1258     * 
1259     * </p> 
1260         */
1261        public Encounter setClassElement(BoundCodeDt<EncounterClassEnum> theValue) {
1262                myClassElement = theValue;
1263                return this;
1264        }
1265        
1266        
1267
1268        /**
1269         * Sets the value(s) for <b>class</b> (class)
1270         *
1271     * <p>
1272     * <b>Definition:</b>
1273     * 
1274     * </p> 
1275         */
1276        public Encounter setClassElement(EncounterClassEnum theValue) {
1277                setClassElement(new BoundCodeDt<EncounterClassEnum>(EncounterClassEnum.VALUESET_BINDER, theValue));
1278                
1279/*
1280                getClassElementElement().setValueAsEnum(theValue);
1281*/
1282                return this;
1283        }
1284
1285  
1286        /**
1287         * Gets the value(s) for <b>type</b> (class).
1288         * creating it if it does
1289         * not exist. Will not return <code>null</code>.
1290         *
1291     * <p>
1292     * <b>Definition:</b>
1293     * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)
1294     * </p> 
1295         */
1296        public java.util.List<CodeableConceptDt> getType() {  
1297                if (myType == null) {
1298                        myType = new java.util.ArrayList<CodeableConceptDt>();
1299                }
1300                return myType;
1301        }
1302
1303        /**
1304         * Sets the value(s) for <b>type</b> (class)
1305         *
1306     * <p>
1307     * <b>Definition:</b>
1308     * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)
1309     * </p> 
1310         */
1311        public Encounter setType(java.util.List<CodeableConceptDt> theValue) {
1312                myType = theValue;
1313                return this;
1314        }
1315        
1316        
1317
1318        /**
1319         * Adds and returns a new value for <b>type</b> (class)
1320         *
1321     * <p>
1322     * <b>Definition:</b>
1323     * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)
1324     * </p> 
1325         */
1326        public CodeableConceptDt addType() {
1327                CodeableConceptDt newType = new CodeableConceptDt();
1328                getType().add(newType);
1329                return newType; 
1330        }
1331
1332        /**
1333         * Adds a given new value for <b>type</b> (class)
1334         *
1335         * <p>
1336         * <b>Definition:</b>
1337         * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)
1338         * </p>
1339         * @param theValue The type to add (must not be <code>null</code>)
1340         */
1341        public Encounter addType(CodeableConceptDt theValue) {
1342                if (theValue == null) {
1343                        throw new NullPointerException("theValue must not be null");
1344                }
1345                getType().add(theValue);
1346                return this;
1347        }
1348
1349        /**
1350         * Gets the first repetition for <b>type</b> (class),
1351         * creating it if it does not already exist.
1352         *
1353     * <p>
1354     * <b>Definition:</b>
1355     * Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)
1356     * </p> 
1357         */
1358        public CodeableConceptDt getTypeFirstRep() {
1359                if (getType().isEmpty()) {
1360                        return addType();
1361                }
1362                return getType().get(0); 
1363        }
1364  
1365        /**
1366         * Gets the value(s) for <b>priority</b> (grade).
1367         * creating it if it does
1368         * not exist. Will not return <code>null</code>.
1369         *
1370     * <p>
1371     * <b>Definition:</b>
1372     * 
1373     * </p> 
1374         */
1375        public CodeableConceptDt getPriority() {  
1376                if (myPriority == null) {
1377                        myPriority = new CodeableConceptDt();
1378                }
1379                return myPriority;
1380        }
1381
1382        /**
1383         * Sets the value(s) for <b>priority</b> (grade)
1384         *
1385     * <p>
1386     * <b>Definition:</b>
1387     * 
1388     * </p> 
1389         */
1390        public Encounter setPriority(CodeableConceptDt theValue) {
1391                myPriority = theValue;
1392                return this;
1393        }
1394        
1395        
1396
1397  
1398        /**
1399         * Gets the value(s) for <b>patient</b> (who.focus).
1400         * creating it if it does
1401         * not exist. Will not return <code>null</code>.
1402         *
1403     * <p>
1404     * <b>Definition:</b>
1405     * 
1406     * </p> 
1407         */
1408        public ResourceReferenceDt getPatient() {  
1409                if (myPatient == null) {
1410                        myPatient = new ResourceReferenceDt();
1411                }
1412                return myPatient;
1413        }
1414
1415        /**
1416         * Sets the value(s) for <b>patient</b> (who.focus)
1417         *
1418     * <p>
1419     * <b>Definition:</b>
1420     * 
1421     * </p> 
1422         */
1423        public Encounter setPatient(ResourceReferenceDt theValue) {
1424                myPatient = theValue;
1425                return this;
1426        }
1427        
1428        
1429
1430  
1431        /**
1432         * Gets the value(s) for <b>episodeOfCare</b> (context).
1433         * creating it if it does
1434         * not exist. Will not return <code>null</code>.
1435         *
1436     * <p>
1437     * <b>Definition:</b>
1438     * Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years)
1439     * </p> 
1440         */
1441        public java.util.List<ResourceReferenceDt> getEpisodeOfCare() {  
1442                if (myEpisodeOfCare == null) {
1443                        myEpisodeOfCare = new java.util.ArrayList<ResourceReferenceDt>();
1444                }
1445                return myEpisodeOfCare;
1446        }
1447
1448        /**
1449         * Sets the value(s) for <b>episodeOfCare</b> (context)
1450         *
1451     * <p>
1452     * <b>Definition:</b>
1453     * Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years)
1454     * </p> 
1455         */
1456        public Encounter setEpisodeOfCare(java.util.List<ResourceReferenceDt> theValue) {
1457                myEpisodeOfCare = theValue;
1458                return this;
1459        }
1460        
1461        
1462
1463        /**
1464         * Adds and returns a new value for <b>episodeOfCare</b> (context)
1465         *
1466     * <p>
1467     * <b>Definition:</b>
1468     * Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years)
1469     * </p> 
1470         */
1471        public ResourceReferenceDt addEpisodeOfCare() {
1472                ResourceReferenceDt newType = new ResourceReferenceDt();
1473                getEpisodeOfCare().add(newType);
1474                return newType; 
1475        }
1476  
1477        /**
1478         * Gets the value(s) for <b>incomingReferral</b> ().
1479         * creating it if it does
1480         * not exist. Will not return <code>null</code>.
1481         *
1482     * <p>
1483     * <b>Definition:</b>
1484     * The referral request this encounter satisfies (incoming referral)
1485     * </p> 
1486         */
1487        public java.util.List<ResourceReferenceDt> getIncomingReferral() {  
1488                if (myIncomingReferral == null) {
1489                        myIncomingReferral = new java.util.ArrayList<ResourceReferenceDt>();
1490                }
1491                return myIncomingReferral;
1492        }
1493
1494        /**
1495         * Sets the value(s) for <b>incomingReferral</b> ()
1496         *
1497     * <p>
1498     * <b>Definition:</b>
1499     * The referral request this encounter satisfies (incoming referral)
1500     * </p> 
1501         */
1502        public Encounter setIncomingReferral(java.util.List<ResourceReferenceDt> theValue) {
1503                myIncomingReferral = theValue;
1504                return this;
1505        }
1506        
1507        
1508
1509        /**
1510         * Adds and returns a new value for <b>incomingReferral</b> ()
1511         *
1512     * <p>
1513     * <b>Definition:</b>
1514     * The referral request this encounter satisfies (incoming referral)
1515     * </p> 
1516         */
1517        public ResourceReferenceDt addIncomingReferral() {
1518                ResourceReferenceDt newType = new ResourceReferenceDt();
1519                getIncomingReferral().add(newType);
1520                return newType; 
1521        }
1522  
1523        /**
1524         * Gets the value(s) for <b>participant</b> ().
1525         * creating it if it does
1526         * not exist. Will not return <code>null</code>.
1527         *
1528     * <p>
1529     * <b>Definition:</b>
1530     * The&nbsp;list of&nbsp;people&nbsp;responsible for providing the service
1531     * </p> 
1532         */
1533        public java.util.List<Participant> getParticipant() {  
1534                if (myParticipant == null) {
1535                        myParticipant = new java.util.ArrayList<Participant>();
1536                }
1537                return myParticipant;
1538        }
1539
1540        /**
1541         * Sets the value(s) for <b>participant</b> ()
1542         *
1543     * <p>
1544     * <b>Definition:</b>
1545     * The&nbsp;list of&nbsp;people&nbsp;responsible for providing the service
1546     * </p> 
1547         */
1548        public Encounter setParticipant(java.util.List<Participant> theValue) {
1549                myParticipant = theValue;
1550                return this;
1551        }
1552        
1553        
1554
1555        /**
1556         * Adds and returns a new value for <b>participant</b> ()
1557         *
1558     * <p>
1559     * <b>Definition:</b>
1560     * The&nbsp;list of&nbsp;people&nbsp;responsible for providing the service
1561     * </p> 
1562         */
1563        public Participant addParticipant() {
1564                Participant newType = new Participant();
1565                getParticipant().add(newType);
1566                return newType; 
1567        }
1568
1569        /**
1570         * Adds a given new value for <b>participant</b> ()
1571         *
1572         * <p>
1573         * <b>Definition:</b>
1574         * The&nbsp;list of&nbsp;people&nbsp;responsible for providing the service
1575         * </p>
1576         * @param theValue The participant to add (must not be <code>null</code>)
1577         */
1578        public Encounter addParticipant(Participant theValue) {
1579                if (theValue == null) {
1580                        throw new NullPointerException("theValue must not be null");
1581                }
1582                getParticipant().add(theValue);
1583                return this;
1584        }
1585
1586        /**
1587         * Gets the first repetition for <b>participant</b> (),
1588         * creating it if it does not already exist.
1589         *
1590     * <p>
1591     * <b>Definition:</b>
1592     * The&nbsp;list of&nbsp;people&nbsp;responsible for providing the service
1593     * </p> 
1594         */
1595        public Participant getParticipantFirstRep() {
1596                if (getParticipant().isEmpty()) {
1597                        return addParticipant();
1598                }
1599                return getParticipant().get(0); 
1600        }
1601  
1602        /**
1603         * Gets the value(s) for <b>appointment</b> ().
1604         * creating it if it does
1605         * not exist. Will not return <code>null</code>.
1606         *
1607     * <p>
1608     * <b>Definition:</b>
1609     * 
1610     * </p> 
1611         */
1612        public ResourceReferenceDt getAppointment() {  
1613                if (myAppointment == null) {
1614                        myAppointment = new ResourceReferenceDt();
1615                }
1616                return myAppointment;
1617        }
1618
1619        /**
1620         * Sets the value(s) for <b>appointment</b> ()
1621         *
1622     * <p>
1623     * <b>Definition:</b>
1624     * 
1625     * </p> 
1626         */
1627        public Encounter setAppointment(ResourceReferenceDt theValue) {
1628                myAppointment = theValue;
1629                return this;
1630        }
1631        
1632        
1633
1634  
1635        /**
1636         * Gets the value(s) for <b>period</b> (when.done).
1637         * creating it if it does
1638         * not exist. Will not return <code>null</code>.
1639         *
1640     * <p>
1641     * <b>Definition:</b>
1642     * The start and end time of the encounter
1643     * </p> 
1644         */
1645        public PeriodDt getPeriod() {  
1646                if (myPeriod == null) {
1647                        myPeriod = new PeriodDt();
1648                }
1649                return myPeriod;
1650        }
1651
1652        /**
1653         * Sets the value(s) for <b>period</b> (when.done)
1654         *
1655     * <p>
1656     * <b>Definition:</b>
1657     * The start and end time of the encounter
1658     * </p> 
1659         */
1660        public Encounter setPeriod(PeriodDt theValue) {
1661                myPeriod = theValue;
1662                return this;
1663        }
1664        
1665        
1666
1667  
1668        /**
1669         * Gets the value(s) for <b>length</b> ().
1670         * creating it if it does
1671         * not exist. Will not return <code>null</code>.
1672         *
1673     * <p>
1674     * <b>Definition:</b>
1675     * Quantity of time the encounter lasted. This excludes the time during leaves of absence.
1676     * </p> 
1677         */
1678        public DurationDt getLength() {  
1679                if (myLength == null) {
1680                        myLength = new DurationDt();
1681                }
1682                return myLength;
1683        }
1684
1685        /**
1686         * Sets the value(s) for <b>length</b> ()
1687         *
1688     * <p>
1689     * <b>Definition:</b>
1690     * Quantity of time the encounter lasted. This excludes the time during leaves of absence.
1691     * </p> 
1692         */
1693        public Encounter setLength(DurationDt theValue) {
1694                myLength = theValue;
1695                return this;
1696        }
1697        
1698        
1699
1700  
1701        /**
1702         * Gets the value(s) for <b>reason</b> (why).
1703         * creating it if it does
1704         * not exist. Will not return <code>null</code>.
1705         *
1706     * <p>
1707     * <b>Definition:</b>
1708     * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis
1709     * </p> 
1710         */
1711        public java.util.List<CodeableConceptDt> getReason() {  
1712                if (myReason == null) {
1713                        myReason = new java.util.ArrayList<CodeableConceptDt>();
1714                }
1715                return myReason;
1716        }
1717
1718        /**
1719         * Sets the value(s) for <b>reason</b> (why)
1720         *
1721     * <p>
1722     * <b>Definition:</b>
1723     * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis
1724     * </p> 
1725         */
1726        public Encounter setReason(java.util.List<CodeableConceptDt> theValue) {
1727                myReason = theValue;
1728                return this;
1729        }
1730        
1731        
1732
1733        /**
1734         * Adds and returns a new value for <b>reason</b> (why)
1735         *
1736     * <p>
1737     * <b>Definition:</b>
1738     * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis
1739     * </p> 
1740         */
1741        public CodeableConceptDt addReason() {
1742                CodeableConceptDt newType = new CodeableConceptDt();
1743                getReason().add(newType);
1744                return newType; 
1745        }
1746
1747        /**
1748         * Adds a given new value for <b>reason</b> (why)
1749         *
1750         * <p>
1751         * <b>Definition:</b>
1752         * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis
1753         * </p>
1754         * @param theValue The reason to add (must not be <code>null</code>)
1755         */
1756        public Encounter addReason(CodeableConceptDt theValue) {
1757                if (theValue == null) {
1758                        throw new NullPointerException("theValue must not be null");
1759                }
1760                getReason().add(theValue);
1761                return this;
1762        }
1763
1764        /**
1765         * Gets the first repetition for <b>reason</b> (why),
1766         * creating it if it does not already exist.
1767         *
1768     * <p>
1769     * <b>Definition:</b>
1770     * Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis
1771     * </p> 
1772         */
1773        public CodeableConceptDt getReasonFirstRep() {
1774                if (getReason().isEmpty()) {
1775                        return addReason();
1776                }
1777                return getReason().get(0); 
1778        }
1779  
1780        /**
1781         * Gets the value(s) for <b>indication</b> (why).
1782         * creating it if it does
1783         * not exist. Will not return <code>null</code>.
1784         *
1785     * <p>
1786     * <b>Definition:</b>
1787     * Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure
1788     * </p> 
1789         */
1790        public java.util.List<ResourceReferenceDt> getIndication() {  
1791                if (myIndication == null) {
1792                        myIndication = new java.util.ArrayList<ResourceReferenceDt>();
1793                }
1794                return myIndication;
1795        }
1796
1797        /**
1798         * Sets the value(s) for <b>indication</b> (why)
1799         *
1800     * <p>
1801     * <b>Definition:</b>
1802     * Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure
1803     * </p> 
1804         */
1805        public Encounter setIndication(java.util.List<ResourceReferenceDt> theValue) {
1806                myIndication = theValue;
1807                return this;
1808        }
1809        
1810        
1811
1812        /**
1813         * Adds and returns a new value for <b>indication</b> (why)
1814         *
1815     * <p>
1816     * <b>Definition:</b>
1817     * Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure
1818     * </p> 
1819         */
1820        public ResourceReferenceDt addIndication() {
1821                ResourceReferenceDt newType = new ResourceReferenceDt();
1822                getIndication().add(newType);
1823                return newType; 
1824        }
1825  
1826        /**
1827         * Gets the value(s) for <b>hospitalization</b> ().
1828         * creating it if it does
1829         * not exist. Will not return <code>null</code>.
1830         *
1831     * <p>
1832     * <b>Definition:</b>
1833     * 
1834     * </p> 
1835         */
1836        public Hospitalization getHospitalization() {  
1837                if (myHospitalization == null) {
1838                        myHospitalization = new Hospitalization();
1839                }
1840                return myHospitalization;
1841        }
1842
1843        /**
1844         * Sets the value(s) for <b>hospitalization</b> ()
1845         *
1846     * <p>
1847     * <b>Definition:</b>
1848     * 
1849     * </p> 
1850         */
1851        public Encounter setHospitalization(Hospitalization theValue) {
1852                myHospitalization = theValue;
1853                return this;
1854        }
1855        
1856        
1857
1858  
1859        /**
1860         * Gets the value(s) for <b>location</b> ().
1861         * creating it if it does
1862         * not exist. Will not return <code>null</code>.
1863         *
1864     * <p>
1865     * <b>Definition:</b>
1866     * List of locations where  the patient has been during this encounter
1867     * </p> 
1868         */
1869        public java.util.List<Location> getLocation() {  
1870                if (myLocation == null) {
1871                        myLocation = new java.util.ArrayList<Location>();
1872                }
1873                return myLocation;
1874        }
1875
1876        /**
1877         * Sets the value(s) for <b>location</b> ()
1878         *
1879     * <p>
1880     * <b>Definition:</b>
1881     * List of locations where  the patient has been during this encounter
1882     * </p> 
1883         */
1884        public Encounter setLocation(java.util.List<Location> theValue) {
1885                myLocation = theValue;
1886                return this;
1887        }
1888        
1889        
1890
1891        /**
1892         * Adds and returns a new value for <b>location</b> ()
1893         *
1894     * <p>
1895     * <b>Definition:</b>
1896     * List of locations where  the patient has been during this encounter
1897     * </p> 
1898         */
1899        public Location addLocation() {
1900                Location newType = new Location();
1901                getLocation().add(newType);
1902                return newType; 
1903        }
1904
1905        /**
1906         * Adds a given new value for <b>location</b> ()
1907         *
1908         * <p>
1909         * <b>Definition:</b>
1910         * List of locations where  the patient has been during this encounter
1911         * </p>
1912         * @param theValue The location to add (must not be <code>null</code>)
1913         */
1914        public Encounter addLocation(Location theValue) {
1915                if (theValue == null) {
1916                        throw new NullPointerException("theValue must not be null");
1917                }
1918                getLocation().add(theValue);
1919                return this;
1920        }
1921
1922        /**
1923         * Gets the first repetition for <b>location</b> (),
1924         * creating it if it does not already exist.
1925         *
1926     * <p>
1927     * <b>Definition:</b>
1928     * List of locations where  the patient has been during this encounter
1929     * </p> 
1930         */
1931        public Location getLocationFirstRep() {
1932                if (getLocation().isEmpty()) {
1933                        return addLocation();
1934                }
1935                return getLocation().get(0); 
1936        }
1937  
1938        /**
1939         * Gets the value(s) for <b>serviceProvider</b> ().
1940         * creating it if it does
1941         * not exist. Will not return <code>null</code>.
1942         *
1943     * <p>
1944     * <b>Definition:</b>
1945     * An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.
1946     * </p> 
1947         */
1948        public ResourceReferenceDt getServiceProvider() {  
1949                if (myServiceProvider == null) {
1950                        myServiceProvider = new ResourceReferenceDt();
1951                }
1952                return myServiceProvider;
1953        }
1954
1955        /**
1956         * Sets the value(s) for <b>serviceProvider</b> ()
1957         *
1958     * <p>
1959     * <b>Definition:</b>
1960     * An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.
1961     * </p> 
1962         */
1963        public Encounter setServiceProvider(ResourceReferenceDt theValue) {
1964                myServiceProvider = theValue;
1965                return this;
1966        }
1967        
1968        
1969
1970  
1971        /**
1972         * Gets the value(s) for <b>partOf</b> ().
1973         * creating it if it does
1974         * not exist. Will not return <code>null</code>.
1975         *
1976     * <p>
1977     * <b>Definition:</b>
1978     * Another Encounter of which this encounter is a part of (administratively or in time).
1979     * </p> 
1980         */
1981        public ResourceReferenceDt getPartOf() {  
1982                if (myPartOf == null) {
1983                        myPartOf = new ResourceReferenceDt();
1984                }
1985                return myPartOf;
1986        }
1987
1988        /**
1989         * Sets the value(s) for <b>partOf</b> ()
1990         *
1991     * <p>
1992     * <b>Definition:</b>
1993     * Another Encounter of which this encounter is a part of (administratively or in time).
1994     * </p> 
1995         */
1996        public Encounter setPartOf(ResourceReferenceDt theValue) {
1997                myPartOf = theValue;
1998                return this;
1999        }
2000        
2001        
2002
2003  
2004        /**
2005         * Block class for child element: <b>Encounter.statusHistory</b> ()
2006         *
2007     * <p>
2008     * <b>Definition:</b>
2009     * The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them
2010     * </p> 
2011         */
2012        @Block()        
2013        public static class StatusHistory 
2014            extends  BaseIdentifiableElement  
2015            implements IResourceBlock {
2016        
2017        @Child(name="status", type=CodeDt.class, order=0, min=1, max=1, summary=false, modifier=false)  
2018        @Description(
2019                shortDefinition="",
2020                formalDefinition=""
2021        )
2022        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/encounter-state")
2023        private BoundCodeDt<EncounterStateEnum> myStatus;
2024        
2025        @Child(name="period", type=PeriodDt.class, order=1, min=1, max=1, summary=false, modifier=false)        
2026        @Description(
2027                shortDefinition="",
2028                formalDefinition=""
2029        )
2030        private PeriodDt myPeriod;
2031        
2032
2033        @Override
2034        public boolean isEmpty() {
2035                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myStatus,  myPeriod);
2036        }
2037        
2038        @Override
2039        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
2040                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myStatus, myPeriod);
2041        }
2042
2043        /**
2044         * Gets the value(s) for <b>status</b> ().
2045         * creating it if it does
2046         * not exist. Will not return <code>null</code>.
2047         *
2048     * <p>
2049     * <b>Definition:</b>
2050     * 
2051     * </p> 
2052         */
2053        public BoundCodeDt<EncounterStateEnum> getStatusElement() {  
2054                if (myStatus == null) {
2055                        myStatus = new BoundCodeDt<EncounterStateEnum>(EncounterStateEnum.VALUESET_BINDER);
2056                }
2057                return myStatus;
2058        }
2059
2060        
2061        /**
2062         * Gets the value(s) for <b>status</b> ().
2063         * creating it if it does
2064         * not exist. This method may return <code>null</code>.
2065         *
2066     * <p>
2067     * <b>Definition:</b>
2068     * 
2069     * </p> 
2070         */
2071        public String getStatus() {  
2072                return getStatusElement().getValue();
2073        }
2074
2075        /**
2076         * Sets the value(s) for <b>status</b> ()
2077         *
2078     * <p>
2079     * <b>Definition:</b>
2080     * 
2081     * </p> 
2082         */
2083        public StatusHistory setStatus(BoundCodeDt<EncounterStateEnum> theValue) {
2084                myStatus = theValue;
2085                return this;
2086        }
2087        
2088        
2089
2090        /**
2091         * Sets the value(s) for <b>status</b> ()
2092         *
2093     * <p>
2094     * <b>Definition:</b>
2095     * 
2096     * </p> 
2097         */
2098        public StatusHistory setStatus(EncounterStateEnum theValue) {
2099                setStatus(new BoundCodeDt<EncounterStateEnum>(EncounterStateEnum.VALUESET_BINDER, theValue));
2100                
2101/*
2102                getStatusElement().setValueAsEnum(theValue);
2103*/
2104                return this;
2105        }
2106
2107  
2108        /**
2109         * Gets the value(s) for <b>period</b> ().
2110         * creating it if it does
2111         * not exist. Will not return <code>null</code>.
2112         *
2113     * <p>
2114     * <b>Definition:</b>
2115     * 
2116     * </p> 
2117         */
2118        public PeriodDt getPeriod() {  
2119                if (myPeriod == null) {
2120                        myPeriod = new PeriodDt();
2121                }
2122                return myPeriod;
2123        }
2124
2125        /**
2126         * Sets the value(s) for <b>period</b> ()
2127         *
2128     * <p>
2129     * <b>Definition:</b>
2130     * 
2131     * </p> 
2132         */
2133        public StatusHistory setPeriod(PeriodDt theValue) {
2134                myPeriod = theValue;
2135                return this;
2136        }
2137        
2138        
2139
2140  
2141
2142
2143        }
2144
2145
2146        /**
2147         * Block class for child element: <b>Encounter.participant</b> ()
2148         *
2149     * <p>
2150     * <b>Definition:</b>
2151     * The list of people responsible for providing the service
2152     * </p> 
2153         */
2154        @Block()        
2155        public static class Participant 
2156            extends  BaseIdentifiableElement  
2157            implements IResourceBlock {
2158        
2159        @Child(name="type", type=CodeableConceptDt.class, order=0, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false)        
2160        @Description(
2161                shortDefinition="",
2162                formalDefinition="Role of participant in encounter"
2163        )
2164        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/valueset-encounter-participant-type")
2165        private java.util.List<BoundCodeableConceptDt<ParticipantTypeEnum>> myType;
2166        
2167        @Child(name="period", type=PeriodDt.class, order=1, min=0, max=1, summary=false, modifier=false)        
2168        @Description(
2169                shortDefinition="",
2170                formalDefinition="The period of time that the specified participant was present during the encounter. These can overlap or be sub-sets of the overall encounters period"
2171        )
2172        private PeriodDt myPeriod;
2173        
2174        @Child(name="individual", order=2, min=0, max=1, summary=true, modifier=false, type={
2175                ca.uhn.fhir.model.dstu2.resource.Practitioner.class, 
2176                ca.uhn.fhir.model.dstu2.resource.RelatedPerson.class
2177        })
2178        @Description(
2179                shortDefinition="who",
2180                formalDefinition=""
2181        )
2182        private ResourceReferenceDt myIndividual;
2183        
2184
2185        @Override
2186        public boolean isEmpty() {
2187                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myType,  myPeriod,  myIndividual);
2188        }
2189        
2190        @Override
2191        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
2192                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myType, myPeriod, myIndividual);
2193        }
2194
2195        /**
2196         * Gets the value(s) for <b>type</b> ().
2197         * creating it if it does
2198         * not exist. Will not return <code>null</code>.
2199         *
2200     * <p>
2201     * <b>Definition:</b>
2202     * Role of participant in encounter
2203     * </p> 
2204         */
2205        public java.util.List<BoundCodeableConceptDt<ParticipantTypeEnum>> getType() {  
2206                if (myType == null) {
2207                        myType = new java.util.ArrayList<BoundCodeableConceptDt<ParticipantTypeEnum>>();
2208                }
2209                return myType;
2210        }
2211
2212        /**
2213         * Sets the value(s) for <b>type</b> ()
2214         *
2215     * <p>
2216     * <b>Definition:</b>
2217     * Role of participant in encounter
2218     * </p> 
2219         */
2220        public Participant setType(java.util.List<BoundCodeableConceptDt<ParticipantTypeEnum>> theValue) {
2221                myType = theValue;
2222                return this;
2223        }
2224        
2225        
2226
2227        /**
2228         * Add a value for <b>type</b> () using an enumerated type. This
2229         * is intended as a convenience method for situations where the FHIR defined ValueSets are mandatory
2230         * or contain the desirable codes. If you wish to use codes other than those which are built-in, 
2231         * you may also use the {@link #addType()} method.
2232         *
2233     * <p>
2234     * <b>Definition:</b>
2235     * Role of participant in encounter
2236     * </p> 
2237         */
2238        public BoundCodeableConceptDt<ParticipantTypeEnum> addType(ParticipantTypeEnum theValue) {
2239                BoundCodeableConceptDt<ParticipantTypeEnum> retVal = new BoundCodeableConceptDt<ParticipantTypeEnum>(ParticipantTypeEnum.VALUESET_BINDER, theValue);
2240                getType().add(retVal);
2241                return retVal;
2242        }
2243
2244        /**
2245         * Gets the first repetition for <b>type</b> (),
2246         * creating it if it does not already exist.
2247         *
2248     * <p>
2249     * <b>Definition:</b>
2250     * Role of participant in encounter
2251     * </p> 
2252         */
2253        public BoundCodeableConceptDt<ParticipantTypeEnum> getTypeFirstRep() {
2254                if (getType().size() == 0) {
2255                        addType();
2256                }
2257                return getType().get(0);
2258        }
2259
2260        /**
2261         * Add a value for <b>type</b> ()
2262         *
2263     * <p>
2264     * <b>Definition:</b>
2265     * Role of participant in encounter
2266     * </p> 
2267         */
2268        public BoundCodeableConceptDt<ParticipantTypeEnum> addType() {
2269                BoundCodeableConceptDt<ParticipantTypeEnum> retVal = new BoundCodeableConceptDt<ParticipantTypeEnum>(ParticipantTypeEnum.VALUESET_BINDER);
2270                getType().add(retVal);
2271                return retVal;
2272        }
2273
2274        /**
2275         * Sets the value(s), and clears any existing value(s) for <b>type</b> ()
2276         *
2277     * <p>
2278     * <b>Definition:</b>
2279     * Role of participant in encounter
2280     * </p> 
2281         */
2282        public Participant setType(ParticipantTypeEnum theValue) {
2283                getType().clear();
2284                addType(theValue);
2285                return this;
2286        }
2287
2288  
2289        /**
2290         * Gets the value(s) for <b>period</b> ().
2291         * creating it if it does
2292         * not exist. Will not return <code>null</code>.
2293         *
2294     * <p>
2295     * <b>Definition:</b>
2296     * The period of time that the specified participant was present during the encounter. These can overlap or be sub-sets of the overall encounters period
2297     * </p> 
2298         */
2299        public PeriodDt getPeriod() {  
2300                if (myPeriod == null) {
2301                        myPeriod = new PeriodDt();
2302                }
2303                return myPeriod;
2304        }
2305
2306        /**
2307         * Sets the value(s) for <b>period</b> ()
2308         *
2309     * <p>
2310     * <b>Definition:</b>
2311     * The period of time that the specified participant was present during the encounter. These can overlap or be sub-sets of the overall encounters period
2312     * </p> 
2313         */
2314        public Participant setPeriod(PeriodDt theValue) {
2315                myPeriod = theValue;
2316                return this;
2317        }
2318        
2319        
2320
2321  
2322        /**
2323         * Gets the value(s) for <b>individual</b> (who).
2324         * creating it if it does
2325         * not exist. Will not return <code>null</code>.
2326         *
2327     * <p>
2328     * <b>Definition:</b>
2329     * 
2330     * </p> 
2331         */
2332        public ResourceReferenceDt getIndividual() {  
2333                if (myIndividual == null) {
2334                        myIndividual = new ResourceReferenceDt();
2335                }
2336                return myIndividual;
2337        }
2338
2339        /**
2340         * Sets the value(s) for <b>individual</b> (who)
2341         *
2342     * <p>
2343     * <b>Definition:</b>
2344     * 
2345     * </p> 
2346         */
2347        public Participant setIndividual(ResourceReferenceDt theValue) {
2348                myIndividual = theValue;
2349                return this;
2350        }
2351        
2352        
2353
2354  
2355
2356
2357        }
2358
2359
2360        /**
2361         * Block class for child element: <b>Encounter.hospitalization</b> ()
2362         *
2363     * <p>
2364     * <b>Definition:</b>
2365     * 
2366     * </p> 
2367         */
2368        @Block()        
2369        public static class Hospitalization 
2370            extends  BaseIdentifiableElement  
2371            implements IResourceBlock {
2372        
2373        @Child(name="preAdmissionIdentifier", type=IdentifierDt.class, order=0, min=0, max=1, summary=false, modifier=false)    
2374        @Description(
2375                shortDefinition="",
2376                formalDefinition=""
2377        )
2378        private IdentifierDt myPreAdmissionIdentifier;
2379        
2380        @Child(name="origin", order=1, min=0, max=1, summary=false, modifier=false, type={
2381                ca.uhn.fhir.model.dstu2.resource.Location.class
2382        })
2383        @Description(
2384                shortDefinition="",
2385                formalDefinition=""
2386        )
2387        private ResourceReferenceDt myOrigin;
2388        
2389        @Child(name="admitSource", type=CodeableConceptDt.class, order=2, min=0, max=1, summary=false, modifier=false)  
2390        @Description(
2391                shortDefinition="",
2392                formalDefinition=""
2393        )
2394        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/valueset-encounter-admit-source")
2395        private BoundCodeableConceptDt<AdmitSourceEnum> myAdmitSource;
2396        
2397        @Child(name="admittingDiagnosis", order=3, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
2398                ca.uhn.fhir.model.dstu2.resource.Condition.class
2399        })
2400        @Description(
2401                shortDefinition="",
2402                formalDefinition="The admitting diagnosis field is used to record the diagnosis codes as reported by admitting practitioner. This could be different or in addition to the conditions reported as reason-condition(s) for the encounter"
2403        )
2404        private java.util.List<ResourceReferenceDt> myAdmittingDiagnosis;
2405        
2406        @Child(name="reAdmission", type=CodeableConceptDt.class, order=4, min=0, max=1, summary=false, modifier=false)  
2407        @Description(
2408                shortDefinition="",
2409                formalDefinition="Whether this hospitalization is a readmission and why if known"
2410        )
2411        private CodeableConceptDt myReAdmission;
2412        
2413        @Child(name="dietPreference", type=CodeableConceptDt.class, order=5, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)     
2414        @Description(
2415                shortDefinition="",
2416                formalDefinition=""
2417        )
2418        private java.util.List<CodeableConceptDt> myDietPreference;
2419        
2420        @Child(name="specialCourtesy", type=CodeableConceptDt.class, order=6, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)    
2421        @Description(
2422                shortDefinition="",
2423                formalDefinition=""
2424        )
2425        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/valueset-encounter-special-courtesy")
2426        private java.util.List<CodeableConceptDt> mySpecialCourtesy;
2427        
2428        @Child(name="specialArrangement", type=CodeableConceptDt.class, order=7, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false) 
2429        @Description(
2430                shortDefinition="",
2431                formalDefinition=""
2432        )
2433        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/valueset-encounter-special-arrangements")
2434        private java.util.List<CodeableConceptDt> mySpecialArrangement;
2435        
2436        @Child(name="destination", order=8, min=0, max=1, summary=false, modifier=false, type={
2437                ca.uhn.fhir.model.dstu2.resource.Location.class
2438        })
2439        @Description(
2440                shortDefinition="",
2441                formalDefinition=""
2442        )
2443        private ResourceReferenceDt myDestination;
2444        
2445        @Child(name="dischargeDisposition", type=CodeableConceptDt.class, order=9, min=0, max=1, summary=false, modifier=false) 
2446        @Description(
2447                shortDefinition="",
2448                formalDefinition=""
2449        )
2450        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/valueset-encounter-discharge-disposition")
2451        private CodeableConceptDt myDischargeDisposition;
2452        
2453        @Child(name="dischargeDiagnosis", order=10, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
2454                ca.uhn.fhir.model.dstu2.resource.Condition.class
2455        })
2456        @Description(
2457                shortDefinition="",
2458                formalDefinition=""
2459        )
2460        private java.util.List<ResourceReferenceDt> myDischargeDiagnosis;
2461        
2462
2463        @Override
2464        public boolean isEmpty() {
2465                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myPreAdmissionIdentifier,  myOrigin,  myAdmitSource,  myAdmittingDiagnosis,  myReAdmission,  myDietPreference,  mySpecialCourtesy,  mySpecialArrangement,  myDestination,  myDischargeDisposition,  myDischargeDiagnosis);
2466        }
2467        
2468        @Override
2469        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
2470                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myPreAdmissionIdentifier, myOrigin, myAdmitSource, myAdmittingDiagnosis, myReAdmission, myDietPreference, mySpecialCourtesy, mySpecialArrangement, myDestination, myDischargeDisposition, myDischargeDiagnosis);
2471        }
2472
2473        /**
2474         * Gets the value(s) for <b>preAdmissionIdentifier</b> ().
2475         * creating it if it does
2476         * not exist. Will not return <code>null</code>.
2477         *
2478     * <p>
2479     * <b>Definition:</b>
2480     * 
2481     * </p> 
2482         */
2483        public IdentifierDt getPreAdmissionIdentifier() {  
2484                if (myPreAdmissionIdentifier == null) {
2485                        myPreAdmissionIdentifier = new IdentifierDt();
2486                }
2487                return myPreAdmissionIdentifier;
2488        }
2489
2490        /**
2491         * Sets the value(s) for <b>preAdmissionIdentifier</b> ()
2492         *
2493     * <p>
2494     * <b>Definition:</b>
2495     * 
2496     * </p> 
2497         */
2498        public Hospitalization setPreAdmissionIdentifier(IdentifierDt theValue) {
2499                myPreAdmissionIdentifier = theValue;
2500                return this;
2501        }
2502        
2503        
2504
2505  
2506        /**
2507         * Gets the value(s) for <b>origin</b> ().
2508         * creating it if it does
2509         * not exist. Will not return <code>null</code>.
2510         *
2511     * <p>
2512     * <b>Definition:</b>
2513     * 
2514     * </p> 
2515         */
2516        public ResourceReferenceDt getOrigin() {  
2517                if (myOrigin == null) {
2518                        myOrigin = new ResourceReferenceDt();
2519                }
2520                return myOrigin;
2521        }
2522
2523        /**
2524         * Sets the value(s) for <b>origin</b> ()
2525         *
2526     * <p>
2527     * <b>Definition:</b>
2528     * 
2529     * </p> 
2530         */
2531        public Hospitalization setOrigin(ResourceReferenceDt theValue) {
2532                myOrigin = theValue;
2533                return this;
2534        }
2535        
2536        
2537
2538  
2539        /**
2540         * Gets the value(s) for <b>admitSource</b> ().
2541         * creating it if it does
2542         * not exist. Will not return <code>null</code>.
2543         *
2544     * <p>
2545     * <b>Definition:</b>
2546     * 
2547     * </p> 
2548         */
2549        public BoundCodeableConceptDt<AdmitSourceEnum> getAdmitSource() {  
2550                if (myAdmitSource == null) {
2551                        myAdmitSource = new BoundCodeableConceptDt<AdmitSourceEnum>(AdmitSourceEnum.VALUESET_BINDER);
2552                }
2553                return myAdmitSource;
2554        }
2555
2556        /**
2557         * Sets the value(s) for <b>admitSource</b> ()
2558         *
2559     * <p>
2560     * <b>Definition:</b>
2561     * 
2562     * </p> 
2563         */
2564        public Hospitalization setAdmitSource(BoundCodeableConceptDt<AdmitSourceEnum> theValue) {
2565                myAdmitSource = theValue;
2566                return this;
2567        }
2568        
2569        
2570
2571        /**
2572         * Sets the value(s) for <b>admitSource</b> ()
2573         *
2574     * <p>
2575     * <b>Definition:</b>
2576     * 
2577     * </p> 
2578         */
2579        public Hospitalization setAdmitSource(AdmitSourceEnum theValue) {
2580                setAdmitSource(new BoundCodeableConceptDt<AdmitSourceEnum>(AdmitSourceEnum.VALUESET_BINDER, theValue));
2581                
2582/*
2583                getAdmitSource().setValueAsEnum(theValue);
2584*/
2585                return this;
2586        }
2587
2588  
2589        /**
2590         * Gets the value(s) for <b>admittingDiagnosis</b> ().
2591         * creating it if it does
2592         * not exist. Will not return <code>null</code>.
2593         *
2594     * <p>
2595     * <b>Definition:</b>
2596     * The admitting diagnosis field is used to record the diagnosis codes as reported by admitting practitioner. This could be different or in addition to the conditions reported as reason-condition(s) for the encounter
2597     * </p> 
2598         */
2599        public java.util.List<ResourceReferenceDt> getAdmittingDiagnosis() {  
2600                if (myAdmittingDiagnosis == null) {
2601                        myAdmittingDiagnosis = new java.util.ArrayList<ResourceReferenceDt>();
2602                }
2603                return myAdmittingDiagnosis;
2604        }
2605
2606        /**
2607         * Sets the value(s) for <b>admittingDiagnosis</b> ()
2608         *
2609     * <p>
2610     * <b>Definition:</b>
2611     * The admitting diagnosis field is used to record the diagnosis codes as reported by admitting practitioner. This could be different or in addition to the conditions reported as reason-condition(s) for the encounter
2612     * </p> 
2613         */
2614        public Hospitalization setAdmittingDiagnosis(java.util.List<ResourceReferenceDt> theValue) {
2615                myAdmittingDiagnosis = theValue;
2616                return this;
2617        }
2618        
2619        
2620
2621        /**
2622         * Adds and returns a new value for <b>admittingDiagnosis</b> ()
2623         *
2624     * <p>
2625     * <b>Definition:</b>
2626     * The admitting diagnosis field is used to record the diagnosis codes as reported by admitting practitioner. This could be different or in addition to the conditions reported as reason-condition(s) for the encounter
2627     * </p> 
2628         */
2629        public ResourceReferenceDt addAdmittingDiagnosis() {
2630                ResourceReferenceDt newType = new ResourceReferenceDt();
2631                getAdmittingDiagnosis().add(newType);
2632                return newType; 
2633        }
2634  
2635        /**
2636         * Gets the value(s) for <b>reAdmission</b> ().
2637         * creating it if it does
2638         * not exist. Will not return <code>null</code>.
2639         *
2640     * <p>
2641     * <b>Definition:</b>
2642     * Whether this hospitalization is a readmission and why if known
2643     * </p> 
2644         */
2645        public CodeableConceptDt getReAdmission() {  
2646                if (myReAdmission == null) {
2647                        myReAdmission = new CodeableConceptDt();
2648                }
2649                return myReAdmission;
2650        }
2651
2652        /**
2653         * Sets the value(s) for <b>reAdmission</b> ()
2654         *
2655     * <p>
2656     * <b>Definition:</b>
2657     * Whether this hospitalization is a readmission and why if known
2658     * </p> 
2659         */
2660        public Hospitalization setReAdmission(CodeableConceptDt theValue) {
2661                myReAdmission = theValue;
2662                return this;
2663        }
2664        
2665        
2666
2667  
2668        /**
2669         * Gets the value(s) for <b>dietPreference</b> ().
2670         * creating it if it does
2671         * not exist. Will not return <code>null</code>.
2672         *
2673     * <p>
2674     * <b>Definition:</b>
2675     * 
2676     * </p> 
2677         */
2678        public java.util.List<CodeableConceptDt> getDietPreference() {  
2679                if (myDietPreference == null) {
2680                        myDietPreference = new java.util.ArrayList<CodeableConceptDt>();
2681                }
2682                return myDietPreference;
2683        }
2684
2685        /**
2686         * Sets the value(s) for <b>dietPreference</b> ()
2687         *
2688     * <p>
2689     * <b>Definition:</b>
2690     * 
2691     * </p> 
2692         */
2693        public Hospitalization setDietPreference(java.util.List<CodeableConceptDt> theValue) {
2694                myDietPreference = theValue;
2695                return this;
2696        }
2697        
2698        
2699
2700        /**
2701         * Adds and returns a new value for <b>dietPreference</b> ()
2702         *
2703     * <p>
2704     * <b>Definition:</b>
2705     * 
2706     * </p> 
2707         */
2708        public CodeableConceptDt addDietPreference() {
2709                CodeableConceptDt newType = new CodeableConceptDt();
2710                getDietPreference().add(newType);
2711                return newType; 
2712        }
2713
2714        /**
2715         * Adds a given new value for <b>dietPreference</b> ()
2716         *
2717         * <p>
2718         * <b>Definition:</b>
2719         * 
2720         * </p>
2721         * @param theValue The dietPreference to add (must not be <code>null</code>)
2722         */
2723        public Hospitalization addDietPreference(CodeableConceptDt theValue) {
2724                if (theValue == null) {
2725                        throw new NullPointerException("theValue must not be null");
2726                }
2727                getDietPreference().add(theValue);
2728                return this;
2729        }
2730
2731        /**
2732         * Gets the first repetition for <b>dietPreference</b> (),
2733         * creating it if it does not already exist.
2734         *
2735     * <p>
2736     * <b>Definition:</b>
2737     * 
2738     * </p> 
2739         */
2740        public CodeableConceptDt getDietPreferenceFirstRep() {
2741                if (getDietPreference().isEmpty()) {
2742                        return addDietPreference();
2743                }
2744                return getDietPreference().get(0); 
2745        }
2746  
2747        /**
2748         * Gets the value(s) for <b>specialCourtesy</b> ().
2749         * creating it if it does
2750         * not exist. Will not return <code>null</code>.
2751         *
2752     * <p>
2753     * <b>Definition:</b>
2754     * 
2755     * </p> 
2756         */
2757        public java.util.List<CodeableConceptDt> getSpecialCourtesy() {  
2758                if (mySpecialCourtesy == null) {
2759                        mySpecialCourtesy = new java.util.ArrayList<CodeableConceptDt>();
2760                }
2761                return mySpecialCourtesy;
2762        }
2763
2764        /**
2765         * Sets the value(s) for <b>specialCourtesy</b> ()
2766         *
2767     * <p>
2768     * <b>Definition:</b>
2769     * 
2770     * </p> 
2771         */
2772        public Hospitalization setSpecialCourtesy(java.util.List<CodeableConceptDt> theValue) {
2773                mySpecialCourtesy = theValue;
2774                return this;
2775        }
2776        
2777        
2778
2779        /**
2780         * Adds and returns a new value for <b>specialCourtesy</b> ()
2781         *
2782     * <p>
2783     * <b>Definition:</b>
2784     * 
2785     * </p> 
2786         */
2787        public CodeableConceptDt addSpecialCourtesy() {
2788                CodeableConceptDt newType = new CodeableConceptDt();
2789                getSpecialCourtesy().add(newType);
2790                return newType; 
2791        }
2792
2793        /**
2794         * Adds a given new value for <b>specialCourtesy</b> ()
2795         *
2796         * <p>
2797         * <b>Definition:</b>
2798         * 
2799         * </p>
2800         * @param theValue The specialCourtesy to add (must not be <code>null</code>)
2801         */
2802        public Hospitalization addSpecialCourtesy(CodeableConceptDt theValue) {
2803                if (theValue == null) {
2804                        throw new NullPointerException("theValue must not be null");
2805                }
2806                getSpecialCourtesy().add(theValue);
2807                return this;
2808        }
2809
2810        /**
2811         * Gets the first repetition for <b>specialCourtesy</b> (),
2812         * creating it if it does not already exist.
2813         *
2814     * <p>
2815     * <b>Definition:</b>
2816     * 
2817     * </p> 
2818         */
2819        public CodeableConceptDt getSpecialCourtesyFirstRep() {
2820                if (getSpecialCourtesy().isEmpty()) {
2821                        return addSpecialCourtesy();
2822                }
2823                return getSpecialCourtesy().get(0); 
2824        }
2825  
2826        /**
2827         * Gets the value(s) for <b>specialArrangement</b> ().
2828         * creating it if it does
2829         * not exist. Will not return <code>null</code>.
2830         *
2831     * <p>
2832     * <b>Definition:</b>
2833     * 
2834     * </p> 
2835         */
2836        public java.util.List<CodeableConceptDt> getSpecialArrangement() {  
2837                if (mySpecialArrangement == null) {
2838                        mySpecialArrangement = new java.util.ArrayList<CodeableConceptDt>();
2839                }
2840                return mySpecialArrangement;
2841        }
2842
2843        /**
2844         * Sets the value(s) for <b>specialArrangement</b> ()
2845         *
2846     * <p>
2847     * <b>Definition:</b>
2848     * 
2849     * </p> 
2850         */
2851        public Hospitalization setSpecialArrangement(java.util.List<CodeableConceptDt> theValue) {
2852                mySpecialArrangement = theValue;
2853                return this;
2854        }
2855        
2856        
2857
2858        /**
2859         * Adds and returns a new value for <b>specialArrangement</b> ()
2860         *
2861     * <p>
2862     * <b>Definition:</b>
2863     * 
2864     * </p> 
2865         */
2866        public CodeableConceptDt addSpecialArrangement() {
2867                CodeableConceptDt newType = new CodeableConceptDt();
2868                getSpecialArrangement().add(newType);
2869                return newType; 
2870        }
2871
2872        /**
2873         * Adds a given new value for <b>specialArrangement</b> ()
2874         *
2875         * <p>
2876         * <b>Definition:</b>
2877         * 
2878         * </p>
2879         * @param theValue The specialArrangement to add (must not be <code>null</code>)
2880         */
2881        public Hospitalization addSpecialArrangement(CodeableConceptDt theValue) {
2882                if (theValue == null) {
2883                        throw new NullPointerException("theValue must not be null");
2884                }
2885                getSpecialArrangement().add(theValue);
2886                return this;
2887        }
2888
2889        /**
2890         * Gets the first repetition for <b>specialArrangement</b> (),
2891         * creating it if it does not already exist.
2892         *
2893     * <p>
2894     * <b>Definition:</b>
2895     * 
2896     * </p> 
2897         */
2898        public CodeableConceptDt getSpecialArrangementFirstRep() {
2899                if (getSpecialArrangement().isEmpty()) {
2900                        return addSpecialArrangement();
2901                }
2902                return getSpecialArrangement().get(0); 
2903        }
2904  
2905        /**
2906         * Gets the value(s) for <b>destination</b> ().
2907         * creating it if it does
2908         * not exist. Will not return <code>null</code>.
2909         *
2910     * <p>
2911     * <b>Definition:</b>
2912     * 
2913     * </p> 
2914         */
2915        public ResourceReferenceDt getDestination() {  
2916                if (myDestination == null) {
2917                        myDestination = new ResourceReferenceDt();
2918                }
2919                return myDestination;
2920        }
2921
2922        /**
2923         * Sets the value(s) for <b>destination</b> ()
2924         *
2925     * <p>
2926     * <b>Definition:</b>
2927     * 
2928     * </p> 
2929         */
2930        public Hospitalization setDestination(ResourceReferenceDt theValue) {
2931                myDestination = theValue;
2932                return this;
2933        }
2934        
2935        
2936
2937  
2938        /**
2939         * Gets the value(s) for <b>dischargeDisposition</b> ().
2940         * creating it if it does
2941         * not exist. Will not return <code>null</code>.
2942         *
2943     * <p>
2944     * <b>Definition:</b>
2945     * 
2946     * </p> 
2947         */
2948        public CodeableConceptDt getDischargeDisposition() {  
2949                if (myDischargeDisposition == null) {
2950                        myDischargeDisposition = new CodeableConceptDt();
2951                }
2952                return myDischargeDisposition;
2953        }
2954
2955        /**
2956         * Sets the value(s) for <b>dischargeDisposition</b> ()
2957         *
2958     * <p>
2959     * <b>Definition:</b>
2960     * 
2961     * </p> 
2962         */
2963        public Hospitalization setDischargeDisposition(CodeableConceptDt theValue) {
2964                myDischargeDisposition = theValue;
2965                return this;
2966        }
2967        
2968        
2969
2970  
2971        /**
2972         * Gets the value(s) for <b>dischargeDiagnosis</b> ().
2973         * creating it if it does
2974         * not exist. Will not return <code>null</code>.
2975         *
2976     * <p>
2977     * <b>Definition:</b>
2978     * 
2979     * </p> 
2980         */
2981        public java.util.List<ResourceReferenceDt> getDischargeDiagnosis() {  
2982                if (myDischargeDiagnosis == null) {
2983                        myDischargeDiagnosis = new java.util.ArrayList<ResourceReferenceDt>();
2984                }
2985                return myDischargeDiagnosis;
2986        }
2987
2988        /**
2989         * Sets the value(s) for <b>dischargeDiagnosis</b> ()
2990         *
2991     * <p>
2992     * <b>Definition:</b>
2993     * 
2994     * </p> 
2995         */
2996        public Hospitalization setDischargeDiagnosis(java.util.List<ResourceReferenceDt> theValue) {
2997                myDischargeDiagnosis = theValue;
2998                return this;
2999        }
3000        
3001        
3002
3003        /**
3004         * Adds and returns a new value for <b>dischargeDiagnosis</b> ()
3005         *
3006     * <p>
3007     * <b>Definition:</b>
3008     * 
3009     * </p> 
3010         */
3011        public ResourceReferenceDt addDischargeDiagnosis() {
3012                ResourceReferenceDt newType = new ResourceReferenceDt();
3013                getDischargeDiagnosis().add(newType);
3014                return newType; 
3015        }
3016  
3017
3018
3019        }
3020
3021
3022        /**
3023         * Block class for child element: <b>Encounter.location</b> ()
3024         *
3025     * <p>
3026     * <b>Definition:</b>
3027     * List of locations where  the patient has been during this encounter
3028     * </p> 
3029         */
3030        @Block()        
3031        public static class Location 
3032            extends  BaseIdentifiableElement  
3033            implements IResourceBlock {
3034        
3035        @Child(name="location", order=0, min=1, max=1, summary=false, modifier=false, type={
3036                ca.uhn.fhir.model.dstu2.resource.Location.class
3037        })
3038        @Description(
3039                shortDefinition="where",
3040                formalDefinition="The location where the encounter takes place"
3041        )
3042        private ResourceReferenceDt myLocation;
3043        
3044        @Child(name="status", type=CodeDt.class, order=1, min=0, max=1, summary=false, modifier=false)  
3045        @Description(
3046                shortDefinition="",
3047                formalDefinition="The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time"
3048        )
3049        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/encounter-location-status")
3050        private BoundCodeDt<EncounterLocationStatusEnum> myStatus;
3051        
3052        @Child(name="period", type=PeriodDt.class, order=2, min=0, max=1, summary=false, modifier=false)        
3053        @Description(
3054                shortDefinition="",
3055                formalDefinition=""
3056        )
3057        private PeriodDt myPeriod;
3058        
3059
3060        @Override
3061        public boolean isEmpty() {
3062                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myLocation,  myStatus,  myPeriod);
3063        }
3064        
3065        @Override
3066        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
3067                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myLocation, myStatus, myPeriod);
3068        }
3069
3070        /**
3071         * Gets the value(s) for <b>location</b> (where).
3072         * creating it if it does
3073         * not exist. Will not return <code>null</code>.
3074         *
3075     * <p>
3076     * <b>Definition:</b>
3077     * The location where the encounter takes place
3078     * </p> 
3079         */
3080        public ResourceReferenceDt getLocation() {  
3081                if (myLocation == null) {
3082                        myLocation = new ResourceReferenceDt();
3083                }
3084                return myLocation;
3085        }
3086
3087        /**
3088         * Sets the value(s) for <b>location</b> (where)
3089         *
3090     * <p>
3091     * <b>Definition:</b>
3092     * The location where the encounter takes place
3093     * </p> 
3094         */
3095        public Location setLocation(ResourceReferenceDt theValue) {
3096                myLocation = theValue;
3097                return this;
3098        }
3099        
3100        
3101
3102  
3103        /**
3104         * Gets the value(s) for <b>status</b> ().
3105         * creating it if it does
3106         * not exist. Will not return <code>null</code>.
3107         *
3108     * <p>
3109     * <b>Definition:</b>
3110     * The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time
3111     * </p> 
3112         */
3113        public BoundCodeDt<EncounterLocationStatusEnum> getStatusElement() {  
3114                if (myStatus == null) {
3115                        myStatus = new BoundCodeDt<EncounterLocationStatusEnum>(EncounterLocationStatusEnum.VALUESET_BINDER);
3116                }
3117                return myStatus;
3118        }
3119
3120        
3121        /**
3122         * Gets the value(s) for <b>status</b> ().
3123         * creating it if it does
3124         * not exist. This method may return <code>null</code>.
3125         *
3126     * <p>
3127     * <b>Definition:</b>
3128     * The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time
3129     * </p> 
3130         */
3131        public String getStatus() {  
3132                return getStatusElement().getValue();
3133        }
3134
3135        /**
3136         * Sets the value(s) for <b>status</b> ()
3137         *
3138     * <p>
3139     * <b>Definition:</b>
3140     * The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time
3141     * </p> 
3142         */
3143        public Location setStatus(BoundCodeDt<EncounterLocationStatusEnum> theValue) {
3144                myStatus = theValue;
3145                return this;
3146        }
3147        
3148        
3149
3150        /**
3151         * Sets the value(s) for <b>status</b> ()
3152         *
3153     * <p>
3154     * <b>Definition:</b>
3155     * The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time
3156     * </p> 
3157         */
3158        public Location setStatus(EncounterLocationStatusEnum theValue) {
3159                setStatus(new BoundCodeDt<EncounterLocationStatusEnum>(EncounterLocationStatusEnum.VALUESET_BINDER, theValue));
3160                
3161/*
3162                getStatusElement().setValueAsEnum(theValue);
3163*/
3164                return this;
3165        }
3166
3167  
3168        /**
3169         * Gets the value(s) for <b>period</b> ().
3170         * creating it if it does
3171         * not exist. Will not return <code>null</code>.
3172         *
3173     * <p>
3174     * <b>Definition:</b>
3175     * 
3176     * </p> 
3177         */
3178        public PeriodDt getPeriod() {  
3179                if (myPeriod == null) {
3180                        myPeriod = new PeriodDt();
3181                }
3182                return myPeriod;
3183        }
3184
3185        /**
3186         * Sets the value(s) for <b>period</b> ()
3187         *
3188     * <p>
3189     * <b>Definition:</b>
3190     * 
3191     * </p> 
3192         */
3193        public Location setPeriod(PeriodDt theValue) {
3194                myPeriod = theValue;
3195                return this;
3196        }
3197        
3198        
3199
3200  
3201
3202
3203        }
3204
3205
3206
3207
3208    @Override
3209    public String getResourceName() {
3210        return "Encounter";
3211    }
3212    
3213    public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() {
3214        return ca.uhn.fhir.context.FhirVersionEnum.DSTU2;
3215    }
3216
3217
3218}