/// <summary>
        /// Get PaymentType DRG Schedules
        /// </summary>
        /// <param name="paymentTypeDrgPayment"></param>
        /// <returns></returns>
        public PaymentTypeDrg GetPaymentTypeDrgPayment(PaymentTypeDrg paymentTypeDrgPayment)
        {
            // Initialize the Stored Procedure
            _cmd = _db.GetStoredProcCommand("GetServiceLinesandPaymentTypes");
            // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
            _db.AddInParameter(_cmd, "@PaymentTypeID ", DbType.Int64, paymentTypeDrgPayment.PaymentTypeId);
            _db.AddInParameter(_cmd, "@ContractID", DbType.Int64, paymentTypeDrgPayment.ContractId);
            _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, paymentTypeDrgPayment.ServiceTypeId);
            _db.AddInParameter(_cmd, "@ServiceLineTypeId", DbType.Int64, 0);
            _db.AddInParameter(_cmd, "@UserName", DbType.String, paymentTypeDrgPayment.UserName);

            // Retrieve the results of the Stored Procedure in Datatable
            DataSet paymentTypeDrgDataSet = _db.ExecuteDataSet(_cmd);

            if (paymentTypeDrgDataSet != null && paymentTypeDrgDataSet.Tables.Count > 0)
            {
                //populating ContractBasicInfo data
                if (paymentTypeDrgDataSet.Tables[0].Rows != null && paymentTypeDrgDataSet.Tables[0] != null && paymentTypeDrgDataSet.Tables[0].Rows.Count > 0)
                {
                    PaymentTypeDrg paymentDrgPayment = new PaymentTypeDrg
                    {
                        BaseRate            = DBNull.Value == paymentTypeDrgDataSet.Tables[0].Rows[0]["BaseRate"] ? (double?)null : Convert.ToDouble(paymentTypeDrgDataSet.Tables[0].Rows[0]["BaseRate"]),
                        ClaimFieldDocId     = DBNull.Value == paymentTypeDrgDataSet.Tables[0].Rows[0]["ClaimFieldDocID"] ? (int?)null : Convert.ToInt32(paymentTypeDrgDataSet.Tables[0].Rows[0]["ClaimFieldDocID"]),
                        PaymentTypeDetailId = Convert.ToInt64(paymentTypeDrgDataSet.Tables[0].Rows[0]["PaymentTypeDetailID"])
                    };
                    return(paymentDrgPayment);
                }
            }

            //returns response to Business layer
            return(null);
        }
        /// <summary>
        /// PaymentTypeDRGPaymentDetails
        /// </summary>
        /// <param name="contractId"></param>
        /// <param name="serviceTypeId"></param>
        /// <param name="paymentTypeId"></param>
        /// <param name="isEdit"></param>
        /// <returns></returns>
        public ActionResult PaymentTypeDrg(long?contractId, long?serviceTypeId, int paymentTypeId, bool isEdit)
        {
            PaymentTypeDrgPaymentViewModel modelPaymentTypeDrgPaymentViewModel = new PaymentTypeDrgPaymentViewModel();

            if (isEdit)
            {
                PaymentTypeDrg paymentTypeDrgPaymentForPost = new PaymentTypeDrg
                {
                    ServiceTypeId = serviceTypeId,
                    ContractId    = contractId,
                    PaymentTypeId = paymentTypeId,
                    UserName      = GetCurrentUserName()
                };
                //Get the Name of User logged in

                PaymentTypeDrg paymentTypeDrgPaymentViewModelInfo =
                    PostApiResponse <PaymentTypeDrg>("PaymentTypeDrg",
                                                     "GetPaymentTypeDrgPayment",
                                                     paymentTypeDrgPaymentForPost);

                modelPaymentTypeDrgPaymentViewModel = AutoMapper.Mapper.Map <PaymentTypeDrg, PaymentTypeDrgPaymentViewModel>(paymentTypeDrgPaymentViewModelInfo);
            }

            modelPaymentTypeDrgPaymentViewModel.ContractId    = contractId;
            modelPaymentTypeDrgPaymentViewModel.ServiceTypeId = serviceTypeId;
            modelPaymentTypeDrgPaymentViewModel.PaymentTypeId = paymentTypeId;
            modelPaymentTypeDrgPaymentViewModel.IsEdit        = isEdit;
            return(View(modelPaymentTypeDrgPaymentViewModel));
        }
        public JsonResult AddEditPaymentTypeDrg(PaymentTypeDrgPaymentViewModel info)
        {
            long drgId = 0;

            if (info.ClaimFieldDocId != null)
            {
                PaymentTypeDrg drgPaymrntInfo =
                    AutoMapper.Mapper.Map <PaymentTypeDrgPaymentViewModel, PaymentTypeDrg>(info);
                //Get the Name of User logged in
                drgPaymrntInfo.UserName = GetCurrentUserName();
                drgId = PostApiResponse <long>("PaymentTypeDrg", "AddEditPaymentTypeDrgPayment", drgPaymrntInfo);
            }
            return(drgId > 0 ? Json(new { sucess = true, Id = drgId, documentId = info.ClaimFieldDocId }) : Json(new { sucess = false, Id = 0, documentId = info.ClaimFieldDocId }));
        }
