コード例 #1
0
ファイル: ResultPdfHelper.cs プロジェクト: sahvishal/matrix
        public void SetFindingsVertical <T>(HtmlDocument doc, StandardFinding <T> findingInDb, IEnumerable <StandardFinding <T> > findingsCollection, string containerId)
        {
            if (findingsCollection == null || !findingsCollection.Any())
            {
                return;
            }

            string htmlRows = "";

            foreach (var standardFinding in findingsCollection)
            {
                string rowString = "<tr><td> <input type='checkbox' /> </td>";
                if (findingInDb != null && findingInDb.Id == standardFinding.Id)
                {
                    rowString = "<tr><td> <input type='checkbox' checked='checked' /> </td>";
                }
                rowString += "<td> " + standardFinding.Label + " " + standardFinding.Description.Replace("<", "&lt;").Replace(">", "&gt;") + "</td></tr>";
                htmlRows   = htmlRows + rowString;
            }

            var selectedNode = doc.DocumentNode.SelectSingleNode("//table[@id='" + containerId + "']");

            if (selectedNode != null)
            {
                selectedNode.InnerHtml = htmlRows;
            }
        }
コード例 #2
0
 protected override void MapEntityFields(StandardFinding <T> domainObject,
                                         StandardFindingEntity entityToMapTo)
 {
     entityToMapTo.StandardFindingId = (int)domainObject.Id;
     entityToMapTo.Label             = domainObject.Label;
     entityToMapTo.Description       = domainObject.Description;
     //entityToMapTo.MinValue = domainObject.MinValue;
     //entityToMapTo.MaxValue = domainObject.MaxValue;
 }
コード例 #3
0
ファイル: ResultPdfHelper.cs プロジェクト: sahvishal/matrix
        public void SetFindingsHorizontal <T>(HtmlDocument doc, StandardFinding <T> findingInDb, IEnumerable <StandardFinding <T> > findingsCollection, string containerId, int colSpecified = 0)
        {
            if (findingsCollection == null || !findingsCollection.Any())
            {
                return;
            }

            string htmlRows = "";
            int    counter  = 0;

            foreach (var standardFinding in findingsCollection)
            {
                string rowString = "<td>";
                if (colSpecified != 0 && counter % colSpecified == 0)
                {
                    rowString = "<tr><td>";
                }

                if (findingInDb != null && findingInDb.Id == standardFinding.Id)
                {
                    rowString += "<input type='checkbox' checked='checked' /> " + standardFinding.Label;
                }
                else
                {
                    rowString += "<input type='checkbox' /> " + standardFinding.Label;
                }

                if (colSpecified != 0 && counter % colSpecified == (colSpecified - 1))
                {
                    rowString += "</td></tr>";
                }
                else
                {
                    rowString += "</td>";
                }

                htmlRows = htmlRows + rowString;
                counter++;
            }

            if (colSpecified == 0)
            {
                htmlRows = "<tr>" + htmlRows + "</tr>";
            }
            else if (colSpecified != 0 && counter % colSpecified == (colSpecified - 1))
            {
                htmlRows += "</td></tr>";
            }

            var selectedNode = doc.DocumentNode.SelectSingleNode("//table[@id='" + containerId + "']");

            if (selectedNode != null)
            {
                selectedNode.InnerHtml = htmlRows;
            }
        }
コード例 #4
0
ファイル: ResultPdfHelper.cs プロジェクト: sahvishal/matrix
        public void SetSummaryFindings <T>(HtmlDocument doc, StandardFinding <T> findingInDb, IEnumerable <StandardFinding <T> > findingsCollection, string containerId, string descriptionboxid = "", StandardFinding <T> findingForLongDescription = null, bool isTestPurchased = true, UnableScreenReason unableScreenReason = null, bool showAdditionalImagesNeeded = false, bool showConsiderOtherModalities = false)
        {
            string htmlRows        = "";
            string longdescription = "";

            foreach (var standardFinding in findingsCollection)
            {
                string rowString = "<input type='checkbox' /> " + standardFinding.Label;
                if (findingInDb != null && findingInDb.Id == standardFinding.Id)
                {
                    rowString       = "<input type='checkbox' checked='checked' /> " + standardFinding.Label;
                    longdescription = standardFinding.LongDescription;
                }
                htmlRows = htmlRows + rowString;
            }

            var selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='" + containerId + "']");

            if (selectedNode != null)
            {
                selectedNode.InnerHtml = htmlRows;
            }

            if (showAdditionalImagesNeeded)
            {
                longdescription = "<i>" + LongDescriptionAdditionalImagesNeeded + "</i>";
            }
            else if (showConsiderOtherModalities)
            {
                longdescription = "<i>" + LongDescriptionConsiderOtherModalities + "</i>";
            }
            else if (unableScreenReason != null)
            {
                longdescription = string.IsNullOrEmpty(unableScreenReason.Description) ? "<i>" + LongDescriptionFortestnotScreened + "</i>" : unableScreenReason.Description;
            }
            else if (findingForLongDescription != null && !string.IsNullOrEmpty(findingForLongDescription.LongDescription))
            {
                longdescription = findingForLongDescription.LongDescription;
            }
            else if (!isTestPurchased)
            {
                longdescription = "<i>" + LongDescriptionFortestnotPurchased + "</i>";
            }

            if (!string.IsNullOrEmpty(descriptionboxid) && !string.IsNullOrEmpty(longdescription))
            {
                selectedNode = doc.DocumentNode.SelectSingleNode("//p[@id='" + descriptionboxid + "']");
                if (selectedNode != null)
                {
                    selectedNode.InnerHtml = longdescription;
                }
            }
        }
コード例 #5
0
        public StandardFindingEntity CreateStandardFinding <T>(StandardFinding <T> standardFinding)
        {
            if (standardFinding == null)
            {
                throw new ArgumentNullException("standardFinding", "Standard Finding must be provided.");
            }

            var standardFindingEntity = new StandardFindingEntity((int)standardFinding.Id)
            {
                Label       = standardFinding.Label,
                Description = standardFinding.Description
            };

            return(standardFindingEntity);
        }
コード例 #6
0
        private static StandardFinding <decimal> GetFindingToConsider(StandardFinding <decimal> leftResultFinding, StandardFinding <decimal> rightResultFinding)
        {
            if (rightResultFinding != null && leftResultFinding != null)
            {
                if (rightResultFinding.WorstCaseOrder >= leftResultFinding.WorstCaseOrder)
                {
                    return(rightResultFinding);
                }
                return(leftResultFinding);
            }

            if (rightResultFinding != null)
            {
                return(rightResultFinding);
            }

            return(leftResultFinding);
        }
コード例 #7
0
ファイル: LabReportParser.cs プロジェクト: sahvishal/matrix
        private StandardFinding <int> GetIFOBTFinding(DataTable dtRawDataTable, long eventId, long customerId, TestType testTypeId, string fileName, List <StandardFinding <decimal?> > standardFinding)
        {
            var     finding    = new StandardFinding <int>();
            decimal intFinding = 0;

            if (dtRawDataTable != null && dtRawDataTable.Rows.Count() > 0)
            {
                var dt = dtRawDataTable.Select("PatientID='" + customerId + "' AND EventID='" + eventId + "' AND Test_Alias='" + testTypeId + "' AND IsParse=false");

                if (!dt.Any())
                {
                    _labParseEventLogger.Info("Record not found from Text file for CustomerId: " + customerId + ", EventId: " + eventId + ", Test Type: " + testTypeId + " and pdf file name is " + fileName);
                    _loggerForClient.Info("Record not found from Text file for CustomerId: " + customerId + ", EventId: " + eventId + ", Test Type: " + testTypeId + " and pdf file name is " + fileName);
                }
                else
                {
                    string summaryFinding = dt.Any() ? Convert.ToString(dt[dt.Length - 1]["Result"]) : string.Empty;
                    if (summaryFinding.IsNullOrEmpty())
                    {
                        _labParseEventLogger.Info("PDF file(" + fileName + "): Test result not found for Customer Id :" + customerId + " Test: " + testTypeId + "and text file name is " + Convert.ToString(dt[0]["FileName"]));
                        _loggerForClient.Info("PDF file(" + fileName + "): Test result not found for Customer Id :" + customerId + " Test: " + testTypeId + "and text file name is " + Convert.ToString(dt[0]["FileName"]));
                    }
                    summaryFinding = summaryFinding.ToLower();
                    var query = standardFinding.Where(x => x.Label.ToLower() == summaryFinding).Select(x => x.Id);

                    if (query != null && query.Any())
                    {
                        intFinding = query.First();
                    }
                    if (intFinding == 0)
                    {
                        _labParseEventLogger.Info("PDF file(" + fileName + "): Test result format is not correct for Customer Id :" + customerId + " Test: " + testTypeId + "and text file name is " + Convert.ToString(dt[0]["FileName"]));
                        _loggerForClient.Info("PDF file(" + fileName + "): Test result format is not correct for Customer Id :" + customerId + " Test: " + testTypeId + "and text file name is " + Convert.ToString(dt[0]["FileName"]));
                    }
                    finding = new StandardFinding <int>(Convert.ToInt32(intFinding));
                    foreach (var dr in dt)
                    {
                        dr["IsParse"] = true;
                    }
                }
            }
            return(finding);
        }
