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 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_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_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);
        }
Example #5
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);
        }
Example #6
0
        public void InsPlans_GetAllowed_PPOSubstituteMoreExpensive()
        {
            InsPlan       plan     = GeneratePPOPlan(MethodBase.GetCurrentMethod().Name, false);
            ProcedureCode procCode = _listProcCodes[9];

            procCode.SubstitutionCode = _listProcCodes[10].ProcCode;
            ProcedureCodes.Update(procCode);
            Fee    feeOrig = FeeT.GetNewFee(plan.FeeSched, procCode.CodeNum, 85);
            Fee    feeSubs = FeeT.GetNewFee(plan.FeeSched, ProcedureCodes.GetSubstituteCodeNum(procCode.SubstitutionCode, "", plan.PlanNum), 200);
            double allowed = InsPlans.GetAllowed(procCode.ProcCode, plan.FeeSched, plan.AllowedFeeSched, plan.CodeSubstNone, plan.PlanType, "", 0, 0, plan.PlanNum);

            Assert.AreEqual(feeOrig.Amount, allowed);
        }
Example #7
0
        public void InsPlans_GetCopay_SubstituteFee()
        {
            ProcedureCode procCode = _listProcCodes[4];

            procCode.SubstitutionCode = _listProcCodes[5].ProcCode;
            ProcedureCodes.Update(procCode);
            InsPlan plan          = GenerateMediFlatInsPlan(MethodBase.GetCurrentMethod().Name, false);
            Fee     feeDefault    = FeeT.GetNewFee(plan.FeeSched, procCode.CodeNum, 100);
            Fee     feeSubstitute = FeeT.GetNewFee(plan.CopayFeeSched, ProcedureCodes.GetSubstituteCodeNum(procCode.ProcCode, "", plan.PlanNum), 45);
            double  amt           = InsPlans.GetCopay(procCode.CodeNum, plan.FeeSched, plan.CopayFeeSched, plan.CodeSubstNone, "", 0, 0, plan.PlanNum);

            Assert.AreEqual(feeSubstitute.Amount, amt);
        }