Exemple #1
0
        ///<summary>Creates a general deductible of $50, a deductible of $50 on D0220, sets a $30 D0220 complete and creates a claim,
        ///creates a $100 D2750, that is TP'ed, and then creates a $30 D0220 that is TP'ed.</summary>
        ///<param name="actAssert">The first claimproc is for the D2750 and the second claimproc is for the second D0220.</param>
        public void GetDeductibleByCodeDeductLessThanGeneral(string suffix, Action <ClaimProc, ClaimProc> actAssert)
        {
            Patient pat = PatientT.CreatePatient(suffix);

            InsuranceT.AddInsurance(pat, suffix);
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            InsPlan        plan         = InsPlanT.GetPlanForPriSecMed(PriSecMed.Primary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateDeductibleGeneral(plan.PlanNum, BenefitCoverageLevel.Individual, 50);
            BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Diagnostic, 100);
            BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Crowns, 50);
            BenefitT.CreateDeductible(plan.PlanNum, EbenefitCategory.Diagnostic, 0);
            BenefitT.CreateDeductible(plan.PlanNum, "D0220", 50);
            List <Benefit> listBens = Benefits.Refresh(listPatPlans, listSubs);
            Procedure      proc1    = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 30);//proc1 - Intraoral - periapical first film

            ClaimT.CreateClaim("P", listPatPlans, listPlans, new List <ClaimProc>(), new List <Procedure> {
                proc1
            }, pat, new List <Procedure> {
                proc1
            }, listBens,
                               listSubs);
            Procedure        proc2      = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.TP, "", 100, priority: 0); //proc2 - Crown
            Procedure        proc3      = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.TP, "", 30, priority: 1);  //proc3 - Intraoral - periapical first film
            List <ClaimProc> claimProcs = ProcedureT.ComputeEstimates(pat, listPatPlans, listPlans, listSubs, listBens);
            ClaimProc        claimProc2 = claimProcs.FirstOrDefault(x => x.ProcNum == proc2.ProcNum);
            ClaimProc        claimProc3 = claimProcs.FirstOrDefault(x => x.ProcNum == proc3.ProcNum);

            actAssert(claimProc2, claimProc3);
        }
Exemple #2
0
        ///<summary>Creates a procedure and returns its procedure fee.</summary>
        private double GetProcFee(string suffix, bool doUseMedicalCode)
        {
            Prefs.UpdateBool(PrefName.InsPpoAlwaysUseUcrFee, true);
            Prefs.UpdateBool(PrefName.MedicalFeeUsedForNewProcs, doUseMedicalCode);
            Patient pat            = PatientT.CreatePatient(suffix);
            long    ucrFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "UCR " + suffix);

            FeeSchedT.UpdateUCRFeeSched(pat, ucrFeeSchedNum);
            long ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", ppoFeeSchedNum, 1, true);
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            string         procStr      = "D0150";
            string         procStrMed   = "D0120";
            ProcedureCode  procCode     = ProcedureCodes.GetProcCode(procStr);
            ProcedureCode  procCodeMed  = ProcedureCodes.GetProcCode(procStrMed);

            procCode.MedicalCode = procCodeMed.ProcCode;
            FeeT.CreateFee(ucrFeeSchedNum, procCode.CodeNum, 300);
            FeeT.CreateFee(ppoFeeSchedNum, procCode.CodeNum, 120);
            FeeT.CreateFee(ucrFeeSchedNum, procCodeMed.CodeNum, 175);
            FeeT.CreateFee(ppoFeeSchedNum, procCodeMed.CodeNum, 85);
            Procedure proc = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", 300);

            return(Procedures.GetProcFee(pat, listPatPlans, listSubs, listPlans, procCode.CodeNum, proc.ProvNum, proc.ClinicNum, procCode.MedicalCode));
        }