コード例 #8
0
ファイル: ResultPdfHelper.cs プロジェクト: sahvishal/matrix
        public void SetFindingsDropdown <T>(HtmlDocument doc, StandardFinding <T> findingInDb, IEnumerable <StandardFinding <T> > findingsCollection, string containerId)
        {
            if (findingsCollection == null || !findingsCollection.Any())
            {
                return;
            }

            var selectedNode = doc.DocumentNode.SelectSingleNode("//input[@id='" + containerId + "']");

            if (selectedNode != null)
            {
                foreach (var standardFinding in findingsCollection)
                {
                    if (findingInDb != null && findingInDb.Id == standardFinding.Id)
                    {
                        selectedNode.SetAttributeValue("value", standardFinding.Label);
                    }
                }
            }
        }
コード例 #9
0
        private void LoadPadFindings(HtmlDocument doc, StandardFinding <decimal> finding, IEnumerable <StandardFinding <decimal> > standardFindingList, long findingIdForLongDescription = 0, bool isTestPurchased = true, UnableScreenReason unableScreenReason = null)
        {
            if (standardFindingList == null)
            {
                standardFindingList = _standardFindingRepository.GetAllStandardFindings <decimal>((int)TestType.PAD);
            }

            //if (standardFindingList.Count() > 0 && standardFindingList.First().WorstCaseOrder > 0)
            //{
            //    standardFindingList = standardFindingList.OrderBy(f => f.WorstCaseOrder).ToList();
            //}
            standardFindingList = standardFindingList.OrderBy(f => f.Id).ToList();
            StandardFinding <decimal> findingForLongDescription = null;

            if (findingIdForLongDescription > 0)
            {
                findingForLongDescription =
                    standardFindingList.Where(sf => sf.Id == findingIdForLongDescription).SingleOrDefault();
            }

            if (finding != null)
            {
                var stdFinding = standardFindingList.Where(f => f.Id == finding.Id).Single();

                var selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='pad-rpp-resultspan']");
                if (selectedNode != null)
                {
                    selectedNode.InnerHtml = stdFinding.Label;
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='docletter-abi']");
                if (stdFinding.ResultInterpretation != null && stdFinding.ResultInterpretation.Value != (long)ResultInterpretation.Normal && selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }
            }

            _resultPdfHelper.SetSummaryFindings(doc, finding, standardFindingList, "FindingsPadDiv", "longdescription-pad", findingForLongDescription, isTestPurchased, unableScreenReason);
            _resultPdfHelper.SetFindingsVertical(doc, finding, standardFindingList, "padFinding");
        }
コード例 #10
0
 protected override void MapDomainFields(StandardFindingEntity entity,
                                         StandardFinding <T> domainObjectToMapTo)
 {
     domainObjectToMapTo.Id          = entity.StandardFindingId;
     domainObjectToMapTo.Label       = entity.Label;
     domainObjectToMapTo.Description = entity.Description;
     if (typeof(T) == typeof(int?))
     {
         int returnValue;
         if (entity.MinValue.HasValue)
         {
             returnValue = decimal.ToInt32(entity.MinValue.Value);
             domainObjectToMapTo.MinValue = (T)Convert.ChangeType(returnValue, typeof(int));
         }
         else
         {
             domainObjectToMapTo.MinValue = default(T);
         }
         if (entity.MaxValue.HasValue)
         {
             returnValue = decimal.ToInt32(entity.MaxValue.Value);
             domainObjectToMapTo.MaxValue = (T)Convert.ChangeType(returnValue, typeof(int));
         }
         else
         {
             domainObjectToMapTo.MaxValue = default(T);
         }
     }
     else if (typeof(T) == typeof(decimal?))
     {
         domainObjectToMapTo.MinValue = entity.MinValue.HasValue
             ? (T)Convert.ChangeType(entity.MinValue, typeof(decimal))
             : default(T);
         domainObjectToMapTo.MaxValue = entity.MaxValue.HasValue
             ? (T)Convert.ChangeType(entity.MaxValue, typeof(decimal))
             : default(T);
     }
 }
コード例 #11
0
        private void LoadAwvEkgFindings(HtmlDocument doc, StandardFinding <int?> finding, bool isTestPurchased = true, UnableScreenReason unableScreenReason = null)
        {
            var standardFindingList = _standardFindingRepository.GetAllStandardFindings <int?>(Convert.ToInt32(TestType.AwvEkg));

            if (finding != null)
            {
                var stdFinding = standardFindingList.Single(f => f.Id == finding.Id);

                var selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='AwvEkg-rpp-resultspan']");
                if (selectedNode != null)
                {
                    selectedNode.InnerHtml = stdFinding.Label;
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='docletter-AwvEkg']");
                if (stdFinding.ResultInterpretation != null && stdFinding.ResultInterpretation.Value != (long)ResultInterpretation.Normal && selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }
            }

            _resultPdfHelper.SetSummaryFindings(doc, finding, standardFindingList, "FindingsAwvEkgDiv", "longdescription-AwvEkg", null, isTestPurchased, unableScreenReason);
            _resultPdfHelper.SetFindingsHorizontal(doc, finding, standardFindingList, "AwvEkgFinding");
        }
