Exemplo n.º 1
0
        // GET: Billing
        public ActionResult Index()
        {
            BillingIndexViewModel viewM             = new BillingIndexViewModel();
            var           fromD                     = new DateTime();
            var           toD                       = new DateTime();
            List <string> physicians                = new List <string>();
            List <string> hospitals                 = new List <string>();
            List <string> services                  = new List <string>();
            List <string> lastnamefilters           = new List <string>();
            Dictionary <string, string> preferences = new Dictionary <string, string>();
            bool?notesCompleted                     = null;
            bool?notesCopied      = null;
            bool?faceSheetEntered = null;
            bool?codingCompleted  = null;
            bool?chargePosted     = null;

            string[] splitList;

            if (Session["billingFromDate"] != null && Session["billingToDate"] != null)
            {
                fromD = Convert.ToDateTime(Session["billingFromDate"]);
                toD   = Convert.ToDateTime(Session["billingToDate"]);
            }
            else
            {
                fromD = getValidDate("", true);
                toD   = getValidDate("", false);
            }
            if (Session["billingSortColumn"] != null)
            {
                viewM.SortColumn    = Session["billingSortColumn"].ToString();
                viewM.SortDirection = (GridFilter.SortDirections)Session["billingSortDirection"];
            }

            //Load user preferences into a dictionary
            preferences = DataCollections.LoadPreferences(db, "Billing", "BillingIndex");

            if (preferences.Count > 0)
            {
                if (preferences["Physician"] != null)
                {
                    splitList  = preferences["Physician"].Split(new char[] { ',' });
                    physicians = splitList.ToList();
                }

                if (preferences["LastNameFilter"] != null)
                {
                    splitList       = preferences["LastNameFilter"].Split(new char[] { ',' });
                    lastnamefilters = splitList.ToList();
                }

                if (preferences["Hospital"] != null)
                {
                    splitList = preferences["Hospital"].Split(new char[] { ',' });
                    hospitals = splitList.ToList();
                }

                if (preferences["ServiceType"] != null)
                {
                    splitList = preferences["ServiceType"].Split(new char[] { ',' });
                    services  = splitList.ToList();
                }
                if (preferences["NotesCompleted"] != null)
                {
                    if (preferences["NotesCompleted"] == "true")
                    {
                        notesCompleted = true;
                    }
                    else
                    {
                        notesCompleted = false;
                    }
                }
                if (preferences["NotesCopied"] != null)
                {
                    if (preferences["NotesCopied"] == "true")
                    {
                        notesCopied = true;
                    }
                    else
                    {
                        notesCopied = false;
                    }
                }
                if (preferences["FaceSheetEntered"] != null)
                {
                    if (preferences["FaceSheetEntered"] == "true")
                    {
                        faceSheetEntered = true;
                    }
                    else
                    {
                        faceSheetEntered = false;
                    }
                }
                if (preferences["CodingCompleted"] != null)
                {
                    if (preferences["CodingCompleted"] == "true")
                    {
                        codingCompleted = true;
                    }
                    else
                    {
                        codingCompleted = false;
                    }
                }
                if (preferences["ChargePosted"] != null)
                {
                    if (preferences["ChargePosted"] == "true")
                    {
                        chargePosted = true;
                    }
                    else
                    {
                        chargePosted = false;
                    }
                }
            }

            //if (Session["billingPhysicians"] != null)
            //{
            //    physicians = (List<string>)Session["billingPhysicians"];
            //}
            //if (Session["billingHospitals"] != null)
            //{
            //    hospitals = (List<string>)Session["billingHospitals"];
            //}
            //if (Session["billingServices"] != null)
            //{
            //    services = (List<string>)Session["billingServices"];
            //}
            //if (Session["billingLastNameFilters"] != null)
            //{
            //    lastnamefilters = (List<string>)Session["billingLastNameFilters"];
            //}

            //if (Session["billingNotesCompleted"] != null)
            //{
            //    notesCompleted = (bool)Session["billingNotesCompleted"];
            //}
            //if (Session["billingNotesCopied"] != null)
            //{
            //    notesCopied = (bool)Session["billingNotesCopied"];
            //}
            //if (Session["billingFaceSheetEntered"] != null)
            //{
            //    faceSheetEntered = (bool)Session["billingFaceSheetEntered"];
            //}
            //if (Session["billingCodingCompleted"] != null)
            //{
            //    codingCompleted = (bool)Session["billingCodingCompleted"];
            //}
            //if (Session["billingChargePosted"] != null)
            //{
            //    chargePosted = (bool)Session["billingChargePosted"];
            //}

            Session["billingFromDate"]      = fromD;
            Session["billingToDate"]        = toD;
            Session["billingSortColumn"]    = viewM.SortColumn;
            Session["billingSortDirection"] = viewM.SortDirection;
            //Session["billingPhysicians"] = physicians;
            //Session["billingHospitals"] = hospitals;
            //Session["billingServices"] = services;
            //Session["billingLastNameFilters"] = lastnamefilters;
            //Session["billingNotesCompleted"] = notesCompleted;
            //Session["billingNotesCopied"] = notesCopied;
            //Session["billingFaceSheetEntered"] = faceSheetEntered;
            //Session["billingCodingCompleted"] = codingCompleted;
            //Session["billingChargePosted"] = chargePosted;

            IQueryable <BillingIndexPatient> query = billingIndexQueryGenerator(fromD, toD, physicians, hospitals, services, lastnamefilters, notesCompleted, notesCopied, faceSheetEntered, chargePosted, codingCompleted, viewM.SortDirection, viewM.SortColumn, false);

            viewM.Patients           = query.AsEnumerable();
            viewM.FromDate           = fromD.ToShortDateString();
            viewM.ToDate             = toD.ToShortDateString();
            viewM.PhysicianList      = DataCollections.getAIMSPhy(db);
            viewM.HospitalList       = DataCollections.getHospital(db);
            viewM.ServiceList        = DataCollections.getServiceType(db);
            viewM.LastNameFilterList = DataCollections.getLastNameFilter();
            viewM.YesNo = DataCollections.getYesNo();
            viewM.SelectedPhysicians       = physicians;
            viewM.SelectedHospitals        = hospitals;
            viewM.SelectedServices         = services;
            viewM.SelectedLastNameFilters  = lastnamefilters;
            viewM.SelectedNotesCompleted   = notesCompleted;
            viewM.SelectedNotesCopied      = notesCopied;
            viewM.SelectedFaceSheetEntered = faceSheetEntered;
            viewM.SelectedCodingCompleted  = codingCompleted;
            viewM.SelectedChargePosted     = chargePosted;
            return(View("Index", viewM));
        }
