Пример #1
0
        private bool GetEventTestEvaluationRestricted(long eventId)
        {
            var hospitalPartner = _hospitalPartnerRepository.GetEventHospitalPartnersByEventId(eventId);

            return(hospitalPartner != null && hospitalPartner.RestrictEvaluation);
        }
Пример #2
0
        public OnlineCustomerPersonalInformationEditModel GetCustomerInfo(string guid)
        {
            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid);
            var model = new OnlineCustomerPersonalInformationEditModel
            {
                RequestValidationModel = onlineRequestValidationModel
            };

            if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid)
            {
                return(model);
            }

            var shippingAddress = new AddressEditModel()
            {
                StreetAddressLine1 = OnlineAddress1,
                City      = _onlineCity,
                StateId   = _onlineStateId,
                CountryId = _onlineCountryId,
                ZipCode   = _onlineZip
            };

            model.CustomerEditModel = new SchedulingCustomerEditModel
            {
                EnableTexting   = _enableTexting,
                EnableVoiceMail = _enableVoiceMail,
                ShippingAddress = shippingAddress
            };

            var tempCart = onlineRequestValidationModel.TempCart;

            var customer = tempCart.CustomerId.HasValue ? _customerRepository.GetCustomer(tempCart.CustomerId.Value) : null;

            if (customer == null && tempCart.ProspectCustomerId.HasValue && tempCart.ProspectCustomerId.Value > 0)
            {
                model.CustomerEditModel = _prospectCustomerService.GetforProspectCustomerId(tempCart.ProspectCustomerId.Value);
                if (model.CustomerEditModel.ShippingAddress.StreetAddressLine1 == OnlineAddress1)
                {
                    model.CustomerEditModel.ShippingAddress = shippingAddress;
                }
            }
            else if (customer != null)
            {
                model.CustomerEditModel = Mapper.Map <Customer, SchedulingCustomerEditModel>(customer);
                model.CustomerEditModel.ShippingAddress               = Mapper.Map <Address, AddressEditModel>(customer.Address);
                model.CustomerEditModel.ConfirmationToEnablTexting    = customer.EnableTexting;
                model.CustomerEditModel.ConfirmationToEnableVoiceMail = customer.EnableVoiceMail;
            }

            model.CustomerEditModel.EnableTexting   = _enableTexting;
            model.CustomerEditModel.EnableVoiceMail = _enableVoiceMail;
            model.CustomerEditModel.MarketingSource = tempCart.MarketingSource;
            if (tempCart.Dob.HasValue && !model.CustomerEditModel.DateofBirth.HasValue)
            {
                model.CustomerEditModel.DateofBirth = tempCart.Dob.Value;
            }

            if (!string.IsNullOrEmpty(tempCart.Gender) && !(model.CustomerEditModel.Gender.HasValue && model.CustomerEditModel.Gender.Value > 0))
            {
                model.CustomerEditModel.Gender = (int)((Gender)System.Enum.Parse(typeof(Gender), tempCart.Gender, true));
            }

            if (tempCart.EventId.HasValue && tempCart.EventId.Value > 0)
            {
                var eventData = _eventRepository.GetById(tempCart.EventId.Value);

                if (eventData.AccountId.HasValue && eventData.AccountId.Value > 0)
                {
                    var account = _corporateAccountRepository.GetbyEventId(tempCart.EventId.Value);
                    model.CustomerEditModel.InsuranceIdLabel = (account != null && !string.IsNullOrEmpty(account.MemberIdLabel)) ? account.MemberIdLabel : string.Empty;
                }

                model.CustomerEditModel.InsuranceIdRequired = eventData.InsuranceIdRequired;
                var eventHospitalPartner = _hospitalPartnerRepository.GetEventHospitalPartnersByEventId(tempCart.EventId.Value);
                if (eventHospitalPartner != null)
                {
                    model.CustomerEditModel.CaptureSsn = eventHospitalPartner.CaptureSsn;
                }
            }

            //model.ShippingOptions = _onlineShippingService.GetShippingOption(tempCart);
            return(model);
        }
