public void Save(long customerId, int forYear, bool?isEligible, long createdBy, ILogger logger, bool isUpload = false) { var customerEligibility = _customerEligibilityRepository.GetByCustomerIdAndYear(customerId, forYear); bool?oldIsEligible = null; if (customerEligibility == null) { var domain = new CustomerEligibility { CustomerId = customerId, ForYear = forYear, IsEligible = isEligible, CreatedBy = createdBy, DateCreated = DateTime.Now }; _customerEligibilityRepository.Save(domain); logger.Info("Inserted new data for Customer Eligibility, CustomerId :" + customerId + ", Year: " + forYear); } else { oldIsEligible = customerEligibility.IsEligible; if (oldIsEligible != isEligible) { logger.Info("Customer Eligibility, Creating History , CustomerId :" + customerId + ", Year: " + forYear); var customerProfileHistoryId = _customerProfileHistoryRepository.CreateCustomerHistory(customerId, createdBy, customerEligibility); _eventCustomerRepository.UpdateCustomerProfileIdByCustomerId(customerId, customerProfileHistoryId); logger.Info("History Created , CustomerId :" + customerId + ", Year: " + forYear); } customerEligibility.IsEligible = isEligible; customerEligibility.DateModified = DateTime.Now; customerEligibility.ModifiedBy = createdBy; _customerEligibilityRepository.Save(customerEligibility); logger.Info("Updated Customer Eligibility, CustomerId :" + customerId + ", Year: " + forYear); } if (DateTime.Today.Year == forYear && (customerEligibility == null || oldIsEligible != isEligible)) //if eligibility is changed only then we'll update CallQueueCustomer { var cqcUpdated = _callQueueCustomerRepository.UpdateCallQueueCustomerEligibility(customerId, isEligible); if (cqcUpdated) { logger.Info("CallQueueCustomers Updated for CustomerId: " + customerId + " with Eligibility: " + isEligible); } else { logger.Info("No CallQueueCustomer found for CustomerId: " + customerId + " with Eligibility: " + isEligible); } } else { logger.Info("CallQueueCustomer not updated as Parsed data has 1)No previous eligibility or 2) Has same eligibility 3) or parsed year doesn't match with current year. CustomerId: " + customerId); } }
public long CreateCustomerHistory(long customerId, long orgRoleId, CustomerEligibility customerEligibility) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { var linqMetaData = new LinqMetaData(adapter); var customerEntity = linqMetaData.CustomerProfile.SingleOrDefault(cp => cp.CustomerId == customerId); var userEntity = (from oru in linqMetaData.OrganizationRoleUser join user in linqMetaData.User on oru.UserId equals user.UserId where oru.OrganizationRoleUserId == customerId select user).WithPath(p => p.Prefetch(prefetch => prefetch.Role)).FirstOrDefault(); var customerWarmTransfer = (from cwt in linqMetaData.CustomerWarmTransfer where cwt.CustomerId == customerId && cwt.WarmTransferYear == DateTime.Today.Year select cwt).SingleOrDefault(); if (customerWarmTransfer == null) { customerWarmTransfer = (from cwt in linqMetaData.CustomerWarmTransfer where cwt.CustomerId == customerId orderby cwt.Id descending select cwt).FirstOrDefault(); } var customerTargeted = (from ct in linqMetaData.CustomerTargeted where ct.CustomerId == customerId && ct.ForYear == DateTime.Today.Year select ct).FirstOrDefault(); if (customerTargeted == null) { customerTargeted = (from ct in linqMetaData.CustomerTargeted where ct.CustomerId == customerId orderby ct.Id descending select ct).FirstOrDefault(); } var customerHistory = _customerProfileHistoryFactory.CustomerProfileHistoryEntity(customerEntity, userEntity, orgRoleId, customerEligibility, customerWarmTransfer, customerTargeted); if (!adapter.SaveEntity(customerHistory, true)) { throw new PersistenceFailureException(); } return(customerHistory.Id); } }
public ActionResult Eligibility(LoanViewModel lvm, FormCollection form) { try { string strDDLValue = form["ddlMerchantName"].ToString(); CustomerEligibility _CE = new CustomerEligibility(); _CE.CustomerId = lvm.CustomerEligility.CustomerId; lvm.CustomerEligility.MerchantFk = Convert.ToInt16(strDDLValue); _CE.MerchantFk = lvm.CustomerEligility.MerchantFk; var merchantFK = Convert.ToInt16(_CE.MerchantFk); var CustomerEligibility = DataReaders.CheckCustomerEligiblity(_CE.CustomerId, merchantFK); ViewBag.Message = CustomerEligibility; TempData["Message"] = CustomerEligibility; return(RedirectToAction("CheckEligibility")); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public CustomerProfileHistoryEntity CustomerProfileHistoryEntity(CustomerProfileEntity customerProfileEntity, UserEntity userEntity, long createdBy, CustomerEligibility customerEligibility, CustomerWarmTransferEntity customerWarmTransfer, CustomerTargetedEntity customerTargeted) { var billingAddress = customerProfileEntity.BillingAddressId.HasValue ? _addressRepository.GetAddress(customerProfileEntity.BillingAddressId.Value) : null; var homeAddress = _addressRepository.GetAddress(userEntity.HomeAddressId); var entity = new CustomerProfileHistoryEntity { IsNew = true, CustomerId = customerProfileEntity.CustomerId, FirstName = userEntity.FirstName, MiddleName = userEntity.MiddleName, LastName = userEntity.LastName, HomeAddress1 = homeAddress.StreetAddressLine1, HomeAddress2 = homeAddress.StreetAddressLine2, HomeCity = homeAddress.City, HomeState = homeAddress.State, HomeZipCode = homeAddress.ZipCode.Zip, HomeCountry = homeAddress.Country, PhoneOffice = userEntity.PhoneOffice, PhoneCell = userEntity.PhoneCell, PhoneHome = userEntity.PhoneHome, Email1 = userEntity.Email1, Email2 = userEntity.Email2, Picture = userEntity.Picture, Dob = userEntity.Dob, DefaultRoleId = userEntity.Role.RoleId, PhoneOfficeExtension = userEntity.PhoneOfficeExtension, Ssn = userEntity.Ssn, DisplayId = customerProfileEntity.DisplayId, BillingAddress1 = billingAddress != null ? billingAddress.StreetAddressLine1 : string.Empty, BillingAddress2 = billingAddress != null ? billingAddress.StreetAddressLine2 : string.Empty, BillingCity = billingAddress != null ? billingAddress.City : string.Empty, BillingState = billingAddress != null ? billingAddress.State : string.Empty, BillingZipCode = billingAddress != null ? billingAddress.ZipCode.Zip : string.Empty, BillingCountry = billingAddress != null ? billingAddress.Country : string.Empty, Waist = customerProfileEntity.Waist, Height = customerProfileEntity.Height, Weight = customerProfileEntity.Weight, Gender = customerProfileEntity.Gender, Race = customerProfileEntity.Race, TrackingMarketingId = customerProfileEntity.TrackingMarketingId, AddedByRoleId = customerProfileEntity.AddedByRoleId, Employer = customerProfileEntity.Employer, EmergencyContactName = customerProfileEntity.EmergencyContactName, EmergencyContactRelationship = customerProfileEntity.EmergencyContactRelationship, EmergencyContactPhoneNumber = customerProfileEntity.EmergencyContactPhoneNumber, DoNotContactReasonId = customerProfileEntity.DoNotContactReasonId, DoNotContactReasonNotesId = customerProfileEntity.DoNotContactReasonNotesId, RequestNewsLetter = customerProfileEntity.RequestNewsLetter, EmployeeId = customerProfileEntity.EmployeeId, InsuranceId = customerProfileEntity.InsuranceId, PreferredLanguage = customerProfileEntity.PreferredLanguage, BestTimeToCall = customerProfileEntity.BestTimeToCall, Hicn = customerProfileEntity.Hicn, EnableTexting = customerProfileEntity.EnableTexting, MedicareAdvantageNumber = customerProfileEntity.MedicareAdvantageNumber, Tag = customerProfileEntity.Tag, MedicareAdvantagePlanName = customerProfileEntity.MedicareAdvantagePlanName, LanguageId = customerProfileEntity.LanguageId, LabId = customerProfileEntity.LabId, Copay = customerProfileEntity.Copay, Lpi = customerProfileEntity.Lpi, Market = customerProfileEntity.Market, Mrn = customerProfileEntity.Mrn, GroupName = customerProfileEntity.GroupName, IsIncorrectPhoneNumber = customerProfileEntity.IsIncorrectPhoneNumber, IsLanguageBarrier = customerProfileEntity.IsLanguageBarrier, DoNotContactTypeId = customerProfileEntity.DoNotContactTypeId, EnableVoiceMail = customerProfileEntity.EnableVoiceMail, AdditionalField1 = customerProfileEntity.AdditionalField1, AdditionalField2 = customerProfileEntity.AdditionalField2, AdditionalField3 = customerProfileEntity.AdditionalField3, AdditionalField4 = customerProfileEntity.AdditionalField4, ActivityId = customerProfileEntity.ActivityId, DoNotContactUpdateDate = customerProfileEntity.DoNotContactUpdateDate, DateCreated = DateTime.Now, CreatedBy = createdBy, DoNotContactUpdateSource = customerProfileEntity.DoNotContactUpdateSource, LanguageBarrierMarkedDate = customerProfileEntity.LanguageBarrierMarkedDate, IncorrectPhoneNumberMarkedDate = customerProfileEntity.IncorrectPhoneNumberMarkedDate, IsSubscribed = customerProfileEntity.IsSubscribed, PreferredContactType = customerProfileEntity.PreferredContactType, Mbi = customerProfileEntity.Mbi, PhoneHomeConsentId = customerProfileEntity.PhoneHomeConsentId, PhoneCellConsentId = customerProfileEntity.PhoneCellConsentId, PhoneOfficeConsentId = customerProfileEntity.PhoneOfficeConsentId, PhoneHomeConsentUpdateDate = customerProfileEntity.PhoneHomeConsentUpdateDate, PhoneCellConsentUpdateDate = customerProfileEntity.PhoneCellConsentUpdateDate, PhoneOfficeConsentUpdateDate = customerProfileEntity.PhoneOfficeConsentUpdateDate, AcesId = customerProfileEntity.AcesId, BillingMemberId = customerProfileEntity.BillingMemberId, BillingMemberPlan = customerProfileEntity.BillingMemberPlan, BillingMemberPlanYear = customerProfileEntity.BillingMemberPlanYear, EnableEmail = customerProfileEntity.EnableEmail, EnableEmailUpdateDate = customerProfileEntity.EnableEmailUpdateDate, MemberUploadSourceId = customerProfileEntity.MemberUploadSourceId, ProductTypeId = customerProfileEntity.ProductTypeId, AcesClientId = customerProfileEntity.AcesClientId, }; if (customerEligibility != null) { entity.IsEligble = customerEligibility.IsEligible; entity.EligibilityForYear = customerEligibility.ForYear; } if (customerWarmTransfer != null) { entity.IsWarmTransfer = customerWarmTransfer.IsWarmTransfer; entity.WarmTransferYear = customerWarmTransfer.WarmTransferYear; } if (customerTargeted != null) { entity.TargetedYear = customerTargeted.ForYear; entity.IsTargeted = customerTargeted.IsTargated; } return(entity); }
private bool CheckCustomerUnableToSchedule(ProspectCustomer prospectCustomer, DateTime from, DateTime todDate, CustomerEligibility customerEligibility) { if (prospectCustomer != null && (prospectCustomer.Tag == ProspectCustomerTag.Deceased)) { return(true); } if (customerEligibility == null || !customerEligibility.IsEligible.HasValue || !customerEligibility.IsEligible.Value) { return(true); } return(prospectCustomer != null && ((prospectCustomer.TagUpdateDate.HasValue && prospectCustomer.TagUpdateDate.Value >= from && prospectCustomer.TagUpdateDate.Value <= todDate) && (prospectCustomer.Tag == ProspectCustomerTag.HomeVisitRequested || prospectCustomer.Tag == ProspectCustomerTag.MobilityIssue || prospectCustomer.Tag == ProspectCustomerTag.NoLongeronInsurancePlan))); }
private string GetCurrentStatus(Customer customer, IEnumerable <DirectMail> directMails, EventCustomer eventCustomer, EventVolumeModel eventModel, EventVolumeModel lastScreeningEvent, ProspectCustomer prospectCustomer, DateTime fromDate, DateTime toDate, CustomerEligibility customerEligibility) { if (eventCustomer != null && eventCustomer.NoShow) { return(CurrentStatus.NoShow); } if (eventModel != null && eventModel.EventDate.Date >= DateTime.Today && (eventCustomer != null && eventCustomer.AppointmentId.HasValue)) { return(CurrentStatus.ScheduledFutureAppointment); } //if (eventModel != null && eventModel.EventDate.Date == DateTime.Today && (eventCustomer != null && eventCustomer.AppointmentId.HasValue)) //{ // return CompletionStatus.ScheduledForToday; //} if (lastScreeningEvent != null) { return(CurrentStatus.ScheduledTestingComplete); } if (eventCustomer != null && !eventCustomer.AppointmentId.HasValue) { return(CurrentStatus.ScheduledCancelled); } if (customer.IsIncorrectPhoneNumber) { return(CurrentStatus.InvalidData); } if (CheckCustomerUnableToSchedule(prospectCustomer, fromDate, toDate, customerEligibility)) { return(CurrentStatus.UnableToSchedule); } if (CheckCustomerRefusal(prospectCustomer, fromDate, toDate) || IsCustomerMarkedDonotContact(customer, fromDate, toDate)) { return(CurrentStatus.Refusal); } if (directMails != null && directMails.Count() > 4) { var customerDirectMail = directMails.OrderByDescending(dm => dm.MailDate).FirstOrDefault(); if (customerDirectMail.MailDate.AddDays(28) < DateTime.Today) { return(CurrentStatus.Exhausted); } } return(CurrentStatus.InProgress); }
private List <string> GetReasons(Customer customer, IEnumerable <ProspectCustomer> prospectCustomers, IEnumerable <EventCustomer> eventCustomers, IEnumerable <Event> events, IEnumerable <OrganizationRoleUser> orgRoleUsers, IEnumerable <User> users, CallQueueCustomerCriteraAssignmentForStats callQueueCustomer, IEnumerable <long> healthPlanZipIdPairs, CorporateAccount account, IEnumerable <AccountCallQueueSetting> callQueueSettings, CustomerEligibility customerEligibility, CustomerTargeted customerTargeted) { var resons = new List <string>(); var orgRoleUser = orgRoleUsers.Where(x => x.Id == customer.CustomerId).FirstOrDefault(); var firstDayOfYear = new DateTime(DateTime.Today.Year, 1, 1); if (orgRoleUser != null) { var user = users.Where(x => x.Id == orgRoleUser.UserId).FirstOrDefault(); if (user != null && (string.IsNullOrEmpty(user.HomePhoneNumber.Number) && string.IsNullOrEmpty(user.HomePhoneNumber.Number) && string.IsNullOrEmpty(user.MobilePhoneNumber.Number))) { resons.Add("Phone Number is not available"); } } var prospectCustomer = prospectCustomers.Where(x => x.CustomerId == customer.CustomerId).FirstOrDefault(); if (prospectCustomer != null) { var homeVisitRequested = ProspectCustomerTag.HomeVisitRequested.ToString(); var doNotContact = ProspectCustomerTag.DoNotCall.ToString(); var deceased = ProspectCustomerTag.Deceased.ToString(); var mobilityIssue = ProspectCustomerTag.MobilityIssue.ToString(); var inLongTermCareNursingHome = ProspectCustomerTag.InLongTermCareNursingHome.ToString(); var mobilityIssue_LeftMessageWithOther = ProspectCustomerTag.MobilityIssues_LeftMessageWithOther.ToString(); var debilitatingDisease = ProspectCustomerTag.DebilitatingDisease.ToString(); var noLongeronInsurancePlan = ProspectCustomerTag.NoLongeronInsurancePlan.ToString(); var refusedCustomerTag = prospectCustomer.Tag.ToString(); if (refusedCustomerTag == deceased || ((!prospectCustomer.ContactedDate.HasValue || prospectCustomer.ContactedDate.Value.Year == firstDayOfYear.Year) && (refusedCustomerTag == homeVisitRequested || refusedCustomerTag == doNotContact || refusedCustomerTag == mobilityIssue || refusedCustomerTag == inLongTermCareNursingHome || refusedCustomerTag == mobilityIssue_LeftMessageWithOther || refusedCustomerTag == debilitatingDisease || refusedCustomerTag == noLongeronInsurancePlan))) { resons.Add(((ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), refusedCustomerTag, true)).GetDescription()); } if (prospectCustomer.CallBackRequestedDate.HasValue && refusedCustomerTag == ProspectCustomerTag.CallBackLater.ToString() && prospectCustomer.CallBackRequestedDate > DateTime.Today.AddDays(1)) { resons.Add("Requested for Callback on " + prospectCustomer.CallBackRequestedDate.Value.ToShortDateString() + " at " + prospectCustomer.CallBackRequestedDate.Value.ToShortTimeString()); } } if (customerEligibility == null || customerEligibility.IsEligible == null) { resons.Add("Eligibility is not available"); } if (customerEligibility != null && customerEligibility.IsEligible == false) { resons.Add("Not Eligible"); } if (customerTargeted == null || !customerTargeted.IsTargated.HasValue || customerTargeted.IsTargated == false) { resons.Add("Non-Targeted"); } if (!customer.ActivityId.HasValue) { resons.Add("Activity is not available"); } if (customer.ActivityId.HasValue && (customer.ActivityId == ((long)UploadActivityType.MailOnly) || customer.ActivityId == (long)UploadActivityType.DoNotCallDoNotMail)) { var activty = ((UploadActivityType)customer.ActivityId.Value).GetDescription(); resons.Add("Activity is " + activty); } if (!callQueueSettings.IsNullOrEmpty() && customer.IsIncorrectPhoneNumber && customer.IncorrectPhoneNumberMarkedDate >= firstDayOfYear) { resons.Add("Incorrect Phone Number"); } else if (customer.IsIncorrectPhoneNumber) { resons.Add("Incorrect Phone Number"); } //if ((customer.DoNotContactUpdateDate > firstDayOfYear && (customer.DoNotContactTypeId == (long)DoNotContactType.DoNotContact || customer.DoNotContactTypeId == (long)DoNotContactType.DoNotCall)) // || (customer.DoNotContactUpdateSource == (long)DoNotContactSource.Manual && customer.DoNotContactTypeId != (long)DoNotContactType.DoNotMail)) if (customer.DoNotContactTypeId == (long)DoNotContactType.DoNotContact || customer.DoNotContactTypeId == (long)DoNotContactType.DoNotCall) { resons.Add(((DoNotContactType)customer.DoNotContactTypeId).GetDescription()); } var eventCustomer = eventCustomers.Where(x => x.CustomerId == customer.CustomerId).ToArray(); if (eventCustomer.Any()) { var eventIds = eventCustomer.Select(x => x.EventId).ToArray(); var customerEvents = events.Where(x => eventIds.Contains(x.Id)).ToArray(); if (customerEvents.Any()) { var customerContactedThisYear = new DateTime(DateTime.Today.Year, 1, 1); if (customerEvents.Any(x => x.EventDate.Year == customerContactedThisYear.Year) || customerEvents.Any(x => x.EventDate > customerContactedThisYear)) { resons.Add("Booked Appointment"); } } } if (callQueueCustomer != null && account != null) { SetReasonsForCampaign(resons, customer, callQueueCustomer, healthPlanZipIdPairs, account, callQueueSettings); } return(resons.Distinct().ToList()); }
public PreAssessmentCustomerContactViewModel GetByCustomerId(long customerId, long callId, long orgRoleUserId) { if (customerId <= 0) { return(null); } var call = _callCenterCallRepository.GetById(callId); var eventCustomer = _eventCustomerRepository.Get(call.EventId, customerId); CallQueue callQueue = null; if (call != null) { callQueue = _callQueueRepository.GetById((long)call.CallQueueId); } var customer = _customerRepository.GetCustomer(customerId); var memberIdLabel = string.Empty; CorporateAccount corporateAccount = null; CustomerEligibility customerEligibility = null; if (customer != null) { customerEligibility = _customerEligibilityRepository.GetByCustomerIdAndYear(customer.CustomerId, DateTime.Today.Year); if (!string.IsNullOrEmpty(customer.Tag)) { corporateAccount = _corporateAccountRepository.GetByTag(customer.Tag); memberIdLabel = corporateAccount != null ? corporateAccount.MemberIdLabel : string.Empty; } } var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); CallQueuePatientInfomationViewModel patientInfo = null; if (customer != null) { Falcon.App.Core.Medical.Domain.ActivityType activityType = null; if (customer.ActivityId.HasValue) { activityType = _activityTypeRepository.GetById(customer.ActivityId.Value); } patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetCustomerInfo(customer, customerEligibility, activityType); } else { patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetProspectCustomerInfo(prospectCustomer); } if (patientInfo.HealthPlanPhoneNumber == null) { patientInfo.HealthPlanPhoneNumber = corporateAccount != null ? corporateAccount.CheckoutPhoneNumber : null; } var additionalFileds = new List <OrderedPair <string, string> >(); if (corporateAccount != null) { var accountAdditionalFields = _accountAdditionalFieldRepository.GetByAccountId(corporateAccount.Id); if (accountAdditionalFields.Any()) { additionalFileds.AddRange(accountAdditionalFields.Select(additionalField => new OrderedPair <string, string>(additionalField.DisplayName, GetCustomerAdditionalField(customer, additionalField.AdditionalFieldId)))); } if (corporateAccount.ShowCallCenterScript && corporateAccount.CallCenterScriptFileId > 0) { var callCenterScriptPdf = _fileRepository.GetById(corporateAccount.CallCenterScriptFileId); var mediaLocation = _mediaRepository.GetCallCenterScriptPdfFolderLocation(); patientInfo.CallCenterScriptUrl = mediaLocation.Url + callCenterScriptPdf.Path; } if (callQueue != null && callQueue.Category == HealthPlanCallQueueCategory.PreAssessmentCallQueue) { if (corporateAccount.ShowCallCenterScript && corporateAccount.ConfirmationScriptFileId > 0) { var confirmationScriptPdf = _fileRepository.GetById(corporateAccount.ConfirmationScriptFileId); var mediaLocation = _mediaRepository.GetCallCenterScriptPdfFolderLocation(); patientInfo.CallCenterScriptUrl = mediaLocation.Url + confirmationScriptPdf.Path; } } } var hasMammo = customer != null && _preApprovedTestRepository.CheckPreApprovedTestForCustomer(customer.CustomerId, TestGroup.BreastCancer); patientInfo.HasMammo = hasMammo; patientInfo.MammoTestAsPreApproved = hasMammo; patientInfo.CustomerId = customerId; patientInfo.ProspectCustomerId = prospectCustomer != null ? prospectCustomer.Id : 0; patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetCustomerTagInfo(prospectCustomer, patientInfo); if (patientInfo != null && callQueue != null && callQueue.IsHealthPlan) { patientInfo.PrimaryCarePhysician = _primaryCarePhysicianHelper.GetPrimaryCarePhysicianViewModel(customerId); } if (customer != null) { var customerCustomTags = _corporateCustomerCustomTagRepository.GetByCustomerId(customer.CustomerId); if (!customerCustomTags.IsNullOrEmpty()) { var customTags = customerCustomTags.OrderByDescending(x => x.DataRecorderMetaData.DateCreated).Select(x => x.Tag).ToArray(); patientInfo.CustomCorporateTags = customTags.IsNullOrEmpty() ? string.Empty : string.Join(",", customTags); } } IEnumerable <string> preApprovedTests = null; var preApprovedTestsList = _preApprovedTestRepository.GetPreApprovedTests(customerId); if (preApprovedTestsList.Count() > 0) { preApprovedTests = preApprovedTestsList; } IEnumerable <Package> preApprovedPackages = null; var preApprovedPackageList = _preApprovedPackageRepository.GetByCustomerId(customerId); var packageIds = preApprovedPackageList != null?preApprovedPackageList.Select(x => x.PackageId) : null; if (packageIds != null) { preApprovedPackages = _packageRepository.GetByIds(packageIds.ToList()); } if (customer != null && customer.Address != null && customer.Address.StateId > 0 && corporateAccount != null) { patientInfo.HealthPlanPhoneNumber = _customerAccountGlocomNumberService.GetGlocomNumber(corporateAccount.Id, customer.Address.StateId, customer.CustomerId, callId); } if (patientInfo.HealthPlanPhoneNumber == null) { patientInfo.HealthPlanPhoneNumber = corporateAccount != null ? corporateAccount.CheckoutPhoneNumber : null; } if (patientInfo.HealthPlanPhoneNumber != null) { string dialerUrl; var callCenterRepProfile = _callCenterRepProfileRepository.Get(orgRoleUserId); if (callCenterRepProfile != null && !string.IsNullOrEmpty(callCenterRepProfile.DialerUrl)) { dialerUrl = callCenterRepProfile.DialerUrl.ToLower().Replace(CallCenterAgentUrlKeywords.CallerId.ToLower(), (patientInfo.HealthPlanPhoneNumber.AreaCode + patientInfo.HealthPlanPhoneNumber.Number)) .Replace(CallCenterAgentUrlKeywords.PatientId.ToLower(), patientInfo.CustomerId.ToString()); } else { dialerUrl = "Glocom://*65*" + patientInfo.HealthPlanPhoneNumber.AreaCode + patientInfo.HealthPlanPhoneNumber.Number + "*1" + CallCenterAgentUrlKeywords.PatientContact.ToLower(); } if (patientInfo.CallBackPhoneNumber != null) { patientInfo.CallBackPhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.CallBackPhoneNumber.AreaCode + patientInfo.CallBackPhoneNumber.Number)); } if (patientInfo.OfficePhoneNumber != null) { patientInfo.OfficePhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.OfficePhoneNumber.AreaCode + patientInfo.OfficePhoneNumber.Number)); } if (patientInfo.MobilePhoneNumber != null && !string.IsNullOrEmpty(patientInfo.MobilePhoneNumber.Number)) { patientInfo.MobilePhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.MobilePhoneNumber.AreaCode + patientInfo.MobilePhoneNumber.Number)); } } var preAssessmentCustomerCallQueueCallAttempt = _preAssessmentCustomerCallQueueCallAttemptRepository.GetByCallId(callId); RegisteredEventViewModel registeredEventModel = null; var isCancelled = false; if (callQueue != null && callQueue.Category == HealthPlanCallQueueCategory.PreAssessmentCallQueue && call.EventId > 0) { var isEawvPurchased = _testResultService.IsTestPurchasedByCustomer(eventCustomer.Id, (long)TestType.eAWV); Appointment appointment = null; if (eventCustomer.AppointmentId.HasValue) { appointment = _appointmentRepository.GetById(eventCustomer.AppointmentId.Value); } else { isCancelled = true; } var theEvent = _eventService.GetById(eventCustomer.EventId); var hostAddress = new AddressViewModel { StreetAddressLine1 = theEvent.StreetAddressLine1, StreetAddressLine2 = theEvent.StreetAddressLine2, City = theEvent.City, State = theEvent.State, ZipCode = theEvent.Zip }; QuestionnaireType questionnaireType = QuestionnaireType.None; if (corporateAccount != null && corporateAccount.IsHealthPlan && theEvent != null) { questionnaireType = _accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(corporateAccount.Id, theEvent.EventDate); } registeredEventModel = new RegisteredEventViewModel { EventId = theEvent.EventId, EventDate = theEvent.EventDate, AppointmentTime = appointment != null ? appointment.StartTime : (DateTime?)null, HostName = theEvent.OrganizationName, HostAddress = hostAddress.ToString(), EventNotes = "", EventCustomerId = eventCustomer.Id, TimeZone = theEvent.EventTimeZone, IsCanceled = isCancelled, HraQuestionerAppUrl = _settings.HraQuestionerAppUrl, OrganizationNameForHraQuestioner = _settings.OrganizationNameForHraQuestioner, CorporateAccountTag = corporateAccount.Tag, MedicareVisitId = eventCustomer.AwvVisitId.HasValue ? eventCustomer.AwvVisitId.Value : 0, Pods = theEvent.Pods.IsNullOrEmpty() ? "" : theEvent.PodNames(), ShowHraQuestionnaire = questionnaireType == QuestionnaireType.HraQuestionnaire ? true : false, IsEawvPurchased = isEawvPurchased, ShowChatQuestionnaire = questionnaireType == QuestionnaireType.ChatQuestionnaire ? true : false, ChatQuestionerAppUrl = _settings.ChatQuestionerAppUrl, AllowNonMammoPatients = theEvent.AllowNonMammoPatients, CaptureHaf = corporateAccount != null && corporateAccount.CaptureHaf, }; preAssessmentCustomerCallQueueCallAttempt.IsNotesReadAndUnderstood = true; } if (corporateAccount != null) { var organization = _organizationRepository.GetOrganizationbyId(corporateAccount.Id); patientInfo.HealthPlan = organization.Name; } var warmTransfer = false; if (customer != null && corporateAccount != null && corporateAccount.WarmTransfer) { var customerWarmTransfer = _customerWarmTransferRepository.GetByCustomerIdAndYear(customer.CustomerId, DateTime.Today.Year); warmTransfer = customerWarmTransfer != null && customerWarmTransfer.IsWarmTransfer.HasValue && customerWarmTransfer.IsWarmTransfer.Value; } var model = new PreAssessmentCustomerContactViewModel { PatientInfomation = patientInfo, // CallHistory = callHistoryModel, PreApprovedTests = preApprovedTests, // ReadAndUnderstood = currentCall != null && currentCall.ReadAndUnderstood.HasValue && currentCall.ReadAndUnderstood.Value, AdditionalFields = additionalFileds, MemberIdLabel = memberIdLabel, // IsCallEnded = currentCall != null && currentCall.Status == (long)CallStatus.CallSkipped && currentCall.EndTime.HasValue, PreApprovedPackages = !preApprovedPackages.IsNullOrEmpty() ? preApprovedPackages.Select(x => x.Name).ToList() : null, CallId = callId, HealthPlanId = corporateAccount != null ? corporateAccount.Id : 0, CallQueueCustomerAttempt = preAssessmentCustomerCallQueueCallAttempt ?? new PreAssessmentCustomerCallQueueCallAttempt { IsNotesReadAndUnderstood = true }, EventInformation = registeredEventModel, WarmTransfer = warmTransfer, // RequiredTests = requiredTests, }; var isHealthPlanCallQueue = call != null; var patientInfoEditModel = _preAssessmentCallQueuePatientInfomationFactory.GetCallQueueCustomerEditModel(model, isHealthPlanCallQueue); model.PatientInfoEditModel = patientInfoEditModel; model.PatientInfoEditViewModel = patientInfoEditModel; return(model); }
private CallQueueCustomer CreateCustomerCallQueueCustomerModel(CallQueueCustomer existingCallQueueCustomer, CallQueueCustomer callQueueCustomer, Customer customer, IEnumerable <Call> customerCalls, int callAttempts, Appointment futureAppointment, ProspectCustomer prospectCustomer, EventAppointmentCancellationLog eacl, bool isConfirmationCallQueue, CustomerEligibility customerEligibility, IEnumerable <EventCustomer> eventCustomers, CustomerTargeted customerTargeted) { var lastCall = (from cc in customerCalls where cc.Status != (long)CallStatus.CallSkipped && (isConfirmationCallQueue == false || cc.CallQueueId == callQueueCustomer.CallQueueId) orderby cc.DateCreated descending select cc).FirstOrDefault(); if (existingCallQueueCustomer == null) { existingCallQueueCustomer = callQueueCustomer; existingCallQueueCustomer.DateCreated = DateTime.Now; existingCallQueueCustomer.CallDate = DateTime.Now; } else { existingCallQueueCustomer.CallDate = DateTime.Now; } existingCallQueueCustomer.IsActive = true; existingCallQueueCustomer.Status = CallQueueStatus.Initial; existingCallQueueCustomer.FirstName = customer.Name.FirstName; existingCallQueueCustomer.LastName = customer.Name.LastName; existingCallQueueCustomer.MiddleName = customer.Name.MiddleName; existingCallQueueCustomer.PhoneHome = customer.HomePhoneNumber; existingCallQueueCustomer.PhoneCell = customer.MobilePhoneNumber; existingCallQueueCustomer.PhoneOffice = customer.OfficePhoneNumber; existingCallQueueCustomer.ZipId = customer.Address.ZipCode.Id; existingCallQueueCustomer.ZipCode = customer.Address.ZipCode.Zip; existingCallQueueCustomer.Tag = customer.Tag; existingCallQueueCustomer.IsEligble = customerEligibility != null ? customerEligibility.IsEligible : null; existingCallQueueCustomer.IsIncorrectPhoneNumber = customer.IsIncorrectPhoneNumber; existingCallQueueCustomer.IsLanguageBarrier = customer.IsLanguageBarrier; existingCallQueueCustomer.ActivityId = customer.ActivityId; existingCallQueueCustomer.DoNotContactTypeId = customer.DoNotContactTypeId; existingCallQueueCustomer.DoNotContactUpdateDate = customer.DoNotContactUpdateDate; existingCallQueueCustomer.AppointmentDate = futureAppointment != null ? futureAppointment.StartTime : (DateTime?)null; existingCallQueueCustomer.NoShowDate = futureAppointment == null ? (eventCustomers.Any() ? eventCustomers.OrderByDescending(x => x.NoShowDate).First().NoShowDate : null) : null; if (!isConfirmationCallQueue) { existingCallQueueCustomer.CallCount = customerCalls.Count(x => x.IsContacted.HasValue && x.IsContacted.Value); existingCallQueueCustomer.Attempts = callAttempts; existingCallQueueCustomer.CallStatus = lastCall != null ? lastCall.Status : (long?)null; existingCallQueueCustomer.Disposition = lastCall != null ? lastCall.Disposition : string.Empty; } //confirm call queue - called then registered for another event, and queue regenerated existingCallQueueCustomer.ContactedDate = lastCall != null ? lastCall.DateCreated : (DateTime?)null; existingCallQueueCustomer.CallBackRequestedDate = null; if (prospectCustomer != null && lastCall != null && lastCall.Status == (long)CallStatus.Attended && lastCall.Disposition == ProspectCustomerTag.CallBackLater.ToString()) { existingCallQueueCustomer.CallBackRequestedDate = prospectCustomer.CallBackRequestedDate; } existingCallQueueCustomer.AppointmentCancellationDate = (DateTime?)null; if (eacl != null && (lastCall == null || lastCall.DateCreated < eacl.DateCreated)) { existingCallQueueCustomer.AppointmentCancellationDate = eacl.DateCreated; } existingCallQueueCustomer.DoNotContactUpdateSource = customer.DoNotContactUpdateSource; existingCallQueueCustomer.LanguageBarrierMarkedDate = customer.LanguageBarrierMarkedDate; existingCallQueueCustomer.IncorrectPhoneNumberMarkedDate = customer.IncorrectPhoneNumberMarkedDate; existingCallQueueCustomer.LanguageId = customer.LanguageId; if (customerTargeted != null) { existingCallQueueCustomer.TargetedYear = customerTargeted.ForYear; existingCallQueueCustomer.IsTargeted = customerTargeted.IsTargated; } existingCallQueueCustomer.ProductTypeId = customer.ProductTypeId; return(existingCallQueueCustomer); }
public CallQueuePatientInfomationViewModel SetCustomerInfo(Customer customer, CustomerEligibility customerEligibility, Falcon.App.Core.Medical.Domain.ActivityType activityType) { var address = customer.Address != null?Mapper.Map <Address, AddressViewModel>(customer.Address) : customer.BillingAddress != null?Mapper.Map <Address, AddressViewModel>(customer.BillingAddress) : null; bool?eligibility = null; if (customerEligibility != null && customerEligibility.IsEligible.HasValue) { eligibility = customerEligibility.IsEligible.Value; } var model = new CallQueuePatientInfomationViewModel { CustomerId = customer.CustomerId, UserId = customer.Id, FirstName = customer.Name.FirstName, LastName = customer.Name.LastName, Gender = customer.Gender, DateOfBirth = customer.DateOfBirth, Email = customer.Email != null?customer.Email.ToString() : string.Empty, AlternateEmail = customer.AlternateEmail != null?customer.AlternateEmail.ToString() : string.Empty, HicnNumber = customer.Hicn, MbiNumber = customer.Mbi, MemberId = customer.InsuranceId, GroupName = customer.GroupName, IsEligible = eligibility, AddressViewModel = address, CallBackPhoneNumber = customer.HomePhoneNumber, OfficePhoneNumber = customer.OfficePhoneNumber, MobilePhoneNumber = customer.MobilePhoneNumber, ActivityId = activityType != null ? activityType.Id : 0, Activity = activityType != null ? activityType.Name : string.Empty, PhoneHomeConsent = customer.PhoneHomeConsentId, PhoneOfficeConsent = customer.PhoneOfficeConsentId, PhoneCellConsent = customer.PhoneCellConsentId, EnableEmail = customer.EnableEmail, AcesId = customer.AcesId, Product = customer.ProductTypeId.HasValue && customer.ProductTypeId.Value > 0 ? ((ProductType)customer.ProductTypeId.Value).GetDescription() : "N/A" }; return(model); }