Exemplo n.º 2
0
        //GET: PatientLog
        public ActionResult Index()
        {
            var viewM = new PatientAssignmentIndexViewModel();
            var fromD = new DateTime();
            var toD   = new DateTime();
            Dictionary <string, string> preferences = new Dictionary <string, string>();
            List <string> physicians = new List <string>();
            string        hospitals  = "BRO";
            List <string> services   = new List <string>();

            string[] splitList;

            if (Session["patientAssignmentFromDate"] != null && Session["patientAssignmentToDate"] != null)
            {
                fromD = Convert.ToDateTime(Session["patientAssignmentFromDate"]);
                toD   = Convert.ToDateTime(Session["patientAssignmentToDate"]);
            }
            else
            {
                fromD = DateTime.Now.AddDays(intDayFallback);
                fromD = fromD.Date + new TimeSpan(0, 0, 0);
                toD   = DateTime.Now;
                toD   = toD.Date + new TimeSpan(23, 59, 59);
            }
            if (Session["patientAssignmentSortColumn"] != null)
            {
                //sortColumn = Session["patientLogSortColumn"].ToString();
                //sortDirection = (GridFilter.FilterTypes)Session["patientLogSortDirection"];
                viewM.SortColumn    = Session["patientAssignmentSortColumn"].ToString();
                viewM.SortDirection = (GridFilter.SortDirections)Session["patientAssignmentSortDirection"];
            }

            //Load user preferences into a dictionary
            preferences = DataCollections.LoadPreferences(db, "PatientAssignment", "PatientAssignmentIndex");

            if (preferences.Count > 0)
            {
                if (preferences["Physician"] != null)
                {
                    splitList  = preferences["Physician"].Split(new char[] { ',' });
                    physicians = splitList.ToList();
                }

                if (preferences["Hospital"] != null)
                {
                    hospitals = preferences["Hospital"];
                }

                if (preferences["ServiceType"] != null)
                {
                    splitList = preferences["ServiceType"].Split(new char[] { ',' });
                    services  = splitList.ToList();
                }
            }
            //if (Session["patientAssignmentPhysicians"] != null)
            //{
            //    physicians = (List<string>)Session["patientAssignmentPhysicians"];
            //}
            //if (Session["patientAssignmentHospitals"] != null)
            //{
            //    string hosp = Session["patientAssignmentHospitals"].ToString();
            //    //tempList.Add(hosp);
            //    hospitals = hosp;
            //}
            //else
            //{
            //    //List<string> tempList = new List<string>();
            //    //string usr = HubSecurity.getLoggedInUserID();
            //    ////string hosp = (from u in db.UserDetails
            //    ////              where u.UserID == usr && u.UserType == "AIMSPhy"
            //    ////              select u.DefaultHospital).Single().ToString();
            //    //string hosp = "HFM"; //DEBUG
            //    //tempList.Add(hosp);
            //    hospitals = "BRO";
            //}
            //if (Session["patientAssignmentServices"] != null)
            //{
            //    services = (List<string>)Session["patientAssignmentServices"];
            //}



            Session["patientAssignmentFromDate"]      = fromD;
            Session["patientAssignmentToDate"]        = toD;
            Session["patientAssignmentSortColumn"]    = viewM.SortColumn;
            Session["patientAssignmentSortDirection"] = viewM.SortDirection;
            //Session["patientAssignmentPhysicians"] = physicians;
            //Session["patientAssignmentHospitals"] = hospitals;
            //Session["patientAssignmentServices"] = services;

            IQueryable <PatientLog> query = patientAssignmentQueryGenerator(fromD, toD, physicians, hospitals, services, viewM.SortDirection, viewM.SortColumn);

            viewM.Patients = query.AsEnumerable <PatientLog>();
            //viewM.ToLookupTally = viewM.Patients.ToLookup(p => p.Physician, p => p.ServiceType);
            viewM.ToLookupTally = query.ToLookup(p => p.Physician, p => p.ServiceType).ToDictionary(p => p.Key, p => p.ToArray());
            if (viewM.ToLookupTally.Count == 0)
            {
                viewM.ToLookupTally.Add("No data", new string[] { "" });
            }
            viewM.FromDate           = fromD.ToShortDateString();
            viewM.ToDate             = toD.ToShortDateString();
            viewM.PhysicianList      = DataCollections.getAIMSPhy(db);
            viewM.HospitalList       = DataCollections.getHospital(db);
            viewM.ServiceList        = DataCollections.getServiceType(db);
            viewM.ImportColumns      = DataCollections.getImportColumns(db);
            viewM.SelectedPhysicians = physicians;
            viewM.SelectedHospitals  = hospitals;
            viewM.SelectedServices   = services;

            return(View("Index", viewM));
        }