Beispiel #1
0
        private void SetFinding(ImtTestResult testResult)
        {
            if (testResult == null || (testResult.QimtLeft == null && testResult.QimtRight == null) || testResult.ExpectedQimt == null)
            {
                return;
            }

            int qimtData = 0;

            if (testResult.QimtRight != null && testResult.QimtLeft != null)
            {
                qimtData = testResult.QimtLeft.Reading > testResult.QimtRight.Reading ? testResult.QimtLeft.Reading : testResult.QimtRight.Reading;
            }
            else
            {
                qimtData = testResult.QimtRight == null ? testResult.QimtLeft.Reading : testResult.QimtRight.Reading;
            }

            var expectedQimt = testResult.ExpectedQimt.Reading;

            var standardFindingList = _standardFindingRepository.GetAllStandardFindings <int>((int)TestType.IMT);

            if (standardFindingList == null)
            {
                return;
            }

            var normalFinding   = standardFindingList.Where(sfl => sfl.Label.ToLower().Trim().Equals("normal")).FirstOrDefault();
            var abnormalFinding = standardFindingList.Where(sfl => sfl.Label.ToLower().Trim().Equals("abnormal")).FirstOrDefault();

            testResult.Finding = qimtData <= expectedQimt ? normalFinding : abnormalFinding;
        }
Beispiel #2
0
        public void LoadHPyloriTestresults(HtmlDocument doc, HPyloriTestResult testResult, bool removeLongDescription, bool loadImages, List <OrderedPair <long, string> > technicianIdNamePairs,
                                           IEnumerable <CustomerScreeningEvaluatinPhysicianViewModel> physicians, IEnumerable <EventPhysicianTest> eventPhysicianTests, IEnumerable <PhysicianEvaluation> eventCustomerPhysicianEvaluations, CustomerSkipReview customerSkipReview)
        {
            var standardFindingList = _standardFindingRepository.GetAllStandardFindings <int>((int)TestType.HPylori);

            if (testResult != null)
            {
                var selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='HPylori-rpp-section']");
                if (selectedNode != null && (testResult.UnableScreenReason == null || testResult.UnableScreenReason.Count == 0) && (testResult.TestNotPerformed == null || testResult.TestNotPerformed.TestNotPerformedReasonId <= 0) &&
                    (testResult.RepeatStudy == null || testResult.RepeatStudy.Reading == false))
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='rpp-eus-HPylori-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                _resultPdfHelper.SetPhysicianSignature(doc, "HPylori-primaryEvalPhysicianSign", "HPylori-overreadEvalPhysicianSign", physicians, eventPhysicianTests, eventCustomerPhysicianEvaluations, customerSkipReview);

                _resultPdfHelper.SetCheckBox(doc, "TechnicallyLimitedbutReadableHPyloriInputCheck", testResult.TechnicallyLimitedbutReadable);
                _resultPdfHelper.SetCheckBox(doc, "RepeatStudyHPyloriInputCheck", testResult.RepeatStudy);

                _resultPdfHelper.SetTechnician(doc, testResult, "techHPylori", "technotesHPylori", technicianIdNamePairs);
                _resultPdfHelper.SetFindingsVertical(doc, testResult.Finding, standardFindingList, "HPyloriFinding");
                _resultPdfHelper.SetSummaryFindings(doc, testResult.Finding, standardFindingList, "finding-HPylori-div", "long-description-HPylori", null, true, (testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0 ? testResult.UnableScreenReason.First() : null));
                _resultPdfHelper.SetPhysicianRemarks(doc, testResult, "followUpHPylori", "criticalHPylori", "physicianRemarksHPylori");
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.HPylori, "HPyloriUnableToScreen", testResult.UnableScreenReason);

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

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

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='HPylori-longdescription-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", removeLongDescription ? "display:none" : "display:block");
                }
            }
            else
            {
                _resultPdfHelper.SetFindingsVertical(doc, null, standardFindingList, "HPyloriFinding");
                _resultPdfHelper.SetSummaryFindings(doc, null, standardFindingList, "finding-HPylori-div", "longdescription-HPylori", null, false);
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.HPylori, "HPyloriUnableToScreen", null);
            }
        }
        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");
        }
