Example #1
0
        // GET: PatientLog/Create
        public ActionResult Create()
        {
            PatientLogCreateViewModel viewM = new PatientLogCreateViewModel();

            viewM.GenderList       = DataCollections.getGender(db);
            viewM.ServiceTypeList  = DataCollections.getServiceType(db);
            viewM.HospitalList     = DataCollections.getHospital(db);
            viewM.PatientClassList = DataCollections.getPatientClass(db);
            viewM.PCPList          = DataCollections.getPCP(db, "BRO");
            return(View(viewM));
        }
Example #2
0
        // GET: PatientLog/EditAll
        public ActionResult EditAll()
        {
            var fromD = new DateTime();
            var toD   = new DateTime();

            //List<string> hospitals = new List<string>();

            if (Session["patientLogFromDate"] != null && Session["patientLogToDate"] != null)
            {
                fromD = Convert.ToDateTime(Session["patientLogFromDate"]);
                toD   = Convert.ToDateTime(Session["patientLogToDate"]);
            }
            else
            {
                fromD = DateTime.Now.AddDays(intDayFallback);
                toD   = DateTime.Now;
            }

            //if (Session["patientLogHospitals"] != null)
            //{
            //    hospitals = (List<string>)Session["patientLogHospitals"];
            //}

            PatientLogEditAllViewModel viewM = new PatientLogEditAllViewModel();

            viewM.FromDate = fromD.ToShortDateString();
            viewM.ToDate   = toD.ToShortDateString();
            //viewM.isAdmin = (HubSecurity.isAdmin || HubSecurity.isSiteLeader);

            PatientLogEditViewModel oneEntry;
            List <int> patientList = (List <int>)Session["patientLogListOfID"];

            //Checks if list is null, this should never be the case but stops page from erroring out. This session variable is only empty
            //if you browse to this page before using the Index page
            if (patientList != null)
            {
                foreach (int patID in patientList)
                {
                    oneEntry         = new PatientLogEditViewModel();
                    oneEntry.Patient = db.PatientLogs.Find(patID);

                    //oneEntry.GenderList = getGender(oneEntry.Patient.Gender);
                    oneEntry.HospitalList    = DataCollections.getHospital(db, oneEntry.Patient.Hospital);
                    oneEntry.PCPList         = DataCollections.getPCP(db, oneEntry.Patient.Hospital, oneEntry.Patient.PCP_Practice);
                    oneEntry.ServiceTypeList = DataCollections.getServiceType(db, oneEntry.Patient.ServiceType);
                    //oneEntry.PatientClassList = getPatientClass(oneEntry.Patient.PatientClass);
                    //oneEntry.PhysicianList = getAIMSPhy(oneEntry.Patient.Hospital, oneEntry.Patient.Physician);

                    viewM.Patients.Add(oneEntry);
                }
            }

            return(View("EditAll", viewM));
        }
        public ActionResult Correction()
        {
            string        patient            = "";
            List <string> hospitals          = new List <string>();
            List <string> services           = new List <string>();
            BillingCorrectionViewModel viewM = new BillingCorrectionViewModel();

            if (Session["billingCorrectionServiceDate"] != null)
            {
                viewM.SearchServiceDate = Session["billingCorrectionServiceDate"].ToString();
            }
            else
            {
                viewM.SearchServiceDate = DateTime.Now.ToShortDateString();
                Session["billingCorrectionServiceDate"] = viewM.SearchServiceDate;
            }
            if (Session["billingCorrectionPatient"] != null)
            {
                patient = Session["billingCorrectionPatient"].ToString();
            }
            if (Session["billingCorrectionHospitals"] != null)
            {
                hospitals = (List <string>)Session["billingCorrectionHospitals"];
            }
            if (Session["billingCorrectionServices"] != null)
            {
                services = (List <string>)Session["billingCorrectionServices"];
            }

            viewM.Patients          = new List <BillingIndexPatient>().AsEnumerable();
            viewM.GenderList        = DataCollections.getGender(db);
            viewM.PhysicianList     = DataCollections.getAIMSPhy(db);
            viewM.PCPList           = DataCollections.getPCP(db, "BRO");
            viewM.HospitalList      = DataCollections.getHospital(db);
            viewM.ServiceList       = DataCollections.getServiceType(db);
            viewM.SelectedHospitals = hospitals;
            viewM.SelectedServices  = services;
            viewM.SearchPatientName = patient;

            return(View(viewM));
        }
        public ActionResult Correction(BillingCorrectionViewModel viewM)
        {
            DateTime      fromD     = getValidDate(viewM.SearchServiceDate, true);
            DateTime      toD       = getValidDate(viewM.SearchServiceDate, false);
            string        patient   = viewM.SearchPatientName;
            List <string> hospitals = new List <string>();
            List <string> services  = new List <string>();

            string[] splitList;

            if (viewM.hidHospitals != null && viewM.hidHospitals != "")
            {
                splitList = viewM.hidHospitals.Split(new char[] { ',' });
                hospitals = splitList.ToList <string>();
            }
            if (viewM.hidServices != null && viewM.hidServices != "")
            {
                splitList = viewM.hidServices.Split(new char[] { ',' });
                services  = splitList.ToList <string>();
            }

            BillingCorrectionViewModel returnM = new BillingCorrectionViewModel();

            returnM.Patients          = billingCorrectionQueryGenerator(fromD, toD, patient, hospitals, services);
            returnM.GenderList        = DataCollections.getGender(db);
            returnM.PhysicianList     = DataCollections.getAIMSPhy(db);
            returnM.PCPList           = DataCollections.getPCP(db, "BRO");
            returnM.HospitalList      = DataCollections.getHospital(db);
            returnM.ServiceList       = DataCollections.getServiceType(db);
            returnM.SearchPatientName = patient;
            returnM.SearchServiceDate = fromD.ToShortDateString();
            returnM.SelectedHospitals = hospitals;
            returnM.SelectedServices  = services;

            return(View(returnM));
        }
        public ActionResult Index(BillingIndexViewModel viewM)
        {
            BillingIndexViewModel returnM  = 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>();
            bool?         notesCompleted   = null;
            bool?         notesCopied      = null;
            bool?         faceSheetEntered = null;
            bool?         codingCompleted  = null;
            bool?         chargePosted     = null;

            string[] splitList;

            //Manages physician input and builds a List<string> to be used in the query
            if (viewM.hidPhysicians != null && viewM.hidPhysicians != "")
            {
                splitList  = viewM.hidPhysicians.Split(new char[] { ',' });
                physicians = splitList.ToList <string>();
            }
            //Manages physician input and builds a List<string> to be used in the query
            if (viewM.hidHospitals != null && viewM.hidHospitals != "")
            {
                splitList = viewM.hidHospitals.Split(new char[] { ',' });
                hospitals = splitList.ToList <string>();
            }
            if (viewM.hidServices != null && viewM.hidServices != "")
            {
                splitList = viewM.hidServices.Split(new char[] { ',' });
                services  = splitList.ToList <string>();
            }
            if (viewM.hidLastNameFilters != null && viewM.hidLastNameFilters != "")
            {
                splitList       = viewM.hidLastNameFilters.Split(new char[] { ',' });
                lastnamefilters = splitList.ToList <string>();
            }
            if (viewM.hidNotesCompleted != null)
            {
                switch (viewM.hidNotesCompleted)
                {
                case "true":
                    notesCompleted = true;
                    break;

                case "false":
                    notesCompleted = false;
                    break;
                }
            }
            if (viewM.hidNotesCopied != null)
            {
                switch (viewM.hidNotesCopied)
                {
                case "true":
                    notesCopied = true;
                    break;

                case "false":
                    notesCopied = false;
                    break;
                }
            }
            if (viewM.hidFaceSheetEntered != null)
            {
                switch (viewM.hidFaceSheetEntered)
                {
                case "true":
                    faceSheetEntered = true;
                    break;

                case "false":
                    faceSheetEntered = false;
                    break;
                }
            }
            if (viewM.hidCodingCompleted != null)
            {
                switch (viewM.hidCodingCompleted)
                {
                case "true":
                    codingCompleted = true;
                    break;

                case "false":
                    codingCompleted = false;
                    break;
                }
            }
            if (viewM.hidChargePosted != null)
            {
                switch (viewM.hidChargePosted)
                {
                case "true":
                    chargePosted = true;
                    break;

                case "false":
                    chargePosted = false;
                    break;
                }
            }


            fromD = getValidDate(viewM.FromDate, true);
            toD   = getValidDate(viewM.ToDate, false);

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

            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;

            returnM.Patients           = query.AsEnumerable();
            returnM.FromDate           = fromD.ToShortDateString();
            returnM.ToDate             = toD.ToShortDateString();
            returnM.PhysicianList      = DataCollections.getAIMSPhy(db);
            returnM.HospitalList       = DataCollections.getHospital(db);
            returnM.ServiceList        = DataCollections.getServiceType(db);
            returnM.LastNameFilterList = DataCollections.getLastNameFilter();
            returnM.YesNo = DataCollections.getYesNo();
            returnM.SelectedPhysicians       = physicians;
            returnM.SelectedHospitals        = hospitals;
            returnM.SelectedServices         = services;
            returnM.SelectedLastNameFilters  = lastnamefilters;
            returnM.SelectedNotesCompleted   = notesCompleted;
            returnM.SelectedNotesCopied      = notesCopied;
            returnM.SelectedFaceSheetEntered = faceSheetEntered;
            returnM.SelectedCodingCompleted  = codingCompleted;
            returnM.SelectedChargePosted     = chargePosted;
            returnM.SortColumn    = viewM.SortColumn;
            returnM.SortDirection = viewM.SortDirection;
            return(View("Index", returnM));
        }
        // 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));
        }
