Exemplo n.º 1
0
        public void FeeSchedTools_ImportCanada()
        {
            string canadianCodes = Properties.Resources.canadianprocedurecodes;

            //If we need to import these procedures codes, do so
            foreach (string line in canadianCodes.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
            {
                string[] properties = line.Split('\t');
                if (properties.Count() != 10)
                {
                    continue;
                }
                if (ProcedureCodes.GetCodeNum(properties[0]) != 0)
                {
                    continue;
                }
                ProcedureCode procCode = new ProcedureCode()
                {
                    ProcCode = properties[0],
                    Descript = properties[1],
                    ProcTime = properties[8],
                    AbbrDesc = properties[9],
                };
                ProcedureCodes.Insert(procCode);
            }
            //Now import the fees
            string     feeData     = Properties.Resources.BC_BCDA_2018_GPOOC;
            FeeSched   feeSched    = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name, isGlobal: false);
            List <Fee> listNewFees = FeeScheds.ImportCanadaFeeSchedule2(feeSched, feeData, 0, 0, out int numImported, out int numSkipped);

            Assert.IsTrue(DoAmountsMatch(listNewFees, feeSched.FeeSchedNum, 0, 0));
        }
Exemplo n.º 2
0
        public void FeeSchedTools_GlobalUpdateFees()
        {
            PrefT.UpdateBool(PrefName.MedicalFeeUsedForNewProcs, false);
            string        suffix    = MethodBase.GetCurrentMethod().Name;
            string        procStr   = "D0120";
            string        procStr2  = "D0145";
            double        procFee   = 100;
            ProcedureCode procCode  = ProcedureCodes.GetProcCode(procStr);
            ProcedureCode procCode2 = ProcedureCodes.GetProcCode(procStr2);
            //Set up clinic, prov, pat
            Clinic  clinic      = ClinicT.CreateClinic(suffix);
            long    feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix, false);
            long    provNum     = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum);
            Fee     fee         = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum);
            Fee     fee2        = FeeT.GetNewFee(feeSchedNum, procCode2.CodeNum, procFee, clinic.ClinicNum, provNum);
            Patient pat         = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum);
            //Chart a procedure for this proccode/pat as well as a different proccode
            Procedure proc  = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", fee.Amount);
            Procedure proc2 = ProcedureT.CreateProcedure(pat, procStr2, ProcStat.TP, "", fee2.Amount);

            //Update the fee amount for only the D0120 code
            fee.Amount = 50;
            Fees.Update(fee);
            //Now run global update fees
            Procedures.GlobalUpdateFees(Fees.GetByClinicNum(clinic.ClinicNum), clinic.ClinicNum, clinic.Abbr);
            //Make sure we have the same number of updated fees, and fee amounts for both procs
            proc  = Procedures.GetOneProc(proc.ProcNum, false);
            proc2 = Procedures.GetOneProc(proc2.ProcNum, false);
            Assert.AreEqual(fee.Amount, proc.ProcFee);
            Assert.AreEqual(fee2.Amount, proc2.ProcFee);
        }
Exemplo n.º 3
0
        public void InsPlan_PpoNoSubWriteoffsNoSub()
        {
            string        suffix         = MethodBase.GetCurrentMethod().Name;
            Patient       pat            = PatientT.CreatePatient(suffix);
            long          ucrFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "UCR Fees" + suffix);
            long          ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);
            InsuranceInfo ins            = InsuranceT.AddInsurance(pat, suffix, planType: "p", feeSchedNum: ppoFeeSchedNum);

            ins.PriInsPlan.HasPpoSubstWriteoffs = false;
            InsPlans.Update(ins.PriInsPlan);
            BenefitT.CreateCategoryPercent(ins.PriInsPlan.PlanNum, EbenefitCategory.Restorative, 50);
            ProcedureCode originalProcCode  = ProcedureCodes.GetProcCode("D2330");
            ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2140");

            originalProcCode.SubstitutionCode = "";          //NOT substituting
            originalProcCode.SubstOnlyIf      = SubstitutionCondition.Always;
            ProcedureCodeT.Update(originalProcCode);
            FeeT.CreateFee(ucrFeeSchedNum, originalProcCode.CodeNum, 100);
            FeeT.CreateFee(ucrFeeSchedNum, downgradeProcCode.CodeNum, 80);
            FeeT.CreateFee(ppoFeeSchedNum, originalProcCode.CodeNum, 60);
            FeeT.CreateFee(ppoFeeSchedNum, downgradeProcCode.CodeNum, 50);
            Procedure        proc           = ProcedureT.CreateProcedure(pat, "D2330", ProcStat.C, "9", 100);//Tooth 9
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);
            List <Procedure> listProcs      = Procedures.Refresh(pat.PatNum);

            ins.RefreshBenefits();
            Claim     claim  = ClaimT.CreateClaim("P", ins.ListPatPlans, ins.ListInsPlans, listClaimProcs, listProcs, pat, listProcs, ins.ListBenefits, ins.ListInsSubs);
            ClaimProc clProc = ClaimProcs.Refresh(pat.PatNum)[0];          //Should only be one

            Assert.AreEqual(50, clProc.Percentage);
            Assert.AreEqual(30, clProc.BaseEst);
            Assert.AreEqual(30, clProc.InsPayEst);
            Assert.AreEqual(40, clProc.WriteOffEst);
        }
