public void LoadCholesterolResult(HtmlDocument doc, CholesterolTestResult testResult, bool isMale, List <OrderedPair <long, string> > technicianIdNamePairs)
        {
            LoadCholesterolFinding(doc, testResult, isMale);

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

                _resultPdfHelper.SetInputBox(doc, "CholesterolTotalCholestrolInputText", testResult.TotalCholesterol);
                _resultPdfHelper.SetInputBox(doc, "CholesterolLDLInputText", testResult.LDL);
                _resultPdfHelper.SetInputBox(doc, "CholesterolHDLInputText", testResult.HDL);
                _resultPdfHelper.SetInputBox(doc, "CholesterolTriglyceridesInputText", testResult.TriGlycerides);
                _resultPdfHelper.SetInputBox(doc, "CholesterolTCHDLRatioInputText", testResult.TCHDLRatio);

                _resultPdfHelper.SetTechnician(doc, testResult, "techCholesterol", "technotesCholesterol", technicianIdNamePairs);
                _resultPdfHelper.SetPhysicianRemarks(doc, testResult, "followUpCholesterol", "criticalCholesterol", "physicianRemarksCholesterol");
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.Cholesterol, "CholesterolUnableToScreen", testResult.UnableScreenReason);
            }
            else
            {
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.Cholesterol, "CholesterolUnableToScreen", null);
            }
        }
        public TestResult GetCholesterolTestResultDomain(KynHealthAssessmentEditModel model, CholesterolTestResult inpersistence, long uploadedby, bool isNewResultFlow)
        {
            if (!IsLipidReadingProvided(model) && inpersistence == null)
            {
                return(inpersistence);
            }

            decimal?tchol         = null;
            decimal?hdl           = null;
            decimal?triglycerides = null;

            if (inpersistence == null)
            {
                inpersistence = new CholesterolTestResult
                {
                    ResultStatus = new TestResultState
                    {
                        StateNumber = isNewResultFlow ? (int)NewTestResultStateNumber.ResultEntryPartial : (int)TestResultStateNumber.ManualEntry
                    }
                };
            }

            inpersistence.TotalCholesterol = GetTotalColesterolReading(model.TotalCholesterol, ref tchol);
            inpersistence.HDL           = GetHdlReading(model.HDLCholesterol, ref hdl);
            inpersistence.TriGlycerides = GetTriglyceridesReading(model.Triglycerides, ref triglycerides);
            inpersistence.TCHDLRatio    = CalculateTchdlRatio(tchol, hdl, TestType.Cholesterol);
            inpersistence.LDL           = CalculateLdlReading(hdl, tchol, triglycerides, TestType.Cholesterol);


            inpersistence.DataRecorderMetaData = SetDataRecorderMetaData(inpersistence.DataRecorderMetaData, uploadedby);
            inpersistence.ResultStatus.DataRecorderMetaData = SetDataRecorderMetaData(inpersistence.ResultStatus.DataRecorderMetaData, uploadedby);

            return(inpersistence);
        }
Beispiel #3
0
        private CholesterolTestResult GetCholesterolTestResult(CholesterolTestResult testResult)
        {
            if (testResult.TotalCholesterol == null && testResult.HDL == null && testResult.TCHDLRatio == null && testResult.LDL == null && testResult.TriGlycerides == null)
            {
                return(null);
            }

            return(testResult);
        }
        public override TestResult CreateActualTestResult(CustomerEventScreeningTestsEntity customerEventScreeningTestsEntity)
        {
            var customerEventReadingEntities = customerEventScreeningTestsEntity.CustomerEventReading.ToList();

            var testResult = new CholesterolTestResult(customerEventScreeningTestsEntity.CustomerEventScreeningTestId);

            var standardFindingTestReadingEntities =
                customerEventScreeningTestsEntity.
                StandardFindingTestReadingCollectionViaCustomerEventReading.ToList();

            var totalCholesterolData = customerEventReadingEntities.SingleOrDefault(customerEventReading => customerEventReading.TestReading.ReadingId == (int)ReadingLabels.TotalCholestrol);

            if (totalCholesterolData != null)
            {
                testResult.TotalCholesterol = CreateTestReadingforaIntValue(totalCholesterolData, (int)ReadingLabels.TotalCholestrol, standardFindingTestReadingEntities, totalCholesterolData.Value);
            }

            var hdlData = customerEventReadingEntities.SingleOrDefault(customerEventReading => customerEventReading.TestReading.ReadingId == (int)ReadingLabels.HDL);

            if (hdlData != null)
            {
                testResult.HDL = CreateTestReadingforaIntValue(hdlData, (int)ReadingLabels.HDL, standardFindingTestReadingEntities, hdlData.Value);
            }

            var ldlData = customerEventReadingEntities.SingleOrDefault(customerEventReading => customerEventReading.TestReading.ReadingId == (int)ReadingLabels.LDL);

            if (ldlData != null)
            {
                testResult.LDL = CreateTestReadingforaIntValue(ldlData, (int)ReadingLabels.LDL, standardFindingTestReadingEntities, (string.IsNullOrEmpty(ldlData.Value) ? null : (int?)Convert.ToInt32(ldlData.Value)));
            }


            var triglyceridesData = customerEventReadingEntities.SingleOrDefault(customerEventReading => customerEventReading.TestReading.ReadingId == (int)ReadingLabels.TriGlycerides);

            if (triglyceridesData != null)
            {
                testResult.TriGlycerides = CreateTestReadingforaIntValue(triglyceridesData, (int)ReadingLabels.TriGlycerides, standardFindingTestReadingEntities, triglyceridesData.Value);
            }

            var tchdlratioData = customerEventReadingEntities.SingleOrDefault(customerEventReading => customerEventReading.TestReading.ReadingId == (int)ReadingLabels.TCHDLRatio);

            if (tchdlratioData != null)
            {
                testResult.TCHDLRatio = CreateTestReadingforaDecimalValue(tchdlratioData, (int)ReadingLabels.TCHDLRatio, standardFindingTestReadingEntities,
                                                                          (string.IsNullOrEmpty(tchdlratioData.Value) ? null : (decimal?)Convert.ToDecimal(tchdlratioData.Value)));
            }

            return(testResult);
        }
        private void LoadCholesterolFinding(HtmlDocument doc, CholesterolTestResult testResult, bool isMale)
        {
            var hdlFinding       = _standardFindingRepository.GetAllStandardFindings <string>((int)TestType.Cholesterol, (int)ReadingLabels.HDL);
            var ldlFinding       = _standardFindingRepository.GetAllStandardFindings <int?>((int)TestType.Cholesterol, (int)ReadingLabels.LDL);
            var trigFinding      = _standardFindingRepository.GetAllStandardFindings <string>((int)TestType.Cholesterol, (int)ReadingLabels.TriGlycerides);
            var totalCholFinding = _standardFindingRepository.GetAllStandardFindings <string>((int)TestType.Cholesterol, (int)ReadingLabels.TotalCholestrol);
            var tcHdlFinding     = _standardFindingRepository.GetAllStandardFindings <decimal?>((int)TestType.Cholesterol, (int)ReadingLabels.TCHDLRatio);

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

            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.HDL != null ? testResult.HDL.Finding : null, hdlFinding, "CholesterolHdlFinding");

            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.LDL != null ? testResult.LDL.Finding : null, ldlFinding, "CholesterolLdlFinding");

            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.TriGlycerides != null ? testResult.TriGlycerides.Finding : null, trigFinding, "CholesterolTriglyceridesFinding");

            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.TotalCholesterol != null ? testResult.TotalCholesterol.Finding : null, totalCholFinding, "CholesterolTotalCholestrolFinding");

            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.TCHDLRatio != null ? testResult.TCHDLRatio.Finding : null, tcHdlFinding, "CholesterolTchdlRatioFinding");
        }