Ejemplo n.º 4
0
        public void GetPaymentTypeDrgPaymentMockTest1()
        {
            PaymentTypeDrg objAddNewPaymentTypeDrgPayment = new PaymentTypeDrg {
                PaymentTypeDetailId = 1
            };

            var mockPaymentTypeDrgPayment = new Mock <IPaymentTypeDrgPaymentRepository>();

            mockPaymentTypeDrgPayment.Setup(f => f.GetPaymentTypeDrgPayment(It.IsAny <PaymentTypeDrg>())).Returns(objAddNewPaymentTypeDrgPayment);
            PaymentTypeDrgLogic target = new PaymentTypeDrgLogic(mockPaymentTypeDrgPayment.Object);

            PaymentTypeDrg actual = (PaymentTypeDrg)target.GetPaymentType(null);

            Assert.AreEqual(1, actual.PaymentTypeDetailId);
        }
        /// <summary>
        /// Add Edit PaymentType DRG Schedules
        /// </summary>
        /// <param name="paymentTypeDrgPayment"></param>
        /// <returns></returns>
        public long AddEditPaymentTypeDrgPayment(PaymentTypeDrg paymentTypeDrgPayment)
        {
            //Checks if input request is not null
            if (paymentTypeDrgPayment != null)
            {
                // Initialize the Stored Procedure
                _cmd = _db.GetStoredProcCommand("AddEditDRGPayment");
                // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
                _db.AddInParameter(_cmd, "@PaymentTypeDetailID", DbType.Int64, paymentTypeDrgPayment.PaymentTypeDetailId);
                _db.AddInParameter(_cmd, "@BaseRate ", DbType.Decimal, paymentTypeDrgPayment.BaseRate);
                _db.AddInParameter(_cmd, "@PaymentTypeID ", DbType.Int64, paymentTypeDrgPayment.PaymentTypeId);
                _db.AddInParameter(_cmd, "@ContractID", DbType.Int64, paymentTypeDrgPayment.ContractId);
                _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, paymentTypeDrgPayment.ServiceTypeId);
                _db.AddInParameter(_cmd, "@ClaimFieldDocID ", DbType.Int64, paymentTypeDrgPayment.ClaimFieldDocId);
                _db.AddInParameter(_cmd, "@UserName ", DbType.String, paymentTypeDrgPayment.UserName);

                // Retrieve the results of the Stored Procedure in Datatable
                return(long.Parse(_db.ExecuteScalar(_cmd).ToString()));
            }

            return(0);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="contractServiceTypeId"></param>
        /// <param name="dtDrg"></param>
        /// <param name="dtDoc"></param>
        /// <param name="dtDocValues"></param>
        /// <returns></returns>
        public static PaymentTypeDrg GetPaymentType(long contractServiceTypeId, DataTable dtDrg, DataTable dtDoc, DataTable dtDocValues)
        {
            PaymentTypeDrg paymentTypeDrg = null;

            if (dtDrg != null && dtDrg.Rows.Count > 0)
            {
                paymentTypeDrg = (from DataRow row in dtDrg.Rows
                                  where (Convert.ToInt64(DBNull.Value == row["contractServiceTypeId"]
                                      ? (long?)null
                                      : Convert.ToInt64(row["contractServiceTypeId"])) == contractServiceTypeId)
                                  select new PaymentTypeDrg
                {
                    BaseRate = DBNull.Value == row["BaseRate"]
                                          ? (double?)null
                                          : Convert.ToDouble(row["BaseRate"]),
                    ClaimFieldDocId =
                        Convert.ToInt64(row["ClaimFieldDocID"]),
                    ContractId = DBNull.Value == row["ContractId"]
                                          ? (long?)null
                                          : Convert.ToInt64(row["ContractId"]),
                    ServiceTypeId =
                        DBNull.Value == row["ContractServiceTypeID"]
                                              ? (long?)null
                                              : Convert.ToInt64(
                            row["ContractServiceTypeID"]),
                    PaymentTypeId = (byte)Enums.PaymentTypeCodes.DrgPayment,
                    PaymentTypeDetailId = DBNull.Value == row["PaymentTypeDetailId"]
                                       ? 0
                                       : Convert.ToInt64(
                        row["PaymentTypeDetailId"]),
                    ClaimFieldDoc = GetClaimFieldDoc(
                        Convert.ToInt64(row["ClaimFieldDocID"]), dtDoc, dtDocValues),
                }).FirstOrDefault();
            }

            return(paymentTypeDrg);
        }
 public PaymentTypeDrg GetPaymentTypeDrgPayment(PaymentTypeDrg paymentTypeDrgPayment)
 {
     return((PaymentTypeDrg)_paymentTypeDrgPaymentLogic.GetPaymentType(paymentTypeDrgPayment));
 }
 /// <summary>
 /// Add & Edit Payment Type DRG Schedules
 /// </summary>
 /// <param name="paymentTypeDrgPayment">PaymentTypeDRGPayment Object</param>
 /// <returns>Inserted Payment Id</returns>
 public long AddEditPaymentTypeDrgPayment(PaymentTypeDrg paymentTypeDrgPayment)
 {
     return(_paymentTypeDrgPaymentLogic.AddEditPaymentType(paymentTypeDrgPayment));
 }