Exemplo n.º 4
0
        public void FeeSchedTools_GlobalUpdateWriteoffEstimates_SubscriberInDifferentFamily()
        {
            string        suffix   = MethodBase.GetCurrentMethod().Name;
            string        procStr  = "D0145";
            double        procFee  = 100;
            ProcedureCode procCode = ProcedureCodes.GetProcCode(procStr);
            //Set up clinic, prov, pat
            Clinic  clinic        = ClinicT.CreateClinic(suffix);
            long    feeSchedNum   = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix);
            long    provNum       = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum);
            Fee     fee           = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum);
            Patient pat           = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum);
            Patient patSubscriber = PatientT.CreatePatient(suffix + "_Subscriber", provNum, clinic.ClinicNum);
            //Set up insurance
            InsuranceInfo info = InsuranceT.AddInsurance(pat, suffix, "p", feeSchedNum);

            info.PriInsSub.Subscriber = patSubscriber.PatNum;
            InsSubs.Update(info.PriInsSub);
            info.ListBenefits.Add(BenefitT.CreatePercentForProc(info.PriInsPlan.PlanNum, procCode.CodeNum, 100));
            //Create the procedure and claimproc
            Procedure proc         = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ClaimProc priClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, proc.ProcNum, info.PriInsPlan.PlanNum, info.PriInsSub.InsSubNum, DateTime.Today,
                                                                -1, -1, -1, ClaimProcStatus.CapEstimate);

            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), true, info.ListInsPlans, info.ListPatPlans, info.ListBenefits, pat.Age,
                                        info.ListInsSubs);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ProcNum == proc.ProcNum);
            Assert.AreEqual(procFee, priClaimProc.InsPayEst);
            GlobalUpdateWriteoffs(clinic.ClinicNum);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ClaimProcNum == priClaimProc.ClaimProcNum);
            Assert.AreEqual(procFee, priClaimProc.InsPayEst);
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public void FeeSchedTools_CopyFeeSched_Concurrency()
        {
            //Make sure there are no duplicate fees already present within the database.
            string dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);

            if (dbmResult.Trim() != _feeDeleteDuplicatesExpectedResult)
            {
                DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Fix);
            }
            //Create two fee schedules; from and to
            FeeSched feeSchedFrom = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM");
            FeeSched feeSchedTo   = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO");

            //Create a single fee and associate it to the "from" fee schedule.
            FeeT.CreateFee(feeSchedFrom.FeeSchedNum, _listProcCodes[_rand.Next(_listProcCodes.Count - 1)].CodeNum, _defaultFeeAmt);
            //Create a helper action that will simply copy the "from" schedule into the "to" schedule for the given fee cache passed in.
            Action actionCopyFromTo = new Action(() => {
                FeeScheds.CopyFeeSchedule(feeSchedFrom, 0, 0, feeSchedTo, null, 0);
            });

            //Mimic each user clicking the "Copy" button from within the Fee Tools window one right after the other (before they click OK).
            actionCopyFromTo();
            actionCopyFromTo();
            //Make sure that there was NOT a duplicate fee inserted into the database.
            dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);
            Assert.AreEqual(dbmResult.Trim(), _feeDeleteDuplicatesExpectedResult, "Duplicate fees detected due to concurrent copying.");
        }
