public static string GetSpecimenBarcode(Bundle orderResponse) { var component = orderResponse.Entry.FirstOrDefault(x => x.Resource is Order); var order = (Order)component.Resource; var diagnosticOrder = FhirResourceHelper.Read <DiagnosticOrder>(order.Detail.FirstOrDefault().Reference); var specRef = diagnosticOrder.Specimen.FirstOrDefault().With(x => x.Reference); var spec = FhirResourceHelper.Read <Specimen>(specRef); return(spec.Container.FirstOrDefault().Identifier.FirstOrDefault().Value); }
public static List <Tuple <string, string> > GetOrderCodes(Bundle orderResponse) { var barcode = GetSpecimenBarcode(orderResponse); var order = GetOrderByBarcode(barcode); var organizarion = FhirResourceHelper.Read <Organization>(order.Target.Reference); return(new List <Tuple <string, string> > { new Tuple <string, string>(organizarion.Identifier.First().Value, barcode), }); }
public static Tuple <string, string> GetResultCodes(Order order) { var orderMisId = order.Identifier .FirstOrDefault() .If(x => x.System == "http://netrika.ru") .With(x => x.Value); var targetOrganization = FhirResourceHelper.Read <Organization>(order.Target.Reference); var targetCode = targetOrganization.Identifier.First().Value; return(new Tuple <string, string>(targetCode, orderMisId)); }