Example #7
0
        // GET: PatientLog/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PatientLog patientLog = await db.PatientLogs.FindAsync(id);

            PatientLogEditViewModel viewM = new PatientLogEditViewModel();

            if (patientLog == null)
            {
                return(HttpNotFound());
            }
            viewM.Patient = patientLog;

            //Checks if service type is faxable
            bool foundType = db.FaxServiceTypes.AsEnumerable().Any(f => f.Service == patientLog.ServiceType);

            //If faxable, check that a notification was not sent already, and return the result
            if (foundType)
            {
                string faxType = (from f in db.FaxServiceTypes
                                  where f.Service == patientLog.ServiceType
                                  select f.FaxType).Single() + "Notification";

                bool commSent = db.PCPCommunications.AsEnumerable().Where(c => c.PLRecord == id && c.DocumentType == faxType).Any();
                viewM.isFaxable    = !commSent;
                viewM.alreadyFaxed = commSent;
            }
            else
            {
                viewM.isFaxable = false;
            }

            List <int> idList = (List <int>)Session["patientLogListOfID"];

            //Populates index variables that the view uses to set up previous/next logic
            for (int i = 0; i < idList.Count; i++)
            {
                if (id == idList[i])
                {
                    viewM.Indexer = i;
                    break;
                }
            }
            viewM.IndexerDisplay = viewM.Indexer + 1;
            if (idList.Count() == 1)
            {
                viewM.SafeIndexerPrev = 0;
                viewM.SafeIndexerNext = 0;
            }
            else
            {
                if (viewM.Indexer == 0)
                {
                    viewM.SafeIndexerPrev = 1;
                }
                else
                {
                    viewM.SafeIndexerPrev = viewM.Indexer - 1;
                }
                if (viewM.Indexer == (idList.Count() - 1))
                {
                    viewM.SafeIndexerNext = viewM.Indexer - 1;
                }
                else
                {
                    viewM.SafeIndexerNext = viewM.Indexer + 1;
                }
            }

            //Populates dropdownlists with selected value of current patient
            viewM.GenderList       = DataCollections.getGender(db, viewM.Patient.Gender);
            viewM.HospitalList     = DataCollections.getHospital(db, viewM.Patient.Hospital);
            viewM.PCPList          = DataCollections.getPCP(db, viewM.Patient.Hospital, viewM.Patient.PCP_Practice);
            viewM.ServiceTypeList  = DataCollections.getServiceType(db, viewM.Patient.ServiceType);
            viewM.PatientClassList = DataCollections.getPatientClass(db, viewM.Patient.PatientClass);
            viewM.PhysicianList    = DataCollections.getAIMSPhy(db, viewM.Patient.Hospital, viewM.Patient.Physician);
            return(View(viewM));
        }