コード例 #12
0
        public override TestResult CreateActualTestResult(CustomerEventScreeningTestsEntity customerEventScreeningTestEntity)
        {
            var customerEventReadingEntities = customerEventScreeningTestEntity.CustomerEventReading.ToList();
            var testResult = new AwvEkgIppeTestResult(customerEventScreeningTestEntity.CustomerEventScreeningTestId);

            if (customerEventScreeningTestEntity.TestMedia != null && customerEventScreeningTestEntity.TestMedia.Count > 0)
            {
                var fileEntityCollection = customerEventScreeningTestEntity.FileCollectionViaTestMedia.ToList();
                var testMediaEntity      = customerEventScreeningTestEntity.TestMedia.FirstOrDefault();
                testResult.ResultImage = new ResultMedia(testMediaEntity.MediaId);

                testResult.ResultImage.File      = GetFileObjectfromEntity(testMediaEntity.FileId, fileEntityCollection);
                testResult.ResultImage.Thumbnail = testMediaEntity.ThumbnailFileId != null ? new File(testMediaEntity.ThumbnailFileId.Value) : null;

                if (testMediaEntity.IsManual)
                {
                    testResult.ResultImage.ReadingSource = ReadingSource.Manual;
                }
                else
                {
                    testResult.ResultImage.ReadingSource = ReadingSource.Automatic;
                }
            }

            var customerEventTestStandardFindingEntities = customerEventScreeningTestEntity.CustomerEventTestStandardFinding.ToList();

            var testResultService    = new TestResultService();
            var standardFindings     = testResultService.GetAllStandardFindings <int?>((int)TestType.AwvEkgIPPE);
            var bundleBranchFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.AwvEkgIPPE, (int)ReadingLabels.BundleBranchBlock);
            var infarctionFindings   = testResultService.GetAllStandardFindings <int?>((int)TestType.AwvEkgIPPE, (int)ReadingLabels.InfarctionPattern);

            var standardFindingTestReadingEntities =
                customerEventScreeningTestEntity.
                StandardFindingTestReadingCollectionViaCustomerEventTestStandardFinding.ToList();

            customerEventTestStandardFindingEntities.ForEach(customerEventTestStandardFindingEntity =>
            {
                var standardFindingTestReadingEntity = standardFindingTestReadingEntities.Find(entity => entity.StandardFindingTestReadingId == customerEventTestStandardFindingEntity.StandardFindingTestReadingId);
                if (standardFindingTestReadingEntity == null)
                {
                    return;
                }

                var standardFindingEntity = standardFindings.ToList().FindAll(standardFinding => standardFinding.Id == standardFindingTestReadingEntity.StandardFindingId).FirstOrDefault();
                if (standardFindingEntity != null)
                {
                    testResult.Finding = new StandardFinding <int?>(standardFindingEntity.Id)
                    {
                        CustomerEventStandardFindingId =
                            customerEventTestStandardFindingEntity.
                            CustomerEventTestStandardFindingId,
                        Label =
                            standardFindingEntity.Label,
                        MaxValue = Convert.ToInt32(standardFindingEntity.MaxValue),
                        MinValue = Convert.ToInt32(standardFindingEntity.MinValue)
                    };
                    return;
                }

                standardFindingEntity = bundleBranchFindings.ToList().FindAll(standardFinding => standardFinding.Id == standardFindingTestReadingEntity.StandardFindingId).FirstOrDefault();
                if (standardFindingEntity != null)
                {
                    var finding = new StandardFinding <int>(standardFindingEntity.Id)
                    {
                        CustomerEventStandardFindingId =
                            customerEventTestStandardFindingEntity.
                            CustomerEventTestStandardFindingId,
                        Label =
                            standardFindingEntity.Label,
                        MaxValue = Convert.ToInt32(standardFindingEntity.MaxValue),
                        MinValue = Convert.ToInt32(standardFindingEntity.MinValue)
                    };
                    if (testResult.BundleBranchBlockFinding == null)
                    {
                        testResult.BundleBranchBlockFinding = new List <StandardFinding <int> >();
                    }
                    testResult.BundleBranchBlockFinding.Add(finding);
                    return;
                }

                standardFindingEntity = infarctionFindings.ToList().FindAll(standardFinding => standardFinding.Id == standardFindingTestReadingEntity.StandardFindingId).FirstOrDefault();
                if (standardFindingEntity != null)
                {
                    var finding = new StandardFinding <int>(standardFindingEntity.Id)
                    {
                        CustomerEventStandardFindingId =
                            customerEventTestStandardFindingEntity.
                            CustomerEventTestStandardFindingId,
                        Label =
                            standardFindingEntity.Label,
                        MaxValue = Convert.ToInt32(standardFindingEntity.MaxValue),
                        MinValue = Convert.ToInt32(standardFindingEntity.MinValue)
                    };
                    if (testResult.InfarctionPatternFinding == null)
                    {
                        testResult.InfarctionPatternFinding = new List <StandardFinding <int> >();
                    }
                    testResult.InfarctionPatternFinding.Add(finding);
                    return;
                }
            });


            testResult.PRInterval  = CreateResultReadingforNullableDecimal((int)ReadingLabels.PRInterval, customerEventReadingEntities);
            testResult.QRSDuration = CreateResultReadingforNullableDecimal((int)ReadingLabels.QRSDuration, customerEventReadingEntities);
            testResult.QTcInterval = CreateResultReadingforNullableDecimal((int)ReadingLabels.QTcInterval, customerEventReadingEntities);

            testResult.PRTAxis          = new PRTAxis();
            testResult.PRTAxis.PFront   = CreateResultReadingforNullableInt((int)ReadingLabels.PRTAxisPFront, customerEventReadingEntities);
            testResult.PRTAxis.QRSFront = CreateResultReadingforNullableInt((int)ReadingLabels.PRTAxisQRSFront, customerEventReadingEntities);
            testResult.PRTAxis.TFront   = CreateResultReadingforNullableInt((int)ReadingLabels.PRTAxisTFront, customerEventReadingEntities);

            testResult.QTDispersion = CreateResultReadingforNullableInt((int)ReadingLabels.QTDispersion, customerEventReadingEntities);
            testResult.QTInterval   = CreateResultReadingforNullableDecimal((int)ReadingLabels.QTInterval, customerEventReadingEntities);
            testResult.RRInterval   = CreateResultReadingforNullableInt((int)ReadingLabels.RRInterval, customerEventReadingEntities);
            testResult.VentRate     = CreateResultReadingforNullableInt((int)ReadingLabels.VentRate, customerEventReadingEntities);

            testResult.SinusRythm         = CreateResultReading((int)ReadingLabels.SinusRythm, customerEventReadingEntities);
            testResult.SinusArrythmia     = CreateResultReading((int)ReadingLabels.SinusArrythmia, customerEventReadingEntities);
            testResult.SinusBradycardia   = CreateResultReading((int)ReadingLabels.SinusBradycardia, customerEventReadingEntities);
            testResult.Mild               = CreateResultReading((int)ReadingLabels.Mild, customerEventReadingEntities);
            testResult.Marked             = CreateResultReading((int)ReadingLabels.Marked, customerEventReadingEntities);
            testResult.SinusTachycardia   = CreateResultReading((int)ReadingLabels.SinusTachycardia, customerEventReadingEntities);
            testResult.AtrialFibrillation = CreateResultReading((int)ReadingLabels.AtrialFibrillation, customerEventReadingEntities);
            testResult.AtrialFlutter      = CreateResultReading((int)ReadingLabels.AtrialFlutter, customerEventReadingEntities);
            testResult.SVT                           = CreateResultReading((int)ReadingLabels.SVT, customerEventReadingEntities);
            testResult.PACs                          = CreateResultReading((int)ReadingLabels.PACs, customerEventReadingEntities);
            testResult.PVCs                          = CreateResultReading((int)ReadingLabels.PVCs, customerEventReadingEntities);
            testResult.QRSWidening                   = CreateResultReading((int)ReadingLabels.QRSWidening, customerEventReadingEntities);
            testResult.LeftAxis                      = CreateResultReading((int)ReadingLabels.LeftAxis, customerEventReadingEntities);
            testResult.RightAxis                     = CreateResultReading((int)ReadingLabels.RightAxis, customerEventReadingEntities);
            testResult.AbnormalAxis                  = CreateResultReading((int)ReadingLabels.AbnormalAxis, customerEventReadingEntities);
            testResult.Left                          = CreateResultReading((int)ReadingLabels.Left, customerEventReadingEntities);
            testResult.Right                         = CreateResultReading((int)ReadingLabels.Right, customerEventReadingEntities);
            testResult.HeartBlock                    = CreateResultReading((int)ReadingLabels.HeartBlock, customerEventReadingEntities);
            testResult.TypeI                         = CreateResultReading((int)ReadingLabels.TypeI, customerEventReadingEntities);
            testResult.TypeII                        = CreateResultReading((int)ReadingLabels.TypeII, customerEventReadingEntities);
            testResult.FirstDegreeBlock              = CreateResultReading((int)ReadingLabels.FirstDegreeBlock, customerEventReadingEntities);
            testResult.SecondDegreeBlock             = CreateResultReading((int)ReadingLabels.SecondDegreeBlock, customerEventReadingEntities);
            testResult.ThirdDegreeCompleteHeartBlock = CreateResultReading((int)ReadingLabels.ThirdDegreeCompleteHeartBlock, customerEventReadingEntities);
            testResult.Artifact                      = CreateResultReading((int)ReadingLabels.Artifact, customerEventReadingEntities);

            testResult.BundleBranchBlock           = CreateResultReading((int)ReadingLabels.BundleBranchBlock, customerEventReadingEntities);
            testResult.LeftAnteriorFasicularBlock  = CreateResultReading((int)ReadingLabels.LeftAnteriorFasicularBlock, customerEventReadingEntities);
            testResult.VentricularHypertrophy      = CreateResultReading((int)ReadingLabels.VentricularHypertrophy, customerEventReadingEntities);
            testResult.LeftVentricularHypertrophy  = CreateResultReading((int)ReadingLabels.LeftVHypertrophy, customerEventReadingEntities);
            testResult.RightVentricularHypertrophy = CreateResultReading((int)ReadingLabels.RightVHypertrophy, customerEventReadingEntities);
            testResult.ProlongedQTInterval         = CreateResultReading((int)ReadingLabels.ProlongedQTInterval, customerEventReadingEntities);
            testResult.IschemicSTTChanges          = CreateResultReading((int)ReadingLabels.IschemicSTTChanges, customerEventReadingEntities);
            testResult.NonSpecificSTTChanges       = CreateResultReading((int)ReadingLabels.NonSpecificSTTChanges, customerEventReadingEntities);
            testResult.PoorRWaveProgression        = CreateResultReading((int)ReadingLabels.PoorRWaveProgression, customerEventReadingEntities);
            testResult.InfarctionPattern           = CreateResultReading((int)ReadingLabels.InfarctionPattern, customerEventReadingEntities);
            testResult.AtypicalQWaveLead           = CreateResultReading((int)ReadingLabels.AtypicalQWaveLead, customerEventReadingEntities);
            testResult.AtrialEnlargement           = CreateResultReading((int)ReadingLabels.AtrialEnlargement, customerEventReadingEntities);
            testResult.LeftAtrialEnlargement       = CreateResultReading((int)ReadingLabels.LeftAtrialEnlargment, customerEventReadingEntities);
            testResult.RightAtrialEnlargement      = CreateResultReading((int)ReadingLabels.RightAtrialEnlargment, customerEventReadingEntities);
            testResult.RepolarizationVariant       = CreateResultReading((int)ReadingLabels.RepolarizationVariant, customerEventReadingEntities);
            testResult.PacerRythm = CreateResultReading((int)ReadingLabels.PacerRythm, customerEventReadingEntities);
            testResult.SupraventricularArrythmia = CreateResultReading((int)ReadingLabels.SupraventricularArrythmia, customerEventReadingEntities);

            testResult.ReversedLeads = CreateResultReading((int)ReadingLabels.ReversedLeads, customerEventReadingEntities);
            testResult.RepeatStudy   = CreateResultReading((int)ReadingLabels.RepeatStudy, customerEventReadingEntities);
            testResult.ComparetoEkg  = CreateResultReading((int)ReadingLabels.ComparetoEkg, customerEventReadingEntities);

            testResult.LowVoltage      = CreateResultReading((int)ReadingLabels.LowVoltage, customerEventReadingEntities);
            testResult.LimbLeads       = CreateResultReading((int)ReadingLabels.LimbLeads, customerEventReadingEntities);
            testResult.PrecordialLeads = CreateResultReading((int)ReadingLabels.PrecordialLeads, customerEventReadingEntities);

            return(testResult);
        }
