Пример #1
0
        public TestResultRepository GetTestResultRepository()
        {
            if (testResultRepository != null)
            {
                return(testResultRepository);
            }

            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();
            var databaseName   = Guid.NewGuid().ToString();

            optionsBuilder.UseInMemoryDatabase(databaseName);
            dbContext = new ApplicationDbContext(optionsBuilder.Options);
            dbContext.Database.EnsureCreated();
            PrepareDatabaseRows();

            testResultRepository = new TestResultRepository(dbContext);
            return(testResultRepository);
        }
        public List <TestResult> GetPatientNameFiles(int id)
        {
            PatientRepository pr = new PatientRepository();

            using (var Filerepo = new TestResultRepository())
            {
                int MyId = Convert.ToInt32(id);

                var name = pr.GetAll().Find(x => x.PatientId == MyId);
                return(Filerepo.GetAllDownload().Select(x => new TestResult()
                {
                    ResultId = x.Id,
                    FileName = x.FileName,
                    resultFile = x.File,
                    PatientName = name.FullName + " " + name.Surname
                }).ToList());
            }
        }
Пример #3
0
        private void SetPsaTestData(List <BioCheckResponseModel> bioCheckResponse, EventCustomer eventCustomer)
        {
            _testResultRepository = new PsaTestRepository();

            var testResult = _testResultRepository.GetTestResults(eventCustomer.CustomerId, eventCustomer.EventId);

            if (testResult != null)
            {
                var psaTestResult = testResult as PsaTestResult;
                if (psaTestResult.PSASCR != null)
                {
                    if (psaTestResult.PSASCR.Reading != null)
                    {
                        bioCheckResponse.Add(new BioCheckResponseModel("Q24", psaTestResult.PSASCR.Reading));
                    }
                }
            }
        }
        private void addPatientResult(object sender, RoutedEventArgs e)
        {
            try
            {
                ITestResultRepository testResultRepository = new TestResultRepository(ConfigurationManager.ConnectionStrings["ConnectionPatientResults"].ConnectionString);

                var parameters = new[]
                {
                    new SqlParameter(StoredProcedureParameters.Id, PatientRepository.PatientId),
                    new SqlParameter(StoredProcedureParameters.NameOfTest, "Protein Metabolism Test"),
                    new SqlParameter(StoredProcedureParameters.SpDateOfResult, Calendar.ToString()),
                    new SqlParameter(StoredProcedureParameters.GeneralProtein, Convert.ToDouble(txtGeneralProtein.Text)),
                    new SqlParameter(StoredProcedureParameters.Albumin, Convert.ToDouble(txtAlbumin.Text)),
                    new SqlParameter(StoredProcedureParameters.Globulin, Convert.ToDouble(txtGlobulin.Text)),
                    new SqlParameter(StoredProcedureParameters.Fibrinogen, Convert.ToDouble(txtFibrinogen.Text)),
                    new SqlParameter(StoredProcedureParameters.Creatinine, Convert.ToDouble(txtCreatinin.Text)),
                    new SqlParameter(StoredProcedureParameters.CreatineKinase, Convert.ToDouble(txtCreatineKinase.Text)),
                    new SqlParameter(StoredProcedureParameters.Urea, Convert.ToDouble(txtUrea.Text)),
                    new SqlParameter(StoredProcedureParameters.UreaAcid, Convert.ToDouble(txtUreaAcid.Text))
                };

                testResultRepository.InsertProteinMetabolismTestResultInfo(CommandType.StoredProcedure,
                                                                           StoredProcedureNames.SpInsertProteinMetabolismTestresultInfo, parameters);
                txtGeneralProtein.Text = string.Empty;
                txtAlbumin.Text        = string.Empty;
                txtGlobulin.Text       = string.Empty;
                txtFibrinogen.Text     = string.Empty;
                txtCreatinin.Text      = string.Empty;
                txtCreatineKinase.Text = string.Empty;
                txtUrea.Text           = string.Empty;
                txtUreaAcid.Text       = string.Empty;

                proteinMetabolism.Visibility = Visibility.Hidden;
                MessageBox.Show("Thank you, protein metabolism test result was succsesfully added");
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #5
0
        public static void CompletePhysicianEvaluation(long eventCustomerId, long physicianId, bool isSendForCorrection, bool isNewResultFlow)
        {
            ReleaseLock(eventCustomerId);
            try
            {
                if (isSendForCorrection)
                {
                    IoC.Resolve <IPhysicianEvaluationRepository>().Delete(eventCustomerId, physicianId);
                }
                else
                {
                    StopEvaluation(eventCustomerId, physicianId);

                    var physicianAssignmentService = IoC.Resolve <IPhysicianAssignmentService>();
                    var eventCustomer        = IoC.Resolve <IEventCustomerRepository>().GetById(eventCustomerId);
                    var assignedPhysicianIds =
                        physicianAssignmentService.GetPhysicianIdsAssignedtoaCustomer(eventCustomer.EventId, eventCustomer.CustomerId);
                    if (assignedPhysicianIds == null || assignedPhysicianIds.Count() == 0)
                    {
                        return;
                    }

                    if ((assignedPhysicianIds.Count() == 1 && assignedPhysicianIds.ElementAtOrDefault(0) == physicianId) || assignedPhysicianIds.ElementAtOrDefault(1) == physicianId)
                    {
                        if (!SkipAudit(assignedPhysicianIds) || isNewResultFlow)
                        {
                            return;
                        }
                        var testResultRepository = new TestResultRepository();
                        testResultRepository.SetResultstoState(eventCustomer.EventId, eventCustomer.CustomerId, (int)TestResultStateNumber.PostAudit, true, physicianId);

                        var eventCustomerResultRepository = IoC.Resolve <IEventCustomerResultRepository>();
                        eventCustomerResultRepository.SetEventCustomerResultState(eventCustomer.EventId, eventCustomer.CustomerId);
                    }
                }
            }
            catch (Exception ex)
            {
                var logger = IoC.Resolve <ILogManager>().GetLogger <Global>();
                logger.Error("Evaluation EventCustomerId (" + eventCustomerId + ") & PhysicianId (" + physicianId + "). Error occured while executing CompletePhysicianEvaluation. Message: " + ex.Message + "\n\t Stack Trace: " + ex.StackTrace);
            }
        }
        public async Task UsersWithAllCorrectAnswersAndNoWrongAnswersHaveMaximumPoints()
        {
            //Arrange
            TestResultServiceTestBase testBase             = new TestResultServiceTestBase();
            TestResultRepository      testResultRepository = await testBase.GetTestResultRepositoryAsync();

            var service = new TestResultService(testResultRepository, new CorrectAnswerPointsRule(), new BonusPointsRule(), new AnsweringTimePlaceRule());

            //Act
            service.CalculateWeeklyResults(1);
            var results = testResultRepository.GetFinalResults();

            //Assert
            Assert.Equal(
                results.Where(x => x.UserId == UserModel.userD.Id).Select(x => x.Week1Points).FirstOrDefault(),
                2 * (100 + 30));
            Assert.Equal(
                results.Where(x => x.UserId == UserModel.userC.Id).Select(x => x.Week1Points).FirstOrDefault(),
                2 * (100 + 30));
        }
Пример #7
0
        public string UpdateCasecMark(string infomation)
        {
            // Moi them 1 truong levelCasec
            //bắt sự kiện ngoại lệ như input NULL, contactID null hoặc trống, không có thông tin điểm

            // Logs
            var log = new TmpLogServiceInfo
            {
                Time        = DateTime.Now,
                Description = infomation,
                CallType    = (int)CallType.UpdateCasecMark,
            };

            try
            {
                var input = JsonConvert.DeserializeObject <UpdateCasecMark>(infomation);

                var result = CheckInputUpdateCasecMark(input);
                if (result.Code == 0)
                {
                    TestResultRepository.InsertCasecMark(input.contactId, input.casecAccount, input.tuVung, input.nguPhap, input.ngheHieu, input.chinhTa, input.toeic, input.levelCasec, input.tongDiem, input.ngayThi);
                    result.Code = 0;
                }
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
            catch (Exception ex)
            {
                var result = new Result();
                result.Code        = 1;
                result.Description = "Hệ thống hiện tại bị lỗi, cập nhật điểm không thành công: " + infomation;
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
        }
        private void SaveKynLabResult(KynHealthAssessmentEditModel model, long uploadedby, long customerId, long eventId, long eventCustomerResultId, int testId, bool isRecordable, bool isNewResultFlow)
        {
            if (isRecordable)
            {
                var testResultRepository = new TestResultRepository();
                var kynTestResult        = testResultRepository.GetTestResult(customerId, eventId, testId, isNewResultFlow);
                kynTestResult = _kynHealthAssessmentFactory.GetKynTestResultDomain(model, kynTestResult, uploadedby, testId, isNewResultFlow);
                if (kynTestResult != null)
                {
                    testResultRepository.SaveTestResults(kynTestResult, customerId, eventId, uploadedby);
                }
            }

            var kynLabValues = _kynHealthAssessmentFactory.GetKynLabValues(model);

            kynLabValues.EventCustomerResultId = eventCustomerResultId;
            kynLabValues.TestId = testId;
            _kynLabValuesRepository.Save(kynLabValues, uploadedby);

            UpdateFastingStatus(model, eventCustomerResultId);
        }
        public void InsertMethod(TestResult model, int PatientId)
        {
            Result            fileUpload = new Result();
            PatientRepository pr         = new PatientRepository();

            using (var Filerepo = new TestResultRepository())
            {
                var name = pr.GetAll().Find(x => x.PatientId == PatientId);
                foreach (var item in model.File)
                {
                    byte[] uploadfile = new byte[item.InputStream.Length];
                    item.InputStream.Read(uploadfile, 0, uploadfile.Length);

                    fileUpload.FileName    = item.FileName;
                    fileUpload.File        = uploadfile;
                    fileUpload.PatientId   = PatientId;
                    fileUpload.PatientName = name.FullName + " " + name.Surname;
                    Filerepo.Insert(fileUpload);
                }
            }
        }
Пример #10
0
        public string UpdateLinkSB100(string infomation)
        {
            var log = new TmpLogServiceInfo
            {
                Time        = DateTime.Now,
                Description = infomation,
                CallType    = (int)CallType.UpdateLinkSB100,
            };

            try
            {
                //bắt sự kiện ngoại lệ như input NULL, không có/NULL/Sai định dạng link SB100
                // Logs

                var input  = JsonConvert.DeserializeObject <UpdateLinkSB100>(infomation);
                var result = CheckInputUpdateLinkSB100(input);
                if (result.Code == 0)
                {
                    TestResultRepository.UpdateLinkSB100(input.contactId, input.SB100);
                    result.Code = 0;
                }
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
            catch (Exception ex)
            {
                var result = new Result();
                result.Code        = 1;
                result.Description = "Hệ thống hiện tại bị lỗi, cập nhật link không thành công" + infomation;
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
        }
        public async Task UsersWithTheSameCorrectAnswersAndTheSameBonusHaveTheSamePoints()
        {
            //Arrange
            TestResultServiceTestBase testBase             = new TestResultServiceTestBase();
            TestResultRepository      testResultRepository = await testBase.GetTestResultRepositoryAsync();

            var service        = new TestResultService(testResultRepository, new CorrectAnswerPointsRule(), new BonusPointsRule(), new AnsweringTimePlaceRule());
            var expectedResult = testBase.GetExpectedWeek1ResultModel();

            //Act
            service.CalculateWeeklyResults(1);
            var results = testResultRepository.GetFinalResults();

            //Assert
            Assert.Equal(
                results.Where(x => x.UserId == UserModel.userA.Id).Select(x => x.Week1Points).FirstOrDefault(),
                results.Where(x => x.UserId == UserModel.userB.Id).Select(x => x.Week1Points).FirstOrDefault());

            Assert.Equal(
                expectedResult.Where(x => x.UserId == UserModel.userA.Id).Select(x => x.Week1Points).FirstOrDefault(),
                results.Where(x => x.UserId == UserModel.userA.Id).Select(x => x.Week1Points).FirstOrDefault());
        }
Пример #12
0
        public string UpdateLinkSB100(string infomation)
        {
            //bắt sự kiện ngoại lệ như input NULL, không có/NULL/Sai định dạng link SB100
            // Logs
            var log = new TmpLogServiceInfo
            {
                Time        = DateTime.Now,
                Description = infomation,
                CallType    = (int)CallType.UpdateLinkSB100,
            };
            var input  = JsonConvert.DeserializeObject <UpdateLinkSB100>(infomation);
            var result = CheckInputUpdateLinkSB100(input);

            if (result.Code == 0)
            {
                TestResultRepository.UpdateLinkSB100(input.contactId, input.SB100);
                result.Code = 0;
            }
            var output = JsonConvert.SerializeObject(result);

            return(output);
        }
        public async Task UsersWithNoCorrectAnswersHaveZeroPoints()
        {
            //Arrange
            TestResultServiceTestBase testBase             = new TestResultServiceTestBase();
            TestResultRepository      testResultRepository = await testBase.GetTestResultRepositoryAsync();

            var service        = new TestResultService(testResultRepository, new CorrectAnswerPointsRule(), new BonusPointsRule(), new AnsweringTimePlaceRule());
            var expectedResult = testBase.GetExpectedWeek1ResultModel();

            //Act
            service.CalculateWeeklyResults(1);
            var results = testResultRepository.GetFinalResults();

            //Assert
            var expectedResultItems = expectedResult.Where(x => x.Week1Points == 0).Select(x => x.UserId).ToList();
            var resultItems         = results.Where(x => x.Week1Points == 0).Select(x => x.UserId).ToList();

            Assert.Equal(expectedResultItems.Count, resultItems.Count);
            foreach (var item in expectedResultItems)
            {
                Assert.Contains(item, resultItems);
            }
        }
Пример #14
0
        public GenerateBioCheckJsonPollingAgent(IEventCustomerRepository eventCustomerRepository, ILogManager logManager,
                                                ICustomerRepository customerRepository, IEventRepository eventRepository,
                                                IHealthAssessmentRepository healthAssessmentRepository, IKynLabValuesRepository kynLabValuesRepository,
                                                IBasicBiometricRepository basicBiometricRepository, ISettings settings, ITraleApiService trailApiService, IMediaRepository mediaRepository, IMediaHelper mediaHelper)
        {
            _eventCustomerRepository = eventCustomerRepository;
            _logManager = logManager;

            _customerRepository         = customerRepository;
            _eventRepository            = eventRepository;
            _healthAssessmentRepository = healthAssessmentRepository;
            _kynLabValuesRepository     = kynLabValuesRepository;
            _basicBiometricRepository   = basicBiometricRepository;
            _trailApiService            = trailApiService;
            _mediaRepository            = mediaRepository;
            _mediaHelper = mediaHelper;
            _logger      = logManager.GetLogger("GenerateBIoCheckJsonPollingAgent");

            _bioCheckAssessmentTestResultRepository = new MyBioAssessmentTestRepository();
            _profileId         = settings.ProfileId;
            _isDevEnvironment  = settings.IsDevEnvironment;
            _testResultService = new Service.TestResultService();
        }
        public async Task GetWeek2CorrectRanking()
        {
            //Arrange
            TestResultServiceTestBase testBase             = new TestResultServiceTestBase();
            TestResultRepository      testResultRepository = await testBase.GetTestResultRepositoryAsync();

            var service        = new TestResultService(testResultRepository, new CorrectAnswerPointsRule(), new BonusPointsRule(), new AnsweringTimePlaceRule());
            var expectedResult = testBase.GetExpectedWeek2ResultModel();

            //Act
            service.CalculateWeeklyResults(2);
            var results = testResultRepository.GetFinalResults();

            //Assert
            var expectedResultItems = expectedResult.Select(x => GetWeek2Result(x)).ToList();
            var resultItems         = results.Select(x => GetWeek2Result(x)).ToList();

            Assert.Equal(expectedResultItems.Count, resultItems.Count);
            foreach (var item in expectedResultItems)
            {
                Assert.Contains(item, resultItems);
            }
        }
Пример #16
0
        public string UpdateInterviewMark(string infomation)
        {
            // Logs
            var log = new TmpLogServiceInfo
            {
                Time        = DateTime.Now,
                Description = infomation,
                CallType    = (int)CallType.UpdateInterviewMark,
            };

            try
            {
                var input  = JsonConvert.DeserializeObject <UpdateInterviewMark>(infomation);
                var result = CheckInputUpdateInterviewMark(input);
                if (result.Code == 0)
                {
                    TestResultRepository.InsertInterviewMark(input.contactId, input.smooth, input.vocabulary, input.grammar, input.rythm, input.speaking, input.levelSpeaking, input.Notes, input.agent_user);
                    result.Code = 0;
                }
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
            catch (Exception ex)
            {
                var result = new Result();
                result.Code        = 1;
                result.Description = "Hệ thống hiện tại bị lỗi, cập nhật điểm không thành công" + infomation;
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
        }
Пример #17
0
        private void addPatientResult(object sender, RoutedEventArgs e)
        {
            try
            {
                ITestResultRepository testResultRepository = new TestResultRepository(ConfigurationManager.ConnectionStrings["ConnectionPatientResults"].ConnectionString);

                var parameters = new[]
                {
                    new SqlParameter(StoredProcedureParameters.Id, PatientRepository.PatientId),
                    new SqlParameter(StoredProcedureParameters.NameOfTest, "Test Test"),
                    new SqlParameter(StoredProcedureParameters.SpDateOfResult, Calendar.ToString()),
                    new SqlParameter(StoredProcedureParameters.Kaltsydol, Convert.ToDouble(txtCaltsydol.Text)),
                    new SqlParameter(StoredProcedureParameters.Cobalamin, Convert.ToDouble(txtCobalamin.Text)),
                    new SqlParameter(StoredProcedureParameters.FolicAcid, Convert.ToDouble(txtFoliAcid.Text)),
                    new SqlParameter(StoredProcedureParameters.Pyridoxine, Convert.ToDouble(txtPyridoxin.Text)),
                    new SqlParameter(StoredProcedureParameters.Retinol, Convert.ToDouble(txtRetinol.Text)),
                    new SqlParameter(StoredProcedureParameters.Tocopherol, Convert.ToDouble(txtTocopheron.Text))
                };

                testResultRepository.InsertVitaminsTestResultInfo(CommandType.StoredProcedure,
                                                                  StoredProcedureNames.SpInsertVitaminsTestResultInfo, parameters);
                txtCaltsydol.Text  = string.Empty;
                txtCobalamin.Text  = string.Empty;
                txtFoliAcid.Text   = string.Empty;
                txtPyridoxin.Text  = string.Empty;
                txtRetinol.Text    = string.Empty;
                txtTocopheron.Text = string.Empty;

                vitaminsWindow.Visibility = Visibility.Hidden;
                MessageBox.Show("Thank you, vitamins test result was succsesfully added");
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #18
0
        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);
            }
        }
Пример #19
0
        public void LoadFloChecAbiTestResults(HtmlDocument doc, FloChecABITestResult testResult, bool removeLongDescription, IEnumerable <CustomerScreeningEvaluatinPhysicianViewModel> physicians, IEnumerable <EventPhysicianTest> eventPhysicianTests,
                                              List <OrderedPair <long, string> > technicianIdNamePairs, bool loadImages, bool showUnreadableTest, IEnumerable <PhysicianEvaluation> eventCustomerPhysicianEvaluations, CustomerSkipReview customerSkipReview)
        {
            var incidentalFindings = _incidentalFindingRepository.GetAllIncidentalFinding((int)TestType.FloChecABI);

            if (testResult != null)
            {
                var selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='FloChecAbi-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;");
                }


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

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

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

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

                    case ReadingLabels.LeftHandBFI:
                        if (testResult.LeftResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "FloChecAbitxtLeftHandBFI", testResult.LeftResultReadings.BFI);
                        }
                        break;

                    case ReadingLabels.RightABI:
                        if (testResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "FloChecAbitxtRightFootdABI", testResult.RightResultReadings.ABI);

                            if (testResult.RightResultReadings.ABI != null && testResult.RightResultReadings.ABI.Reading.HasValue)
                            {
                                rightAbi = testResult.RightResultReadings.ABI.Reading;
                            }
                        }
                        break;

                    case ReadingLabels.RightHandBFI:
                        if (testResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "FloChecAbitxtRightHandBFI", testResult.RightResultReadings.BFI);
                        }
                        break;

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

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

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

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

                long findingId = 0;

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

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

                LoadFloChecAbiFindings(doc, testResult.Finding, standardFindingList, findingId, true, (testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0 ? testResult.UnableScreenReason.First() : null));
                _resultPdfHelper.SetTechnician(doc, testResult, "techFloChecAbi", "technotesFloChecAbi", technicianIdNamePairs);
                _resultPdfHelper.SetIncidentalFindings(doc, incidentalFindings, testResult.IncidentalFindings, "FloChecAbiIncidentalFinding");
                _resultPdfHelper.SetPhysicianRemarks(doc, testResult, "followUpFloChecAbi", "criticalFloChecAbi", "physicianRemarksFloChecAbi");
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.FloChecABI, "FloChecAbiUnableToScreen", testResult.UnableScreenReason);

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

                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-FloChecAbi", loadImages);
                }

                selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='FloChecAbi-longdescription-div']");
                if (selectedNode != null)
                {
                    selectedNode.SetAttributeValue("style", removeLongDescription ? "display:none" : "display:block");
                }
            }
            else
            {
                LoadFloChecAbiFindings(doc, null, null, 0, false);
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.FloChecABI, "FloChecAbiUnableToScreen", null);
                _resultPdfHelper.SetIncidentalFindings(doc, incidentalFindings, null, "FloChecAbiIncidentalFinding");
            }
        }
