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