Ejemplo n.º 9
0
        public void EvaluateIfPaymentResultsLineIsNotNullTest()
        {
            List <PaymentResult> paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, Line = null, AdjudicatedValue = null, ServiceTypeId = 1
                },
            };
            PaymentTypeDrg paymentTypeDrg = new PaymentTypeDrg
            {
                RelativeWeightId = 10,
                BaseRate         = 10,
                Conditions       = new List <ICondition>
                {
                    new Condition
                    {
                        ConditionOperator = (byte)Enums.ConditionOperation.EqualTo,
                        LeftOperands      = new List <string> {
                            "300"
                        },
                        OperandType  = (byte)Enums.OperandIdentifier.HcpcsCode,
                        RightOperand = "300"
                    }
                },
                ClaimFieldDoc = new ClaimFieldDoc
                {
                    ClaimFieldValues = new List <ClaimFieldValue>
                    {
                        new ClaimFieldValue
                        {
                            Identifier = "ABCDE",
                            Value      = "100"
                        }
                    }
                },
                ServiceTypeId = 1,
                ValidLineIds  = new List <int> {
                    1, 2
                },
                HcpcsCode  = "ABCDE",
                ContractId = 1,
            };
            // 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 <IPaymentTypeDrgPaymentRepository> paymentTypeDrgPaymentRepository = new Mock <IPaymentTypeDrgPaymentRepository>();

            paymentTypeDrgPaymentRepository.Setup(x => x.GetPaymentTypeDrgPayment(It.IsAny <PaymentTypeDrg>()))
            .Returns(paymentTypeDrg);

            var target = new PaymentTypeDrgLogic(paymentTypeDrgPaymentRepository.Object)
            {
                PaymentTypeBase = paymentTypeDrg
            };


            // _target.Contract = contract;
            IEvaluateableClaim evaluateableClaim = new EvaluateableClaim();

            evaluateableClaim.ClaimId      = 123;
            evaluateableClaim.Drg          = "ABCDE";
            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 = "ABCDE"
                }
            };


            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, false, false))
            .Returns(updatedPaymentResults);
            mockContractBaseLogic.SetupAllProperties();

            //Act
            List <PaymentResult> actual = target.EvaluatePaymentType(evaluateableClaim, paymentResults, false, false);

            // Assert
            Assert.AreEqual(2, actual.Count);
            var firstOrDefault = paymentResults.FirstOrDefault(x => x.AdjudicatedValue != null);

            if (firstOrDefault != null)
            {
                Assert.AreEqual(1000, firstOrDefault.AdjudicatedValue);
            }
        }