Пример #20
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");
            }
        }
Пример #21
0
        public void PadOverlayResults(HtmlDocument doc, PADTestResult padTestResult)
        {
            var selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='AnkleBrachialIndexDiv']");

            if (selectedNode != null)
            {
                selectedNode.SetAttributeValue("style", "display:block;");
            }

            if (padTestResult != null)
            {
                var readings = new TestResultRepository().GetAllReadings((int)TestType.PAD);
                foreach (var resultReading in readings)
                {
                    switch (resultReading.Label)
                    {
                    case ReadingLabels.LeftABI:
                        if (padTestResult.LeftResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "LeftAbi", padTestResult.LeftResultReadings.ABI);
                        }
                        break;

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

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

                    case ReadingLabels.RightABI:
                        if (padTestResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "RightAbi", padTestResult.RightResultReadings.ABI);
                        }
                        break;

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

                    case ReadingLabels.SystolicRAnkle:
                        if (padTestResult.RightResultReadings != null)
                        {
                            _resultPdfHelper.SetInputBox(doc, "RightAnkleSystolicPressure", padTestResult.RightResultReadings.SystolicAnkle);
                        }
                        break;
                    }
                }
            }
        }
Пример #22
0
        private ContactLevelInfoModel InitModel(ContactInfo contactInfo, ContactLevelInfo contactLevelInfo)
        {
            var model = new ContactLevelInfoModel
            {
                ContactInfo      = contactInfo,
                ContactLevelInfo = contactLevelInfo,
            };

            if (model.ContactLevelInfo != null)
            {
                // AppointmentTime
                if (model.ContactLevelInfo.AppointmentTime != null)
                {
                    model.AppointmentTime = model.ContactLevelInfo.AppointmentTime.Value.ToString("dd/MM/yyyy");
                }
            }

            if (model.ContactInfo != null)
            {
                // Phone
                var listPhone = PhoneRepository.GetByContact(contactInfo.Id);
                if (listPhone != null)
                {
                    model.ContactInfo.Mobile1 = listPhone.Count > 0 ? listPhone[0].PhoneNumber : string.Empty;
                    model.ContactInfo.Mobile2 = listPhone.Count > 1 ? listPhone[1].PhoneNumber : string.Empty;
                    model.ContactInfo.Mobile3 = listPhone.Count > 2 ? listPhone[2].PhoneNumber : string.Empty;
                }

                // Birthday
                if (model.ContactInfo.Birthday != null)
                {
                    model.Birthday = model.ContactInfo.Birthday.Value.ToString("dd/MM/yyyy");
                }
            }
            else
            {
                model.ContactInfo = new ContactInfo();
            }

            // StatusMaps
            List <StatusMapInfo> statusMaps;

            if (StoreData.ListStatusMap != null && StoreData.ListStatusMap.Count > 0)
            {
                statusMaps = model.ContactInfo == null
                                     ? StoreData.ListStatusMap
                                     : StoreData.ListStatusMap.Where(c => c.LevelId == model.ContactInfo.LevelId).ToList();
            }
            else
            {
                statusMaps = model.ContactInfo == null
                                         ? StatusMapRepository.GetAll()
                                         : StatusMapRepository.GetAllByLevelId(model.ContactInfo.LevelId);
            }
            ViewBag.StatusMaps = statusMaps != null && statusMaps.Count > 0
                                     ? statusMaps.Where(c => c.StatusMapType == (int)EmployeeType.Consultant).ToList()
                                     : new List <StatusMapInfo>();
            // CasecAccountInfo
            var casecAccounts = CasecAccountRepository.GetAllByContactId(contactLevelInfo.ContactId) ?? new List <CasecAccountInfo>();

            model.CasecAccountInfo = casecAccounts.FirstOrDefault(c => c.StatusCasecAccountId == (int)StatusCasecType.Used);
            model.ContactLevelInfo.HasCasecAccount       = model.CasecAccountInfo != null;
            model.ContactLevelInfo.HasCasecAccountHidden = model.ContactLevelInfo.HasCasecAccount;

            // TopicaAccountInfo
            var topicaAccounts = TopicaAccountRepository.GetAllByContactId(contactLevelInfo.ContactId) ?? new List <TopicaAccountInfo>();

            model.TopicaAccountInfo = topicaAccounts.FirstOrDefault(c => c.StatusTopicaAccountId == (int)StatusTopicaType.Used);
            model.ContactLevelInfo.HasTopicaAccount      = model.TopicaAccountInfo != null;
            model.ContactLevelInfo.HasCasecAccountHidden = model.ContactLevelInfo.HasTopicaAccount;

            // TestResultCasecInfo
            model.TestResultCasecInfo = TestResultRepository.GetResultCasecCurent(contactLevelInfo.ContactId);
            if (model.TestResultCasecInfo != null)
            {
                if (model.TestResultCasecInfo.FullName == null || model.TestResultCasecInfo.FullName == "")
                {
                    model.TestResultCasecInfo.FullName = model.ContactInfo.Fullname;
                }
                model.ContactLevelInfo.HasPointTestCasec = true;
                var casecAccount = casecAccounts.FirstOrDefault(c => c.Id == model.TestResultCasecInfo.CasecAccountId) ?? new CasecAccountInfo();
                model.TestResultCasecInfo.Account  = casecAccount.Account;
                model.TestResultCasecInfo.Password = casecAccount.Password;
            }
            else
            {
                model.ContactLevelInfo.HasPointTestCasec = false;
            }
            model.ContactLevelInfo.HasPointTestCasecHidden = model.ContactLevelInfo.HasPointTestCasec;

            // TestResultTopicaInfo
            model.TestResultTopicaInfo = TestResultRepository.GetResultTopicaCurent(contactLevelInfo.ContactId);
            if (model.TestResultTopicaInfo != null)
            {
                if (model.TestResultTopicaInfo.FullName == null || model.TestResultTopicaInfo.FullName == "")
                {
                    model.TestResultTopicaInfo.FullName = model.ContactInfo.Fullname;
                }
                model.ContactLevelInfo.HasPointTestTopica = true;
                var topicaAccount = topicaAccounts.FirstOrDefault(c => c.Account == model.TestResultTopicaInfo.Account) ?? new TopicaAccountInfo();
                model.TestResultTopicaInfo.Account  = topicaAccount.Account;
                model.TestResultTopicaInfo.Password = topicaAccount.Password;
            }
            else
            {
                model.ContactLevelInfo.HasPointTestTopica = false;
            }
            model.ContactLevelInfo.HasPointTestCasecHidden = model.ContactLevelInfo.HasPointTestTopica;

            // TestResultInterviewInfo
            model.TestResultInterviewInfo = TestResultRepository.GetResultInterviewCurent(contactLevelInfo.ContactId);
            if (model.TestResultInterviewInfo != null)
            {
                if (model.TestResultInterviewInfo.FullName == null || model.TestResultInterviewInfo.FullName == "")
                {
                    model.TestResultInterviewInfo.FullName = model.ContactInfo.Fullname;
                }
                model.ContactLevelInfo.HasPointInterview = true;
            }
            else
            {
                model.ContactLevelInfo.HasPointInterview = false;
            }
            model.ContactLevelInfo.HasPointInterviewHidden = model.ContactLevelInfo.HasPointInterview;

            // TestResultLinkSb100Info
            model.TestResultLinkSb100Info = TestResultRepository.GetResultLinkSb100Curent(contactLevelInfo.ContactId);

            return(model);
        }
