public static Bundle CreateLabResultForOrder(Order order) { var resultOrganization = order.Target; var practitioner1 = FhirResourceHelper.GetPractitioner(resultOrganization); var practitioner2 = FhirResourceHelper.GetPractitioner(resultOrganization); var reportPractitioner = FhirResourceHelper.GetPractitioner(resultOrganization); var observation1 = FhirResourceHelper.GetObservation(practitioner1); var observation2 = FhirResourceHelper.GetObservation(practitioner2); var diagnosticReport = FhirResourceHelper.GetDiagnosticReport(order.Subject, reportPractitioner, observation1, observation2, order.Detail.First()); var orderResponse = FhirResourceHelper.GetOrderResponse(order, new[] { diagnosticReport }); var lisResultBundle = new Bundle { Meta = new Meta { Profile = new List <string> { Constants.LisResultStructureDefinitionReference }, }, Type = Bundle.BundleType.Transaction, Entry = new List <Bundle.BundleEntryComponent> { new Bundle.BundleEntryComponent { Resource = orderResponse, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = orderResponse.TypeName, } }, new Bundle.BundleEntryComponent { Resource = practitioner1, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = practitioner1.TypeName, } }, new Bundle.BundleEntryComponent { Resource = practitioner2, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = practitioner2.TypeName, } }, new Bundle.BundleEntryComponent { Resource = reportPractitioner, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = reportPractitioner.TypeName, } }, new Bundle.BundleEntryComponent { Resource = diagnosticReport, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = diagnosticReport.TypeName, } }, new Bundle.BundleEntryComponent { Resource = observation1, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = observation1.TypeName, } }, new Bundle.BundleEntryComponent { Resource = observation2, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = observation2.TypeName, } }, } }; return(lisResultBundle); }