コード例 #13
0
ファイル: LabReportParser.cs プロジェクト: sahvishal/matrix
        private List <EventCustomerScreeningAggregate> SaveResultWithoutMedia(List <EventCustomerScreeningAggregate> eventCustomerAggregates, DataTable dtRawDataTable, List <StandardFinding <decimal?> > standardFinding)
        {
            try
            {
                foreach (DataRow dr in dtRawDataTable.Rows)
                {
                    long     intFinding     = 0;
                    long     customerId     = 0;
                    long     eventId        = 0;
                    string   summaryFinding = string.Empty;
                    string   txtFileName    = string.Empty;
                    TestType testTypeId;
                    StandardFinding <int> finding = new StandardFinding <int>();
                    if (!ValidateDataTable(dr, out txtFileName, out eventId, out customerId, out testTypeId, out summaryFinding))
                    {
                        continue;
                    }
                    if (testTypeId == TestType.UrineMicroalbumin)
                    {
                        ResultReading <string> microAlbuminValue = new ResultReading <string>()
                        {
                            Label            = ReadingLabels.MicroalbuminValue,
                            Reading          = summaryFinding,
                            RecorderMetaData = new DataRecorderMetaData(UploadedBy, DateTime.Now, null),
                            ReadingSource    = ReadingSource.Automatic
                        };

                        TestResult testResult = new UrineMicroalbuminTestResult {
                            MicroalbuminValue = microAlbuminValue
                        };
                        _resultParserHelper.AddTestResulttoEventCustomerAggregate(eventCustomerAggregates, eventId, customerId, testResult);
                        _resultParserHelper.AddResultArchiveLog(string.Empty, TestType.UrineMicroalbumin, customerId, MedicalEquipmentTag.LabReportParser);
                    }
                    else if (testTypeId == TestType.IFOBT)
                    {
                        summaryFinding = summaryFinding.ToLower();
                        var query = standardFinding.Where(x => x.Label.ToLower() == summaryFinding).Select(x => x.Id);
                        if (query != null && query.Count() > 0)
                        {
                            intFinding = query.First();
                        }
                        if (intFinding == 0)
                        {
                            _labParseEventLogger.Info("file(" + txtFileName + "): Test result format is not correct for Customer Id :" + customerId + ",EventId :" + eventId + " and Test: " + testTypeId);
                            _loggerForClient.Info("file(" + txtFileName + "): Test result format is not correct for Customer Id :" + customerId + ",EventId :" + eventId + " and Test: " + testTypeId);
                            continue;
                        }
                        finding = new StandardFinding <int>(Convert.ToInt32(intFinding));

                        TestResult testResult = new IFOBTTestResult {
                            Finding = finding
                        };
                        _resultParserHelper.AddTestResulttoEventCustomerAggregate(eventCustomerAggregates, eventId, customerId, testResult);
                        _resultParserHelper.AddResultArchiveLog(string.Empty, TestType.IFOBT, customerId, MedicalEquipmentTag.LabReportParser);
                    }
                    else
                    {
                        var message = "file(" + txtFileName + "): Test(" + testTypeId + ") is an invalid test for parsing for Customer Id :" + customerId + ",EventId :" + eventId;
                        _labParseEventLogger.Info(message);
                        _loggerForClient.Info(message);
                        continue;
                    }

                    _labParseEventLogger.Info(string.Concat("file(" + txtFileName + "): Result saved successfully for Customer Id: ", customerId, " ,Event Id: ", eventId, " and Test :", testTypeId, "\n"));
                    _loggerForClient.Info(string.Concat("file(" + txtFileName + "): Result saved successfully for Customer Id: ", customerId, " ,Event Id: ", eventId, " and Test :", testTypeId, "\n"));
                }
            }
            catch (Exception ex)
            {
                _labParseEventLogger.Info("\nText File: Issue on data saving. Exception: " + ex.Message + "  \n");
                _loggerForClient.Info("\nText File: Issue on data saving.Please contact to Administrator \n");
            }
            return(eventCustomerAggregates);
        }