Пример #23
0
        public ActionResult SendEmailWithAttachment(MailModel objModelMail, HttpPostedFileBase fileUploader
                                                    , HttpPostedFileBase fileUploader2, HttpPostedFileBase fileUploader3, HttpPostedFileBase fileUploader4, HttpPostedFileBase fileUploader5)
        {
            if (ModelState.IsValid)
            {
                var user      = UserContext.GetCurrentUser();
                var emailSend = user.EmailSend;

                //var passwordSend = SecurityHelper.Decrypt(user.PasswordSend);
                var passwordSendtext = "198uR6IM2naAocEN07w/9g==";
                var passwordSend     = SecurityHelper.Decrypt(passwordSendtext);
                //var type = objModelMail.TypeEmail;
                //type = 4;
                var emails = objModelMail.To.Split(';');

                foreach (var emailTo in emails)
                {
                    using (var mail = new MailMessage(emailSend, emailTo))
                    {
                        mail.Subject = objModelMail.Subject;
                        mail.Body    = objModelMail.Body;
                        int type_email = objModelMail.TypeEmail;
                        int id         = objModelMail.ContactId;
                        if (fileUploader != null)
                        {
                            string fileName = Path.GetFileName(fileUploader.FileName);
                            mail.Attachments.Add(new Attachment(fileUploader.InputStream, fileName));
                        }
                        if (fileUploader2 != null)
                        {
                            string fileName = Path.GetFileName(fileUploader2.FileName);
                            mail.Attachments.Add(new Attachment(fileUploader2.InputStream, fileName));
                        }
                        if (fileUploader3 != null)
                        {
                            string fileName = Path.GetFileName(fileUploader3.FileName);
                            mail.Attachments.Add(new Attachment(fileUploader3.InputStream, fileName));
                        }
                        if (fileUploader4 != null)
                        {
                            string fileName = Path.GetFileName(fileUploader4.FileName);
                            mail.Attachments.Add(new Attachment(fileUploader4.InputStream, fileName));
                        }
                        if (fileUploader5 != null)
                        {
                            string fileName = Path.GetFileName(fileUploader5.FileName);
                            mail.Attachments.Add(new Attachment(fileUploader5.InputStream, fileName));
                        }

                        if (type_email == 4)
                        {
                            try
                            {
                                string path     = Server.MapPath("~/FileAttach/huongdantestphongvan04.png");
                                string fileName = Path.GetFileName(path);
                                //string fileName = Path.GetFileName(@"C:\FileAttach\huongdantestphongvan04.png");
                                FileStream fileStream = new FileStream(path, FileMode.Open);
                                mail.Attachments.Add(new Attachment(fileStream, fileName));

                                string path2     = Server.MapPath("~/FileAttach/CASEC_Huongdandanhchothisinh4.docx");
                                string fileName2 = Path.GetFileName(path2);
                                //string fileName2 = Path.GetFileName(@"C:\FileAttach\CASEC_Huongdandanhchothisinh4.docx");
                                FileStream fileStream2 = new FileStream(path2, FileMode.Open);
                                mail.Attachments.Add(new Attachment(fileStream2, fileName2));
                            }
                            catch { }
                        }

                        if (type_email == 7)
                        {
                            try
                            {
                                string     path       = Server.MapPath("~/FileAttach/huongdantestphongvan07.png");
                                string     fileName   = Path.GetFileName(path);
                                FileStream fileStream = new FileStream(path, FileMode.Open);
                                mail.Attachments.Add(new Attachment(fileStream, fileName));

                                string     path2       = Server.MapPath("~/FileAttach/Huongdansudungbaithilythuyet7.docx");
                                string     fileName2   = Path.GetFileName(path2);
                                FileStream fileStream2 = new FileStream(path2, FileMode.Open);
                                mail.Attachments.Add(new Attachment(fileStream2, fileName2));
                            }
                            catch { }
                        }

                        if (type_email == 6)
                        {
                            TestResultLinkSb100Info contactLevelInfos = new TestResultLinkSb100Info();
                            contactLevelInfos = TestResultRepository.GetResultLinkSb100Curent(id);
                            string sb100_chuoi = "";
                            sb100_chuoi = contactLevelInfos.LinkSb100.ToString();
                            string fileName3      = Path.GetFileName(sb100_chuoi);
                            var    request        = (HttpWebRequest)WebRequest.Create(sb100_chuoi);
                            var    response       = request.GetResponse();
                            var    responseStream = response.GetResponseStream();
                            mail.Attachments.Add(new Attachment(responseStream, fileName3));
                        }
                        mail.IsBodyHtml   = true;
                        mail.BodyEncoding = Encoding.UTF8;
                        var smtp = new SmtpClient {
                            Host = "smtp.gmail.com", EnableSsl = true
                        };
                        //{ Host = "smtp.gmail.com", EnableSsl = true };
                        var networkCredential = new NetworkCredential(emailSend, passwordSend);
                        smtp.UseDefaultCredentials = true;
                        smtp.Credentials           = networkCredential;
                        smtp.Timeout = 3600000;
                        smtp.Port    = 587;
                        smtp.Send(mail);
                        ViewBag.Message = "Sent";
                    }
                }
                return(View("SendEmailWithAttachment", objModelMail));
            }
            return(View());
        }
