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.valueset.AnimalSpeciesEnum;
042import ca.uhn.fhir.model.dstu2.composite.AnnotationDt;
043import ca.uhn.fhir.model.dstu2.valueset.AnswerFormatEnum;
044import ca.uhn.fhir.model.dstu2.resource.Appointment;
045import ca.uhn.fhir.model.dstu2.valueset.AppointmentStatusEnum;
046import ca.uhn.fhir.model.dstu2.valueset.AssertionDirectionTypeEnum;
047import ca.uhn.fhir.model.dstu2.valueset.AssertionOperatorTypeEnum;
048import ca.uhn.fhir.model.dstu2.valueset.AssertionResponseTypesEnum;
049import ca.uhn.fhir.model.dstu2.composite.AttachmentDt;
050import ca.uhn.fhir.model.dstu2.valueset.AuditEventActionEnum;
051import ca.uhn.fhir.model.dstu2.valueset.AuditEventObjectLifecycleEnum;
052import ca.uhn.fhir.model.dstu2.valueset.AuditEventObjectRoleEnum;
053import ca.uhn.fhir.model.dstu2.valueset.AuditEventObjectTypeEnum;
054import ca.uhn.fhir.model.dstu2.valueset.AuditEventOutcomeEnum;
055import ca.uhn.fhir.model.dstu2.valueset.AuditEventParticipantNetworkTypeEnum;
056import ca.uhn.fhir.model.dstu2.valueset.AuditEventSourceTypeEnum;
057import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum;
058import ca.uhn.fhir.model.dstu2.resource.BodySite;
059import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
060import ca.uhn.fhir.model.dstu2.resource.CarePlan;
061import ca.uhn.fhir.model.dstu2.valueset.CarePlanActivityCategoryEnum;
062import ca.uhn.fhir.model.dstu2.valueset.CarePlanActivityStatusEnum;
063import ca.uhn.fhir.model.dstu2.valueset.CarePlanRelationshipEnum;
064import ca.uhn.fhir.model.dstu2.valueset.CarePlanStatusEnum;
065import ca.uhn.fhir.model.dstu2.resource.Claim;
066import ca.uhn.fhir.model.dstu2.resource.ClaimResponse;
067import ca.uhn.fhir.model.dstu2.valueset.ClaimTypeEnum;
068import ca.uhn.fhir.model.dstu2.resource.ClinicalImpression;
069import ca.uhn.fhir.model.dstu2.valueset.ClinicalImpressionStatusEnum;
070import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
071import ca.uhn.fhir.model.dstu2.composite.CodingDt;
072import ca.uhn.fhir.model.dstu2.resource.CommunicationRequest;
073import ca.uhn.fhir.model.dstu2.valueset.CommunicationRequestStatusEnum;
074import ca.uhn.fhir.model.dstu2.valueset.CommunicationStatusEnum;
075import ca.uhn.fhir.model.dstu2.resource.Composition;
076import ca.uhn.fhir.model.dstu2.valueset.CompositionAttestationModeEnum;
077import ca.uhn.fhir.model.dstu2.valueset.CompositionStatusEnum;
078import ca.uhn.fhir.model.dstu2.valueset.ConceptMapEquivalenceEnum;
079import ca.uhn.fhir.model.dstu2.resource.Condition;
080import ca.uhn.fhir.model.dstu2.valueset.ConditionCategoryCodesEnum;
081import ca.uhn.fhir.model.dstu2.valueset.ConditionClinicalStatusCodesEnum;
082import ca.uhn.fhir.model.dstu2.valueset.ConditionVerificationStatusEnum;
083import ca.uhn.fhir.model.dstu2.valueset.ConditionalDeleteStatusEnum;
084import ca.uhn.fhir.model.dstu2.valueset.ConditionsCodesEnum;
085import ca.uhn.fhir.model.dstu2.resource.Conformance;
086import ca.uhn.fhir.model.dstu2.valueset.ConformanceEventModeEnum;
087import ca.uhn.fhir.model.dstu2.valueset.ConformanceResourceStatusEnum;
088import ca.uhn.fhir.model.dstu2.valueset.ConformanceStatementKindEnum;
089import ca.uhn.fhir.model.dstu2.composite.ContactPointDt;
090import ca.uhn.fhir.model.dstu2.valueset.ContentTypeEnum;
091import ca.uhn.fhir.model.dstu2.resource.Contract;
092import ca.uhn.fhir.model.dstu2.valueset.ContractActionCodesEnum;
093import ca.uhn.fhir.model.dstu2.valueset.ContractActorRoleCodesEnum;
094import ca.uhn.fhir.model.dstu2.valueset.ContractSubtypeCodesEnum;
095import ca.uhn.fhir.model.dstu2.valueset.ContractTermTypeCodesEnum;
096import ca.uhn.fhir.model.dstu2.valueset.ContractTypeCodesEnum;
097import ca.uhn.fhir.model.dstu2.resource.Coverage;
098import ca.uhn.fhir.model.dstu2.valueset.DataElementStringencyEnum;
099import ca.uhn.fhir.model.dstu2.valueset.DaysOfWeekEnum;
100import ca.uhn.fhir.model.dstu2.valueset.DetectedIssueSeverityEnum;
101import ca.uhn.fhir.model.dstu2.resource.Device;
102import ca.uhn.fhir.model.dstu2.resource.DeviceComponent;
103import ca.uhn.fhir.model.dstu2.resource.DeviceMetric;
104import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricCalibrationStateEnum;
105import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricCalibrationTypeEnum;
106import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricCategoryEnum;
107import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricColorEnum;
108import ca.uhn.fhir.model.dstu2.valueset.DeviceMetricOperationalStatusEnum;
109import ca.uhn.fhir.model.dstu2.valueset.DeviceStatusEnum;
110import ca.uhn.fhir.model.dstu2.resource.DeviceUseRequest;
111import ca.uhn.fhir.model.dstu2.valueset.DeviceUseRequestPriorityEnum;
112import ca.uhn.fhir.model.dstu2.valueset.DeviceUseRequestStatusEnum;
113import ca.uhn.fhir.model.dstu2.resource.DiagnosticOrder;
114import ca.uhn.fhir.model.dstu2.valueset.DiagnosticOrderPriorityEnum;
115import ca.uhn.fhir.model.dstu2.valueset.DiagnosticOrderStatusEnum;
116import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport;
117import ca.uhn.fhir.model.dstu2.valueset.DiagnosticReportStatusEnum;
118import ca.uhn.fhir.model.dstu2.valueset.DigitalMediaTypeEnum;
119import ca.uhn.fhir.model.dstu2.valueset.DocumentModeEnum;
120import ca.uhn.fhir.model.dstu2.resource.DocumentReference;
121import ca.uhn.fhir.model.dstu2.valueset.DocumentReferenceStatusEnum;
122import ca.uhn.fhir.model.dstu2.valueset.DocumentRelationshipTypeEnum;
123import ca.uhn.fhir.model.dstu2.composite.ElementDefinitionDt;
124import ca.uhn.fhir.model.dstu2.resource.EligibilityRequest;
125import ca.uhn.fhir.model.dstu2.resource.Encounter;
126import ca.uhn.fhir.model.dstu2.valueset.EncounterClassEnum;
127import ca.uhn.fhir.model.dstu2.valueset.EncounterLocationStatusEnum;
128import ca.uhn.fhir.model.dstu2.valueset.EncounterStateEnum;
129import ca.uhn.fhir.model.dstu2.valueset.EncounterTypeEnum;
130import ca.uhn.fhir.model.dstu2.resource.EnrollmentRequest;
131import ca.uhn.fhir.model.dstu2.valueset.EnteralFormulaTypeCodesEnum;
132import ca.uhn.fhir.model.dstu2.resource.EpisodeOfCare;
133import ca.uhn.fhir.model.dstu2.valueset.EpisodeOfCareStatusEnum;
134import ca.uhn.fhir.model.dstu2.valueset.ExceptionCodesEnum;
135import ca.uhn.fhir.model.dstu2.valueset.ExtensionContextEnum;
136import ca.uhn.fhir.model.dstu2.valueset.FamilyHistoryStatusEnum;
137import ca.uhn.fhir.model.dstu2.resource.FamilyMemberHistory;
138import ca.uhn.fhir.model.dstu2.valueset.FilterOperatorEnum;
139import ca.uhn.fhir.model.dstu2.valueset.FlagCategoryCodesEnum;
140import ca.uhn.fhir.model.dstu2.valueset.FlagStatusEnum;
141import ca.uhn.fhir.model.dstu2.valueset.FluidConsistencyTypeCodesEnum;
142import ca.uhn.fhir.model.dstu2.resource.Goal;
143import ca.uhn.fhir.model.dstu2.valueset.GoalCategoryEnum;
144import ca.uhn.fhir.model.dstu2.valueset.GoalPriorityEnum;
145import ca.uhn.fhir.model.dstu2.valueset.GoalStartEventEnum;
146import ca.uhn.fhir.model.dstu2.valueset.GoalStatusEnum;
147import ca.uhn.fhir.model.dstu2.valueset.GoalStatusReasonEnum;
148import ca.uhn.fhir.model.dstu2.resource.Group;
149import ca.uhn.fhir.model.dstu2.valueset.GroupTypeEnum;
150import ca.uhn.fhir.model.dstu2.valueset.GuideDependencyTypeEnum;
151import ca.uhn.fhir.model.dstu2.valueset.GuidePageKindEnum;
152import ca.uhn.fhir.model.dstu2.valueset.GuideResourcePurposeEnum;
153import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
154import ca.uhn.fhir.model.dstu2.resource.HealthcareService;
155import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
156import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
157import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum;
158import ca.uhn.fhir.model.dstu2.valueset.IdentityAssuranceLevelEnum;
159import ca.uhn.fhir.model.dstu2.resource.ImagingObjectSelection;
160import ca.uhn.fhir.model.dstu2.resource.ImagingStudy;
161import ca.uhn.fhir.model.dstu2.resource.Immunization;
162import ca.uhn.fhir.model.dstu2.valueset.ImmunizationReasonCodesEnum;
163import ca.uhn.fhir.model.dstu2.valueset.ImmunizationRecommendationDateCriterionCodesEnum;
164import ca.uhn.fhir.model.dstu2.valueset.ImmunizationRecommendationStatusCodesEnum;
165import ca.uhn.fhir.model.dstu2.valueset.ImmunizationRouteCodesEnum;
166import ca.uhn.fhir.model.dstu2.valueset.InstanceAvailabilityEnum;
167import ca.uhn.fhir.model.dstu2.valueset.InterventionCodesEnum;
168import ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum;
169import ca.uhn.fhir.model.dstu2.valueset.IssueTypeEnum;
170import ca.uhn.fhir.model.dstu2.valueset.KOStitleEnum;
171import ca.uhn.fhir.model.dstu2.valueset.LateralityEnum;
172import ca.uhn.fhir.model.dstu2.valueset.LinkTypeEnum;
173import ca.uhn.fhir.model.dstu2.valueset.ListModeEnum;
174import ca.uhn.fhir.model.dstu2.valueset.ListOrderCodesEnum;
175import ca.uhn.fhir.model.dstu2.valueset.ListStatusEnum;
176import ca.uhn.fhir.model.dstu2.resource.Location;
177import ca.uhn.fhir.model.dstu2.valueset.LocationModeEnum;
178import ca.uhn.fhir.model.dstu2.valueset.LocationStatusEnum;
179import ca.uhn.fhir.model.dstu2.valueset.LocationTypeEnum;
180import ca.uhn.fhir.model.dstu2.valueset.MaritalStatusCodesEnum;
181import ca.uhn.fhir.model.dstu2.valueset.MeasmntPrincipleEnum;
182import ca.uhn.fhir.model.dstu2.resource.Media;
183import ca.uhn.fhir.model.dstu2.resource.Medication;
184import ca.uhn.fhir.model.dstu2.valueset.MedicationAdministrationStatusEnum;
185import ca.uhn.fhir.model.dstu2.valueset.MedicationDispenseStatusEnum;
186import ca.uhn.fhir.model.dstu2.resource.MedicationOrder;
187import ca.uhn.fhir.model.dstu2.valueset.MedicationOrderStatusEnum;
188import ca.uhn.fhir.model.dstu2.resource.MedicationStatement;
189import ca.uhn.fhir.model.dstu2.valueset.MedicationStatementStatusEnum;
190import ca.uhn.fhir.model.dstu2.valueset.MessageEventEnum;
191import ca.uhn.fhir.model.dstu2.valueset.MessageSignificanceCategoryEnum;
192import ca.uhn.fhir.model.dstu2.valueset.MessageTransportEnum;
193import ca.uhn.fhir.model.dstu2.resource.NamingSystem;
194import ca.uhn.fhir.model.dstu2.valueset.NamingSystemIdentifierTypeEnum;
195import ca.uhn.fhir.model.dstu2.valueset.NamingSystemTypeEnum;
196import ca.uhn.fhir.model.dstu2.valueset.NoteTypeEnum;
197import ca.uhn.fhir.model.dstu2.valueset.NutrientModifierCodesEnum;
198import ca.uhn.fhir.model.dstu2.resource.NutritionOrder;
199import ca.uhn.fhir.model.dstu2.valueset.NutritionOrderStatusEnum;
200import ca.uhn.fhir.model.dstu2.resource.Observation;
201import ca.uhn.fhir.model.dstu2.valueset.ObservationCategoryCodesEnum;
202import ca.uhn.fhir.model.dstu2.valueset.ObservationRelationshipTypeEnum;
203import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
204import ca.uhn.fhir.model.dstu2.resource.OperationDefinition;
205import ca.uhn.fhir.model.dstu2.valueset.OperationKindEnum;
206import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
207import ca.uhn.fhir.model.dstu2.valueset.OperationParameterUseEnum;
208import ca.uhn.fhir.model.dstu2.resource.Order;
209import ca.uhn.fhir.model.dstu2.valueset.OrderStatusEnum;
210import ca.uhn.fhir.model.dstu2.resource.Organization;
211import ca.uhn.fhir.model.dstu2.valueset.OrganizationTypeEnum;
212import ca.uhn.fhir.model.dstu2.valueset.ParticipantRequiredEnum;
213import ca.uhn.fhir.model.dstu2.valueset.ParticipantStatusEnum;
214import ca.uhn.fhir.model.dstu2.valueset.ParticipantTypeEnum;
215import ca.uhn.fhir.model.dstu2.valueset.ParticipationStatusEnum;
216import ca.uhn.fhir.model.dstu2.resource.Patient;
217import ca.uhn.fhir.model.dstu2.valueset.PayeeTypeCodesEnum;
218import ca.uhn.fhir.model.dstu2.valueset.PaymentStatusCodesEnum;
219import ca.uhn.fhir.model.dstu2.valueset.PaymentTypeCodesEnum;
220import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
221import ca.uhn.fhir.model.dstu2.resource.Person;
222import ca.uhn.fhir.model.dstu2.resource.Practitioner;
223import ca.uhn.fhir.model.dstu2.valueset.PractitionerRoleEnum;
224import ca.uhn.fhir.model.dstu2.valueset.PractitionerSpecialtyEnum;
225import ca.uhn.fhir.model.dstu2.valueset.PriorityCodesEnum;
226import ca.uhn.fhir.model.dstu2.resource.Procedure;
227import ca.uhn.fhir.model.dstu2.resource.ProcedureRequest;
228import ca.uhn.fhir.model.dstu2.valueset.ProcedureRequestPriorityEnum;
229import ca.uhn.fhir.model.dstu2.valueset.ProcedureRequestStatusEnum;
230import ca.uhn.fhir.model.dstu2.valueset.ProcedureStatusEnum;
231import ca.uhn.fhir.model.dstu2.resource.ProcessRequest;
232import ca.uhn.fhir.model.dstu2.valueset.ProvenanceEntityRoleEnum;
233import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
234import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
235import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
236import ca.uhn.fhir.model.dstu2.valueset.QuestionnaireResponseStatusEnum;
237import ca.uhn.fhir.model.dstu2.valueset.QuestionnaireStatusEnum;
238import ca.uhn.fhir.model.dstu2.composite.RangeDt;
239import ca.uhn.fhir.model.dstu2.composite.RatioDt;
240import ca.uhn.fhir.model.dstu2.valueset.ReferralMethodEnum;
241import ca.uhn.fhir.model.dstu2.resource.ReferralRequest;
242import ca.uhn.fhir.model.dstu2.valueset.ReferralStatusEnum;
243import ca.uhn.fhir.model.dstu2.resource.RelatedPerson;
244import ca.uhn.fhir.model.dstu2.valueset.RemittanceOutcomeEnum;
245import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum;
246import ca.uhn.fhir.model.dstu2.valueset.ResourceVersionPolicyEnum;
247import ca.uhn.fhir.model.dstu2.valueset.ResponseTypeEnum;
248import ca.uhn.fhir.model.dstu2.valueset.RestfulConformanceModeEnum;
249import ca.uhn.fhir.model.dstu2.valueset.RestfulSecurityServiceEnum;
250import ca.uhn.fhir.model.dstu2.resource.RiskAssessment;
251import ca.uhn.fhir.model.dstu2.valueset.RulesetCodesEnum;
252import ca.uhn.fhir.model.dstu2.composite.SampledDataDt;
253import ca.uhn.fhir.model.dstu2.resource.Schedule;
254import ca.uhn.fhir.model.dstu2.valueset.SearchEntryModeEnum;
255import ca.uhn.fhir.model.dstu2.valueset.SearchModifierCodeEnum;
256import ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum;
257import ca.uhn.fhir.model.dstu2.valueset.ServiceProvisionConditionsEnum;
258import ca.uhn.fhir.model.dstu2.composite.SignatureDt;
259import ca.uhn.fhir.model.dstu2.resource.Slot;
260import ca.uhn.fhir.model.dstu2.valueset.SlotStatusEnum;
261import ca.uhn.fhir.model.dstu2.resource.Specimen;
262import ca.uhn.fhir.model.dstu2.valueset.SpecimenCollectionMethodEnum;
263import ca.uhn.fhir.model.dstu2.valueset.SpecimenStatusEnum;
264import ca.uhn.fhir.model.dstu2.resource.StructureDefinition;
265import ca.uhn.fhir.model.dstu2.valueset.StructureDefinitionKindEnum;
266import ca.uhn.fhir.model.dstu2.valueset.SubscriptionChannelTypeEnum;
267import ca.uhn.fhir.model.dstu2.valueset.SubscriptionStatusEnum;
268import ca.uhn.fhir.model.dstu2.valueset.SubscriptionTagEnum;
269import ca.uhn.fhir.model.dstu2.resource.Substance;
270import ca.uhn.fhir.model.dstu2.valueset.SubstanceCategoryCodesEnum;
271import ca.uhn.fhir.model.dstu2.valueset.SupplementTypeCodesEnum;
272import ca.uhn.fhir.model.dstu2.valueset.SupplyDeliveryStatusEnum;
273import ca.uhn.fhir.model.dstu2.resource.SupplyRequest;
274import ca.uhn.fhir.model.dstu2.valueset.SupplyRequestReasonEnum;
275import ca.uhn.fhir.model.dstu2.valueset.SupplyRequestStatusEnum;
276import ca.uhn.fhir.model.dstu2.valueset.SurfaceCodesEnum;
277import ca.uhn.fhir.model.dstu2.valueset.SystemRestfulInteractionEnum;
278import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
279import ca.uhn.fhir.model.dstu2.valueset.TextureModifiedFoodTypeCodesEnum;
280import ca.uhn.fhir.model.dstu2.valueset.TextureModifierCodesEnum;
281import ca.uhn.fhir.model.dstu2.composite.TimingDt;
282import ca.uhn.fhir.model.dstu2.valueset.TransactionModeEnum;
283import ca.uhn.fhir.model.dstu2.valueset.TypeRestfulInteractionEnum;
284import ca.uhn.fhir.model.dstu2.valueset.UDICodesEnum;
285import ca.uhn.fhir.model.dstu2.valueset.UnknownContentCodeEnum;
286import ca.uhn.fhir.model.dstu2.valueset.UseEnum;
287import ca.uhn.fhir.model.dstu2.resource.ValueSet;
288import ca.uhn.fhir.model.dstu2.valueset.VisionBaseEnum;
289import ca.uhn.fhir.model.dstu2.valueset.VisionEyesEnum;
290import ca.uhn.fhir.model.dstu2.resource.VisionPrescription;
291import ca.uhn.fhir.model.dstu2.valueset.XPathUsageTypeEnum;
292import ca.uhn.fhir.model.api.IResource;
293import ca.uhn.fhir.model.dstu2.composite.AgeDt;
294import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt;
295import ca.uhn.fhir.model.dstu2.composite.DurationDt;
296import ca.uhn.fhir.model.dstu2.composite.MoneyDt;
297import ca.uhn.fhir.model.dstu2.composite.NarrativeDt;
298import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
299import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt;
300import ca.uhn.fhir.model.primitive.Base64BinaryDt;
301import ca.uhn.fhir.model.primitive.BooleanDt;
302import ca.uhn.fhir.model.primitive.BoundCodeDt;
303import ca.uhn.fhir.model.primitive.CodeDt;
304import ca.uhn.fhir.model.primitive.DateDt;
305import ca.uhn.fhir.model.primitive.DateTimeDt;
306import ca.uhn.fhir.model.primitive.DecimalDt;
307import ca.uhn.fhir.model.primitive.IdDt;
308import ca.uhn.fhir.model.primitive.InstantDt;
309import ca.uhn.fhir.model.primitive.IntegerDt;
310import ca.uhn.fhir.model.primitive.OidDt;
311import ca.uhn.fhir.model.primitive.PositiveIntDt;
312import ca.uhn.fhir.model.primitive.StringDt;
313import ca.uhn.fhir.model.primitive.TimeDt;
314import ca.uhn.fhir.model.primitive.UnsignedIntDt;
315import ca.uhn.fhir.model.primitive.UriDt;
316
317
318/**
319 * HAPI/FHIR <b>MedicationDispense</b> Resource
320 * (clinical.medication)
321 *
322 * <p>
323 * <b>Definition:</b>
324 * Indicates that a medication product is to be or has been dispensed for a named person/patient.  This includes a description of the medication product (supply) provided and the instructions for administering the medication.  The medication dispense is the result of a pharmacy system responding to a medication order.
325 * </p> 
326 *
327 * <p>
328 * <b>Requirements:</b>
329 * 
330 * </p> 
331 *
332 * <p>
333 * <b>Profile Definition:</b>
334 * <a href="http://hl7.org/fhir/profiles/MedicationDispense">http://hl7.org/fhir/profiles/MedicationDispense</a> 
335 * </p>
336 *
337 */
338@ResourceDef(name="MedicationDispense", profile="http://hl7.org/fhir/profiles/MedicationDispense", id="medicationdispense")
339public class MedicationDispense extends ca.uhn.fhir.model.dstu2.resource.BaseResource
340    implements  IResource     {
341
342        /**
343         * Search parameter constant for <b>destination</b>
344         * <p>
345         * Description: <b>Return dispenses that should be sent to a specific destination</b><br>
346         * Type: <b>reference</b><br>
347         * Path: <b>MedicationDispense.destination</b><br>
348         * </p>
349         */
350        @SearchParamDefinition(name="destination", path="MedicationDispense.destination", description="Return dispenses that should be sent to a specific destination", type="reference"  )
351        public static final String SP_DESTINATION = "destination";
352
353        /**
354         * <b>Fluent Client</b> search parameter constant for <b>destination</b>
355         * <p>
356         * Description: <b>Return dispenses that should be sent to a specific destination</b><br>
357         * Type: <b>reference</b><br>
358         * Path: <b>MedicationDispense.destination</b><br>
359         * </p>
360         */
361        public static final ReferenceClientParam DESTINATION = new ReferenceClientParam(SP_DESTINATION);
362
363        /**
364         * Search parameter constant for <b>dispenser</b>
365         * <p>
366         * Description: <b>Return all dispenses performed by a specific individual</b><br>
367         * Type: <b>reference</b><br>
368         * Path: <b>MedicationDispense.dispenser</b><br>
369         * </p>
370         */
371        @SearchParamDefinition(name="dispenser", path="MedicationDispense.dispenser", description="Return all dispenses performed by a specific individual", type="reference"  )
372        public static final String SP_DISPENSER = "dispenser";
373
374        /**
375         * <b>Fluent Client</b> search parameter constant for <b>dispenser</b>
376         * <p>
377         * Description: <b>Return all dispenses performed by a specific individual</b><br>
378         * Type: <b>reference</b><br>
379         * Path: <b>MedicationDispense.dispenser</b><br>
380         * </p>
381         */
382        public static final ReferenceClientParam DISPENSER = new ReferenceClientParam(SP_DISPENSER);
383
384        /**
385         * Search parameter constant for <b>identifier</b>
386         * <p>
387         * Description: <b>Return dispenses with this external identifier</b><br>
388         * Type: <b>token</b><br>
389         * Path: <b>MedicationDispense.identifier</b><br>
390         * </p>
391         */
392        @SearchParamDefinition(name="identifier", path="MedicationDispense.identifier", description="Return dispenses with this external identifier", type="token"  )
393        public static final String SP_IDENTIFIER = "identifier";
394
395        /**
396         * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
397         * <p>
398         * Description: <b>Return dispenses with this external identifier</b><br>
399         * Type: <b>token</b><br>
400         * Path: <b>MedicationDispense.identifier</b><br>
401         * </p>
402         */
403        public static final TokenClientParam IDENTIFIER = new TokenClientParam(SP_IDENTIFIER);
404
405        /**
406         * Search parameter constant for <b>medication</b>
407         * <p>
408         * Description: <b>Return dispenses of this medicine resource</b><br>
409         * Type: <b>reference</b><br>
410         * Path: <b>MedicationDispense.medicationReference</b><br>
411         * </p>
412         */
413        @SearchParamDefinition(name="medication", path="MedicationDispense.medicationReference", description="Return dispenses of this medicine resource", type="reference"  )
414        public static final String SP_MEDICATION = "medication";
415
416        /**
417         * <b>Fluent Client</b> search parameter constant for <b>medication</b>
418         * <p>
419         * Description: <b>Return dispenses of this medicine resource</b><br>
420         * Type: <b>reference</b><br>
421         * Path: <b>MedicationDispense.medicationReference</b><br>
422         * </p>
423         */
424        public static final ReferenceClientParam MEDICATION = new ReferenceClientParam(SP_MEDICATION);
425
426        /**
427         * Search parameter constant for <b>code</b>
428         * <p>
429         * Description: <b>Return dispenses of this medicine code</b><br>
430         * Type: <b>token</b><br>
431         * Path: <b>MedicationDispense.medicationCodeableConcept</b><br>
432         * </p>
433         */
434        @SearchParamDefinition(name="code", path="MedicationDispense.medicationCodeableConcept", description="Return dispenses of this medicine code", type="token"  )
435        public static final String SP_CODE = "code";
436
437        /**
438         * <b>Fluent Client</b> search parameter constant for <b>code</b>
439         * <p>
440         * Description: <b>Return dispenses of this medicine code</b><br>
441         * Type: <b>token</b><br>
442         * Path: <b>MedicationDispense.medicationCodeableConcept</b><br>
443         * </p>
444         */
445        public static final TokenClientParam CODE = new TokenClientParam(SP_CODE);
446
447        /**
448         * Search parameter constant for <b>patient</b>
449         * <p>
450         * Description: <b>The identity of a patient to list dispenses  for</b><br>
451         * Type: <b>reference</b><br>
452         * Path: <b>MedicationDispense.patient</b><br>
453         * </p>
454         */
455        @SearchParamDefinition(name="patient", path="MedicationDispense.patient", description="The identity of a patient to list dispenses  for", type="reference"  )
456        public static final String SP_PATIENT = "patient";
457
458        /**
459         * <b>Fluent Client</b> search parameter constant for <b>patient</b>
460         * <p>
461         * Description: <b>The identity of a patient to list dispenses  for</b><br>
462         * Type: <b>reference</b><br>
463         * Path: <b>MedicationDispense.patient</b><br>
464         * </p>
465         */
466        public static final ReferenceClientParam PATIENT = new ReferenceClientParam(SP_PATIENT);
467
468        /**
469         * Search parameter constant for <b>prescription</b>
470         * <p>
471         * Description: <b>The identity of a prescription to list dispenses from</b><br>
472         * Type: <b>reference</b><br>
473         * Path: <b>MedicationDispense.authorizingPrescription</b><br>
474         * </p>
475         */
476        @SearchParamDefinition(name="prescription", path="MedicationDispense.authorizingPrescription", description="The identity of a prescription to list dispenses from", type="reference"  )
477        public static final String SP_PRESCRIPTION = "prescription";
478
479        /**
480         * <b>Fluent Client</b> search parameter constant for <b>prescription</b>
481         * <p>
482         * Description: <b>The identity of a prescription to list dispenses from</b><br>
483         * Type: <b>reference</b><br>
484         * Path: <b>MedicationDispense.authorizingPrescription</b><br>
485         * </p>
486         */
487        public static final ReferenceClientParam PRESCRIPTION = new ReferenceClientParam(SP_PRESCRIPTION);
488
489        /**
490         * Search parameter constant for <b>responsibleparty</b>
491         * <p>
492         * Description: <b>Return all dispenses with the specified responsible party</b><br>
493         * Type: <b>reference</b><br>
494         * Path: <b>MedicationDispense.substitution.responsibleParty</b><br>
495         * </p>
496         */
497        @SearchParamDefinition(name="responsibleparty", path="MedicationDispense.substitution.responsibleParty", description="Return all dispenses with the specified responsible party", type="reference"  )
498        public static final String SP_RESPONSIBLEPARTY = "responsibleparty";
499
500        /**
501         * <b>Fluent Client</b> search parameter constant for <b>responsibleparty</b>
502         * <p>
503         * Description: <b>Return all dispenses with the specified responsible party</b><br>
504         * Type: <b>reference</b><br>
505         * Path: <b>MedicationDispense.substitution.responsibleParty</b><br>
506         * </p>
507         */
508        public static final ReferenceClientParam RESPONSIBLEPARTY = new ReferenceClientParam(SP_RESPONSIBLEPARTY);
509
510        /**
511         * Search parameter constant for <b>status</b>
512         * <p>
513         * Description: <b>Status of the dispense</b><br>
514         * Type: <b>token</b><br>
515         * Path: <b>MedicationDispense.status</b><br>
516         * </p>
517         */
518        @SearchParamDefinition(name="status", path="MedicationDispense.status", description="Status of the dispense", type="token"  )
519        public static final String SP_STATUS = "status";
520
521        /**
522         * <b>Fluent Client</b> search parameter constant for <b>status</b>
523         * <p>
524         * Description: <b>Status of the dispense</b><br>
525         * Type: <b>token</b><br>
526         * Path: <b>MedicationDispense.status</b><br>
527         * </p>
528         */
529        public static final TokenClientParam STATUS = new TokenClientParam(SP_STATUS);
530
531        /**
532         * Search parameter constant for <b>type</b>
533         * <p>
534         * Description: <b>Return all dispenses of a specific type</b><br>
535         * Type: <b>token</b><br>
536         * Path: <b>MedicationDispense.type</b><br>
537         * </p>
538         */
539        @SearchParamDefinition(name="type", path="MedicationDispense.type", description="Return all dispenses of a specific type", type="token"  )
540        public static final String SP_TYPE = "type";
541
542        /**
543         * <b>Fluent Client</b> search parameter constant for <b>type</b>
544         * <p>
545         * Description: <b>Return all dispenses of a specific type</b><br>
546         * Type: <b>token</b><br>
547         * Path: <b>MedicationDispense.type</b><br>
548         * </p>
549         */
550        public static final TokenClientParam TYPE = new TokenClientParam(SP_TYPE);
551
552        /**
553         * Search parameter constant for <b>whenhandedover</b>
554         * <p>
555         * Description: <b>Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting)</b><br>
556         * Type: <b>date</b><br>
557         * Path: <b>MedicationDispense.whenHandedOver</b><br>
558         * </p>
559         */
560        @SearchParamDefinition(name="whenhandedover", path="MedicationDispense.whenHandedOver", description="Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting)", type="date"  )
561        public static final String SP_WHENHANDEDOVER = "whenhandedover";
562
563        /**
564         * <b>Fluent Client</b> search parameter constant for <b>whenhandedover</b>
565         * <p>
566         * Description: <b>Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting)</b><br>
567         * Type: <b>date</b><br>
568         * Path: <b>MedicationDispense.whenHandedOver</b><br>
569         * </p>
570         */
571        public static final DateClientParam WHENHANDEDOVER = new DateClientParam(SP_WHENHANDEDOVER);
572
573        /**
574         * Search parameter constant for <b>whenprepared</b>
575         * <p>
576         * Description: <b>Date when medication prepared</b><br>
577         * Type: <b>date</b><br>
578         * Path: <b>MedicationDispense.whenPrepared</b><br>
579         * </p>
580         */
581        @SearchParamDefinition(name="whenprepared", path="MedicationDispense.whenPrepared", description="Date when medication prepared", type="date"  )
582        public static final String SP_WHENPREPARED = "whenprepared";
583
584        /**
585         * <b>Fluent Client</b> search parameter constant for <b>whenprepared</b>
586         * <p>
587         * Description: <b>Date when medication prepared</b><br>
588         * Type: <b>date</b><br>
589         * Path: <b>MedicationDispense.whenPrepared</b><br>
590         * </p>
591         */
592        public static final DateClientParam WHENPREPARED = new DateClientParam(SP_WHENPREPARED);
593
594        /**
595         * Search parameter constant for <b>receiver</b>
596         * <p>
597         * Description: <b></b><br>
598         * Type: <b>reference</b><br>
599         * Path: <b>MedicationDispense.receiver</b><br>
600         * </p>
601         */
602        @SearchParamDefinition(name="receiver", path="MedicationDispense.receiver", description="", type="reference"  )
603        public static final String SP_RECEIVER = "receiver";
604
605        /**
606         * <b>Fluent Client</b> search parameter constant for <b>receiver</b>
607         * <p>
608         * Description: <b></b><br>
609         * Type: <b>reference</b><br>
610         * Path: <b>MedicationDispense.receiver</b><br>
611         * </p>
612         */
613        public static final ReferenceClientParam RECEIVER = new ReferenceClientParam(SP_RECEIVER);
614
615
616        /**
617         * Constant for fluent queries to be used to add include statements. Specifies
618         * the path value of "<b>MedicationDispense:destination</b>".
619         */
620        public static final Include INCLUDE_DESTINATION = new Include("MedicationDispense:destination");
621
622        /**
623         * Constant for fluent queries to be used to add include statements. Specifies
624         * the path value of "<b>MedicationDispense:dispenser</b>".
625         */
626        public static final Include INCLUDE_DISPENSER = new Include("MedicationDispense:dispenser");
627
628        /**
629         * Constant for fluent queries to be used to add include statements. Specifies
630         * the path value of "<b>MedicationDispense:medication</b>".
631         */
632        public static final Include INCLUDE_MEDICATION = new Include("MedicationDispense:medication");
633
634        /**
635         * Constant for fluent queries to be used to add include statements. Specifies
636         * the path value of "<b>MedicationDispense:patient</b>".
637         */
638        public static final Include INCLUDE_PATIENT = new Include("MedicationDispense:patient");
639
640        /**
641         * Constant for fluent queries to be used to add include statements. Specifies
642         * the path value of "<b>MedicationDispense:prescription</b>".
643         */
644        public static final Include INCLUDE_PRESCRIPTION = new Include("MedicationDispense:prescription");
645
646        /**
647         * Constant for fluent queries to be used to add include statements. Specifies
648         * the path value of "<b>MedicationDispense:receiver</b>".
649         */
650        public static final Include INCLUDE_RECEIVER = new Include("MedicationDispense:receiver");
651
652        /**
653         * Constant for fluent queries to be used to add include statements. Specifies
654         * the path value of "<b>MedicationDispense:responsibleparty</b>".
655         */
656        public static final Include INCLUDE_RESPONSIBLEPARTY = new Include("MedicationDispense:responsibleparty");
657
658
659        @Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1, summary=false, modifier=false)        
660        @Description(
661                shortDefinition="id",
662                formalDefinition="Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR."
663        )
664        private IdentifierDt myIdentifier;
665        
666        @Child(name="status", type=CodeDt.class, order=1, min=0, max=1, summary=false, modifier=true)   
667        @Description(
668                shortDefinition="status",
669                formalDefinition="A code specifying the state of the set of dispense events."
670        )
671        private BoundCodeDt<MedicationDispenseStatusEnum> myStatus;
672        
673        @Child(name="patient", order=2, min=0, max=1, summary=false, modifier=false, type={
674                ca.uhn.fhir.model.dstu2.resource.Patient.class  })
675        @Description(
676                shortDefinition="who.focus",
677                formalDefinition="A link to a resource representing the person to whom the medication will be given."
678        )
679        private ResourceReferenceDt myPatient;
680        
681        @Child(name="dispenser", order=3, min=0, max=1, summary=false, modifier=false, type={
682                ca.uhn.fhir.model.dstu2.resource.Practitioner.class     })
683        @Description(
684                shortDefinition="who.actor",
685                formalDefinition="The individual responsible for dispensing the medication"
686        )
687        private ResourceReferenceDt myDispenser;
688        
689        @Child(name="authorizingPrescription", order=4, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
690                ca.uhn.fhir.model.dstu2.resource.MedicationOrder.class  })
691        @Description(
692                shortDefinition="",
693                formalDefinition="Indicates the medication order that is being dispensed against."
694        )
695        private java.util.List<ResourceReferenceDt> myAuthorizingPrescription;
696        
697        @Child(name="type", type=CodeableConceptDt.class, order=5, min=0, max=1, summary=false, modifier=false) 
698        @Description(
699                shortDefinition="",
700                formalDefinition="Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc."
701        )
702        private CodeableConceptDt myType;
703        
704        @Child(name="quantity", type=SimpleQuantityDt.class, order=6, min=0, max=1, summary=false, modifier=false)      
705        @Description(
706                shortDefinition="",
707                formalDefinition="The amount of medication that has been dispensed. Includes unit of measure."
708        )
709        private SimpleQuantityDt myQuantity;
710        
711        @Child(name="daysSupply", type=SimpleQuantityDt.class, order=7, min=0, max=1, summary=false, modifier=false)    
712        @Description(
713                shortDefinition="",
714                formalDefinition="The amount of medication expressed as a timing amount."
715        )
716        private SimpleQuantityDt myDaysSupply;
717        
718        @Child(name="medication", order=8, min=1, max=1, summary=false, modifier=false, type={
719                CodeableConceptDt.class,                Medication.class        })
720        @Description(
721                shortDefinition="",
722                formalDefinition="Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications."
723        )
724        private IDatatype myMedication;
725        
726        @Child(name="whenPrepared", type=DateTimeDt.class, order=9, min=0, max=1, summary=false, modifier=false)        
727        @Description(
728                shortDefinition="",
729                formalDefinition="The time when the dispensed product was packaged and reviewed."
730        )
731        private DateTimeDt myWhenPrepared;
732        
733        @Child(name="whenHandedOver", type=DateTimeDt.class, order=10, min=0, max=1, summary=false, modifier=false)     
734        @Description(
735                shortDefinition="",
736                formalDefinition="The time the dispensed product was provided to the patient or their representative."
737        )
738        private DateTimeDt myWhenHandedOver;
739        
740        @Child(name="destination", order=11, min=0, max=1, summary=false, modifier=false, type={
741                ca.uhn.fhir.model.dstu2.resource.Location.class })
742        @Description(
743                shortDefinition="",
744                formalDefinition="Identification of the facility/location where the medication was shipped to, as part of the dispense event."
745        )
746        private ResourceReferenceDt myDestination;
747        
748        @Child(name="receiver", order=12, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
749                ca.uhn.fhir.model.dstu2.resource.Patient.class,                 ca.uhn.fhir.model.dstu2.resource.Practitioner.class     })
750        @Description(
751                shortDefinition="",
752                formalDefinition="Identifies the person who picked up the medication.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional"
753        )
754        private java.util.List<ResourceReferenceDt> myReceiver;
755        
756        @Child(name="note", type=StringDt.class, order=13, min=0, max=1, summary=false, modifier=false) 
757        @Description(
758                shortDefinition="",
759                formalDefinition="Extra information about the dispense that could not be conveyed in the other attributes."
760        )
761        private StringDt myNote;
762        
763        @Child(name="dosageInstruction", order=14, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)       
764        @Description(
765                shortDefinition="",
766                formalDefinition="Indicates how the medication is to be used by the patient"
767        )
768        private java.util.List<DosageInstruction> myDosageInstruction;
769        
770        @Child(name="substitution", order=15, min=0, max=1, summary=false, modifier=false)      
771        @Description(
772                shortDefinition="",
773                formalDefinition="Indicates whether or not substitution was made as part of the dispense.  In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why."
774        )
775        private Substitution mySubstitution;
776        
777
778        @Override
779        public boolean isEmpty() {
780                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myIdentifier,  myStatus,  myPatient,  myDispenser,  myAuthorizingPrescription,  myType,  myQuantity,  myDaysSupply,  myMedication,  myWhenPrepared,  myWhenHandedOver,  myDestination,  myReceiver,  myNote,  myDosageInstruction,  mySubstitution);
781        }
782        
783        @Override
784        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
785                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myStatus, myPatient, myDispenser, myAuthorizingPrescription, myType, myQuantity, myDaysSupply, myMedication, myWhenPrepared, myWhenHandedOver, myDestination, myReceiver, myNote, myDosageInstruction, mySubstitution);
786        }
787
788        /**
789         * Gets the value(s) for <b>identifier</b> (id).
790         * creating it if it does
791         * not exist. Will not return <code>null</code>.
792         *
793     * <p>
794     * <b>Definition:</b>
795     * Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.
796     * </p> 
797         */
798        public IdentifierDt getIdentifier() {  
799                if (myIdentifier == null) {
800                        myIdentifier = new IdentifierDt();
801                }
802                return myIdentifier;
803        }
804
805        /**
806         * Sets the value(s) for <b>identifier</b> (id)
807         *
808     * <p>
809     * <b>Definition:</b>
810     * Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.
811     * </p> 
812         */
813        public MedicationDispense setIdentifier(IdentifierDt theValue) {
814                myIdentifier = theValue;
815                return this;
816        }
817        
818        
819
820  
821        /**
822         * Gets the value(s) for <b>status</b> (status).
823         * creating it if it does
824         * not exist. Will not return <code>null</code>.
825         *
826     * <p>
827     * <b>Definition:</b>
828     * A code specifying the state of the set of dispense events.
829     * </p> 
830         */
831        public BoundCodeDt<MedicationDispenseStatusEnum> getStatusElement() {  
832                if (myStatus == null) {
833                        myStatus = new BoundCodeDt<MedicationDispenseStatusEnum>(MedicationDispenseStatusEnum.VALUESET_BINDER);
834                }
835                return myStatus;
836        }
837
838        
839        /**
840         * Gets the value(s) for <b>status</b> (status).
841         * creating it if it does
842         * not exist. Will not return <code>null</code>.
843         *
844     * <p>
845     * <b>Definition:</b>
846     * A code specifying the state of the set of dispense events.
847     * </p> 
848         */
849        public String getStatus() {  
850                return getStatusElement().getValue();
851        }
852
853        /**
854         * Sets the value(s) for <b>status</b> (status)
855         *
856     * <p>
857     * <b>Definition:</b>
858     * A code specifying the state of the set of dispense events.
859     * </p> 
860         */
861        public MedicationDispense setStatus(BoundCodeDt<MedicationDispenseStatusEnum> theValue) {
862                myStatus = theValue;
863                return this;
864        }
865        
866        
867
868        /**
869         * Sets the value(s) for <b>status</b> (status)
870         *
871     * <p>
872     * <b>Definition:</b>
873     * A code specifying the state of the set of dispense events.
874     * </p> 
875         */
876        public MedicationDispense setStatus(MedicationDispenseStatusEnum theValue) {
877                setStatus(new BoundCodeDt<MedicationDispenseStatusEnum>(MedicationDispenseStatusEnum.VALUESET_BINDER, theValue));
878                
879/*
880                getStatusElement().setValueAsEnum(theValue);
881*/
882                return this;
883        }
884
885  
886        /**
887         * Gets the value(s) for <b>patient</b> (who.focus).
888         * creating it if it does
889         * not exist. Will not return <code>null</code>.
890         *
891     * <p>
892     * <b>Definition:</b>
893     * A link to a resource representing the person to whom the medication will be given.
894     * </p> 
895         */
896        public ResourceReferenceDt getPatient() {  
897                if (myPatient == null) {
898                        myPatient = new ResourceReferenceDt();
899                }
900                return myPatient;
901        }
902
903        /**
904         * Sets the value(s) for <b>patient</b> (who.focus)
905         *
906     * <p>
907     * <b>Definition:</b>
908     * A link to a resource representing the person to whom the medication will be given.
909     * </p> 
910         */
911        public MedicationDispense setPatient(ResourceReferenceDt theValue) {
912                myPatient = theValue;
913                return this;
914        }
915        
916        
917
918  
919        /**
920         * Gets the value(s) for <b>dispenser</b> (who.actor).
921         * creating it if it does
922         * not exist. Will not return <code>null</code>.
923         *
924     * <p>
925     * <b>Definition:</b>
926     * The individual responsible for dispensing the medication
927     * </p> 
928         */
929        public ResourceReferenceDt getDispenser() {  
930                if (myDispenser == null) {
931                        myDispenser = new ResourceReferenceDt();
932                }
933                return myDispenser;
934        }
935
936        /**
937         * Sets the value(s) for <b>dispenser</b> (who.actor)
938         *
939     * <p>
940     * <b>Definition:</b>
941     * The individual responsible for dispensing the medication
942     * </p> 
943         */
944        public MedicationDispense setDispenser(ResourceReferenceDt theValue) {
945                myDispenser = theValue;
946                return this;
947        }
948        
949        
950
951  
952        /**
953         * Gets the value(s) for <b>authorizingPrescription</b> ().
954         * creating it if it does
955         * not exist. Will not return <code>null</code>.
956         *
957     * <p>
958     * <b>Definition:</b>
959     * Indicates the medication order that is being dispensed against.
960     * </p> 
961         */
962        public java.util.List<ResourceReferenceDt> getAuthorizingPrescription() {  
963                if (myAuthorizingPrescription == null) {
964                        myAuthorizingPrescription = new java.util.ArrayList<ResourceReferenceDt>();
965                }
966                return myAuthorizingPrescription;
967        }
968
969        /**
970         * Sets the value(s) for <b>authorizingPrescription</b> ()
971         *
972     * <p>
973     * <b>Definition:</b>
974     * Indicates the medication order that is being dispensed against.
975     * </p> 
976         */
977        public MedicationDispense setAuthorizingPrescription(java.util.List<ResourceReferenceDt> theValue) {
978                myAuthorizingPrescription = theValue;
979                return this;
980        }
981        
982        
983
984        /**
985         * Adds and returns a new value for <b>authorizingPrescription</b> ()
986         *
987     * <p>
988     * <b>Definition:</b>
989     * Indicates the medication order that is being dispensed against.
990     * </p> 
991         */
992        public ResourceReferenceDt addAuthorizingPrescription() {
993                ResourceReferenceDt newType = new ResourceReferenceDt();
994                getAuthorizingPrescription().add(newType);
995                return newType; 
996        }
997  
998        /**
999         * Gets the value(s) for <b>type</b> ().
1000         * creating it if it does
1001         * not exist. Will not return <code>null</code>.
1002         *
1003     * <p>
1004     * <b>Definition:</b>
1005     * Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.
1006     * </p> 
1007         */
1008        public CodeableConceptDt getType() {  
1009                if (myType == null) {
1010                        myType = new CodeableConceptDt();
1011                }
1012                return myType;
1013        }
1014
1015        /**
1016         * Sets the value(s) for <b>type</b> ()
1017         *
1018     * <p>
1019     * <b>Definition:</b>
1020     * Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.
1021     * </p> 
1022         */
1023        public MedicationDispense setType(CodeableConceptDt theValue) {
1024                myType = theValue;
1025                return this;
1026        }
1027        
1028        
1029
1030  
1031        /**
1032         * Gets the value(s) for <b>quantity</b> ().
1033         * creating it if it does
1034         * not exist. Will not return <code>null</code>.
1035         *
1036     * <p>
1037     * <b>Definition:</b>
1038     * The amount of medication that has been dispensed. Includes unit of measure.
1039     * </p> 
1040         */
1041        public SimpleQuantityDt getQuantity() {  
1042                if (myQuantity == null) {
1043                        myQuantity = new SimpleQuantityDt();
1044                }
1045                return myQuantity;
1046        }
1047
1048        /**
1049         * Sets the value(s) for <b>quantity</b> ()
1050         *
1051     * <p>
1052     * <b>Definition:</b>
1053     * The amount of medication that has been dispensed. Includes unit of measure.
1054     * </p> 
1055         */
1056        public MedicationDispense setQuantity(SimpleQuantityDt theValue) {
1057                myQuantity = theValue;
1058                return this;
1059        }
1060        
1061        
1062
1063  
1064        /**
1065         * Gets the value(s) for <b>daysSupply</b> ().
1066         * creating it if it does
1067         * not exist. Will not return <code>null</code>.
1068         *
1069     * <p>
1070     * <b>Definition:</b>
1071     * The amount of medication expressed as a timing amount.
1072     * </p> 
1073         */
1074        public SimpleQuantityDt getDaysSupply() {  
1075                if (myDaysSupply == null) {
1076                        myDaysSupply = new SimpleQuantityDt();
1077                }
1078                return myDaysSupply;
1079        }
1080
1081        /**
1082         * Sets the value(s) for <b>daysSupply</b> ()
1083         *
1084     * <p>
1085     * <b>Definition:</b>
1086     * The amount of medication expressed as a timing amount.
1087     * </p> 
1088         */
1089        public MedicationDispense setDaysSupply(SimpleQuantityDt theValue) {
1090                myDaysSupply = theValue;
1091                return this;
1092        }
1093        
1094        
1095
1096  
1097        /**
1098         * Gets the value(s) for <b>medication[x]</b> ().
1099         * creating it if it does
1100         * not exist. Will not return <code>null</code>.
1101         *
1102     * <p>
1103     * <b>Definition:</b>
1104     * Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.
1105     * </p> 
1106         */
1107        public IDatatype getMedication() {  
1108                return myMedication;
1109        }
1110
1111        /**
1112         * Sets the value(s) for <b>medication[x]</b> ()
1113         *
1114     * <p>
1115     * <b>Definition:</b>
1116     * Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.
1117     * </p> 
1118         */
1119        public MedicationDispense setMedication(IDatatype theValue) {
1120                myMedication = theValue;
1121                return this;
1122        }
1123        
1124        
1125
1126  
1127        /**
1128         * Gets the value(s) for <b>whenPrepared</b> ().
1129         * creating it if it does
1130         * not exist. Will not return <code>null</code>.
1131         *
1132     * <p>
1133     * <b>Definition:</b>
1134     * The time when the dispensed product was packaged and reviewed.
1135     * </p> 
1136         */
1137        public DateTimeDt getWhenPreparedElement() {  
1138                if (myWhenPrepared == null) {
1139                        myWhenPrepared = new DateTimeDt();
1140                }
1141                return myWhenPrepared;
1142        }
1143
1144        
1145        /**
1146         * Gets the value(s) for <b>whenPrepared</b> ().
1147         * creating it if it does
1148         * not exist. Will not return <code>null</code>.
1149         *
1150     * <p>
1151     * <b>Definition:</b>
1152     * The time when the dispensed product was packaged and reviewed.
1153     * </p> 
1154         */
1155        public Date getWhenPrepared() {  
1156                return getWhenPreparedElement().getValue();
1157        }
1158
1159        /**
1160         * Sets the value(s) for <b>whenPrepared</b> ()
1161         *
1162     * <p>
1163     * <b>Definition:</b>
1164     * The time when the dispensed product was packaged and reviewed.
1165     * </p> 
1166         */
1167        public MedicationDispense setWhenPrepared(DateTimeDt theValue) {
1168                myWhenPrepared = theValue;
1169                return this;
1170        }
1171        
1172        
1173
1174        /**
1175         * Sets the value for <b>whenPrepared</b> ()
1176         *
1177     * <p>
1178     * <b>Definition:</b>
1179     * The time when the dispensed product was packaged and reviewed.
1180     * </p> 
1181         */
1182        public MedicationDispense setWhenPrepared( Date theDate,  TemporalPrecisionEnum thePrecision) {
1183                myWhenPrepared = new DateTimeDt(theDate, thePrecision); 
1184                return this; 
1185        }
1186
1187        /**
1188         * Sets the value for <b>whenPrepared</b> ()
1189         *
1190     * <p>
1191     * <b>Definition:</b>
1192     * The time when the dispensed product was packaged and reviewed.
1193     * </p> 
1194         */
1195        public MedicationDispense setWhenPreparedWithSecondsPrecision( Date theDate) {
1196                myWhenPrepared = new DateTimeDt(theDate); 
1197                return this; 
1198        }
1199
1200 
1201        /**
1202         * Gets the value(s) for <b>whenHandedOver</b> ().
1203         * creating it if it does
1204         * not exist. Will not return <code>null</code>.
1205         *
1206     * <p>
1207     * <b>Definition:</b>
1208     * The time the dispensed product was provided to the patient or their representative.
1209     * </p> 
1210         */
1211        public DateTimeDt getWhenHandedOverElement() {  
1212                if (myWhenHandedOver == null) {
1213                        myWhenHandedOver = new DateTimeDt();
1214                }
1215                return myWhenHandedOver;
1216        }
1217
1218        
1219        /**
1220         * Gets the value(s) for <b>whenHandedOver</b> ().
1221         * creating it if it does
1222         * not exist. Will not return <code>null</code>.
1223         *
1224     * <p>
1225     * <b>Definition:</b>
1226     * The time the dispensed product was provided to the patient or their representative.
1227     * </p> 
1228         */
1229        public Date getWhenHandedOver() {  
1230                return getWhenHandedOverElement().getValue();
1231        }
1232
1233        /**
1234         * Sets the value(s) for <b>whenHandedOver</b> ()
1235         *
1236     * <p>
1237     * <b>Definition:</b>
1238     * The time the dispensed product was provided to the patient or their representative.
1239     * </p> 
1240         */
1241        public MedicationDispense setWhenHandedOver(DateTimeDt theValue) {
1242                myWhenHandedOver = theValue;
1243                return this;
1244        }
1245        
1246        
1247
1248        /**
1249         * Sets the value for <b>whenHandedOver</b> ()
1250         *
1251     * <p>
1252     * <b>Definition:</b>
1253     * The time the dispensed product was provided to the patient or their representative.
1254     * </p> 
1255         */
1256        public MedicationDispense setWhenHandedOver( Date theDate,  TemporalPrecisionEnum thePrecision) {
1257                myWhenHandedOver = new DateTimeDt(theDate, thePrecision); 
1258                return this; 
1259        }
1260
1261        /**
1262         * Sets the value for <b>whenHandedOver</b> ()
1263         *
1264     * <p>
1265     * <b>Definition:</b>
1266     * The time the dispensed product was provided to the patient or their representative.
1267     * </p> 
1268         */
1269        public MedicationDispense setWhenHandedOverWithSecondsPrecision( Date theDate) {
1270                myWhenHandedOver = new DateTimeDt(theDate); 
1271                return this; 
1272        }
1273
1274 
1275        /**
1276         * Gets the value(s) for <b>destination</b> ().
1277         * creating it if it does
1278         * not exist. Will not return <code>null</code>.
1279         *
1280     * <p>
1281     * <b>Definition:</b>
1282     * Identification of the facility/location where the medication was shipped to, as part of the dispense event.
1283     * </p> 
1284         */
1285        public ResourceReferenceDt getDestination() {  
1286                if (myDestination == null) {
1287                        myDestination = new ResourceReferenceDt();
1288                }
1289                return myDestination;
1290        }
1291
1292        /**
1293         * Sets the value(s) for <b>destination</b> ()
1294         *
1295     * <p>
1296     * <b>Definition:</b>
1297     * Identification of the facility/location where the medication was shipped to, as part of the dispense event.
1298     * </p> 
1299         */
1300        public MedicationDispense setDestination(ResourceReferenceDt theValue) {
1301                myDestination = theValue;
1302                return this;
1303        }
1304        
1305        
1306
1307  
1308        /**
1309         * Gets the value(s) for <b>receiver</b> ().
1310         * creating it if it does
1311         * not exist. Will not return <code>null</code>.
1312         *
1313     * <p>
1314     * <b>Definition:</b>
1315     * Identifies the person who picked up the medication.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional
1316     * </p> 
1317         */
1318        public java.util.List<ResourceReferenceDt> getReceiver() {  
1319                if (myReceiver == null) {
1320                        myReceiver = new java.util.ArrayList<ResourceReferenceDt>();
1321                }
1322                return myReceiver;
1323        }
1324
1325        /**
1326         * Sets the value(s) for <b>receiver</b> ()
1327         *
1328     * <p>
1329     * <b>Definition:</b>
1330     * Identifies the person who picked up the medication.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional
1331     * </p> 
1332         */
1333        public MedicationDispense setReceiver(java.util.List<ResourceReferenceDt> theValue) {
1334                myReceiver = theValue;
1335                return this;
1336        }
1337        
1338        
1339
1340        /**
1341         * Adds and returns a new value for <b>receiver</b> ()
1342         *
1343     * <p>
1344     * <b>Definition:</b>
1345     * Identifies the person who picked up the medication.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional
1346     * </p> 
1347         */
1348        public ResourceReferenceDt addReceiver() {
1349                ResourceReferenceDt newType = new ResourceReferenceDt();
1350                getReceiver().add(newType);
1351                return newType; 
1352        }
1353  
1354        /**
1355         * Gets the value(s) for <b>note</b> ().
1356         * creating it if it does
1357         * not exist. Will not return <code>null</code>.
1358         *
1359     * <p>
1360     * <b>Definition:</b>
1361     * Extra information about the dispense that could not be conveyed in the other attributes.
1362     * </p> 
1363         */
1364        public StringDt getNoteElement() {  
1365                if (myNote == null) {
1366                        myNote = new StringDt();
1367                }
1368                return myNote;
1369        }
1370
1371        
1372        /**
1373         * Gets the value(s) for <b>note</b> ().
1374         * creating it if it does
1375         * not exist. Will not return <code>null</code>.
1376         *
1377     * <p>
1378     * <b>Definition:</b>
1379     * Extra information about the dispense that could not be conveyed in the other attributes.
1380     * </p> 
1381         */
1382        public String getNote() {  
1383                return getNoteElement().getValue();
1384        }
1385
1386        /**
1387         * Sets the value(s) for <b>note</b> ()
1388         *
1389     * <p>
1390     * <b>Definition:</b>
1391     * Extra information about the dispense that could not be conveyed in the other attributes.
1392     * </p> 
1393         */
1394        public MedicationDispense setNote(StringDt theValue) {
1395                myNote = theValue;
1396                return this;
1397        }
1398        
1399        
1400
1401        /**
1402         * Sets the value for <b>note</b> ()
1403         *
1404     * <p>
1405     * <b>Definition:</b>
1406     * Extra information about the dispense that could not be conveyed in the other attributes.
1407     * </p> 
1408         */
1409        public MedicationDispense setNote( String theString) {
1410                myNote = new StringDt(theString); 
1411                return this; 
1412        }
1413
1414 
1415        /**
1416         * Gets the value(s) for <b>dosageInstruction</b> ().
1417         * creating it if it does
1418         * not exist. Will not return <code>null</code>.
1419         *
1420     * <p>
1421     * <b>Definition:</b>
1422     * Indicates how the medication is to be used by the patient
1423     * </p> 
1424         */
1425        public java.util.List<DosageInstruction> getDosageInstruction() {  
1426                if (myDosageInstruction == null) {
1427                        myDosageInstruction = new java.util.ArrayList<DosageInstruction>();
1428                }
1429                return myDosageInstruction;
1430        }
1431
1432        /**
1433         * Sets the value(s) for <b>dosageInstruction</b> ()
1434         *
1435     * <p>
1436     * <b>Definition:</b>
1437     * Indicates how the medication is to be used by the patient
1438     * </p> 
1439         */
1440        public MedicationDispense setDosageInstruction(java.util.List<DosageInstruction> theValue) {
1441                myDosageInstruction = theValue;
1442                return this;
1443        }
1444        
1445        
1446
1447        /**
1448         * Adds and returns a new value for <b>dosageInstruction</b> ()
1449         *
1450     * <p>
1451     * <b>Definition:</b>
1452     * Indicates how the medication is to be used by the patient
1453     * </p> 
1454         */
1455        public DosageInstruction addDosageInstruction() {
1456                DosageInstruction newType = new DosageInstruction();
1457                getDosageInstruction().add(newType);
1458                return newType; 
1459        }
1460
1461        /**
1462         * Adds a given new value for <b>dosageInstruction</b> ()
1463         *
1464         * <p>
1465         * <b>Definition:</b>
1466         * Indicates how the medication is to be used by the patient
1467         * </p>
1468         * @param theValue The dosageInstruction to add (must not be <code>null</code>)
1469         */
1470        public MedicationDispense addDosageInstruction(DosageInstruction theValue) {
1471                if (theValue == null) {
1472                        throw new NullPointerException("theValue must not be null");
1473                }
1474                getDosageInstruction().add(theValue);
1475                return this;
1476        }
1477
1478        /**
1479         * Gets the first repetition for <b>dosageInstruction</b> (),
1480         * creating it if it does not already exist.
1481         *
1482     * <p>
1483     * <b>Definition:</b>
1484     * Indicates how the medication is to be used by the patient
1485     * </p> 
1486         */
1487        public DosageInstruction getDosageInstructionFirstRep() {
1488                if (getDosageInstruction().isEmpty()) {
1489                        return addDosageInstruction();
1490                }
1491                return getDosageInstruction().get(0); 
1492        }
1493  
1494        /**
1495         * Gets the value(s) for <b>substitution</b> ().
1496         * creating it if it does
1497         * not exist. Will not return <code>null</code>.
1498         *
1499     * <p>
1500     * <b>Definition:</b>
1501     * Indicates whether or not substitution was made as part of the dispense.  In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.
1502     * </p> 
1503         */
1504        public Substitution getSubstitution() {  
1505                if (mySubstitution == null) {
1506                        mySubstitution = new Substitution();
1507                }
1508                return mySubstitution;
1509        }
1510
1511        /**
1512         * Sets the value(s) for <b>substitution</b> ()
1513         *
1514     * <p>
1515     * <b>Definition:</b>
1516     * Indicates whether or not substitution was made as part of the dispense.  In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.
1517     * </p> 
1518         */
1519        public MedicationDispense setSubstitution(Substitution theValue) {
1520                mySubstitution = theValue;
1521                return this;
1522        }
1523        
1524        
1525
1526  
1527        /**
1528         * Block class for child element: <b>MedicationDispense.dosageInstruction</b> ()
1529         *
1530     * <p>
1531     * <b>Definition:</b>
1532     * Indicates how the medication is to be used by the patient
1533     * </p> 
1534         */
1535        @Block()        
1536        public static class DosageInstruction 
1537            extends  BaseIdentifiableElement        implements IResourceBlock {
1538        
1539        @Child(name="text", type=StringDt.class, order=0, min=0, max=1, summary=false, modifier=false)  
1540        @Description(
1541                shortDefinition="",
1542                formalDefinition="Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication."
1543        )
1544        private StringDt myText;
1545        
1546        @Child(name="additionalInstructions", type=CodeableConceptDt.class, order=1, min=0, max=1, summary=false, modifier=false)       
1547        @Description(
1548                shortDefinition="",
1549                formalDefinition="Additional instructions such as \"Swallow with plenty of water\" which may or may not be coded."
1550        )
1551        private CodeableConceptDt myAdditionalInstructions;
1552        
1553        @Child(name="timing", type=TimingDt.class, order=2, min=0, max=1, summary=false, modifier=false)        
1554        @Description(
1555                shortDefinition="",
1556                formalDefinition="The timing schedule for giving the medication to the patient.  The Schedule data type allows many different expressions.  For example, \"Every  8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\";  \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\""
1557        )
1558        private TimingDt myTiming;
1559        
1560        @Child(name="asNeeded", order=3, min=0, max=1, summary=false, modifier=false, type={
1561                BooleanDt.class,                CodeableConceptDt.class })
1562        @Description(
1563                shortDefinition="",
1564                formalDefinition="Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).  Specifically if 'boolean' datatype is selected, then the following logic applies:  If set to True, this indicates that the medication is only taken when needed, within the specified schedule."
1565        )
1566        private IDatatype myAsNeeded;
1567        
1568        @Child(name="site", order=4, min=0, max=1, summary=false, modifier=false, type={
1569                CodeableConceptDt.class,                BodySite.class  })
1570        @Description(
1571                shortDefinition="",
1572                formalDefinition="A coded specification of the anatomic site where the medication first enters the body"
1573        )
1574        private IDatatype mySite;
1575        
1576        @Child(name="route", type=CodeableConceptDt.class, order=5, min=0, max=1, summary=false, modifier=false)        
1577        @Description(
1578                shortDefinition="",
1579                formalDefinition="A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject."
1580        )
1581        private CodeableConceptDt myRoute;
1582        
1583        @Child(name="method", type=CodeableConceptDt.class, order=6, min=0, max=1, summary=false, modifier=false)       
1584        @Description(
1585                shortDefinition="",
1586                formalDefinition="A coded value indicating the method by which the medication is intended to be or was introduced into or on the body."
1587        )
1588        private CodeableConceptDt myMethod;
1589        
1590        @Child(name="dose", order=7, min=0, max=1, summary=false, modifier=false, type={
1591                RangeDt.class,          SimpleQuantityDt.class  })
1592        @Description(
1593                shortDefinition="",
1594                formalDefinition="The amount of therapeutic or other substance given at one administration event."
1595        )
1596        private IDatatype myDose;
1597        
1598        @Child(name="rate", order=8, min=0, max=1, summary=false, modifier=false, type={
1599                RatioDt.class,          RangeDt.class   })
1600        @Description(
1601                shortDefinition="",
1602                formalDefinition="Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours.   Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours"
1603        )
1604        private IDatatype myRate;
1605        
1606        @Child(name="maxDosePerPeriod", type=RatioDt.class, order=9, min=0, max=1, summary=false, modifier=false)       
1607        @Description(
1608                shortDefinition="",
1609                formalDefinition="The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time,  e.g. 1000mg in 24 hours."
1610        )
1611        private RatioDt myMaxDosePerPeriod;
1612        
1613
1614        @Override
1615        public boolean isEmpty() {
1616                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myText,  myAdditionalInstructions,  myTiming,  myAsNeeded,  mySite,  myRoute,  myMethod,  myDose,  myRate,  myMaxDosePerPeriod);
1617        }
1618        
1619        @Override
1620        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
1621                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myText, myAdditionalInstructions, myTiming, myAsNeeded, mySite, myRoute, myMethod, myDose, myRate, myMaxDosePerPeriod);
1622        }
1623
1624        /**
1625         * Gets the value(s) for <b>text</b> ().
1626         * creating it if it does
1627         * not exist. Will not return <code>null</code>.
1628         *
1629     * <p>
1630     * <b>Definition:</b>
1631     * Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.
1632     * </p> 
1633         */
1634        public StringDt getTextElement() {  
1635                if (myText == null) {
1636                        myText = new StringDt();
1637                }
1638                return myText;
1639        }
1640
1641        
1642        /**
1643         * Gets the value(s) for <b>text</b> ().
1644         * creating it if it does
1645         * not exist. Will not return <code>null</code>.
1646         *
1647     * <p>
1648     * <b>Definition:</b>
1649     * Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.
1650     * </p> 
1651         */
1652        public String getText() {  
1653                return getTextElement().getValue();
1654        }
1655
1656        /**
1657         * Sets the value(s) for <b>text</b> ()
1658         *
1659     * <p>
1660     * <b>Definition:</b>
1661     * Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.
1662     * </p> 
1663         */
1664        public DosageInstruction setText(StringDt theValue) {
1665                myText = theValue;
1666                return this;
1667        }
1668        
1669        
1670
1671        /**
1672         * Sets the value for <b>text</b> ()
1673         *
1674     * <p>
1675     * <b>Definition:</b>
1676     * Free text dosage instructions can be used for cases where the instructions are too complex to code. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication.
1677     * </p> 
1678         */
1679        public DosageInstruction setText( String theString) {
1680                myText = new StringDt(theString); 
1681                return this; 
1682        }
1683
1684 
1685        /**
1686         * Gets the value(s) for <b>additionalInstructions</b> ().
1687         * creating it if it does
1688         * not exist. Will not return <code>null</code>.
1689         *
1690     * <p>
1691     * <b>Definition:</b>
1692     * Additional instructions such as \&quot;Swallow with plenty of water\&quot; which may or may not be coded.
1693     * </p> 
1694         */
1695        public CodeableConceptDt getAdditionalInstructions() {  
1696                if (myAdditionalInstructions == null) {
1697                        myAdditionalInstructions = new CodeableConceptDt();
1698                }
1699                return myAdditionalInstructions;
1700        }
1701
1702        /**
1703         * Sets the value(s) for <b>additionalInstructions</b> ()
1704         *
1705     * <p>
1706     * <b>Definition:</b>
1707     * Additional instructions such as \&quot;Swallow with plenty of water\&quot; which may or may not be coded.
1708     * </p> 
1709         */
1710        public DosageInstruction setAdditionalInstructions(CodeableConceptDt theValue) {
1711                myAdditionalInstructions = theValue;
1712                return this;
1713        }
1714        
1715        
1716
1717  
1718        /**
1719         * Gets the value(s) for <b>timing</b> ().
1720         * creating it if it does
1721         * not exist. Will not return <code>null</code>.
1722         *
1723     * <p>
1724     * <b>Definition:</b>
1725     * The timing schedule for giving the medication to the patient.  The Schedule data type allows many different expressions.  For example, \&quot;Every  8 hours\&quot;; \&quot;Three times a day\&quot;; \&quot;1/2 an hour before breakfast for 10 days from 23-Dec 2011:\&quot;;  \&quot;15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\&quot;
1726     * </p> 
1727         */
1728        public TimingDt getTiming() {  
1729                if (myTiming == null) {
1730                        myTiming = new TimingDt();
1731                }
1732                return myTiming;
1733        }
1734
1735        /**
1736         * Sets the value(s) for <b>timing</b> ()
1737         *
1738     * <p>
1739     * <b>Definition:</b>
1740     * The timing schedule for giving the medication to the patient.  The Schedule data type allows many different expressions.  For example, \&quot;Every  8 hours\&quot;; \&quot;Three times a day\&quot;; \&quot;1/2 an hour before breakfast for 10 days from 23-Dec 2011:\&quot;;  \&quot;15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\&quot;
1741     * </p> 
1742         */
1743        public DosageInstruction setTiming(TimingDt theValue) {
1744                myTiming = theValue;
1745                return this;
1746        }
1747        
1748        
1749
1750  
1751        /**
1752         * Gets the value(s) for <b>asNeeded[x]</b> ().
1753         * creating it if it does
1754         * not exist. Will not return <code>null</code>.
1755         *
1756     * <p>
1757     * <b>Definition:</b>
1758     * Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).  Specifically if 'boolean' datatype is selected, then the following logic applies:  If set to True, this indicates that the medication is only taken when needed, within the specified schedule.
1759     * </p> 
1760         */
1761        public IDatatype getAsNeeded() {  
1762                return myAsNeeded;
1763        }
1764
1765        /**
1766         * Sets the value(s) for <b>asNeeded[x]</b> ()
1767         *
1768     * <p>
1769     * <b>Definition:</b>
1770     * Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).  Specifically if 'boolean' datatype is selected, then the following logic applies:  If set to True, this indicates that the medication is only taken when needed, within the specified schedule.
1771     * </p> 
1772         */
1773        public DosageInstruction setAsNeeded(IDatatype theValue) {
1774                myAsNeeded = theValue;
1775                return this;
1776        }
1777        
1778        
1779
1780  
1781        /**
1782         * Gets the value(s) for <b>site[x]</b> ().
1783         * creating it if it does
1784         * not exist. Will not return <code>null</code>.
1785         *
1786     * <p>
1787     * <b>Definition:</b>
1788     * A coded specification of the anatomic site where the medication first enters the body
1789     * </p> 
1790         */
1791        public IDatatype getSite() {  
1792                return mySite;
1793        }
1794
1795        /**
1796         * Sets the value(s) for <b>site[x]</b> ()
1797         *
1798     * <p>
1799     * <b>Definition:</b>
1800     * A coded specification of the anatomic site where the medication first enters the body
1801     * </p> 
1802         */
1803        public DosageInstruction setSite(IDatatype theValue) {
1804                mySite = theValue;
1805                return this;
1806        }
1807        
1808        
1809
1810  
1811        /**
1812         * Gets the value(s) for <b>route</b> ().
1813         * creating it if it does
1814         * not exist. Will not return <code>null</code>.
1815         *
1816     * <p>
1817     * <b>Definition:</b>
1818     * A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.
1819     * </p> 
1820         */
1821        public CodeableConceptDt getRoute() {  
1822                if (myRoute == null) {
1823                        myRoute = new CodeableConceptDt();
1824                }
1825                return myRoute;
1826        }
1827
1828        /**
1829         * Sets the value(s) for <b>route</b> ()
1830         *
1831     * <p>
1832     * <b>Definition:</b>
1833     * A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.
1834     * </p> 
1835         */
1836        public DosageInstruction setRoute(CodeableConceptDt theValue) {
1837                myRoute = theValue;
1838                return this;
1839        }
1840        
1841        
1842
1843  
1844        /**
1845         * Gets the value(s) for <b>method</b> ().
1846         * creating it if it does
1847         * not exist. Will not return <code>null</code>.
1848         *
1849     * <p>
1850     * <b>Definition:</b>
1851     * A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.
1852     * </p> 
1853         */
1854        public CodeableConceptDt getMethod() {  
1855                if (myMethod == null) {
1856                        myMethod = new CodeableConceptDt();
1857                }
1858                return myMethod;
1859        }
1860
1861        /**
1862         * Sets the value(s) for <b>method</b> ()
1863         *
1864     * <p>
1865     * <b>Definition:</b>
1866     * A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.
1867     * </p> 
1868         */
1869        public DosageInstruction setMethod(CodeableConceptDt theValue) {
1870                myMethod = theValue;
1871                return this;
1872        }
1873        
1874        
1875
1876  
1877        /**
1878         * Gets the value(s) for <b>dose[x]</b> ().
1879         * creating it if it does
1880         * not exist. Will not return <code>null</code>.
1881         *
1882     * <p>
1883     * <b>Definition:</b>
1884     * The amount of therapeutic or other substance given at one administration event.
1885     * </p> 
1886         */
1887        public IDatatype getDose() {  
1888                return myDose;
1889        }
1890
1891        /**
1892         * Sets the value(s) for <b>dose[x]</b> ()
1893         *
1894     * <p>
1895     * <b>Definition:</b>
1896     * The amount of therapeutic or other substance given at one administration event.
1897     * </p> 
1898         */
1899        public DosageInstruction setDose(IDatatype theValue) {
1900                myDose = theValue;
1901                return this;
1902        }
1903        
1904        
1905
1906  
1907        /**
1908         * Gets the value(s) for <b>rate[x]</b> ().
1909         * creating it if it does
1910         * not exist. Will not return <code>null</code>.
1911         *
1912     * <p>
1913     * <b>Definition:</b>
1914     * Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours.   Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours
1915     * </p> 
1916         */
1917        public IDatatype getRate() {  
1918                return myRate;
1919        }
1920
1921        /**
1922         * Sets the value(s) for <b>rate[x]</b> ()
1923         *
1924     * <p>
1925     * <b>Definition:</b>
1926     * Identifies the speed with which the medication was or will be introduced into the patient. Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours.   Currently we do not specify a default of '1' in the denominator, but this is being discussed. Other examples: 200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours
1927     * </p> 
1928         */
1929        public DosageInstruction setRate(IDatatype theValue) {
1930                myRate = theValue;
1931                return this;
1932        }
1933        
1934        
1935
1936  
1937        /**
1938         * Gets the value(s) for <b>maxDosePerPeriod</b> ().
1939         * creating it if it does
1940         * not exist. Will not return <code>null</code>.
1941         *
1942     * <p>
1943     * <b>Definition:</b>
1944     * The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time,  e.g. 1000mg in 24 hours.
1945     * </p> 
1946         */
1947        public RatioDt getMaxDosePerPeriod() {  
1948                if (myMaxDosePerPeriod == null) {
1949                        myMaxDosePerPeriod = new RatioDt();
1950                }
1951                return myMaxDosePerPeriod;
1952        }
1953
1954        /**
1955         * Sets the value(s) for <b>maxDosePerPeriod</b> ()
1956         *
1957     * <p>
1958     * <b>Definition:</b>
1959     * The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time,  e.g. 1000mg in 24 hours.
1960     * </p> 
1961         */
1962        public DosageInstruction setMaxDosePerPeriod(RatioDt theValue) {
1963                myMaxDosePerPeriod = theValue;
1964                return this;
1965        }
1966        
1967        
1968
1969  
1970
1971
1972        }
1973
1974
1975        /**
1976         * Block class for child element: <b>MedicationDispense.substitution</b> ()
1977         *
1978     * <p>
1979     * <b>Definition:</b>
1980     * Indicates whether or not substitution was made as part of the dispense.  In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.
1981     * </p> 
1982         */
1983        @Block()        
1984        public static class Substitution 
1985            extends  BaseIdentifiableElement        implements IResourceBlock {
1986        
1987        @Child(name="type", type=CodeableConceptDt.class, order=0, min=1, max=1, summary=false, modifier=false) 
1988        @Description(
1989                shortDefinition="",
1990                formalDefinition="A code signifying whether a different drug was dispensed from what was prescribed."
1991        )
1992        private CodeableConceptDt myType;
1993        
1994        @Child(name="reason", type=CodeableConceptDt.class, order=1, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)     
1995        @Description(
1996                shortDefinition="",
1997                formalDefinition="Indicates the reason for the substitution of (or lack of substitution) from what was prescribed."
1998        )
1999        private java.util.List<CodeableConceptDt> myReason;
2000        
2001        @Child(name="responsibleParty", order=2, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
2002                ca.uhn.fhir.model.dstu2.resource.Practitioner.class     })
2003        @Description(
2004                shortDefinition="",
2005                formalDefinition="The person or organization that has primary responsibility for the substitution"
2006        )
2007        private java.util.List<ResourceReferenceDt> myResponsibleParty;
2008        
2009
2010        @Override
2011        public boolean isEmpty() {
2012                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myType,  myReason,  myResponsibleParty);
2013        }
2014        
2015        @Override
2016        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
2017                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myType, myReason, myResponsibleParty);
2018        }
2019
2020        /**
2021         * Gets the value(s) for <b>type</b> ().
2022         * creating it if it does
2023         * not exist. Will not return <code>null</code>.
2024         *
2025     * <p>
2026     * <b>Definition:</b>
2027     * A code signifying whether a different drug was dispensed from what was prescribed.
2028     * </p> 
2029         */
2030        public CodeableConceptDt getType() {  
2031                if (myType == null) {
2032                        myType = new CodeableConceptDt();
2033                }
2034                return myType;
2035        }
2036
2037        /**
2038         * Sets the value(s) for <b>type</b> ()
2039         *
2040     * <p>
2041     * <b>Definition:</b>
2042     * A code signifying whether a different drug was dispensed from what was prescribed.
2043     * </p> 
2044         */
2045        public Substitution setType(CodeableConceptDt theValue) {
2046                myType = theValue;
2047                return this;
2048        }
2049        
2050        
2051
2052  
2053        /**
2054         * Gets the value(s) for <b>reason</b> ().
2055         * creating it if it does
2056         * not exist. Will not return <code>null</code>.
2057         *
2058     * <p>
2059     * <b>Definition:</b>
2060     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2061     * </p> 
2062         */
2063        public java.util.List<CodeableConceptDt> getReason() {  
2064                if (myReason == null) {
2065                        myReason = new java.util.ArrayList<CodeableConceptDt>();
2066                }
2067                return myReason;
2068        }
2069
2070        /**
2071         * Sets the value(s) for <b>reason</b> ()
2072         *
2073     * <p>
2074     * <b>Definition:</b>
2075     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2076     * </p> 
2077         */
2078        public Substitution setReason(java.util.List<CodeableConceptDt> theValue) {
2079                myReason = theValue;
2080                return this;
2081        }
2082        
2083        
2084
2085        /**
2086         * Adds and returns a new value for <b>reason</b> ()
2087         *
2088     * <p>
2089     * <b>Definition:</b>
2090     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2091     * </p> 
2092         */
2093        public CodeableConceptDt addReason() {
2094                CodeableConceptDt newType = new CodeableConceptDt();
2095                getReason().add(newType);
2096                return newType; 
2097        }
2098
2099        /**
2100         * Adds a given new value for <b>reason</b> ()
2101         *
2102         * <p>
2103         * <b>Definition:</b>
2104         * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2105         * </p>
2106         * @param theValue The reason to add (must not be <code>null</code>)
2107         */
2108        public Substitution addReason(CodeableConceptDt theValue) {
2109                if (theValue == null) {
2110                        throw new NullPointerException("theValue must not be null");
2111                }
2112                getReason().add(theValue);
2113                return this;
2114        }
2115
2116        /**
2117         * Gets the first repetition for <b>reason</b> (),
2118         * creating it if it does not already exist.
2119         *
2120     * <p>
2121     * <b>Definition:</b>
2122     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2123     * </p> 
2124         */
2125        public CodeableConceptDt getReasonFirstRep() {
2126                if (getReason().isEmpty()) {
2127                        return addReason();
2128                }
2129                return getReason().get(0); 
2130        }
2131  
2132        /**
2133         * Gets the value(s) for <b>responsibleParty</b> ().
2134         * creating it if it does
2135         * not exist. Will not return <code>null</code>.
2136         *
2137     * <p>
2138     * <b>Definition:</b>
2139     * The person or organization that has primary responsibility for the substitution
2140     * </p> 
2141         */
2142        public java.util.List<ResourceReferenceDt> getResponsibleParty() {  
2143                if (myResponsibleParty == null) {
2144                        myResponsibleParty = new java.util.ArrayList<ResourceReferenceDt>();
2145                }
2146                return myResponsibleParty;
2147        }
2148
2149        /**
2150         * Sets the value(s) for <b>responsibleParty</b> ()
2151         *
2152     * <p>
2153     * <b>Definition:</b>
2154     * The person or organization that has primary responsibility for the substitution
2155     * </p> 
2156         */
2157        public Substitution setResponsibleParty(java.util.List<ResourceReferenceDt> theValue) {
2158                myResponsibleParty = theValue;
2159                return this;
2160        }
2161        
2162        
2163
2164        /**
2165         * Adds and returns a new value for <b>responsibleParty</b> ()
2166         *
2167     * <p>
2168     * <b>Definition:</b>
2169     * The person or organization that has primary responsibility for the substitution
2170     * </p> 
2171         */
2172        public ResourceReferenceDt addResponsibleParty() {
2173                ResourceReferenceDt newType = new ResourceReferenceDt();
2174                getResponsibleParty().add(newType);
2175                return newType; 
2176        }
2177  
2178
2179
2180        }
2181
2182
2183
2184
2185    @Override
2186    public String getResourceName() {
2187        return "MedicationDispense";
2188    }
2189    
2190    public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() {
2191        return ca.uhn.fhir.context.FhirVersionEnum.DSTU2;
2192    }
2193
2194
2195}