コード例 #14
0
        private void LoadAwvAaaFindings(HtmlDocument doc, long eventId, long customerId, StandardFinding <decimal?> finding = null, IEnumerable <StandardFinding <int> > aortaRangeSaggitalView = null, IEnumerable <StandardFinding <int> > aortaRangeTransverseView = null, decimal?maxAortaSize = null, bool isTestPurchased = true, UnableScreenReason unableScreenReason = null, IEnumerable <StandardFinding <int> > peakSystolicVelocityStandardFindings = null)
        {
            List <StandardFinding <decimal?> > standardFindingList;

            if (_settings.AwvAaaFindingChangeDate.HasValue)
            {
                var eventCustomerResult = _eventCustomerResultRepository.GetByCustomerIdAndEventId(customerId, eventId);
                if (eventCustomerResult != null && eventCustomerResult.DataRecorderMetaData.DateCreated < _settings.AwvAaaFindingChangeDate.Value)
                {
                    standardFindingList = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.AwvAAA, (int)ReadingLabels.AortaSize, _settings.AwvAaaFindingChangeDate.Value, true);
                }
                else
                {
                    standardFindingList = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.AwvAAA, (int)ReadingLabels.AortaSize, _settings.AwvAaaFindingChangeDate.Value, false);
                }
            }
            else
            {
                standardFindingList = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.AwvAAA, (int)ReadingLabels.AortaSize);
            }


            StandardFinding <decimal?> findingForLongDescription = null;

            if (maxAortaSize.HasValue)
            {
                var findingId = _testResultService.GetCalculatedStandardFinding(eventId, customerId, maxAortaSize, (int)TestType.AwvAAA, (int)ReadingLabels.AortaSize);
                if (findingId > 0)
                {
                    findingForLongDescription = standardFindingList.SingleOrDefault(sf => sf.Id == findingId);
                }
            }

            _resultPdfHelper.SetSummaryFindings(doc, finding, standardFindingList, "FindingsAwvAaaDiv", "long-description-AwvAaa", findingForLongDescription, isTestPurchased, unableScreenReason);
            _resultPdfHelper.SetFindingsVertical(doc, finding, standardFindingList, "AwvAaaFinding");

            if (finding != null)
            {
                var stdFinding = standardFindingList.Single(f => f.Id == finding.Id);

                var selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='AwvAaa-rpp-resultspan']");
                if (selectedNode != null)
                {
                    selectedNode.InnerHtml = stdFinding.Label;
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='docletter-AwvAaa']");
                if (stdFinding.ResultInterpretation != null && stdFinding.ResultInterpretation.Value != (long)ResultInterpretation.Normal && selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }
            }

            var sViewStandardFindingList = _standardFindingRepository.GetAllStandardFindings <int>((int)TestType.AwvAAA, (int)ReadingLabels.AortaRangeSaggitalView);

            _resultPdfHelper.SetFindingsHorizontal(doc, aortaRangeSaggitalView, sViewStandardFindingList, "AwvAaaSagitalView");

            var tViewStandardFindingList = _standardFindingRepository.GetAllStandardFindings <int>((int)TestType.AwvAAA, (int)ReadingLabels.AortaRangeTransverseView);

            _resultPdfHelper.SetFindingsHorizontal(doc, aortaRangeTransverseView, tViewStandardFindingList, "AwvAaaTransverseView");

            var peakSystolicVelocityStandardFindingsList = _standardFindingRepository.GetAllStandardFindings <int>((int)TestType.AwvAAA, (int)ReadingLabels.PeakSystolicVelocitySaggitalView);

            _resultPdfHelper.SetFindingsHorizontal(doc, peakSystolicVelocityStandardFindings, peakSystolicVelocityStandardFindingsList, "AwvAaaPeakSystolicVelocityStandardFindings");
        }
コード例 #15
0
        private void LoadLipidFinding(HtmlDocument doc, LipidTestResult testResult, bool isMale)
        {
            var hdlFinding       = _standardFindingRepository.GetAllStandardFindings <string>((int)TestType.Lipid, (int)ReadingLabels.HDL);
            var ldlFinding       = _standardFindingRepository.GetAllStandardFindings <int?>((int)TestType.Lipid, (int)ReadingLabels.LDL);
            var glucoseFinding   = _standardFindingRepository.GetAllStandardFindings <int?>((int)TestType.Lipid, (int)ReadingLabels.Glucose);
            var trigFinding      = _standardFindingRepository.GetAllStandardFindings <string>((int)TestType.Lipid, (int)ReadingLabels.TriGlycerides);
            var totalCholFinding = _standardFindingRepository.GetAllStandardFindings <string>((int)TestType.Lipid, (int)ReadingLabels.TotalCholestrol);
            var tcHdlFinding     = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.Lipid, (int)ReadingLabels.TCHDLRatio);

            hdlFinding = FilterMaleFemalRecordsontheGenderBasis(hdlFinding, isMale).ToList();

            UnableScreenReason unableScreenReason = null;

            if (testResult != null && testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0)
            {
                unableScreenReason = testResult.UnableScreenReason.First();
            }

            StandardFinding <string> hdlFindingForLongDescription = null;
            int t = 0;

            if (testResult != null && testResult.HDL != null && !string.IsNullOrEmpty(testResult.HDL.Reading) && int.TryParse(testResult.HDL.Reading, out t))
            {
                var findingIds = _testResultService.GetMultipleCalculatedStandardFinding(t, (int)TestType.Lipid, (int)ReadingLabels.HDL);
                if (findingIds != null && findingIds.Count() > 0)
                {
                    hdlFindingForLongDescription = hdlFinding.Where(fd => findingIds.Contains(fd.Id)).SingleOrDefault();
                }
            }
            _resultPdfHelper.SetSummaryFindings(doc, testResult != null && testResult.HDL != null ? testResult.HDL.Finding : null, hdlFinding, "FindingsHdlDiv", "longdescription-hdl", hdlFindingForLongDescription, testResult != null, unableScreenReason);
            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.HDL != null ? testResult.HDL.Finding : null, hdlFinding, "hdlFinding");



            StandardFinding <int?> ldlFindingForLongDescription = null;

            if (testResult != null && testResult.LDL != null && testResult.LDL.Reading.HasValue)
            {
                var findingId = _testResultService.GetCalculatedStandardFinding(testResult.LDL.Reading, (int)TestType.Lipid, (int)ReadingLabels.LDL);
                if (findingId > 0)
                {
                    ldlFindingForLongDescription = ldlFinding.Where(fd => findingId == fd.Id).SingleOrDefault();
                }
            }
            _resultPdfHelper.SetSummaryFindings(doc, testResult != null && testResult.LDL != null ? testResult.LDL.Finding : null, ldlFinding, "FindingsLdlDiv", "longdescription-ldl", ldlFindingForLongDescription, testResult != null, unableScreenReason);
            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.LDL != null ? testResult.LDL.Finding : null, ldlFinding, "ldlFinding");


            StandardFinding <int?> glucoseFindingForLongDescription = null;

            if (testResult != null && testResult.Glucose != null && testResult.Glucose.Reading.HasValue)
            {
                var findingId = _testResultService.GetCalculatedStandardFinding(testResult.Glucose.Reading, (int)TestType.Lipid, (int)ReadingLabels.Glucose);
                if (findingId > 0)
                {
                    glucoseFindingForLongDescription = glucoseFinding.Where(fd => findingId == fd.Id).SingleOrDefault();
                }
            }
            _resultPdfHelper.SetSummaryFindings(doc, testResult != null && testResult.Glucose != null ? testResult.Glucose.Finding : null, glucoseFinding, "FindingsGlucoseDiv", "longdescription-glucose", glucoseFindingForLongDescription, testResult != null, unableScreenReason);
            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.Glucose != null ? testResult.Glucose.Finding : null, glucoseFinding, "glucoseFinding");

            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.TriGlycerides != null ? testResult.TriGlycerides.Finding : null, trigFinding, "triglyceridesFinding");
            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.TotalCholestrol != null ? testResult.TotalCholestrol.Finding : null, totalCholFinding, "totalCholestrolFinding");
            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.TCHDLRatio != null ? testResult.TCHDLRatio.Finding : null, tcHdlFinding, "tchdlRatioFinding");
        }
