public bool AssignStatusToAllPatients(string EnrolmentStatus, string EnrollmentSubStatus, string EnrollmentReason, string EnrollmentStatusnote, int[] Patients)
        {
            try
            {
                if (EnrollmentSubStatus != "In-Active Enrolled")
                {
                    EnrollmentReason = "";
                }
                if (Patients.Count() > 0)
                {
                    foreach (var patientid in Patients)
                    {
                        var patient = _db.Patients.Where(x => x.Id == patientid).FirstOrDefault();
                        patient.EnrollmentStatus          = EnrolmentStatus;
                        patient.EnrollmentSubStatus       = EnrollmentSubStatus;
                        patient.EnrollmentSubStatusReason = EnrollmentReason;
                        patient.EnrollmentStatusNotes     = EnrollmentStatusnote;
                        patient.UpdatedBy = User.Identity.GetUserId();
                        patient.UpdatedOn = DateTime.Now;
                        if (EnrollmentSubStatus == "Active Enrolled")
                        {
                            patient.CcmStatus = "Enrolled";

                            if (patient.CCMEnrolledOn == null)
                            {
                                patient.CCMEnrolledOn = DateTime.Now;
                                patient.CCMEnrolledBy = User.Identity.GetUserId();
                                //HelperExtensions.UpdateCurrentMonthActivityfromCycleZeroToOne(patient.Id);
                                try
                                {
                                    var reviewtimeccms = _db.ReviewTimeCcms.Where(x => x.PatientId == patient.Id && x.Cycle == 0).ToList().Where(x => x.StartTime.Date.Month == DateTime.Now.Month).ToList();
                                    foreach (var reviewtimeccmitem in reviewtimeccms)
                                    {
                                        reviewtimeccmitem.Cycle            = 1;
                                        _db.Entry(reviewtimeccmitem).State = EntityState.Modified;
                                        _db.SaveChanges();
                                    }
                                }
                                catch/* (Exception ex)*/
                                {
                                }
                            }
                        }
                        //patient.CCMEnrolledBy = User.Identity.GetUserId();
                        //patient.CCMEnrolledOn = DateTime.Now;
                        _db.Entry(patient).State = EntityState.Modified;
                        _db.SaveChanges();
                        patient.Cycle = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid);
                        //HelperExtensions.GetCCMCycleStatus(patient.Id, patient.Cycle, User.Identity.GetUserId(),patient.EnrollmentSubStatus);
                        CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid, patient.Cycle);
                    }
                }
            }
            catch /*(Exception ex)*/
            {
                return(false);
            }
            return(true);
        }
示例#2
0
        //private readonly ApplicationdbContect _db = new ApplicationdbContect();
        //private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        // GET: G0506
        public ActionResult Index(int PatientId)
        {
            var primaryinsurance   = new G0506_PrimaryInsurance();
            var secondaryinsurance = new G0506_SecondaryInsurance();
            var patientinfo        = _db.G0506_PatientsInfo.Where(p => p.PatientId == PatientId).FirstOrDefault();

            if (patientinfo != null)
            {
                primaryinsurance   = _db.G0506_PrimaryInsurance.Where(p => p.Id == patientinfo.G0506_PrimaryInsuranceId).FirstOrDefault();
                secondaryinsurance = _db.G0506_SecondaryInsurance.Where(p => p.Id == patientinfo.G0506_SecondaryInsuranceId).FirstOrDefault();
            }


            G0506ViewModel viewModel = new G0506ViewModel();

            viewModel.G0506_PatientsInfo       = patientinfo;
            viewModel.G0506_PrimaryInsurance   = primaryinsurance;
            viewModel.G0506_SecondaryInsurance = secondaryinsurance;



            ViewBag.PatientId = PatientId;
            var Category = "G0506 INITIAL VISIT";

            ViewBag.Message         = Category;
            ViewBag.BillingReviewId = HelperExtensions.ReviewTimeGet(Category, PatientId, User.Identity.GetUserId(), BillingCodeHelper.G0506BillingCatagoryid);
            var G0506FormDataViewModel = new G0506FormDataViewModel();


            var PatientInfo = _db.G0506_PatientsInfo.Where(x => x.PatientId == PatientId).FirstOrDefault();

            if (patientinfo == null)
            {
                patientinfo           = new G0506_PatientsInfo();
                patientinfo.PatientId = PatientId;
                patientinfo.CreatedBy = User.Identity.GetUserId();
                patientinfo.CreatedOn = DateTime.Now;
                _db.G0506_PatientsInfo.Add(patientinfo);
                _db.SaveChanges();
            }



            if (PatientInfo != null)
            {
                ViewBag.AdditionalProviders = _db.G0506_AdditionalProviders.Where(sd => sd.G0506_PatientsInfoId == PatientInfo.Id).ToList();
            }
            else
            {
                ViewBag.AdditionalProviders = new List <G0506_AdditionalProviders>();
            }


            ViewBag.G0506Status = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(PatientId, BillingCodeHelper.G0506BillingCatagoryid, null);

            return(View(viewModel));
        }
