Ejemplo n.º 1
0
        private void ResultExportForGapPatient(DateTime fromDate, DateTime toDate, CorporateAccount account, DateTime eventStartDate, DateTime eventEndDate)
        {
            try
            {
                var bcbsmiResultExportDownloadPath = string.Format(_bcbsmiResultExportDownloadPath, account.FolderName);

                var gapFileName = string.Format(@"Q_MOBILE_ResultExport_{0}_{1}.csv", fromDate.Date.ToString("yyyyMMdd"), toDate.Date.ToString("yyyyMMdd"));

                var finalFilename = Path.Combine(bcbsmiResultExportDownloadPath, gapFileName);

                CreateDistinationDirectory(_accumulativeResultExportsPath);
                CreateDistinationDirectory(_incrementalResultExportsPath);

                var cumulativeFilePath = Path.Combine(_accumulativeResultExportsPath, string.Format(@"ResultExport_{0}_{1}.csv", account.Tag, eventStartDate.Year));

                var incrementalFile = string.Format(@"ResultExport_{0}_{1}.csv", account.Tag, Guid.NewGuid());

                var incrementalFilePath = Path.Combine(_incrementalResultExportsPath, incrementalFile);

                DateTime?stopSendingPdftoHealthPlanDate = null;
                if (account != null && account.IsHealthPlan)
                {
                    stopSendingPdftoHealthPlanDate = _stopSendingPdftoHealthPlanDate;
                }

                _pcpResultExportServiceHelper.ResultExport(fromDate, toDate, account.Id, _incrementalResultExportsPath, account.Tag,
                                                           _bcbsMiGapPatinetTags, useBlankValue: true, resultExportFileName: incrementalFile, considerEventDate: true,
                                                           eventStartDate: eventStartDate, eventEndDate: eventEndDate, stopSendingPdftoHealthPlanDate: stopSendingPdftoHealthPlanDate);

                _pcpResultExportServiceHelper.CreateCumulativeFileAndPost(incrementalFilePath, cumulativeFilePath, finalFilename);

                if (DirectoryOperationsHelper.IsFileExist(finalFilename))
                {
                    _csvReader.RemoveEmptyColumnsFromCsv(finalFilename);

                    _pgpFileEncryptionHelper.EncryptFile(account, finalFilename);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message: {0} \n Stack Trace: {1} ", ex.Message, ex.StackTrace));
            }
        }
Ejemplo n.º 2
0
        public void ResultExport()
        {
            try
            {
                if (_accountIds.IsNullOrEmpty())
                {
                    return;
                }
                var corporateAccounts = _corporateAccountRepository.GetByIds(_accountIds);

                foreach (var account in corporateAccounts)
                {
                    try
                    {
                        if (account.Id == _settings.ExcellusAccountId && _settings.ExcellusExportResultReportDayOfWeek != DateTime.Now.DayOfWeek)
                        {
                            _logger.Info(string.Format("The job runs for Account ID : {0} and Tag : {1} on every {2}.", account.Id, account.Tag, _settings.ExcellusExportResultReportDayOfWeek));
                            continue;
                        }
                        if (account.Id == _settings.MedMutualAccountId && _settings.MedMutualExportDay != DateTime.Now.Day)
                        {
                            _logger.Info(string.Format("The job runs for Account ID : {0} and Tag : {1} on {2} of every month.", account.Id, account.Tag, _settings.MedMutualExportDay));
                            continue;
                        }
                        if (account.Id == _settings.FloridaBlueFepAccountId && _settings.FloridaBlueFepExportDayOfWeek != DateTime.Now.DayOfWeek)
                        {
                            _logger.Info(string.Format("The job runs for Account ID : {0} and Tag : {1} on every {2}.", account.Id, account.Tag, _settings.FloridaBlueFepExportDayOfWeek));
                            continue;
                        }

                        string[] customTags = null;

                        if (account.Id == _settings.ExcellusAccountId)
                        {
                            customTags = _settings.ExcellusCustomTags;
                        }
                        else if (account.Id == _settings.HealthNowAccountId)
                        {
                            customTags = _settings.HealthNowCustomTags;
                        }

                        var resultExportSettings = string.Format(_resultExportSettings, account.Tag);
                        var physicianPartnerResultExportDownloadPath = string.Format(_physicianPartnerResultExportDownloadPath, account.FolderName);

                        if (account.Id == _settings.MedMutualAccountId || account.Id == _settings.HealthNowAccountId)
                        {
                            physicianPartnerResultExportDownloadPath = string.Format(_settings.HealthPlanDownloadPath, account.FolderName);
                        }
                        else if (account.Id == _settings.BcbsScAccountId || account.Id == _settings.BcbsScAssessmentAccountId || account.Id == _settings.NammAccountId)
                        {
                            physicianPartnerResultExportDownloadPath = string.Format(_settings.HealthPlanExportRootPath, account.FolderName);
                        }
                        else if (account.Id == _settings.FloridaBlueFepAccountId)
                        {
                            physicianPartnerResultExportDownloadPath = Path.Combine(string.Format(_settings.HealthPlanDownloadPath, account.FolderName), "Reports");
                        }

                        var customSettings = _customSettingManager.Deserialize(resultExportSettings);
                        var sftpSettings   = _sftpCridentialManager.Deserialize(_settings.SftpResouceFilePath + account.Tag + ".xml");

                        var fromDate = customSettings.LastTransactionDate ?? _cutOfDate;
                        var toDate   = DateTime.Now;

                        _logger.Info(string.Format("Generating Result Report for Account ID : {0} and Tag : {1}", account.Id, account.Tag));

                        DateTime?stopSendingPdftoHealthPlanDate = null;
                        if (account != null && account.IsHealthPlan)
                        {
                            stopSendingPdftoHealthPlanDate = _settings.StopSendingPdftoHealthPlanDate;
                        }

                        _pcpResultExportServiceHelper.ResultExport(fromDate, toDate, account.Id, physicianPartnerResultExportDownloadPath, account.Tag, customTags, stopSendingPdftoHealthPlanDate: stopSendingPdftoHealthPlanDate);

                        var resultExportFileName = string.Format(@"ResultExport_{0}.csv", DateTime.Now.Date.ToString("yyyyMMdd"));
                        var fileName             = physicianPartnerResultExportDownloadPath + "\\" + resultExportFileName;

                        if (DirectoryOperationsHelper.IsFileExist(fileName))
                        {
                            _pgpFileEncryptionHelper.EncryptFile(account, fileName);

                            if (account.Id == _settings.FloridaBlueFepAccountId && _settings.SendReportToFloridaBlueSftp)
                            {
                                var destinationSftpPath = _settings.FloridaBlueSftpPath + "\\" + account.FolderName + "\\Download\\Reports";
                                PostFile(fileName, destinationSftpPath, _settings.FloridaBlueSftpHost, _settings.FloridaBlueSftpUserName, _settings.FloridaBlueSftpPassword);
                            }
                            else
                            {
                                PostFileOnClientSftp(sftpSettings, account, fileName, fromDate);
                            }
                        }

                        customSettings.LastTransactionDate = toDate;
                        _customSettingManager.SerializeandSave(resultExportSettings, customSettings);
                    }
                    catch (Exception ex)
                    {
                        _logger.Error(string.Format("Account Id {0} and account Tag {1}  Message: {2} \n Stack Trace: {3} ", account.Id, account.Tag, ex.Message, ex.StackTrace));
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message: {0} \n Stack Trace: {1} ", ex.Message, ex.StackTrace));
            }
        }
Ejemplo n.º 3
0
        public void ResultExport()
        {
            try
            {
                if (_accountIds.IsNullOrEmpty())
                {
                    return;
                }

                var accounts = _corporateAccountRepository.GetByIds(_accountIds);

                if (accounts.IsNullOrEmpty())
                {
                    _logger.Info("Account can't be null");
                    return;
                }

                foreach (var account in accounts)
                {
                    try
                    {
                        var resultExportSettings = string.Format(_resultExportSettings, account.Tag);

                        var customSettings = _customSettingManager.Deserialize(resultExportSettings);

                        var fromDate = customSettings.LastTransactionDate ?? _cutOfDate;
                        var toDate   = DateTime.Now;

                        var      destinationPath = _wellmedResultExportDownloadPath;
                        string[] customTags      = null;

                        if (account.Id == _settings.WellmedWellCareAccountId)
                        {
                            destinationPath = destinationPath + "\\" + account.FolderName;
                        }

                        if (account.Id == _settings.WellmedWellCareAccountId)
                        {
                            customTags = _settings.WellCareToWellMedCustomTags;
                        }

                        if (!Directory.Exists(destinationPath))
                        {
                            Directory.CreateDirectory(destinationPath);
                        }

                        var fileName = string.Format(@"ResultExport_{0}.csv", DateTime.Now.Date.ToString("yyyyMMdd"));

                        if (account.Id != _accountId)
                        {
                            fileName = string.Format(@"WCR_ResultExport_{0}.csv", DateTime.Now.Date.ToString("yyyyMMdd"));;
                        }

                        var sourceFileName = Path.Combine(destinationPath, fileName);

                        DateTime?stopSendingPdftoHealthPlanDate = null;
                        if (account != null && account.IsHealthPlan)
                        {
                            stopSendingPdftoHealthPlanDate = _settings.StopSendingPdftoHealthPlanDate;
                        }

                        _pcpResultExportServiceHelper.ResultExport(fromDate, toDate, account.Id, destinationPath, account.Tag, customTags: customTags, resultExportFileName: fileName, stopSendingPdftoHealthPlanDate: stopSendingPdftoHealthPlanDate);

                        if (DirectoryOperationsHelper.IsFileExist(sourceFileName))
                        {
                            sourceFileName = _pgpFileEncryptionHelper.EncryptFile(account, sourceFileName);
                        }

                        if (_sendReportToSftp && File.Exists(sourceFileName))
                        {
                            var sftpResultExportDirectory = _destinationSftpFolderResultExportPath;

                            if (account.Id != _accountId)
                            {
                                sftpResultExportDirectory = sftpResultExportDirectory + "\\" + account.FolderName;
                            }

                            var processFtp = new ProcessFtp(_logger, _sftpHost, _sftpUserName, _sftpPassword);
                            processFtp.UploadSingleFile(sourceFileName, sftpResultExportDirectory, "");
                        }

                        customSettings.LastTransactionDate = toDate;
                        _customSettingManager.SerializeandSave(resultExportSettings, customSettings);
                    }
                    catch (Exception ex)
                    {
                        _logger.Error("some error occured for Account Id:  " + account.Id + " tag: " + account.Tag);
                        _logger.Info("Message:" + ex.Message);
                        _logger.Info("Stack Trace:" + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message: {0} \n Stack Trace: {1} ", ex.Message, ex.StackTrace));
            }
        }
Ejemplo n.º 4
0
        public void ResultExport()
        {
            try
            {
                if (_accountId <= 0)
                {
                    return;
                }

                var account = _corporateAccountRepository.GetById(_accountId);

                if (account == null)
                {
                    _logger.Info("Account can't be null");
                    return;
                }

                var resultExportSettings = string.Format(_resultExportSettings, account.Tag);

                var customSettings = _customSettingManager.Deserialize(resultExportSettings);

                var fromDate = customSettings.LastTransactionDate ?? _cutOfDate;
                var toDate   = DateTime.Now;

                if (!Directory.Exists(_molinaResultExportDownloadPath))
                {
                    Directory.CreateDirectory(_molinaResultExportDownloadPath);
                }

                var sourceFileName = _molinaResultExportDownloadPath + string.Format(@"\ResultExport_{0}.csv", DateTime.Now.Date.ToString("yyyyMMdd"));;

                DateTime?stopSendingPdftoHealthPlanDate = null;
                if (account != null && account.IsHealthPlan)
                {
                    stopSendingPdftoHealthPlanDate = _stopSendingPdftoHealthPlanDate;
                }

                _pcpResultExportServiceHelper.ResultExport(fromDate, toDate, account.Id, _molinaResultExportDownloadPath, account.Tag, stopSendingPdftoHealthPlanDate: stopSendingPdftoHealthPlanDate);

                try
                {
                    if (DirectoryOperationsHelper.IsFileExist(sourceFileName))
                    {
                        _pgpFileEncryptionHelper.EncryptFile(account, sourceFileName);
                    }
                    else
                    {
                        _logger.Error("Message: " + sourceFileName + " File not found");
                    }
                }
                catch (Exception exception)
                {
                    _logger.Error("Message: " + exception.Message + " Stack Trace: " + exception.StackTrace);
                }

                customSettings.LastTransactionDate = toDate;
                _customSettingManager.SerializeandSave(resultExportSettings, customSettings);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message: {0} \n Stack Trace: {1} ", ex.Message, ex.StackTrace));
            }
        }
Ejemplo n.º 5
0
        public void ResultExport()
        {
            try
            {
                string[] showAdditionalFields = null;
                if (!string.IsNullOrEmpty(_settings.AnthemAdditionalFieldValues))
                {
                    showAdditionalFields = _settings.AnthemAdditionalFieldValues.Split(new char[','], StringSplitOptions.RemoveEmptyEntries);
                }

                foreach (var customTag in _customTags)
                {
                    try
                    {
                        _logger.Info("Running report for CustomTag: " + customTag);
                        var corporateTag = _corporateTagRepository.GetByTag(customTag);

                        if (corporateTag == null)
                        {
                            _logger.Info("No Corporate Tag Found: " + customTag);
                            continue;
                        }
                        var account = (_corporateAccountRepository).GetById(corporateTag.CorporateId);

                        _logger.Info(string.Format("Generating AppointmentBooked for accountId {0} and account tag {1}. ", account.Id, account.Tag));

                        var folderStateCode = string.Empty;
                        if (account.Id == _anthemAccountId)
                        {
                            folderStateCode = "CA";
                        }
                        else
                        {
                            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, "results");

                        var resultExportSettings = string.Format(_resultExportSettings, account.Tag);

                        var customSettings = _customSettingManager.Deserialize(resultExportSettings);

                        var fromDate = customSettings.LastTransactionDate ?? DateTime.Today.GetFirstDateOfYear();

                        var toDate = DateTime.Now;

                        CreateDistinationDirectory(destinationPath);

                        CreateDistinationDirectory(_accumulativeResultExportsPath);
                        CreateDistinationDirectory(_incrementalResultExportsPath);

                        var customTags = new[] { customTag };

                        var finalFilename   = string.Format("HLTHFAIR_ResultsExport_{0}.csv", DateTime.Today.ToString("yyyyMMdd"));
                        var incrementalFile = string.Format(@"ResultExport_{0}_{1}.csv", account.Tag, Guid.NewGuid());

                        var cumulativeFilePath  = Path.Combine(_accumulativeResultExportsPath, string.Format(@"ResultExport_{0}_{1}.csv", account.Tag, DateTime.Today.Year));
                        var incrementalFilePath = Path.Combine(_incrementalResultExportsPath, incrementalFile);

                        var finalFilePath = Path.Combine(destinationPath, finalFilename);

                        DateTime?stopSendingPdftoHealthPlanDate = null;
                        if (account != null && account.IsHealthPlan)
                        {
                            stopSendingPdftoHealthPlanDate = _settings.StopSendingPdftoHealthPlanDate;
                        }

                        _pcpResultExportServiceHelper.ResultExport(fromDate, toDate, account.Id, _incrementalResultExportsPath, account.Tag, customTags, resultExportFileName: incrementalFile, considerEventDate: true, eventStartDate: fromDate.GetFirstDateOfYear(), eventEndDate: fromDate.GetLastDateOfYear(), showHiddenAdditionalFields: showAdditionalFields, stopSendingPdftoHealthPlanDate: stopSendingPdftoHealthPlanDate);

                        _pcpResultExportServiceHelper.CreateCumulativeFileAndPost(incrementalFilePath, cumulativeFilePath, finalFilePath);

                        if (DirectoryOperationsHelper.IsFileExist(finalFilePath))
                        {
                            _pgpFileEncryptionHelper.EncryptFile(account, finalFilePath);
                        }

                        customSettings.LastTransactionDate = toDate;
                        _customSettingManager.SerializeandSave(resultExportSettings, customSettings);
                    }
                    catch (Exception ex)
                    {
                        _logger.Error(string.Format("Custom Tag {0}  Message: {1} \n Stack Trace: {2} ", customTag, ex.Message, ex.StackTrace));
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message: {0} \n Stack Trace: {1} ", ex.Message, ex.StackTrace));
            }
        }
Ejemplo n.º 6
0
        public void ResultExport()
        {
            try
            {
                if (_accountIds.IsNullOrEmpty())
                {
                    return;
                }

                var corporateAccounts = _corporateAccountRepository.GetByIds(_accountIds);

                foreach (var account in corporateAccounts)
                {
                    try
                    {
                        _logger.Info(string.Format("Generating for accountId {0} and account tag {1}. ", account.Id, account.Tag));

                        var resultExportSettings          = string.Format(_resultExportSettings, account.Tag);
                        var optumResultExportDownloadPath = string.Format(_optumeResultExportDownloadPath, account.FolderName);

                        var customSettings = _customSettingManager.Deserialize(resultExportSettings);

                        var fromDate = customSettings.LastTransactionDate ?? DateTime.Today.GetFirstDateOfYear();

                        var toDate = DateTime.Now;

                        if (_optumAccountIds.Contains(account.Id))
                        {
                            try
                            {
                                DirectoryOperationsHelper.DeleteDirectory(optumResultExportDownloadPath, true);
                            }
                            catch (Exception ex)
                            {
                                _logger.Error("Some error occurred while deleting directory at path: " + optumResultExportDownloadPath);
                                _logger.Error("Message: " + ex.Message);
                                _logger.Error("Stack Trace: " + ex.StackTrace);
                            }
                        }

                        string[] showHiddenColumns = new string[1];

                        if (_optumNVSettingAccountIds.Contains(account.Id))
                        {
                            showHiddenColumns[0] = "Mrn";
                        }

                        _logger.Info(" Create Destination Path: " + optumResultExportDownloadPath);

                        DirectoryOperationsHelper.CreateDirectoryIfNotExist(optumResultExportDownloadPath);

                        var fileName = optumResultExportDownloadPath + string.Format(@"\ResultExport_{0}.csv", DateTime.Now.Date.ToString("yyyyMMdd"));

                        if (_optumAccountIds.Contains(account.Id))
                        {
                            GenerateCummulativeReport(fromDate, toDate, account, optumResultExportDownloadPath, showHiddenColumns, fileName);
                        }
                        else
                        {
                            DateTime?stopSendingPdftoHealthPlanDate = null;
                            if (account != null && account.IsHealthPlan)
                            {
                                stopSendingPdftoHealthPlanDate = _stopSendingPdftoHealthPlanDate;
                            }

                            _pcpResultExportServiceHelper.ResultExport(fromDate, toDate, account.Id, optumResultExportDownloadPath, account.Tag, resultExportFileName: fileName, showHiddenColumns: showHiddenColumns, stopSendingPdftoHealthPlanDate: stopSendingPdftoHealthPlanDate);
                        }

                        if (DirectoryOperationsHelper.IsFileExist(fileName))
                        {
                            _pgpFileEncryptionHelper.EncryptFile(account, fileName);
                        }
                        else if (_optumNVSettingAccountIds.Contains(account.Id))
                        {
                            _pcpResultExportServiceHelper.WriteCsvHeader(fileName, showHiddenColumns);
                        }

                        customSettings.LastTransactionDate = toDate;
                        _customSettingManager.SerializeandSave(resultExportSettings, customSettings);
                    }
                    catch (Exception ex)
                    {
                        _logger.Error(string.Format("Account Id {0} and account Tag {1}  Message: {2} \n Stack Trace: {3} ", account.Id, account.Tag, ex.Message, ex.StackTrace));
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message: {0} \n Stack Trace: {1} ", ex.Message, ex.StackTrace));
            }
        }