Beispiel #4
0
        public void LoadPadTestResults(HtmlDocument doc, PADTestResult testResult, bool removeLongDescription, IEnumerable <CustomerScreeningEvaluatinPhysicianViewModel> physicians, IEnumerable <EventPhysicianTest> eventPhysicianTests,
                                       List <OrderedPair <long, string> > technicianIdNamePairs, IEnumerable <PhysicianEvaluation> eventCustomerPhysicianEvaluations, CustomerSkipReview customerSkipReview)
        {
            var incidentalFindings = _incidentalFindingRepository.GetAllIncidentalFinding((int)TestType.PAD);

            if (testResult != null)
            {
                var selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='pad-rpp-section']");
                if (selectedNode != null && (testResult.UnableScreenReason == null || testResult.UnableScreenReason.Count == 0) && (testResult.TestNotPerformed == null || testResult.TestNotPerformed.TestNotPerformedReasonId <= 0) &&
                    (testResult.RepeatStudy == null || testResult.RepeatStudy.Reading == false))
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='rpp-eus-pad-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                _resultPdfHelper.SetPhysicianSignature(doc, "pad-primaryEvalPhysicianSign", "pad-overreadEvalPhysicianSign", physicians, eventPhysicianTests, eventCustomerPhysicianEvaluations, customerSkipReview);

                var     readings = new TestResultRepository().GetAllReadings((int)TestType.PAD);
                decimal?leftAbi  = null;
                decimal?rightAbi = null;

                foreach (var resultReading in readings)
                {
                    switch (resultReading.Label)
                    {
                    case ReadingLabels.LeftABI:
                        if (testResult.LeftResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "txtLeftAbi", testResult.LeftResultReadings.ABI);

                            if (testResult.LeftResultReadings.ABI != null && testResult.LeftResultReadings.ABI.Reading.HasValue)
                            {
                                leftAbi = testResult.LeftResultReadings.ABI.Reading;

                                selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='pad-at-a-glance-finding-left']");
                                if (selectedNode != null)
                                {
                                    selectedNode.InnerHtml = testResult.LeftResultReadings.ABI.Reading.Value.ToString("0.00");
                                }
                            }
                        }
                        break;

                    case ReadingLabels.SystolicLArm:
                        if (testResult.LeftResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "txtSystolicLeftArm", testResult.LeftResultReadings.SystolicArm);
                        }
                        break;

                    case ReadingLabels.SystolicLAnkle:
                        if (testResult.LeftResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "txtSystolicLeftAnkle", testResult.LeftResultReadings.SystolicAnkle);
                        }
                        break;

                    case ReadingLabels.RightABI:
                        if (testResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "txtRightAbi", testResult.RightResultReadings.ABI);
                            if (testResult.RightResultReadings.ABI != null && testResult.RightResultReadings.ABI.Reading.HasValue)
                            {
                                rightAbi = testResult.RightResultReadings.ABI.Reading;

                                selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='pad-at-a-glance-finding-right']");
                                if (selectedNode != null)
                                {
                                    selectedNode.InnerHtml = testResult.RightResultReadings.ABI.Reading.Value.ToString("0.00");
                                }
                            }
                        }
                        break;

                    case ReadingLabels.SystolicRArm:
                        if (testResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "txtSystolicRightArm", testResult.RightResultReadings.SystolicArm);
                        }
                        break;

                    case ReadingLabels.SystolicRAnkle:
                        if (testResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "txtSystolicRightAnkle", testResult.RightResultReadings.SystolicAnkle);
                        }
                        break;

                    case ReadingLabels.SystolicHighestArm:
                        _resultPdfHelper.SetInputBox(doc, "systolicHighestArm", testResult.SystolicHighestArm);
                        break;

                    case ReadingLabels.RepeatStudy:
                        _resultPdfHelper.SetCheckBox(doc, "RepeatStudyPadInputCheck", testResult.RepeatStudy);
                        break;

                    case ReadingLabels.LeftUnabletoOcclude:
                        if (testResult.LeftResultReadings != null)
                        {
                            _resultPdfHelper.SetCheckBox(doc, "leftunabletoocclude-checkbox", testResult.LeftResultReadings.UnabletoOcclude);
                        }

                        break;

                    case ReadingLabels.RightUnabletoOcclude:
                        if (testResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetCheckBox(doc, "rightunabletoocclude-checkbox", testResult.RightResultReadings.UnabletoOcclude);
                        }

                        break;
                    }
                }

                decimal?abi;
                long    leftFindingId = 0;
                if (leftAbi != null)
                {
                    leftFindingId = _testResultService.GetCalculatedStandardFinding(leftAbi.Value, (int)TestType.PAD, null);
                }

                long rightFindingId = 0;
                if (rightAbi != null)
                {
                    rightFindingId = _testResultService.GetCalculatedStandardFinding(rightAbi.Value, (int)TestType.PAD, null);
                }

                var standardFindingList = _standardFindingRepository.GetAllStandardFindings <decimal>((int)TestType.PAD);

                long findingId = 0;

                if (leftFindingId == rightFindingId)
                {
                    findingId = leftFindingId;
                }
                else if (leftFindingId > 0 && rightFindingId > 0)
                {
                    var lf = standardFindingList.Where(f => f.Id == leftFindingId).Single();
                    var rf = standardFindingList.Where(f => f.Id == rightFindingId).Single();

                    findingId = lf.WorstCaseOrder > rf.WorstCaseOrder ? lf.Id : rf.Id;
                }
                else
                {
                    findingId = leftFindingId > rightFindingId ? leftFindingId : rightFindingId;
                }

                if (findingId > 0 && findingId == leftFindingId)
                {
                    abi = leftAbi;
                }
                else
                {
                    abi = rightAbi;
                }

                _resultPdfHelper.SetInputBox(doc, "abi-pad-summary", new ResultReading <decimal?> {
                    Reading = abi
                });
                LoadPadFindings(doc, testResult.Finding, standardFindingList, findingId, true, (testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0 ? testResult.UnableScreenReason.First() : null));
                _resultPdfHelper.SetTechnician(doc, testResult, "techPad", "technotespad", technicianIdNamePairs);
                _resultPdfHelper.SetIncidentalFindings(doc, incidentalFindings, testResult.IncidentalFindings, "padIncidentalFinding");
                _resultPdfHelper.SetPhysicianRemarks(doc, testResult, "followUpPad", "criticalPad", "physicianRemarksPad");
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.PAD, "padUnableToScreen", testResult.UnableScreenReason);

                if (testResult.IncidentalFindings != null && testResult.IncidentalFindings.Count() > 0)
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//p[@id='incidentalfinding-description-pad']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block;");
                    }
                }
                if (testResult.Finding != null)
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='pad-at-a-glance-result']");
                    if (selectedNode != null && testResult.ResultInterpretation.HasValue)
                    {
                        selectedNode.InnerHtml = ((ResultInterpretation)testResult.ResultInterpretation).ToString();
                    }


                    selectedNode = doc.DocumentNode.SelectSingleNode("//img[@id='pad-at-a-glance-findingImage']");
                    if (selectedNode != null)
                    {
                        if (testResult.Finding.Label.ToLower() == PadNormal.ToLower())
                        {
                            selectedNode.SetAttributeValue("src", StringforContentDirectory + "/NMMSV_N.png");
                        }
                        else if (testResult.Finding.Label.ToLower() == PadMild.ToLower())
                        {
                            selectedNode.SetAttributeValue("src", StringforContentDirectory + "/NMMSV_M.png");
                        }
                        else if (testResult.Finding.Label.ToLower() == PadModerate.ToLower())
                        {
                            selectedNode.SetAttributeValue("src", StringforContentDirectory + "/NMMSV_MD.png");
                        }
                        else if (testResult.Finding.Label.ToLower() == PadSevere.ToLower())
                        {
                            selectedNode.SetAttributeValue("src", StringforContentDirectory + "/NMMSV_S.png");
                        }
                        else
                        {
                            selectedNode.SetAttributeValue("src", StringforContentDirectory + "/NoIndication_NMMSV.png");
                        }
                    }
                }

                if (testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0)
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='pad-at-a-glance-finding']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:none;");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='pad-at-a-glance-unabletoscreen']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block;");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='pad-at-a-glance-result']");
                    if (selectedNode != null)
                    {
                        selectedNode.InnerHtml = "N/A";
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//img[@id='pad-at-a-glance-findingImage']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("src", StringforContentDirectory + "/NoIndication_NMMSV.png");
                    }
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='pad-longdescription-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", removeLongDescription ? "display:none" : "display:block");
                }
            }
            else
            {
                LoadPadFindings(doc, null, null, 0, false);
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.PAD, "padUnableToScreen", null);
                _resultPdfHelper.SetIncidentalFindings(doc, incidentalFindings, null, "padIncidentalFinding");
            }
        }
