示例#1
0
        public void OrthoCases_Delete_DeleteOrthoCaseAndAssociatedObjects()
        {
            Prefs.UpdateString(PrefName.OrthoBandingCodes, "D8080");
            Prefs.UpdateString(PrefName.OrthoDebondCodes, "D8070");
            Prefs.UpdateString(PrefName.OrthoVisitCodes, "D8060");
            Userod user = UserodT.CreateUser();

            Security.CurUser = user;
            Patient   pat          = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            Procedure bandingProc  = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0);
            Procedure visitProc    = ProcedureT.CreateProcedure(pat, "D8060", ProcStat.C, "", 0);
            Procedure debondProc   = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0);
            long      orthoCaseNum = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc);

            OrthoProcLinks.LinkProcForActiveOrthoCase(visitProc);
            OrthoProcLinks.LinkProcForActiveOrthoCase(debondProc);
            OrthoCase            orthoCase        = OrthoCases.GetOne(orthoCaseNum);
            OrthoPlanLink        schedulePlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule);
            long                 orthoscheduleNum = schedulePlanLink.FKey;
            OrthoSchedule        orthoSchedule    = OrthoSchedules.GetOne(schedulePlanLink.FKey);
            List <OrthoProcLink> listAllProcLinks = OrthoProcLinks.GetManyByOrthoCase(orthoCaseNum);

            OrthoCases.Delete(orthoCase.OrthoCaseNum, orthoSchedule, schedulePlanLink, listAllProcLinks);
            orthoCase        = OrthoCases.GetOne(orthoCaseNum);
            schedulePlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule);
            orthoSchedule    = OrthoSchedules.GetOne(orthoscheduleNum);
            listAllProcLinks = OrthoProcLinks.GetManyByOrthoCase(orthoCaseNum);
            Assert.AreEqual(orthoCase, null);
            Assert.AreEqual(schedulePlanLink, null);
            Assert.AreEqual(orthoSchedule, null);
            Assert.AreEqual(listAllProcLinks.Count, 0);
        }
示例#2
0
        ///<summary>Inserts the OrthoCase, OrthoSchedule, Schedule OrthoPlanLink, and banding OrthoProcLink for an Ortho Case.</summary>
        public static long InsertForFormOrthoCase(long patNum, double fee, double feeInsPrimary, double feeInsSecondary, double feePat, DateTime bandingDate
                                                  , bool isTransfer, DateTime debondDateExpected, double bandingAmount, double debondAmount, double visitAmount, Procedure bandingProc)
        {
            //No remoting role check; no call to db
            //Ortho Case
            OrthoCase newOrthoCase = new OrthoCase();

            newOrthoCase.PatNum             = patNum;
            newOrthoCase.Fee                = fee;
            newOrthoCase.FeeInsPrimary      = feeInsPrimary;
            newOrthoCase.FeeInsSecondary    = feeInsSecondary;
            newOrthoCase.FeePat             = feePat;
            newOrthoCase.BandingDate        = bandingDate;
            newOrthoCase.DebondDateExpected = debondDateExpected;
            newOrthoCase.IsTransfer         = isTransfer;
            newOrthoCase.SecUserNumEntry    = Security.CurUser.UserNum;
            newOrthoCase.IsActive           = true; //New Ortho Cases can only be added if there are no other active ones. So we automatically set a new ortho case as active.
            if (bandingProc.AptNum != 0)            //If banding is scheduled save the appointment date instead.
            {
                newOrthoCase.BandingDate = bandingProc.ProcDate;
            }
            long orthoCaseNum = OrthoCases.Insert(newOrthoCase);
            //Ortho Schedule
            OrthoSchedule newOrthoSchedule = new OrthoSchedule();

            newOrthoSchedule.BandingAmount = bandingAmount;
            newOrthoSchedule.DebondAmount  = debondAmount;
            newOrthoSchedule.VisitAmount   = visitAmount;
            newOrthoSchedule.IsActive      = true;
            long orthoScheduleNum = OrthoSchedules.Insert(newOrthoSchedule);
            //Ortho Plan Link
            OrthoPlanLink newOrthoPlanLink = new OrthoPlanLink();

            newOrthoPlanLink.OrthoCaseNum    = orthoCaseNum;
            newOrthoPlanLink.LinkType        = OrthoPlanLinkType.OrthoSchedule;
            newOrthoPlanLink.FKey            = orthoScheduleNum;
            newOrthoPlanLink.IsActive        = true;
            newOrthoPlanLink.SecUserNumEntry = Security.CurUser.UserNum;
            OrthoPlanLinks.Insert(newOrthoPlanLink);
            //Banding Proc Link
            if (!newOrthoCase.IsTransfer)
            {
                OrthoProcLinks.Insert(OrthoProcLinks.CreateHelper(orthoCaseNum, bandingProc.ProcNum, OrthoProcType.Banding));
            }
            return(orthoCaseNum);
        }