Example #8
0
        public ActionResult Index(PatientLogIndexViewModel viewM)
        {
            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>();

            string[] splitList;
            bool     assigned;

            //Manages physician input and builds a List<string> to be used in the query
            if (viewM.hidHospitals != null && viewM.hidHospitals != "")
            {
                splitList = viewM.hidHospitals.Split(new char[] { ',' });
                hospitals = splitList.ToList <string>();
            }
            if (viewM.hidServices != null && viewM.hidServices != "")
            {
                splitList = viewM.hidServices.Split(new char[] { ',' });
                services  = splitList.ToList <string>();
            }
            if (viewM.Assigned)
            {
                assigned = (bool)viewM.Assigned;
            }
            else
            {
                assigned = false;
            }


            fromD = getValidDate(viewM.FromDate, true);
            toD   = getValidDate(viewM.ToDate, false);

            PatientLogIndexViewModel returnM = new PatientLogIndexViewModel();

            returnM.FromDate = fromD.ToShortDateString();
            returnM.ToDate   = toD.ToShortDateString();
            //returnM.PhysicianList = DataCollections.getAIMSPhy(db);
            returnM.HospitalList = DataCollections.getHospital(db);
            returnM.ServiceList  = DataCollections.getServiceType(db);
            //returnM.SelectedPhysicians = physicians;
            returnM.SelectedHospitals = hospitals;
            returnM.SelectedServices  = services;
            returnM.Assigned          = assigned;
            returnM.SortColumn        = viewM.SortColumn;
            returnM.SortDirection     = viewM.SortDirection;

            Session["patientLogFromDate"]      = fromD;
            Session["patientLogToDate"]        = toD;
            Session["patientLogSortColumn"]    = returnM.SortColumn;
            Session["patientLogSortDirection"] = returnM.SortDirection;
            //Session["patientLogPhysicians"] = physicians;
            //Session["patientLogHospitals"] = hospitals;
            //Session["patientLogServices"] = services;
            //Session["patientLogAssigned"] = assigned;

            IQueryable <PatientLog> query = patientLogQueryGenerator(fromD, toD, hospitals, services, returnM.SortDirection, returnM.SortColumn, assigned);

            returnM.Patients   = query.AsEnumerable <PatientLog>();
            returnM.RiskFactor = new Dictionary <string, string>();
            foreach (PatientLog pat in returnM.Patients)
            {
                bool isHigh = (from p in db.PatientLogs where pat.MRN_FIN == p.MRN_FIN && p.ServiceType.Contains("DC -") && (p.ServiceDate >= DbFunctions.AddDays(pat.ServiceDate, -7) && p.ServiceDate < pat.ServiceDate) select p.ID).Any();

                if (isHigh)
                {
                    returnM.RiskFactor.Add(pat.ID.ToString(), "H");
                    continue;
                }

                bool isMed = (from p in db.PatientLogs where pat.MRN_FIN == p.MRN_FIN && p.ServiceType.Contains("DC -") && (p.ServiceDate >= DbFunctions.AddDays(pat.ServiceDate, -30) && p.ServiceDate < pat.ServiceDate) select p.ID).Any();

                if (isMed)
                {
                    returnM.RiskFactor.Add(pat.ID.ToString(), "M");
                }
            }
            return(View(returnM));
        }