Пример #3
0
        public CustomerScreeningViewData GetCustomerScreeningViewData(long customerId, long eventId)
        {
            var eventCustomer   = _eventCustomerRepository.Get(eventId, customerId);
            var customer        = _customerRepository.GetCustomer(customerId);
            var theEvent        = _eventRepository.GetById(eventId);
            var isNewResultFlow = theEvent.EventDate >= _settings.ResultFlowChangeDate;
            var testResults     = GetTestResults(customerId, eventId, isNewResultFlow);
            var appointment     = _appointmentRepository.GetEventCustomerAppointment(eventId, customerId);
            var order           = _orderRepository.GetOrder(customerId, eventId);
            var package         = _packageRepository.GetPackageForOrder(order.Id);

            var tests = _testRepository.GetTestsForOrder(order.Id);

            var evaluatingPhysicians = _physicianEvaluationRepsoitory.GetPhysicianEvaluation(eventCustomer.Id);
            var primaryEvalRecord    = evaluatingPhysicians != null?evaluatingPhysicians.Where(p => p.IsPrimaryEvaluator).OrderByDescending(p => p.EvaluationEndTime ?? p.EvaluationStartTime).FirstOrDefault() : null;

            var primaryPhysicianId  = primaryEvalRecord != null ? primaryEvalRecord.PhysicianId : 0;
            var overreadPhysicianId = primaryEvalRecord != null?evaluatingPhysicians.Where(p => !p.IsPrimaryEvaluator && p.EvaluationStartTime > primaryEvalRecord.EvaluationStartTime).OrderByDescending(
                p => p.EvaluationEndTime ?? p.EvaluationStartTime).Select(p => p.PhysicianId).FirstOrDefault() : 0;

            if (primaryPhysicianId < 1)
            {
                var assignment = _physicianAssignmentService.GetPhysicianIdsAssignedtoaCustomer(eventId, customerId);
                if (assignment != null)
                {
                    primaryPhysicianId  = assignment.First();
                    overreadPhysicianId = assignment.ElementAtOrDefault(1);
                }
                else // Should be Skip Evaluation Case
                {
                    var physicians = testResults.Where(tr => tr.EvaluatedbyOrgRoleUserId > 0).Select(tr => tr.EvaluatedbyOrgRoleUserId).Distinct().ToArray();

                    if (physicians.Any())
                    {
                        primaryPhysicianId = physicians.First();
                    }

                    if (physicians.Count() > 1)
                    {
                        overreadPhysicianId = physicians.Last();
                    }
                }
            }
            if (primaryPhysicianId < 1)
            {
                //todo:default for the state
                primaryPhysicianId = _physicianRepository.GetDefaultPhysicianforEvent(eventId);
            }

            var primaryPhysician  = _physicianRepository.GetPhysician(primaryPhysicianId);
            var overreadPhysician = overreadPhysicianId > 0 ? _physicianRepository.GetPhysician(overreadPhysicianId) : null;

            var host           = _hostRepository.GetHostForEvent(eventId);
            var basicBiometric = _basicBiometricRepository.Get(eventId, customerId);

            CustomerScreeningViewData viewData = _factory.Create(testResults, customer, appointment, theEvent, package != null ? package.Package : null, tests != null ? tests.Select(t => t.Test).ToArray() : null, host,
                                                                 primaryPhysician, overreadPhysician, order, basicBiometric);

            if (order.PaymentsApplied != null)
            {
                var chargeCardPayments =
                    order.PaymentsApplied.Where(pa => pa.PaymentType == PaymentType.CreditCard).Select(
                        pa => (ChargeCardPayment)pa).ToArray();

                if (chargeCardPayments.Count() > 0)
                {
                    viewData.ChargeCards = _chargeCardRepository.GetByIds(chargeCardPayments.Select(cp => cp.ChargeCardId).ToArray());
                }

                var checkPayments = order.PaymentsApplied.Where(pa => pa.PaymentType == PaymentType.Check).Select(
                    pa => (CheckPayment)pa).ToArray();

                if (checkPayments.Count() > 0)
                {
                    viewData.Checks = _checkRepository.GetByIds(checkPayments.Select(c => c.CheckId).ToArray());
                }
            }

            var eventHospitalPartner = _hospitalPartnerRepository.GetEventHospitalPartnersByEventId(eventId);

            if (eventHospitalPartner != null && eventHospitalPartner.RestrictEvaluation)
            {
                var eventPhysicianTests = _eventPhysicianTestRepository.GetByEventId(eventId);
                if (eventPhysicianTests != null && eventPhysicianTests.Any())
                {
                    viewData.EventPhysicianTests = eventPhysicianTests;
                }
            }

            return(viewData);
        }