コード例 #16
0
ファイル: LabReportParser.cs プロジェクト: sahvishal/matrix
        private bool ValidateDataTable(DataRow dr, out string txtFileName, out long eventId, out long customerId, out TestType testTypeId, out string summaryFinding)
        {
            txtFileName = Convert.ToString(dr["FileName"]);
            EventCustomer         eventCustomer = null;
            StandardFinding <int> finding       = new StandardFinding <int>();
            string strEventId = Convert.ToString(dr["EventID"]);

            summaryFinding = Convert.ToString(dr["Result"]);
            eventId        = 0;
            customerId     = 0;
            testTypeId     = 0;

            if (!long.TryParse(strEventId, out eventId))
            {
                _labParseEventLogger.Info("file(" + txtFileName + "): Incorrect Event Id : " + strEventId);
                _loggerForClient.Info("file(" + txtFileName + "): Incorrect Event Id : " + strEventId);
                return(false);
            }
            if (eventId <= 0)
            {
                _labParseEventLogger.Info("file(" + txtFileName + "): Incorrect Event Id : " + strEventId);
                _loggerForClient.Info("file(" + txtFileName + "): Incorrect Event Id : " + strEventId);
                return(false);
            }

            string labParseLogger = "LabParseLogger_" + strEventId;

            _labParseEventLogger = _logManager.GetLogger(labParseLogger);

            string strCustomerId = Convert.ToString(dr["PatientID"]);

            if (!long.TryParse(strCustomerId, out customerId))
            {
                _labParseEventLogger.Info("file(" + txtFileName + "): Incorrect customer Id : " + strCustomerId + " for event Id " + eventId);
                _loggerForClient.Info("file(" + txtFileName + "): Incorrect customer Id : " + strCustomerId + " for event Id " + eventId);
                return(false);
            }

            if (customerId <= 0)
            {
                _labParseEventLogger.Info("file(" + txtFileName + "): Incorrect customer Id : " + strCustomerId + " for event Id " + eventId);
                _loggerForClient.Info("file(" + txtFileName + "): Incorrect customer Id : " + strCustomerId + " for event Id " + eventId);
                return(false);
            }

            string strTestType = Convert.ToString(dr["Test_Alias"]);

            if (!Enum.TryParse(strTestType, true, out testTypeId))
            {
                _labParseEventLogger.Info("file(" + txtFileName + "): Test Name incorrect : " + strTestType + " for event Id " + eventId + " and customer Id " + customerId);
                _loggerForClient.Info("file(" + txtFileName + "): Test Name incorrect : " + strTestType);
                return(false);
            }

            eventCustomer = _eventCustomerRepository.Get(eventId, customerId);
            if (eventCustomer == null)
            {
                var message = "file(" + txtFileName + "): customer : " + customerId + " has not been " + eventId + " booked appointment.";
                _labParseEventLogger.Info(message);
                _loggerForClient.Info(message);
                return(false);
            }

            if (eventCustomer.AppointmentId.HasValue == false)
            {
                var message = "file(" + txtFileName + "): customer appointment has been canceled for Customer Id: " + customerId + ", EventId : " + eventId + ".";
                _labParseEventLogger.Info(message);
                _loggerForClient.Info(message);
                return(false);
            }

            if (eventCustomer.NoShow == true)
            {
                var message = "file(" + txtFileName + "): customer has been marked as No Show for Customer Id: " + customerId + ", EventId : " + eventId + ".";
                _labParseEventLogger.Info(message);
                _loggerForClient.Info(message);
                return(false);
            }

            if (eventCustomer.LeftWithoutScreeningReasonId.HasValue)
            {
                var message = "file(" + txtFileName + "): customer has been marked as Left without screening for customer Id: " + customerId + ", EventId : " + eventId + ".";
                _labParseEventLogger.Info(message);
                _loggerForClient.Info(message);
                return(false);
            }

            var isTestPurchased = _testResultService.IsTestPurchasedByCustomer(eventCustomer.Id, (long)testTypeId);

            if (!isTestPurchased)
            {
                _labParseEventLogger.Info("file(" + txtFileName + "): " + testTypeId + " test not purchased by customer Id " + customerId + " for event Id " + eventId);
                _loggerForClient.Info("file(" + txtFileName + "): " + testTypeId + " test not purchased by customer Id " + customerId + " for event Id " + eventId);
                return(false);
            }

            if (summaryFinding.IsNullOrEmpty())
            {
                _labParseEventLogger.Info("file(" + txtFileName + "): Test result not found for Test: " + testTypeId + " Customer Id :" + customerId + " ,and event Id: " + eventId);
                _loggerForClient.Info("file(" + txtFileName + "): Test result not found for Test: " + testTypeId + " Customer Id :" + customerId + " ,and event Id: " + eventId);
                return(false);
            }
            return(true);
        }
コード例 #17
0
ファイル: LabReportParser.cs プロジェクト: sahvishal/matrix
        public IEnumerable <EventCustomerScreeningAggregate> Parse()
        {
            var       eventCustomerAggregates = new List <EventCustomerScreeningAggregate>();
            var       pdfResults     = DirectoryOperationsHelper.GetFiles(_labReportOutputPath, "*.pdf");
            var       rawTxtFile     = DirectoryOperationsHelper.GetFiles(_labReportOutputPath, "*.txt");
            DataTable dtRawDataTable = new DataTable();

            if (rawTxtFile != null && rawTxtFile.Count() > 0)
            {
                _loggerForClient.Info("Total " + rawTxtFile.Count() + " Text File found.");
                foreach (var file in rawTxtFile)
                {
                    string txtFilename = new FileInfo(file).Name;
                    try
                    {
                        dtRawDataTable = GetRecordsFromTextFile(file, txtFilename, dtRawDataTable);
                    }
                    catch (Exception ex)
                    {
                        _loggerForClient.Info("File name :" + txtFilename + " is blank. Exception :" + ex.Message);
                        MovedParsedFile(file);
                    }
                }

                if (dtRawDataTable != null)
                {
                    _loggerForClient.Info("Total " + dtRawDataTable.Rows.Count() + " records found from all text file ");
                }
            }
            else
            {
                _loggerForClient.Info("There is not any text file availble");
            }

            var standardFinding = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.IFOBT);

            if (pdfResults != null && pdfResults.Any())
            {
                _loggerForClient.Info("Number of Files to be Parse : " + pdfResults.Count());

                foreach (var filePath in pdfResults)
                {
                    string   errorMessage = string.Empty;
                    long     customerId   = 0;
                    long     eventId      = 0;
                    TestType testTypeId;

                    var fileName  = Path.GetFileNameWithoutExtension(filePath);
                    var extension = Path.GetExtension(filePath);

                    if (extension != ".pdf")
                    {
                        errorMessage = "file with pdf extension supported only";
                        _loggerForClient.Error(errorMessage);
                        MovedParsedFile(filePath);
                        continue;
                    }

                    _loggerForClient.Info("=============== Parsing Started for file: " + fileName + " =================");
                    _loggerForClient.Info("Parsing Started for File: " + fileName);

                    if (!ParseValidationCheck(fileName, filePath, out eventId, out customerId, out testTypeId))
                    {
                        continue;
                    }

                    try
                    {
                        string folderToSavePdf = _mediaRepository.GetResultMediaFileLocation(customerId, eventId).PhysicalPath;
                        var    resultMedia     = GetMediaFromPdfFile(filePath, folderToSavePdf, testTypeId);
                        MovedParsedFile(filePath);

                        if (resultMedia != null && testTypeId == TestType.IFOBT)
                        {
                            var finding = new StandardFinding <int>();
                            finding = GetIFOBTFinding(dtRawDataTable, eventId, customerId, testTypeId, fileName, standardFinding);
                            resultMedia.ReadingSource = ReadingSource.Automatic;

                            TestResult testResult = new IFOBTTestResult {
                                ResultImage = resultMedia, Finding = finding
                            };
                            _resultParserHelper.AddTestResulttoEventCustomerAggregate(eventCustomerAggregates, eventId, customerId, testResult);
                            _resultParserHelper.AddResultArchiveLog(string.Empty, TestType.IFOBT, customerId, MedicalEquipmentTag.LabReportParser);

                            _labParseEventLogger.Info(string.Concat("\nPDF Filename(" + fileName + "): Parsing successfully for Customer Id: ", customerId, " ,Event Id: ", eventId, " TestType :", TestType.IFOBT, "\n"));
                            _loggerForClient.Info(string.Concat("\nPDF Filename (" + fileName + "): parsing successfully for Customer Id: ", customerId, " ,Event Id: ", eventId, " ,TestType :", TestType.IFOBT, "\n"));
                        }
                        else if (resultMedia != null && testTypeId == TestType.UrineMicroalbumin)
                        {
                            ResultReading <string> microAlbuminValue = new ResultReading <string>();
                            microAlbuminValue         = GetUrineMicroAlbuminValue(dtRawDataTable, eventId, customerId, testTypeId, fileName);
                            resultMedia.ReadingSource = ReadingSource.Automatic;

                            TestResult testResult = new UrineMicroalbuminTestResult {
                                ResultImage = resultMedia, MicroalbuminValue = microAlbuminValue
                            };
                            _resultParserHelper.AddTestResulttoEventCustomerAggregate(eventCustomerAggregates, eventId, customerId, testResult);
                            _resultParserHelper.AddResultArchiveLog(string.Empty, TestType.UrineMicroalbumin, customerId, MedicalEquipmentTag.LabReportParser);

                            _labParseEventLogger.Info(string.Concat("\nFilename(" + fileName + "): Parsing successfully for Customer Id: ", customerId, " ,Event Id: ", eventId, " TestType :", TestType.UrineMicroalbumin, "\n"));
                            _loggerForClient.Info(string.Concat("\nFilename (" + fileName + "): Parsing successfully for Customer Id: ", customerId, " ,Event Id: ", eventId, " ,TestType :", TestType.UrineMicroalbumin, "\n"));
                        }
                        else
                        {
                            var message = string.Concat("\nFilename(" + fileName + "): Test(" + testTypeId + ") is an invalid test for parsing for Customer Id: ", customerId, " ,Event Id: ", eventId, " TestType :", testTypeId, "\n");
                            _labParseEventLogger.Info(message);
                            _loggerForClient.Info(message);
                        }
                    }
                    catch (Exception ex)
                    {
                        errorMessage = " System Failure! Message: " + ex.Message + "\n\t" + ex.StackTrace;
                        _labParseEventLogger.Error(errorMessage);
                        _loggerForClient.Error("Parsing failed for filename :" + fileName + ".Please contact to Administrator.");

                        MovedParsedFile(filePath);
                        _resultParserHelper.AddResultArchiveLog(ex.Message, testTypeId, customerId, MedicalEquipmentTag.LabReportParser, false);
                    }
                }
            }
            if (dtRawDataTable != null && dtRawDataTable.Columns.Count() > 0 && dtRawDataTable.Rows.Count > 0)
            {
                var rows = dtRawDataTable.Select("IsParse=false");
                if (rows != null && rows.Any())
                {
                    dtRawDataTable = rows.CopyToDataTable();

                    if (dtRawDataTable.Rows.Count > 0)
                    {
                        eventCustomerAggregates = SaveResultWithoutMedia(eventCustomerAggregates, dtRawDataTable, standardFinding);
                    }
                }
            }
            return(eventCustomerAggregates);
        }
