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); }
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); }
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)); }
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)); }