예제 #1
0
        public void GetAppealLetter()
        {
            Mock <IAppealLetterRepository> mockAppealLetterLogic = new Mock <IAppealLetterRepository>();
            AppealLetter result = new AppealLetter();

            mockAppealLetterLogic.Setup(f => f.GetAppealLetter(It.IsAny <AppealLetter>())).Returns(result);
            AppealLetterLogic target = new AppealLetterLogic(mockAppealLetterLogic.Object);

            AppealLetter actual = target.GetAppealLetter(new AppealLetter());

            Assert.AreEqual(result, actual);
        }
예제 #2
0
        /// <summary>
        /// RTFs the preview.
        /// </summary>
        /// <param name="letterTemplateViewModel">The letter template view model.</param>
        /// <param name="reportVirtualPath">The report virtual path.</param>
        /// <returns></returns>
        public static string[] RtfPreview(LetterTemplateViewModel letterTemplateViewModel, string reportVirtualPath)
        {
            AppealLetter letterReportContainer = new AppealLetter
            {
                LetterTemplaterText = letterTemplateViewModel.TemplateText,
                AppealLetterClaims  = new List <AppealLetterClaim>(),
                IsPreview           = true
            };

            //Create default letter data / claim data
            AppealLetterClaim appealLetterClaim = new AppealLetterClaim
            {
                BillDate             = LetterBillDate,
                BillType             = LetterBillType,
                ContractName         = LetterContractName,
                Drg                  = LetterDrg,
                ExpectedAllowed      = LetterExpectedAllowed,
                Ftn                  = LetterFtn,
                MedRecNumber         = LetterMedRecNumber,
                PrimaryGroupNumber   = PrimaryGroupNumber,
                SecondaryGroupNumber = SecondaryGroupNumber,
                TertiaryGroupNumber  = TertiaryGroupNumber,

                PrimaryMemberId   = PrimaryMemberId,
                SecondaryMemberId = SecondaryMemberId,
                TertiaryMemberId  = TertiaryMemberId,

                Npi = LetterNpi,
                PatientAccountNumber  = LetterPatientAccountNumber,
                PatientDob            = LetterPatientDateOfBirth,
                PatientFirstName      = LetterPatientFirstName,
                PatientLastName       = LetterPatientLastName,
                PatientMiddleName     = LetterPatientMiddleName,
                PatientResponsibility = LetterPatientResponsibility,
                PayerName             = LetterPayerName,
                ProviderName          = LetterProviderName,
                RemitCheckDate        = LetterRemitCheckDate,
                RemitPayment          = LetterRemitPayment,
                StatementFrom         = LetterStatementFrom,
                StatementThru         = LetterStatementThru,
                ClaimTotal            = LetterClaimTotal,
                Icn = LetterIcn,
                Los = LetterLos,
                Age = LetterAge
            };

            letterReportContainer.AppealLetterClaims.Add(appealLetterClaim);
            string[] test = GetExportedFileName(letterReportContainer, reportVirtualPath, Constants.AppealLetterPreviewFileBaseName);
            return(test);
        }
예제 #3
0
        /// <summary>
        /// Gets the appeal letter.
        /// </summary>
        /// <param name="appealLetter">The appeal letter container.</param>
        /// <returns></returns>
        public AppealLetter GetAppealLetter(AppealLetter appealLetter)
        {
            //if Start date and end date are mindate than update date criteria as by default 3 years(based on configuration)
            if (appealLetter != null && appealLetter.StartDate == DateTime.MinValue &&
                appealLetter.EndDate == DateTime.MinValue)
            {
                if (!string.IsNullOrEmpty(appealLetter.ClaimSearchCriteria) && appealLetter.ClaimSearchCriteria.Contains(Constants.AdjudicationRequestCriteria))
                {
                    appealLetter.DateType = Constants.DefaultDateType;
                }

                appealLetter.EndDate   = DateTime.Now;
                appealLetter.StartDate =
                    DateTime.Now.AddYears(-GlobalConfigVariable.PullDataForNumberOfYears);
            }
            return(_appealLetterRepository.GetAppealLetter(appealLetter));
        }