Exemplo n.º 8
0
        public void FeeSchedTools_CopyFeeSched_Clinics()
        {
            //Make sure there are no duplicate fees already present within the database.
            string dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);

            if (dbmResult.Trim() != _feeDeleteDuplicatesExpectedResult)
            {
                DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Fix);
            }
            //Make sure that there are more than six clinics
            ClinicT.ClearClinicTable();
            for (int i = 0; i < 10; i++)
            {
                ClinicT.CreateClinic(MethodBase.GetCurrentMethod().Name + "_" + i);
            }
            //Create two fee schedules; from and to
            FeeSched feeSchedNumFrom = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM");
            FeeSched feeSchedNumTo   = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO");

            //Create a fee for every single procedure code in the database and associate it to the "from" fee schedule.
            foreach (ProcedureCode code in _listProcCodes)
            {
                FeeT.CreateFee(feeSchedNumFrom.FeeSchedNum, code.CodeNum, _rand.Next(5000));
            }
            //Copy the "from" fee schedule into the "to" fee schedule and do it for at least seven clinics.
            FeeScheds.CopyFeeSchedule(feeSchedNumFrom, 0, 0, feeSchedNumTo, Clinics.GetDeepCopy(true).Select(x => x.ClinicNum).ToList(), 0);
            //Make sure that there was NOT a duplicate fee inserted into the database.
            dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check);
            Assert.AreEqual(dbmResult.Trim(), _feeDeleteDuplicatesExpectedResult, "Duplicate fees detected due to concurrent copying.");
        }
Exemplo n.º 9
0
        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));
        }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
        public void FeeSchedTools_CopyFeeSched()
        {
            //Create two fee schedules; from and to
            FeeSched fromFeeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM");
            FeeSched toFeeSched   = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO");
            //Create a single fee and associate it to the "from" fee schedule.
            long feeCodeNum = _listProcCodes[_rand.Next(_listProcCodes.Count - 1)].CodeNum;

            FeeT.CreateFee(fromFeeSched.FeeSchedNum, feeCodeNum, _defaultFeeAmt * _rand.NextDouble());
            FeeScheds.CopyFeeSchedule(fromFeeSched, 0, 0, toFeeSched, null, 0);
            //Get the two fees and check that they are the same.
            Fee fromFee = Fees.GetFee(feeCodeNum, fromFeeSched.FeeSchedNum, 0, 0);
            Fee toFee   = Fees.GetFee(feeCodeNum, toFeeSched.FeeSchedNum, 0, 0);

            Assert.AreEqual(fromFee.Amount, toFee.Amount);
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        public void FeeSchedTools_GlobalUpdateWriteoffEstimates()
        {
            string        suffix   = MethodBase.GetCurrentMethod().Name;
            string        procStr  = "D0145";
            double        procFee  = 100;
            ProcedureCode procCode = ProcedureCodes.GetProcCode(procStr);
            //Set up clinic, prov, pat
            Clinic  clinic      = ClinicT.CreateClinic(suffix);
            long    feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.FixedBenefit, suffix);
            long    provNum     = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum);
            Fee     fee         = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum);
            Patient pat         = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum);
            //Set up insurance
            InsuranceInfo  info         = InsuranceT.AddInsurance(pat, suffix, "c", feeSchedNum);
            List <InsSub>  listSubs     = info.ListInsSubs;
            List <InsPlan> listPlans    = info.ListInsPlans;
            List <PatPlan> listPatPlans = info.ListPatPlans;
            InsPlan        priPlan      = info.PriInsPlan;
            InsSub         priSub       = info.PriInsSub;

            info.ListBenefits.Add(BenefitT.CreatePercentForProc(priPlan.PlanNum, procCode.CodeNum, 90));
            //Create the procedure and claimproc
            Procedure proc         = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ClaimProc priClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, proc.ProcNum, priPlan.PlanNum, priSub.InsSubNum, DateTime.Today, -1, -1, -1,
                                                                ClaimProcStatus.CapEstimate);

            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), true, listPlans, listPatPlans, info.ListBenefits, pat.Age, info.ListInsSubs);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ProcNum == proc.ProcNum);
            Assert.AreEqual(procFee, priClaimProc.WriteOff);
            procFee = 50;
            Procedure procNew = proc.Copy();

            procNew.ProcFee = procFee;
            Procedures.Update(procNew, proc);
            //GlobalUpdate
            long updated = GlobalUpdateWriteoffs(clinic.ClinicNum);

            Assert.AreEqual(1, updated);
            ClaimProc priClaimProcDb = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ClaimProcNum == priClaimProc.ClaimProcNum);

            Assert.AreEqual(procFee, priClaimProcDb.WriteOff);
        }
