Пример #1
0
        public void Fees_GetListFromObjects_ProviderProcCodeDefault()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Update our new provider so that they are associated to the new fee schedule that was just created.
            Provider prov = Providers.GetProv(fee.ProvNum);

            prov.FeeSched = fee.FeeSched;
            ProviderT.Update(prov);
            //Make the default provider associated to the procedure code our new provider.
            procedureCode.ProvNumDefault = prov.ProvNum;
            ProcedureCodeT.Update(procedureCode);
            //The fees associated to the fee schedule of the procedure code's default provider should be returned by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          null,
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #2
0
        public void Fees_GetListFromObjects_ProviderPatientSecondary()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Update our new provider so that they are associated to the new fee schedule that was just created.
            Provider prov = Providers.GetProv(fee.ProvNum);

            prov.FeeSched = fee.FeeSched;
            ProviderT.Update(prov);
            //Act like this provider is a secondary provider of a patient which should return the fees for the provider by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          prov.ProvNum,
                                                          0,
                                                          null,
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #3
0
        public void Fees_GetListFromObjects_AppointmentProviderSecondary()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Update our new provider so that they are associated to the new fee schedule that was just created.
            Provider prov = Providers.GetProv(fee.ProvNum);

            prov.FeeSched = fee.FeeSched;
            ProviderT.Update(prov);
            //Make an appointment that has the new provider set as the secondary provider.
            Appointment appt = AppointmentT.CreateAppointment(0, DateTime.Now, 0, 0, provHyg: prov.ProvNum);
            //The fees associated to the fee schedule of the appointment's secondary provider should be returned by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          null,
                                                          null,
                                                          new List <Appointment>()
            {
                appt
            },
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #4
0
        public void Fees_GetListFromObjects_ProviderPracticeDefault()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Update our new provider so that they are associated to the new fee schedule that was just created.
            Provider prov = Providers.GetProv(fee.ProvNum);

            prov.FeeSched = fee.FeeSched;
            ProviderT.Update(prov);
            //Update the database so that the practice provider is the provider associated to our new fee.
            long practiceDefaultProvOld = PrefC.GetLong(PrefName.PracticeDefaultProv);

            PrefT.UpdateLong(PrefName.PracticeDefaultProv, fee.ProvNum);
            //Since our new fee is associated to the fee schedule of the practice default provider, it should be returned by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          null,
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            //Put the default provider back the way it was prior to asserting.
            PrefT.UpdateLong(PrefName.PracticeDefaultProv, practiceDefaultProvOld);
            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #5
0
        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);
        }
Пример #6
0
        protected static void FeeTestSetup()
        {
            //Some unit tests cannot handle duplicate procedure codes being present within the database.
            //This is acceptable because that scenario should be impossible (we block the user via the UI layer).
            //Delete all duplicate procedure codes.
            Dictionary <string, ProcedureCode> dictProcCodes = ProcedureCodes.GetAllCodes().GroupBy(x => x.ProcCode).ToDictionary(x => x.Key, x => x.First());

            ProcedureCodeT.ClearProcedureCodeTable();
            foreach (ProcedureCode procedureCode in dictProcCodes.Values)
            {
                ProcedureCodes.Insert(procedureCode);
            }
            ProcedureCodes.RefreshCache();
            _listProcCodes    = ProcedureCodes.GetAllCodes();       //Just in case the PKs matter to some tests.
            _listProcCodesOld = _listProcCodes.Select(x => x.Copy()).ToList();
            if (Fees.GetCountByFeeSchedNum(_standardFeeSchedNum) <= 0)
            {
                List <Fee> listFees = new List <Fee>();
                foreach (ProcedureCode procCode in _listProcCodes)
                {
                    listFees.Add(new Fee()
                    {
                        FeeSched  = _standardFeeSchedNum,
                        CodeNum   = procCode.CodeNum,
                        Amount    = _defaultFeeAmt * _rand.NextDouble(),
                        ClinicNum = 0,
                        ProvNum   = 0
                    });                     //create the default fee schedule fee
                }
                Fees.InsertMany(listFees);
            }
        }
Пример #7
0
        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);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
0
        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);
        }
        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));
        }
Пример #12
0
        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;
            }
        }
Пример #13
0
        public void Fees_GetListFromObjects_ProviderFirst()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), codeNum: procedureCode.CodeNum);
            //Update the database so that provFirst is associated to the new fee schedule we just created.
            Provider provFirst = Providers.GetFirst();

            provFirst.FeeSched = fee.FeeSched;
            ProviderT.Update(provFirst);
            //Since our new fee is associated to the fee schedule of the first provider, it should be returned by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          null,
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #14
0
        public void Fees_GetListFromObjects_DiscountPlan()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Create a discount plan and associate it to the fee schedule that was just created.
            DiscountPlan discountPlan = DiscountPlanT.CreateDiscountPlan(suffix, feeSchedNum: fee.FeeSched);
            //Act like a discount plan has our fee schedule which should return the corresponding fees by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          null,
                                                          null,
                                                          null,
                                                          null,
                                                          discountPlan.DiscountPlanNum);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #15
0
        public void Fees_GetListFromObjects_InsPlanAllowedFeeSched()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Create an insurance plan and associate the allowed fee schedule to the fee schedule that was just created.
            InsPlan insPlan = InsPlanT.CreateInsPlan(0, allowedFeeSched: fee.FeeSched);
            //Act like an ins plan has our fee schedule which should return the corresponding fees by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          new List <InsPlan>()
            {
                insPlan
            },
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #16
0
 public static void SetupClass(TestContext testContext)
 {
     //Add anything here that you want to run once before the tests in this class run.
     ProcedureCodeT.AddIfNotPresent("D0120");
     ProcedureCodeT.AddIfNotPresent("D1110");
     ProcedureCodeT.AddIfNotPresent("D0602");
     ProcedureCodeT.AddIfNotPresent("D1206");
     ProcedureCodes.RefreshCache();            //Refresh cache if the codes above were added
     _x271 = new X271(Properties.Resources.x271Test);
 }
        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));
        }
Пример #18
0
        public void ProcedureCodes_GetProcCodesByTreatmentArea_MouthCodes()
        {
            string suffix = MethodBase.GetCurrentMethod().Name;
            List <ProcedureCode> listMouthProcCodesOld = ProcedureCodes.GetProcCodesByTreatmentArea(false, TreatmentArea.Mouth);
            int i = 0;

            do
            {
                i++;                //Add a nonexisting proc code.
            }while(!ProcedureCodeT.AddIfNotPresent("D" + i.ToString().PadLeft(4, '0')) && i < 10000);
            ProcedureCode newProc = ProcedureCodes.GetOne("D" + i.ToString().PadLeft(4, '0'));

            newProc.TreatArea = TreatmentArea.Mouth;
            newProc.Descript  = suffix;
            ProcedureCodeT.Update(newProc);
            List <ProcedureCode> listMouthProcCodesNew = ProcedureCodes.GetProcCodesByTreatmentArea(false, TreatmentArea.Mouth);

            Assert.IsFalse(listMouthProcCodesNew.Any(x => x.TreatArea != TreatmentArea.Mouth));
            Assert.IsTrue((listMouthProcCodesOld.Count + 1) == listMouthProcCodesNew.Count);
            Assert.IsTrue(listMouthProcCodesNew.Exists(x => x.CodeNum == newProc.CodeNum));
        }
Пример #19
0
        public void Fees_GetListFromObjects_PatientFeeSched()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Act like a patient has our fee schedule which should return the corresponding fees by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          fee.FeeSched,
                                                          null,
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }