Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ISystemInformationRepository systemInformationRepository = new SystemInformationRepository();
                VersionNumber = systemInformationRepository.GetBuildNumber();

                var current = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole;
                if (current.CheckRole((long)Roles.Customer))
                {
                    this.Page.Form.Action = Request.Url.AbsolutePath;
                }

                var key = Request.QueryString["key"];
                if (!string.IsNullOrEmpty(key))
                {
                    key = key.Replace(" ", "+");
                    CryptographyService cryptographyService = new DigitalDeliveryCryptographyService();
                    string decryptedKey = cryptographyService.Decrypt(key);

                    string[] allKeys;
                    allKeys = decryptedKey.Split('~');

                    EventId    = Convert.ToInt64(allKeys[0]);
                    CustomerId = Convert.ToInt64(allKeys[1]);
                    Server.Transfer("/App/Common/Results.aspx?EventId=" + EventId + "&CustomerId=" + CustomerId);
                }
                else
                {
                    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;
                    }
                    IsMedicare = Request.QueryString["IsMedicare"] != null && Convert.ToBoolean(Request.QueryString["IsMedicare"]);
                }

                if (!current.CheckRole((long)Roles.Customer))
                {
                    var eventCustomerResult = IoC.Resolve <IEventCustomerResultRepository>().GetByCustomerIdAndEventId(CustomerId, EventId);
                    if (eventCustomerResult != null)
                    {
                        var priorityInQueue = IoC.Resolve <IPriorityInQueueRepository>().GetByEventCustomerResultId(eventCustomerResult.Id);
                        if (priorityInQueue != null && priorityInQueue.InQueuePriority > 0 && priorityInQueue.NoteId != null)
                        {
                            var noteText = IoC.Resolve <INotesRepository>().Get(priorityInQueue.NoteId.Value);
                            if (noteText != null && !string.IsNullOrEmpty(noteText.Text))
                            {
                                PriorityInQueueMessage.ShowSuccessMessage("<b><u>Priority In Queue Reason:</u> </b>" + noteText.Text);
                                PriorityInQueueMessage.Visible = true;
                            }
                        }
                    }
                }

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

                GetConductedbyData();
                var eventsRepository        = IoC.Resolve <IEventRepository>();
                var eventData               = eventsRepository.GetById(EventId);
                var settings                = IoC.Resolve <ISettings>();
                var basicBiometricCutOfDate = settings.BasicBiometricCutOfDate;
                var hideBasicBiometric      = (eventData.EventDate.Date >= basicBiometricCutOfDate);

                ShowHideFastingStatus = (eventData.EventDate.Date >= settings.FastingStatusDate);

                BasicBiometric.ShowByCutOffDate = !hideBasicBiometric;
                TestSection.SetSectionShowHide(hideBasicBiometric);

                ContainTestForEvaluation = TestSection.ContainsReviewableTests;

                GetPcpInformation();

                CreateIfjsArrays();
                CreateJsArrayforIfuCs();
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var settings = IoC.Resolve <ISettings>();

            ISystemInformationRepository systemInformationRepository = new SystemInformationRepository();

            VersionNumber = systemInformationRepository.GetBuildNumber();

            if (!IsPostBack)
            {
                if (EventCustomerId > 0)
                {
                    var eventRepository = new EventCustomerResultRepository();
                    EventCustomerResult = eventRepository.GetById(EventCustomerId);
                    if (EventCustomerResult != null)
                    {
                        EventId    = EventCustomerResult.EventId;
                        CustomerId = EventCustomerResult.CustomerId;
                        SetEventBasicInfo(EventCustomerResult.EventId);
                        TestSection.CustomerId = EventCustomerResult.CustomerId;
                        TestSection.EventId    = EventCustomerResult.EventId;
                    }

                    var priorityInQueue = IoC.Resolve <IPriorityInQueueRepository>().GetByEventCustomerResultId(EventCustomerId);
                    if (priorityInQueue != null && priorityInQueue.InQueuePriority > 0 && priorityInQueue.NoteId != null)
                    {
                        var noteText = IoC.Resolve <INotesRepository>().Get(priorityInQueue.NoteId.Value);
                        if (noteText != null && !string.IsNullOrEmpty(noteText.Text))
                        {
                            PriorityInQueueMessage.ShowSuccessMessage("<b><u>Priority In Queue Reason:</u> </b>" +
                                                                      noteText.Text);
                            PriorityInQueueMessage.Visible = true;
                        }
                    }

                    var customerEventTestStateRepository = IoC.Resolve <ICustomerEventTestStateRepository>();
                    var isCriticalPatient = customerEventTestStateRepository.IsPatientCritical(EventCustomerId);

                    var eventCustomerCriticalQuestionRepository = IoC.Resolve <IEventCustomerCriticalQuestionRepository>();
                    var criticalData = eventCustomerCriticalQuestionRepository.GetByEventCustomerId(EventCustomerId);

                    if ((priorityInQueue != null && priorityInQueue.InQueuePriority > 0) || (isCriticalPatient && !criticalData.IsNullOrEmpty()))
                    {
                        ShowCriticalPatientData = true;
                    }
                }

                Page.Title = "Evaluation : " + CustomerId;

                var physicianId         = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.OrganizationRoleUserId;
                var physicianRepository = IoC.Resolve <IPhysicianRepository>();
                var overReadPhysicianId = physicianRepository.GetOverreadPhysician(EventCustomerId);

                var physician = physicianRepository.GetPhysician(physicianId);
                CanPhysicianUpdateResultEntery = physician.UpdateResultEntry;
                if (physicianId == overReadPhysicianId)
                {
                    IsforOveread = true;
                }
                else
                {
                    IsforOveread = false;
                }

                string messageForPhysician = new CommunicationRepository().GetCommentsforPhysician(CustomerId, EventId, physicianId);
                if (!string.IsNullOrEmpty(messageForPhysician))
                {
                    FranchiseeCommentsMessage.ShowSuccessMessage("<b><u>Technician Comments:</u> </b>" + messageForPhysician);
                    FranchiseeCommentsMessage.Visible = true;
                }

                if (overReadPhysicianId > 0)
                {
                    headerifoverreaddiv.Visible   = true;
                    headerifoverreaddiv.InnerHtml = IsforOveread ? "<h2> This study is an Overread, and you are the Second Evaluator! </h2>" : "<h2> This study is an Overread, and you are the First Evaluator! </h2>";
                }

                ClientScript.RegisterClientScriptBlock(Page.GetType(), "js_OverRead", (overReadPhysicianId > 0 ? " var isOverReadAvailable = true; " : " var isOverReadAvailable = false; ") + (overReadPhysicianId == physicianId ? "var isCurrentViewforOverread = true;" : "var isCurrentViewforOverread = false;"), true);

                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);

                var basicBiometricCutOfDate = settings.BasicBiometricCutOfDate;
                var hideBasicBiometric      = (EventDate.Date >= basicBiometricCutOfDate);
                BasicBiometric.ShowByCutOffDate = !hideBasicBiometric;

                ShowHideFastingStatus = (EventDate.Date.Date >= settings.FastingStatusDate);

                TestSection.SetSectionShowHideEvaluation(EventId, CustomerId, hideBasicBiometric);

                StartEvaluation();
                GetConductedbyData();

                CreateIfjsArrays();
                CreateJsArrayforIfuCs();

                var hospitalPartnerRepository = IoC.Resolve <IHospitalPartnerRepository>();
                var eventHospitalPartner      = hospitalPartnerRepository.GetEventHospitalPartnersByEventId(EventId);
                if (eventHospitalPartner != null && eventHospitalPartner.RestrictEvaluation)
                {
                    var eventPhysicianTestRepository = IoC.Resolve <IEventPhysicianTestRepository>();
                    var eventPhysicianTests          = eventPhysicianTestRepository.GetByEventIdPhysicianId(EventId, physicianId);
                    if (eventPhysicianTests != null && eventPhysicianTests.Any())
                    {
                        foreach (var eventPhysicianTest in eventPhysicianTests)
                        {
                            ClientScript.RegisterArrayDeclaration("arr_permittedtest", "'" + eventPhysicianTest.TestId + "'");
                        }
                    }
                }
                else
                {
                    var testIds = physicianRepository.GetPermittedTestIdsForPhysician(physicianId);
                    foreach (var testId in testIds)
                    {
                        ClientScript.RegisterArrayDeclaration("arr_permittedtest", "'" + testId + "'");
                    }
                }
            }

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

            CaptureHaf      = (account == null || account.CaptureHaf);
            IsNewResultFlow = EventDate >= settings.ResultFlowChangeDate;

            QuestionnaireType questionnaireType = QuestionnaireType.None;

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

            ShowHraLink  = "none";
            ShowChatLink = "none";

            if (EventCustomerResult == null && EventCustomerId > 0)
            {
                var eventRepository = new EventCustomerResultRepository();
                EventCustomerResult = eventRepository.GetById(EventCustomerId);
            }

            if (EventCustomerResult != null)
            {
                if (!IsforOveread)
                {
                    hfIsPdfVerified.Value = EventCustomerResult.ChatPdfReviewedByPhysicianId.HasValue &&
                                            EventCustomerResult.ChatPdfReviewedByPhysicianDate.HasValue ? "1" : "0";
                }
                else
                {
                    hfIsPdfVerified.Value = EventCustomerResult.ChatPdfReviewedByOverreadPhysicianId.HasValue &&
                                            EventCustomerResult.ChatPdfReviewedByOverreadPhysicianDate.HasValue ? "1" : "0";
                }
            }

            if (account != null && account.IsHealthPlan && (questionnaireType == QuestionnaireType.HraQuestionnaire) && EventCustomerId > 0)
            {
                var testResultService       = IoC.Resolve <ITestResultService>();
                var eventCustomerRepository = IoC.Resolve <IEventCustomerRepository>();
                var eventCustomer           = eventCustomerRepository.GetById(EventCustomerId);
                if (IsNewResultFlow)
                {
                    var isEawvPurchased = testResultService.IsTestPurchasedByCustomer(EventCustomerId, (long)TestType.eAWV);
                    if (isEawvPurchased)
                    {
                        var testResultRepository = new EAwvTestRepository();
                        var eawvTestResult       = testResultRepository.GetTestResult(eventCustomer.CustomerId, eventCustomer.EventId, (int)TestType.eAWV, IsNewResultFlow);

                        bool iseawvTestMarkedTestNotPerformed = eawvTestResult != null &&
                                                                eawvTestResult.TestNotPerformed != null &&
                                                                eawvTestResult.TestNotPerformed.TestNotPerformedReasonId >
                                                                0;

                        if (!iseawvTestMarkedTestNotPerformed)
                        {
                            if (eventCustomer.AwvVisitId != null)
                            {
                                MedicareVisitId = eventCustomer.AwvVisitId.Value;
                                Tag             = account.Tag;
                                var sessionContext = IoC.Resolve <ISessionContext>();
                                HraQuestionerAppUrl = settings.HraQuestionerAppUrl;
                                OrganizationNameForHraQuestioner = settings.OrganizationNameForHraQuestioner;
                                HraToken = (Session.SessionID + "_" + sessionContext.UserSession.UserId + "_" +
                                            sessionContext.UserSession.CurrentOrganizationRole.RoleId + "_" +
                                            sessionContext.UserSession.CurrentOrganizationRole.OrganizationId).Encrypt();
                                ShowHraLink = "block";
                            }
                        }
                    }
                }
                else
                {
                    if (eventCustomer.AwvVisitId != null)
                    {
                        MedicareVisitId = eventCustomer.AwvVisitId.Value;
                        Tag             = account.Tag;
                        var sessionContext = IoC.Resolve <ISessionContext>();
                        HraQuestionerAppUrl = settings.HraQuestionerAppUrl;
                        OrganizationNameForHraQuestioner = settings.OrganizationNameForHraQuestioner;
                        HraToken = (Session.SessionID + "_" + sessionContext.UserSession.UserId + "_" +
                                    sessionContext.UserSession.CurrentOrganizationRole.RoleId + "_" +
                                    sessionContext.UserSession.CurrentOrganizationRole.OrganizationId).Encrypt();
                        ShowHraLink = "block";
                    }
                }
            }
            else if (account != null && account.IsHealthPlan && (questionnaireType == QuestionnaireType.ChatQuestionnaire) && EventCustomerId > 0)
            {
                ChatQuestionerAppUrl  = settings.ChatQuestionerAppUrl;
                ShowChatLink          = "block";
                ShowChatAssesmentLink = true;
            }

            if (EventDate < settings.ChecklistChangeDate)
            {
                ShowCheckListForm = account != null && account.PrintCheckList;
            }

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