示例#3
0
        public ActionResult BacktoProgessbyLiaison(int?patientId, int Cycle, string Reason, string FeedBack, int?BillingcategoryId)
        {
            try
            {
                var patient = _db.Patients.Where(x => x.Id == patientId).FirstOrDefault();
                patient.EnrollmentNotes  = FeedBack;
                _db.Entry(patient).State = EntityState.Modified;
                _db.SaveChanges();
                var patientccmcycle = Cycle;
                CategoryCycleStatusHelper.User = User;
                var patientccmcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid, patientccmcycle);
                if (patient != null)
                {
                    if (BillingcategoryId == BillingCodeHelper.cmmBillingCatagoryid)
                    {
                        if (patientccmcyclestatus == "Ready for Clinical Sign-Off")
                        {
                            HelperExtensions.UpdateCCMCycleStatus(patient.Id, patientccmcycle, "Enrolled", User.Identity.GetUserId(), Reason, true);
                        }
                        else
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Not Allowed." }));
                        }
                    }
                    else
                    {
                        CategoryCycleStatusHelper.User = User;
                        var patientcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingcategoryId.GetInteger(), patientccmcycle);


                        if (patientcyclestatus == "Ready for Clinical Sign-Off")
                        {
                            HelperExtensions.UpdatecategoryStatus(BillingcategoryId, patient.Id, patientccmcycle, "Enrolled", User.Identity.GetUserId(), Reason, true);
                        }
                        else
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Not Allowed." }));
                        }
                    }
                }
                return(RedirectToAction("Index", "CcmStatus", new { status = "Ready for Clinical Sign-Off", BillingcategoryId = BillingcategoryId }));
            }
            catch (Exception ex)
            {
                log.Error(Environment.NewLine + User.Identity.GetUserName() + "-------" + User.Identity.GetUserId() + Environment.NewLine + ex.Message + "-----" + ex.StackTrace);
                return(RedirectToAction("Index", "CcmStatus", new { status = "Ready for Clinical Sign-Off" }));

                /*return ex.Message + "------------------" + ex.StackTrace;*/
            }
        }
示例#4
0
 private static void UpdatePatientCycleAndCycleStatus(int patientId, int BillingCategoryId)
 {
     int    cycle       = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patientId, BillingCategoryId);
     string cyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patientId, BillingCategoryId, cycle, true);
 }