Beispiel #6
0
        public TestResult Parse(long customerId, string xmlFilePath, TestType testType)
        {
            _lipidParserHelper.SetLogger(_logger);
            _errorSummary = string.Empty;
            _logger.Info(string.Format("------------------------------- {0} Parsing for file [{1}]", testType.ToString(), xmlFilePath));

            if (!File.Exists(xmlFilePath))
            {
                _errorSummary += "File doesn't exist.";
                _logger.Error("File doesn't exist.");
                return(null);
            }

            var doc = new XmlDocument();

            doc.Load(xmlFilePath);
            var elements = doc.GetElementsByTagName(_tagNameforBiomarker);

            if (elements.Count < 1)
            {
                _errorSummary += "Data not found in file.";
                _logger.Error("Data not found in file.");
                return(null);
            }

            var ldlValue     = GetLipidValue(LdlCholName, elements);
            var hdlValue     = GetLipidValue(HdlCholName, elements);
            var tCholValue   = GetLipidValue(TotalCholName, elements);
            var glucoseValue = GetLipidValue(GlucoseName, elements);
            var tglValue     = GetLipidValue(TriglyceridesName, elements);

            decimal?tchol = null;
            decimal?hdl   = null;
            //not in use
            decimal?tGlycerides = null;


            if (testType == TestType.Lipid)
            {
                var testResult = new LipidTestResult
                {
                    Glucose         = _lipidParserHelper.GetReading(glucoseValue, ReadingLabels.Glucose, testType, ref _errorSummary),
                    LDL             = _lipidParserHelper.GetReading(ldlValue, ReadingLabels.LDL, testType, ref _errorSummary),
                    TotalCholestrol = _lipidParserHelper.GetReading(tCholValue, ReadingLabels.TotalCholestrol, ref tchol, testType, ref _errorSummary),
                    TriGlycerides   = _lipidParserHelper.GetReading(tglValue, ReadingLabels.TriGlycerides, ref tGlycerides, testType, ref _errorSummary),
                    HDL             = _lipidParserHelper.GetHdlReading(hdlValue, customerId, ref hdl, testType, ref _errorSummary),
                    TCHDLRatio      = _lipidParserHelper.GetHdlTclRatio(hdl, tchol, testType, ref _errorSummary)
                };

                return(GetLipidTestResult(testResult));
            }

            if (testType == TestType.Cholesterol)
            {
                var testResult = new CholesterolTestResult
                {
                    LDL = _lipidParserHelper.GetReading(ldlValue, ReadingLabels.LDL, testType, ref _errorSummary),
                    TotalCholesterol = _lipidParserHelper.GetReading(tCholValue, ReadingLabels.TotalCholestrol, ref tchol, testType, ref _errorSummary),
                    TriGlycerides    = _lipidParserHelper.GetReading(tglValue, ReadingLabels.TriGlycerides, ref tGlycerides, testType, ref _errorSummary),
                    HDL        = _lipidParserHelper.GetHdlReading(hdlValue, customerId, ref hdl, testType, ref _errorSummary),
                    TCHDLRatio = _lipidParserHelper.GetHdlTclRatio(hdl, tchol, testType, ref _errorSummary)
                };

                return(GetCholesterolTestResult(testResult));
            }

            if (testType == TestType.Diabetes)
            {
                var testResult = new DiabetesTestResult
                {
                    Glucose = _lipidParserHelper.GetReading(glucoseValue, ReadingLabels.Glucose, testType, ref _errorSummary)
                };

                return(GetDiabetesTestResult(testResult));
            }

            return(null);
        }