public ActionResult Create(PatientLogCreateViewModel viewM) { if (ModelState.IsValid) { viewM.Patient.Physician = HubSecurity.getLoggedInUserID(); DataSubmissions.CreatePatient(db, viewM.Patient); return(RedirectToAction("Index")); } return(View(viewM.Patient)); }
public JsonResult jsonSubmitCommunicationMethod(ReferringPractice prac) { string result = ""; ReferringPractice newPrac = DataCollections.getPractice(db, prac.PracID); newPrac.EmailNotification = prac.EmailNotification; newPrac.FaxNotification = prac.FaxNotification; DataSubmissions.SavePractice(db, newPrac); result = "Communication Methods Saved"; return(Json(result)); }
public JsonResult jsonDeletePatients(string ids) { string[] split = ids.Split(new char[] { ',' }); DataSubmissions.DeletePatients(db, split); //for (int i = 0; i < ids.Length; i++) //{ // int id = Convert.ToInt32(split[i]); // PatientLog patient = db.PatientLogs.Find(id); // //PatientLogTmp pt = DataSubmissions.CreateTmpPatient(patient); // //db.PatientLogTmps.Add(pt); // //db.PatientLogs.Remove(patient); // DataSubmissions.DeletePatients() //} //db.SaveChanges(); return(Json("Success", JsonRequestBehavior.AllowGet)); }
public ActionResult jsonCopyPatients(string ids) { string[] split = ids.Split(new char[] { ',' }); DataSubmissions.CopyPatients(db, split); //for (int i = 0; i < ids.Length; i++) //{ // int id = Convert.ToInt32(split[i]); // PatientLog patientLog = db.PatientLogs.Find(id); // //Reset values for copied record // patientLog.ServiceDate = DateTime.Parse(DateTime.Now.ToShortDateString()); // patientLog.DateCreated = DateTime.Now; // patientLog.LastUpdated = null; // patientLog.Notes = null; // db.PatientLogs.Add(patientLog); //} //db.SaveChanges(); return(Content("Boo")); }
public JsonResult jsonSubmitPracticeInformation(ReferringPractice prac) { string result = ""; ReferringPractice newPrac = DataCollections.getPractice(db, prac.PracID); newPrac.Address1 = prac.Address1; newPrac.Address2 = prac.Address2; newPrac.Address3 = prac.Address3; newPrac.City = prac.City; newPrac.State = prac.State; newPrac.Zip = prac.Zip; newPrac.Phone = prac.Phone; newPrac.Fax = prac.Fax; newPrac.Email = prac.Email; newPrac.OfficeManager = prac.OfficeManager; newPrac.Other = prac.Other; newPrac.PDFPassword = prac.PDFPassword; DataSubmissions.SavePractice(db, newPrac); result = "Practice Information Saved"; return(Json(result)); }
//This function returns results from PatientLog table for all PatientLog Views aside from PatientSort private IQueryable <BillingIndexPatient> billingIndexQueryGenerator(DateTime fromDate, DateTime toDate, List <string> selectedPhy, List <string> selectedHosp, List <string> selectedServ, List <string> selectedLastNameFilters, bool?notesCompleted, bool?notesCopied, bool?faceSheetEntered, bool?chargePosted, bool?codingCompleted, GridFilter.SortDirections direction, string sortColumn, bool purge) { //Query billing records IQueryable <BillingIndexPatient> query = from d in db.PatientLogs join b in db.Billings on d.ID equals b.PLRecord into ds from b in ds.DefaultIfEmpty() where d.ServiceDate >= fromDate && d.ServiceDate <= toDate && d.ServiceType != "Assigned" select new BillingIndexPatient() { ID = b.ID, PLRecord = d.ID, PatientName = d.PatientName, DOB = d.DOB, MRN_FIN = d.MRN_FIN, Hospital = d.Hospital, ServiceDate = d.ServiceDate, ServiceType = d.ServiceType, Physician = d.Physician, NotesCompleted = b.NotesCompleted, NotesCopied = b.NotesCopied, FaceSheetEntered = b.FaceSheetEntered, ChargePosted = b.ChargePosted, CodingCompleted = b.CodingCompleted, Purge = b.Purge }; if (selectedPhy.Any()) { query = query.Where(h => selectedPhy.Contains(h.Physician)); } //Apply hospital filters if any are provided if (selectedHosp.Any()) { query = query.Where(h => selectedHosp.Contains(h.Hospital)); } if (selectedServ.Any()) { query = query.Where(s => selectedServ.Contains(s.ServiceType)); } if (selectedLastNameFilters.Any()) { for (int i = 0; i < selectedLastNameFilters.Count() - 1; i++) { query = query.Where(f => f.PatientName.StartsWith(selectedLastNameFilters[i])); } } //Filter by notes completed if necessary if (notesCompleted == true) { query = query.Where(n => n.NotesCompleted == true); } else if (notesCompleted == false) { query = query.Where(n => n.NotesCompleted == false); } //Filter by notes copied if necessary if (notesCopied == true) { query = query.Where(n => n.NotesCopied == true); } else if (notesCopied == false) { query = query.Where(n => n.NotesCopied == false); } //Filter by facesheet entere3d if necessary if (faceSheetEntered == true) { query = query.Where(n => n.FaceSheetEntered == true); } else if (faceSheetEntered == false) { query = query.Where(n => n.FaceSheetEntered == false); } //Filter by coding completed if necessary if (codingCompleted == true) { query = query.Where(n => n.CodingCompleted == true); } else if (codingCompleted == false) { query = query.Where(n => n.CodingCompleted == false); } //Filter by charge posted if necessary if (chargePosted == true) { query = query.Where(n => n.ChargePosted == true); } else if (chargePosted == false) { query = query.Where(n => n.ChargePosted == false); } //Apply sorting (default = PatientName ASC) if (direction == GridFilter.SortDirections.Ascending) { if (sortColumn == "PatientName") { query = query.OrderBy(sortColumn + ", ServiceDate"); } else { query = query.OrderBy(sortColumn); } } else { query = query.OrderBy(sortColumn + " " + "DESC"); } if (purge) { query = query.Where(n => n.Purge == true); } List <int> plRecordList = query.Select(p => p.PLRecord).ToList(); foreach (int id in plRecordList) { bool exists = (from b in db.Billings where b.PLRecord == id select b.ID).Any(); if (!exists) { DataSubmissions.CreateBillingEntry(db, id); } } //Save preferences Dictionary <string, string> filters = new Dictionary <string, string>(); string pref = null; foreach (string phy in selectedPhy) { pref += phy + ","; } if (pref != null) { pref = pref.Substring(0, pref.Length - 1); } filters.Add("Physician", pref); pref = null; foreach (string hosp in selectedHosp) { pref += hosp + ","; } if (pref != null) { pref = pref.Substring(0, pref.Length - 1); } filters.Add("Hospital", pref); pref = null; foreach (string serv in selectedServ) { pref += serv + ","; } if (pref != null) { pref = pref.Substring(0, pref.Length - 1); } filters.Add("ServiceType", pref); pref = null; foreach (string lnf in selectedLastNameFilters) { pref += lnf + ","; } if (pref != null) { pref = pref.Substring(0, pref.Length - 1); } filters.Add("LastNameFilter", pref); if (direction == GridFilter.SortDirections.Ascending) { filters.Add("SortDirection", "Ascending"); } else { filters.Add("SortDirection", "Descending"); } filters.Add("SortColumn", sortColumn); pref = null; if (notesCompleted != null) { pref = notesCompleted.ToString(); } filters.Add("NotesCompleted", pref); pref = null; if (notesCopied != null) { pref = notesCopied.ToString(); } filters.Add("NotesCopied", pref); pref = null; if (faceSheetEntered != null) { pref = faceSheetEntered.ToString(); } filters.Add("FaceSheetEntered", pref); pref = null; if (chargePosted != null) { pref = chargePosted.ToString(); } filters.Add("ChargePosted", pref); pref = null; if (codingCompleted != null) { pref = codingCompleted.ToString(); } filters.Add("CodingCompleted", pref); if (!purge) { DataSubmissions.SavePreferences(db, "Billing", "BillingIndex", filters); } else { DataSubmissions.SavePreferences(db, "Billing", "BillingPurge", filters); } List <int> idList = query.Select(p => p.ID).ToList(); Session["billingListOfID"] = idList; return(query); }
public JsonResult jsonSubmitSpecialtiesAll(List <RefPracSpecialty> specialties) { DataSubmissions.SaveSpecialties(db, specialties, HubSecurity.getLoggedInUserID()); return(Json("Specialties Saved")); }
public JsonResult jsonSubmitSpecialties(List <RefPracSpecialty> specialties) { DataSubmissions.SaveSpecialties(db, specialties); return(Json("Specialties Saved")); }
public ActionResult EditPreferences(PracticeAdminEditPreferencesViewModel viewM) { PracticeAdminEditPreferencesViewModel returnM = new PracticeAdminEditPreferencesViewModel(); ReferringPractice oldPrac; returnM.practices = DataCollections.getPractices(db, HubSecurity.getLoggedInUserID()); int id; if (viewM.UpdatePracticeInformation != null) { if (viewM.hidAll == "true") { foreach (SelectListItem prac in returnM.practices) { if (prac.Value == "ALL") { continue; } id = Convert.ToInt32(prac.Value); oldPrac = (from r in db.ReferringPractices where r.PracID == id select r).Single(); oldPrac.Address1 = viewM.selectedPrac.Address1; oldPrac.Address2 = viewM.selectedPrac.Address2; oldPrac.Address3 = viewM.selectedPrac.Address3; oldPrac.City = viewM.selectedPrac.City; oldPrac.State = viewM.selectedPrac.State; oldPrac.Zip = viewM.selectedPrac.Zip; oldPrac.Phone = viewM.selectedPrac.Phone; oldPrac.Fax = viewM.selectedPrac.Fax; oldPrac.OfficeManager = viewM.selectedPrac.OfficeManager; oldPrac.Other = viewM.selectedPrac.Other; oldPrac.PDFPassword = viewM.selectedPrac.PDFPassword; DataSubmissions.SavePractice(db, oldPrac); } } else { oldPrac = (from r in db.ReferringPractices where r.PracID == viewM.selectedPrac.PracID select r).Single(); oldPrac.Address1 = viewM.selectedPrac.Address1; oldPrac.Address2 = viewM.selectedPrac.Address2; oldPrac.Address3 = viewM.selectedPrac.Address3; oldPrac.City = viewM.selectedPrac.City; oldPrac.State = viewM.selectedPrac.State; oldPrac.Zip = viewM.selectedPrac.Zip; oldPrac.Phone = viewM.selectedPrac.Phone; oldPrac.Fax = viewM.selectedPrac.Fax; oldPrac.OfficeManager = viewM.selectedPrac.OfficeManager; oldPrac.Other = viewM.selectedPrac.Other; oldPrac.PDFPassword = viewM.selectedPrac.PDFPassword; DataSubmissions.SavePractice(db, oldPrac); } } if (viewM.UpdateCommunicationMethod != null) { if (viewM.hidAll == "true") { foreach (SelectListItem prac in returnM.practices) { if (prac.Value == "ALL") { continue; } id = Convert.ToInt32(prac.Value); oldPrac = (from r in db.ReferringPractices where r.PracID == id select r).Single(); oldPrac.EmailNotification = viewM.selectedPrac.EmailNotification; oldPrac.FaxNotification = viewM.selectedPrac.FaxNotification; DataSubmissions.SavePractice(db, oldPrac); } } else { oldPrac = (from r in db.ReferringPractices where r.PracID == viewM.selectedPrac.PracID select r).Single(); oldPrac.EmailNotification = viewM.selectedPrac.EmailNotification; oldPrac.FaxNotification = viewM.selectedPrac.FaxNotification; DataSubmissions.SavePractice(db, oldPrac); } } returnM.practices = DataCollections.getPractices(db, HubSecurity.getLoggedInUserID()); returnM.selectedPrac = DataCollections.getPractice(db, viewM.hidPrac); returnM.specialties = DataCollections.getSpecialties(db, viewM.selectedPrac.PracID); returnM.hidPrac = viewM.hidPrac; returnM.tabReturn = viewM.tabReturn; returnM.hidAll = viewM.hidAll; return(View(returnM)); }
public ActionResult CopyConfirmed(int id) { DataSubmissions.CopyPatient(db, id); return(RedirectToAction("Index")); }
//This function returns results from PatientLog table for all PatientLog Views aside from PatientSort private IQueryable <PatientLog> patientLogQueryGenerator(DateTime fromDate, DateTime toDate, List <string> selectedHosp, List <string> selectedServ, GridFilter.SortDirections direction, string sortColumn, bool assigned) { //Query PatientLog by physicians and date/time range string user = HubSecurity.getLoggedInUserID(); IQueryable <PatientLog> query; //Alter query to show all Assigned entries if selected to do so if (!assigned) { if (sortColumn == null) { query = from d in db.PatientLogs where d.ServiceDate >= fromDate && d.ServiceDate <= toDate && d.Physician == user orderby d.PatientName, d.ServiceDate select d; } else { query = from d in db.PatientLogs where d.ServiceDate >= fromDate && d.ServiceDate <= toDate && d.Physician == user select d; } } else { if (sortColumn == null) { query = from d in db.PatientLogs where d.Physician == user && d.ServiceType == "Assigned" orderby d.PatientName, d.ServiceDate select d; } else { query = from d in db.PatientLogs where d.Physician == user && d.ServiceType == "Assigned" select d; } } //Apply hospital filters if any are provided if (selectedHosp.Any()) { query = query.Where(h => selectedHosp.Contains(h.Hospital)); } //Apply service type filters only if not showing assigned view if (!assigned) { if (selectedServ.Any()) { query = query.Where(s => selectedServ.Contains(s.ServiceType)); } } //Apply sorting if (direction == GridFilter.SortDirections.Ascending) { if (sortColumn == "PatientName") { query = query.OrderBy(sortColumn + ", ServiceDate"); } else { query = query.OrderBy(sortColumn); } } else { query = query.OrderBy(sortColumn + " DESC"); } List <int> idList = query.Select(p => p.ID).ToList(); Session["patientLogListOfID"] = idList; //Update user preferences if Assigned is not selected if (!assigned) { Dictionary <string, string> filters = new Dictionary <string, string>(); string hospPref = null; foreach (string hosp in selectedHosp) { hospPref += hosp + ","; } if (hospPref != null) { hospPref = hospPref.Substring(0, hospPref.Length - 1); } filters.Add("Hospital", hospPref); string servPref = null; foreach (string serv in selectedServ) { servPref += serv + ","; } if (servPref != null) { servPref = servPref.Substring(0, servPref.Length - 1); } filters.Add("ServiceType", servPref); if (direction == GridFilter.SortDirections.Ascending) { filters.Add("SortDirection", "Ascending"); } else { filters.Add("SortDirection", "Descending"); } filters.Add("SortColumn", sortColumn); DataSubmissions.SavePreferences(db, "PatientLog", "PatientLogIndex", filters); } return(query); }
private IQueryable <PatientLog> patientAssignmentQueryGenerator(DateTime fromDate, DateTime toDate, List <string> selectedPhy, string selectedHosp, List <string> selectedServ, GridFilter.SortDirections direction, string sortColumn) { IQueryable <PatientLog> query; if (sortColumn == null) { //Query PatientLog by physicians and date/time range query = from d in db.PatientLogs where d.ServiceDate >= fromDate && d.ServiceDate <= toDate && selectedHosp == d.Hospital orderby d.PatientName, d.ServiceDate select d; } else { query = from d in db.PatientLogs where d.ServiceDate >= fromDate && d.ServiceDate <= toDate && selectedHosp == d.Hospital select d; //Apply sorting if (direction == GridFilter.SortDirections.Ascending) { if (sortColumn == "PatientName") { query = query.OrderBy(sortColumn + ", ServiceDate"); } else { query = query.OrderBy(sortColumn); } } else { query = query.OrderBy(sortColumn + " DESC"); } } //Apply hospital filters if any are provided if (selectedPhy.Any()) { query = query.Where(h => selectedPhy.Contains(h.Physician)); } if (selectedServ.Any()) { query = query.Where(s => selectedServ.Contains(s.ServiceType)); } //Save preferences Dictionary <string, string> filters = new Dictionary <string, string>(); string pref = null; foreach (string phy in selectedPhy) { pref += phy + ","; } if (pref != null) { pref = pref.Substring(0, pref.Length - 1); } filters.Add("Physician", pref); filters.Add("Hospital", selectedHosp); pref = null; foreach (string serv in selectedServ) { pref += serv + ","; } if (pref != null) { pref = pref.Substring(0, pref.Length - 1); } filters.Add("ServiceType", pref); //if (direction == GridFilter.SortDirections.Ascending) //{ // filters.Add("SortDirection", "Ascending"); //} //else //{ // filters.Add("SortDirection", "Descending"); //} DataSubmissions.SavePreferences(db, "PatientAssignment", "PatientAssignmentIndex", filters); List <int> idList = query.Select(p => p.ID).ToList(); Session["patientAssignmentListOfID"] = idList; return(query); }
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)); }