///<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); }
///<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); }
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); }
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); }
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"); }
///<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), }); }
private void butRun_Click(object sender, EventArgs e) { textResults.Text = ""; Application.DoEvents(); Cursor = Cursors.WaitCursor; if (!DatabaseTools.SetDbConnection("unittest", false)) //if database doesn't exist { DatabaseTools.SetDbConnection("", false); textResults.Text += DatabaseTools.FreshFromDump(false); //this also sets database to be unittest. } else { textResults.Text += DatabaseTools.ClearDb(); } try{ textResults.Text += BenefitT.BenefitComputeRenewDate(); } catch (Exception ex) { textResults.Text += ex.Message; //failed } try { textResults.Text += ToothT.FormatRanges(); } catch (Exception ex) { textResults.Text += ex.Message; //failed } int specificTest = 0; try { Application.DoEvents(); specificTest = PIn.Int(textSpecificTest.Text); //typically zero textResults.Text += AllTests.TestOneTwo(specificTest); } catch (Exception ex) { textResults.Text += "1&2: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestThree(specificTest); } catch (Exception ex) { textResults.Text += "3: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestFour(specificTest); } catch (Exception ex) { textResults.Text += "4: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestFive(specificTest); } catch (Exception ex) { textResults.Text += "5: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestSix(specificTest); } catch (Exception ex) { textResults.Text += "6: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestSeven(specificTest); } catch (Exception ex) { textResults.Text += "7: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestEight(specificTest); } catch (Exception ex) { textResults.Text += "8: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestNine(specificTest); } catch (Exception ex) { textResults.Text += "9: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestTen(specificTest); } catch (Exception ex) { textResults.Text += "10: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestEleven(specificTest); } catch (Exception ex) { textResults.Text += "11: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwelve(specificTest); } catch (Exception ex) { textResults.Text += "12: Failed. " + ex.Message + "\r\n"; } try { Application.DoEvents(); textResults.Text += AllTests.TestThirteen(specificTest); } catch (Exception ex) { textResults.Text += "13: Failed. " + ex.Message + "\r\n"; } //try {//There is a phantom TestFourteen that has been commented out. It is similary to TestOne. // Application.DoEvents(); // textResults.Text+=AllTests.TestFourteen(specificTest); //} //catch(Exception ex) { // textResults.Text+="14: Failed. "+ex.Message+"\r\n"; //} try { Application.DoEvents(); textResults.Text += AllTests.TestFourteen(specificTest); } catch (Exception ex) { textResults.Text += "14: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestFifteen(specificTest); } catch (Exception ex) { textResults.Text += "15: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestSixteen(specificTest); } catch (Exception ex) { textResults.Text += "16: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestSeventeen(specificTest); } catch (Exception ex) { textResults.Text += "17: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestEighteen(specificTest); } catch (Exception ex) { textResults.Text += "18: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestNineteen(specificTest); } catch (Exception ex) { textResults.Text += "19: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwenty(specificTest); } catch (Exception ex) { textResults.Text += "20: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentyOne(specificTest); } catch (Exception ex) { textResults.Text += "21: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentyTwo(specificTest); } catch (Exception ex) { textResults.Text += "22: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentyThree(specificTest); } catch (Exception ex) { textResults.Text += "23: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentyFour(specificTest); } catch (Exception ex) { textResults.Text += "24: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentyFive(specificTest); } catch (Exception ex) { textResults.Text += "25: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentySix(specificTest); } catch (Exception ex) { textResults.Text += "26: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentySeven(specificTest); } catch (Exception ex) { textResults.Text += "27: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentyEight(specificTest); } catch (Exception ex) { textResults.Text += "28: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestTwentyNine(specificTest); } catch (Exception ex) { textResults.Text += "29: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestThirty(specificTest); } catch (Exception ex) { textResults.Text += "30: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestThirtyOne(specificTest); } catch (Exception ex) { textResults.Text += "31: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestThirtyTwo(specificTest); } catch (Exception ex) { textResults.Text += "32: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestThirtyThree(specificTest); } catch (Exception ex) { textResults.Text += "33: Failed. " + ex.Message; } try { Application.DoEvents(); textResults.Text += AllTests.TestThirtyFour(specificTest); } catch (Exception ex) { textResults.Text += "34: Failed. " + ex.Message; } textResults.Text += "Done"; Cursor = Cursors.Default; }