Exemplo n.º 14
0
        public void Fees_GetByFeeSchedNumsClinicNums_MiddleTier()
        {
            List <long> listFeeSchedNums = new List <long>();
            long        codeNum1         = ProcedureCodes.GetCodeNum("D1110");
            long        codeNum2         = ProcedureCodes.GetCodeNum("D1206");

            for (int i = 0; i < 300; i++)
            {
                FeeSched feeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, "FS" + i);
                FeeT.GetNewFee(feeSched.FeeSchedNum, codeNum1, 11);
                FeeT.GetNewFee(feeSched.FeeSchedNum, codeNum2, 13);
                listFeeSchedNums.Add(feeSched.FeeSchedNum);
            }
            DataAction.RunMiddleTierMock(() => {
                List <FeeLim> listFees = Fees.GetByFeeSchedNumsClinicNums(listFeeSchedNums, new List <long> {
                    0
                });
                Assert.AreEqual(600, listFees.Count);
            });
        }
Exemplo n.º 15
0
        public void Fees_GetFee_ClinicSpecificFees()
        {
            Patient pat         = PatientT.CreatePatient("58");
            long    feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Standard UCR", false);
            long    codeNum     = ProcedureCodes.GetCodeNum("D2750");
            long    clinicNum2  = ClinicT.CreateClinic("2-58").ClinicNum;
            long    clinicNum3  = ClinicT.CreateClinic("3-58").ClinicNum;
            long    clinicNum1  = ClinicT.CreateClinic("1-58").ClinicNum;

            FeeT.CreateFee(feeSchedNum, codeNum, 65, clinicNum1, 0);
            FeeT.CreateFee(feeSchedNum, codeNum, 70, clinicNum2, 0);
            FeeT.CreateFee(feeSchedNum, codeNum, 75, clinicNum3, 0);
            double fee1 = Fees.GetFee(codeNum, feeSchedNum, clinicNum1, 0).Amount;
            double fee2 = Fees.GetFee(codeNum, feeSchedNum, clinicNum2, 0).Amount;
            double fee3 = Fees.GetFee(codeNum, feeSchedNum, clinicNum3, 0).Amount;

            Assert.AreEqual(fee1, 65);
            Assert.AreEqual(fee2, 70);
            Assert.AreEqual(fee3, 75);
        }
Exemplo n.º 16
0
        public void Fees_GetFee_ProviderSpecificFees()
        {
            Patient pat         = PatientT.CreatePatient("57");
            long    feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPOInsPlan1", false);
            long    codeNum     = ProcedureCodes.GetCodeNum("D2750");
            long    provNum1    = ProviderT.CreateProvider("1-57");
            long    provNum2    = ProviderT.CreateProvider("2-57");
            long    provNum3    = ProviderT.CreateProvider("3-57");

            FeeT.CreateFee(feeSchedNum, codeNum, 50, 0, provNum1);
            FeeT.CreateFee(feeSchedNum, codeNum, 55, 0, provNum2);
            FeeT.CreateFee(feeSchedNum, codeNum, 60, 0, provNum3);
            double fee1 = Fees.GetFee(codeNum, feeSchedNum, 0, provNum1).Amount;
            double fee2 = Fees.GetFee(codeNum, feeSchedNum, 0, provNum2).Amount;
            double fee3 = Fees.GetFee(codeNum, feeSchedNum, 0, provNum3).Amount;

            Assert.AreEqual(50, fee1);
            Assert.AreEqual(55, fee2);
            Assert.AreEqual(60, fee3);
        }
Exemplo n.º 17
0
        public void Fees_GetFee_ClinicAndProviderSpecificFees()
        {
            Patient pat         = PatientT.CreatePatient("59");
            long    feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Standard", false);
            long    codeNum     = ProcedureCodes.GetCodeNum("D2750");
            long    provNum1    = ProviderT.CreateProvider("1-59");
            long    provNum2    = ProviderT.CreateProvider("2-59");
            long    clinicNum1  = ClinicT.CreateClinic("1-59").ClinicNum;
            long    clinicNum2  = ClinicT.CreateClinic("2-59").ClinicNum;

            FeeT.CreateFee(feeSchedNum, codeNum, 80, clinicNum1, provNum1);
            FeeT.CreateFee(feeSchedNum, codeNum, 85, clinicNum1, provNum2);
            FeeT.CreateFee(feeSchedNum, codeNum, 90, clinicNum2, provNum2);
            double fee1 = Fees.GetFee(codeNum, feeSchedNum, clinicNum1, provNum1).Amount;
            double fee2 = Fees.GetFee(codeNum, feeSchedNum, clinicNum1, provNum2).Amount;
            double fee3 = Fees.GetFee(codeNum, feeSchedNum, clinicNum2, provNum2).Amount;

            Assert.AreEqual(fee1, 80);
            Assert.AreEqual(fee2, 85);
            Assert.AreEqual(fee3, 90);
        }
