예제 #1
0
        ///<summary>Returns a non-empty string if there would be a display issue due to invalid settings.
        ///Use the result to block the display from the user when needed.</summary>
        public static string ValidateSettings()
        {
            string validationErrors  = "";
            Array  arrayEbenetitCats = Enum.GetValues(typeof(EbenefitCategory));

            for (int i = 0; i < arrayEbenetitCats.Length; i++)
            {
                EbenefitCategory ebenCat = (EbenefitCategory)arrayEbenetitCats.GetValue(i);
                if (ebenCat == EbenefitCategory.None)
                {
                    continue;
                }
                CovCat covCat = CovCats.GetForEbenCat(ebenCat);
                if (covCat == null)
                {
                    if (validationErrors != "")
                    {
                        validationErrors += ", ";
                    }
                    validationErrors += ebenCat.ToString();
                }
            }
            if (validationErrors != "")
            {
                validationErrors = "Missing or hidden insurance category for each of the following E-benefits:" + "\r\n"
                                   + validationErrors + "\r\n"
                                   + "Go to Setup then Insurance Categories to add or edit.";
            }
            return(validationErrors);
        }
예제 #2
0
        public EB271(X12Segment segment, bool isInNetwork, bool isCoinsuranceInverted, X12Segment segHsd = null)
        {
            if (eb01 == null)
            {
                FillDictionaries();
            }
            Segment = segment;
            SupplementalSegments = new List <X12Segment>();
            //start pattern matching to generate closest Benefit
            EB01          eb01val  = eb01.Find(EB01MatchesCode);
            EB02          eb02val  = eb02.Find(EB02MatchesCode);
            EB03          eb03val  = eb03.Find(EB03MatchesCode);
            EB06          eb06val  = eb06.Find(EB06MatchesCode);
            EB09          eb09val  = eb09.Find(EB09MatchesCode);
            ProcedureCode proccode = null;

            if (ProcedureCodes.IsValidCode(Segment.Get(13, 2)))
            {
                proccode = ProcedureCodes.GetProcCode(Segment.Get(13, 2));
            }
            if (!eb01val.IsSupported ||
                (eb02val != null && !eb02val.IsSupported) ||
                (eb03val != null && !eb03val.IsSupported) ||
                (eb06val != null && !eb06val.IsSupported) ||
                (eb09val != null && !eb09val.IsSupported))
            {
                Benefitt = null;
                return;
            }
            if (eb01val.BenefitType == InsBenefitType.ActiveCoverage && Segment.Get(3) == "30")
            {
                Benefitt = null;
                return;
            }
            if (eb01val.BenefitType == InsBenefitType.ActiveCoverage && proccode != null)
            {
                //A code is covered.  Informational only.
                Benefitt = null;
                return;
            }
            if (Segment.Get(8) != "")           //if percentage
            //must have either a category or a proc code
            {
                if (proccode == null)                                                                                                       //if no proc code is specified
                {
                    if (eb03val == null || eb03val.ServiceType == EbenefitCategory.None || eb03val.ServiceType == EbenefitCategory.General) //and no category specified
                    {
                        Benefitt = null;
                        return;
                    }
                }
            }
            //coinsurance amounts are handled with fee schedules rather than benefits
            if (eb01val.BenefitType == InsBenefitType.CoPayment || eb01val.BenefitType == InsBenefitType.CoInsurance)
            {
                if (Segment.Get(7) != "")               //and a monetary amount specified
                {
                    Benefitt = null;
                    return;
                }
            }
            //a limitation without an amount is meaningless
            if (eb01val.BenefitType == InsBenefitType.Limitations &&
                segHsd == null)                 //Some benefits do not have monetary value but limit service in a time period.  Originally done for customer 27936.
            {
                if (Segment.Get(7) == "")       //no monetary amount specified
                {
                    Benefitt = null;
                    return;
                }
            }
            if (isInNetwork && (Segment.Get(12) == "N" || Segment.Get(12) == "U"))
            {
                Benefitt = null;
                return;
            }
            if (!isInNetwork && Segment.Get(12) == "Y")
            {
                Benefitt = null;
                return;
            }
            //if only a quantity is specified with no qualifier, it's meaningless
            if (Segment.Get(10) != "" && eb09val == null)
            {
                Benefitt = null;
                return;
            }
            //if only a qualifier is specified with no quantity, it's meaningless
            if (eb09val != null && Segment.Get(10) == "")
            {
                Benefitt = null;
                return;
            }
            Benefitt = new Benefit();
            //1
            Benefitt.BenefitType = eb01val.BenefitType;
            //2
            if (eb02val != null)
            {
                Benefitt.CoverageLevel = eb02val.CoverageLevel;
            }
            //3
            if (eb03val != null)
            {
                Benefitt.CovCatNum = CovCats.GetForEbenCat(eb03val.ServiceType).CovCatNum;
            }
            //4-Insurance type - we ignore.
            //5-Plan description - we ignore.
            //6
            if (eb06val != null)
            {
                Benefitt.TimePeriod = eb06val.TimePeriod;
            }
            //7
            if (Segment.Get(7) != "")
            {
                Benefitt.MonetaryAmt = PIn.Double(Segment.Get(7));              //Monetary amount. Situational
            }
            //8
            if (Segment.Get(8) != "")
            {
                if (isCoinsuranceInverted && Benefitt.BenefitType == InsBenefitType.CoInsurance) //Some carriers incorrectly send insurance percentage.
                {
                    Benefitt.Percent = (int)(PIn.Double(Segment.Get(8)) * 100);                  //Percent. Came to us inverted, do Not Invert.
                }
                else
                {
                    //OD shows the percentage paid by Insurance by default.
                    //Some carriers submit 271s to us showing percentage paid by Patient, so we need to invert this case to match OD expectations.
                    Benefitt.Percent = 100 - (int)(PIn.Double(Segment.Get(8)) * 100);              //Percent. Invert.
                }
                Benefitt.CoverageLevel = BenefitCoverageLevel.None;
            }
            //9-Quantity qualifier
            if (eb09val != null)
            {
                Benefitt.QuantityQualifier = eb09val.QuantityQualifier;
            }
            //10-Quantity
            if (Segment.Get(10) != "")
            {
                Benefitt.Quantity = (byte)PIn.Double(Segment.Get(10));              //Example: "19.0" with Quantity qualifier "S7" (age).
            }
            //11-Authorization. Ignored.
            //12-In network. Ignored.
            //13-proc
            if (proccode != null)
            {
                Benefitt.CodeNum = proccode.CodeNum;              //element 13,2
            }
            if (Benefitt.BenefitType == InsBenefitType.Limitations &&
                proccode != null &&               //Valid ADA code.
                segHsd != null)
            {
                if (segHsd.Elements.Length < 6 || segHsd.Elements[2] == "" || segHsd.Elements[5] == "")
                {
                    Benefitt = null;
                    return;
                }
                Benefitt.Quantity   = PIn.Byte(segHsd.Elements[2]);                                      //HSD02: Quantity.
                Benefitt.TimePeriod = eb06.FirstOrDefault(x => x.Code == segHsd.Elements[5]).TimePeriod; //HSD05: Frequency.
            }
        }