Exemple #3
0
        ///<summary>Creates a procedure and computes estimates for a patient where the secondary insurance has a COB rule of Medicaid.</summary>
        private void ComputeEstimatesMedicaidCOB(string suffix, double procFee, double priAllowed, double secAllowed, int priPercentCovered,
                                                 int secPercentCovered, Action <ClaimProc /*Primary*/, ClaimProc /*Secondary*/, Procedure> assertAct)
        {
            Patient pat            = PatientT.CreatePatient(suffix);
            long    ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", ppoFeeSchedNum);
            long medicaidFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", medicaidFeeSchedNum, 2, cobRule: EnumCobRule.SecondaryMedicaid);
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            InsPlan        priPlan      = InsPlanT.GetPlanForPriSecMed(PriSecMed.Primary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateCategoryPercent(priPlan.PlanNum, EbenefitCategory.Diagnostic, priPercentCovered);
            InsPlan secPlan = InsPlanT.GetPlanForPriSecMed(PriSecMed.Secondary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateCategoryPercent(secPlan.PlanNum, EbenefitCategory.Diagnostic, secPercentCovered);
            List <Benefit> listBens = Benefits.Refresh(listPatPlans, listSubs);
            string         procStr  = "D0150";
            Procedure      proc     = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ProcedureCode  procCode = ProcedureCodes.GetProcCode(procStr);

            FeeT.CreateFee(ppoFeeSchedNum, procCode.CodeNum, priAllowed);
            FeeT.CreateFee(medicaidFeeSchedNum, procCode.CodeNum, secAllowed);
            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), false, listPlans, listPatPlans, listBens, pat.Age, listSubs);
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);

            assertAct(listClaimProcs.FirstOrDefault(x => x.PlanNum == priPlan.PlanNum), listClaimProcs.FirstOrDefault(x => x.PlanNum == secPlan.PlanNum), proc);
        }
Exemple #4
0
        public void Patients_GetPatientsByPartialName_LotsOfNames()
        {
            PatientT.CreatePatient(lName: "Salmon", fName: "Jason");
            PatientT.CreatePatient(lName: "Jansen", fName: "Andrew");
            List <Patient> listPats = Patients.GetPatientsByPartialName("andrew jansen thinks programming is fun");

            Assert.AreEqual(0, listPats.Count);
        }
Exemple #5
0
        public void Patients_GetPatientsByPartialName_FirstNotPreferred()
        {
            PatientT.CreatePatient(lName: "Brock", fName: "Taylor");
            PatientT.CreatePatient(lName: "McGehee", fName: "Christopher", preferredName: "Chris");
            List <Patient> listPats = Patients.GetPatientsByPartialName("chris owre");

            Assert.AreEqual(0, listPats.Count);
        }
Exemple #6
0
        public void Patients_GetPatientsByPartialName_JustLast()
        {
            PatientT.CreatePatient(lName: "Owre", fName: "Sam");
            PatientT.CreatePatient(lName: "Owre", fName: "Sarah");
            List <Patient> listPats = Patients.GetPatientsByPartialName("OWRE");

            Assert.AreEqual(2, listPats.Count);
        }
Exemple #7
0
        public void Patients_GetPatientsByPartialName_MatchTwoLastAndFirst()
        {
            PatientT.CreatePatient(lName: "OWRE", fName: "sam");
            PatientT.CreatePatient(lName: "Owre", fName: "sarah");
            List <Patient> listPats = Patients.GetPatientsByPartialName("owre s");

            Assert.AreEqual(2, listPats.Count);
        }
Exemple #8
0
        public void Patients_GetPatientsByPartialName_LastAndFirst()
        {
            PatientT.CreatePatient(lName: "Owre", fName: "Sam");
            PatientT.CreatePatient(lName: "Owre", fName: "Sarah");
            List <Patient> listPats = Patients.GetPatientsByPartialName("sam owre");

            Assert.AreEqual(1, listPats.Count);
        }
Exemple #9
0
        public void Patients_GetPatientsByPartialName_AllCaps()
        {
            PatientT.CreatePatient(lName: "Buchanan", fName: "Cameron");
            PatientT.CreatePatient(lName: "Montano", fName: "Joseph");
            List <Patient> listPats = Patients.GetPatientsByPartialName("CAMERON BUCHANAN");

            Assert.AreEqual(1, listPats.Count);
        }
