Exemple #1
0
        ///<summary>Removes the assigned user from the InsVerify of the InsPlan that is associated to the PatPlan passed in.
        ///Will only unassign if the user assigned to the patplan matches the user assigned to the insplan.</summary>
        private static void RemoveAssignedUser(PatPlan patPlanCur)
        {
            //No Remoting check; no call to db.
            //Get the insurance verified assigned to the PatPlan.
            InsVerify insVerifyForPatPlan = InsVerifies.GetOneByFKey(patPlanCur.PatPlanNum, VerifyTypes.PatientEnrollment);

            if (insVerifyForPatPlan != null && insVerifyForPatPlan.UserNum > 0)
            {
                //Get the insplan associated to the PatPlan.
                InsSub inssub = null;
                if (patPlanCur != null)
                {
                    inssub = InsSubs.GetOne(patPlanCur.InsSubNum);
                }
                InsPlan insPlan = null;
                if (inssub != null)
                {
                    insPlan = InsPlans.RefreshOne(inssub.PlanNum);
                }
                if (insPlan != null)
                {
                    //Get the insVerify for the insplan associated to the patplan we are about to delete.
                    InsVerify insVerifyForInsPlan = InsVerifies.GetOneByFKey(insPlan.PlanNum, VerifyTypes.InsuranceBenefit);
                    //Only unassign the user for the insplan if it matches the user for the patplan being dropped
                    if (insVerifyForInsPlan != null && insVerifyForInsPlan.UserNum == insVerifyForPatPlan.UserNum)
                    {
                        //Remove user and set DateLastVerified to MinValue.
                        insVerifyForInsPlan.UserNum          = 0;
                        insVerifyForInsPlan.DateLastVerified = DateTime.MinValue;
                        InsVerifies.Update(insVerifyForInsPlan);
                    }
                }
            }
        }
Exemple #2
0
        ///<summary>Deletes the patplan with the specified patPlanNum.  Rearranges the other patplans for the patient to keep the ordinal sequence contiguous.  Then, recomputes all estimates for this patient because their coverage is now different.  Also sets patient.HasIns to the correct value.</summary>
        public static void Delete(long patPlanNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patPlanNum);
                return;
            }
            string    command = "SELECT PatNum FROM patplan WHERE PatPlanNum=" + POut.Long(patPlanNum);
            DataTable table   = Db.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return;
            }
            long           patNum      = PIn.Long(table.Rows[0][0].ToString());
            List <PatPlan> patPlans    = PatPlans.Refresh(patNum);
            bool           doDecrement = false;

            for (int i = 0; i < patPlans.Count; i++)
            {
                if (doDecrement)                 //patPlan has already been deleted, so decrement the rest.
                {
                    command = "UPDATE patplan SET Ordinal=" + POut.Long(patPlans[i].Ordinal - 1)
                              + " WHERE PatPlanNum=" + POut.Long(patPlans[i].PatPlanNum);
                    Db.NonQ(command);
                    continue;
                }
                if (patPlans[i].PatPlanNum == patPlanNum)
                {
                    RemoveAssignedUser(patPlans[i]);
                    command = "DELETE FROM patplan WHERE PatPlanNum=" + POut.Long(patPlanNum);
                    Db.NonQ(command);
                    command = "DELETE FROM benefit WHERE PatPlanNum=" + POut.Long(patPlanNum);
                    Db.NonQ(command);
                    doDecrement = true;
                    InsVerifies.DeleteByFKey(patPlanNum, VerifyTypes.PatientEnrollment);
                }
            }
            Family           fam                = Patients.GetFamily(patNum);
            Patient          pat                = fam.GetPatient(patNum);
            List <ClaimProc> claimProcs         = ClaimProcs.Refresh(patNum);
            List <ClaimProc> listClaimProcsEsts = claimProcs.Where(x => x.Status.In(ClaimProcStatus.Estimate, ClaimProcStatus.CapEstimate)).ToList();
            List <Procedure> procs              = Procedures.Refresh(patNum);

            patPlans = PatPlans.Refresh(patNum);
            List <InsSub>  subList  = InsSubs.RefreshForFam(fam);
            List <InsPlan> planList = InsPlans.RefreshForSubList(subList);
            List <Benefit> benList  = Benefits.Refresh(patPlans, subList);

            Procedures.ComputeEstimatesForAll(patNum, listClaimProcsEsts, procs, planList, patPlans, benList, pat.Age, subList, claimProcs);
            Patients.SetHasIns(patNum);