Exemplo n.º 18
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");
        }
Exemplo n.º 19
0
        public void Procedures_GlobalUpdateFees()
        {
            string name = MethodBase.GetCurrentMethod().Name;
            Random rand = new Random();
            //set up fees
            List <Clinic> listClinics = new List <Clinic>();

            for (int i = 0; i < 3; i++)
            {
                listClinics.Add(ClinicT.CreateClinic(name + "_" + i));
            }
            List <long> listFeeSchedNums = new List <long>();

            for (int i = 0; i < 2; i++)
            {
                listFeeSchedNums.Add(FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, name + "_" + i, false));
            }
            List <long> listProvNums = new List <long>();

            for (int i = 0; i < 2; i++)
            {
                long feeSched = listFeeSchedNums[rand.Next(listFeeSchedNums.Count - 1)];
                listProvNums.Add(ProviderT.CreateProvider(name + "_" + i, feeSchedNum: feeSched));
            }
            List <ProcedureCode> listProcCodes = ProcedureCodes.GetAllCodes();
            List <Fee>           listFees      = new List <Fee>();

            foreach (ProcedureCode procCode in listProcCodes)
            {
                foreach (long feeSched in listFeeSchedNums)
                {
                    foreach (Clinic clinic in listClinics)
                    {
                        foreach (long provNum in listProvNums)
                        {
                            listFees.Add(FeeT.GetNewFee(feeSched, procCode.CodeNum, 50 * rand.NextDouble(), clinic.ClinicNum, provNum));
                        }
                    }
                }
            }
            //set up patients
            List <Patient> listPatients = new List <Patient>();

            for (int i = 0; i < 3; i++)
            {
                listPatients.Add(PatientT.CreatePatient(name + "_" + i,
                                                        listProvNums[rand.Next(listProvNums.Count - 1)],
                                                        listClinics[rand.Next(listClinics.Count - 1)].ClinicNum));
            }
            //TP some procedures
            List <Fee> listTPFees = new List <Fee>();

            for (int i = 0; i < 100; i++)
            {
                ProcedureCode procCode = listProcCodes[rand.Next(listProcCodes.Count - 1)];
                Patient       patient  = listPatients[rand.Next(listPatients.Count - 1)];
                Fee           fee      = Fees.GetFee(procCode.CodeNum, Providers.GetProv(patient.PriProv).FeeSched, patient.ClinicNum, patient.PriProv);
                Procedure     proc     = ProcedureT.CreateProcedure(patient, procCode.ProcCode, ProcStat.TP, "", fee.Amount);
                listTPFees.Add(fee);
            }
            //change some of the fees
            List <Fee> listTPFeesChanged    = listTPFees.OrderBy(x => rand.Next()).Take(50).ToList();
            List <Fee> listNonTPFeesChanged = (listFees.Except(listTPFees)).OrderBy(x => rand.Next()).Take(50).ToList();
            FeeCache   cache = new FeeCache(listTPFeesChanged.Union(listNonTPFeesChanged).ToList());

            cache.BeginTransaction();
            foreach (Fee fee in listTPFeesChanged)
            {
                fee.Amount = 50 * rand.NextDouble();
                cache.Update(fee);
            }
            foreach (Fee fee in listNonTPFeesChanged)
            {
                fee.Amount = 50 * rand.NextDouble();
                cache.Update(fee);
            }
            cache.SaveToDb();
            //Run the global update
            long updatedCount = 0;

            cache = new FeeCache();
            for (int i = 0; i < listClinics.Count; i++)
            {
                updatedCount += Procedures.GlobalUpdateFees(cache.GetFeesForClinics(listClinics.Select(x => x.ClinicNum)), listClinics[i].ClinicNum, listClinics[i].Abbr);
            }
            //check the counts are the same
            List <Fee> listToCount = listTPFees.Where(x => listTPFeesChanged.Select(y => y.FeeNum).Contains(x.FeeNum)).ToList();

            Assert.AreEqual(listToCount.Count, updatedCount);
        }
Exemplo n.º 20
0
        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);
        }