Beispiel #5
0
        public void LoadAwvEkgTestResults(HtmlDocument doc, AwvEkgTestResult testResult, bool removeLongDescription, List <OrderedPair <long, string> > technicianIdNamePairs,
                                          bool loadImages, IEnumerable <CustomerScreeningEvaluatinPhysicianViewModel> physicians, IEnumerable <EventPhysicianTest> eventPhysicianTests,
                                          bool showUnreadableTest, IEnumerable <PhysicianEvaluation> eventCustomerPhysicianEvaluation, CustomerSkipReview customerSkipReview, string stringforMediaDirectory)
        {
            var bbbFindings = _standardFindingRepository.GetAllStandardFindings <int>((Int32)TestType.AwvEkg, (Int32)ReadingLabels.BundleBranchBlock);
            var ipFindings  = _standardFindingRepository.GetAllStandardFindings <int>((Int32)TestType.AwvEkg, (Int32)ReadingLabels.InfarctionPattern);

            if (testResult != null)
            {
                var selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='AwvEkg-rpp-section']");
                if (selectedNode != null && (testResult.UnableScreenReason == null || testResult.UnableScreenReason.Count == 0) && (testResult.TestNotPerformed == null || testResult.TestNotPerformed.TestNotPerformedReasonId <= 0) &&
                    (showUnreadableTest || testResult.RepeatStudy == null || testResult.RepeatStudy.Reading == false))
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='rpp-eus-AwvEkg-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                _resultPdfHelper.SetPhysicianSignature(doc, "AwvEkg-primaryEvalPhysicianSign", "AwvEkg-overreadEvalPhysicianSign", physicians, eventPhysicianTests, eventCustomerPhysicianEvaluation, customerSkipReview);

                LoadAwvEkgFindings(doc, testResult.Finding, true, (testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0 ? testResult.UnableScreenReason.First() : null));

                _resultPdfHelper.SetInputBox(doc, "AwvEkgprIntervalTextbox", testResult.PRInterval);
                _resultPdfHelper.SetInputBox(doc, "AwvEkgventRateTextbox", testResult.VentRate);
                _resultPdfHelper.SetInputBox(doc, "AwvEkgqrsDurationTextbox", testResult.QRSDuration);
                _resultPdfHelper.SetInputBox(doc, "AwvEkgqtIntervalTextbox", testResult.QTInterval);
                _resultPdfHelper.SetInputBox(doc, "AwvEkgqtcInterval", testResult.QTcInterval);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgReversedLeadInputCheck", testResult.ReversedLeads);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgRepeatStudyInputCheck", testResult.RepeatStudy);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgArtifactInputCheck", testResult.Artifact);
                _resultPdfHelper.SetCheckBox(doc, "ComparetoPrevAwvEkgInputCheck", testResult.ComparetoEkg);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgSinusRythmInputCheck", testResult.SinusRythm);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgSinusArrythmiaInputCheck", testResult.SinusArrythmia);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgSinusBradycardiaInputCheck", testResult.SinusBradycardia);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgMarkedInputCheck", testResult.Marked);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgSinusTachycardiaInputCheck", testResult.SinusTachycardia);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgAtrialFibrillationInputCheck", testResult.AtrialFibrillation);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgAtrialFlutterInputCheck", testResult.AtrialFlutter);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgSupraventriculaCheckbox", testResult.SupraventricularArrythmia);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgSvtInputCheck", testResult.SVT);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgPacInputCheck", testResult.PACs);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgPvcInputCheck", testResult.PVCs);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgPacerRythmCheckbox", testResult.PacerRythm);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgBundleBranchBlockCheckbox", testResult.BundleBranchBlock);

                _resultPdfHelper.SetFindingsHorizontal(doc, testResult.BundleBranchBlockFinding, bbbFindings, "AwvEkgBundleBranchBlockFinding", 3);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgQrsWideningInputCheck", testResult.QRSWidening);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgLeftAxisInputCheck", testResult.LeftAxis);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgRightAxisInputCheck", testResult.RightAxis);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgAbnormalAxisInputCheck", testResult.AbnormalAxis);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgLeftInputCheck", testResult.Left);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgRightInputCheck", testResult.Right);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgLeftAnteriorfasicularBlockCheckbox", testResult.LeftAnteriorFasicularBlock);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgHeartBlockInputCheck", testResult.HeartBlock);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgFirstDegreeBlockInputCheck", testResult.FirstDegreeBlock);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgSecondDegreeBlockCheckbox", testResult.SecondDegreeBlock);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgTypeIIInputCheck", testResult.TypeII);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgThirdDegreeBlockInputCheck", testResult.ThirdDegreeCompleteHeartBlock);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgVentricularCheckbox", testResult.VentricularHypertrophy);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgLeftVentricularCheckbox", testResult.LeftVentricularHypertrophy);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgRightVentricularCheckbox", testResult.RightVentricularHypertrophy);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgProlongedQTCheckbox", testResult.ProlongedQTInterval);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgISchemicSttCheckbox", testResult.IschemicSTTChanges);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgNonSpecificSttCheckbox", testResult.NonSpecificSTTChanges);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgPoorRWaveProgressionCheckbox", testResult.PoorRWaveProgression);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgInfarctionPatternCheckbox", testResult.InfarctionPattern);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgATypicalWaveCheckbox", testResult.AtypicalQWaveLead);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgAtrialEnlargementCheckbox", testResult.AtrialEnlargement);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgLeftAtrialCheckbox", testResult.LeftAtrialEnlargement);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgRightAtrialCheckbox", testResult.RightAtrialEnlargement);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgRepolarizationCheckbox", testResult.RepolarizationVariant);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgLowVoltageCheckbox", testResult.LowVoltage);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgLimbLeadsCheckbox", testResult.LimbLeads);
                _resultPdfHelper.SetCheckBox(doc, "AwvEkgPrecordialLeadsCheckbox", testResult.PrecordialLeads);

                _resultPdfHelper.SetCheckBox(doc, "AwvEkgShortPrIntervalCheckbox", testResult.ShortPrInterval);

                _resultPdfHelper.SetFindingsHorizontal(doc, testResult.InfarctionPatternFinding, ipFindings, "AwvEkgInfarctionPatternFinding", 2);

                if (testResult.ResultImage != null && (testResult.UnableScreenReason == null || testResult.UnableScreenReason.Count == 0) && (showUnreadableTest || testResult.RepeatStudy == null || testResult.RepeatStudy.Reading == false))
                {
                    _resultPdfHelper.LoadTestMedia(doc, new[] { testResult.ResultImage }, "testmedia-AwvEkg", loadImages);

                    selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='AwvEkgReport']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block");
                    }
                    selectedNode = doc.DocumentNode.SelectSingleNode("//img[@id='AwvEkgGraph']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("src", stringforMediaDirectory + "/" + testResult.ResultImage.File.Path);
                    }
                }

                _resultPdfHelper.SetTechnician(doc, testResult, "techAwvEkg", "technotesAwvEkg", technicianIdNamePairs);
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.AwvEkg, "AwvEkgUnableToScreen", testResult.UnableScreenReason);
                _resultPdfHelper.SetPhysicianRemarks(doc, testResult, "followUpAwvEkg", "criticalAwvEkg", "AwvEkgPhysicianNotesTextbox");

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='AwvEkg-longdescription-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", removeLongDescription ? "display:none" : "display:block");
                }
            }
            else
            {
                LoadAwvEkgFindings(doc, null, false);
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.AwvEkg, "AwvEkgUnableToScreen", null);
                _resultPdfHelper.SetFindingsHorizontal(doc, new StandardFinding <int>(), bbbFindings, "AwvEkgBundleBranchBlockFinding", 3);
                _resultPdfHelper.SetFindingsHorizontal(doc, new StandardFinding <int>(), ipFindings, "AwvEkgInfarctionPatternFinding", 2);
            }
        }
        public void LoadLeadTestresults(HtmlDocument doc, LeadTestResult testResult, bool removeLongDescription, List <OrderedPair <long, string> > technicianIdNamePairs,
                                        bool loadImages, IEnumerable <CustomerScreeningEvaluatinPhysicianViewModel> physicians, IEnumerable <EventPhysicianTest> eventPhysicianTests,
                                        IEnumerable <PhysicianEvaluation> eventCustomerPhysicianEvaluation, CustomerSkipReview customerSkipReview, DateTime eventDate,
                                        bool isPhysicianPartnerCustomer)
        {
            var findingVelocityLeftList  = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.Lead, (int)ReadingLabels.LeftCFAPSV);
            var findingVelocityRightList = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.Lead, (int)ReadingLabels.RightCFAPSV);
            var incidentalFindings       = _incidentalFindingRepository.GetAllIncidentalFinding((int)TestType.Stroke);

            var selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='LowVelocityLeftLabel']");

            if (selectedNode != null)
            {
                selectedNode.InnerHtml = findingVelocityLeftList.FirstOrDefault().Label;
            }

            selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='LowVelocityRightLabel']");
            if (selectedNode != null)
            {
                selectedNode.InnerHtml = findingVelocityRightList.FirstOrDefault().Label;
            }

            var getAbsValue = new Func <ResultReading <decimal?>, ResultReading <decimal?> >(r =>
            {
                if (r != null && r.Reading != null && r.Reading.Value < 0)
                {
                    r.Reading = r.Reading.Value * -1;
                }

                return(r);
            });


            if (testResult != null)
            {
                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='lead-rpp-section']");
                if (selectedNode != null && (testResult.UnableScreenReason == null || testResult.UnableScreenReason.Count == 0) && (testResult.TestNotPerformed == null || testResult.TestNotPerformed.TestNotPerformedReasonId <= 0) &&
                    (testResult.RepeatStudy == null || testResult.RepeatStudy.Reading == false))
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='rpp-eus-lead-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                _resultPdfHelper.SetPhysicianSignature(doc, "lead-primaryEvalPhysicianSign", "lead-overreadEvalPhysicianSign", physicians, eventPhysicianTests, eventCustomerPhysicianEvaluation, customerSkipReview);

                var readings = new TestResultRepository().GetAllReadings((int)TestType.Lead);

                foreach (var resultReading in readings)
                {
                    switch (resultReading.Label)
                    {
                    case ReadingLabels.RightCFAPSV:
                        if (testResult.RightResultReadings != null)
                        {
                            testResult.RightResultReadings.CFAPSV = getAbsValue(testResult.RightResultReadings.CFAPSV);
                            _resultPdfHelper.SetInputBox(doc, "RightCFAPSVInputText", testResult.RightResultReadings.CFAPSV);
                        }
                        break;

                    case ReadingLabels.RightPSFAPSV:
                        if (testResult.RightResultReadings != null)
                        {
                            testResult.RightResultReadings.PSFAPSV = getAbsValue(testResult.RightResultReadings.PSFAPSV);
                            _resultPdfHelper.SetInputBox(doc, "RightPSFAPSVInputText", getAbsValue(testResult.RightResultReadings.PSFAPSV));
                        }
                        break;


                    case ReadingLabels.LeftCFAPSV:
                        if (testResult.LeftResultReadings != null)
                        {
                            testResult.LeftResultReadings.CFAPSV = getAbsValue(testResult.LeftResultReadings.CFAPSV);
                            _resultPdfHelper.SetInputBox(doc, "LeftCFAPSVInputText", getAbsValue(testResult.LeftResultReadings.CFAPSV));
                        }
                        break;

                    case ReadingLabels.LeftPSFAPSV:
                        if (testResult.LeftResultReadings != null)
                        {
                            testResult.LeftResultReadings.PSFAPSV = getAbsValue(testResult.LeftResultReadings.PSFAPSV);
                            _resultPdfHelper.SetInputBox(doc, "LeftPSFAPSVInputText", getAbsValue(testResult.LeftResultReadings.PSFAPSV));
                        }
                        break;

                    case ReadingLabels.TechnicallyLimitedbutReadable:
                        _resultPdfHelper.SetCheckBox(doc, "TechnicallyLimitedbutReadableLeadInputCheck", testResult.TechnicallyLimitedbutReadable);
                        break;

                    case ReadingLabels.RepeatStudy:
                        _resultPdfHelper.SetCheckBox(doc, "RepeatStudyLeadInputCheck", testResult.RepeatStudy);
                        break;
                    }
                }


                if (findingVelocityLeftList != null)
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//input[@id='LowVelocityLeftCheckbox']");
                    if (selectedNode != null && testResult.LowVelocityLeft != null)
                    {
                        selectedNode.SetAttributeValue("checked", "checked");
                    }
                }

                if (findingVelocityLeftList != null)
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//input[@id='LowVelocityRightCheckbox']");
                    if (selectedNode != null && testResult.LowVelocityRight != null)
                    {
                        selectedNode.SetAttributeValue("checked", "checked");
                    }
                }

                _resultPdfHelper.LoadTestMedia(doc, testResult.ResultImages, "testmedia-lead", loadImages);
                LoadLeadIncidentalFindings(doc, incidentalFindings, testResult.IncidentalFindings);
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.Lead, "leadUnableToScreen", testResult.UnableScreenReason);
                _resultPdfHelper.SetTechnician(doc, testResult, "techlead", "technoteslead", technicianIdNamePairs);
                _resultPdfHelper.SetPhysicianRemarks(doc, testResult, "followUpLead", "criticalLead", "physicianRemarksLead");

                if (testResult.IncidentalFindings != null && testResult.IncidentalFindings.Any())
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//p[@id='incidentalfinding-description-lead']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block;");
                    }
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//span[@id='diagnosisCodeLead']");

                if (selectedNode != null && testResult.DiagnosisCode != null && !string.IsNullOrEmpty(testResult.DiagnosisCode.Reading))
                {
                    var readingList = testResult.DiagnosisCode.Reading.Split('|');
                    var stBuilder   = string.Empty;

                    foreach (var reading in readingList)
                    {
                        stBuilder = stBuilder + "<br/>" + reading;
                    }

                    selectedNode.InnerHtml = stBuilder;
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='lead-longdescription-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", removeLongDescription ? "display:none" : "display:block");
                }

                if (_settings.ChangeLeadReadingDate.HasValue && eventDate.Date >= _settings.ChangeLeadReadingDate.Value)
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='diagnosisCodeLeadContainer']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:none");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//table[@id='leadFinding']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:none");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//table[@id='leadFinding-CheckBox']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='lead-longdescription-div']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:none");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//p[@id='long-description-lead']");
                    if (selectedNode != null)
                    {
                        selectedNode.InnerHtml = "<i>" + LeadLongLongDescription + "</i>";
                    }

                    if (testResult.RightResultReadings != null)
                    {
                        _resultPdfHelper.SetCheckBox(doc, "rightNoVisualPlaque", testResult.RightResultReadings.NoVisualPlaque);
                        _resultPdfHelper.SetCheckBox(doc, "rightVisuallyDemonstratedPlaque", testResult.RightResultReadings.VisuallyDemonstratedPlaque);
                        _resultPdfHelper.SetCheckBox(doc, "rightModerateStenosis", testResult.RightResultReadings.ModerateStenosis);
                        _resultPdfHelper.SetCheckBox(doc, "rightPossibleOcclusion", testResult.RightResultReadings.PossibleOcclusion);
                    }

                    if (testResult.LeftResultReadings != null)
                    {
                        _resultPdfHelper.SetCheckBox(doc, "leftNoVisualPlaque", testResult.LeftResultReadings.NoVisualPlaque);
                        _resultPdfHelper.SetCheckBox(doc, "leftVisuallyDemonstratedPlaque", testResult.LeftResultReadings.VisuallyDemonstratedPlaque);
                        _resultPdfHelper.SetCheckBox(doc, "leftModerateStenosis", testResult.LeftResultReadings.ModerateStenosis);
                        _resultPdfHelper.SetCheckBox(doc, "leftPossibleOcclusion", testResult.LeftResultReadings.PossibleOcclusion);
                    }

                    SetLeadResult(doc, testResult, readings);
                }
                else
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='diagnosisCodeLeadContainer']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//table[@id='leadFinding']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block");
                    }

                    selectedNode = doc.DocumentNode.SelectSingleNode("//table[@id='leadFinding-CheckBox']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:none");
                    }

                    LoadLeadFindings(doc, testResult);
                }

                if (isPhysicianPartnerCustomer)
                {
                    selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='ppLead-patient-detail']");
                    if (selectedNode != null)
                    {
                        selectedNode.SetAttributeValue("style", "display:block");
                    }
                }
            }
            else
            {
                LoadLeadFindings(doc, null, false);
                _resultPdfHelper.SetIncidentalFindings(doc, incidentalFindings, null, "leadIncidenatlFindings");
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.Lead, "leadUnableToScreen", null);
            }
        }
Beispiel #7
0
        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);
        }
        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");
        }