Пример #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Initial Code just to hide left hand side panel for this page.
            var masterPage = (TecnicianManualEntry)Page.Master;

            if (masterPage != null)
            {
                masterPage.HideLeftContainer = true;
            }

            var accountRepository = IoC.Resolve <ICorporateAccountRepository>();
            var account           = accountRepository.GetbyEventId(EventId);

            CaptureHaf = (account == null || account.CaptureHaf);

            CapturePcpConsent = (account != null && account.CapturePcpConsent);
            IsHealthPlanEvent = (account != null && account.IsHealthPlan);


            //var communicationRepository = IoC.Resolve<ICommunicationRepository>();
            EventCustomer eventCustomer = null;

            //var lastCommentAdded = communicationRepository.GetCommentsforPhysician(CustomerId, EventId);

            if (!IsPostBack)
            {
                var setting          = IoC.Resolve <ISettings>();
                var eventsRepository = IoC.Resolve <IEventRepository>();
                var eventData        = eventsRepository.GetById(EventId);
                eventCustomer = IoC.Resolve <IEventCustomerRepository>().Get(EventId, CustomerId);
                var eventCustomerId = eventCustomer.Id;

                var purchasedTest       = IoC.Resolve <ITestResultService>().TestPurchasedByCustomer(eventCustomerId);
                var iseawvTestPurchased = IsEawvTestPurchased = purchasedTest != null?purchasedTest.Any(x => x.Id == (long)TestType.eAWV) : false;

                IsNewResultFlow = eventData.EventDate >= setting.ResultFlowChangeDate;
                if (IsNewResultFlow)
                {
                    ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "true");
                }
                else
                {
                    ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "false");
                }

                var questionnaireType = QuestionnaireType.None;
                if (account != null && account.IsHealthPlan && eventData != null)
                {
                    questionnaireType = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>().QuestionnaireTypeByAccountIdandEventDate(account.Id, eventData.EventDate);
                }

                var isShowHraQuestioner = questionnaireType == QuestionnaireType.HraQuestionnaire;

                if (eventData.EventDate < setting.ChecklistChangeDate)
                {
                    ShowCheckList = (account != null && account.PrintCheckList);
                }

                var mediaLocation = IoC.Resolve <IMediaRepository>().GetResultMediaFileLocation(CustomerId, EventId);
                ClientScript.RegisterClientScriptBlock(Page.GetType(), "js_Location_Url", "function getLocationPrefix() { return '" + mediaLocation.PhysicalPath.Replace("\\", "\\\\") + "'; } function getUrlPrefix() { return '" + mediaLocation.Url + "'; }", true);

                GetConductedbyData(eventData);
                FillStates();

                var currentSession = IoC.Resolve <ISessionContext>();

                ClientScript.RegisterHiddenField("hfTechnicianId", currentSession.UserSession.CurrentOrganizationRole.OrganizationRoleUserId.ToString());
                ClientScript.RegisterHiddenField("hfOrganizationId", currentSession.UserSession.CurrentOrganizationRole.OrganizationId.ToString());

                string pageHeading = "";

                var basicBiometricCutOfDate = setting.BasicBiometricCutOfDate;
                var hideBasicBiometric      = (eventData.EventDate.Date >= basicBiometricCutOfDate);
                ShowHideFastingStatus           = (eventData.EventDate.Date >= setting.FastingStatusDate);
                BasicBiometric.ShowByCutOffDate = !hideBasicBiometric;

                TestSection.SetSectionShowHide(hideBasicBiometric);

                if (currentSession != null && currentSession.UserSession != null && currentSession.UserSession.CurrentOrganizationRole != null)
                {
                    RoleId = currentSession.UserSession.CurrentOrganizationRole.GetSystemRoleId;
                }


                if (Mode == EditResultMode.ResultCorrection)
                {
                    var result = new CommunicationRepository().GetPhysicianandCommentsforFranchisee(CustomerId, EventId);
                    if (!string.IsNullOrEmpty(result.SecondValue))
                    {
                        PhysicianCommentsDiv.Visible = true;
                        PhysicianCommentsMessageBox.ShowErrorMessage("<b><u>Physician Comments:</u> </b>" + result.SecondValue);
                    }

                    updateWithCorrectionDivTop.Visible = true;
                    saveDivTop.Visible    = false;
                    approveDivtop.Visible = false;

                    updateWithCorrectionsDivbottom.Visible = true;
                    saveDivbottom.Visible    = false;
                    approveDivbottom.Visible = false;

                    var physicianService = IoC.Resolve <IPhysicianAssignmentService>();
                    var physicianIds     = physicianService.GetPhysicianIdsAssignedtoaCustomer(EventId, CustomerId);
                    if (physicianIds != null && result.FirstValue > 0 && physicianIds.Count() == 2 && physicianIds.ElementAt(1) == result.FirstValue)
                    {
                        SendToOvereadPhysician = true;
                    }

                    ClientScript.RegisterHiddenField("ResultStatusInputHidden", "4");

                    pageHeading = "Results Update/Correction";
                }


                if (Mode == EditResultMode.ResultPreAudit) // && isTechTeamConfigured == true)
                {
                    ClientScript.RegisterHiddenField("ResultStatusInputHidden", "4");
                    pageHeading = "Results Pre Audit";

                    saveDivTop.Visible    = false;
                    saveDivbottom.Visible = false;

                    if (TestSection.ContainsReviewableTests && !IsNewResultFlow)
                    {
                        skipevaluationdivbottom.Visible = true;
                    }

                    var customerHealthInfo = IoC.Resolve <IHealthAssessmentRepository>().Get(CustomerId, EventId);
                    if (!CaptureHaf || (customerHealthInfo != null && customerHealthInfo.Any()))
                    {
                        ClientScript.RegisterStartupScript(Page.GetType(), "js_setmedicalhistory", "setMedicalHistory();", true);
                    }

                    var defaultPhysician = IoC.Resolve <IPhysicianRepository>().GetDefaultPhysicianforEvent(EventId);
                    ClientScript.RegisterHiddenField("DefaultPhysician", defaultPhysician.ToString());

                    //var eventCustomerId = IoC.Resolve<IEventCustomerRepository>().Get(EventId, CustomerId).Id;
                    var isCustomerSkipped = IoC.Resolve <IPhysicianEvaluationRepository>().IsMarkedReviewSkip(eventCustomerId);
                    if (isCustomerSkipped)
                    {
                        ClientScript.RegisterStartupScript(Page.GetType(), "js_markcustomerskipped", "$('#skipevaluationcheckbox').attr('checked', true);", true);
                    }
                }
                else if (Mode == EditResultMode.ResultEntry)
                {
                    if (IsNewResultFlow)
                    {
                        ClientScript.RegisterHiddenField("ResultStatusInputHidden", "2");
                    }
                    else
                    {
                        ClientScript.RegisterHiddenField("ResultStatusInputHidden", "3");
                    }

                    pageHeading = "Results Edit/Entry";

                    approveDivtop.Visible    = false;
                    approveDivbottom.Visible = false;
                }

                HeadingSpan.InnerHtml = pageHeading;

                if (Request.UrlReferrer.AbsolutePath.ToLower().IndexOf("auditresultentry.aspx") < 0)
                {
                    Session["ReferredUrlFirstTimeOpen"] = Request.UrlReferrer;
                }

                CreateIFJSArrays();
                CreateJsArrayforIfuCs();

                //var eventCustomerRepository = IoC.Resolve<IEventCustomerRepository>();
                var goBackToResultEnteryPage = false;

                EventCustomerResult eventCustomerResult = IoC.Resolve <IEventCustomerResultRepository>().GetByCustomerIdAndEventId(CustomerId, EventId);;

                if ((Mode == EditResultMode.ResultEntry))
                {
                    if (IsCustomerNoShowOrLeftWithoutScreening(eventCustomer))
                    {
                        ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "customerMarkNoShow();", true);
                        goBackToResultEnteryPage = true;
                    }
                    else
                    {
                        var nextCustomerId = new TestResultRepository().GetNextCustomerEntryandAudit(EventId, CustomerId, IsNewResultFlow);
                        ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "setnextCustomerId(" + nextCustomerId + ");", true);
                    }
                }
                else
                {
                    var isChartSignedOff  = true;
                    var isQvTestPurchased = purchasedTest != null?purchasedTest.Any(x => x.Id == (long)TestType.Qv) : false;

                    var isHraQuestionnaire = questionnaireType == QuestionnaireType.HraQuestionnaire;

                    if (questionnaireType == QuestionnaireType.ChatQuestionnaire)
                    {
                        isChartSignedOff = isQvTestPurchased || (eventCustomerResult != null && eventCustomerResult.SignedOffBy.HasValue);
                    }
                    else
                    {
                        var isEawvTestNotPerformed = IoC.Resolve <ITestNotPerformedRepository>().IsTestNotPerformed(eventCustomer.Id, (long)TestType.eAWV);
                        isChartSignedOff = (eventCustomerResult != null && eventCustomerResult.SignedOffBy.HasValue) || !isShowHraQuestioner || !iseawvTestPurchased || isEawvTestNotPerformed;
                    }
                    IsChartSignedOff = (eventCustomerResult != null && eventCustomerResult.SignedOffBy.HasValue);
                    if (!IsNewResultFlow || isChartSignedOff)
                    {
                        if (IsCustomerNoShowOrLeftWithoutScreening(eventCustomer))
                        {
                            ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "customerMarkNoShow();", true);
                            goBackToResultEnteryPage = true;
                        }
                        else
                        {
                            long nextCustomerId = 0;
                            if (IsNewResultFlow && account != null && (questionnaireType != QuestionnaireType.None))
                            {
                                nextCustomerId = new TestResultRepository().GetNextCustomerForPreAudit(EventId, CustomerId, isHraQuestionnaire);
                            }
                            else
                            {
                                nextCustomerId = new TestResultRepository().GetNextCustomerEntryandAudit(EventId, CustomerId, IsNewResultFlow);
                            }

                            ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "setnextCustomerId(" + nextCustomerId + ");", true);
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(Page.GetType(), "js_NextCustomer", "customerChartIsUnsigned();", true);
                    }

                    //if (eventCustomerResult != null && IsNewResultFlow)
                    //{
                    //    var notes = communicationRepository.GetNotesForReversal(eventCustomerResult.Id);
                    //    if (!string.IsNullOrWhiteSpace(notes))
                    //    {
                    //        revertBackNotes.Visible = true;
                    //        ReasonToRevert.InnerText = notes;
                    //    }
                    //}
                }

                if (!goBackToResultEnteryPage)
                {
                    if (eventCustomerResult != null)
                    {
                        //LogAudit(ModelType.View, eventCustomerResult);
                        var priorityInQueue =
                            IoC.Resolve <IPriorityInQueueRepository>().GetByEventCustomerResultId(eventCustomerResult.Id);
                        if (priorityInQueue != null && priorityInQueue.InQueuePriority > 0)
                        {
                            if (!CurrentOrgUser.CheckRole((long)Roles.Technician))
                            {
                                PriorityInQueueCheckbox.Checked = true;
                            }

                            if (priorityInQueue.NoteId == null)
                            {
                                return;
                            }
                            var noteText = IoC.Resolve <INotesRepository>().Get(priorityInQueue.NoteId.Value);
                            if (noteText != null && !string.IsNullOrEmpty(noteText.Text))
                            {
                                PriorityInQueueText.InnerText = noteText.Text;
                                PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "block");
                            }
                            else if (!CurrentOrgUser.CheckRole((long)Roles.Technician))
                            {
                                PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "block");
                            }
                        }
                        else
                        {
                            PriorityInQueueCheckbox.Checked = false;
                            PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "none");
                        }
                    }
                    else
                    {
                        PriorityInQueueCheckbox.Checked = false;
                        PriorityInQueueReasonDisplayDiv.Style.Add(HtmlTextWriterStyle.Display, "none");
                    }
                }
            }
        }
