Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void LedgersTests_ComputeAgingForPaysplitsAllocatedToDiffPats()
        {
            string  suffix   = MethodBase.GetCurrentMethod().Name;
            Patient patDad   = PatientT.CreatePatient(fName: "Father", suffix: suffix);     //Father-guarantor
            Patient patChild = PatientT.CreatePatient(fName: "Child", suffix: suffix);      //Child

            PatientT.SetGuarantor(patChild, patDad.PatNum);
            Procedure proc1 = ProcedureT.CreateProcedure(patChild, "D1110", ProcStat.C, "", 50, DateTime.Today.AddDays(-45));
            Procedure proc2 = ProcedureT.CreateProcedure(patChild, "D0120", ProcStat.C, "", 40, DateTime.Today.AddDays(-45));

            Ledgers.ComputeAging(patDad.PatNum, DateTime.Today);
            patDad = Patients.GetPat(patDad.PatNum);
            Assert.AreEqual(90, patDad.Bal_31_60);
            Patient patMom = PatientT.CreatePatient(fName: "Mom", suffix: suffix);       //Mom is not associated to the father and childs account
            long    patNum = patMom.PatNum;
            //complete procedures for patMom.
            Procedure proc3 = ProcedureT.CreateProcedure(patMom, "D1110", ProcStat.C, "", 50, DateTime.Today.AddDays(-1));
            Procedure proc4 = ProcedureT.CreateProcedure(patMom, "D0120", ProcStat.C, "", 40, DateTime.Today.AddDays(-1));

            //Compute aging. Check that the aging is correct before we continue
            Ledgers.ComputeAging(patNum, DateTime.Today);
            patMom = Patients.GetPat(patNum);
            Assert.AreEqual(90, patMom.Bal_0_30);
            //patMom will now make a payment for her procedures and patChilds
            Payment         pay           = PaymentT.MakePaymentNoSplits(patNum, 100, clinicNum: proc3.ClinicNum);
            List <PaySplit> listPaySplits = new List <PaySplit>();

            listPaySplits.Add(PaySplitT.CreateSplit(proc3.ClinicNum, patNum, pay.PayNum, 0, DateTime.Today, proc3.ProcNum, proc3.ProvNum, 50, 0));
            //Create a paysplit for patChild. PatChild is from a different family.
            listPaySplits.Add(PaySplitT.CreateSplit(proc1.ClinicNum, patChild.PatNum, pay.PayNum, 0, DateTime.Today, proc1.ProcNum, proc1.ProvNum, 50, 0));
            //This should compute the aging for the
            string strErrorMsg = Ledgers.ComputeAgingForPaysplitsAllocatedToDiffPats(patNum, listPaySplits);

            Assert.IsTrue(string.IsNullOrEmpty(strErrorMsg));
            patDad = Patients.GetPat(patDad.PatNum);
            Assert.AreEqual(40, patDad.Bal_31_60);
            //Compute patMom aging to verify that it is correct.
            Ledgers.ComputeAging(patNum, DateTime.Today);
            patMom = Patients.GetPat(patNum);
            Assert.AreEqual(40, patMom.Bal_0_30);
        }