public void GetPropertyValueForPhysicianTest() { // Arrange _target = new ConditionLogic(); EvaluateableClaim evaluateableClaim = new EvaluateableClaim { ClaimId = 123, BillType = "123", Physicians = new List <Physician> { new Physician { FirstName = "Raul", MiddleName = "M", LastName = "Bush", PhysicianType = "Referring" } } }; //Act List <string> actual = _target.GetPropertyValues(evaluateableClaim, Constants.PropertyReferringPhysician); // Assert Assert.AreEqual("RaulMBush", actual[0]); }
public void GetChildPropertyValuesTest() { // Arrange _target = new ConditionLogic(); EvaluateableClaim evaluateableClaim = new EvaluateableClaim { ClaimId = 123, BillType = "123", ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, RevCode = "250" }, new ClaimCharge { Line = 2, RevCode = "251" } } }; //Act List <string> actual = _target.GetPropertyValues(evaluateableClaim, Constants.PropertyRevCode); // Assert Assert.AreEqual(2, actual.Count); Assert.AreEqual("250", actual[0]); Assert.AreEqual("251", actual[1]); }
public void IsPaymentTypeConditionWithPaymentTypeNullTest() { // Arrange _mockPaymentTypeFeeScheduleRepository = new Mock <IPaymentTypeFeeScheduleRepository>(); _target = new PaymentTypeFeeScheduleLogic(_mockPaymentTypeFeeScheduleRepository.Object); IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250", HcpcsCode = "12545" } }; //Act bool actual = _target.IsPaymentTypeConditions(null, evaluateableClaim); // Assert Assert.AreEqual(false, actual); }
public void IsMatchInValidDataTest() { // Arrange _target = new ContractBaseLogic(); _mockConditionLogic = new Mock <IConditionLogic>(); List <string> leftOperand = new List <string> { "121" }; _mockConditionLogic.Setup(x => x.GetPropertyValues(null, Constants.PropertyBillType)).Returns(leftOperand); _mockConditionLogic.Setup(x => x.IsMatch()).Returns(false); _mockConditionLogic.SetupAllProperties(); EvaluateableClaim evaluateableClaim = new EvaluateableClaim { ClaimId = 123, BillType = "121" }; List <ICondition> conditions = new List <ICondition> { new Condition { ConditionOperator = (byte)Enums.ConditionOperation.EqualTo, RightOperand = "131", OperandIdentifier = (byte)Enums.OperandIdentifier.BillType, OperandType = (byte)Enums.OperandType.Numeric, PropertyColumnName = Constants.PropertyBillType } }; //Act bool actual = _target.IsConditionsValid(conditions, evaluateableClaim); // Assert Assert.AreEqual(false, actual); }
/// <summary> /// Gets all record. /// </summary> /// <param name="evaluateableClaim">The evaluateable claim.</param> private static void GetAllRecord(EvaluateableClaim evaluateableClaim) { DiagnosisCode principalDiagnosisCode = evaluateableClaim.DiagnosisCodes.FirstOrDefault(q => PrincipalDiagnosisCodes.Contains(q.Instance)); if (evaluateableClaim.StatementThru >= DateTime.Parse(Constants.IcdVersionDate, CultureInfo.InvariantCulture)) { //Getting ERecord Data evaluateableClaim.MicrodynApcEditInput.ERecord = new ERecord { ClaimId = Convert.ToString(evaluateableClaim.ClaimId, CultureInfo.InvariantCulture), PrincipalDiagnosisCode = principalDiagnosisCode != null ? principalDiagnosisCode.IcddCode : string.Empty, AdmitDiagnosisCode = principalDiagnosisCode != null ? principalDiagnosisCode.IcddCode : string.Empty, SecondaryDiagnosisCodes = evaluateableClaim.DiagnosisCodes.Where(q => !PrincipalDiagnosisCodes.Contains(q.Instance)).Select(q => q.IcddCode).ToList() }; } else { //Getting DRecord Data evaluateableClaim.MicrodynApcEditInput.DRecord = new DRecord { ClaimId = Convert.ToString(evaluateableClaim.ClaimId, CultureInfo.InvariantCulture), PrincipalDiagnosisCode = principalDiagnosisCode != null ? principalDiagnosisCode.IcddCode : string.Empty, AdmitDiagnosisCode = principalDiagnosisCode != null ? principalDiagnosisCode.IcddCode : string.Empty, SecondaryDiagnosisCodes = evaluateableClaim.DiagnosisCodes.Where(q => !PrincipalDiagnosisCodes.Contains(q.Instance)).Select(q => q.IcddCode).ToList() }; } //Getting LRecord Data GetLRecord(evaluateableClaim); }
public List <PaymentResult> GetPaymentResults(EvaluateableClaim claim) { List <PaymentResult> paymentResults = new List <PaymentResult>(); if (claim != null) { //Initialize claim level payment result. paymentResults.Add(new PaymentResult { ClaimId = claim.ClaimId, ClaimTotalCharges = claim.ClaimTotal, IsClaimChargeData = false, ClaimStatus = (byte)Enums.AdjudicationOrVarianceStatuses.UnAdjudicated }); //Initialize claim line level payment result. paymentResults.AddRange(claim.ClaimCharges.Select(claimCharge => new PaymentResult { ClaimId = claim.ClaimId, ClaimTotalCharges = claimCharge.Amount, IsClaimChargeData = true, Line = claimCharge.Line, IsInitialEntry = true, ClaimStatus = (byte)Enums.AdjudicationOrVarianceStatuses.UnAdjudicated, ServiceLineCode = claimCharge.HcpcsCodeWithModifier })); } return(paymentResults); }
public void UpdateClaimStatusIfAdjudicatedValueIsNotNull() { _mockPaymentResultLogic = new Mock <IPaymentResultRepository>(); var paymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, ContractId = 101, AdjudicatedValue = 100 }, new PaymentResult { ClaimId = 123, ContractId = 101, ServiceTypeId = 10, AdjudicatedValue = 100 } }; var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>(); var mockPaymentResultLogic = new Mock <IPaymentResultLogic>(); mockPaymentResultLogic.Setup( x => x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(paymentResults); _target = new PaymentResultLogic(_mockPaymentResultLogic.Object); IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250" } }; var updatedPaymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, AdjudicatedValue = 100, ContractId = 101, ServiceTypeId = 10 }, new PaymentResult { ClaimId = 123, ContractId = 101 } }; var mockContractBaseLogic = new Mock <ContractBaseLogic>(); mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false)) .Returns(updatedPaymentResults); mockContractBaseLogic.SetupAllProperties(); //Act List <PaymentResult> actual = _target.Evaluate(evaluateableClaim, paymentResults, false, false); // Assert var firstOrDefault = actual.FirstOrDefault(q => q.ClaimStatus == 3); if (firstOrDefault != null) { Assert.AreEqual(3, firstOrDefault.ClaimStatus); } }
public void EvaluateIfClaimHasNoPayerTest() { // Arrange _target = new EvaluateableClaimLogic(); IEvaluateableClaim claim = new EvaluateableClaim(); claim.ClaimId = 123; List <PaymentResult> paymentResults = new List <PaymentResult>(); PaymentResult paymentResult = new PaymentResult { ClaimId = 123 }; paymentResults.Add(paymentResult); PaymentResult paymentResultForLine = new PaymentResult { ClaimId = 123, Line = 1 }; paymentResults.Add(paymentResultForLine); //Act List <PaymentResult> actual = _target.Evaluate(claim, paymentResults, false, false); // Assert PaymentResult overAllClaimPaymentResult = actual.FirstOrDefault( payment => payment.Line == null && payment.ServiceTypeId == null); if (overAllClaimPaymentResult != null) { Assert.AreEqual(overAllClaimPaymentResult.ClaimStatus, (byte)Enums.AdjudicationOrVarianceStatuses.ClaimDataError); } }
/// <summary> /// Generates the model compassion report. /// </summary> /// <param name="modelComparisonForPost">The model comparison for post.</param> /// <returns></returns> public ModelComparisonReport Generate(ModelComparisonReport modelComparisonForPost) { ModelComparisonReport modelComparisonReportData = new ModelComparisonReport(); // Initialize the Stored Procedure _databaseCommandObj = _databaseObj.GetStoredProcCommand("GetModelComparisonReport"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _databaseObj.AddInParameter(_databaseCommandObj, "@SelectedModels ", DbType.String, modelComparisonForPost.SelectedModelList); _databaseObj.AddInParameter(_databaseCommandObj, "@IsDetailedView ", DbType.Int32, modelComparisonForPost.IsCheckedDetailLevel); _databaseObj.AddInParameter(_databaseCommandObj, "@DetailedViewAt ", DbType.Int32, modelComparisonForPost.DetailSelectValue); _databaseObj.AddInParameter(_databaseCommandObj, "@FacilityId ", DbType.Int32, modelComparisonForPost.FacilityId); _databaseObj.AddInParameter(_databaseCommandObj, "@DateType", DbType.Int32, modelComparisonForPost.DateType); _databaseObj.AddInParameter(_databaseCommandObj, "@DateFrom", DbType.DateTime, modelComparisonForPost.StartDate); _databaseObj.AddInParameter(_databaseCommandObj, "@DateTo", DbType.DateTime, modelComparisonForPost.EndDate); _databaseObj.AddInParameter(_databaseCommandObj, "@SelectCriteria", DbType.String, modelComparisonForPost.ClaimSearchCriteria); _databaseObj.AddInParameter(_databaseCommandObj, "@RequestedUserID", DbType.String, modelComparisonForPost.RequestedUserId); _databaseObj.AddInParameter(_databaseCommandObj, "@RequestedUserName", DbType.String, modelComparisonForPost.RequestedUserName); // Retrieve the results of the Stored Procedure in Data table _databaseCommandObj.CommandTimeout = 1000; DataSet modelComparisonDataSet = _databaseObj.ExecuteDataSet(_databaseCommandObj); if (modelComparisonDataSet.IsTableDataPopulated()) { List <ModelComparisonReportDetails> modelComparisonReportList = new List <ModelComparisonReportDetails>(); DataRowCollection modelComparisonRowCollection = modelComparisonDataSet.Tables[0].Rows; for (int indexCount = 0; indexCount < modelComparisonRowCollection.Count; indexCount++) { ModelComparisonReportDetails modelComparisonReportDetails = new ModelComparisonReportDetails(); DataRow modelComparisonRow = modelComparisonRowCollection[indexCount]; EvaluateableClaim claimData = new EvaluateableClaim { NodeText = DBNull.Value == modelComparisonRow["ModelName"] ? string.Empty : modelComparisonRow["ModelName"].ToString(), ModelId = DBNull.Value == modelComparisonRow["ModelId"] ? (int?)null : Convert.ToInt32(modelComparisonRow["ModelId"]), ClaimTotal = DBNull.Value == modelComparisonRow["ClaimTotalCharges"] ? (double?)null : Convert.ToDouble(modelComparisonRow["ClaimTotalCharges"]), AdjudicatedValue = DBNull.Value == modelComparisonRow["AdjudicatedValue"] ? (double?)null : Convert.ToDouble(modelComparisonRow["AdjudicatedValue"]), CalculatedAdjustment = DBNull.Value == modelComparisonRow["CalculatedAdjudtment"] ? (double?)null : Convert.ToDouble(modelComparisonRow["CalculatedAdjudtment"]), ActualPayment = DBNull.Value == modelComparisonRow["ActualPayment"] ? (double?)null : Convert.ToDouble(modelComparisonRow["ActualPayment"]), ActualAdjustment = DBNull.Value == modelComparisonRow["ActualAdjustment"] ? (double?)null : Convert.ToDouble(modelComparisonRow["ActualAdjustment"]), PatientResponsibility = DBNull.Value == modelComparisonRow["PatientResponsibility"] ? (double?)null : Convert.ToDouble(modelComparisonRow["PatientResponsibility"]), RemitAllowedAmt = DBNull.Value == modelComparisonRow["RemitAllowed"] ? (double?)null : Convert.ToDouble(modelComparisonRow["RemitAllowed"]), RemitNonCovered = DBNull.Value == modelComparisonRow["RemitNonCovered"] ? (double?)null : Convert.ToDouble(modelComparisonRow["RemitNonCovered"]), RemitContrAdj = DBNull.Value == modelComparisonRow["RemitNonCovered"] ? (double?)null : Convert.ToDouble(modelComparisonRow["RemitNonCovered"]), ContractualVariance = DBNull.Value == modelComparisonRow["ContractualVariance"] ? (double?)null : Convert.ToDouble(modelComparisonRow["ContractualVariance"]), PaymentVariance = DBNull.Value == modelComparisonRow["PaymentVariance"] ? (double?)null : Convert.ToDouble(modelComparisonRow["PaymentVariance"]), DetailedSelection = DBNull.Value == modelComparisonRow["DetailedSelection"] ? string.Empty : modelComparisonRow["DetailedSelection"].ToString() }; modelComparisonReportDetails.ClaimData = claimData; modelComparisonReportDetails.Count = DBNull.Value == modelComparisonRow["ClaimCount"] ? string.Empty : modelComparisonRow["ClaimCount"].ToString(); modelComparisonReportList.Add(modelComparisonReportDetails); } modelComparisonReportData.ModelComparisonData = modelComparisonReportList; } return(modelComparisonReportData); }
/// <summary> /// Gets the smart box. /// </summary> /// <param name="evaluateableClaim">The evaluateable claim.</param> /// <returns></returns> private static SmartBox GetSmartBox(EvaluateableClaim evaluateableClaim) { return(new SmartBox { LOS = evaluateableClaim.Los, TCC = evaluateableClaim.ClaimTotal }); }
public void UpdateAdjudicatedAmountIfPaymentResultNull() { _mockPaymentResultLogic = new Mock <IPaymentResultRepository>(); var paymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, Line = 1, ServiceTypeId = 10 }, new PaymentResult { ClaimId = 123, Line = 1, ServiceTypeId = 5 } }; var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>(); var mockPaymentResultLogic = new Mock <IPaymentResultLogic>(); mockPaymentResultLogic.Setup( x => x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(paymentResults); _target = new PaymentResultLogic(_mockPaymentResultLogic.Object); IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250" } }; var updatedPaymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, Line = 1, ServiceTypeId = 10 }, new PaymentResult { ClaimId = 123, Line = 1, ServiceTypeId = 5 } }; var mockContractBaseLogic = new Mock <ContractBaseLogic>(); mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false)) .Returns(updatedPaymentResults); mockContractBaseLogic.SetupAllProperties(); //Act List <PaymentResult> actual = _target.Evaluate(evaluateableClaim, paymentResults, false, false); // Assert Assert.AreEqual(true, actual.TrueForAll(q => q.AdjudicatedValue == null)); }
public void EvaluateIfLineIsNullTest() { _mockPaymentResultLogic = new Mock <IPaymentResultRepository>(); var paymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, ServiceTypeId = 1 }, new PaymentResult { ClaimId = 123, ServiceTypeId = 1 } }; var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>(); var mockPaymentResultLogic = new Mock <IPaymentResultLogic>(); mockPaymentResultLogic.Setup( x => x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(paymentResults); _target = new PaymentResultLogic(_mockPaymentResultLogic.Object); IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250" } }; var updatedPaymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, Line = 1 }, new PaymentResult { ClaimId = 123 } }; var mockContractBaseLogic = new Mock <ContractBaseLogic>(); mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false)) .Returns(updatedPaymentResults); mockContractBaseLogic.SetupAllProperties(); //Act List <PaymentResult> actual = _target.Evaluate(evaluateableClaim, paymentResults, false, false); // Assert Assert.AreEqual(updatedPaymentResults.Any(q => q.ClaimId != 0), actual.Any(q => q.ClaimId != 0)); }
public void EvaluateWithAdjudicatedLineTest() { // Arrange _mockPaymentTypeFeeScheduleRepository = new Mock <IPaymentTypeFeeScheduleRepository>(); _target = new PaymentTypeFeeScheduleLogic(_mockPaymentTypeFeeScheduleRepository.Object); var paymentType = new PaymentTypeFeeSchedule { ValidLineIds = new List <int> { 1 }, NonFeeSchedule = 50, ServiceTypeId = 12, ClaimFieldDoc = new ClaimFieldDoc { ClaimFieldDocId = 12, ClaimFieldValues = new List <ClaimFieldValue> { new ClaimFieldValue { Identifier = "J2123", Value = "50" } } }, Conditions = new List <ICondition>() }; _target.PaymentTypeBase = paymentType; IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, HcpcsCode = "12500", HcpcsCodeWithModifier = "12500" } }; var paymentResults = new List <PaymentResult> { new PaymentResult { Line = 1, AdjudicatedValue = 10, ServiceTypeId = 12 } }; //Act List <PaymentResult> actual = _target.Evaluate(evaluateableClaim, paymentResults, true, false); // Assert Assert.AreEqual(paymentResults.Count, actual.Count); }
public void GetPropertyValuesTest() { // Arrange _target = new ConditionLogic(); EvaluateableClaim evaluateableClaim = new EvaluateableClaim { ClaimId = 123, BillType = "123" }; //Act List <string> actual = _target.GetPropertyValues(evaluateableClaim, Constants.PropertyBillType); // Assert Assert.AreEqual("123", actual[0]); }
/// <summary> /// Checks the payer condition. /// </summary> /// <param name="contract">The contract.</param> /// <param name="claim">The claim.</param> private static void CheckPayerCondition(Contract contract, EvaluateableClaim claim) { if (contract.Payers.Count != 0 && (!string.IsNullOrEmpty(claim.PriPayerName))) { ICondition conditionPayer = new Condition(); conditionPayer.PropertyColumnName = Constants.PropertyPriPayerName; conditionPayer.RightOperand = string.Join(";", contract.Payers.Select(payer => payer.PayerName).ToList()); conditionPayer.OperandIdentifier = (byte)Enums.OperandIdentifier.PayerName; conditionPayer.OperandType = (byte)Enums.OperandType.AlphaNumeric; conditionPayer.ConditionOperator = (byte)Enums.ConditionOperation.EqualTo; contract.Conditions.Add(conditionPayer); } }
public void GetPropertyValueForStatementCoverPeriodTest() { // Arrange _target = new ConditionLogic(); EvaluateableClaim evaluateableClaim = new EvaluateableClaim { ClaimId = 123, BillType = "123", StatementFrom = DateTime.Now, StatementThru = DateTime.Now.AddDays(1) }; //Act List <string> actual = _target.GetPropertyValues(evaluateableClaim, Constants.PropertyStatementCoversPeriod); // Assert Assert.AreEqual(2, actual.Count); }
/// <summary> /// Gets the statement cover period. /// </summary> /// <param name="currentObject">The current object.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="values">The values.</param> /// <returns></returns> private static bool GetStatementCoverPeriod(object currentObject, string propertyName, ref List <string> values) { if (!string.IsNullOrEmpty(propertyName) && propertyName.Equals(Constants.PropertyStatementCoversPeriod)) { EvaluateableClaim evaluateableClaim = currentObject as EvaluateableClaim; if (evaluateableClaim != null) { values.Add(evaluateableClaim.StatementFrom.ToString()); values.Add(evaluateableClaim.StatementThru.ToString()); return(true); } } return(false); }
public void IsPaymentTypeConditionWithInvalidDataTest() { // Arrange _mockPaymentTypeFeeScheduleRepository = new Mock <IPaymentTypeFeeScheduleRepository>(); _target = new PaymentTypeFeeScheduleLogic(_mockPaymentTypeFeeScheduleRepository.Object); var paymentType = new PaymentTypeFeeSchedule { ValidLineIds = new List <int> { 1 }, NonFeeSchedule = 50, Conditions = new List <ICondition> { new Condition { ConditionOperator = (byte)Enums.ConditionOperation.EqualTo, RightOperand = "K2250", OperandIdentifier = (byte)Enums.OperandIdentifier.HcpcsCode, OperandType = (byte)Enums.OperandType.AlphaNumeric, PropertyColumnName = Constants.PropertyHcpcsCode, LeftOperands = new List <string> { "J2250", "12350" } } } }; IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250", HcpcsCode = "12545", HcpcsCodeWithModifier = "12545" } }; //Act bool actual = _target.IsPaymentTypeConditions(paymentType, evaluateableClaim); // Assert Assert.AreEqual(false, actual); }
public void IsMatchTest() { // Arrange _mockPaymentTypeFeeScheduleRepository = new Mock <IPaymentTypeFeeScheduleRepository>(); _target = new PaymentTypeFeeScheduleLogic(_mockPaymentTypeFeeScheduleRepository.Object); var paymentType = new PaymentTypeFeeSchedule { ValidLineIds = new List <int> { 1 }, NonFeeSchedule = 50, Conditions = new List <ICondition> { new Condition { ConditionOperator = (byte)Enums.ConditionOperation.EqualTo, RightOperand = "250", OperandIdentifier = (byte)Enums.OperandIdentifier.RevCode, OperandType = (byte)Enums.OperandType.Numeric, PropertyColumnName = Constants.PropertyRevCode, LeftOperands = new List <string> { "250", "350" } } } }; _target.PaymentTypeBase = paymentType; IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250" } }; //Act bool actual = _target.IsMatch(evaluateableClaim); // Assert Assert.AreEqual(true, actual); }
/// <summary> /// Gets the c record. /// </summary> /// <param name="evaluateableClaim">The evaluateable claim.</param> private static void GetCRecord(EvaluateableClaim evaluateableClaim) { evaluateableClaim.MicrodynApcEditInput.CRecord = new CRecord { ClaimId = Convert.ToString(evaluateableClaim.ClaimId, CultureInfo.InvariantCulture), FromDate = Convert.ToDateTime(evaluateableClaim.StatementFrom, CultureInfo.InvariantCulture), ThruDate = Convert.ToDateTime(evaluateableClaim.StatementThru, CultureInfo.InvariantCulture), ConditionCodes = evaluateableClaim.ConditionCodes != null?evaluateableClaim.ConditionCodes.Select(q => q.Code).ToList() : null, OccurrenceCodes = evaluateableClaim.OccurrenceCodes != null?evaluateableClaim.OccurrenceCodes.Select(q => q.Code).ToList() : null, BillType = Convert.ToString(evaluateableClaim.BillType, CultureInfo.InvariantCulture), Npi = Convert.ToString(evaluateableClaim.Npi, CultureInfo.InvariantCulture), OppsFlag = OppFlag, // Hard coded 1 BeneAmount = BeneAmount, // Hard coded 0.0 BloodPint = BloodPint, // Hard coded 1, PatientData = evaluateableClaim.PatientData }; }
GetRtaDataByClaim(EvaluateableClaim evaluateableClaim) { RtaData rtaData = new RtaData { EvaluateableClaim = evaluateableClaim, Contracts = new List <Contract>() }; if (evaluateableClaim != null) { // Initialize the Stored Procedure _databaseCommandObj = _databaseObj.GetStoredProcCommand("RTA_GetDataByClaim"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _databaseObj.AddInParameter(_databaseCommandObj, "@SsiNumber", DbType.Int32, evaluateableClaim.Ssinumber); _databaseObj.AddInParameter(_databaseCommandObj, "@Hcpcs", DbType.String, string.Join(",", evaluateableClaim.ClaimCharges.Select(q => q.HcpcsCode))); _databaseObj.AddInParameter(_databaseCommandObj, "@ZipCode", DbType.String, evaluateableClaim.ProviderZip); _databaseObj.AddInParameter(_databaseCommandObj, "@StatementFrom", DbType.DateTime, evaluateableClaim.StatementFrom); _databaseObj.AddInParameter(_databaseCommandObj, "@StatementThru", DbType.DateTime, evaluateableClaim.StatementThru); _databaseObj.AddInParameter(_databaseCommandObj, "@PayerName", DbType.String, evaluateableClaim.PriPayerName); _databaseObj.AddInParameter(_databaseCommandObj, "@IsInstitutional", DbType.Boolean, evaluateableClaim.ClaimType.ToLower().Contains(Constants.ClaimTypeInstitutionalContract)); // Retrieve the results of the Stored Procedure in Data table DataSet dataSet = _databaseObj.ExecuteDataSet(_databaseCommandObj); if (dataSet.Tables.Count > 0) { rtaData.FacilityId = dataSet.Tables[0].Rows[0]["FacilityID"] == DBNull.Value ? (long?)null : Convert.ToInt64(dataSet.Tables[0].Rows[0]["FacilityID"]); if (rtaData.FacilityId != null) { rtaData.EvaluateableClaim.MedicareLabFeeSchedules = GetMedicareLabFeeSchedules(dataSet); //Remove RTA related Tables from dataSet and than pass dataSet to CMS logic to build List<Contract> dataSet.Tables.RemoveAt(MedicareTablePosition); //Remove Medicare Lab Fee Schedule Table dataSet.Tables.RemoveAt(FacilityTablePosition); //Remove Facility Table DataTable contractBasicInfo = dataSet.Tables[0]; dataSet.Tables.RemoveAt(ContractBasicInfoTablePosition); //Remove Contract Basic Info Table. rtaData.Contracts = ContractRepository.GetContracts(dataSet); rtaData.Contracts.AddRange(ContractRepository.GetContracts(contractBasicInfo)); } } } return(rtaData); }
public void IsMatchTest() { // Arrange _target = new EvaluateableClaimLogic(); IEvaluateableClaim claim = new EvaluateableClaim(); Exception expectedExcetpion = null; // Act try { _target.IsMatch(claim); } catch (Exception ex) { expectedExcetpion = ex; } // Assert Assert.IsNotNull(expectedExcetpion); }
/// <summary> /// Gets the l record. /// </summary> /// <param name="evaluateableClaim">The evaluateable claim.</param> private static void GetLRecord(EvaluateableClaim evaluateableClaim) { evaluateableClaim.MicrodynApcEditInput.LRecords = new List <LRecord>(); foreach (ClaimCharge claimcharge in evaluateableClaim.ClaimCharges) { LRecord lRecord = new LRecord { ClaimId = Convert.ToString(evaluateableClaim.ClaimId, CultureInfo.InvariantCulture), LineItemId = claimcharge.Line, HcpcsProcedureCode = claimcharge.HcpcsCode, ServiceDate = Convert.ToDateTime(claimcharge.ServiceFromDate), RevenueCode = Convert.ToString(claimcharge.RevCode, CultureInfo.InvariantCulture), UnitsofService = claimcharge.Units == null ? (int?)null : Convert.ToInt32(claimcharge.Units, CultureInfo.InvariantCulture), LineItemCharge = claimcharge.Amount == null ? (double?)null : Convert.ToDouble(claimcharge.Amount, CultureInfo.InvariantCulture), LineItemFlag = LineItemFlag, // Hardcoded 0 HcpcsModifiers = claimcharge.HcpcsModifiers }; evaluateableClaim.MicrodynApcEditInput.LRecords.Add(lRecord); } }
public void GetPaymentResultsIfClaimNotNull() { _mockPaymentResultLogic = new Mock <IPaymentResultRepository>(); var paymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, AdjudicatedValue = 100, ContractId = 101 }, new PaymentResult { ClaimId = 123, ContractId = 101 } }; var mockPaymentResultLogic = new Mock <IPaymentResultLogic>(); mockPaymentResultLogic.Setup( x => x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(paymentResults); _target = new PaymentResultLogic(_mockPaymentResultLogic.Object); var evaluateableClaim = new EvaluateableClaim { ClaimId = 123, ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250" } } }; //Act List <PaymentResult> actual = _target.GetPaymentResults(evaluateableClaim); // Assert Assert.AreEqual(evaluateableClaim.ClaimCharges[0].Amount, actual[1].ClaimTotalCharges); }
public void GenerateModelComparisonReportTest() { var mockModelComparisonReportRepository = new Mock <IModelComparisonReportRepository>(); ModelComparisonReport value = new ModelComparisonReport { FacilityId = 1, SelectedModelList = "287103,11672", DetailSelectValue = 1, StartDate = DateTime.MinValue, EndDate = DateTime.MinValue, ClaimSearchCriteria = "-99|2|Test" }; EvaluateableClaim claimData = new EvaluateableClaim { NodeText = "Testing", ModelId = 123 }; List <ModelComparisonReportDetails> modelComparisonReportDetailsList = new List <ModelComparisonReportDetails> { new ModelComparisonReportDetails { ClaimData = claimData } }; ModelComparisonReport result = new ModelComparisonReport { ModelComparisonData = modelComparisonReportDetailsList }; mockModelComparisonReportRepository.Setup( f => f.Generate(It.IsAny <ModelComparisonReport>())).Returns(result); ModelComparisonReportLogic target = new ModelComparisonReportLogic(mockModelComparisonReportRepository.Object); ModelComparisonReport actual = target.Generate(value); Assert.AreEqual(actual, result); }
public void EvaluateIfClaimHasNoLineTest() { // Arrange _target = new EvaluateableClaimLogic(); IEvaluateableClaim claim = new EvaluateableClaim(); claim.ClaimId = 123; claim.PriPayerName = "Blue Cross"; claim.BillType = "141"; claim.ClaimState = "Billed"; claim.ClaimType = "hosp"; claim.StatementFrom = DateTime.Now; claim.StatementThru = DateTime.Now; claim.ClaimTotal = 200; List <PaymentResult> paymentResults = new List <PaymentResult>(); PaymentResult paymentResult = new PaymentResult { ClaimId = 123 }; paymentResults.Add(paymentResult); PaymentResult paymentResultForLine = new PaymentResult { ClaimId = 123, Line = 1 }; paymentResults.Add(paymentResultForLine); // Act List <PaymentResult> actual = _target.Evaluate(claim, paymentResults, false, false); // Assert PaymentResult overAllClaimPaymentResult = actual.FirstOrDefault( payment => payment.Line == null && payment.ServiceTypeId == null); if (overAllClaimPaymentResult != null) { Assert.AreEqual(overAllClaimPaymentResult.ClaimStatus, (byte)Enums.AdjudicationOrVarianceStatuses.AdjudicationErrorMissingServiceLine); } }
/// <summary> /// Gets the physician data. /// </summary> /// <param name="currentObject">The current object.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="values">The values.</param> /// <returns></returns> private static bool GetPhysicianData(object currentObject, string propertyName, ref List <string> values) { if (!string.IsNullOrEmpty(propertyName) && (propertyName.Equals(Constants.PropertyReferringPhysician) || propertyName.Equals(Constants.PropertyRenderingPhysician) || propertyName.Equals(Constants.PropertyAttendingPhysician))) { EvaluateableClaim evaluateableClaim = currentObject as EvaluateableClaim; if (evaluateableClaim != null && evaluateableClaim.Physicians != null && evaluateableClaim.Physicians.Any(a => a.PhysicianType == propertyName)) { values.AddRange( evaluateableClaim.Physicians.Where(a => a.PhysicianType == propertyName). Select( a => string.IsNullOrEmpty(a.MiddleName) ? (a.FirstName + " " + a.LastName).Trim().Replace(" ", "") : (a.FirstName + " " + a.MiddleName + " " + a.LastName).Trim ().Replace(" ", "")).ToList()); } return(true); } return(false); }
public void EvaluateAtClaimLevelTest() { List <PaymentResult> paymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, Line = 1, AdjudicatedValue = null }, new PaymentResult { ClaimId = 123, Line = 2, AdjudicatedValue = null }, }; PaymentTypePerVisit paymentTypePerVisit = new PaymentTypePerVisit { Rate = 10, PayAtClaimLevel = true, ValidLineIds = new List <int> { 1, 2, 3, 4, 5, 6 }, Conditions = new List <ICondition> { new Condition { ConditionOperator = (byte)Enums.ConditionOperation.EqualTo, LeftOperands = new List <string> { "300" }, OperandType = (byte)Enums.OperandIdentifier.HcpcsCode, RightOperand = "300" } }, ContractId = 1, HcpcsCode = "300", }; // Arrange var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>(); var mockPaymentResultLogic = new Mock <IPaymentResultLogic>(); mockPaymentResultLogic.Setup( x => x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(paymentResults); Mock <IPaymentTypePerVisitRepository> paymentTypePerVisitRepository = new Mock <IPaymentTypePerVisitRepository>(); paymentTypePerVisitRepository.Setup(x => x.GetPaymentTypePerVisitDetails(It.IsAny <PaymentTypePerVisit>())) .Returns(paymentTypePerVisit); var target = new PaymentTypePerVisitLogic(paymentTypePerVisitRepository.Object) { PaymentTypeBase = paymentTypePerVisit }; // _target.Contract = contract; IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimTotal = 100; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, HcpcsCode = "300" }, new ClaimCharge { Line = 2, Amount = 20, HcpcsCode = "301" }, new ClaimCharge { Line = 3, Amount = 20, HcpcsCode = "302" }, new ClaimCharge { Line = 4, Amount = 20, HcpcsCode = "303" }, new ClaimCharge { Line = 5, Amount = 20, HcpcsCode = "304" }, new ClaimCharge { Line = 6, Amount = 20, HcpcsCode = "305" } }; List <PaymentResult> updatedPaymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, ContractId = 1, AdjudicatedValue = 110 }, new PaymentResult { ClaimId = 123, Line = 1, ContractId = 1, AdjudicatedValue = 110 } }; Mock <ContractBaseLogic> mockContractBaseLogic = new Mock <ContractBaseLogic>(); mockContractServiceTypeLogic.Setup(x => x.IsValidServiceType()).Returns(true); mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, true, false)) .Returns(updatedPaymentResults); mockContractBaseLogic.SetupAllProperties(); //Act List <PaymentResult> actual = target.EvaluatePaymentType(evaluateableClaim, paymentResults, true, false); // Assert Assert.AreEqual(3, actual.Count); var firstOrDefault = paymentResults.FirstOrDefault(x => x.AdjudicatedValue != null); if (firstOrDefault != null) { Assert.AreEqual(10, firstOrDefault.AdjudicatedValue); } }
public RtaData GetRtaData(EvaluateableClaim evaluateableClaim) { return(_rtaLogic.GetRtaDataByClaim(evaluateableClaim)); }
/// <summary> /// Gets the excel variance report. /// </summary> /// <param name="varianceReport">The variance report.</param> /// <param name="maxRecordLimitForExcelReport">The maximum record limit for excel report.</param> /// <returns>reportInfo</returns> public VarianceReport GetExcelVarianceReport(VarianceReport varianceReport, int maxRecordLimitForExcelReport) { VarianceReport varianceReportData = new VarianceReport(); // Initialize the Stored Procedure _databaseCommandObj = _databaseObj.GetStoredProcCommand("GetVarianceDetailReport"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _databaseObj.AddInParameter(_databaseCommandObj, "@ModelID ", DbType.Int64, varianceReport.NodeId); _databaseObj.AddInParameter(_databaseCommandObj, "@DateType ", DbType.Int32, varianceReport.DateType); _databaseObj.AddInParameter(_databaseCommandObj, "@DateFrom ", DbType.DateTime, varianceReport.StartDate); _databaseObj.AddInParameter(_databaseCommandObj, "@DateTo ", DbType.DateTime, varianceReport.EndDate); _databaseObj.AddInParameter(_databaseCommandObj, "@SelectCriteria ", DbType.String, varianceReport.ClaimSearchCriteria.ToTrim()); _databaseObj.AddInParameter(_databaseCommandObj, "@MaxRecordLimit", DbType.Int32, maxRecordLimitForExcelReport); //Added RequestedUserID and RequestedUserName with reference to HIPAA logging feature _databaseObj.AddInParameter(_databaseCommandObj, "@RequestedUserID", DbType.String, varianceReport.RequestedUserId); _databaseObj.AddInParameter(_databaseCommandObj, "@RequestedUserName", DbType.String, varianceReport.RequestedUserName); // Retrieve the results of the Stored Procedure in Data set _databaseCommandObj.CommandTimeout = varianceReport.CommandTimeoutForVarianceReport; DataSet varianceReportResult = _databaseObj.ExecuteDataSet(_databaseCommandObj); if (varianceReportResult.IsTableDataPopulated()) { if (varianceReportResult.Tables[0].Columns.Count == 2) { varianceReportData.CountThreshold = Convert.ToInt32(varianceReportResult.Tables[0].Rows[0][0]); return(varianceReportData); } List <EvaluateableClaim> claimDataList = new List <EvaluateableClaim>(); DataRowCollection claimDataRowCollection = varianceReportResult.Tables[0].Rows; for (int indexCount = 0; indexCount < claimDataRowCollection.Count; indexCount++) { DataRow claimDataRow = claimDataRowCollection[indexCount]; EvaluateableClaim claimData = new EvaluateableClaim { PatientAccountNumber = GetStringValue(claimDataRow["PatientAccountNumber"]), AdjudicatedDate = GetValue <DateTime?>(claimDataRow["AdjudicatedDate"], typeof(DateTime)), Ssinumber = GetValue <int?>(claimDataRow["SSINumber"], typeof(int)), ClaimType = GetStringValue(claimDataRow["ClaimType"]), ClaimState = GetStringValue(claimDataRow["ClaimState"]), PayerSequence = GetValue <int?>(claimDataRow["PayerSequence"], typeof(int)), ClaimTotal = GetValue <double?>(claimDataRow["ClaimTotal"], typeof(double)), StatementFrom = GetValue <DateTime?>(claimDataRow["StatementFrom"], typeof(DateTime)), StatementThru = GetValue <DateTime?>(claimDataRow["StatementThru"], typeof(DateTime)), ClaimDate = GetValue <DateTime?>(claimDataRow["ClaimDate"], typeof(DateTime)), BillDate = GetValue <DateTime?>(claimDataRow["BillDate"], typeof(DateTime)), LastFiledDate = GetValue <DateTime?>(claimDataRow["LastFiledDate"], typeof(DateTime)), LastFiledDateValue = DBNull.Value == claimDataRow["LastFiledDate"] ? null : Convert.ToDateTime(claimDataRow["LastFiledDate"]).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture), BillType = GetStringValue(claimDataRow["BillType"]), Drg = GetStringValue(claimDataRow["DRG"]), PriIcdpCode = GetStringValue(claimDataRow["PriICDPCode"]), PriIcddCode = GetStringValue(claimDataRow["PriICDDCode"]), PriPayerName = GetStringValue(claimDataRow["PriPayerName"]), SecPayerName = GetStringValue(claimDataRow["SecPayerName"]), TerPayerName = GetStringValue(claimDataRow["TerPayerName"]), IsRemitLinked = GetStringValue(claimDataRow["IsRemitLinked"]), ClaimStat = GetStringValue(claimDataRow["ClaimStatus"]), AdjudicatedValue = GetValue <double?>(claimDataRow["AdjudicatedValue"], typeof(double)), ActualPayment = GetValue <double>(claimDataRow["ActualPayment"], typeof(double)), PatientResponsibility = GetValue <double?>(claimDataRow["PatientResponsibility"], typeof(double)), RemitAllowedAmt = GetValue <double?>(claimDataRow["RemitAllowedAmt"], typeof(double)), RemitNonCovered = GetValue <double?>(claimDataRow["RemitNonCovered"], typeof(double)), ClaimLink = GetValue <long?>(claimDataRow["ClaimLink"], typeof(long)), LinkedRemitId = GetStringValue(claimDataRow["LinkedRemitID"]), ClaimId = GetValue <long>(claimDataRow["ClaimId"], typeof(long)), CalculatedAdjustment = GetValue <double?>(claimDataRow["CalculatedAdj"], typeof(double)), ActualAdjustment = GetValue <double?>(claimDataRow["ActualAdj"], typeof(double)), ContractualVariance = GetValue <double?>(claimDataRow["ContractualVariance"], typeof(double)), PaymentVariance = GetValue <double?>(claimDataRow["PaymentVariance"], typeof(double)), AdjudicatedDateValue = DBNull.Value == claimDataRow["AdjudicatedDate"] ? null : Convert.ToString(claimDataRow["AdjudicatedDate"].ToString() == "1/1/1900 12:00:00 AM" ? "" : claimDataRow["AdjudicatedDate"].ToString()), StatementFromValue = DBNull.Value == claimDataRow["StatementFrom"] ? null : Convert.ToString(claimDataRow["StatementFrom"].ToString() == "1/1/1900 12:00:00 AM" ? "" : Convert.ToDateTime(claimDataRow["StatementFrom"]).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture)), StatementThruValue = DBNull.Value == claimDataRow["StatementThru"] ? null : Convert.ToString(claimDataRow["StatementThru"].ToString() == "1/1/1900 12:00:00 AM" ? "" : Convert.ToDateTime(claimDataRow["StatementThru"]).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture)), ClaimDateValue = DBNull.Value == claimDataRow["ClaimDate"] ? null : Convert.ToString(claimDataRow["ClaimDate"].ToString() == "1/1/1900 12:00:00 AM" ? "" : Convert.ToDateTime(claimDataRow["ClaimDate"]).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture)), BillDateValue = DBNull.Value == claimDataRow["BillDate"] ? null : Convert.ToString(claimDataRow["BillDate"].ToString() == "1/1/1900 12:00:00 AM" ? "" : Convert.ToDateTime(claimDataRow["BillDate"]).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture)), CustomField1 = GetStringValue(claimDataRow["CustomField1"]), CustomField2 = GetStringValue(claimDataRow["CustomField2"]), CustomField3 = GetStringValue(claimDataRow["CustomField3"]), CustomField4 = GetStringValue(claimDataRow["CustomField4"]), CustomField5 = GetStringValue(claimDataRow["CustomField5"]), CustomField6 = GetStringValue(claimDataRow["CustomField6"]), DischargeStatus = GetStringValue(claimDataRow["DischargeStatus"]), Npi = GetStringValue(claimDataRow["NPI"]), MemberId = GetStringValue(claimDataRow["MemberID"]), Icn = GetStringValue(claimDataRow["ICN"]), Mrn = GetStringValue(claimDataRow["MRN"]), IsReviewed = GetValue <bool>(claimDataRow["IsReviewed"], typeof(bool)), Los = GetValue <int>(claimDataRow["Los"], typeof(int)), Age = GetValue <byte>(claimDataRow["Age"], typeof(byte)), CheckDate = DBNull.Value == claimDataRow["CheckDate"] ? null : Convert.ToString(claimDataRow["CheckDate"].ToString() == Constants.DateTime1900 ? string.Empty : Convert.ToDateTime(claimDataRow["CheckDate"]).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture)), CheckNumber = GetValue <string>(claimDataRow["CheckNumber"], typeof(string)), AdjudicatedContractName = DBNull.Value == claimDataRow["AdjudicatedContractName"] ? null : GetValue <string>(claimDataRow["AdjudicatedContractName"], typeof(string)), InsuredsGroupNumber = DBNull.Value == claimDataRow["InsuredsGroupNumber"] ? null : GetValue <string>(claimDataRow["InsuredsGroupNumber"], typeof(string)) }; claimDataList.Add(claimData); } varianceReportData.ClaimData = claimDataList; } return(varianceReportData); }