Пример #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ISystemInformationRepository systemInformationRepository = new SystemInformationRepository();

            VersionNumber = systemInformationRepository.GetBuildNumber();

            var master = ((Franchisor_FranchisorMaster)Master);

            if (master != null)
            {
                master.HideLeftContainer = true;
                master.hideucsearch();
                master.settitle("Post Audit");
                master.SetBreadCrumbRoot = "<a href=\"#\">DashBoard</a>";
            }

            long s = 0;

            if (Request.QueryString["EventId"] != null && long.TryParse(Request.QueryString["EventId"], out s))
            {
                EventId = s;
            }

            s = 0;
            if (Request.QueryString["CustomerId"] != null && long.TryParse(Request.QueryString["CustomerId"], out s))
            {
                CustomerId = s;
            }

            if (EventId > 0 && CustomerId > 0)
            {
                var corporateAccountRepository = IoC.Resolve <ICorporateAccountRepository>();
                var account = corporateAccountRepository.GetbyEventId(EventId);

                IsHealthPlan = account != null && account.IsHealthPlan;

                var eventRepository = IoC.Resolve <IEventRepository>();
                var theEvent        = eventRepository.GetById(EventId);
                QuestionnaireType = QuestionnaireType.None;
                if (account != null && theEvent != null)
                {
                    var accountHraChatQuestionnaireHistoryServices = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>();
                    QuestionnaireType = accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(account.Id, theEvent.EventDate);
                }

                ShowHraQuestions = (QuestionnaireType == QuestionnaireType.HraQuestionnaire);

                var eventCustomerResultRepository = IoC.Resolve <IEventCustomerResultRepository>();
                var testResultService             = IoC.Resolve <ITestResultService>();
                var eventCustomerResult           = eventCustomerResultRepository.GetByCustomerIdAndEventId(CustomerId, EventId);

                IsEawvTestPurchased = testResultService.IsTestPurchasedByCustomer(eventCustomerResult.Id, (long)TestType.eAWV);
                if (IsEawvTestPurchased)
                {
                    IsEawvTestNotPerformed = IoC.Resolve <ITestNotPerformedRepository>().IsTestNotPerformed(eventCustomerResult.Id, (long)TestType.eAWV);
                }

                if (account != null)
                {
                    if (account.MarkPennedBack && eventCustomerResult.IsRevertedToEvaluation)
                    {
                        MarkAsPennedBackDiv.Visible = true;
                        if (eventCustomerResult.IsPennedBack)
                        {
                            MarkAsPennedBackCheckbox.Checked = true;
                        }
                    }
                    else
                    {
                        MarkAsPennedBackDiv.Visible = false;
                    }
                }

                IsNewResultFlow = eventRepository.IsEventHasNewResultFlow(EventId);

                if (IsNewResultFlow)
                {
                    ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "true");
                }
                else
                {
                    ClientScript.RegisterHiddenField("IsNewResultFlowInputHidden", "false");
                }
            }

            var repository     = new TestResultRepository();
            var nextCustomerId = repository.GetNextCustomerPostAudit(EventId, CustomerId, IsNewResultFlow);

            ClientScript.RegisterStartupScript(Page.GetType(), "js_nextCustomer", "nextCustomerId = " + nextCustomerId + ";", true);
        }