コード例 #18
0
 private string GetOutputFromStandaredFinding(StandardFinding <int> finding)
 {
     return(finding != null ? finding.Label : string.Empty);
 }
コード例 #19
0
        public StandardFinding <T> CreateStandardFinding <T>(StandardFindingEntity standardFindingEntity)
        {
            if (standardFindingEntity == null)
            {
                throw new ArgumentNullException("standardFindingEntity", "Standard Finding Entity must be provided.");
            }

            var standardFinding = new StandardFinding <T>(standardFindingEntity.StandardFindingId)
            {
                Label                 = standardFindingEntity.Label,
                Description           = standardFindingEntity.Description,
                ResultInterpretation  = standardFindingEntity.ResultInterpretation,
                PathwayRecommendation = standardFindingEntity.PathwayRecommendation,
                LongDescription       = standardFindingEntity.LongDescription,
                WorstCaseOrder        = standardFindingEntity.WorstCaseOrder
            };

            if (typeof(T) == typeof(int?) || typeof(T) == typeof(int)) // For Type Int
            {
                int returnValue;
                // Setting for Min Value
                if (standardFindingEntity.MinValue != null)
                {
                    returnValue = decimal.ToInt32((decimal)standardFindingEntity.MinValue);
                    standardFinding.MinValue = (T)Convert.ChangeType(returnValue, typeof(int));
                }
                else
                {
                    standardFinding.MinValue = default(T);
                }

                //Setting for Max Value
                if (standardFindingEntity.MaxValue != null)
                {
                    returnValue = decimal.ToInt32((decimal)standardFindingEntity.MaxValue);
                    standardFinding.MaxValue = (T)Convert.ChangeType(returnValue, typeof(int));
                }
                else
                {
                    standardFinding.MaxValue = default(T);
                }
            }
            else if (typeof(T) == typeof(decimal?) || typeof(T) == typeof(decimal)) // For Type Decimal
            {
                // Setting for min Value
                if (standardFindingEntity.MinValue != null)
                {
                    standardFinding.MinValue = (T)Convert.ChangeType(standardFindingEntity.MinValue, typeof(decimal));
                }
                else
                {
                    standardFinding.MinValue = default(T);
                }

                // Setting for max Value
                if (standardFindingEntity.MaxValue != null)
                {
                    standardFinding.MaxValue = (T)Convert.ChangeType(standardFindingEntity.MaxValue, typeof(decimal));
                }
                else
                {
                    standardFinding.MaxValue = default(T);
                }
            }
            return(standardFinding);
        }
コード例 #20
0
        private void LoadLeadFindings(HtmlDocument doc, LeadTestResult testResult, bool isTestPurchased = true)
        {
            var standardFindingList = _standardFindingRepository.GetAllStandardFindings <decimal>((int)TestType.Lead, (int)ReadingLabels.Left);

            StandardFinding <decimal> leftFinding  = null;
            StandardFinding <decimal> rightFinding = null;

            if (testResult != null)
            {
                if (testResult.LeftResultReadings != null && testResult.LeftResultReadings.Finding != null)
                {
                    leftFinding = testResult.LeftResultReadings.Finding;
                }
                if (testResult.RightResultReadings != null && testResult.RightResultReadings.Finding != null)
                {
                    rightFinding = testResult.RightResultReadings.Finding;
                }
            }

            StandardFinding <decimal> finding = leftFinding != null && rightFinding != null
                                          ? (leftFinding.Id > rightFinding.Id ? leftFinding : rightFinding)
                                          : (leftFinding ?? rightFinding);

            UnableScreenReason unableScreenReason = null;

            //TODO: This is a hack for U Screen Text on Stroke Summary
            if (testResult != null && testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0 && testResult.UnableScreenReason.Where(us => us.Reason == UnableToScreenReason.TechnicallyLimitedImages).Count() < 1)
            {
                unableScreenReason = testResult.UnableScreenReason.First();
            }

            _resultPdfHelper.SetSummaryFindings(doc, finding, standardFindingList, "FindingsLeadDiv", "long-description-lead", null, isTestPurchased, unableScreenReason);

            HtmlNode selectedNode;

            if (finding != null)
            {
                var stdFinding = standardFindingList.Where(f => f.Id == finding.Id).Single();

                selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='lead-rpp-resultspan']");
                if (selectedNode != null)
                {
                    selectedNode.InnerHtml = stdFinding.Label;
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='docletter-lead']");
                if (stdFinding.ResultInterpretation != null && stdFinding.ResultInterpretation.Value != (long)ResultInterpretation.Normal && selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }
            }

            string htmlRows          = "";
            string strokeDescription = "<fieldset><legend>STENOSIS RANGE</legend><Table>";

            foreach (var standardFinding in standardFindingList)
            {
                string rowString = "<tr>";
                strokeDescription += "<tr>";
                if (rightFinding != null && rightFinding.Id == standardFinding.Id)
                {
                    rowString += "<td> <input type='checkbox' checked='checked' /> </td>";
                }
                else
                {
                    rowString += "<td> <input type='checkbox' /> </td>";
                }

                if (leftFinding != null && leftFinding.Id == standardFinding.Id)
                {
                    rowString += "<td> <input type='checkbox' checked='checked' /> </td>";
                }
                else
                {
                    rowString += "<td> <input type='checkbox' /> </td>";
                }

                rowString += "<td> " + standardFinding.Label + " " + standardFinding.Description + "</td></tr>";

                htmlRows = htmlRows + rowString;
            }

            strokeDescription += "</Table></fieldset>";

            selectedNode = doc.DocumentNode.SelectSingleNode("//table[@id='leadFinding']");
            if (selectedNode != null)
            {
                selectedNode.InnerHtml += htmlRows;
            }

            selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='leadFindingDescriptionDiv']");
            if (selectedNode != null)
            {
                selectedNode.InnerHtml += strokeDescription;
            }

            if (leftFinding != null)
            {
                selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='lead-at-a-glance-finding-left']");
                if (selectedNode != null)
                {
                    selectedNode.InnerHtml = leftFinding.Label;
                }
            }

            if (rightFinding != null)
            {
                selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='lead-at-a-glance-finding-right']");
                if (selectedNode != null)
                {
                    selectedNode.InnerHtml = rightFinding.Label;
                }
            }

            if (finding != null)
            {
                selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='lead-at-a-glance-result']");
                if (selectedNode != null && testResult.ResultInterpretation.HasValue)
                {
                    selectedNode.InnerHtml = ((ResultInterpretation)testResult.ResultInterpretation).ToString();
                }
            }
        }
