public void InsPlan_GetInsUsedDisplay_OrthoProcsNotAffectInsUsed() { string suffix = "13"; Patient pat = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub sub = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum); long subNum = sub.InsSubNum; PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum); BenefitT.CreateAnnualMax(plan.PlanNum, 100); BenefitT.CreateOrthoMax(plan.PlanNum, 500); BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Diagnostic, 100); BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Orthodontics, 100); Procedure proc1 = ProcedureT.CreateProcedure(pat, "D0140", ProcStat.C, "", 59); //limEx Procedure proc2 = ProcedureT.CreateProcedure(pat, "D8090", ProcStat.C, "", 348); //Comprehensive ortho ClaimProcT.AddInsPaid(pat.PatNum, plan.PlanNum, proc1.ProcNum, 59, subNum, 0, 0); ClaimProcT.AddInsPaid(pat.PatNum, plan.PlanNum, proc2.ProcNum, 348, subNum, 0, 0); //Lists Family fam = Patients.GetFamily(pat.PatNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(pat.PatNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <ClaimProcHist> histList = ClaimProcs.GetHistList(pat.PatNum, benefitList, patPlans, planList, DateTime.Today, subList); //Validate double insUsed = InsPlans.GetInsUsedDisplay(histList, DateTime.Today, plan.PlanNum, patPlan.PatPlanNum, -1, planList, benefitList, pat.PatNum, subNum); Assert.AreEqual(59, insUsed); }
public void PaymentEdit_Init_AutoSplitWithClaimPayments() //Legacy_TestFortyEight { string suffix = "48"; Patient pat = PatientT.CreatePatient(suffix); long patNum = pat.PatNum; InsPlan insPlan = InsPlanT.CreateInsPlan(CarrierT.CreateCarrier(suffix).CarrierNum); InsSub insSub = InsSubT.CreateInsSub(patNum, insPlan.PlanNum); PatPlan patPlan = PatPlanT.CreatePatPlan(1, patNum, insSub.InsSubNum); Procedure procedure1 = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 50, DateTime.Now.AddDays(-1)); Procedure procedure2 = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 40, DateTime.Now.AddDays(-2)); Procedure procedure3 = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 60, DateTime.Now.AddDays(-3)); ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure1.ProcNum, 20, insSub.InsSubNum, 0, 0); ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure2.ProcNum, 5, insSub.InsSubNum, 5, 0); ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure3.ProcNum, 20, insSub.InsSubNum, 0, 10); Payment payment = PaymentT.MakePaymentNoSplits(patNum, 150, DateTime.Today); Family famForPat = Patients.GetFamily(patNum); List <Patient> listFamForPat = famForPat.ListPats.ToList(); PaymentEdit.InitData init = PaymentEdit.Init(listFamForPat, famForPat, new Family { }, payment, new List <PaySplit>(), new List <Procedure>(), patNum); //Auto Splits will be in opposite order from least recent to most recent. //ListSplitsCur should contain four splits, 30, 35, and 30, then one unallocated for the remainder of the payment 55. Assert.AreEqual(4, init.AutoSplitData.ListSplitsCur.Count); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[0].SplitAmt != 40 || init.AutoSplitData.ListSplitsCur[0].ProcNum != procedure3.ProcNum || init.AutoSplitData.ListSplitsCur[0].PatNum != patNum); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[1].SplitAmt != 35 || init.AutoSplitData.ListSplitsCur[1].ProcNum != procedure2.ProcNum || init.AutoSplitData.ListSplitsCur[1].PatNum != patNum); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[2].SplitAmt != 30 || init.AutoSplitData.ListSplitsCur[2].ProcNum != procedure1.ProcNum || init.AutoSplitData.ListSplitsCur[2].PatNum != patNum); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[3].SplitAmt != 45 || init.AutoSplitData.ListSplitsCur[3].ProcNum != 0); }
public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverridePosterior() { //First, setup the test scenario. string suffix = MethodBase.GetCurrentMethod().Name; Patient pat = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name); InsPlan plan = new InsPlan(); plan.CarrierNum = carrier.CarrierNum; plan.PlanType = ""; plan.CobRule = EnumCobRule.Basic; plan.PlanNum = InsPlans.Insert(plan); //Procedure code does not have a substitution code ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2740"); //clear out any substitution codes on this procedure originalProcCode.SubstitutionCode = ""; ProcedureCodeT.Update(originalProcCode); //Add an override for the inplan above for the originalProcCode to substitute if posterior ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2750"); SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Posterior, plan.PlanNum); //Posterior procedure Procedure proc = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "4", 100);//Tooth 4 long subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum); //The ins override is set to substitute only if posterior. Assert.AreEqual(downgradeProcCodeForIns.CodeNum, subCodeNum); }
public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverrideAlways() { //First, setup the test scenario. string suffix = MethodBase.GetCurrentMethod().Name; Patient pat = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name); InsPlan plan = new InsPlan(); plan.CarrierNum = carrier.CarrierNum; plan.PlanType = ""; plan.CobRule = EnumCobRule.Basic; plan.PlanNum = InsPlans.Insert(plan); //Add a substitution code on the procedure level. ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2330"); ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2140"); originalProcCode.SubstitutionCode = "D2140"; originalProcCode.SubstOnlyIf = SubstitutionCondition.Always; ProcedureCodeT.Update(originalProcCode); //Add an override for the inplan above for the originalProcCode ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2150"); SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Always, plan.PlanNum); //Next, perform the thing you're trying to test. Procedure proc = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "9", 100);//Tooth 9 long subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum); //Finally, use one or more asserts to verify the results. Assert.AreEqual(downgradeProcCodeForIns.CodeNum, subCodeNum); }
public void ProcedureCodes_GetSubstituteCodeNum_Posterior() { //First, setup the test scenario. string suffix = MethodBase.GetCurrentMethod().Name; Patient pat = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name); InsPlan plan = new InsPlan(); plan.CarrierNum = carrier.CarrierNum; plan.PlanType = ""; plan.CobRule = EnumCobRule.Basic; plan.PlanNum = InsPlans.Insert(plan); //Add a substitution code on the procedure level. ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2740"); ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2750"); originalProcCode.SubstitutionCode = "D2750"; originalProcCode.SubstOnlyIf = SubstitutionCondition.Posterior; ProcedureCodeT.Update(originalProcCode); //Posterior Procedure= ToothNum 4 Procedure proc = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "4", 100);//Tooth 4 long subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum); //Finally, use one or more asserts to verify the results. Assert.AreEqual(downgradeProcCode.CodeNum, subCodeNum); }
public void RpProcNotBilledIns_GetProcsNotBilled_MedicalInsOnly() { string suffix = MethodBase.GetCurrentMethod().Name; Patient patient = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(suffix); ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("T7782"); //Create a primary medical insurance plan InsuranceInfo insuranceInfo = InsuranceT.AddInsurance(patient, carrier.CarrierName, ordinal: 1, isMedical: true); insuranceInfo.AddBenefit(BenefitT.CreatePercentForProc(insuranceInfo.MedInsPlan.PlanNum, procedureCode.CodeNum, 80)); Procedure procedure = ProcedureT.CreateProcedure(patient, procedureCode.ProcCode, ProcStat.TP, "", 55, procDate: DateTime.Now.AddDays(-3)); ProcedureT.ComputeEstimates(patient, insuranceInfo); ProcedureT.SetComplete(procedure, patient, insuranceInfo); //Run the procs not billed report with "includeMedProcs" set to false. //The patient should not be returned due to not having any dental insurance estimates. DataTable table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), false, DateTime.Now.AddDays(-10), DateTime.Now, false, false); Assert.IsNotNull(table); Assert.IsFalse(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); //Run the procs not billed report with "includeMedProcs" set to true. //The patient should be returned due to the medical insurance estimates. table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), true, DateTime.Now.AddDays(-10), DateTime.Now, false, false); Assert.IsNotNull(table); Assert.IsTrue(table.Rows.Count > 0); Assert.IsTrue(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); }
public void InsPlan_GetPendingDisplay_LimitationsOverrideGeneralLimitations() { string suffix = "31"; Patient pat = PatientT.CreatePatient(suffix); long patNum = pat.PatNum; Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); long planNum = plan.PlanNum; InsSub sub = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber long subNum = sub.InsSubNum; long patPlanNum = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum).PatPlanNum; BenefitT.CreateAnnualMax(planNum, 1000); BenefitT.CreateCategoryPercent(planNum, EbenefitCategory.RoutinePreventive, 100); BenefitT.CreateLimitation(planNum, EbenefitCategory.RoutinePreventive, 1000); //Changing this amount would affect patient portion vs ins portion. But regardless of the amount, this should prevent any pending from showing in the box, which is for general pending only. Procedure proc = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 125); //Prophy //Lists List <ClaimProc> claimProcs = ClaimProcs.Refresh(pat.PatNum); Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <Procedure> ProcList = Procedures.Refresh(pat.PatNum); Claim claim = ClaimT.CreateClaim("P", patPlans, planList, claimProcs, ProcList, pat, ProcList, benefitList, subList);//Creates the claim in the same manner as the account module, including estimates and status NotReceived. List <ClaimProcHist> histList = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList); //Validate Assert.AreEqual(0, InsPlans.GetPendingDisplay(histList, DateTime.Today, plan, patPlanNum, -1, patNum, subNum, benefitList)); }
public void InsPlan_GetInsUsedDisplay_LimitationsOverride() { string suffix = "6"; Patient pat = PatientT.CreatePatient(suffix); long patNum = pat.PatNum; Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); long planNum = plan.PlanNum; InsSub sub = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber long subNum = sub.InsSubNum; long patPlanNum = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum).PatPlanNum; BenefitT.CreateAnnualMax(planNum, 1000); BenefitT.CreateLimitation(planNum, EbenefitCategory.Diagnostic, 1000); Procedure proc = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 50); //An exam long procNum = proc.ProcNum; Procedure proc2 = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.C, "8", 830); //create a crown ClaimProcT.AddInsPaid(patNum, planNum, procNum, 50, subNum, 0, 0); ClaimProcT.AddInsPaid(patNum, planNum, proc2.ProcNum, 400, subNum, 0, 0); //Lists Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <ClaimProcHist> histList = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList); //Validate double insUsed = InsPlans.GetInsUsedDisplay(histList, DateTime.Today, planNum, patPlanNum, -1, planList, benefitList, patNum, subNum); Assert.AreEqual(400, insUsed); }
private InsPlan GeneratePPOPlan(string suffix, bool codeSubstNone = true) { long baseFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Normal_" + suffix, true); Carrier carrier = CarrierT.CreateCarrier("Carrier_" + suffix); return(InsPlanT.CreateInsPlanPPO(carrier.CarrierNum, baseFeeSchedNum, codeSubstNone)); }
public void InsPlans_ComputeEstimatesForSubscriber_CanadianLabFees() { string suffix = MethodBase.GetCurrentMethod().Name; CultureInfo curCulture = CultureInfo.CurrentCulture; Thread.CurrentThread.CurrentCulture = new CultureInfo("en-CA"); //Canada try { //Create a patient and treatment plan a procedure with a lab fee. Patient pat = PatientT.CreatePatient(); ProcedureCodeT.AddIfNotPresent("14611"); ProcedureCodeT.AddIfNotPresent("99111", isCanadianLab: true); Procedure proc = ProcedureT.CreateProcedure(pat, "14611", ProcStat.TP, "", 250); Procedure procLab = ProcedureT.CreateProcedure(pat, "99111", ProcStat.TP, "", 149, procNumLab: proc.ProcNum); //Create a new primary insurance plan for this patient. //It is important that we add the insurance plan after the procedure has already been created for this particular scenario. Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub sub = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum); PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, sub.InsSubNum); //Invoking ComputeEstimatesForAll() will simulate the logic of adding a new insurance plan from the Family module. //The bug that this unit test is preventing is that a duplicate claimproc was being created for the lab fee. //This was causing a faux line to show up when a claim was created for the procedure in question. //It ironically doesn't matter if the procedures above are even covered by insurance because they'll get claimprocs created regardless. InsPlans.ComputeEstimatesForSubscriber(sub.Subscriber); //Check to see how many claimproc enteries there are for the current patient. There should only be two. List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum); Assert.AreEqual(2, listClaimProcs.Count); } finally { Thread.CurrentThread.CurrentCulture = curCulture; } }
public void InsPlans_GetAllowed_NoFeeSched() { Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name); InsPlan plan = new InsPlan(); plan.CarrierNum = carrier.CarrierNum; plan.PlanType = ""; plan.CobRule = EnumCobRule.Basic; plan.PlanNum = InsPlans.Insert(plan); ProcedureCode procCode = _listProcCodes[13]; procCode.SubstitutionCode = _listProcCodes[14].ProcCode; ProcedureCodes.Update(procCode); ProcedureCodes.RefreshCache(); Provider prov = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv)); long provFeeSched = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name); prov.FeeSched = provFeeSched; Providers.Update(prov); Providers.RefreshCache(); Fee defaultFee = FeeT.GetNewFee(Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv)).FeeSched, ProcedureCodes.GetSubstituteCodeNum(procCode.ProcCode, "", plan.PlanNum), 80); double amt = InsPlans.GetAllowed(procCode.ProcCode, plan.FeeSched, plan.AllowedFeeSched, plan.CodeSubstNone, plan.PlanType, "", 0, 0, plan.PlanNum); Assert.AreEqual(defaultFee.Amount, amt); }
public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverrideNever() { //First, setup the test scenario. string suffix = MethodBase.GetCurrentMethod().Name; Patient pat = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name); InsPlan plan = new InsPlan(); plan.CarrierNum = carrier.CarrierNum; plan.PlanType = ""; plan.CobRule = EnumCobRule.Basic; plan.PlanNum = InsPlans.Insert(plan); //Add a substitution code on the procedure level that has SubstitutionCondition.Never. ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2330"); //clear out any substitution codes on this procedure originalProcCode.SubstitutionCode = ""; ProcedureCodeT.Update(originalProcCode); //Add an override for the inplan above for the originalProcCode to never substitute ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2150"); SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Never, plan.PlanNum); //Next, perform the thing you're trying to test. Procedure proc = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "9", 100);//Tooth 9 long subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum); //The procedure level and ins override is set SubstitutionCondition.Never so it should use originalProcCode.CodeNum Assert.AreEqual(originalProcCode.CodeNum, subCodeNum); }
private InsPlan GenerateMediFlatInsPlan(string suffix, bool codeSubstNone = true) { long baseFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Normal_" + suffix, true); long copayFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.CoPay, "Copay_" + suffix, true); Carrier carrier = CarrierT.CreateCarrier("Carrier_" + suffix); return(InsPlanT.CreateInsPlanMediFlatCopay(carrier.CarrierNum, baseFeeSchedNum, copayFeeSchedNum, codeSubstNone)); }
public void X271_EB271_SetInsuranceHistoryDates() { Patient pat = PatientT.CreatePatient(lName: "Doe", fName: "John"); Carrier carrier = CarrierT.CreateCarrier("X271Test"); InsPlan insPlan = InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub insSub = InsSubT.CreateInsSub(pat.PatNum, insPlan.PlanNum); List <EB271> listEb = _x271.GetListEB(true, carrier.IsCoinsuranceInverted); int countValidInsHist = EB271.SetInsuranceHistoryDates(listEb, pat.PatNum, insSub); Assert.AreEqual(3, countValidInsHist); //There are 4 valid fields but 1 has an invalid date. }
private InsPlan GenerateCapPlan(string suffix, bool createAllowed = true, bool codeSubstNone = true) { long baseFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Normal_" + suffix, true); long allowedFeeSchedNum = 0; if (createAllowed) { allowedFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Allowed_" + suffix, true); } Carrier carrier = CarrierT.CreateCarrier("Carrier_" + suffix); return(InsPlanT.CreateInsPlanCapitation(carrier.CarrierNum, baseFeeSchedNum, allowedFeeSchedNum, codeSubstNone)); }
public void TearDownTest() { BenefitT.ClearBenefitTable(); CarrierT.ClearCarrierTable(); ClaimT.ClearClaimTable(); ClaimProcT.ClearClaimProcTable(); EtransT.ClearEtransTable(); InsPlanT.ClearInsPlanTable(); InsSubT.ClearInsSubTable(); PatientT.ClearPatientTable(); PatPlanT.ClearPatPlanTable(); ProcedureT.ClearProcedureTable(); SubstitutionLinkT.ClearSubstitutionLinkTable(); }
public void InsPlan_GetDedRemainDisplay_IndividualAndFamilyDeductiblesInsRemaining() { string suffix = "20"; Patient pat = PatientT.CreatePatient(suffix); //guarantor long patNum = pat.PatNum; Patient pat2 = PatientT.CreatePatient(suffix); PatientT.SetGuarantor(pat2, pat.PatNum); Patient pat3 = PatientT.CreatePatient(suffix); PatientT.SetGuarantor(pat3, pat.PatNum); Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); long planNum = plan.PlanNum; InsSub sub = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber long subNum = sub.InsSubNum; PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum); //all three patients have the same plan PatPlan patPlan2 = PatPlanT.CreatePatPlan(1, pat2.PatNum, subNum); //all three patients have the same plan PatPlan patPlan3 = PatPlanT.CreatePatPlan(1, pat3.PatNum, subNum); //all three patients have the same plan BenefitT.CreateDeductibleGeneral(planNum, BenefitCoverageLevel.Individual, 75); BenefitT.CreateDeductibleGeneral(planNum, BenefitCoverageLevel.Family, 150); ClaimProcT.AddInsUsedAdjustment(pat3.PatNum, planNum, 0, subNum, 75); //Adjustment goes on the third patient Procedure proc = ProcedureT.CreateProcedure(pat2, "D2750", ProcStat.C, "20", 1280); //proc for second patient with a deductible already applied. ClaimProcT.AddInsPaid(pat2.PatNum, planNum, proc.ProcNum, 304, subNum, 50, 597); proc = ProcedureT.CreateProcedure(pat, "D4355", ProcStat.TP, "", 135); //proc is for the first patient long procNum = proc.ProcNum; //Lists List <ClaimProc> claimProcs = ClaimProcs.Refresh(patNum); Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <ClaimProcHist> histList = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList); List <ClaimProcHist> loopList = new List <ClaimProcHist>(); //Validate List <ClaimProcHist> HistList = ClaimProcs.GetHistList(pat.PatNum, benefitList, patPlans, planList, DateTime.Today, subList); double dedFam = Benefits.GetDeductGeneralDisplay(benefitList, planNum, patPlan.PatPlanNum, BenefitCoverageLevel.Family); double ded = Benefits.GetDeductGeneralDisplay(benefitList, planNum, patPlan.PatPlanNum, BenefitCoverageLevel.Individual); double dedRem = InsPlans.GetDedRemainDisplay(HistList, DateTime.Today, planNum, patPlan.PatPlanNum, -1, planList, pat.PatNum, ded, dedFam); //test family and individual deductible together Assert.AreEqual(25, dedRem); dedRem = InsPlans.GetDedRemainDisplay(HistList, DateTime.Today, planNum, patPlan.PatPlanNum, -1, planList, pat.PatNum, ded, -1); //test individual deductible by itself Assert.AreEqual(75, dedRem); }
public void Claims_CalculateAndUpdate_ProcedureCodeDowngradeHigherFee() { string suffix = "61"; Patient pat = PatientT.CreatePatient(suffix); long ucrFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "UCR Fees" + suffix); long ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO Downgrades" + suffix); Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub sub = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum); long subNum = sub.InsSubNum; BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Restorative, 100); PatPlanT.CreatePatPlan(1, pat.PatNum, subNum); ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2391"); ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2140"); originalProcCode.SubstitutionCode = "D2140"; originalProcCode.SubstOnlyIf = SubstitutionCondition.Always; ProcedureCodes.Update(originalProcCode); FeeT.CreateFee(ucrFeeSchedNum, originalProcCode.CodeNum, 140); FeeT.CreateFee(ucrFeeSchedNum, downgradeProcCode.CodeNum, 120); FeeT.CreateFee(ppoFeeSchedNum, originalProcCode.CodeNum, 80); FeeT.CreateFee(ppoFeeSchedNum, downgradeProcCode.CodeNum, 100); Procedure proc = ProcedureT.CreateProcedure(pat, "D2391", ProcStat.C, "1", 140);//Tooth 1 List <ClaimProc> claimProcs = ClaimProcs.Refresh(pat.PatNum); List <ClaimProc> claimProcListOld = new List <ClaimProc>(); Family fam = Patients.GetFamily(pat.PatNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(pat.PatNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <Procedure> ProcList = Procedures.Refresh(pat.PatNum); InsPlan insPlan = planList[0];//Should only be one InsPlan planOld = insPlan.Copy(); insPlan.PlanType = "p"; insPlan.FeeSched = ppoFeeSchedNum; InsPlans.Update(insPlan, planOld); //Creates the claim in the same manner as the account module, including estimates. Claim claim = ClaimT.CreateClaim("P", patPlans, planList, claimProcs, ProcList, pat, ProcList, benefitList, subList); ClaimProc clProc = ClaimProcs.Refresh(pat.PatNum)[0]; //Should only be one Assert.AreEqual(80, clProc.InsEstTotal); Assert.AreEqual(60, clProc.WriteOff); }
public void RpProcNotBilledIns_GetProcsNotBilled_ShowProcsBeforeIns() { string suffix = MethodBase.GetCurrentMethod().Name; Patient patient = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(suffix); ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("T7782"); Procedure procedure = ProcedureT.CreateProcedure(patient, procedureCode.ProcCode, ProcStat.C, "", 55, procDate: DateTime.Now.AddDays(-3)); //Add insurance after the procedure has been set complete. InsuranceInfo insuranceInfo = InsuranceT.AddInsurance(patient, carrier.CarrierName, ordinal: 1, isMedical: true); //The patient should not be returned when 'showProcsBeforeIns' is set to false. DataTable table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), false, DateTime.Now.AddDays(-10), DateTime.Now, false, false); Assert.IsNotNull(table); Assert.IsFalse(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); //The patient should be returned when 'showProcsBeforeIns' is set to true. table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), true, DateTime.Now.AddDays(-10), DateTime.Now, true, false); Assert.IsNotNull(table); Assert.IsTrue(table.Rows.Count > 0); Assert.IsTrue(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum)); }
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"); }
public void Claims_CalculateAndUpdate_Allowed1Allowed2CompletedProcedures() { string suffix = "8"; Patient pat = PatientT.CreatePatient(suffix); long patNum = pat.PatNum; long feeSchedNum1 = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix); long feeSchedNum2 = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix + "b"); //Standard Fee long codeNum = ProcedureCodes.GetCodeNum("D2750"); Fee fee = Fees.GetFee(codeNum, 53, 0, 0); if (fee == null) { fee = new Fee(); fee.CodeNum = codeNum; fee.FeeSched = 53; fee.Amount = 1200; Fees.Insert(fee); } else { fee.Amount = 1200; Fees.Update(fee); } //PPO fees fee = new Fee(); fee.CodeNum = codeNum; fee.FeeSched = feeSchedNum1; fee.Amount = 600; Fees.Insert(fee); fee = new Fee(); fee.CodeNum = codeNum; fee.FeeSched = feeSchedNum2; fee.Amount = 800; Fees.Insert(fee); //Carrier Carrier carrier = CarrierT.CreateCarrier(suffix); long planNum1 = InsPlanT.CreateInsPlanPPO(carrier.CarrierNum, feeSchedNum1).PlanNum; long planNum2 = InsPlanT.CreateInsPlanPPO(carrier.CarrierNum, feeSchedNum2).PlanNum; InsSub sub1 = InsSubT.CreateInsSub(pat.PatNum, planNum1); long subNum1 = sub1.InsSubNum; InsSub sub2 = InsSubT.CreateInsSub(pat.PatNum, planNum2); long subNum2 = sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum1, EbenefitCategory.Crowns, 50); BenefitT.CreateCategoryPercent(planNum2, EbenefitCategory.Crowns, 50); BenefitT.CreateAnnualMax(planNum1, 1000); BenefitT.CreateAnnualMax(planNum2, 1000); PatPlanT.CreatePatPlan(1, patNum, subNum1); PatPlanT.CreatePatPlan(2, patNum, subNum2); Procedure proc = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.TP, "8", Fees.GetAmount0(codeNum, 53)); //crown on 8 long procNum = proc.ProcNum; //Lists List <ClaimProc> claimProcs = ClaimProcs.Refresh(patNum); Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <Procedure> procList = Procedures.Refresh(patNum); //Set complete and attach to claim ProcedureT.SetComplete(proc, pat, planList, patPlans, claimProcs, benefitList, subList); claimProcs = ClaimProcs.Refresh(patNum); List <Procedure> procsForClaim = new List <Procedure>(); procsForClaim.Add(proc); Claim claim = ClaimT.CreateClaim("P", patPlans, planList, claimProcs, procList, pat, procsForClaim, benefitList, subList); //Validate Assert.AreEqual(500, claim.WriteOff); }