Exemple #10
0
        public void Patients_GetPatientsByPartialName_TwoWordLastNamePlusFirst()
        {
            PatientT.CreatePatient(lName: "Owre", fName: "Sam");
            PatientT.CreatePatient(lName: "Van Damme", fName: "Jean-Claude");
            List <Patient> listPats = Patients.GetPatientsByPartialName("sam van damme");

            Assert.AreEqual(0, listPats.Count);
        }
Exemple #11
0
        public void Patients_GetPatientsByPartialName_LastAndPreferred()
        {
            PatientT.CreatePatient(lName: "Jansen", fName: "Andrew");
            PatientT.CreatePatient(lName: "Montano", fName: "Joseph", preferredName: "Joe");
            List <Patient> listPats = Patients.GetPatientsByPartialName("Joe Montano");

            Assert.AreEqual(1, listPats.Count);
        }
Exemple #12
0
        public void Patients_GetPatientsByPartialName_Everybody()
        {
            PatientT.CreatePatient(lName: "Buchanan", fName: "Cameron");
            PatientT.CreatePatient(lName: "Montano", fName: "Joseph");
            PatientT.CreatePatient(lName: "Owre", fName: "Sam");
            PatientT.CreatePatient(lName: "Owre", fName: "Sarah");
            PatientT.CreatePatient(lName: "Salmon", fName: "Jason");
            PatientT.CreatePatient(lName: "Jansen", fName: "Andrew");
            PatientT.CreatePatient(lName: "Van Damme", fName: "Jean-Claude");
            PatientT.CreatePatient(lName: "Brock", fName: "Taylor");
            PatientT.CreatePatient(lName: "McGehee", fName: "Christopher", preferredName: "Chris");
            List <Patient> listPats = Patients.GetPatientsByPartialName("");

            Assert.AreEqual(9, listPats.Count);
        }
Exemple #13
0
        public void Benefits_OverAgeWithLifetimeMax()
        {
            string        suffix = MethodBase.GetCurrentMethod().Name;
            Patient       pat    = PatientT.CreatePatient(suffix, birthDate: DateTime.Now.AddYears(-20));
            InsuranceInfo ins    = InsuranceT.AddInsurance(pat, suffix);

            BenefitT.CreateCategoryPercent(ins.PrimaryInsPlan.PlanNum, EbenefitCategory.Orthodontics, 50);
            BenefitT.CreateAgeLimitation(ins.PrimaryInsPlan.PlanNum, EbenefitCategory.Orthodontics, 18);
            BenefitT.CreateOrthoMax(ins.PrimaryInsPlan.PlanNum, 1000);
            ins.RefreshBenefits();
            Procedure        proc           = ProcedureT.CreateProcedure(pat, "D8090", ProcStat.TP, "", 3000);//comprehensive orthodontic treatment
            List <ClaimProc> listClaimProcs = ProcedureT.ComputeEstimates(pat, ins);

            Assert.AreEqual(0, listClaimProcs.First().InsEstTotal);
        }
Exemple #14
0
        public void PDMPLogicoy_GetURL_TestData()
        {
            long     provNum = ProviderT.CreateProvider("provPDMP", fName: "Barry", lName: "Anderson");
            Provider prov    = Providers.GetProv(provNum);

            prov.NationalProvID = "2621233875";
            Patient     pat                = PatientT.CreatePatient(fName: "Bilbo", lName: "Baggins", birthDate: new DateTime(1959, 12, 26), priProvNum: provNum);
            string      testUsername       = "******";
            string      testPassword       = "******";
            string      stateWhereLicensed = "IL";
            string      strDeaNum          = "BR3932553";
            string      facilityId         = "RVC";
            PDMPLogicoy pdmp               = new PDMPLogicoy(testUsername, testPassword, pat, prov, stateWhereLicensed, strDeaNum, facilityId);
            string      urlActual          = pdmp.GetURL();
            string      urlUniqueID        = ".*";//Ex: "68fa8c70-d253-417b-a438-13909ee2134d&amp;"
            string      urlExpected        = "https://openid\\.logicoy\\.com/pdmp/dataServices/getReport/fetchSummaryReport\\?SSOToken=" + urlUniqueID + "stateCode=IL";

            Assert.IsTrue(Regex.IsMatch(urlActual, urlExpected));
        }
