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