예제 #3
0
파일: EB271.cs 프로젝트: steev90/opendental
        public EB271(X12Segment segment, bool isInNetwork)
        {
            if (eb01 == null)
            {
                FillDictionaries();
            }
            Segment = segment;
            SupplementalSegments = new List <X12Segment>();
            //start pattern matching to generate closest Benefit
            EB01          eb01val  = eb01.Find(EB01MatchesCode);
            EB02          eb02val  = eb02.Find(EB02MatchesCode);
            EB03          eb03val  = eb03.Find(EB03MatchesCode);
            EB06          eb06val  = eb06.Find(EB06MatchesCode);
            EB09          eb09val  = eb09.Find(EB09MatchesCode);
            ProcedureCode proccode = null;

            if (ProcedureCodes.IsValidCode(Segment.Get(13, 2)))
            {
                proccode = ProcedureCodes.GetProcCode(Segment.Get(13, 2));
            }
            if (!eb01val.IsSupported ||
                (eb02val != null && !eb02val.IsSupported) ||
                (eb03val != null && !eb03val.IsSupported) ||
                (eb06val != null && !eb06val.IsSupported) ||
                (eb09val != null && !eb09val.IsSupported))
            {
                Benefitt = null;
                return;
            }
            if (eb01val.BenefitType == InsBenefitType.ActiveCoverage && Segment.Get(3) == "30")
            {
                Benefitt = null;
                return;
            }
            if (eb01val.BenefitType == InsBenefitType.ActiveCoverage && proccode != null)
            {
                //A code is covered.  Informational only.
                Benefitt = null;
                return;
            }
            if (Segment.Get(8) != "")           //if percentage
            //must have either a category or a proc code
            {
                if (proccode == null)                                                                                                       //if no proc code is specified
                {
                    if (eb03val == null || eb03val.ServiceType == EbenefitCategory.None || eb03val.ServiceType == EbenefitCategory.General) //and no category specified
                    {
                        Benefitt = null;
                        return;
                    }
                }
            }
            //coinsurance amounts are handled with fee schedules rather than benefits
            if (eb01val.BenefitType == InsBenefitType.CoPayment || eb01val.BenefitType == InsBenefitType.CoInsurance)
            {
                if (Segment.Get(7) != "")               //and a monetary amount specified
                {
                    Benefitt = null;
                    return;
                }
            }
            //a limitation without an amount is meaningless
            if (eb01val.BenefitType == InsBenefitType.Limitations)
            {
                if (Segment.Get(7) == "")               //no monetary amount specified
                {
                    Benefitt = null;
                    return;
                }
            }
            if (isInNetwork && Segment.Get(12) == "N")
            {
                Benefitt = null;
                return;
            }
            if (!isInNetwork && Segment.Get(12) == "Y")
            {
                Benefitt = null;
                return;
            }
            //if only a quantity is specified with no qualifier, it's meaningless
            if (Segment.Get(10) != "" && eb09val == null)
            {
                Benefitt = null;
                return;
            }
            //if only a qualifier is specified with no quantity, it's meaningless
            if (eb09val != null && Segment.Get(10) == "")
            {
                Benefitt = null;
                return;
            }
            Benefitt = new Benefit();
            //1
            Benefitt.BenefitType = eb01val.BenefitType;
            //2
            if (eb02val != null)
            {
                Benefitt.CoverageLevel = eb02val.CoverageLevel;
            }
            //3
            if (eb03val != null)
            {
                Benefitt.CovCatNum = CovCats.GetForEbenCat(eb03val.ServiceType).CovCatNum;
            }
            //4-Insurance type - we ignore.
            //5-Plan description - we ignore.
            //6
            if (eb06val != null)
            {
                Benefitt.TimePeriod = eb06val.TimePeriod;
            }
            //7
            if (Segment.Get(7) != "")
            {
                Benefitt.MonetaryAmt = PIn.Double(Segment.Get(7));              //Monetary amount. Situational
            }
            //8
            if (Segment.Get(8) != "")
            {
                Benefitt.Percent       = 100 - (int)(PIn.Double(Segment.Get(8)) * 100);    //Percent. Situational
                Benefitt.CoverageLevel = BenefitCoverageLevel.None;
            }
            //9-Quantity qualifier
            if (eb09val != null)
            {
                Benefitt.QuantityQualifier = eb09val.QuantityQualifier;
            }
            //10-Quantity
            if (Segment.Get(10) != "")
            {
                Benefitt.Quantity = (byte)PIn.Double(Segment.Get(10));              //Example: "19.0" with Quantity qualifier "S7" (age).
            }
            //11-Authorization. Ignored.
            //12-In network. Ignored.
            //13-proc
            if (proccode != null)
            {
                Benefitt.CodeNum = proccode.CodeNum;              //element 13,2
            }
        }