Exemple #15
0
        public void Procedures_ComputeEstimates_PrimaryInsuranceMedicaidCOB()
        {
            string        suffix         = MethodBase.GetCurrentMethod().Name;
            Patient       pat            = PatientT.CreatePatient(suffix);
            long          ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);
            InsuranceInfo insInfo        = InsuranceT.AddInsurance(pat, suffix, "p", ppoFeeSchedNum, 1, cobRule: EnumCobRule.SecondaryMedicaid);
            InsPlan       priPlan        = InsPlanT.GetPlanForPriSecMed(PriSecMed.Primary, insInfo.ListPatPlans, insInfo.ListInsPlans, insInfo.ListInsSubs);

            BenefitT.CreateCategoryPercent(priPlan.PlanNum, EbenefitCategory.Diagnostic, percent: 50);
            List <Benefit> listBens = Benefits.Refresh(insInfo.ListPatPlans, insInfo.ListInsSubs);
            string         procStr  = "D0150";
            Procedure      proc     = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", 125);
            ProcedureCode  procCode = ProcedureCodes.GetProcCode(procStr);

            FeeT.CreateFee(ppoFeeSchedNum, procCode.CodeNum, amount: 80);
            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), false, insInfo.ListInsPlans, insInfo.ListPatPlans, listBens, pat.Age,
                                        insInfo.ListInsSubs);
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);

            Assert.AreEqual(40, listClaimProcs[0].InsEstTotal, 0.001);
            Assert.AreEqual(45, listClaimProcs[0].WriteOffEst, 0.001);
        }
Exemple #16
0
        public void Claims_CalculateAndUpdate_PreauthOrderWriteoff()
        {
            string suffix = MethodBase.GetCurrentMethod().Name;
            //create the patient and insurance information
            Patient pat = PatientT.CreatePatient(suffix);
            //proc - Crown
            Procedure proc         = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.C, "8", 1000);
            long      feeSchedNum1 = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix);

            FeeT.CreateFee(feeSchedNum1, proc.CodeNum, 900);
            Carrier carrier = CarrierT.CreateCarrier(suffix);
            InsPlan insPlan = InsPlanT.CreateInsPlanPPO(carrier.CarrierNum, feeSchedNum1);

            BenefitT.CreateAnnualMax(insPlan.PlanNum, 1000);
            BenefitT.CreateCategoryPercent(insPlan.PlanNum, EbenefitCategory.Crowns, 100);
            InsSub  sub = InsSubT.CreateInsSub(pat.PatNum, insPlan.PlanNum);
            PatPlan pp  = PatPlanT.CreatePatPlan(1, pat.PatNum, sub.InsSubNum);
            //create lists and variables required for ComputeEstimates()
            List <InsSub>    SubList         = InsSubs.RefreshForFam(Patients.GetFamily(pat.PatNum));
            List <InsPlan>   listInsPlan     = InsPlans.RefreshForSubList(SubList);
            List <PatPlan>   listPatPlan     = PatPlans.Refresh(pat.PatNum);
            List <Benefit>   listBenefits    = Benefits.Refresh(listPatPlan, SubList);
            List <Procedure> listProcsForPat = Procedures.Refresh(pat.PatNum);
            List <Procedure> procsForClaim   = new List <Procedure>();

            procsForClaim.Add(proc);
            //Create the claim and associated claimprocs
            //The order of these claimprocs is the whole point of the unit test.
            //Create Preauth
            ClaimProcs.CreateEst(new ClaimProc(), proc, insPlan, sub, 0, 500, true, true);
            //Create Estimate
            ClaimProcs.CreateEst(new ClaimProc(), proc, insPlan, sub, 1000, 1000, true, false);
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);
            Claim            claimWaiting   = ClaimT.CreateClaim("W", listPatPlan, listInsPlan, listClaimProcs, listProcsForPat, pat, procsForClaim, listBenefits, SubList, false);

            Assert.AreEqual(100, claimWaiting.WriteOff, "WriteOff Amount");
        }
