protected void UpdateInbox() { DoctorTable currDoc = GetCurrentUser(); var msgList = from m in medDB.MessageTables.Local where m.MessageTo.Trim() == (currDoc.Email.Trim()) select m; if (msgList.Count() != InboxListBox.Items.Count) { foreach (MessageTable m in msgList) { if (m.MessageTo != null) { string from = ""; if (m.MessageFrom.Trim().Equals("System")) { from = "System"; } else { PatientTable tempDoc = GetPatientFromEmail(m.MessageFrom); from = tempDoc.LastName.Trim(); } InboxListBox.Items.Add($"(No. {m.MessageID} ) From {from}, sent {m.Date}, Message: {m.Message} "); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { dbcontext.UserTables.Load(); UserTable user = (from x in dbcontext.UserTables.Local where x.UserName.Equals(HttpContext.Current.User.Identity.Name) select x).First(); if (user.UserType.Equals("Patient")) { dbcontext.PatientTables.Load(); PatientTable patient = (from x in dbcontext.PatientTables.Local where x.UserName.Equals(HttpContext.Current.User.Identity.Name) select x).First(); dbcontext.DoctorTables.Load(); DoctorTable doctor = (from x in dbcontext.DoctorTables.Local where x.DoctorId == patient.DoctorId select x).First(); DropDownList1.Items.Add(doctor.UserName); } else { dbcontext.DoctorTables.Load(); DoctorTable doctor = (from x in dbcontext.DoctorTables.Local where x.UserName.Equals(HttpContext.Current.User.Identity.Name) select x).First(); foreach (PatientTable patient in doctor.PatientTables) { DropDownList1.Items.Add(patient.UserName); } } } }
public ActionResult DoctorVisit([FromForm] Visit visits) { var patients = PatientTable.GetPatientById(patientId); DateTime time = DateTime.Now.Date; string date = time.ToString("yyyy-MM-dd"); if (visits.Type == "visit") { visits.Status = "in progress"; } else if (visits.Type == "referral") { visits.Status = "pending"; } else if (visits.Type == "test") { TestTable.InsertData(patientId, Properties.UserId, "", date); visits.Status = "pending"; } VisitTable.InsertD(patients[0].Id, Properties.UserId, visits.Type, visits.Doctor, visits.Status, date); return(RedirectToAction("DoctorView", "Doctor", PatientTable.GetPatientById(patientId)[0])); }
protected void Button1_Click(object sender, EventArgs e) { dbcontext.PatientTables.Load(); PatientTable user = (from x in dbcontext.PatientTables.Local where x.UserName.Equals(HttpContext.Current.User.Identity.Name) select x).First(); AppointmentTable app = new AppointmentTable(); app.PatientUserName = user.UserName; app.DoctorUserName = DropDownList4.SelectedValue.ToString(); DateTime a = Convert.ToDateTime(TextBox1.Text + " " + DropDownList1.SelectedValue); app.DateAndTime = a; app.Description = TextBox2.Text; //System.Diagnostics.Debug.WriteLine(app.DateAndTime.ToString()); dbcontext.AppointmentTables.Load(); var y = from time in dbcontext.AppointmentTables.Local where time.DateAndTime.ToString().Equals(app.DateAndTime.ToString()) && time.DoctorUserName.Equals(app.DoctorUserName) select time; if (y.ToList().Count == 0) { dbcontext.AppointmentTables.Add(app); dbcontext.SaveChanges(); Server.Transfer("AppointmentsPatient.aspx", true); } else { Server.Transfer("AppointmentsPatient.aspx", true); } }
public ActionResult DoctorIndex([FromForm] string searchString) { try { Regex regex = new Regex("[0-9]"); List <Patient> patient; if (regex.IsMatch(searchString)) { patient = PatientTable.GetPatientByPesel(System.Convert.ToInt32(searchString)); } else { patient = PatientTable.GetPatientBySurname(searchString); } if (patient.Count == 0) { return(View()); } else { return(RedirectToAction("DoctorView", "Doctor", patient[0])); } } catch { return(View()); } }
/// <summary> /// Returns a list of <see cref="Mockup2.DatabaseClasses.Patient"/>s based on certain search criteria, provided /// by the QueryBuilder SQL code. /// </summary> /// <param name="b">QueryBuilder containing the SQL query to run.</param> /// <returns>A list of <see cref="Mockup2.DatabaseClasses.Patient"/> objects.</returns> public List <Patient> GetPatients(QueryBuilder b) { List <Patient> result = new List <Patient>(); MySqlCommand query = new MySqlCommand(b.ToString(), dbCon.GetConnection()); MySqlDataReader reader = query.ExecuteReader(); while (reader.Read()) { Patient p = new Patient(); PatientTable pt = Tables.PATIENT_TABLE; p.ID = GetInt(reader[pt.ID.Name]); p.NHSNumber = GetString(reader[pt.NHSNumber.Name]); p.FirstName = GetString(reader[pt.FirstName.Name]); p.LastName = GetString(reader[pt.LastName.Name]); p.Address = GetString(reader[pt.Address.Name]); p.Postcode = GetString(reader[pt.PostCode.Name]); p.NextOfKin = GetString(reader[pt.NextOfKin.Name]); DateTime temp; DateTime.TryParse(GetString(reader[pt.DOB.Name]), out temp); p.DOB = temp; p.Gender = GetString(reader[pt.Gender.Name]); p.Religion = GetString(reader[pt.Religion.Name]); p.Email = GetString(reader[pt.Email.Name]); p.Phone = GetString(reader[pt.Phone.Name]); result.Add(p); } reader.Close(); reader.Dispose(); return(result); }
public ActionResult PatientView([FromForm] string searchString) { try { if (Regex.IsMatch(searchString, @"^[a-zA-Z]+$")) { List <Doctor> doctor = DoctorTable.GetDoctorIdBySurname(searchString); if (doctor.Count != 0) { int doctorId = doctor[0].Id; var visit = VisitTable.GetDataByDoctorId(doctorId, Properties.UserId); var prescript = PrescriptionTable.GetDataByDoctorId(doctorId, Properties.UserId); var test = TestTable.GetDataByDoctorId(doctorId, Properties.UserId); var sickleave = SickLeaveTable.GetDataByDoctorId(doctorId, Properties.UserId); var description = MedicalDescriptionTable.GetDataByDoctorId(doctorId, Properties.UserId); var doc = DocumentationTable.GetDataByDoctorId(doctorId, Properties.UserId); ViewData["PatientName"] = PatientTable.GetPatientById(Properties.UserId)[0]; ViewData["visitData"] = visit; ViewData["prescriptioneData"] = prescript; ViewData["Tests"] = test; ViewData["sickLeaveData"] = sickleave; ViewData["medicalDescription"] = description; ViewData["documentation"] = doc; return(View()); } else { ViewData["PatientName"] = PatientTable.GetPatientById(Properties.UserId)[0]; ViewData["visitData"] = new List <Visit>(); ViewData["prescriptioneData"] = new List <Prescription>(); ViewData["Tests"] = new List <Test>(); ViewData["sickLeaveData"] = new List <SickLeave>(); ViewData["medicalDescription"] = new List <MedicalDescription>(); ViewData["documentation"] = new List <Documentation>(); var prescript = PrescriptionTable.GetPrescriptByMedicine(searchString); if (prescript.Count != 0) { ViewData["prescriptioneData"] = prescript; } var des = MedicalDescriptionTable.GetData(Properties.UserId, searchString); if (des.Count != 0) { ViewData["medicalDescription"] = des; } View(); } } return(View()); } catch { return(View()); } }
public ActionResult NewPatient(PatientTable patient) { var context = new PatientDataContext(); context.PatientTables.InsertOnSubmit(patient); context.SubmitChanges(); return(RedirectToAction("Dashboard")); }
protected void btn_delete_Click(object sender, CommandEventArgs e) { PatientTable pt = new PatientTable(); string rdn = e.CommandArgument.ToString(); pt.Delete(rdn); u_init(""); }
public IActionResult AddDocumentationView(int id) { ViewBag.var = id; var patients = PatientTable.GetPatientById(patientId); ViewData["patient"] = patients[0]; return(View()); }
public ActionResult DoctorSickLeave(int id) { ViewBag.var = id; var patients = PatientTable.GetPatientById(patientId); ViewData["patient"] = patients[0]; return(View()); }
public ActionResult DoctorSickLeave([FromForm] SickLeave sl) { var patients = PatientTable.GetPatientById(patientId); DateTime time = DateTime.Now.Date; string date = time.ToString("yyyy-MM-dd"); SickLeaveTable.InsertD(patients[0].Id, Properties.UserId, sl.Days, sl.Description, date); return(RedirectToAction("Visit", "Doctor", new { id = Properties.VisitId })); }
public ActionResult DoctorPrescription([FromForm] Prescription presc) { var patients = PatientTable.GetPatientById(patientId); DateTime time = DateTime.Now.Date; string date = time.ToString("yyyy-MM-dd"); PrescriptionTable.InsertData(patients[0].Id, Properties.UserId, presc.Medicine, presc.Description, date, presc.Refund); return(RedirectToAction("Visit", "Doctor", new { id = Properties.VisitId })); }
public IActionResult SickLeave(int id, int patientId) { ViewBag.id = id; ViewBag.patientId = patientId; var data = SickLeaveTable.GetData(id); var patientData = PatientTable.GetPatientById(patientId); ViewData["PatientName"] = patientData[0]; return(View(data[0])); }
protected void GetMedicationList() { PatientTable currPatient = GetCurrentPatient(); var medsList = from med in medDB.MedicationListTables where currPatient.PatientID == (med.PatientID) select med.Description; foreach (string s in medsList.ToList()) { MedicationListBox.Items.Add(s.Trim()); } }
public IActionResult AddDescription(int id) { ViewBag.var = id; var data = VisitTable.GetDataById(id); var patients = PatientTable.GetPatientById(patientId); ViewData["patient"] = patients[0]; ViewData["visit"] = data[0]; return(View()); }
protected void btn_export_floor_Click(object sender, EventArgs e) { PatientTable pt = new PatientTable(); DateTime beginDate, endDate; beginDate = DateTime.Now.AddMonths(-1); endDate = DateTime.Now.AddMonths(1); beginDate = Convert.ToDateTime(tbox_beginDate.Text); beginDate = beginDate.AddDays(-1); endDate = Convert.ToDateTime(tbox_endDate.Text); endDate = endDate.AddDays(1); string floorName = ddl_floor.SelectedValue; string category = ddl_category2.SelectedValue; string fileName = System.Configuration.ConfigurationManager.AppSettings["ExportPath"] + category + "_" + floorName + DateTime.Now.ToString("yyyyMMdd") + ".xls"; string sqlWhere = " and brifeInfo.floorName ='" + floorName + "'"; string result = ""; switch (category) { case "医疗": result = pt.Exportyl(fileName, beginDate, endDate, sqlWhere); DownloadFile(result, Response, fileName, "医疗工作_" + category + "_" + floorName + ".xls"); break; case "护理": result = pt.Exporthl(fileName, beginDate, endDate, sqlWhere); DownloadFile(result, Response, fileName, "护理工作_" + category + "_" + floorName + ".xls"); break; case "医技": result = pt.Exportyj(fileName, beginDate, endDate, sqlWhere); DownloadFile(result, Response, fileName, "医技工作_" + category + "_" + floorName + ".xls"); break; case "后勤": result = pt.Exporthq(fileName, beginDate, endDate, sqlWhere); DownloadFile(result, Response, fileName, "后勤工作_" + category + "_" + floorName + ".xls"); break; case "行政-收费": result = pt.Exportzy(fileName, beginDate, endDate, sqlWhere); DownloadFile(result, Response, fileName, "行政-收费_" + category + "_" + floorName + ".xls"); break; default: break; } }
protected void Page_Load(object sender, EventArgs e) { medDB.DoctorTables.Load(); var user = User.Identity.Name; var currUserQuery = from patient in medDB.PatientTables where patient.FirstName.Trim().Equals(user) select patient; if (currUserQuery.Count() != 0) { currUser = currUserQuery.FirstOrDefault(); } LoadApptTable(); }
//btn_export_all_Click protected void btn_export_all_Click(object sender, EventArgs e) { PatientTable pt = new PatientTable(); DateTime beginDate, endDate; beginDate = DateTime.Now.AddMonths(-1); endDate = DateTime.Now.AddMonths(1); beginDate = Convert.ToDateTime(tbox_beginDate.Text); beginDate = beginDate.AddDays(-1); endDate = Convert.ToDateTime(tbox_endDate.Text); endDate = endDate.AddDays(1); string fileName = System.Configuration.ConfigurationManager.AppSettings["ExportPath"] + "所有数据" + DateTime.Now.ToString("yyyyMMdd") + ".xls"; string result = pt.ExportAll(fileName, beginDate, endDate); DownloadFile(result, Response, fileName, "所有数据.xls"); }
public IActionResult PdfPrescription(int id) { var prescription = PrescriptionTable.GetDataById(id); var patData = PatientTable.GetPatientById(Properties.UserId); patData[0].Name = patData[0].Name + " " + patData[0].Surname; ViewBag.patient = patData; var doc = DoctorTable.GetDoctorIdByName(prescription[0].DoctorName); var docData = DoctorTable.GetSpecializationById(doc[0].Id); docData[0].Name = docData[0].Name + " " + docData[0].Surname; ViewBag.doctor = docData; return(View(prescription)); }
public IActionResult PdfSickLeave(int id) { var sickLeave = SickLeaveTable.GetData(id); var patData = PatientTable.GetPatientById(Properties.UserId); patData[0].Name = patData[0].Name + " " + patData[0].Surname; ViewBag.patient = patData; var doc = DoctorTable.GetDoctorIdByName(sickLeave[0].DoctorName); var docData = DoctorTable.GetSpecializationById(doc[0].Id); docData[0].Name = docData[0].Name + " " + docData[0].Surname; ViewBag.doctor = docData; return(View(sickLeave)); }
protected void btn_export_Click(object sender, EventArgs e) { PatientTable pt = new PatientTable(); DateTime beginDate, endDate; string filePath = System.Configuration.ConfigurationManager.AppSettings["ExportPath"] + "医疗工作.xls"; beginDate = DateTime.Now.AddMonths(-1); endDate = DateTime.Now.AddMonths(1); beginDate = Convert.ToDateTime(tbox_beginDate.Text); beginDate = beginDate.AddDays(-1); endDate = Convert.ToDateTime(tbox_endDate.Text); endDate = endDate.AddDays(1); string result = pt.Exportyl(filePath, beginDate, endDate, null); DownloadFile(result, Response, filePath, "医疗工作.xls"); }
protected void btn_export_hl_Click(object sender, EventArgs e) { PatientTable pt = new PatientTable(); DateTime beginDate, endDate; beginDate = DateTime.Now.AddMonths(-1); endDate = DateTime.Now.AddMonths(1); beginDate = Convert.ToDateTime(tbox_beginDate.Text); beginDate = beginDate.AddDays(-1); endDate = Convert.ToDateTime(tbox_endDate.Text); endDate = endDate.AddDays(1); string filePath = System.Configuration.ConfigurationManager.AppSettings["ExportPath"] + "护理工作.xls"; //string fileName = @"E:\testsrrsh" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; string result = pt.Exporthl(filePath, beginDate, endDate, null); DownloadFile(result, Response, filePath, "护理工作.xls"); }
protected void UpdateOutbox() { DoctorTable currDoc = GetCurrentUser(); var msgList = from m in medDB.MessageTables.Local where m.MessageFrom.Trim() == (currDoc.Email.Trim()) select m; foreach (MessageTable m in msgList.ToList()) { PatientTable patient = GetPatientFromEmail(m.MessageTo); if (m.MessageTo != null) { OutboxListBox.Items.Add($"(No. {m.MessageID} ) Sent To {patient.LastName}, sent {m.Date}, Message: {m.Message} "); } } }
public ActionResult AddPatient(PatientTable patient) { if (Session["User"] != null) { var user = (UserTable)Session["User"]; patient.UserID = user.UserID; if (ModelState.IsValid) { var findpatient = db.PatientTables.Where(d => d.Email == patient.Email).FirstOrDefault(); if (findpatient == null) { db.PatientTables.Add(patient); db.SaveChanges(); if (patient.LogoFile != null) { var folder = "~/Content/PatientImages"; var file = string.Format("{0}.png", patient.PatientID); var response = FileHelpers.UploadPhoto(patient.LogoFile, folder, file); if (response) { var pic = string.Format("{0}/{1}", folder, file); patient.Photo = pic; db.Entry(patient).State = EntityState.Modified; db.SaveChanges(); } } return(RedirectToAction("Login")); } else { ViewBag.Message = "Email Already Registered"; } } } else { return(RedirectToAction("Login")); } ViewBag.GenderID = new SelectList(db.GenderTables.ToList(), "GenderID", "Name", patient.GenderID); return(View(patient)); }
protected void Button1_Click(object sender, EventArgs e) { Label1.Text = string.Empty; Label1.Visible = false; Label2.Visible = false; try { PatientTable abc = (from x in dbcon.PatientTables where x.PatientUserName == TextBox1.Text.Trim() select x).First(); Label1.Text = (abc.Name + "; " + abc.Address + "; " + abc.Email + "; " + abc.Phone); Label1.Visible = true; } catch (System.InvalidOperationException) { Label2.Visible = true; } }
public IActionResult PdfResults(int id) { var results = ResultTable.GetDataByTestId(id); var docName = TestTable.GetDataById(results[0].TestId); var doc = DoctorTable.GetDoctorIdByName(docName[0].DoctorName); var docData = DoctorTable.GetSpecializationById(doc[0].Id); docData[0].Name = docData[0].Name + " " + docData[0].Surname; ViewBag.doctor = docData; var patData = PatientTable.GetPatientById(Properties.UserId); patData[0].Name = patData[0].Name + " " + patData[0].Surname; ViewBag.patient = patData; return(View(results)); }
protected void SendButton_Click(object sender, EventArgs e) { PatientTable currPatient = GetCurrentPatient(); if (TextBox1.Text.Length < 50) { DoctorTable currentDoc = GetDoctorFromLastName(DropDownList1.SelectedValue.ToString()); MessageTable msg = new MessageTable(); msg.Date = DateTime.Now; msg.MessageTo = currentDoc.Email; msg.MessageFrom = currPatient.Email; msg.Message = TextBox1.Text; //msg.MessageID medDB.MessageTables.Add(msg); } UpdateDB(); Server.TransferRequest(Request.Url.AbsolutePath, false); }
protected void ScheduleButton_Click(object sender, EventArgs e) { currDoc = GetCurrentDoctor(); PatientTable currPat = GetPatientFromName(PatientsSelectDropDownList.SelectedValue.Trim()); //Update DB with new appointmnet AppointmentTable appt = new AppointmentTable(); appt.AppointmentID = GenerateApptID(); appt.DoctorID = docID; appt.PatientID = currPat.PatientID; appt.Data = AppointmentDaySelectCalendar.SelectedDate; appt.Time = TimeSpan.Parse(TimeDropDownList.SelectedValue); medDB.AppointmentTables.Add(appt); UpdateDB(); ////Send message to inbox //MessageTable msgToPatient = new MessageTable(); //msgToPatient.MessageID = GenerateMsgID(); //msgToPatient.MessageTo = currUser.UserLoginName; //msgToPatient.MessageFrom = "System"; //msgToPatient.Date = DateTime.Now; ////msgToPatient.Message = $"Appointment scheduled on {appt.Data} @ {appt.Time} with Doctor {currDoc.LastName}"; //msgToPatient.Message = "Appointment scheduled"; //medDB.MessageTables.Add(msgToPatient); //UpdateDB(); //MessageTable msgToDoctor = new MessageTable(); //msgToDoctor.MessageID = GenerateMsgID(); //msgToDoctor.MessageTo = currDoc.UserLoginName; //msgToDoctor.MessageFrom = "System"; //msgToDoctor.Date = DateTime.Now.Date; ////msgToDoctor.Message = $"Appointment scheduled on {appt.Data} @ {appt.Time} with Patient {currUser.FirstName + currUser.LastName}"; //msgToDoctor.Message = "Appointment scheduled"; //medDB.MessageTables.Add(msgToDoctor); //UpdateDB(); Server.TransferRequest(Request.Url.AbsolutePath, false); }
public ActionResult PatientView(Patient patient) { var patients = PatientTable.GetPatientById(Properties.UserId); var description = MedicalDescriptionTable.GetDataByPatientId(Properties.UserId); var visit = VisitTable.GetDataByPatientId(Properties.UserId); var prescript = PrescriptionTable.GetData(Properties.UserId); var test = TestTable.GetData(Properties.UserId); var leavesick = SickLeaveTable.GetDataByPatientId(Properties.UserId); var doc = DocumentationTable.GetDataByPatientId(Properties.UserId); // ViewData["PatientName"] = PatientTable.GetPatientById(patient.Id); ViewData["PatientName"] = patients[0]; ViewData["visitData"] = visit; ViewData["prescriptioneData"] = prescript; ViewData["Tests"] = test; ViewData["sickLeaveData"] = leavesick; ViewData["medicalDescription"] = description; ViewData["documentation"] = doc; return(View()); }