示例#5
0
        public ActionResult ClinicalSignOff(int?patientId, int BillingcategoryId = 0)
        {
            try
            {
                var patient        = _db.Patients.Where(x => x.Id == patientId).FirstOrDefault();
                var categorystatus = _db.CategoriesStatuses.Where(p => p.BillingCategoryId == BillingcategoryId && p.PatientId == patientId).FirstOrDefault();
                if (BillingcategoryId == BillingCodeHelper.cmmBillingCatagoryid)
                {
                    CategoryCycleStatusHelper.User = User;
                    var patientccmcycle       = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid);
                    var patientccmcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid, patientccmcycle);

                    if (patient != null)
                    {
                        var totaltimespent = TotalReviewTime(patient.Id, patientccmcycle);
                        //if (totaltimespent.TotalMinutes < 20)
                        //{
                        //    return RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Time is less than 20 minutes." });
                        //}
                        var finalcareplan = _db.FinalCarePlanNotes.Where(x => x.PatientId == patientId && x.Cycle == patientccmcycle).FirstOrDefault();
                        if (finalcareplan == null)
                        {
                            var finalcareplans = _db.FinalCarePlanNotes.Where(x => x.PatientId == patientId).OrderByDescending(x => x.CarePlanCreatedOn).ToList();
                            if (finalcareplans.Count > 0)
                            {
                                var lastcareplan = finalcareplans[0];
                                if (lastcareplan.CarePlanCreatedOn.Value.Month == DateTime.Now.Month && lastcareplan.CarePlanCreatedOn.Value.Year == DateTime.Now.Year)

                                {
                                    lastcareplan.Cycle            = patientccmcycle;
                                    _db.Entry(lastcareplan).State = EntityState.Modified;
                                    _db.SaveChanges();
                                }
                                else
                                {
                                    return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cannot submit this cycle for billing untill final care plan not generated." }));;
                                }
                            }
                            else
                            {
                                return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cannot submit this cycle for billing untill final care plan not generated." }));
                            }
                        }
                        if (patient.EnrollmentSubStatus != "Active Enrolled")
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Patient is not Active Enrolled." }));
                        }
                        if ((patientccmcyclestatus == "Enrolled" || patientccmcyclestatus == "Ready for Clinical Sign-Off"))
                        {
                            HelperExtensions.UpdateCCMCycleStatus(patient.Id, patientccmcycle, "Clinical Sign-Off", User.Identity.GetUserId(), "");
                        }
                        else
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cycle is locked." }));
                        }

                        patient.CcmStatus = "Clinical Sign-Off";
                        patient.CcmClinicalSignOffDate = DateTime.Now;
                        patient.UpdatedOn = DateTime.Now;
                        patient.UpdatedBy = User.Identity.GetUserId();


                        var ccmCycleStatusObj = _db.CCMCycleStatuses.Where(x => (x.PatientId == patientId && EntityFunctions.TruncateTime(x.CreatedOn).Value.Month == DateTime.Now.Month)).FirstOrDefault();
                        if (ccmCycleStatusObj != null)
                        {
                            //ccmCycleStatusObj.clinicalSignOffQueCounter += 1;
                        }
                        _db.Entry(ccmCycleStatusObj).State = EntityState.Modified;
                        _db.Entry(patient).State           = EntityState.Modified;
                        _db.SaveChanges();
                    }

                    return(RedirectToAction("Index", "CcmStatus", new { status = "Clinical Sign-Off" }));
                }
                else
                {
                    CategoryCycleStatusHelper.User = User;
                    var patientccmcycle       = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patient.Id, BillingcategoryId);
                    var patientccmcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingcategoryId, patientccmcycle);

                    if (patient.EnrollmentSubStatus != "Active Enrolled")
                    {
                        return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Patient is not Active Enrolled." }));
                    }
                    if ((patientccmcyclestatus == "Enrolled" || patientccmcyclestatus == "Ready for Clinical Sign-Off"))
                    {
                        HelperExtensions.UpdatecategoryStatus(BillingcategoryId, patient.Id, patientccmcycle, "Clinical Sign-Off", User.Identity.GetUserId(), "");
                    }
                    else
                    {
                        return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cycle is locked." }));
                    }

                    return(RedirectToAction("Index", "CcmStatus", new { status = "Clinical Sign-Off", BillingcategoryId = BillingcategoryId }));
                }
            }
            catch (Exception ex)
            {
                log.Error(Environment.NewLine + User.Identity.GetUserName() + "-------" + User.Identity.GetUserId() + Environment.NewLine + ex.Message + "-----" + ex.StackTrace);
                return(RedirectToAction("Index", "CcmStatus", new { status = "Clinical Sign-Off" }));
                /*return ex.Message + "------------------" + ex.StackTrace;*/
            }
        }
示例#6
0
        public ActionResult ClaimsSubmission(int?patientId, int?BillingcategoryId, int Cycle = 0)
        {
            try
            {
                var patient = _db.Patients.Where(x => x.Id == patientId).FirstOrDefault();
                if (patient == null)
                {
                    ViewBag.Message = "Patient Not Found!";
                    return(View("Error"));
                }

                //var patientccmcycle = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patient);
                var patientccmcycle = Cycle;
                CategoryCycleStatusHelper.User = User;
                var patientccmcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid, patientccmcycle);
                if (BillingcategoryId == BillingCodeHelper.cmmBillingCatagoryid)
                {
                    if (patient != null)
                    {
                        if (patientccmcyclestatus == "Clinical Sign-Off")
                        {
                            HelperExtensions.UpdateCCMCycleStatus(patient.Id, patientccmcycle, "Claims Submission", User.Identity.GetUserId(), "");
                        }
                        else
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Not Allowed." }));
                        }
                    }
                    if (string.IsNullOrEmpty(patient.CcmBillingCode) || string.IsNullOrEmpty(patient.CcmBillingCode2))
                    {
                        ViewBag.Message = "No Billing Codes Found for Claims Submission!";
                        return(View("Error"));
                    }

                    patient.CcmStatus = "Claims Submission";
                    patient.CcmClaimSubmissionDate = DateTime.Now;
                    patient.UpdatedOn        = DateTime.Now;
                    patient.UpdatedBy        = User.Identity.GetUserId();
                    _db.Entry(patient).State = EntityState.Modified;
                    _db.SaveChanges();
                }
                else
                {
                    CategoryCycleStatusHelper.User = User;
                    var patientcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingcategoryId.GetInteger(), patientccmcycle);
                    if (patient != null)
                    {
                        if (patientcyclestatus == "Clinical Sign-Off")
                        {
                            HelperExtensions.UpdatecategoryStatus(BillingcategoryId, patient.Id, patientccmcycle, "Claims Submission", User.Identity.GetUserId(), "");
                        }
                        else
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Not Allowed." }));
                        }
                    }
                }
                return(RedirectToAction("Index", "CcmStatus", new { status = "Claims Submission", BillingcategoryId = BillingcategoryId }));
            }
            catch (Exception ex)
            {
                log.Error(Environment.NewLine + User.Identity.GetUserName() + "-------" + User.Identity.GetUserId() + Environment.NewLine + ex.Message + "-----" + ex.StackTrace);
                return(RedirectToAction("Index", "CcmStatus", new { status = "Claims Submission" }));
                /*return ex.Message + "------------------" + ex.StackTrace;*/
            }
        }