Example #9
0
        //GET: PatientLog
        public ActionResult Index()
        {
            var viewM = new PatientLogIndexViewModel();
            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>();

            string[] splitList;
            string   pref;
            bool     assigned;

            //PatientLogIndexViewModel viewM;


            if (Session["patientLogFromDate"] != null && Session["patientLogToDate"] != null)
            {
                fromD = Convert.ToDateTime(Session["patientLogFromDate"]);
                toD   = Convert.ToDateTime(Session["patientLogToDate"]);
            }
            else
            {
                fromD = getValidDate("", true);
                toD   = getValidDate("", false);
            }
            if (Session["patientLogSortColumn"] != null)
            {
                viewM.SortColumn    = Session["patientLogSortColumn"].ToString();
                viewM.SortDirection = (GridFilter.SortDirections)Session["patientLogSortDirection"];
            }

            pref = DataCollections.LoadPreference(db, "PatientLog", "PatientLogIndex", "Hospital");

            if (pref != null)
            {
                splitList = pref.Split(new char[] { ',' });
                hospitals = splitList.ToList();
            }
            pref = DataCollections.LoadPreference(db, "PatientLog", "PatientLogIndex", "ServiceType");
            if (pref != null)
            {
                splitList = pref.Split(new char[] { ',' });
                services  = splitList.ToList();
            }

            if (Session["patientLogAssigned"] != null)
            {
                assigned = (bool)Session["patientLogAssigned"];
            }
            else
            {
                assigned = false;
            }

            Session["patientLogFromDate"]      = fromD;
            Session["patientLogToDate"]        = toD;
            Session["patientLogSortColumn"]    = viewM.SortColumn;
            Session["patientLogSortDirection"] = viewM.SortDirection;
            //Session["patientLogPhysicians"] = physicians;
            //Session["patientLogHospitals"] = hospitals;
            //Session["patientLogServices"] = services;

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

            viewM.Patients = query.AsEnumerable();
            //Determines risk factor for each patient
            viewM.RiskFactor = new Dictionary <string, string>();
            foreach (PatientLog pat in viewM.Patients)
            {
                bool isHigh = (from p in db.PatientLogs where pat.MRN_FIN == p.MRN_FIN && p.ServiceType.Contains("DC -") && (p.ServiceDate >= DbFunctions.AddDays(pat.ServiceDate, -7) && p.ServiceDate < pat.ServiceDate) select p.ID).Any();

                if (isHigh)
                {
                    viewM.RiskFactor.Add(pat.ID.ToString(), "H");
                    continue;
                }

                bool isMed = (from p in db.PatientLogs where pat.MRN_FIN == p.MRN_FIN && p.ServiceType.Contains("DC -") && (p.ServiceDate >= DbFunctions.AddDays(pat.ServiceDate, -30) && p.ServiceDate < pat.ServiceDate) select p.ID).Any();

                if (isMed)
                {
                    viewM.RiskFactor.Add(pat.ID.ToString(), "M");
                }
            }

            if (viewM.RiskFactor == null)
            {
                viewM.RiskFactor.Add("testkey", "val1");
            }
            viewM.FromDate = fromD.ToShortDateString();
            viewM.ToDate   = toD.ToShortDateString();
            //viewM.PhysicianList = DataCollections.getAIMSPhy(db);
            viewM.HospitalList = DataCollections.getHospital(db);
            viewM.ServiceList  = DataCollections.getServiceType(db);
            //viewM.SelectedPhysicians = physicians;
            viewM.SelectedHospitals = hospitals;
            viewM.SelectedServices  = services;

            return(View("Index", viewM));
        }
