Exemple #1
0
        private void SaveResultNotPosted(string tag)
        {
            var filePath = GetResultNotPostedXmlFilePath(tag);

            DirectoryOperationsHelper.DeleteFileIfExist(filePath);

            if (_resultPdfNotPosted != null)
            {
                _resultPdfNotPostedSerializer.SerializeandSave(GetResultNotPostedXmlFilePath(tag), _resultPdfNotPosted);

                if (_resultPdfNotPosted.EventCustomer.Count > 0)
                {
                    _resultPdfEmailNotificationHelper.SendEmailNotificationForFileNotPosted(tag, _resultPdfNotPosted.EventCustomer.Count, _logger);
                }

                _resultPdfNotPosted = null;
            }
        }
Exemple #2
0
        private void AddToResultNotPosted(AnthemResultPostedViewModel customerResultObject)
        {
            if (_resultPdfNotPosted == null)
            {
                _resultPdfNotPosted = new ResultPdfNotPosted {
                    EventCustomer = new List <EventCustomerInfo>()
                };
            }
            var ecr = customerResultObject.EventCustomerResult;

            _resultPdfNotPosted.EventCustomer.Add(new EventCustomerInfo
            {
                EventCustomerId = ecr.Id,
                EventId         = ecr.EventId,
                CustomerId      = ecr.CustomerId,
                Error           = "file not Moved on HIP SFTP."
            });
        }
Exemple #3
0
        public void PollForPdfDownload()
        {
            try
            {
                if (_accountIds.IsNullOrEmpty())
                {
                    _logger.Info("Account Ids Can not be empty: ");
                    return;
                }

                var accounts = _corporateAccountRepository.GetByIds(_accountIds);

                if (accounts.IsNullOrEmpty())
                {
                    _logger.Info("No valid account Found");
                    return;
                }

                var destinationFolderPdf = _settings.AnthemDownloadPath;
                destinationFolderPdf = Path.Combine(destinationFolderPdf, "pdf");

                DirectoryOperationsHelper.CreateDirectoryIfNotExist(destinationFolderPdf);

                foreach (var corporateAccount in accounts)
                {
                    PostResultAccountWise(corporateAccount, destinationFolderPdf);
                }

                CreateEobFile(_anthemPdfCrossWalkVeiwModel, destinationFolderPdf);
                CreateCrossWalkFile(destinationFolderPdf, _anthemPdfCrossWalkVeiwModel);

                _resultPdfPostedXml          = null;
                _anthemPdfCrossWalkVeiwModel = null;
                _resultPdfNotPosted          = null;
                _customSettings = null;
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("some error occured Exception Message: \n{0}, \n stack Trace: \n\t {1} ", exception.Message, exception.StackTrace));
            }
        }
Exemple #4
0
        private void PostResultAccountWise(CorporateAccount corporateAccount, string destinationFolderPdf)
        {
            try
            {
                _resultPdfPostedXml = null;
                //_anthemPdfCrossWalkVeiwModel = null;
                _resultPdfNotPosted = null;

                var customerResultObject = new AnthemResultPostedViewModel
                {
                    Tag = corporateAccount.Tag,
                    DestinationFilePath = destinationFolderPdf,
                    ExportToTime        = DateTime.Now.AddHours(-1),
                    CorporateAccount    = corporateAccount,
                };

                var customerResults = GetEventCustomersToPostResult(customerResultObject);

                foreach (var ecr in customerResults)
                {
                    try
                    {
                        customerResultObject.EventCustomerResult = ecr;
                        SetSourcePath(customerResultObject);

                        if (File.Exists(customerResultObject.SourceFilePath))
                        {
                            var ec = _eventCustomerRepository.GetById(ecr.Id);
                            if (ec.AwvVisitId.HasValue)
                            {
                                try
                                {
                                    _logger.Info(" fetching NPI info for VistId :" + ec.AwvVisitId.Value);
                                    var visitDetails = new EhrAssignedNursePractitionerDetails
                                    {
                                        VisitId = ec.AwvVisitId.Value
                                    };

                                    // var model = _medicareApiService.PostAnonymous<EhrAssignedNursePractitionerDetails>(_settings.MedicareApiUrl + MedicareApiUrl.AssignedNursePractitionerDetails, visitDetails);
                                    var npi = string.Empty;
                                    if (!string.IsNullOrWhiteSpace(npi))
                                    {
                                        customerResultObject.Npi = npi;
                                        _logger.Info("NPI: " + npi + " for VistId :" + ec.AwvVisitId.Value);
                                    }
                                    else
                                    {
                                        var mssage = "NPI Is Null or Empty";
                                        mssage = mssage + " for visit id: " + ec.AwvVisitId.Value;
                                        _logger.Info(mssage);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    _logger.Error("exception while fetching NPI information");
                                    _logger.Error("Message: " + ex.Message);
                                    _logger.Error("stack Trace: " + ex.StackTrace);
                                    AddToResultNotPosted(customerResultObject);
                                    continue;
                                }
                            }

                            SetEventCustomerDetail(customerResultObject);

                            SetDestinationFileNameWithoutExt(customerResultObject);

                            PostResultPdf(customerResultObject);
                        }
                        else
                        {
                            AddToResultNotPosted(customerResultObject);
                        }
                    }
                    catch (Exception exception)
                    {
                        _logger.Error(string.Format("some error occurred for the customerId {0}, {1},\n Message {2} \n Stack Trace {3}",
                                                    ecr.CustomerId, ecr.EventId, exception.Message, exception.StackTrace));
                    }
                }

                SaveExportStartTime(customerResultObject);

                CreateResultPostedLoger(corporateAccount);

                SetResultPostedList(corporateAccount.Tag, _resultPdfPostedXml);

                SaveResultNotPosted(corporateAccount.Tag);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("some error occurred for custom tag: {0} Exception Message: \n{1}, \n stack Trace: \n\t {2} ", corporateAccount.Id, ex.Message, ex.StackTrace));
            }
            finally
            {
                _resultPdfPostedXml = null;
                //_anthemPdfCrossWalkVeiwModel = null;
                _resultPdfNotPosted = null;
                _customSettings     = null;
            }
        }