//Cameron_ Possibly create outbound ADT message to update insurance info
        }
Exemple #3
0
        ///<summary></summary>
        public static long Insert(PatPlan patPlan)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                patPlan.PatPlanNum = Meth.GetLong(MethodBase.GetCurrentMethod(), patPlan);
                return(patPlan.PatPlanNum);
            }
            //Cameron_ Possibly create outbound ADT message to update insurance info
            long patPlanNum = Crud.PatPlanCrud.Insert(patPlan);

            //Insert an InsVerify for the patplan to ensure that the patplan can be verified.
            InsVerifies.InsertForPatPlanNum(patPlanNum);
            return(patPlanNum);
        }
Exemple #4
0
        ///<summary>Deletes the patplan and benefits with the specified patPlanNum.  Does not rearrange the other patplans for the patient.  A patplan must be inserted after this function is called to take the place of the patplan being deleted.</summary>
        public static void DeleteNonContiguous(long patPlanNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patPlanNum);
                return;
            }
            string command = "DELETE FROM patplan WHERE PatPlanNum=" + POut.Long(patPlanNum);

            Db.NonQ(command);
            command = "DELETE FROM benefit WHERE PatPlanNum=" + POut.Long(patPlanNum);
            Db.NonQ(command);
            InsVerifies.DeleteByFKey(patPlanNum, VerifyTypes.PatientEnrollment);
        }
Exemple #5
0
 ///<summary>If the passed in InsVerify is null, do nothing.
 ///Otherwise, insert the passed in InsVerify into InsVerifyHist and blank out InsVerify's UserNum, Status, and Note.</summary>
 public static void InsertFromInsVerify(InsVerify insVerify)
 {
     if (insVerify == null)
     {
         return;
     }
     Insert(new InsVerifyHist(insVerify));
     insVerify.UserNum          = 0;
     insVerify.DefNum           = 0;
     insVerify.Note             = "";
     insVerify.DateLastAssigned = DateTime.MinValue;
     if (PrefC.GetBool(PrefName.InsVerifyFutureDateBenefitYear) && insVerify.AppointmentDateTime > DateTime.MinValue)
     {
         insVerify.DateLastVerified = insVerify.AppointmentDateTime;
     }
     InsVerifies.Update(insVerify);
 }
Exemple #6
0
        ///<summary>Deletes the patplan with the specified patPlanNum.  Rearranges the other patplans for the patient to keep the ordinal sequence contiguous.  Then, recomputes all estimates for this patient because their coverage is now different.  Also sets patient.HasIns to the correct value.</summary>
        public static void Delete(long patPlanNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patPlanNum);
                return;
            }
            string    command = "SELECT PatNum FROM patplan WHERE PatPlanNum=" + POut.Long(patPlanNum);
            DataTable table   = Db.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return;
            }
            long           patNum      = PIn.Long(table.Rows[0][0].ToString());
            List <PatPlan> patPlans    = PatPlans.Refresh(patNum);
            bool           doDecrement = false;

            for (int i = 0; i < patPlans.Count; i++)
            {
                if (doDecrement)                 //patPlan has already been deleted, so decrement the rest.
                {
                    command = "UPDATE patplan SET Ordinal=" + POut.Long(patPlans[i].Ordinal - 1)
                              + " WHERE PatPlanNum=" + POut.Long(patPlans[i].PatPlanNum);
                    Db.NonQ(command);
                    continue;
                }
                if (patPlans[i].PatPlanNum == patPlanNum)
                {
                    RemoveAssignedUser(patPlans[i]);
                    command = "DELETE FROM patplan WHERE PatPlanNum=" + POut.Long(patPlanNum);
                    Db.NonQ(command);
                    command = "DELETE FROM benefit WHERE PatPlanNum=" + POut.Long(patPlanNum);
                    Db.NonQ(command);
                    doDecrement = true;
                    InsVerifies.DeleteByFKey(patPlanNum, VerifyTypes.PatientEnrollment);
                }
            }
            InsPlans.ComputeEstimatesForPatNums(new List <long> {
                patNum
            });
//Cameron_ Possibly create outbound ADT message to update insurance info
        }