Exemplo n.º 1
0
        public JsonResult UnarchivePatientRecord(int patientID)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            var            patients       = mbprosEntities.PatientMasters.Where(aa => aa.PatientID == patientID).ToList();

            foreach (var pat in patients)
            {
                pat.IsArchived = false;
                mbprosEntities.Entry(pat).State = System.Data.Entity.EntityState.Modified;
                mbprosEntities.SaveChanges();
            }
            TempData["EditMessage"] = "Y";
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public JsonResult ArchiveBillingRecord(int patientBillingID)
        {
            MbprosEntities mbprosEntities  = new MbprosEntities();
            var            patientBillings = mbprosEntities.PatientBillings.Where(aa => aa.PatientBillingID == patientBillingID).ToList();

            foreach (var patBill in patientBillings)
            {
                patBill.IsArchived = true;
                mbprosEntities.Entry(patBill).State = System.Data.Entity.EntityState.Modified;
                mbprosEntities.SaveChanges();
            }
            TempData["EditMessage"] = "Y";
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult AddUser(UserModels userModel)
        {
            if (ModelState.IsValid)
            {
                var UserId = Convert.ToString(Session["USERID"]) == "" ? 0 : Convert.ToInt32(Session["USERID"]);
                if (userModel.UserId == 0)//ADD mode
                {
                    if (!IsUserExist(userModel.UserName))
                    {
                        using (MbprosEntities mbprosEntities = new MbprosEntities())
                        {
                            User user = new User();
                            user.UserName   = userModel.UserName;
                            user.OfficeName = userModel.OfficeName;
                            user.Password   = userModel.Password;
                            user.Status     = true;
                            user.IsAdmin    = true;
                            user.EmailID    = userModel.EmailID;
                            user.IsAdmin    = false;
                            //if (userModel.IsAdmin == null)
                            //    user.IsAdmin = false;
                            //else
                            //    user.IsAdmin = userModel.IsAdmin == true ? true : false;
                            user.CreatedDate = DateTime.Now.Date;
                            user.CreatedBy   = UserId;

                            mbprosEntities.Users.Add(user);

                            //Save user in membership
                            WebSecurity.CreateUserAndAccount(userModel.UserName, userModel.Password);
                            if (!Roles.RoleExists("USER"))
                            {
                                Roles.CreateRole("USER");
                            }
                            Roles.AddUserToRole(userModel.UserName, "USER");

                            mbprosEntities.SaveChanges();

                            //Add entries in FeatuereUser table for Normal user
                            var idParam = new SqlParameter
                            {
                                ParameterName = "UserID",
                                Value         = user.UserId
                            };
                            var idParamB = new SqlParameter
                            {
                                ParameterName = "IsAdminUser",
                                Value         = 0
                            };
                            mbprosEntities.Database.ExecuteSqlCommand("usp_AddFeatureUser @UserID, @IsAdminUser", idParam, idParamB);
                            //
                        }
                        ViewBag.IsUserExist     = "";
                        TempData["UserMessage"] = "Y";
                        //return RedirectToAction("AddUser", new { userID = 0, message = "User saved successfully." });
                        return(RedirectToAction("SearchUser", new { message = "User added successfully.", IsBack = true }));
                    }
                    else
                    {
                        ViewBag.IsUserExist = "YES";
                    }
                }
                else//EDIT mode
                {
                    using (MbprosEntities mbprosEntities = new MbprosEntities())
                    {
                        User user = mbprosEntities.Users.Find(userModel.UserId);
                        if (user != null)
                        {
                            WebSecurity.ChangePassword(userModel.UserName, user.Password, userModel.Password);

                            //user.UserName = userModel.UserName; //NEVER
                            user.OfficeName  = userModel.OfficeName;
                            user.Password    = userModel.Password;
                            user.EmailID     = userModel.EmailID;
                            user.UpdatedDate = DateTime.Now;
                            user.UpdatedBy   = UserId;
                            user.IsAdmin     = userModel.IsAdmin;

                            mbprosEntities.Entry(user).State = System.Data.Entity.EntityState.Modified;
                            mbprosEntities.SaveChanges();
                        }
                    }
                    TempData["UserMessage"] = "Y";
                    return(RedirectToAction("SearchUser", new { message = "User updated successfully.", IsBack = true }));
                }
            }
            return(View(userModel));
        }
Exemplo n.º 4
0
        public ActionResult AddPatient(PatientModel patientModel)
        {
            patientModel.Sex                  = Request.Form["hdnSex"];
            patientModel.IsPatInsured         = Request.Form["hdnIsInsured"];
            patientModel.IsConditionRelatedTo = Request.Form["hdnIsConditionRelatedTo"];
            patientModel.IsSecondaryInsurance = Request.Form["hdnIsSecInsurance"];
            patientModel.IsVerifyEligibility  = Request.Form["hdnIsVerify"];
            //        var errors = ModelState
            //.Where(x => x.Value.Errors.Count > 0)
            //.Select(x => new { x.Key, x.Value.Errors })
            //.ToArray();

            if (ModelState.IsValid)
            {
                var UserId = Convert.ToString(Session["USERID"]) == "" ? 0 : Convert.ToInt32(Session["USERID"]);
                // check captcha code is valid or not
                bool   isCaptchaCodeValid = false;
                string CaptchaMessage     = "";
                if (UserId > 0)
                {
                    isCaptchaCodeValid = true;
                }
                else
                {
                    isCaptchaCodeValid = CommonFunctions.GetCaptchaResponse(Request.Form["recaptcha_challenge_field"], Request.Form["recaptcha_response_field"], patientModel.CaptchaSecretkey.ToString(), out CaptchaMessage);
                }
                if (isCaptchaCodeValid)
                {
                    int patientID = 0;
                    using (MbprosEntities mbprosEntities = new MbprosEntities())
                    {
                        PatientMaster patientMaster = new PatientMaster();
                        if (patientModel.PatientID != 0)
                        {
                            patientMaster                     = mbprosEntities.PatientMasters.Find(patientModel.PatientID);
                            patientModel.Sex                  = Request.Form["hdnSex"];
                            patientModel.IsPatInsured         = Request.Form["hdnIsInsured"];
                            patientModel.IsConditionRelatedTo = Request.Form["hdnIsConditionRelatedTo"];
                            patientModel.IsSecondaryInsurance = Request.Form["hdnIsSecInsurance"];
                            patientModel.IsVerifyEligibility  = Request.Form["hdnIsVerify"];
                        }
                        patientMaster.OfficeName    = patientModel.OfficeName;
                        patientMaster.PatientName   = patientModel.PatientName;
                        patientMaster.StreetAddress = patientModel.StreetAddress;
                        patientMaster.City          = patientModel.City;
                        patientMaster.StateCode     = patientModel.StateCode;
                        patientMaster.ZipCode       = patientModel.ZipCode;
                        if (!string.IsNullOrEmpty(patientModel.DateofBirth))
                        {
                            patientMaster.DateofBirth = DateTime.ParseExact(patientModel.DateofBirth, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }

                        patientMaster.SSN = patientModel.SSN;
                        patientMaster.Sex = patientModel.Sex == "" ? "M" : patientModel.Sex;
                        patientMaster.InsuranceCompanyName    = patientModel.InsuranceCompanyName;
                        patientMaster.InsuranceCompanyAddress = patientModel.InsuranceCompanyAddress;
                        patientMaster.InsuranceCompanyPhone   = patientModel.InsuranceCompanyPhone;

                        patientMaster.EDIPayerNumber = patientModel.EDIPayerNumber;



                        patientMaster.PolicyID    = patientModel.PolicyID;
                        patientMaster.GroupNumber = patientModel.GroupNumber;

                        if (patientModel.IsPatInsured == "NO")
                        {
                            patientMaster.PrimaryInsuredName = patientModel.PrimaryInsuredName;
                            if (!string.IsNullOrEmpty(patientModel.PrimaryInsuredDOB))
                            {
                                patientMaster.PrimaryInsuredDOB = DateTime.ParseExact(patientModel.PrimaryInsuredDOB, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                            }

                            patientMaster.IsInsured = false;
                        }
                        else if (patientModel.IsPatInsured == "YES")
                        {
                            patientMaster.IsInsured = true;
                        }

                        patientMaster.ConditionRelatedTo = patientModel.IsConditionRelatedTo;

                        if (!string.IsNullOrEmpty(patientModel.DateofAccident))
                        {
                            patientMaster.DateofAccident = DateTime.ParseExact(patientModel.DateofAccident, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        patientMaster.InsuranceFax = patientModel.InsuranceFax;
                        patientMaster.AdjusterName = patientModel.AdjusterName;

                        if (patientModel.IsSecondaryInsurance == "True")// "Y")// IsSecInsurance == "YES")
                        {
                            patientMaster.SecondaryInsuranceCompanyName  = patientModel.SecondaryInsuranceCompanyName;
                            patientMaster.SecondaryInsuranceCompanyAddr  = patientModel.SecondaryCompanyAddr;
                            patientMaster.SecondaryInsuranceCompanyPhone = patientModel.SecondaryInsuranceCompanyPhone;
                            patientMaster.SecondaryInsuranceID           = patientModel.SecondaryInsuranceID;
                            patientMaster.SecondaryInsuranceGroupID      = patientModel.SecondaryInsuranceGroupID;
                            patientMaster.SecondaryInsuredName           = patientModel.SecondaryInsuredName;

                            if (!string.IsNullOrEmpty(patientModel.SecondaryInsuredDOB))
                            {
                                patientMaster.SecondaryInsuredDOB = DateTime.ParseExact(patientModel.SecondaryInsuredDOB, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                            }
                            patientMaster.IsSecondaryInsurance = true;
                        }
                        else
                        {
                            patientMaster.IsSecondaryInsurance = false;
                        }

                        patientMaster.IsVerifyEligibility = patientModel.IsVerifyEligibility == "True" ? true : false;
                        patientMaster.FacilityName        = patientModel.FacilityName;
                        if (!string.IsNullOrEmpty(patientModel.AdmissionDate))
                        {
                            patientMaster.AdmissionDate = DateTime.ParseExact(patientModel.AdmissionDate, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        if (!string.IsNullOrEmpty(patientModel.LastSeenByRefProvider))
                        {
                            patientMaster.LastSeenByRefProvider = DateTime.ParseExact(patientModel.LastSeenByRefProvider, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        patientMaster.ReferringProviderName = patientModel.ReferringProviderName;
                        patientMaster.ReferringProviderNPI  = patientModel.ReferringProviderNPI;
                        if (!string.IsNullOrEmpty(patientModel.InitialTreatmentDate))
                        {
                            patientMaster.InitialTreatmentDate = DateTime.ParseExact(patientModel.InitialTreatmentDate, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        patientMaster.LastXRayDateORPARTCodes = patientModel.LastXRayDateORPARTCodes;
                        patientMaster.DiagnosisCodes          = patientModel.DiagnosisCodes;
                        patientMaster.AdditionalInfo          = patientModel.AdditionalInfo;
                        //patientMaster.InsuranceVerification = patientModel.InsVerification;
                        patientMaster.Active = true;
                        //patientMaster.UserEmailID = patientModel.UserEmailID;
                        if (patientModel.PatientID == 0)
                        {
                            patientMaster.CreatedDate = DateTime.Now.Date;
                            patientMaster.CreatedBy   = UserId;

                            mbprosEntities.PatientMasters.Add(patientMaster);
                            mbprosEntities.SaveChanges();
                            patientID = patientMaster.PatientID;
                        }
                        else
                        {
                            patientID = patientMaster.PatientID;
                            patientMaster.UpdatedDate = DateTime.Now;
                            patientMaster.UpdatedBy   = UserId;
                            mbprosEntities.Entry(patientMaster).State = System.Data.Entity.EntityState.Modified;
                            mbprosEntities.SaveChanges();
                        }
                    }
                    ViewBag.CaptchaMessage = "";
                    if (patientModel.PatientID == 0)
                    {
                        return(RedirectToAction("Confirmation", new { patientID = patientID, officeName = patientModel.OfficeName }));
                    }
                    else
                    {
                        TempData["EditMessage"] = "Y";
                        return(RedirectToAction(patientModel.CallFrom, "Search", new { editMessage = "Patient details updated successfully", IsBack = true }));
                    }
                }
                else
                {
                    ViewBag.CaptchaMessage = CaptchaMessage;
                }
            }
            patientModel.StateList = new SelectList(CommonFunctions.GetAllDropdownList("STATES"), "ID", "NAME", 0);

            return(View(patientModel));
        }
Exemplo n.º 5
0
        public ActionResult BillingLog(BillingModel billingModel)
        {
            if (ModelState.IsValid)
            {
                var UserId = Convert.ToString(Session["USERID"]) == "" ? 0 : Convert.ToInt32(Session["USERID"]);
                // check captcha code is valid or not
                bool   isCaptchaCodeValid = false;
                string ReCaptchaMessage   = "";
                if (billingModel.BillingID == 0)// Code for Add Billing details
                {
                    if (UserId > 0)
                    {
                        isCaptchaCodeValid = true;
                    }
                    else
                    {
                        isCaptchaCodeValid = CommonFunctions.GetCaptchaResponse(Request.Form["recaptcha_challenge_field"], Request.Form["recaptcha_response_field"], billingModel.CaptchaSecretkey.ToString(), out ReCaptchaMessage);
                    }
                    if (isCaptchaCodeValid)
                    {
                        int patientBillingID = 0;
                        using (MbprosEntities mbprosEntities = new MbprosEntities())
                        {
                            patientBillingID = Common.CommonFunctions.GetNextPatientBillingID();
                            for (int i = 1; i <= 15; i++)
                            {
                                if (!string.IsNullOrEmpty(Request.Form["PatientName" + i]))
                                {
                                    PatientBilling patientBilling = new PatientBilling();
                                    patientBilling.PatientBillingID = patientBillingID;
                                    patientBilling.OfficeName       = billingModel.OfficeName;
                                    patientBilling.PatientName      = Request.Form["PatientName" + i];
                                    if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i]))
                                    {
                                        patientBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture);
                                    }
                                    patientBilling.CoPayType = Request.Form["CopayType" + i];
                                    if (!string.IsNullOrEmpty(patientBilling.CoPayType))
                                    {
                                        patientBilling.ChequeNo  = Request.Form["ChequeNo" + i];
                                        patientBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]);
                                    }
                                    patientBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i];
                                    patientBilling.DXCode         = Request.Form["NewDXCodes" + i];
                                    patientBilling.SrNo           = i;

                                    patientBilling.CreatedDate = DateTime.Now.Date;
                                    patientBilling.CreatedBy   = UserId;
                                    patientBilling.Active      = true;
                                    patientBilling.IsArchived  = false;
                                    patientBilling.Note        = billingModel.AdditionalComments;

                                    mbprosEntities.PatientBillings.Add(patientBilling);
                                }
                            }

                            mbprosEntities.SaveChanges();
                        }
                        ViewBag.ReCaptchaMessage = "";
                        return(RedirectToAction("Confirmation", "Billing", new { billingFormID = patientBillingID, officeName = billingModel.OfficeName }));
                    }
                    else
                    {
                        ViewBag.ReCaptchaMessage = ReCaptchaMessage;
                    }
                }
                else// Code for edit Billing details
                {
                    // here we will have to add 3 codes first for edit existing , other for add new if not exist in DB and one for for deleting if user deletes exisitng record.
                    MbprosEntities mbprosEntities   = new MbprosEntities();
                    var            billDetails      = mbprosEntities.PatientBillings.Where(x => x.PatientBillingID == billingModel.BillingID);
                    int            patientBillingID = 0;
                    for (int i = 1; i <= 15; i++)
                    {
                        PatientBilling objBilling = billDetails.Where(x => x.SrNo == i).FirstOrDefault();
                        if (!string.IsNullOrEmpty(Request.Form["PatientName" + i]))
                        {
                            if (objBilling != null) // it means update the record.
                            {
                                if (i == 1)
                                {
                                    patientBillingID = objBilling.PatientBillingID;
                                }
                                objBilling.OfficeName  = billingModel.OfficeName;
                                objBilling.PatientName = Request.Form["PatientName" + i];
                                if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i]))
                                {
                                    objBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture);
                                }
                                objBilling.CoPayType = Request.Form["CopayType" + i];
                                if (!string.IsNullOrEmpty(objBilling.CoPayType))
                                {
                                    objBilling.ChequeNo  = Request.Form["ChequeNo" + i];
                                    objBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]);
                                }
                                objBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i];
                                objBilling.DXCode         = Request.Form["NewDXCodes" + i];
                                objBilling.SrNo           = i;

                                objBilling.Active = true;
                                objBilling.Note   = billingModel.AdditionalComments;

                                objBilling.BillingFormID = objBilling.BillingFormID;
                                objBilling.UpdatedDate   = DateTime.Now;
                                objBilling.UpdatedBy     = UserId;
                                mbprosEntities.Entry(objBilling).State = System.Data.Entity.EntityState.Modified;
                                mbprosEntities.SaveChanges();
                            }
                            else
                            { // 2 conditions add
                                PatientBilling patientBilling = new PatientBilling();
                                patientBilling.PatientBillingID = patientBillingID;
                                patientBilling.OfficeName       = billingModel.OfficeName;
                                patientBilling.PatientName      = Request.Form["PatientName" + i];
                                if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i]))
                                {
                                    patientBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture);
                                }
                                patientBilling.CoPayType = Request.Form["CopayType" + i];
                                if (!string.IsNullOrEmpty(patientBilling.CoPayType))
                                {
                                    patientBilling.ChequeNo  = Request.Form["ChequeNo" + i];
                                    patientBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]);
                                }
                                patientBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i];
                                patientBilling.DXCode         = Request.Form["NewDXCodes" + i];
                                patientBilling.SrNo           = i;

                                patientBilling.Active      = true;
                                patientBilling.Note        = billingModel.AdditionalComments;
                                patientBilling.CreatedDate = DateTime.Now.Date;
                                patientBilling.CreatedBy   = UserId;
                                patientBilling.IsArchived  = false;
                                mbprosEntities.PatientBillings.Add(patientBilling);
                                mbprosEntities.SaveChanges();
                            }
                        }
                        else
                        {
                            if (objBilling != null) // it means delete the record.
                            {
                                mbprosEntities.PatientBillings.Attach(objBilling);
                                mbprosEntities.PatientBillings.Remove(objBilling);
                                mbprosEntities.SaveChanges();
                            }
                        }
                    }
                    TempData["EditMessage"] = "Y";
                    return(RedirectToAction(billingModel.CallFrom, "Search", new { editMessage = "Patient billing details updated successfully", IsBack = true }));
                }
            }

            return(View(billingModel));
        }