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