Пример #26
0
 public NUnitListener()
 {
     this.testResultRepository = new TestResultRepository(Settings.Default.AutomationFrameworkConnectionString);
 }
 public TestResultServiceTest(TestResultServiceTestFixture fixture)
 {
     this.fixture         = fixture;
     testResultRepository = fixture.GetTestResultRepository();
 }
Пример #28
0
        public KynHealthAssessmentEditModel GetKynHealthAssessment(long customerId, long eventId, long testId, bool isNewResultFlow)
        {
            var basicBiometric = _basicBiometricRepository.Get(eventId, customerId);

            var model = new KynHealthAssessmentEditModel
            {
                EventId    = eventId,
                CustomerId = customerId,
                TestId     = testId
            };

            //var lipidRepository = new LipidTestRepository();

            //var lipidresult = lipidRepository.GetTestResults(customerId, eventId);

            //var lipidTestResult = lipidresult as LipidTestResult;

            //if (lipidTestResult != null)
            //{
            //    model.HDLCholestrol = lipidTestResult.HDL != null ? lipidTestResult.HDL.Reading : string.Empty;
            //    model.TotalCholestrol = lipidTestResult.TotalCholestrol != null ? lipidTestResult.TotalCholestrol.Reading
            //        : string.Empty;
            //    model.Triglycerides = lipidTestResult.TriGlycerides != null
            //        ? lipidTestResult.TriGlycerides.Reading
            //        : string.Empty;
            //    model.Glucose = lipidTestResult.Glucose != null ? lipidTestResult.Glucose.Reading : null;
            //}
            var eventCustomerResult = _eventCustomerResultRepository.GetByCustomerIdAndEventId(customerId, eventId);

            if (eventCustomerResult != null)
            {
                var kynLabValues = _kynLabValuesRepository.Get(eventCustomerResult.Id, testId);
                if (kynLabValues != null)
                {
                    model.TotalCholesterol = kynLabValues.TotalCholesterol != null?kynLabValues.TotalCholesterol.ToString() : string.Empty;

                    model.HDLCholesterol = kynLabValues.Hdl != null?kynLabValues.Hdl.ToString() : string.Empty;

                    model.Triglycerides = kynLabValues.Triglycerides != null?kynLabValues.Triglycerides.ToString() : string.Empty;

                    model.Glucose          = kynLabValues.Glucose ?? null;
                    model.FastingStatus    = kynLabValues.FastingStatus.HasValue ? kynLabValues.FastingStatus.Value : 0;
                    model.ManualSystolic   = kynLabValues.ManualSystolic;
                    model.ManualDiastolic  = kynLabValues.ManualDiastolic;
                    model.A1c              = kynLabValues.A1c;
                    model.BodyFat          = kynLabValues.BodyFat;
                    model.BoneDensity      = kynLabValues.BoneDensity;
                    model.Psa              = kynLabValues.Psa;
                    model.NonHdlCholestrol = kynLabValues.NonHdlCholestrol;
                    model.Nicotine         = kynLabValues.Nicotine;
                    model.Cotinine         = kynLabValues.Cotinine;
                    model.Smoker           = kynLabValues.Smoker;
                    model.LdlCholestrol    = kynLabValues.LdlCholestrol;
                    model.Notes            = kynLabValues.Notes;
                }
            }


            var testResultRepository = new TestResultRepository();
            var testresult           = testResultRepository.GetTestResult(customerId, eventId, (int)testId, isNewResultFlow);

            if (testresult != null)
            {
                model.Notes = testresult.TechnicianNotes;
            }

            if (basicBiometric != null)
            {
                model.SystolicPressure  = basicBiometric.SystolicPressure;
                model.DiastolicPressure = basicBiometric.DiastolicPressure;
                model.PulseRate         = basicBiometric.PulseRate;
            }
            var customer = _customerRepository.GetCustomer(customerId);

            if (customer == null)
            {
                return(model);
            }

            model.HeightInFeet   = customer.Height != null ? customer.Height.Feet : (double?)null;
            model.HeightInInches = customer.Height != null ? customer.Height.Inches : (double?)null;
            model.KynWeight      = customer.Weight != null && customer.Weight.Pounds > 0 ? customer.Weight.Pounds : (double?)null;
            model.WaistSize      = customer.Waist != null ? customer.Waist.Value : (decimal?)null;

            return(model);
        }
