Exemplo n.º 1
0
        public bool IsConditionsValid(List <ICondition> conditions, IEvaluateableClaim claim)
        {
            if (conditions != null && conditions.Any())
            {
                //Fill LHS oprand of each contract with claim codes
                lock (conditions)
                {
                    // ReSharper disable once ForCanBeConvertedToForeach
                    // for loop is required for multiple threads
                    for (int index = 0; index < conditions.Count; index++)
                    {
                        ICondition condition = conditions[index];
                        _conditionLogic.Condition = condition;
                        condition.LeftOperands    =
                            _conditionLogic.GetPropertyValues(claim, _conditionLogic.Condition.PropertyColumnName);
                    }
                }
            }

            bool isMatch = true;

            //Validate each condition in a contract
            if (conditions != null)
            {
                lock (conditions)
                {
                    // ReSharper disable once ForCanBeConvertedToForeach
                    // for loop is required for multiple threads
                    for (int index = 0; index < conditions.Count; index++)
                    {
                        ICondition condition = conditions[index];
                        _conditionLogic.Condition = condition;
                        isMatch = _conditionLogic.IsMatch();
                        if (!isMatch)
                        {
                            break;
                        }
                    }
                }
            }
            return(isMatch);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Determines whether [is payment type conditions] [the specified payment type].
        /// </summary>
        /// <param name="paymentType">Type of the payment.</param>
        /// <param name="claim">The claim.</param>
        /// <returns></returns>
        public bool IsPaymentTypeConditions(IPaymentType paymentType, IEvaluateableClaim claim)
        {
            if (paymentType != null)
            {
                paymentType.ValidLineIds = new List <int>();
                //Fill LHS into Contract's Condition objects
                foreach (ICondition condition in paymentType.Conditions)
                {
                    _conditionLogic.Condition = condition;
                    condition.LeftOperands    =
                        _conditionLogic.GetPropertyValues(claim, _conditionLogic.Condition.PropertyColumnName);
                }

                if (claim != null)
                {
                    //Match claim charge line codes with Payment Type Conditions
                    foreach (ClaimCharge claimCharge in claim.ClaimCharges)
                    {
                        //If condition is not there than its valid. That's why we are initialization by default as true.
                        //For Ex - Payment type don't have any rev code or cpt code than all the lines are valid in this case isMatch should be true
                        bool isMatch      = true;
                        bool isClaimLevel = true;
                        //Based on condition Operand Identifier fill LHS operand with charge line codes
                        foreach (ICondition condition in paymentType.Conditions)
                        {
                            if (condition.OperandIdentifier != null)
                            {
                                switch ((Enums.OperandIdentifier)condition.OperandIdentifier)
                                {
                                case Enums.OperandIdentifier.RevCode:
                                    condition.LeftOperands = new List <string> {
                                        claimCharge.RevCode
                                    };
                                    isClaimLevel = false;
                                    break;

                                case Enums.OperandIdentifier.HcpcsCode:
                                    condition.LeftOperands = new List <string> {
                                        claimCharge.HcpcsCodeWithModifier
                                    };
                                    isClaimLevel = false;
                                    break;

                                case Enums.OperandIdentifier.PlaceOfService:
                                    condition.LeftOperands = new List <string> {
                                        claimCharge.PlaceOfService
                                    };
                                    isClaimLevel = false;
                                    break;
                                }
                            }
                            _conditionLogic.Condition = condition;
                            isMatch = _conditionLogic.IsMatch();

                            if (!isMatch)
                            {
                                break;
                            }
                        }
                        paymentType.PayAtClaimLevel = isClaimLevel;
                        //If Claim charge line codes matches with Payment Type Conditions then build valid charge line list
                        if (isMatch)
                        {
                            paymentType.ValidLineIds.Add(claimCharge.Line);
                        }
                    }
                }

                return(paymentType.ValidLineIds.Any());
            }
            return(false);
        }