コード例 #21
0
        public override CustomerEventScreeningTestsEntity CreateActualTestResultEntity(TestResult testResult, List <OrderedPair <int, int> > testReadingReadingPairs)
        {
            var floChecAbiTestResult = testResult as FloChecABITestResult;
            var customerEventScreeningTestsEntity = new CustomerEventScreeningTestsEntity(testResult.Id)
            {
                TestId = (int)TestType.FloChecABI
            };
            var customerEventReadingEntities = new List <CustomerEventReadingEntity>();

            StandardFinding <decimal> rightResultFinding;

            StandardFinding <decimal> leftResultFinding = rightResultFinding = null;


            var standardFindingsLeftAbi  = new TestResultService().GetAllStandardFindings <decimal>((int)TestType.FloChecABI, (int)ReadingLabels.LeftABI);
            var standardFindingsRightAbi = new TestResultService().GetAllStandardFindings <decimal>((int)TestType.FloChecABI, (int)ReadingLabels.RightABI);



            if (floChecAbiTestResult != null && floChecAbiTestResult.LeftResultReadings != null)
            {
                var customerEventReading = CreateEventReadingEntity(floChecAbiTestResult.LeftResultReadings.BFI, (int)ReadingLabels.LeftHandBFI, testReadingReadingPairs);
                if (customerEventReading != null)
                {
                    customerEventReadingEntities.Add(customerEventReading);
                }

                customerEventReading = CreateEventReadingEntity(floChecAbiTestResult.LeftResultReadings.ABI, (int)ReadingLabels.LeftABI, testReadingReadingPairs);
                if (customerEventReading != null)
                {
                    leftResultFinding = new StandardFinding <decimal>((new TestResultService()).GetCalculatedStandardFinding(floChecAbiTestResult.LeftResultReadings.ABI.Reading, (int)TestType.FloChecABI, standardFindingsLeftAbi != null && standardFindingsLeftAbi.Count() > 0 ? (int?)ReadingLabels.LeftABI : null));
                    if (floChecAbiTestResult.LeftResultReadings.Finding != null && floChecAbiTestResult.LeftResultReadings.Finding.Id > 0 && floChecAbiTestResult.LeftResultReadings.Finding.Id != leftResultFinding.Id)
                    {
                        customerEventReading.StandardFindingTestReadingId = (int?)new TestResultService().GetStandardFindingTestReadingIdForStandardFinding((int)TestType.FloChecABI, (int)ReadingLabels.LeftABI, floChecAbiTestResult.LeftResultReadings.Finding.Id);
                    }

                    customerEventReadingEntities.Add(customerEventReading);
                }
                else if (floChecAbiTestResult.LeftResultReadings.Finding != null && floChecAbiTestResult.LeftResultReadings.Finding.Id > 0)
                {
                    customerEventReading = CreateEventReadingEntity(floChecAbiTestResult.LeftResultReadings.ABI ?? new ResultReading <decimal?> {
                        ReadingSource = ReadingSource.Manual, RecorderMetaData = testResult.DataRecorderMetaData
                    },
                                                                    (int)ReadingLabels.LeftABI, testReadingReadingPairs);

                    customerEventReading.StandardFindingTestReadingId = (int?)new TestResultService().GetStandardFindingTestReadingIdForStandardFinding((int)TestType.FloChecABI, (int)ReadingLabels.LeftABI, floChecAbiTestResult.LeftResultReadings.Finding.Id);

                    customerEventReadingEntities.Add(customerEventReading);
                }
            }

            if (floChecAbiTestResult != null && floChecAbiTestResult.RightResultReadings != null)
            {
                var customerEventReading = CreateEventReadingEntity(floChecAbiTestResult.RightResultReadings.BFI, (int)ReadingLabels.RightHandBFI, testReadingReadingPairs);
                if (customerEventReading != null)
                {
                    customerEventReadingEntities.Add(customerEventReading);
                }

                customerEventReading = CreateEventReadingEntity(floChecAbiTestResult.RightResultReadings.ABI, (int)ReadingLabels.RightABI, testReadingReadingPairs);

                if (customerEventReading != null)
                {
                    rightResultFinding = new StandardFinding <decimal>((new TestResultService()).GetCalculatedStandardFinding(floChecAbiTestResult.RightResultReadings.ABI.Reading, (int)TestType.FloChecABI, standardFindingsRightAbi != null && standardFindingsRightAbi.Count() > 0 ? (int?)ReadingLabels.RightABI : null));
                    if (floChecAbiTestResult.RightResultReadings.Finding != null && floChecAbiTestResult.RightResultReadings.Finding.Id > 0 && floChecAbiTestResult.RightResultReadings.Finding.Id != rightResultFinding.Id)
                    {
                        customerEventReading.StandardFindingTestReadingId = (int?)new TestResultService().GetStandardFindingTestReadingIdForStandardFinding((int)TestType.FloChecABI, (int)ReadingLabels.RightABI, floChecAbiTestResult.RightResultReadings.Finding.Id);
                    }

                    customerEventReadingEntities.Add(customerEventReading);
                }
                else if (floChecAbiTestResult.RightResultReadings.Finding != null && floChecAbiTestResult.RightResultReadings.Finding.Id > 0)
                {
                    customerEventReading = CreateEventReadingEntity(floChecAbiTestResult.RightResultReadings.ABI ?? new ResultReading <decimal?> {
                        ReadingSource = ReadingSource.Manual, RecorderMetaData = testResult.DataRecorderMetaData
                    },
                                                                    (int)ReadingLabels.RightABI, testReadingReadingPairs);

                    customerEventReading.StandardFindingTestReadingId = (int?)new TestResultService().GetStandardFindingTestReadingIdForStandardFinding((int)TestType.FloChecABI, (int)ReadingLabels.RightABI, floChecAbiTestResult.RightResultReadings.Finding.Id);

                    customerEventReadingEntities.Add(customerEventReading);
                }
            }

            if (floChecAbiTestResult != null)
            {
                var customerEventReadingPencilDoppler = CreateEventReadingEntity(floChecAbiTestResult.PencilDopplerUsed, (int)ReadingLabels.PencilDopplerUsed, testReadingReadingPairs);
                if (customerEventReadingPencilDoppler != null)
                {
                    customerEventReadingEntities.Add(customerEventReadingPencilDoppler);
                }

                if (floChecAbiTestResult.RepeatStudy != null)
                {
                    var customerEventReading = CreateEventReadingEntity(floChecAbiTestResult.RepeatStudy, (int)ReadingLabels.RepeatStudy, testReadingReadingPairs);
                    customerEventReadingEntities.Add(customerEventReading);
                }
            }

            testResult.ResultInterpretation = null;
            //TODO: Need to move this code into a Service

            var findingToConsider = GetFindingToConsider(leftResultFinding, rightResultFinding);

            if (floChecAbiTestResult.Finding != null && (standardFindingsRightAbi == null || standardFindingsRightAbi.Count() < 1))
            {
                if (findingToConsider == null || findingToConsider.Id != floChecAbiTestResult.Finding.Id)
                {
                    customerEventScreeningTestsEntity.CustomerEventTestStandardFinding.Add(
                        new CustomerEventTestStandardFindingEntity(floChecAbiTestResult.Finding.CustomerEventStandardFindingId)
                    {
                        StandardFindingTestReadingId = (int?)new TestResultService().GetStandardFindingTestReadingIdForStandardFinding((int)TestType.FloChecABI, null, floChecAbiTestResult.Finding.Id)
                    });

                    findingToConsider = floChecAbiTestResult.Finding;
                }
            }

            if (findingToConsider != null)
            {
                var finding = GetSelectedStandardFinding((int)TestType.FloChecABI, (standardFindingsRightAbi != null && standardFindingsRightAbi.Count() > 0 ? (int?)ReadingLabels.RightABI : null), findingToConsider.Id);

                if (testResult.ResultStatus.StateNumber == (int)TestResultStateNumber.Evaluated || testResult.ResultStatus.StateNumber == (int)NewTestResultStateNumber.Evaluated)
                {
                    testResult.ResultInterpretation  = finding.ResultInterpretation;
                    testResult.PathwayRecommendation = finding.PathwayRecommendation;
                }
            }

            if (customerEventReadingEntities.Count > 0)
            {
                customerEventScreeningTestsEntity.CustomerEventReading.AddRange(customerEventReadingEntities);
            }

            return(customerEventScreeningTestsEntity);
        }