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