예제 #4
0
        /// <summary>
        /// Gets the name of the exported file.
        /// </summary>
        /// <param name="appealLetter">The appeal letter container.</param>
        /// <param name="reportVirtualPath">The report virtual path.</param>
        /// <param name="fileBaseName">Name of the file base.</param>
        /// <returns></returns>
        public static string[] GetExportedFileName(AppealLetter appealLetter, string reportVirtualPath, string fileBaseName)
        {
            string fileName;

            if (appealLetter.ReportThreshold == Constants.ReportThreshold) // Exceeded threshold limit
            {
                fileName = Convert.ToString(Constants.ReportThreshold);
            }
            else if (appealLetter.AppealLetterClaims.Count == 0) //No Records Found
            {
                fileName = Constants.EmptyReportResult;
            }
            else
            {
                _appealLetter = appealLetter;
                string dateTimeStamp = DateTime.Now.ToString(Constants.DateTimeExtendedFormat);
                fileName  = string.Format("{0}{1}.{2}", fileBaseName, dateTimeStamp, Constants.AppealLetterFileExtension);
                _filePath = Path.Combine(reportVirtualPath, fileName);
                //Build rtf document object
                RtfDocument rtfDocument = GetRtfDocument();

                //Get rtf content String
                RtfWriter rtfWriter          = new RtfWriter();
                string    templateRtfContent = rtfWriter.GetRtfContent(rtfDocument);
                //loop through each claim data and replace claim text and merge rtf content
                string finalRtfContent = _appealLetter.AppealLetterClaims.Select(
                    appealLetterClaim => ReplaceClaimData(templateRtfContent, appealLetterClaim))
                                         .Aggregate(string.Empty,
                                                    (current, rtfClaimText) =>
                                                    !string.IsNullOrEmpty(current)
                                ? MergeRtfContent(current, rtfClaimText)
                                : rtfClaimText);

                //Write rtf content into file
                using (TextWriter writer = new StreamWriter(_filePath))
                {
                    rtfWriter.Write(writer, finalRtfContent);
                }
                if (appealLetter.IsPreview)
                {
                    return(new[] { appealLetter.LetterTemplaterText, fileName });
                }
            }
            return(new[] { fileName });
        }
예제 #5
0
        /// <summary>
        /// Generates the appeal letter.
        /// </summary>
        /// <param name="leterTemplateId">The leter template identifier.</param>
        /// <param name="modelId">The model identifier.</param>
        /// <param name="dateType">Type of the date.</param>
        /// <param name="startDate">The start date.</param>
        /// <param name="endDate">The end date.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public ActionResult GenerateAppealLetter(long leterTemplateId, long modelId, int?dateType, DateTime?startDate, DateTime?endDate, string criteria)
        {
            AppealLetter appealLetter = new AppealLetter
            {
                LetterTemplateId    = leterTemplateId,
                NodeId              = modelId,
                DateType            = Convert.ToInt32(dateType),
                StartDate           = Convert.ToDateTime(startDate),
                EndDate             = Convert.ToDateTime(endDate),
                ClaimSearchCriteria = criteria,
                //Added RequestedUserID and RequestedUserName with reference to HIPAA logging feature
                RequestedUserId =
                    string.IsNullOrEmpty(GetLoggedInUserName()) ? Guid.Empty.ToString() : GetUserKey(),
                RequestedUserName = GetLoggedInUserName(),
                MaxNoOfRecords    = GlobalConfigVariable.MaxNoOfDataForLetters
            };

            appealLetter = PostApiResponse <AppealLetter>(Constants.AppealLetter,
                                                          Constants.GetAppealLetter, appealLetter);
            string[] fileName = LetterReportUtil.GetExportedFileName(appealLetter,
                                                                     GlobalConfigVariable.ReportsFilePath, Constants.AppealLetterFileBaseName);
            return(Json(fileName));
        }
 public AppealLetter GetAppealLetter(AppealLetter appealLetter)
 {
     return(_appealLetterLogic.GetAppealLetter(appealLetter));
 }