示例#7
0
        public ActionResult ReadyClinicalSignOff(int?patientId, int?BillingcategoryId)
        {
            try
            {
                var patient = _db.Patients.Where(x => x.Id == patientId).FirstOrDefault();
                if (patient != null)
                {
                    if (BillingcategoryId == BillingCodeHelper.cmmBillingCatagoryid)
                    {
                        CategoryCycleStatusHelper.User = User;
                        var patientccmcycle       = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patient.Id, BillingcategoryId.GetInteger());
                        var patientccmcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingcategoryId.GetInteger(), patientccmcycle);


                        //var totaltimespent = TotalReviewTime(patient.Id, patientccmcycle);
                        //if (totaltimespent.TotalMinutes < 20)
                        //{
                        //    return RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Time is less than 20 minutes." });
                        //}
                        //var finalcareplan = _db.FinalCarePlanNotes.Where(x => x.PatientId == patientId && x.Cycle == patientccmcycle).FirstOrDefault();
                        //if (finalcareplan == null)
                        //{
                        //    var finalcareplans = _db.FinalCarePlanNotes.Where(x => x.PatientId == patientId).OrderByDescending(x => x.CarePlanCreatedOn).ToList();
                        //    if (finalcareplans.Count > 0)
                        //    {
                        //        var lastcareplan = finalcareplans[0];
                        //        if (lastcareplan.CarePlanCreatedOn.Value.Month == DateTime.Now.Month && lastcareplan.CarePlanCreatedOn.Value.Year == DateTime.Now.Year)

                        //        {
                        //            lastcareplan.Cycle = patientccmcycle;
                        //            _db.Entry(lastcareplan).State = EntityState.Modified;
                        //            _db.SaveChanges();
                        //        }
                        //        else
                        //        {
                        //            return RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cannot submit this cycle for billing untill final care plan not generated." }); ;
                        //        }
                        //    }
                        //    else
                        //    {
                        //        return RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cannot submit this cycle for billing untill final care plan not generated." });
                        //    }


                        //}
                        if (patient.EnrollmentSubStatus != "Active Enrolled")
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Patient is not Active Enrolled." }));
                        }
                        if (patientccmcyclestatus == "Enrolled")
                        {
                            var liasionid = _db.Users.AsNoTracking().Where(x => x.CCMid == patient.LiaisonId && x.Role == "Liaison").FirstOrDefault()?.Id;
                            HelperExtensions.UpdateCCMCycleStatus(patient.Id, patientccmcycle, "Ready for Clinical Sign-Off", User.Identity.GetUserId(), "", false, liasionid);
                        }
                        else
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cycle is locked." }));
                        }

                        patient.CcmStatus = "Ready for Clinical Sign-Off";
                        patient.CcmClinicalSignOffDate = DateTime.Now;
                        patient.UpdatedOn        = DateTime.Now;
                        patient.UpdatedBy        = User.Identity.GetUserId();;
                        _db.Entry(patient).State = EntityState.Modified;
                        _db.SaveChanges();
                    }
                    else
                    {
                        CategoryCycleStatusHelper.User = User;
                        var patientccmcycle       = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patient.Id, BillingcategoryId.GetInteger());
                        var patientccmcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingcategoryId.GetInteger(), patientccmcycle);

                        if (patient.EnrollmentSubStatus != "Active Enrolled")
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Patient is not Active Enrolled." }));
                        }
                        if (patientccmcyclestatus == "Enrolled")
                        {
                            var liasionid = _db.Users.AsNoTracking().Where(x => x.CCMid == patient.LiaisonId && x.Role == "Liaison").FirstOrDefault()?.Id;

                            HelperExtensions.UpdatecategoryStatus(BillingcategoryId, patient.Id, patientccmcycle, "Ready for Clinical Sign-Off", User.Identity.GetUserId(), "", false, liasionid);
                        }
                        else
                        {
                            return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Cycle is locked." }));
                        }
                    }
                }

                return(RedirectToAction("Index", "CcmStatus", new { status = "Enrolled", BillingcategoryId = BillingcategoryId }));
            }
            catch (Exception ex)
            {
                log.Error(Environment.NewLine + User.Identity.GetUserName() + "-------" + User.Identity.GetUserId() + Environment.NewLine + ex.Message + "-----" + ex.StackTrace);
                return(RedirectToAction("Index", "CcmStatus", new { status = "Enrolled" }));
                /*return ex.Message + "------------------" + ex.StackTrace;*/
            }
        }