Exemple #17
0
        ///<summary>Creates a procedure and computes estimates for a patient where the secondary insurance has a COB rule of Medicaid.</summary>
        private void ComputeEstimatesFixedBenefits(string suffix, double procFee, double ppoFee, double fixedBenefitFee
                                                   , int priPercentCoveredOverride, bool hasSecondary, double secFee, Action <FixedBenefitAssertItem> assertAct)
        {
            Patient       pat                     = PatientT.CreatePatient(suffix);
            string        procStr                 = "D0150";
            Procedure     proc                    = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ProcedureCode procCode                = ProcedureCodes.GetProcCode(procStr);
            long          ppoFeeSchedNum          = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);
            long          catPercFeeSchedNum      = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Category % " + suffix);
            long          fixedBenefitFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.FixedBenefit, "Fixed Benefit " + suffix);

            if (ppoFee > -1)
            {
                FeeT.CreateFee(ppoFeeSchedNum, procCode.CodeNum, ppoFee);
            }
            FeeT.CreateFee(fixedBenefitFeeSchedNum, procCode.CodeNum, fixedBenefitFee);
            InsuranceT.AddInsurance(pat, suffix, "p", ppoFeeSchedNum, copayFeeSchedNum: fixedBenefitFeeSchedNum);
            if (hasSecondary)
            {
                FeeT.CreateFee(catPercFeeSchedNum, procCode.CodeNum, secFee);
                InsuranceT.AddInsurance(pat, suffix, "", catPercFeeSchedNum, 2, false, EnumCobRule.Standard);
            }
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            InsPlan        priPlan      = InsPlanT.GetPlanForPriSecMed(PriSecMed.Primary, listPatPlans, listPlans, listSubs);
            InsPlan        secPlan      = null;

            if (hasSecondary)
            {
                secPlan = InsPlanT.GetPlanForPriSecMed(PriSecMed.Secondary, listPatPlans, listPlans, listSubs);
                //TODO:  Add diagnostic code benefit for 100%
                BenefitT.CreateCategoryPercent(secPlan.PlanNum, EbenefitCategory.Diagnostic, 100);
            }
            List <Benefit> listBens = Benefits.Refresh(listPatPlans, listSubs);

            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), false, listPlans, listPatPlans, listBens, pat.Age, listSubs);
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);

            if (priPercentCoveredOverride > 0)
            {
                foreach (ClaimProc cpCur in listClaimProcs)
                {
                    cpCur.PercentOverride = priPercentCoveredOverride;
                    ClaimProcs.Update(cpCur);
                }
                Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), false, listPlans, listPatPlans, listBens, pat.Age, listSubs);
                listClaimProcs = ClaimProcs.Refresh(pat.PatNum);
            }
            foreach (ClaimProc cpCur in listClaimProcs)
            {
                cpCur.PercentOverride = priPercentCoveredOverride;
                ClaimProcs.Update(cpCur);
            }
            Procedures.ComputeEstimates(proc, pat.PatNum, listClaimProcs, false, listPlans, listPatPlans, listBens, pat.Age, listSubs);
            listClaimProcs = ClaimProcs.Refresh(pat.PatNum);
            assertAct(new FixedBenefitAssertItem()
            {
                Procedure          = proc,
                PrimaryClaimProc   = listClaimProcs.FirstOrDefault(x => x.PlanNum == priPlan.PlanNum),
                SecondaryClaimProc = secPlan == null ? null : listClaimProcs.FirstOrDefault(x => x.PlanNum == secPlan.PlanNum),
            });
        }
Exemple #18
0
 public void RunBeforeEachTest()
 {
     PatientT.ClearPatientTable();
 }