示例#3
0
        public void OrthoCases_Activate_ActivateAnOrthoCaseAndDeactivateOthersForPat()
        {
            Userod user = UserodT.CreateUser();

            Security.CurUser = user;
            Patient       pat               = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            Procedure     bandingProc1      = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.TP, "", 0);
            Procedure     bandingProc2      = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.TP, "", 0);
            long          orthoCaseNum1     = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc1);
            long          orthoCaseNum2     = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc2);
            OrthoCase     orthoCase2        = OrthoCases.GetOne(orthoCaseNum2);
            OrthoPlanLink schedulePlanLink2 = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum2, OrthoPlanLinkType.OrthoSchedule);
            OrthoSchedule orthoSchedule2    = OrthoSchedules.GetOne(schedulePlanLink2.FKey);

            //Set one OrthoCase inactive. Now orthoCase1 is active and orthoCase2 is inactive.
            OrthoCases.SetActiveState(orthoCase2, schedulePlanLink2, orthoSchedule2, false);
            OrthoCase     orthoCase1        = OrthoCases.GetOne(orthoCaseNum1);
            OrthoPlanLink schedulePlanLink1 = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum1, OrthoPlanLinkType.OrthoSchedule);
            OrthoSchedule orthoSchedule1    = OrthoSchedules.GetOne(schedulePlanLink1.FKey);

            orthoCase2        = OrthoCases.GetOne(orthoCaseNum2);
            schedulePlanLink2 = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum2, OrthoPlanLinkType.OrthoSchedule);
            orthoSchedule2    = OrthoSchedules.GetOne(schedulePlanLink2.FKey);
            Assert.AreEqual(orthoCase1.IsActive, true);
            Assert.AreEqual(schedulePlanLink1.IsActive, true);
            Assert.AreEqual(orthoSchedule1.IsActive, true);
            Assert.AreEqual(orthoCase2.IsActive, false);
            Assert.AreEqual(schedulePlanLink2.IsActive, false);
            Assert.AreEqual(orthoSchedule2.IsActive, false);
            //Active orthoCase2 which should inactivate orthoCase1
            OrthoCases.Activate(orthoCase2, pat.PatNum);
            orthoCase1        = OrthoCases.GetOne(orthoCaseNum1);
            schedulePlanLink1 = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum1, OrthoPlanLinkType.OrthoSchedule);
            orthoSchedule1    = OrthoSchedules.GetOne(schedulePlanLink1.FKey);
            orthoCase2        = OrthoCases.GetOne(orthoCaseNum2);
            schedulePlanLink2 = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum2, OrthoPlanLinkType.OrthoSchedule);
            orthoSchedule2    = OrthoSchedules.GetOne(schedulePlanLink2.FKey);
            Assert.AreEqual(orthoCase1.IsActive, false);
            Assert.AreEqual(schedulePlanLink1.IsActive, false);
            Assert.AreEqual(orthoSchedule1.IsActive, false);
            Assert.AreEqual(orthoCase2.IsActive, true);
            Assert.AreEqual(schedulePlanLink2.IsActive, true);
            Assert.AreEqual(orthoSchedule2.IsActive, true);
        }
示例#4
0
        public void OrthoProcLinks_SetProcFeeForLinkedProc_SetFeeForEachProcType()
        {
            Patient              pat                = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            Procedure            bandingProc        = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0);
            Procedure            visitProc          = ProcedureT.CreateProcedure(pat, "D8060", ProcStat.C, "", 0);
            Procedure            debondProc         = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0);
            long                 orthoCaseNum       = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, new Procedure());
            OrthoCase            orthoCase          = OrthoCases.GetOne(orthoCaseNum);
            OrthoPlanLink        schedulePlanLink   = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule);
            OrthoSchedule        orthoSchedule      = OrthoSchedules.GetOne(schedulePlanLink.FKey);
            List <OrthoProcLink> listVisitProcLinks = OrthoProcLinks.GetVisitLinksForOrthoCase(orthoCaseNum);

            OrthoProcLinks.SetProcFeeForLinkedProc(orthoCase, bandingProc, OrthoProcType.Banding, listVisitProcLinks, schedulePlanLink, orthoSchedule);
            OrthoProcLinks.SetProcFeeForLinkedProc(orthoCase, visitProc, OrthoProcType.Visit, listVisitProcLinks, schedulePlanLink, orthoSchedule);
            OrthoProcLinks.SetProcFeeForLinkedProc(orthoCase, debondProc, OrthoProcType.Debond, listVisitProcLinks, schedulePlanLink, orthoSchedule);
            Assert.AreEqual(bandingProc.ProcFee, 1000);
            Assert.AreEqual(debondProc.ProcFee, 400);
            Assert.AreEqual(visitProc.ProcFee, 60);
        }