Example #10
0
        public ActionResult Index(PatientAssignmentIndexViewModel viewM)
        {
            //Value will always be null unless CopyButton caused post
            if (viewM.CopyButton != null)
            {
                DataSubmissions.CopyPatients(db, viewM.hidSelectedIDs);
            }
            //Value will always be null unless DeleteButton caused post
            if (viewM.DeleteButton != null)
            {
                DataSubmissions.DeletePatients(db, viewM.hidSelectedIDs);
            }

            var           fromD      = new DateTime();
            var           toD        = new DateTime();
            List <string> physicians = new List <string>();
            //List<string> hospitals = new List<string>();
            string        hospitals = viewM.SelectedHospitals;
            List <string> services  = new List <string>();

            string[] splitList;

            //Manages physician input and builds a List<string> to be used in the query
            if (viewM.hidPhysicians != null && viewM.hidPhysicians != "")
            {
                splitList  = viewM.hidPhysicians.Split(new char[] { ',' });
                physicians = splitList.ToList <string>();
            }

            //Manages physician input and builds a List<string> to be used in the query
            //if (viewM.hidHospitals != null && viewM.hidHospitals != "")
            //{
            //    //splitList = viewM.hidHospitals.Split(new char[] { ',' });
            //    //hospitals = splitList.ToList<string>();
            //    hospitals = viewM.hidHospitals;
            //}
            if (viewM.hidServices != null && viewM.hidServices != "")
            {
                splitList = viewM.hidServices.Split(new char[] { ',' });
                services  = splitList.ToList <string>();
            }


            fromD = getValidDate(viewM.FromDate, true);
            toD   = getValidDate(viewM.ToDate, false);

            PatientAssignmentIndexViewModel returnM = new PatientAssignmentIndexViewModel();

            returnM.FromDate           = fromD.ToShortDateString();
            returnM.ToDate             = toD.ToShortDateString();
            returnM.PhysicianList      = DataCollections.getAIMSPhy(db);
            returnM.HospitalList       = DataCollections.getHospital(db);
            returnM.ServiceList        = DataCollections.getServiceType(db);
            returnM.ImportColumns      = DataCollections.getImportColumns(db);
            returnM.SelectedPhysicians = physicians;
            returnM.SelectedHospitals  = hospitals;
            returnM.SelectedServices   = services;
            returnM.SortColumn         = viewM.SortColumn;
            returnM.SortDirection      = viewM.SortDirection;

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

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

            returnM.Patients      = query.AsEnumerable <PatientLog>();
            returnM.ToLookupTally = query.ToLookup(p => p.Physician, p => p.ServiceType).ToDictionary(p => p.Key, p => p.ToArray());
            if (returnM.ToLookupTally.Count == 0)
            {
                returnM.ToLookupTally.Add("No data", new string[] { "" });
            }
            return(View(returnM));
        }
Example #11
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));
        }