///<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); }
///<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)); }
///<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); }
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), }); }