示例#5
0
        public void ClaimProcs_ComputeEstimatesByOrthoCase_SetClaimProcForEachProcType()
        {
            Prefs.UpdateString(PrefName.OrthoBandingCodes, "D8080");
            Prefs.UpdateString(PrefName.OrthoDebondCodes, "D8070");
            Prefs.UpdateString(PrefName.OrthoVisitCodes, "D8060");
            Patient       pat              = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            Procedure     bandingProc      = ProcedureT.CreateProcedure(pat, "D8080", ProcStat.C, "", 0);
            PatPlan       patPlan          = PatPlanT.CreatePatPlan(1, pat.PatNum, 0);
            ClaimProc     bandingClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, bandingProc.ProcNum, 0, 0, bandingProc.ProcDate, 1, 1, 1);
            Procedure     visitProc        = ProcedureT.CreateProcedure(pat, "D8060", ProcStat.C, "", 0);
            ClaimProc     visitClaimProc   = ClaimProcT.CreateClaimProc(pat.PatNum, visitProc.ProcNum, 0, 0, visitProc.ProcDate, 1, 1, 1);
            Procedure     debondProc       = ProcedureT.CreateProcedure(pat, "D8070", ProcStat.C, "", 0);
            ClaimProc     debondClaimProc  = ClaimProcT.CreateClaimProc(pat.PatNum, debondProc.ProcNum, 0, 0, debondProc.ProcDate, 1, 1, 1);
            long          orthoCaseNum     = OrthoCaseT.InsertForFormOrthoCase(pat.PatNum, 2000, 1200, 0, 800, DateTime.Today, false, DateTime.Today.AddMonths(12), 1000, 400, 60, bandingProc);
            OrthoCase     orthoCase        = OrthoCases.GetOne(orthoCaseNum);
            OrthoPlanLink schedulePlanLink = OrthoPlanLinks.GetOneForOrthoCaseByType(orthoCaseNum, OrthoPlanLinkType.OrthoSchedule);
            OrthoSchedule orthoSchedule    = OrthoSchedules.GetOne(schedulePlanLink.FKey);

            OrthoProcLinks.LinkProcForActiveOrthoCase(bandingProc);
            OrthoProcLinks.LinkProcForActiveOrthoCase(visitProc);
            OrthoProcLinks.LinkProcForActiveOrthoCase(debondProc);
            List <OrthoProcLink> allProcLinks      = OrthoProcLinks.GetManyByOrthoCase(orthoCaseNum);
            OrthoProcLink        bandingLink       = allProcLinks.FirstOrDefault(x => x.ProcLinkType == OrthoProcType.Banding);
            OrthoProcLink        debondLink        = allProcLinks.FirstOrDefault(x => x.ProcLinkType == OrthoProcType.Debond);
            OrthoProcLink        visitLink         = allProcLinks.FirstOrDefault(x => x.ProcLinkType == OrthoProcType.Visit);
            List <ClaimProc>     listAllClaimProcs = new List <ClaimProc>()
            {
                bandingClaimProc, visitClaimProc, debondClaimProc
            };
            List <OrthoProcLink> listAllOrthoProcLinks = new List <OrthoProcLink>()
            {
                bandingLink, visitLink, debondLink
            };
            List <PatPlan> listPatPlans = new List <PatPlan>()
            {
                patPlan
            };

            ClaimProcs.ComputeEstimatesByOrthoCase(bandingProc, bandingLink, orthoCase, orthoSchedule, true, listAllClaimProcs,
                                                   new List <ClaimProc>()
            {
                bandingClaimProc
            }, listPatPlans, listAllOrthoProcLinks);
            ClaimProcs.ComputeEstimatesByOrthoCase(debondProc, debondLink, orthoCase, orthoSchedule, true, listAllClaimProcs,
                                                   new List <ClaimProc>()
            {
                debondClaimProc
            }, listPatPlans, listAllOrthoProcLinks);
            ClaimProcs.ComputeEstimatesByOrthoCase(visitProc, visitLink, orthoCase, orthoSchedule, true, listAllClaimProcs,
                                                   new List <ClaimProc>()
            {
                visitClaimProc
            }, listPatPlans, listAllOrthoProcLinks);
            Assert.AreEqual(bandingClaimProc.AllowedOverride, 0);
            Assert.AreEqual(bandingClaimProc.CopayOverride, 0);
            Assert.AreEqual(bandingClaimProc.PercentOverride, 0);
            Assert.AreEqual(bandingClaimProc.PaidOtherInsOverride, 0);
            Assert.AreEqual(bandingClaimProc.WriteOffEstOverride, 0);
            Assert.AreEqual(bandingClaimProc.InsEstTotalOverride, 600);
            Assert.AreEqual(debondClaimProc.AllowedOverride, 0);
            Assert.AreEqual(debondClaimProc.CopayOverride, 0);
            Assert.AreEqual(debondClaimProc.PercentOverride, 0);
            Assert.AreEqual(debondClaimProc.PaidOtherInsOverride, 0);
            Assert.AreEqual(debondClaimProc.WriteOffEstOverride, 0);
            Assert.AreEqual(debondClaimProc.InsEstTotalOverride, 240);
            Assert.AreEqual(visitClaimProc.AllowedOverride, 0);
            Assert.AreEqual(visitClaimProc.CopayOverride, 0);
            Assert.AreEqual(visitClaimProc.PercentOverride, 0);
            Assert.AreEqual(visitClaimProc.PaidOtherInsOverride, 0);
            Assert.AreEqual(visitClaimProc.WriteOffEstOverride, 0);
            Assert.AreEqual(visitClaimProc.InsEstTotalOverride, 36);
        }