//private void ExportFileOnClintSftp(string sourcePath, string destination, SftpCridential cridential, string fileName, ILogger logger) //{ // PostFile(sourcePath, destination, cridential.HostName, cridential.UserName, cridential.Password, fileName, logger); //} //private void PostFile(string sourcePath, string destination, string hostName, string userName, string password, string fileName, ILogger logger) //{ // var processFtp = new ProcessFtp(logger, hostName, userName, password); // logger.Info("Destination Path: " + destination); // logger.Info("File Name Path: " + fileName); // logger.Info("Source Path: " + sourcePath); // processFtp.UploadSingleFile(sourcePath, destination, fileName); //} //private void SendIncorrectPhoneNumberClientSftp(CorporateAccount corporateAccount, string destinationFileName, ILogger logger) //{ // var sftpSettings = _sftpCridentialManager.Deserialize(_settings.SftpResouceFilePath + corporateAccount.Tag + ".xml"); // if (sftpSettings != null && sftpSettings.SendFileToSftp) // { // if (_ntspAccountIds != null && _ntspAccountIds.Contains(corporateAccount.Id)) // { // var destinationPathOnSftp = string.Format(_destinationSftpFolderPdfPath, corporateAccount.FolderName); // destinationPathOnSftp = destinationPathOnSftp + "/" + "IncorrectPhoneNumber"; // ExportFileOnClintSftp(destinationFileName, destinationPathOnSftp, sftpSettings, "IncorrectPhoneNumber.csv", logger); // } // else if (corporateAccount.Id == _bcbsMnAccountId) // { // var fileName = string.Format("IncorrectPhoneNumber_{0}.csv", DateTime.Today.ToString("MMddyyyy")); // ExportFileOnClintSftp(destinationFileName, _bcbsSftpFolderPath, sftpSettings, fileName, logger); // } // else if (_settings.HcpNvAccountId == corporateAccount.Id) // { // var destinationPathOnSftp = (!string.IsNullOrEmpty(_settings.HcpNvSftpResultReportDownloadPath) ? _settings.HcpNvSftpResultReportDownloadPath + "/" : string.Empty) + "IncorrectPhoneNumber"; // var fileName = string.Format("IncorrectPhoneNumber_{0}.csv", DateTime.Today.ToString("MMddyyyy")); // ExportFileOnClintSftp(destinationFileName, destinationPathOnSftp, sftpSettings, fileName, logger); // } // else if (_settings.BcbsAlAccountId == corporateAccount.Id) // { // ExportFileOnClintSftp(destinationFileName, _settings.BcbsAlSftpDownloadPath + "Reports", sftpSettings, "IncorrectPhoneNumber.csv", logger); // } // } //} //private void SendHomevisitRequestToClientSftp(CorporateAccount corporateAccount, string destinationFileName, ILogger logger) //{ // var sftpSettings = _sftpCridentialManager.Deserialize(_settings.SftpResouceFilePath + corporateAccount.Tag + ".xml"); // if (sftpSettings != null && sftpSettings.SendFileToSftp) // { // if (_ntspAccountIds != null && _ntspAccountIds.Contains(corporateAccount.Id)) // { // var destinationPathOnSftp = string.Format(_destinationSftpFolderPdfPath, corporateAccount.FolderName); // destinationPathOnSftp = destinationPathOnSftp + "/" + "HomeVisitRequest"; // ExportFileOnClintSftp(destinationFileName, destinationPathOnSftp, sftpSettings, "HomeVisitRequest.csv", logger); // } // else if (corporateAccount.Id == _bcbsMnAccountId) // { // var fileName = string.Format("HomeVisitRequest_{0}.csv", DateTime.Today.ToString("MMddyyyy")); // ExportFileOnClintSftp(destinationFileName, _bcbsSftpFolderPath, sftpSettings, fileName, logger); // } // else if (_settings.HcpNvAccountId == corporateAccount.Id) // { // var fileName = string.Format("HomeVisitRequest_{0}.csv", DateTime.Today.ToString("MMddyyyy")); // var destinationPathOnSftp = (!string.IsNullOrEmpty(_settings.HcpNvSftpResultReportDownloadPath) ? _settings.HcpNvSftpResultReportDownloadPath + "/" : string.Empty) + "HomeVisitRequest"; // ExportFileOnClintSftp(destinationFileName, destinationPathOnSftp, sftpSettings, fileName, logger); // } // else if (_settings.BcbsAlAccountId == corporateAccount.Id) // { // ExportFileOnClintSftp(destinationFileName, _settings.BcbsAlSftpDownloadPath + "Reports", sftpSettings, "HomeVisitRequested.csv", logger); // } // } //} public void ExcellusMedicaidHomeVisitRequestedCustomerExport(HealthPlanCustomerExportFilter filter, string destinationFolderPath, string fileName, ILogger logger) { logger.Info(string.Format("Starting for Corporate Tag: {0} StartDate: {1}", filter.CorporateTag, filter.StartDate.ToShortDateString())); var list = HomeVisitExportCustomerReport(filter, logger); if (!list.Any()) { return; } if (!Directory.Exists(destinationFolderPath)) { Directory.CreateDirectory(destinationFolderPath); } var destinationFileName = Path.Combine(destinationFolderPath, fileName); if (File.Exists(destinationFileName)) { File.Delete(destinationFileName); } logger.Info(string.Format("Corporate Tag: {0} StartDate: {1} Create CSV at Path: {2} ", filter.CorporateTag, filter.StartDate.ToShortDateString(), destinationFileName)); WriteCsv(destinationFileName, list, logger); }
private void HomeVisitRequestReportForNormalPatient(CorporateAccount account, DateTime fromDate, DateTime toDate) { var tagToExlude = new List <string>(); if (!_bcbsMiGapPatinetTags.IsNullOrEmpty()) { tagToExlude.AddRange(_bcbsMiGapPatinetTags); } if (!_bcbsMiRiskPatientTags.IsNullOrEmpty()) { tagToExlude.AddRange(_bcbsMiRiskPatientTags); } var filter = new HealthPlanCustomerExportFilter { CallStatus = CallStatus.Attended, Tag = ProspectCustomerTag.HomeVisitRequested, CorporateTag = account.Tag, StartDate = fromDate, EndDate = toDate, CustomTags = tagToExlude.ToArray(), ExcludeCustomerWithCustomTag = true }; _logger.Info(string.Format("Starting Normal Patient for Corporate Tag: {0} StartDate: {1}", filter.CorporateTag, filter.StartDate.ToShortDateString())); HomeVisitRequestReport("HomeVisitRequested", account, filter); _logger.Info(string.Format("Completed Normal Patient for Corporate Tag: {0} StartDate: {1}\n", filter.CorporateTag, filter.StartDate.ToShortDateString())); }
private void HomeVisitRequestReportForGapPatient(CorporateAccount account, DateTime fromDate, DateTime toDate) { var filter = new HealthPlanCustomerExportFilter { CallStatus = CallStatus.Attended, Tag = ProspectCustomerTag.HomeVisitRequested, CorporateTag = account.Tag, StartDate = fromDate, EndDate = toDate, CustomTags = _bcbsMiGapPatinetTags }; _logger.Info(string.Format("Starting Gap Patient for Corporate Tag: {0} StartDate: {1}", filter.CorporateTag, filter.StartDate.ToShortDateString())); HomeVisitRequestReport("Q_HomeVisitRequested", account, filter); _logger.Info(string.Format("Completed Gap Patient for Corporate Tag: {0} StartDate: {1}\n", filter.CorporateTag, filter.StartDate.ToShortDateString())); }
public void AnthemIncorrectPhoneNumbreCustomerExport(HealthPlanCustomerExportFilter filter, string destinationFolderPath, string fileName, ILogger logger) { logger.Info(string.Format("Starting for Corporate Tag: {0} StartDate: {1}", filter.CorporateTag, filter.StartDate.ToShortDateString())); var filterforincorrectPhone = new HealthPlanCustomerIncorrectPhoneExportFilter { CorporateTag = filter.CorporateTag, CustomTags = filter.CustomTags, ExcludeCustomerWithCustomTag = filter.ExcludeCustomerWithCustomTag, StartDate = filter.StartDate }; var list = IncorrectPhoneNumberExportReport(filterforincorrectPhone, logger); if (!list.Any()) { return; } if (!Directory.Exists(destinationFolderPath)) { Directory.CreateDirectory(destinationFolderPath); } var destinationFileName = Path.Combine(destinationFolderPath, fileName); if (File.Exists(destinationFileName)) { File.Delete(destinationFileName); } logger.Info(string.Format("Corporate Tag: {0} StartDate: {1} Create CSV at Path: {2} ", filter.CorporateTag, filter.StartDate.ToShortDateString(), destinationFileName)); WriteCsv(destinationFileName, list, logger); }
private IEnumerable <HealthPlanExportCustomerViewModel> HomeVisitExportCustomerReport(HealthPlanCustomerExportFilter filter, ILogger logger) { var list = new List <HealthPlanExportCustomerViewModel>(); var pageNumber = 1; while (true) { int totalRecords; var customers = _customerRepository.HealthPlanHomeVisitRequestedCustomerExport(filter, pageNumber, _pageSizeHealthPlanExport, out totalRecords); if (customers == null || !customers.Any()) { break; } var customerIds = customers.Select(x => x.CustomerId).ToArray(); var corporateTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds); var primaryCarePhysicians = _primaryCarePhysicianRepository.GetByCustomerIds(customerIds); var model = _exportCustomerViewModelFactory.Create(customers, corporateTags, primaryCarePhysicians); list.AddRange(model); logger.Info(string.Format("Page Number {0} Total Records {1}", pageNumber, totalRecords)); pageNumber++; if (list.Count >= totalRecords) { break; } } return(list); }
public void HealthPlanHomeVisitRequestedCustomerExport(DateTime cutOffDate, string destinationFileFormate, ILogger logger) { var healthPlans = _corporateAccountRepository.GetAllHealthPlan(); if (healthPlans.IsNullOrEmpty()) { logger.Info("No Healthplan exists"); return; } if (!_settings.DoNotSendHomeVistIncorrectPhoneNumberAccountIds.IsNullOrEmpty()) { healthPlans = healthPlans.Where(hp => !_settings.DoNotSendHomeVistIncorrectPhoneNumberAccountIds.Contains(hp.Id)); } logger.Info("Starting Corporate Customer Export for Home Vist Requested"); foreach (var corporateAccount in healthPlans) { var filter = new HealthPlanCustomerExportFilter { CallStatus = CallStatus.Attended, CorporateTag = corporateAccount.Tag, StartDate = cutOffDate, Tag = ProspectCustomerTag.HomeVisitRequested }; if (corporateAccount.Id == _settings.HealthNowAccountId) { filter.CustomTags = _settings.HealthNowCustomTags; } if (corporateAccount.Id == _settings.ExcellusAccountId) { filter.CustomTags = _settings.ExcellusCustomTags; } logger.Info(string.Format("Starting for Corporate Tag: {0} StartDate: {1}", filter.CorporateTag, filter.StartDate.ToShortDateString())); var list = HomeVisitExportCustomerReport(filter, logger); if (!list.Any()) { continue; } var destinationFolderPath = string.Format(destinationFileFormate, corporateAccount.FolderName, DateTime.Today.Year); var fileName = "HomeVisitRequested.csv"; if (_settings.OptumHomeVisitRequesedAccountIds.Contains(corporateAccount.Id)) { destinationFolderPath = string.Format(_settings.OptumHomeVisitRequesedDownloadPath, corporateAccount.FolderName); fileName = "HomeVisitRequested" + DateTime.Today.ToString("yyyyMMdd") + ".csv"; } else if (corporateAccount.Id == _martinsPointExclusiveAccountId) { fileName = "Exclusive_HomeVisitRequested.csv"; } else if (corporateAccount.Id == _settings.ExcellusAccountId) { destinationFolderPath = Directory.GetParent(destinationFolderPath).FullName; fileName = "HomeVisitRequest_" + DateTime.Today.ToString("yyyyMMdd") + ".csv"; } else if (corporateAccount.Id == _settings.HealthNowAccountId) { destinationFolderPath = string.Format(_settings.HealthPlanDownloadPath, corporateAccount.FolderName); fileName = "HomeVisitRequest_" + DateTime.Today.ToString("yyyyMMdd") + ".csv"; DirectoryOperationsHelper.DeleteFiles(destinationFolderPath, "HomeVisitRequest*.csv"); } else if (corporateAccount.Id == _settings.MedMutualAccountId) { destinationFolderPath = string.Format(_settings.HealthPlanDownloadPath, corporateAccount.FolderName); fileName = "HomeVisitRequest_" + DateTime.Today.ToString("yyyyMMdd") + ".csv"; DirectoryOperationsHelper.DeleteFiles(destinationFolderPath, "HomeVisitRequest*.csv"); } else if (corporateAccount.Id == _settings.WellmedWellCareAccountId) { var wellmedAccount = healthPlans.FirstOrDefault(x => x.Id == _settings.WellmedAccountId); if (wellmedAccount != null) { destinationFolderPath = string.Format(destinationFileFormate, wellmedAccount.FolderName, DateTime.Today.Year); fileName = "WCR_HomeVisitRequest_" + DateTime.Today.ToString("yyyyMMdd") + ".csv"; } DirectoryOperationsHelper.DeleteFiles(destinationFolderPath, "WCR_HomeVisitRequest*.csv"); } else if (corporateAccount.Id == _settings.ConnecticareAccountId) { destinationFolderPath = string.Format(_settings.HealthPlanDownloadPath, corporateAccount.FolderName); fileName = "Comm Home Visit Req " + DateTime.Today.ToString("yyyy-MM-dd") + ".csv"; } else if (corporateAccount.Id == _settings.ConnecticareMaAccountId) { destinationFolderPath = string.Format(_settings.HealthPlanDownloadPath, corporateAccount.FolderName); fileName = "MCR Home Visit Req " + DateTime.Today.ToString("yyyy-MM-dd") + ".csv"; } else if (corporateAccount.Id == _settings.BcbsScAssessmentAccountId) { destinationFolderPath = string.Format(_settings.HealthPlanExportRootPath, corporateAccount.FolderName); } else if (corporateAccount.Id == _settings.PPAccountId) { destinationFolderPath = string.Format(_settings.HealthPlanDownloadPath, corporateAccount.FolderName); fileName = "HomeVisitRequest_" + DateTime.Today.ToString("yyyyMMdd") + ".csv"; } else if (corporateAccount.Id == _settings.NammAccountId) { destinationFolderPath = string.Format(_settings.HealthPlanExportRootPath, corporateAccount.FolderName); fileName = "HomeVisitRequest_" + DateTime.Today.ToString("yyyyMMdd") + ".csv"; } //else if (corporateAccount.Id == _settings.BcbsScAccountId) //{ // var folder = _settings.BcbsScFolder; // destinationFolderPath = Path.Combine(string.Format(_settings.OutTakeReportPath, folder), "HomeVisitRequest"); // fileName = string.Format("HomeVisitRequest_{0}_{1}_{2}.csv", corporateAccount.AcesClientShortName, folder, DateTime.Today.ToString("MMddyyyy")); //} if (_settings.OptumAccountIds.Contains(corporateAccount.Id)) { try { DirectoryOperationsHelper.DeleteDirectory(destinationFolderPath, true); } catch (Exception ex) { logger.Error("Some error occurred while deleting directory at path: " + destinationFolderPath); logger.Error("Message: " + ex.Message); logger.Error("Stack Trace: " + ex.StackTrace); } } if (!Directory.Exists(destinationFolderPath)) { Directory.CreateDirectory(destinationFolderPath); } var destinationFileName = Path.Combine(destinationFolderPath, fileName); if (File.Exists(destinationFileName)) { File.Delete(destinationFileName); } logger.Info(string.Format("Corporate Tag: {0} StartDate: {1} Create CSV at Path: {2} ", filter.CorporateTag, filter.StartDate.ToShortDateString(), destinationFileName)); WriteCsv(destinationFileName, list, logger); //if (File.Exists(destinationFileName)) //{ // SendHomevisitRequestToClientSftp(corporateAccount, destinationFileName, logger); //} } }
public void PollForCustomerExport() { try { _logger.Info("Stated Corporate Customer Export for Anthem Home Visit Requested."); if (DateTime.Today.DayOfWeek != _dayOfWeek) { _logger.Info("Day of the week is " + ((long)DateTime.Today.DayOfWeek)); return; } foreach (var customTag in _settings.AnthemCustomTags) { try { var corporateTag = _corporateTagRepository.GetByTag(customTag); if (corporateTag == null) { _logger.Info("No Corporate Account Found for the Tag: " + customTag); continue; } var corporateAccount = _corporateAccountReporsitory.GetById(corporateTag.CorporateId); if (corporateAccount == null) { _logger.Info("No Corporate Account Found for the Tag: " + customTag); continue; } _logger.Info("running for Custom Tag: " + customTag); var filter = new HealthPlanCustomerExportFilter { CallStatus = CallStatus.Attended, CorporateTag = corporateAccount.Tag, StartDate = new DateTime(DateTime.Today.Year, 1, 1), Tag = ProspectCustomerTag.HomeVisitRequested, CustomTags = new[] { customTag } }; var folderStateCode = string.Empty; foreach (var stateCode in _settings.AnthemCustomTagStates) { if (customTag.Contains(stateCode)) { folderStateCode = stateCode.Substring(stateCode.Length - 2); break; } } if (folderStateCode == string.Empty) { continue; } var destinationPath = string.Format(_settings.AnthemDownloadPath, folderStateCode); destinationPath = Path.Combine(destinationPath, "HomeVisitRequest"); var fileName = string.Format("HLTHFAIR_HomeVisitRequest_{0}.csv", DateTime.Today.ToString("yyyyMMdd")); _healthPlanCustomerExportService.AnthemHomeVisitRequestedCustomerExport(filter, destinationPath, fileName, _logger); _logger.Info("completed for Custom Tag: " + customTag); } catch (Exception exception) { _logger.Error("Message: " + exception.Message); _logger.Error("Stack Trace: " + exception.StackTrace); } } } catch (Exception ex) { _logger.Error(string.Format("Error while Creating Csv Home Visit Requested list. Message {0} \n Stack Trace {1}", ex.Message, ex.StackTrace)); } _logger.Info("Completed Corporate Customer Export for Anthem Home Visit Requested."); }
private void HomeVisitRequestReport(string fileName, CorporateAccount account, HealthPlanCustomerExportFilter filter) { var list = new List <BcbsMiHomeVisitRequestViewModel>(); var pageNumber = 1; while (true) { int totalRecords; var customers = _customerRepository.HealthPlanHomeVisitRequestedCustomerExport(filter, pageNumber, PageSize, out totalRecords); _logger.Info(string.Format("Corporate Tag: {0} StartDate: {1} Total Customer Found: {2} PageNumber {3} ", filter.CorporateTag, filter.StartDate.ToShortDateString(), totalRecords, pageNumber)); if (customers == null || !customers.Any()) { break; } var customerIds = customers.Select(x => x.CustomerId).ToArray(); var corporateTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds); var primaryCarePhysicians = _primaryCarePhysicianRepository.GetByCustomerIds(customerIds); var model = _healthPlanExportCustomerViewModelFactory.CreateHomeVisitListForBcbsMi(customers, corporateTags, primaryCarePhysicians); list.AddRange(model); pageNumber++; if (list.Count >= totalRecords) { break; } } if (!list.Any()) { _logger.Info(string.Format("No Patients found for Corporate Tag: {0}", filter.CorporateTag)); return; } GenerateReport(fileName, account, list); }