Пример #29
0
        public static void SkipEvaluationfornotContainingReviewableTest(long eventId, long customerId, bool isNewResultFlow)
        {
            try
            {
                //Call API for mark can not be audited now.

                var eventCustomerResultRepository = IoC.Resolve <IEventCustomerResultRepository>();
                var eventCustomer    = eventCustomerResultRepository.GetByCustomerIdAndEventId(customerId, eventId);
                var currentSession   = IoC.Resolve <ISessionContext>().UserSession;
                var defaultPhysician = IoC.Resolve <IPhysicianRepository>().GetDefaultPhysicianforEvent(eventId);
                var orgRoleId        = currentSession.CurrentOrganizationRole.OrganizationRoleUserId;
                IoC.Resolve <IPhysicianEvaluationRepository>().SaveCustomerforReviewSkip(eventCustomer.Id, defaultPhysician, orgRoleId, false);
                var account                = IoC.Resolve <ICorporateAccountRepository>().GetbyEventId(eventId);
                var isEawvTestPurchased    = IoC.Resolve <TestResultService>().IsTestPurchasedByCustomer(eventCustomer.Id, (long)TestType.eAWV);
                var isEawvTestNotPerformed = IoC.Resolve <ITestNotPerformedRepository>().IsTestNotPerformed(eventCustomer.Id, (long)TestType.eAWV);
                var testResultRepository   = new TestResultRepository();

                var eventRepository = IoC.Resolve <IEventRepository>();
                var theEvent        = eventRepository.GetById(eventId);

                var orderId      = IoC.Resolve <IOrderRepository>().GetOrderIdByEventIdCustomerId(eventId, customerId);
                var isEntrybyHip = IoC.Resolve <IEventTestRepository>().GetTestsForOrder(orderId).Any(et => et.ResultEntryTypeId.HasValue == false || et.ResultEntryTypeId.Value == (long)ResultEntryType.Hip);

                var questionnaireType = QuestionnaireType.None;
                if (account != null && theEvent != null)
                {
                    var accountHraChatQuestionnaireHistoryServices = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>();
                    questionnaireType = accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(account.Id, theEvent.EventDate);
                }

                if (isNewResultFlow)
                {
                    var testResultService = IoC.Resolve <ITestResultService>();
                    if (!isEntrybyHip)
                    {
                        testResultService.SetResultstoState(eventCustomer.EventId, eventCustomer.CustomerId, (int)NewTestResultStateNumber.ArtifactSynced, false, orgRoleId);
                    }
                    else
                    {
                        if (account == null || account.IsHealthPlan == false || isEawvTestNotPerformed || questionnaireType != QuestionnaireType.HraQuestionnaire)
                        {
                            testResultService.SetResultstoState(eventCustomer.EventId, eventCustomer.CustomerId, (int)NewTestResultStateNumber.ArtifactSynced, false, orgRoleId);
                        }
                        else
                        {
                            testResultService.SetResultstoState(eventCustomer.EventId, eventCustomer.CustomerId, (int)NewTestResultStateNumber.NpSigned, false, orgRoleId);
                        }
                    }
                }
                else
                {
                    testResultRepository.UpdateStateforSkipEvaluation(eventCustomer.Id, null);
                    eventCustomerResultRepository.SetEventCustomerResultState(eventId, customerId);
                }

                if (isNewResultFlow && account != null && account.IsHealthPlan && (questionnaireType == QuestionnaireType.HraQuestionnaire) && isEawvTestPurchased && !isEawvTestNotPerformed)
                {
                    var service = IoC.Resolve <INewResultFlowStateService>();

                    var model = new EhrReadyforCodingViewModel
                    {
                        EventId        = eventId,
                        HfCustomerId   = customerId,
                        ReadyForCoding = true
                    };

                    service.RunTaskReadyForCodingForVisit(model, currentSession.CurrentOrganizationRole.OrganizationRoleUserId, "SkipEvaluationfornotContainingReviewableTest");
                }
            }
            catch (Exception ex)
            {
                IoC.Resolve <ILogManager>().GetLogger <Global>().Error("Some Exception occurred while recording for Skip Evaluation for Not containing re-viewable test(s)! Message:" + ex.Message + "\n\t " + ex.StackTrace);
            }
        }
Пример #30
0
 public TestResultController(TestResultRepository testRepo)
 {
     _testRepo = testRepo;
 }