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         * Search parameter constant for <b>destination</b>
306         * <p>
307         * Description: <b>Return dispenses that should be sent to a specific destination</b><br>
308         * Type: <b>reference</b><br>
309         * Path: <b>MedicationDispense.destination</b><br>
310         * </p>
311         */
312        @SearchParamDefinition(name="destination", path="MedicationDispense.destination", description="Return dispenses that should be sent to a specific destination", type="reference"  )
313        public static final String SP_DESTINATION = "destination";
314
315        /**
316         * <b>Fluent Client</b> search parameter constant for <b>destination</b>
317         * <p>
318         * Description: <b>Return dispenses that should be sent to a specific destination</b><br>
319         * Type: <b>reference</b><br>
320         * Path: <b>MedicationDispense.destination</b><br>
321         * </p>
322         */
323        public static final ReferenceClientParam DESTINATION = new ReferenceClientParam(SP_DESTINATION);
324
325        /**
326         * Search parameter constant for <b>dispenser</b>
327         * <p>
328         * Description: <b>Return all dispenses performed by a specific individual</b><br>
329         * Type: <b>reference</b><br>
330         * Path: <b>MedicationDispense.dispenser</b><br>
331         * </p>
332         */
333        @SearchParamDefinition(name="dispenser", path="MedicationDispense.dispenser", description="Return all dispenses performed by a specific individual", type="reference" , providesMembershipIn={
334 @Compartment(name="Encounter")         }
335 )
336        public static final String SP_DISPENSER = "dispenser";
337
338        /**
339         * <b>Fluent Client</b> search parameter constant for <b>dispenser</b>
340         * <p>
341         * Description: <b>Return all dispenses performed by a specific individual</b><br>
342         * Type: <b>reference</b><br>
343         * Path: <b>MedicationDispense.dispenser</b><br>
344         * </p>
345         */
346        public static final ReferenceClientParam DISPENSER = new ReferenceClientParam(SP_DISPENSER);
347
348        /**
349         * Search parameter constant for <b>identifier</b>
350         * <p>
351         * Description: <b>Return dispenses with this external identifier</b><br>
352         * Type: <b>token</b><br>
353         * Path: <b>MedicationDispense.identifier</b><br>
354         * </p>
355         */
356        @SearchParamDefinition(name="identifier", path="MedicationDispense.identifier", description="Return dispenses with this external identifier", type="token"  )
357        public static final String SP_IDENTIFIER = "identifier";
358
359        /**
360         * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
361         * <p>
362         * Description: <b>Return dispenses with this external identifier</b><br>
363         * Type: <b>token</b><br>
364         * Path: <b>MedicationDispense.identifier</b><br>
365         * </p>
366         */
367        public static final TokenClientParam IDENTIFIER = new TokenClientParam(SP_IDENTIFIER);
368
369        /**
370         * Search parameter constant for <b>medication</b>
371         * <p>
372         * Description: <b>Return dispenses of this medicine resource</b><br>
373         * Type: <b>reference</b><br>
374         * Path: <b>MedicationDispense.medicationReference</b><br>
375         * </p>
376         */
377        @SearchParamDefinition(name="medication", path="MedicationDispense.medicationReference", description="Return dispenses of this medicine resource", type="reference"  )
378        public static final String SP_MEDICATION = "medication";
379
380        /**
381         * <b>Fluent Client</b> search parameter constant for <b>medication</b>
382         * <p>
383         * Description: <b>Return dispenses of this medicine resource</b><br>
384         * Type: <b>reference</b><br>
385         * Path: <b>MedicationDispense.medicationReference</b><br>
386         * </p>
387         */
388        public static final ReferenceClientParam MEDICATION = new ReferenceClientParam(SP_MEDICATION);
389
390        /**
391         * Search parameter constant for <b>code</b>
392         * <p>
393         * Description: <b>Return dispenses of this medicine code</b><br>
394         * Type: <b>token</b><br>
395         * Path: <b>MedicationDispense.medicationCodeableConcept</b><br>
396         * </p>
397         */
398        @SearchParamDefinition(name="code", path="MedicationDispense.medicationCodeableConcept", description="Return dispenses of this medicine code", type="token"  )
399        public static final String SP_CODE = "code";
400
401        /**
402         * <b>Fluent Client</b> search parameter constant for <b>code</b>
403         * <p>
404         * Description: <b>Return dispenses of this medicine code</b><br>
405         * Type: <b>token</b><br>
406         * Path: <b>MedicationDispense.medicationCodeableConcept</b><br>
407         * </p>
408         */
409        public static final TokenClientParam CODE = new TokenClientParam(SP_CODE);
410
411        /**
412         * Search parameter constant for <b>patient</b>
413         * <p>
414         * Description: <b>The identity of a patient to list dispenses  for</b><br>
415         * Type: <b>reference</b><br>
416         * Path: <b>MedicationDispense.patient</b><br>
417         * </p>
418         */
419        @SearchParamDefinition(name="patient", path="MedicationDispense.patient", description="The identity of a patient to list dispenses  for", type="reference" , providesMembershipIn={
420 @Compartment(name="Patient")   }
421 )
422        public static final String SP_PATIENT = "patient";
423
424        /**
425         * <b>Fluent Client</b> search parameter constant for <b>patient</b>
426         * <p>
427         * Description: <b>The identity of a patient to list dispenses  for</b><br>
428         * Type: <b>reference</b><br>
429         * Path: <b>MedicationDispense.patient</b><br>
430         * </p>
431         */
432        public static final ReferenceClientParam PATIENT = new ReferenceClientParam(SP_PATIENT);
433
434        /**
435         * Search parameter constant for <b>prescription</b>
436         * <p>
437         * Description: <b>The identity of a prescription to list dispenses from</b><br>
438         * Type: <b>reference</b><br>
439         * Path: <b>MedicationDispense.authorizingPrescription</b><br>
440         * </p>
441         */
442        @SearchParamDefinition(name="prescription", path="MedicationDispense.authorizingPrescription", description="The identity of a prescription to list dispenses from", type="reference"  )
443        public static final String SP_PRESCRIPTION = "prescription";
444
445        /**
446         * <b>Fluent Client</b> search parameter constant for <b>prescription</b>
447         * <p>
448         * Description: <b>The identity of a prescription to list dispenses from</b><br>
449         * Type: <b>reference</b><br>
450         * Path: <b>MedicationDispense.authorizingPrescription</b><br>
451         * </p>
452         */
453        public static final ReferenceClientParam PRESCRIPTION = new ReferenceClientParam(SP_PRESCRIPTION);
454
455        /**
456         * Search parameter constant for <b>responsibleparty</b>
457         * <p>
458         * Description: <b>Return all dispenses with the specified responsible party</b><br>
459         * Type: <b>reference</b><br>
460         * Path: <b>MedicationDispense.substitution.responsibleParty</b><br>
461         * </p>
462         */
463        @SearchParamDefinition(name="responsibleparty", path="MedicationDispense.substitution.responsibleParty", description="Return all dispenses with the specified responsible party", type="reference" , providesMembershipIn={
464 @Compartment(name="Encounter")         }
465 )
466        public static final String SP_RESPONSIBLEPARTY = "responsibleparty";
467
468        /**
469         * <b>Fluent Client</b> search parameter constant for <b>responsibleparty</b>
470         * <p>
471         * Description: <b>Return all dispenses with the specified responsible party</b><br>
472         * Type: <b>reference</b><br>
473         * Path: <b>MedicationDispense.substitution.responsibleParty</b><br>
474         * </p>
475         */
476        public static final ReferenceClientParam RESPONSIBLEPARTY = new ReferenceClientParam(SP_RESPONSIBLEPARTY);
477
478        /**
479         * Search parameter constant for <b>status</b>
480         * <p>
481         * Description: <b>Status of the dispense</b><br>
482         * Type: <b>token</b><br>
483         * Path: <b>MedicationDispense.status</b><br>
484         * </p>
485         */
486        @SearchParamDefinition(name="status", path="MedicationDispense.status", description="Status of the dispense", type="token"  )
487        public static final String SP_STATUS = "status";
488
489        /**
490         * <b>Fluent Client</b> search parameter constant for <b>status</b>
491         * <p>
492         * Description: <b>Status of the dispense</b><br>
493         * Type: <b>token</b><br>
494         * Path: <b>MedicationDispense.status</b><br>
495         * </p>
496         */
497        public static final TokenClientParam STATUS = new TokenClientParam(SP_STATUS);
498
499        /**
500         * Search parameter constant for <b>type</b>
501         * <p>
502         * Description: <b>Return all dispenses of a specific type</b><br>
503         * Type: <b>token</b><br>
504         * Path: <b>MedicationDispense.type</b><br>
505         * </p>
506         */
507        @SearchParamDefinition(name="type", path="MedicationDispense.type", description="Return all dispenses of a specific type", type="token"  )
508        public static final String SP_TYPE = "type";
509
510        /**
511         * <b>Fluent Client</b> search parameter constant for <b>type</b>
512         * <p>
513         * Description: <b>Return all dispenses of a specific type</b><br>
514         * Type: <b>token</b><br>
515         * Path: <b>MedicationDispense.type</b><br>
516         * </p>
517         */
518        public static final TokenClientParam TYPE = new TokenClientParam(SP_TYPE);
519
520        /**
521         * Search parameter constant for <b>whenhandedover</b>
522         * <p>
523         * Description: <b>Date when medication handed over to patient (outpatient setting), or supplied to ward or clinic (inpatient setting)</b><br>
524         * Type: <b>date</b><br>
525         * Path: <b>MedicationDispense.whenHandedOver</b><br>
526         * </p>
527         */
528        @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"  )
529        public static final String SP_WHENHANDEDOVER = "whenhandedover";
530
531        /**
532         * <b>Fluent Client</b> 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        public static final DateClientParam WHENHANDEDOVER = new DateClientParam(SP_WHENHANDEDOVER);
540
541        /**
542         * Search parameter constant for <b>whenprepared</b>
543         * <p>
544         * Description: <b>Date when medication prepared</b><br>
545         * Type: <b>date</b><br>
546         * Path: <b>MedicationDispense.whenPrepared</b><br>
547         * </p>
548         */
549        @SearchParamDefinition(name="whenprepared", path="MedicationDispense.whenPrepared", description="Date when medication prepared", type="date"  )
550        public static final String SP_WHENPREPARED = "whenprepared";
551
552        /**
553         * <b>Fluent Client</b> search parameter constant for <b>whenprepared</b>
554         * <p>
555         * Description: <b>Date when medication prepared</b><br>
556         * Type: <b>date</b><br>
557         * Path: <b>MedicationDispense.whenPrepared</b><br>
558         * </p>
559         */
560        public static final DateClientParam WHENPREPARED = new DateClientParam(SP_WHENPREPARED);
561
562        /**
563         * Search parameter constant for <b>receiver</b>
564         * <p>
565         * Description: <b></b><br>
566         * Type: <b>reference</b><br>
567         * Path: <b>MedicationDispense.receiver</b><br>
568         * </p>
569         */
570        @SearchParamDefinition(name="receiver", path="MedicationDispense.receiver", description="", type="reference" , providesMembershipIn={
571 @Compartment(name="Encounter")         }
572 )
573        public static final String SP_RECEIVER = "receiver";
574
575        /**
576         * <b>Fluent Client</b> 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        public static final ReferenceClientParam RECEIVER = new ReferenceClientParam(SP_RECEIVER);
584
585
586        /**
587         * Constant for fluent queries to be used to add include statements. Specifies
588         * the path value of "<b>MedicationDispense:destination</b>".
589         */
590        public static final Include INCLUDE_DESTINATION = new Include("MedicationDispense:destination");
591
592        /**
593         * Constant for fluent queries to be used to add include statements. Specifies
594         * the path value of "<b>MedicationDispense:dispenser</b>".
595         */
596        public static final Include INCLUDE_DISPENSER = new Include("MedicationDispense:dispenser");
597
598        /**
599         * Constant for fluent queries to be used to add include statements. Specifies
600         * the path value of "<b>MedicationDispense:medication</b>".
601         */
602        public static final Include INCLUDE_MEDICATION = new Include("MedicationDispense:medication");
603
604        /**
605         * Constant for fluent queries to be used to add include statements. Specifies
606         * the path value of "<b>MedicationDispense:patient</b>".
607         */
608        public static final Include INCLUDE_PATIENT = new Include("MedicationDispense:patient");
609
610        /**
611         * Constant for fluent queries to be used to add include statements. Specifies
612         * the path value of "<b>MedicationDispense:prescription</b>".
613         */
614        public static final Include INCLUDE_PRESCRIPTION = new Include("MedicationDispense:prescription");
615
616        /**
617         * Constant for fluent queries to be used to add include statements. Specifies
618         * the path value of "<b>MedicationDispense:receiver</b>".
619         */
620        public static final Include INCLUDE_RECEIVER = new Include("MedicationDispense:receiver");
621
622        /**
623         * Constant for fluent queries to be used to add include statements. Specifies
624         * the path value of "<b>MedicationDispense:responsibleparty</b>".
625         */
626        public static final Include INCLUDE_RESPONSIBLEPARTY = new Include("MedicationDispense:responsibleparty");
627
628
629        @Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1, summary=false, modifier=false)        
630        @Description(
631                shortDefinition="id",
632                formalDefinition="Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR."
633        )
634        private IdentifierDt myIdentifier;
635        
636        @Child(name="status", type=CodeDt.class, order=1, min=0, max=1, summary=false, modifier=true)   
637        @Description(
638                shortDefinition="status",
639                formalDefinition="A code specifying the state of the set of dispense events."
640        )
641        @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medication-dispense-status")
642        private BoundCodeDt<MedicationDispenseStatusEnum> myStatus;
643        
644        @Child(name="patient", order=2, min=0, max=1, summary=false, modifier=false, type={
645                ca.uhn.fhir.model.dstu2.resource.Patient.class  })
646        @Description(
647                shortDefinition="who.focus",
648                formalDefinition="A link to a resource representing the person to whom the medication will be given."
649        )
650        private ResourceReferenceDt myPatient;
651        
652        @Child(name="dispenser", order=3, min=0, max=1, summary=false, modifier=false, type={
653                ca.uhn.fhir.model.dstu2.resource.Practitioner.class     })
654        @Description(
655                shortDefinition="who.actor",
656                formalDefinition="The individual responsible for dispensing the medication"
657        )
658        private ResourceReferenceDt myDispenser;
659        
660        @Child(name="authorizingPrescription", order=4, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
661                ca.uhn.fhir.model.dstu2.resource.MedicationOrder.class  })
662        @Description(
663                shortDefinition="",
664                formalDefinition="Indicates the medication order that is being dispensed against."
665        )
666        private java.util.List<ResourceReferenceDt> myAuthorizingPrescription;
667        
668        @Child(name="type", type=CodeableConceptDt.class, order=5, min=0, max=1, summary=false, modifier=false) 
669        @Description(
670                shortDefinition="",
671                formalDefinition="Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc."
672        )
673        private CodeableConceptDt myType;
674        
675        @Child(name="quantity", type=SimpleQuantityDt.class, order=6, min=0, max=1, summary=false, modifier=false)      
676        @Description(
677                shortDefinition="",
678                formalDefinition="The amount of medication that has been dispensed. Includes unit of measure."
679        )
680        private SimpleQuantityDt myQuantity;
681        
682        @Child(name="daysSupply", type=SimpleQuantityDt.class, order=7, min=0, max=1, summary=false, modifier=false)    
683        @Description(
684                shortDefinition="",
685                formalDefinition="The amount of medication expressed as a timing amount."
686        )
687        private SimpleQuantityDt myDaysSupply;
688        
689        @Child(name="medication", order=8, min=1, max=1, summary=false, modifier=false, type={
690                CodeableConceptDt.class,                Medication.class        })
691        @Description(
692                shortDefinition="",
693                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."
694        )
695        private IDatatype myMedication;
696        
697        @Child(name="whenPrepared", type=DateTimeDt.class, order=9, min=0, max=1, summary=false, modifier=false)        
698        @Description(
699                shortDefinition="",
700                formalDefinition="The time when the dispensed product was packaged and reviewed."
701        )
702        private DateTimeDt myWhenPrepared;
703        
704        @Child(name="whenHandedOver", type=DateTimeDt.class, order=10, min=0, max=1, summary=false, modifier=false)     
705        @Description(
706                shortDefinition="",
707                formalDefinition="The time the dispensed product was provided to the patient or their representative."
708        )
709        private DateTimeDt myWhenHandedOver;
710        
711        @Child(name="destination", order=11, min=0, max=1, summary=false, modifier=false, type={
712                ca.uhn.fhir.model.dstu2.resource.Location.class })
713        @Description(
714                shortDefinition="",
715                formalDefinition="Identification of the facility/location where the medication was shipped to, as part of the dispense event."
716        )
717        private ResourceReferenceDt myDestination;
718        
719        @Child(name="receiver", order=12, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
720                ca.uhn.fhir.model.dstu2.resource.Patient.class,                 ca.uhn.fhir.model.dstu2.resource.Practitioner.class     })
721        @Description(
722                shortDefinition="",
723                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"
724        )
725        private java.util.List<ResourceReferenceDt> myReceiver;
726        
727        @Child(name="note", type=StringDt.class, order=13, min=0, max=1, summary=false, modifier=false) 
728        @Description(
729                shortDefinition="",
730                formalDefinition="Extra information about the dispense that could not be conveyed in the other attributes."
731        )
732        private StringDt myNote;
733        
734        @Child(name="dosageInstruction", order=14, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)       
735        @Description(
736                shortDefinition="",
737                formalDefinition="Indicates how the medication is to be used by the patient"
738        )
739        private java.util.List<DosageInstruction> myDosageInstruction;
740        
741        @Child(name="substitution", order=15, min=0, max=1, summary=false, modifier=false)      
742        @Description(
743                shortDefinition="",
744                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."
745        )
746        private Substitution mySubstitution;
747        
748
749        @Override
750        public boolean isEmpty() {
751                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);
752        }
753        
754        @Override
755        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
756                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myStatus, myPatient, myDispenser, myAuthorizingPrescription, myType, myQuantity, myDaysSupply, myMedication, myWhenPrepared, myWhenHandedOver, myDestination, myReceiver, myNote, myDosageInstruction, mySubstitution);
757        }
758
759        /**
760         * Gets the value(s) for <b>identifier</b> (id).
761         * creating it if it does
762         * not exist. Will not return <code>null</code>.
763         *
764     * <p>
765     * <b>Definition:</b>
766     * Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.
767     * </p> 
768         */
769        public IdentifierDt getIdentifier() {  
770                if (myIdentifier == null) {
771                        myIdentifier = new IdentifierDt();
772                }
773                return myIdentifier;
774        }
775
776        /**
777         * Sets the value(s) for <b>identifier</b> (id)
778         *
779     * <p>
780     * <b>Definition:</b>
781     * Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.
782     * </p> 
783         */
784        public MedicationDispense setIdentifier(IdentifierDt theValue) {
785                myIdentifier = theValue;
786                return this;
787        }
788        
789        
790
791  
792        /**
793         * Gets the value(s) for <b>status</b> (status).
794         * creating it if it does
795         * not exist. Will not return <code>null</code>.
796         *
797     * <p>
798     * <b>Definition:</b>
799     * A code specifying the state of the set of dispense events.
800     * </p> 
801         */
802        public BoundCodeDt<MedicationDispenseStatusEnum> getStatusElement() {  
803                if (myStatus == null) {
804                        myStatus = new BoundCodeDt<MedicationDispenseStatusEnum>(MedicationDispenseStatusEnum.VALUESET_BINDER);
805                }
806                return myStatus;
807        }
808
809        
810        /**
811         * Gets the value(s) for <b>status</b> (status).
812         * creating it if it does
813         * not exist. This method may return <code>null</code>.
814         *
815     * <p>
816     * <b>Definition:</b>
817     * A code specifying the state of the set of dispense events.
818     * </p> 
819         */
820        public String getStatus() {  
821                return getStatusElement().getValue();
822        }
823
824        /**
825         * Sets the value(s) for <b>status</b> (status)
826         *
827     * <p>
828     * <b>Definition:</b>
829     * A code specifying the state of the set of dispense events.
830     * </p> 
831         */
832        public MedicationDispense setStatus(BoundCodeDt<MedicationDispenseStatusEnum> theValue) {
833                myStatus = theValue;
834                return this;
835        }
836        
837        
838
839        /**
840         * Sets the value(s) for <b>status</b> (status)
841         *
842     * <p>
843     * <b>Definition:</b>
844     * A code specifying the state of the set of dispense events.
845     * </p> 
846         */
847        public MedicationDispense setStatus(MedicationDispenseStatusEnum theValue) {
848                setStatus(new BoundCodeDt<MedicationDispenseStatusEnum>(MedicationDispenseStatusEnum.VALUESET_BINDER, theValue));
849                
850/*
851                getStatusElement().setValueAsEnum(theValue);
852*/
853                return this;
854        }
855
856  
857        /**
858         * Gets the value(s) for <b>patient</b> (who.focus).
859         * creating it if it does
860         * not exist. Will not return <code>null</code>.
861         *
862     * <p>
863     * <b>Definition:</b>
864     * A link to a resource representing the person to whom the medication will be given.
865     * </p> 
866         */
867        public ResourceReferenceDt getPatient() {  
868                if (myPatient == null) {
869                        myPatient = new ResourceReferenceDt();
870                }
871                return myPatient;
872        }
873
874        /**
875         * Sets the value(s) for <b>patient</b> (who.focus)
876         *
877     * <p>
878     * <b>Definition:</b>
879     * A link to a resource representing the person to whom the medication will be given.
880     * </p> 
881         */
882        public MedicationDispense setPatient(ResourceReferenceDt theValue) {
883                myPatient = theValue;
884                return this;
885        }
886        
887        
888
889  
890        /**
891         * Gets the value(s) for <b>dispenser</b> (who.actor).
892         * creating it if it does
893         * not exist. Will not return <code>null</code>.
894         *
895     * <p>
896     * <b>Definition:</b>
897     * The individual responsible for dispensing the medication
898     * </p> 
899         */
900        public ResourceReferenceDt getDispenser() {  
901                if (myDispenser == null) {
902                        myDispenser = new ResourceReferenceDt();
903                }
904                return myDispenser;
905        }
906
907        /**
908         * Sets the value(s) for <b>dispenser</b> (who.actor)
909         *
910     * <p>
911     * <b>Definition:</b>
912     * The individual responsible for dispensing the medication
913     * </p> 
914         */
915        public MedicationDispense setDispenser(ResourceReferenceDt theValue) {
916                myDispenser = theValue;
917                return this;
918        }
919        
920        
921
922  
923        /**
924         * Gets the value(s) for <b>authorizingPrescription</b> ().
925         * creating it if it does
926         * not exist. Will not return <code>null</code>.
927         *
928     * <p>
929     * <b>Definition:</b>
930     * Indicates the medication order that is being dispensed against.
931     * </p> 
932         */
933        public java.util.List<ResourceReferenceDt> getAuthorizingPrescription() {  
934                if (myAuthorizingPrescription == null) {
935                        myAuthorizingPrescription = new java.util.ArrayList<ResourceReferenceDt>();
936                }
937                return myAuthorizingPrescription;
938        }
939
940        /**
941         * Sets the value(s) for <b>authorizingPrescription</b> ()
942         *
943     * <p>
944     * <b>Definition:</b>
945     * Indicates the medication order that is being dispensed against.
946     * </p> 
947         */
948        public MedicationDispense setAuthorizingPrescription(java.util.List<ResourceReferenceDt> theValue) {
949                myAuthorizingPrescription = theValue;
950                return this;
951        }
952        
953        
954
955        /**
956         * Adds and returns a new value for <b>authorizingPrescription</b> ()
957         *
958     * <p>
959     * <b>Definition:</b>
960     * Indicates the medication order that is being dispensed against.
961     * </p> 
962         */
963        public ResourceReferenceDt addAuthorizingPrescription() {
964                ResourceReferenceDt newType = new ResourceReferenceDt();
965                getAuthorizingPrescription().add(newType);
966                return newType; 
967        }
968  
969        /**
970         * Gets the value(s) for <b>type</b> ().
971         * creating it if it does
972         * not exist. Will not return <code>null</code>.
973         *
974     * <p>
975     * <b>Definition:</b>
976     * Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.
977     * </p> 
978         */
979        public CodeableConceptDt getType() {  
980                if (myType == null) {
981                        myType = new CodeableConceptDt();
982                }
983                return myType;
984        }
985
986        /**
987         * Sets the value(s) for <b>type</b> ()
988         *
989     * <p>
990     * <b>Definition:</b>
991     * Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.
992     * </p> 
993         */
994        public MedicationDispense setType(CodeableConceptDt theValue) {
995                myType = theValue;
996                return this;
997        }
998        
999        
1000
1001  
1002        /**
1003         * Gets the value(s) for <b>quantity</b> ().
1004         * creating it if it does
1005         * not exist. Will not return <code>null</code>.
1006         *
1007     * <p>
1008     * <b>Definition:</b>
1009     * The amount of medication that has been dispensed. Includes unit of measure.
1010     * </p> 
1011         */
1012        public SimpleQuantityDt getQuantity() {  
1013                if (myQuantity == null) {
1014                        myQuantity = new SimpleQuantityDt();
1015                }
1016                return myQuantity;
1017        }
1018
1019        /**
1020         * Sets the value(s) for <b>quantity</b> ()
1021         *
1022     * <p>
1023     * <b>Definition:</b>
1024     * The amount of medication that has been dispensed. Includes unit of measure.
1025     * </p> 
1026         */
1027        public MedicationDispense setQuantity(SimpleQuantityDt theValue) {
1028                myQuantity = theValue;
1029                return this;
1030        }
1031        
1032        
1033
1034  
1035        /**
1036         * Gets the value(s) for <b>daysSupply</b> ().
1037         * creating it if it does
1038         * not exist. Will not return <code>null</code>.
1039         *
1040     * <p>
1041     * <b>Definition:</b>
1042     * The amount of medication expressed as a timing amount.
1043     * </p> 
1044         */
1045        public SimpleQuantityDt getDaysSupply() {  
1046                if (myDaysSupply == null) {
1047                        myDaysSupply = new SimpleQuantityDt();
1048                }
1049                return myDaysSupply;
1050        }
1051
1052        /**
1053         * Sets the value(s) for <b>daysSupply</b> ()
1054         *
1055     * <p>
1056     * <b>Definition:</b>
1057     * The amount of medication expressed as a timing amount.
1058     * </p> 
1059         */
1060        public MedicationDispense setDaysSupply(SimpleQuantityDt theValue) {
1061                myDaysSupply = theValue;
1062                return this;
1063        }
1064        
1065        
1066
1067  
1068        /**
1069         * Gets the value(s) for <b>medication[x]</b> ().
1070         * creating it if it does
1071         * not exist. Will not return <code>null</code>.
1072         *
1073     * <p>
1074     * <b>Definition:</b>
1075     * 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.
1076     * </p> 
1077         */
1078        public IDatatype getMedication() {  
1079                return myMedication;
1080        }
1081
1082        /**
1083         * Sets the value(s) for <b>medication[x]</b> ()
1084         *
1085     * <p>
1086     * <b>Definition:</b>
1087     * 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.
1088     * </p> 
1089         */
1090        public MedicationDispense setMedication(IDatatype theValue) {
1091                myMedication = theValue;
1092                return this;
1093        }
1094        
1095        
1096
1097  
1098        /**
1099         * Gets the value(s) for <b>whenPrepared</b> ().
1100         * creating it if it does
1101         * not exist. Will not return <code>null</code>.
1102         *
1103     * <p>
1104     * <b>Definition:</b>
1105     * The time when the dispensed product was packaged and reviewed.
1106     * </p> 
1107         */
1108        public DateTimeDt getWhenPreparedElement() {  
1109                if (myWhenPrepared == null) {
1110                        myWhenPrepared = new DateTimeDt();
1111                }
1112                return myWhenPrepared;
1113        }
1114
1115        
1116        /**
1117         * Gets the value(s) for <b>whenPrepared</b> ().
1118         * creating it if it does
1119         * not exist. This method may return <code>null</code>.
1120         *
1121     * <p>
1122     * <b>Definition:</b>
1123     * The time when the dispensed product was packaged and reviewed.
1124     * </p> 
1125         */
1126        public Date getWhenPrepared() {  
1127                return getWhenPreparedElement().getValue();
1128        }
1129
1130        /**
1131         * Sets the value(s) for <b>whenPrepared</b> ()
1132         *
1133     * <p>
1134     * <b>Definition:</b>
1135     * The time when the dispensed product was packaged and reviewed.
1136     * </p> 
1137         */
1138        public MedicationDispense setWhenPrepared(DateTimeDt theValue) {
1139                myWhenPrepared = theValue;
1140                return this;
1141        }
1142        
1143        
1144
1145        /**
1146         * Sets the value for <b>whenPrepared</b> ()
1147         *
1148     * <p>
1149     * <b>Definition:</b>
1150     * The time when the dispensed product was packaged and reviewed.
1151     * </p> 
1152         */
1153        public MedicationDispense setWhenPrepared( Date theDate,  TemporalPrecisionEnum thePrecision) {
1154                myWhenPrepared = new DateTimeDt(theDate, thePrecision); 
1155                return this; 
1156        }
1157
1158        /**
1159         * Sets the value for <b>whenPrepared</b> ()
1160         *
1161     * <p>
1162     * <b>Definition:</b>
1163     * The time when the dispensed product was packaged and reviewed.
1164     * </p> 
1165         */
1166        public MedicationDispense setWhenPreparedWithSecondsPrecision( Date theDate) {
1167                myWhenPrepared = new DateTimeDt(theDate); 
1168                return this; 
1169        }
1170
1171 
1172        /**
1173         * Gets the value(s) for <b>whenHandedOver</b> ().
1174         * creating it if it does
1175         * not exist. Will not return <code>null</code>.
1176         *
1177     * <p>
1178     * <b>Definition:</b>
1179     * The time the dispensed product was provided to the patient or their representative.
1180     * </p> 
1181         */
1182        public DateTimeDt getWhenHandedOverElement() {  
1183                if (myWhenHandedOver == null) {
1184                        myWhenHandedOver = new DateTimeDt();
1185                }
1186                return myWhenHandedOver;
1187        }
1188
1189        
1190        /**
1191         * Gets the value(s) for <b>whenHandedOver</b> ().
1192         * creating it if it does
1193         * not exist. This method may return <code>null</code>.
1194         *
1195     * <p>
1196     * <b>Definition:</b>
1197     * The time the dispensed product was provided to the patient or their representative.
1198     * </p> 
1199         */
1200        public Date getWhenHandedOver() {  
1201                return getWhenHandedOverElement().getValue();
1202        }
1203
1204        /**
1205         * Sets the value(s) for <b>whenHandedOver</b> ()
1206         *
1207     * <p>
1208     * <b>Definition:</b>
1209     * The time the dispensed product was provided to the patient or their representative.
1210     * </p> 
1211         */
1212        public MedicationDispense setWhenHandedOver(DateTimeDt theValue) {
1213                myWhenHandedOver = theValue;
1214                return this;
1215        }
1216        
1217        
1218
1219        /**
1220         * Sets the value for <b>whenHandedOver</b> ()
1221         *
1222     * <p>
1223     * <b>Definition:</b>
1224     * The time the dispensed product was provided to the patient or their representative.
1225     * </p> 
1226         */
1227        public MedicationDispense setWhenHandedOver( Date theDate,  TemporalPrecisionEnum thePrecision) {
1228                myWhenHandedOver = new DateTimeDt(theDate, thePrecision); 
1229                return this; 
1230        }
1231
1232        /**
1233         * Sets the value for <b>whenHandedOver</b> ()
1234         *
1235     * <p>
1236     * <b>Definition:</b>
1237     * The time the dispensed product was provided to the patient or their representative.
1238     * </p> 
1239         */
1240        public MedicationDispense setWhenHandedOverWithSecondsPrecision( Date theDate) {
1241                myWhenHandedOver = new DateTimeDt(theDate); 
1242                return this; 
1243        }
1244
1245 
1246        /**
1247         * Gets the value(s) for <b>destination</b> ().
1248         * creating it if it does
1249         * not exist. Will not return <code>null</code>.
1250         *
1251     * <p>
1252     * <b>Definition:</b>
1253     * Identification of the facility/location where the medication was shipped to, as part of the dispense event.
1254     * </p> 
1255         */
1256        public ResourceReferenceDt getDestination() {  
1257                if (myDestination == null) {
1258                        myDestination = new ResourceReferenceDt();
1259                }
1260                return myDestination;
1261        }
1262
1263        /**
1264         * Sets the value(s) for <b>destination</b> ()
1265         *
1266     * <p>
1267     * <b>Definition:</b>
1268     * Identification of the facility/location where the medication was shipped to, as part of the dispense event.
1269     * </p> 
1270         */
1271        public MedicationDispense setDestination(ResourceReferenceDt theValue) {
1272                myDestination = theValue;
1273                return this;
1274        }
1275        
1276        
1277
1278  
1279        /**
1280         * Gets the value(s) for <b>receiver</b> ().
1281         * creating it if it does
1282         * not exist. Will not return <code>null</code>.
1283         *
1284     * <p>
1285     * <b>Definition:</b>
1286     * 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
1287     * </p> 
1288         */
1289        public java.util.List<ResourceReferenceDt> getReceiver() {  
1290                if (myReceiver == null) {
1291                        myReceiver = new java.util.ArrayList<ResourceReferenceDt>();
1292                }
1293                return myReceiver;
1294        }
1295
1296        /**
1297         * Sets the value(s) for <b>receiver</b> ()
1298         *
1299     * <p>
1300     * <b>Definition:</b>
1301     * 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
1302     * </p> 
1303         */
1304        public MedicationDispense setReceiver(java.util.List<ResourceReferenceDt> theValue) {
1305                myReceiver = theValue;
1306                return this;
1307        }
1308        
1309        
1310
1311        /**
1312         * Adds and returns a new value for <b>receiver</b> ()
1313         *
1314     * <p>
1315     * <b>Definition:</b>
1316     * 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
1317     * </p> 
1318         */
1319        public ResourceReferenceDt addReceiver() {
1320                ResourceReferenceDt newType = new ResourceReferenceDt();
1321                getReceiver().add(newType);
1322                return newType; 
1323        }
1324  
1325        /**
1326         * Gets the value(s) for <b>note</b> ().
1327         * creating it if it does
1328         * not exist. Will not return <code>null</code>.
1329         *
1330     * <p>
1331     * <b>Definition:</b>
1332     * Extra information about the dispense that could not be conveyed in the other attributes.
1333     * </p> 
1334         */
1335        public StringDt getNoteElement() {  
1336                if (myNote == null) {
1337                        myNote = new StringDt();
1338                }
1339                return myNote;
1340        }
1341
1342        
1343        /**
1344         * Gets the value(s) for <b>note</b> ().
1345         * creating it if it does
1346         * not exist. This method may return <code>null</code>.
1347         *
1348     * <p>
1349     * <b>Definition:</b>
1350     * Extra information about the dispense that could not be conveyed in the other attributes.
1351     * </p> 
1352         */
1353        public String getNote() {  
1354                return getNoteElement().getValue();
1355        }
1356
1357        /**
1358         * Sets the value(s) for <b>note</b> ()
1359         *
1360     * <p>
1361     * <b>Definition:</b>
1362     * Extra information about the dispense that could not be conveyed in the other attributes.
1363     * </p> 
1364         */
1365        public MedicationDispense setNote(StringDt theValue) {
1366                myNote = theValue;
1367                return this;
1368        }
1369        
1370        
1371
1372        /**
1373         * Sets the value for <b>note</b> ()
1374         *
1375     * <p>
1376     * <b>Definition:</b>
1377     * Extra information about the dispense that could not be conveyed in the other attributes.
1378     * </p> 
1379         */
1380        public MedicationDispense setNote( String theString) {
1381                myNote = new StringDt(theString); 
1382                return this; 
1383        }
1384
1385 
1386        /**
1387         * Gets the value(s) for <b>dosageInstruction</b> ().
1388         * creating it if it does
1389         * not exist. Will not return <code>null</code>.
1390         *
1391     * <p>
1392     * <b>Definition:</b>
1393     * Indicates how the medication is to be used by the patient
1394     * </p> 
1395         */
1396        public java.util.List<DosageInstruction> getDosageInstruction() {  
1397                if (myDosageInstruction == null) {
1398                        myDosageInstruction = new java.util.ArrayList<DosageInstruction>();
1399                }
1400                return myDosageInstruction;
1401        }
1402
1403        /**
1404         * Sets the value(s) for <b>dosageInstruction</b> ()
1405         *
1406     * <p>
1407     * <b>Definition:</b>
1408     * Indicates how the medication is to be used by the patient
1409     * </p> 
1410         */
1411        public MedicationDispense setDosageInstruction(java.util.List<DosageInstruction> theValue) {
1412                myDosageInstruction = theValue;
1413                return this;
1414        }
1415        
1416        
1417
1418        /**
1419         * Adds and returns a new value for <b>dosageInstruction</b> ()
1420         *
1421     * <p>
1422     * <b>Definition:</b>
1423     * Indicates how the medication is to be used by the patient
1424     * </p> 
1425         */
1426        public DosageInstruction addDosageInstruction() {
1427                DosageInstruction newType = new DosageInstruction();
1428                getDosageInstruction().add(newType);
1429                return newType; 
1430        }
1431
1432        /**
1433         * Adds a given new value for <b>dosageInstruction</b> ()
1434         *
1435         * <p>
1436         * <b>Definition:</b>
1437         * Indicates how the medication is to be used by the patient
1438         * </p>
1439         * @param theValue The dosageInstruction to add (must not be <code>null</code>)
1440         */
1441        public MedicationDispense addDosageInstruction(DosageInstruction theValue) {
1442                if (theValue == null) {
1443                        throw new NullPointerException("theValue must not be null");
1444                }
1445                getDosageInstruction().add(theValue);
1446                return this;
1447        }
1448
1449        /**
1450         * Gets the first repetition for <b>dosageInstruction</b> (),
1451         * creating it if it does not already exist.
1452         *
1453     * <p>
1454     * <b>Definition:</b>
1455     * Indicates how the medication is to be used by the patient
1456     * </p> 
1457         */
1458        public DosageInstruction getDosageInstructionFirstRep() {
1459                if (getDosageInstruction().isEmpty()) {
1460                        return addDosageInstruction();
1461                }
1462                return getDosageInstruction().get(0); 
1463        }
1464  
1465        /**
1466         * Gets the value(s) for <b>substitution</b> ().
1467         * creating it if it does
1468         * not exist. Will not return <code>null</code>.
1469         *
1470     * <p>
1471     * <b>Definition:</b>
1472     * 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.
1473     * </p> 
1474         */
1475        public Substitution getSubstitution() {  
1476                if (mySubstitution == null) {
1477                        mySubstitution = new Substitution();
1478                }
1479                return mySubstitution;
1480        }
1481
1482        /**
1483         * Sets the value(s) for <b>substitution</b> ()
1484         *
1485     * <p>
1486     * <b>Definition:</b>
1487     * 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.
1488     * </p> 
1489         */
1490        public MedicationDispense setSubstitution(Substitution theValue) {
1491                mySubstitution = theValue;
1492                return this;
1493        }
1494        
1495        
1496
1497  
1498        /**
1499         * Block class for child element: <b>MedicationDispense.dosageInstruction</b> ()
1500         *
1501     * <p>
1502     * <b>Definition:</b>
1503     * Indicates how the medication is to be used by the patient
1504     * </p> 
1505         */
1506        @Block()        
1507        public static class DosageInstruction 
1508            extends  BaseIdentifiableElement        implements IResourceBlock {
1509        
1510        @Child(name="text", type=StringDt.class, order=0, min=0, max=1, summary=false, modifier=false)  
1511        @Description(
1512                shortDefinition="",
1513                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."
1514        )
1515        private StringDt myText;
1516        
1517        @Child(name="additionalInstructions", type=CodeableConceptDt.class, order=1, min=0, max=1, summary=false, modifier=false)       
1518        @Description(
1519                shortDefinition="",
1520                formalDefinition="Additional instructions such as \"Swallow with plenty of water\" which may or may not be coded."
1521        )
1522        private CodeableConceptDt myAdditionalInstructions;
1523        
1524        @Child(name="timing", type=TimingDt.class, order=2, min=0, max=1, summary=false, modifier=false)        
1525        @Description(
1526                shortDefinition="",
1527                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\""
1528        )
1529        private TimingDt myTiming;
1530        
1531        @Child(name="asNeeded", order=3, min=0, max=1, summary=false, modifier=false, type={
1532                BooleanDt.class,                CodeableConceptDt.class })
1533        @Description(
1534                shortDefinition="",
1535                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."
1536        )
1537        private IDatatype myAsNeeded;
1538        
1539        @Child(name="site", order=4, min=0, max=1, summary=false, modifier=false, type={
1540                CodeableConceptDt.class,                BodySite.class  })
1541        @Description(
1542                shortDefinition="",
1543                formalDefinition="A coded specification of the anatomic site where the medication first enters the body"
1544        )
1545        private IDatatype mySite;
1546        
1547        @Child(name="route", type=CodeableConceptDt.class, order=5, min=0, max=1, summary=false, modifier=false)        
1548        @Description(
1549                shortDefinition="",
1550                formalDefinition="A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject."
1551        )
1552        private CodeableConceptDt myRoute;
1553        
1554        @Child(name="method", type=CodeableConceptDt.class, order=6, min=0, max=1, summary=false, modifier=false)       
1555        @Description(
1556                shortDefinition="",
1557                formalDefinition="A coded value indicating the method by which the medication is intended to be or was introduced into or on the body."
1558        )
1559        private CodeableConceptDt myMethod;
1560        
1561        @Child(name="dose", order=7, min=0, max=1, summary=false, modifier=false, type={
1562                RangeDt.class,          SimpleQuantityDt.class  })
1563        @Description(
1564                shortDefinition="",
1565                formalDefinition="The amount of therapeutic or other substance given at one administration event."
1566        )
1567        private IDatatype myDose;
1568        
1569        @Child(name="rate", order=8, min=0, max=1, summary=false, modifier=false, type={
1570                RatioDt.class,          RangeDt.class   })
1571        @Description(
1572                shortDefinition="",
1573                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"
1574        )
1575        private IDatatype myRate;
1576        
1577        @Child(name="maxDosePerPeriod", type=RatioDt.class, order=9, min=0, max=1, summary=false, modifier=false)       
1578        @Description(
1579                shortDefinition="",
1580                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."
1581        )
1582        private RatioDt myMaxDosePerPeriod;
1583        
1584
1585        @Override
1586        public boolean isEmpty() {
1587                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myText,  myAdditionalInstructions,  myTiming,  myAsNeeded,  mySite,  myRoute,  myMethod,  myDose,  myRate,  myMaxDosePerPeriod);
1588        }
1589        
1590        @Override
1591        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
1592                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myText, myAdditionalInstructions, myTiming, myAsNeeded, mySite, myRoute, myMethod, myDose, myRate, myMaxDosePerPeriod);
1593        }
1594
1595        /**
1596         * Gets the value(s) for <b>text</b> ().
1597         * creating it if it does
1598         * not exist. Will not return <code>null</code>.
1599         *
1600     * <p>
1601     * <b>Definition:</b>
1602     * 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.
1603     * </p> 
1604         */
1605        public StringDt getTextElement() {  
1606                if (myText == null) {
1607                        myText = new StringDt();
1608                }
1609                return myText;
1610        }
1611
1612        
1613        /**
1614         * Gets the value(s) for <b>text</b> ().
1615         * creating it if it does
1616         * not exist. This method may return <code>null</code>.
1617         *
1618     * <p>
1619     * <b>Definition:</b>
1620     * 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.
1621     * </p> 
1622         */
1623        public String getText() {  
1624                return getTextElement().getValue();
1625        }
1626
1627        /**
1628         * Sets the value(s) for <b>text</b> ()
1629         *
1630     * <p>
1631     * <b>Definition:</b>
1632     * 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.
1633     * </p> 
1634         */
1635        public DosageInstruction setText(StringDt theValue) {
1636                myText = theValue;
1637                return this;
1638        }
1639        
1640        
1641
1642        /**
1643         * Sets the value for <b>text</b> ()
1644         *
1645     * <p>
1646     * <b>Definition:</b>
1647     * 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.
1648     * </p> 
1649         */
1650        public DosageInstruction setText( String theString) {
1651                myText = new StringDt(theString); 
1652                return this; 
1653        }
1654
1655 
1656        /**
1657         * Gets the value(s) for <b>additionalInstructions</b> ().
1658         * creating it if it does
1659         * not exist. Will not return <code>null</code>.
1660         *
1661     * <p>
1662     * <b>Definition:</b>
1663     * Additional instructions such as \&quot;Swallow with plenty of water\&quot; which may or may not be coded.
1664     * </p> 
1665         */
1666        public CodeableConceptDt getAdditionalInstructions() {  
1667                if (myAdditionalInstructions == null) {
1668                        myAdditionalInstructions = new CodeableConceptDt();
1669                }
1670                return myAdditionalInstructions;
1671        }
1672
1673        /**
1674         * Sets the value(s) for <b>additionalInstructions</b> ()
1675         *
1676     * <p>
1677     * <b>Definition:</b>
1678     * Additional instructions such as \&quot;Swallow with plenty of water\&quot; which may or may not be coded.
1679     * </p> 
1680         */
1681        public DosageInstruction setAdditionalInstructions(CodeableConceptDt theValue) {
1682                myAdditionalInstructions = theValue;
1683                return this;
1684        }
1685        
1686        
1687
1688  
1689        /**
1690         * Gets the value(s) for <b>timing</b> ().
1691         * creating it if it does
1692         * not exist. Will not return <code>null</code>.
1693         *
1694     * <p>
1695     * <b>Definition:</b>
1696     * 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;
1697     * </p> 
1698         */
1699        public TimingDt getTiming() {  
1700                if (myTiming == null) {
1701                        myTiming = new TimingDt();
1702                }
1703                return myTiming;
1704        }
1705
1706        /**
1707         * Sets the value(s) for <b>timing</b> ()
1708         *
1709     * <p>
1710     * <b>Definition:</b>
1711     * 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;
1712     * </p> 
1713         */
1714        public DosageInstruction setTiming(TimingDt theValue) {
1715                myTiming = theValue;
1716                return this;
1717        }
1718        
1719        
1720
1721  
1722        /**
1723         * Gets the value(s) for <b>asNeeded[x]</b> ().
1724         * creating it if it does
1725         * not exist. Will not return <code>null</code>.
1726         *
1727     * <p>
1728     * <b>Definition:</b>
1729     * 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.
1730     * </p> 
1731         */
1732        public IDatatype getAsNeeded() {  
1733                return myAsNeeded;
1734        }
1735
1736        /**
1737         * Sets the value(s) for <b>asNeeded[x]</b> ()
1738         *
1739     * <p>
1740     * <b>Definition:</b>
1741     * 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.
1742     * </p> 
1743         */
1744        public DosageInstruction setAsNeeded(IDatatype theValue) {
1745                myAsNeeded = theValue;
1746                return this;
1747        }
1748        
1749        
1750
1751  
1752        /**
1753         * Gets the value(s) for <b>site[x]</b> ().
1754         * creating it if it does
1755         * not exist. Will not return <code>null</code>.
1756         *
1757     * <p>
1758     * <b>Definition:</b>
1759     * A coded specification of the anatomic site where the medication first enters the body
1760     * </p> 
1761         */
1762        public IDatatype getSite() {  
1763                return mySite;
1764        }
1765
1766        /**
1767         * Sets the value(s) for <b>site[x]</b> ()
1768         *
1769     * <p>
1770     * <b>Definition:</b>
1771     * A coded specification of the anatomic site where the medication first enters the body
1772     * </p> 
1773         */
1774        public DosageInstruction setSite(IDatatype theValue) {
1775                mySite = theValue;
1776                return this;
1777        }
1778        
1779        
1780
1781  
1782        /**
1783         * Gets the value(s) for <b>route</b> ().
1784         * creating it if it does
1785         * not exist. Will not return <code>null</code>.
1786         *
1787     * <p>
1788     * <b>Definition:</b>
1789     * A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.
1790     * </p> 
1791         */
1792        public CodeableConceptDt getRoute() {  
1793                if (myRoute == null) {
1794                        myRoute = new CodeableConceptDt();
1795                }
1796                return myRoute;
1797        }
1798
1799        /**
1800         * Sets the value(s) for <b>route</b> ()
1801         *
1802     * <p>
1803     * <b>Definition:</b>
1804     * A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.
1805     * </p> 
1806         */
1807        public DosageInstruction setRoute(CodeableConceptDt theValue) {
1808                myRoute = theValue;
1809                return this;
1810        }
1811        
1812        
1813
1814  
1815        /**
1816         * Gets the value(s) for <b>method</b> ().
1817         * creating it if it does
1818         * not exist. Will not return <code>null</code>.
1819         *
1820     * <p>
1821     * <b>Definition:</b>
1822     * A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.
1823     * </p> 
1824         */
1825        public CodeableConceptDt getMethod() {  
1826                if (myMethod == null) {
1827                        myMethod = new CodeableConceptDt();
1828                }
1829                return myMethod;
1830        }
1831
1832        /**
1833         * Sets the value(s) for <b>method</b> ()
1834         *
1835     * <p>
1836     * <b>Definition:</b>
1837     * A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.
1838     * </p> 
1839         */
1840        public DosageInstruction setMethod(CodeableConceptDt theValue) {
1841                myMethod = theValue;
1842                return this;
1843        }
1844        
1845        
1846
1847  
1848        /**
1849         * Gets the value(s) for <b>dose[x]</b> ().
1850         * creating it if it does
1851         * not exist. Will not return <code>null</code>.
1852         *
1853     * <p>
1854     * <b>Definition:</b>
1855     * The amount of therapeutic or other substance given at one administration event.
1856     * </p> 
1857         */
1858        public IDatatype getDose() {  
1859                return myDose;
1860        }
1861
1862        /**
1863         * Sets the value(s) for <b>dose[x]</b> ()
1864         *
1865     * <p>
1866     * <b>Definition:</b>
1867     * The amount of therapeutic or other substance given at one administration event.
1868     * </p> 
1869         */
1870        public DosageInstruction setDose(IDatatype theValue) {
1871                myDose = theValue;
1872                return this;
1873        }
1874        
1875        
1876
1877  
1878        /**
1879         * Gets the value(s) for <b>rate[x]</b> ().
1880         * creating it if it does
1881         * not exist. Will not return <code>null</code>.
1882         *
1883     * <p>
1884     * <b>Definition:</b>
1885     * 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
1886     * </p> 
1887         */
1888        public IDatatype getRate() {  
1889                return myRate;
1890        }
1891
1892        /**
1893         * Sets the value(s) for <b>rate[x]</b> ()
1894         *
1895     * <p>
1896     * <b>Definition:</b>
1897     * 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
1898     * </p> 
1899         */
1900        public DosageInstruction setRate(IDatatype theValue) {
1901                myRate = theValue;
1902                return this;
1903        }
1904        
1905        
1906
1907  
1908        /**
1909         * Gets the value(s) for <b>maxDosePerPeriod</b> ().
1910         * creating it if it does
1911         * not exist. Will not return <code>null</code>.
1912         *
1913     * <p>
1914     * <b>Definition:</b>
1915     * 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.
1916     * </p> 
1917         */
1918        public RatioDt getMaxDosePerPeriod() {  
1919                if (myMaxDosePerPeriod == null) {
1920                        myMaxDosePerPeriod = new RatioDt();
1921                }
1922                return myMaxDosePerPeriod;
1923        }
1924
1925        /**
1926         * Sets the value(s) for <b>maxDosePerPeriod</b> ()
1927         *
1928     * <p>
1929     * <b>Definition:</b>
1930     * 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.
1931     * </p> 
1932         */
1933        public DosageInstruction setMaxDosePerPeriod(RatioDt theValue) {
1934                myMaxDosePerPeriod = theValue;
1935                return this;
1936        }
1937        
1938        
1939
1940  
1941
1942
1943        }
1944
1945
1946        /**
1947         * Block class for child element: <b>MedicationDispense.substitution</b> ()
1948         *
1949     * <p>
1950     * <b>Definition:</b>
1951     * 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.
1952     * </p> 
1953         */
1954        @Block()        
1955        public static class Substitution 
1956            extends  BaseIdentifiableElement        implements IResourceBlock {
1957        
1958        @Child(name="type", type=CodeableConceptDt.class, order=0, min=1, max=1, summary=false, modifier=false) 
1959        @Description(
1960                shortDefinition="",
1961                formalDefinition="A code signifying whether a different drug was dispensed from what was prescribed."
1962        )
1963        private CodeableConceptDt myType;
1964        
1965        @Child(name="reason", type=CodeableConceptDt.class, order=1, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false)     
1966        @Description(
1967                shortDefinition="",
1968                formalDefinition="Indicates the reason for the substitution of (or lack of substitution) from what was prescribed."
1969        )
1970        private java.util.List<CodeableConceptDt> myReason;
1971        
1972        @Child(name="responsibleParty", order=2, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false, type={
1973                ca.uhn.fhir.model.dstu2.resource.Practitioner.class     })
1974        @Description(
1975                shortDefinition="",
1976                formalDefinition="The person or organization that has primary responsibility for the substitution"
1977        )
1978        private java.util.List<ResourceReferenceDt> myResponsibleParty;
1979        
1980
1981        @Override
1982        public boolean isEmpty() {
1983                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myType,  myReason,  myResponsibleParty);
1984        }
1985        
1986        @Override
1987        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
1988                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myType, myReason, myResponsibleParty);
1989        }
1990
1991        /**
1992         * Gets the value(s) for <b>type</b> ().
1993         * creating it if it does
1994         * not exist. Will not return <code>null</code>.
1995         *
1996     * <p>
1997     * <b>Definition:</b>
1998     * A code signifying whether a different drug was dispensed from what was prescribed.
1999     * </p> 
2000         */
2001        public CodeableConceptDt getType() {  
2002                if (myType == null) {
2003                        myType = new CodeableConceptDt();
2004                }
2005                return myType;
2006        }
2007
2008        /**
2009         * Sets the value(s) for <b>type</b> ()
2010         *
2011     * <p>
2012     * <b>Definition:</b>
2013     * A code signifying whether a different drug was dispensed from what was prescribed.
2014     * </p> 
2015         */
2016        public Substitution setType(CodeableConceptDt theValue) {
2017                myType = theValue;
2018                return this;
2019        }
2020        
2021        
2022
2023  
2024        /**
2025         * Gets the value(s) for <b>reason</b> ().
2026         * creating it if it does
2027         * not exist. Will not return <code>null</code>.
2028         *
2029     * <p>
2030     * <b>Definition:</b>
2031     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2032     * </p> 
2033         */
2034        public java.util.List<CodeableConceptDt> getReason() {  
2035                if (myReason == null) {
2036                        myReason = new java.util.ArrayList<CodeableConceptDt>();
2037                }
2038                return myReason;
2039        }
2040
2041        /**
2042         * Sets the value(s) for <b>reason</b> ()
2043         *
2044     * <p>
2045     * <b>Definition:</b>
2046     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2047     * </p> 
2048         */
2049        public Substitution setReason(java.util.List<CodeableConceptDt> theValue) {
2050                myReason = theValue;
2051                return this;
2052        }
2053        
2054        
2055
2056        /**
2057         * Adds and returns a new value for <b>reason</b> ()
2058         *
2059     * <p>
2060     * <b>Definition:</b>
2061     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2062     * </p> 
2063         */
2064        public CodeableConceptDt addReason() {
2065                CodeableConceptDt newType = new CodeableConceptDt();
2066                getReason().add(newType);
2067                return newType; 
2068        }
2069
2070        /**
2071         * Adds a given new value for <b>reason</b> ()
2072         *
2073         * <p>
2074         * <b>Definition:</b>
2075         * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2076         * </p>
2077         * @param theValue The reason to add (must not be <code>null</code>)
2078         */
2079        public Substitution addReason(CodeableConceptDt theValue) {
2080                if (theValue == null) {
2081                        throw new NullPointerException("theValue must not be null");
2082                }
2083                getReason().add(theValue);
2084                return this;
2085        }
2086
2087        /**
2088         * Gets the first repetition for <b>reason</b> (),
2089         * creating it if it does not already exist.
2090         *
2091     * <p>
2092     * <b>Definition:</b>
2093     * Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.
2094     * </p> 
2095         */
2096        public CodeableConceptDt getReasonFirstRep() {
2097                if (getReason().isEmpty()) {
2098                        return addReason();
2099                }
2100                return getReason().get(0); 
2101        }
2102  
2103        /**
2104         * Gets the value(s) for <b>responsibleParty</b> ().
2105         * creating it if it does
2106         * not exist. Will not return <code>null</code>.
2107         *
2108     * <p>
2109     * <b>Definition:</b>
2110     * The person or organization that has primary responsibility for the substitution
2111     * </p> 
2112         */
2113        public java.util.List<ResourceReferenceDt> getResponsibleParty() {  
2114                if (myResponsibleParty == null) {
2115                        myResponsibleParty = new java.util.ArrayList<ResourceReferenceDt>();
2116                }
2117                return myResponsibleParty;
2118        }
2119
2120        /**
2121         * Sets the value(s) for <b>responsibleParty</b> ()
2122         *
2123     * <p>
2124     * <b>Definition:</b>
2125     * The person or organization that has primary responsibility for the substitution
2126     * </p> 
2127         */
2128        public Substitution setResponsibleParty(java.util.List<ResourceReferenceDt> theValue) {
2129                myResponsibleParty = theValue;
2130                return this;
2131        }
2132        
2133        
2134
2135        /**
2136         * Adds and returns a new value for <b>responsibleParty</b> ()
2137         *
2138     * <p>
2139     * <b>Definition:</b>
2140     * The person or organization that has primary responsibility for the substitution
2141     * </p> 
2142         */
2143        public ResourceReferenceDt addResponsibleParty() {
2144                ResourceReferenceDt newType = new ResourceReferenceDt();
2145                getResponsibleParty().add(newType);
2146                return newType; 
2147        }
2148  
2149
2150
2151        }
2152
2153
2154
2155
2156    @Override
2157    public String getResourceName() {
2158        return "MedicationDispense";
2159    }
2160    
2161    public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() {
2162        return ca.uhn.fhir.context.FhirVersionEnum.DSTU2;
2163    }
2164
2165
2166}