예제 #7
0
        /// <summary>
        /// Gets the appeal letter.
        /// </summary>
        /// <param name="appealLetter">The appeal letter container.</param>
        /// <returns></returns>
        public AppealLetter GetAppealLetter(AppealLetter appealLetter)
        {
            if (appealLetter != null)
            {
                // Initialize the Stored Procedure
                _databaseCommandObj = _databaseObj.GetStoredProcCommand("GetAppealLetter");
                // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
                _databaseObj.AddInParameter(_databaseCommandObj, "@LetterTemplateID", DbType.Int64, appealLetter.LetterTemplateId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@ModelID", DbType.Int64, appealLetter.NodeId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@DateType", DbType.Int32, appealLetter.DateType);
                _databaseObj.AddInParameter(_databaseCommandObj, "@DateFrom", DbType.DateTime, appealLetter.StartDate);
                _databaseObj.AddInParameter(_databaseCommandObj, "@DateTo", DbType.DateTime, appealLetter.EndDate);
                _databaseObj.AddInParameter(_databaseCommandObj, "@SelectCriteria", DbType.String, appealLetter.ClaimSearchCriteria);
                //Added RequestedUserID and RequestedUserName with reference to HIPAA logging feature
                _databaseObj.AddInParameter(_databaseCommandObj, "@RequestedUserID", DbType.String, appealLetter.RequestedUserId);
                _databaseObj.AddInParameter(_databaseCommandObj, "@RequestedUserName", DbType.String, appealLetter.RequestedUserName);
                _databaseObj.AddInParameter(_databaseCommandObj, "@MaxRecordLimit", DbType.Int32, appealLetter.MaxNoOfRecords);

                // Retrieve the results of the Stored Procedure in Data Set=====================================================================
                DataSet appealLetterDataSet = _databaseObj.ExecuteDataSet(_databaseCommandObj);
                if (appealLetterDataSet.IsTableDataPopulated(0))
                {
                    if (appealLetterDataSet.Tables.Count == 1)
                    {
                        appealLetter.ReportThreshold = -1;
                    }
                    if (appealLetterDataSet.Tables.Count == 2)
                    {
                        //Get letter template text
                        appealLetter.LetterTemplaterText = GetStringValue(appealLetterDataSet.Tables[0].Rows[0]["LetterTemplaterText"]);

                        //Get letter report data (claim data)
                        DataTable dataTableClaimData = appealLetterDataSet.Tables[1];

                        appealLetter.AppealLetterClaims = new List <AppealLetterClaim>();
                        appealLetter.AppealLetterClaims.AddRange(
                            dataTableClaimData.Rows.Cast <object>().Select((t, indexCount) => new AppealLetterClaim
                        {
                            BillDate        = GetValue <DateTime?>(dataTableClaimData.Rows[indexCount]["BillDate"], typeof(DateTime)),
                            BillType        = GetStringValue(dataTableClaimData.Rows[indexCount]["BillType"]),
                            ClaimId         = GetValue <long>(dataTableClaimData.Rows[indexCount]["ClaimID"], typeof(long)),
                            ContractName    = GetStringValue(dataTableClaimData.Rows[indexCount]["ContractName"]),
                            Drg             = GetStringValue(dataTableClaimData.Rows[indexCount]["DRG"]),
                            ExpectedAllowed = DBNull.Value == dataTableClaimData.Rows[indexCount]["ExpectedAllowed"]
                                        ? (double?)null
                                        : Math.Round(
                                double.Parse(
                                    dataTableClaimData.Rows[indexCount]["ExpectedAllowed"].ToString()), 2),
                            Ftn = GetStringValue(dataTableClaimData.Rows[indexCount]["FTN"]),

                            PrimaryGroupNumber   = GetStringValue(dataTableClaimData.Rows[indexCount]["PrimaryGroupNumber"]),
                            SecondaryGroupNumber = GetStringValue(dataTableClaimData.Rows[indexCount]["SecondaryGroupNumber"]),
                            TertiaryGroupNumber  = GetStringValue(dataTableClaimData.Rows[indexCount]["TertiaryGroupNumber"]),

                            PrimaryMemberId   = GetStringValue(dataTableClaimData.Rows[indexCount]["PrimaryMemberID"]),
                            SecondaryMemberId = GetStringValue(dataTableClaimData.Rows[indexCount]["SecondaryMemberID"]),
                            TertiaryMemberId  = GetStringValue(dataTableClaimData.Rows[indexCount]["TertiaryMemberID"]),
                            Npi                   = GetStringValue(dataTableClaimData.Rows[indexCount]["NPI"]),
                            MedRecNumber          = GetStringValue(dataTableClaimData.Rows[indexCount]["MedRecNumber"]),
                            Icn                   = GetStringValue(dataTableClaimData.Rows[indexCount]["ICN"]),
                            PatientAccountNumber  = GetStringValue(dataTableClaimData.Rows[indexCount]["PatientAccountNumber"]),
                            PatientDob            = GetValue <DateTime?>(dataTableClaimData.Rows[indexCount]["PatientDOB"], typeof(DateTime)),
                            PatientFirstName      = GetStringValue(dataTableClaimData.Rows[indexCount]["PatientFirstName"]),
                            PatientLastName       = GetStringValue(dataTableClaimData.Rows[indexCount]["PatientLastName"]),
                            PatientMiddleName     = GetStringValue(dataTableClaimData.Rows[indexCount]["PatientMiddle"]),
                            PatientResponsibility = DBNull.Value == dataTableClaimData.Rows[indexCount]["PatientResponsibility"]
                                       ? (double?)null
                                       : Math.Round(
                                double.Parse(
                                    dataTableClaimData.Rows[indexCount]["PatientResponsibility"].ToString()), 2),
                            PayerName      = GetStringValue(dataTableClaimData.Rows[indexCount]["PriPayerName"]),
                            ProviderName   = GetStringValue(dataTableClaimData.Rows[indexCount]["ProviderName"]),
                            RemitCheckDate = GetValue <DateTime?>(dataTableClaimData.Rows[indexCount]["RemitCheckDate"], typeof(DateTime)),
                            RemitPayment   = DBNull.Value == dataTableClaimData.Rows[indexCount]["RemitPayment"]
                                       ? (double?)null
                                       : Math.Round(
                                double.Parse(
                                    dataTableClaimData.Rows[indexCount]["RemitPayment"].ToString()), 2),
                            StatementFrom = GetValue <DateTime>(dataTableClaimData.Rows[indexCount]["StatementFrom"], typeof(DateTime)),
                            StatementThru = GetValue <DateTime>(dataTableClaimData.Rows[indexCount]["StatementThru"], typeof(DateTime)),
                            Los           = GetValue <int>(dataTableClaimData.Rows[indexCount]["Los"], typeof(int)),
                            Age           = GetValue <byte>(dataTableClaimData.Rows[indexCount]["Age"], typeof(byte)),
                            ClaimTotal    =
                                DBNull.Value == dataTableClaimData.Rows[indexCount]["ClaimTotal"]
                                        ? (double?)null
                                        : Math.Round(
                                    double.Parse(
                                        dataTableClaimData.Rows[indexCount]["ClaimTotal"].ToString()), 2)
                        }));
                    }
                }
            }
            return(appealLetter);
        }