public ActionResult EditDoctor(sp_get_Doctors_Result Editobj) { HospitalManagementEntities db = new Models.HospitalManagementEntities(); db.sp_Update_Doctors( Editobj.Name, Editobj.EmailId, Editobj.Mobile, Editobj.Gender, Editobj.Specialist, Editobj.Date_of_joining, Editobj.Qualification, Editobj.Address, Editobj.Timing, Convert.ToInt32(Session["UserId"]), Convert.ToInt32(Session["UserId"]), Editobj.DoctorId ); int Result = 1; if (Result > 0) { return(RedirectToAction("GetDoctor")); } else { ViewBag.Message = "Record Failed To Update"; return(View(Editobj)); } }
public ActionResult CreateAppointMent(FormCollection frm) { HospitalManagementEntities db = new Models.HospitalManagementEntities(); CreateAppointment obj = new CreateAppointment(); SqlCommand cmd = new SqlCommand("sp_CreateAppointment", con); obj.DrNameSpeciality = frm["Doctor"].ToString(); con.Open(); string name = obj.DrNameSpeciality.Split('-')[0]; string specialist = obj.DrNameSpeciality.Split('-')[1]; obj.Drid = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PatId", frm["AppPid"]); cmd.Parameters.AddWithValue("@DrId", obj.Drid); cmd.Parameters.AddWithValue("@TotalAmount", frm["Fees"]); cmd.Parameters.AddWithValue("@timeAppoint", frm["Timing"]); cmd.Parameters.AddWithValue("@CreatedBy", 1); Int32 i = Convert.ToInt32(cmd.ExecuteScalar()); if (i > 0) { string Controller = string.Empty, Action = string.Empty; if (Convert.ToInt32(Session["RoleId"]) == 1) { Controller = "Appointment"; Action = "ViewAppointment"; } else if (Convert.ToInt32(Session["RoleId"]) == 2) { Controller = "DashBoard"; Action = "DoctorDashBoard"; } return(RedirectToAction(Action, Controller)); } else { con.Close(); return(View("GetPatient")); } }
public ActionResult CreateDoctor(sp_get_Doctors_Result obj) { HospitalManagementEntities db = new Models.HospitalManagementEntities(); sp_get_Doctors_Result createobj = new Models.sp_get_Doctors_Result(); createobj.Name = obj.Name; createobj.EmailId = obj.EmailId; createobj.Mobile = obj.Mobile; createobj.Specialist = obj.Specialist; createobj.Qualification = obj.Qualification; createobj.Gender = obj.Gender; createobj.Date_of_joining = obj.Date_of_joining; createobj.Address = obj.Address; createobj.Timing = obj.Timing; createobj.CreatedBy = Convert.ToInt32(Session["UserId"]); createobj.UpdatedBy = Convert.ToInt32(Session["UserId"]); db.sp_InsertDoctors( createobj.Name, createobj.EmailId, createobj.Mobile, createobj.Gender, createobj.Specialist, createobj.Date_of_joining, createobj.Qualification, createobj.Address, createobj.Timing, createobj.CreatedBy, createobj.UpdatedBy); int Result = 1; if (Result > 0) { return(RedirectToAction("GetDoctor")); } else { ViewBag.Message = "Record Failed To Insert"; return(View(createobj)); } }
public ActionResult CreatePatient(Patient obj) { HospitalManagementEntities db = new Models.HospitalManagementEntities(); SqlCommand cmd = new SqlCommand("sp_InsertPatient", con); con.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Ptname", obj.PName); cmd.Parameters.AddWithValue("@gender", obj.Gender); cmd.Parameters.AddWithValue("@MobileNo", obj.MobileNo); cmd.Parameters.AddWithValue("@PatientType", obj.PatientType); cmd.Parameters.AddWithValue("@Address", obj.Address); cmd.Parameters.AddWithValue("@ReferBy", obj.ReferBy); cmd.Parameters.AddWithValue("@Age", obj.Age); cmd.Parameters.AddWithValue("@CreatedBy", 1); Int32 i = Convert.ToInt32(cmd.ExecuteScalar()); if (i > 0) { obj.Pid = (int)i; ViewBag.Visable = "block"; ViewBag.Pid = i.ToString(); return(View(obj)); } else { ViewBag.Visable = false; ViewBag.Message = "Record Failed To Insert"; return(View(obj)); } con.Close(); }
public JsonResult ExitingPatientChanngeinfo(DoctorNameSpeciality drobj) { HospitalManagementEntities db = new Models.HospitalManagementEntities(); DoctorNameSpeciality obj = new DoctorNameSpeciality(); string fromdate = string.Empty; string todate = string.Empty; string Drname = string.Empty; string flagExitPatient = string.Empty; fromdate = Convert.ToString(drobj.fromDate); todate = Convert.ToString(drobj.toDate); Drname = Convert.ToString(drobj.NameSpecialist); flagExitPatient = Convert.ToString(drobj.flag); SqlCommand cmd = new SqlCommand("[sp_getExistingPatientsByDrId]", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); //Existing Patient Logic when only drname is passed if ((Drname != string.Empty) && (fromdate == string.Empty) && (todate == string.Empty) && flagExitPatient == "ExistingPatient") { SqlCommand cmdOnlyDrName = new SqlCommand("[sp_getExistingPatientsByDrId]", con); obj.NameSpecialist = Drname.ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmdOnlyDrName.CommandType = CommandType.StoredProcedure; cmdOnlyDrName.Parameters.AddWithValue("@DrId", obj.DrId); cmdOnlyDrName.Parameters.AddWithValue("@fromdate", obj.fromDate); cmdOnlyDrName.Parameters.AddWithValue("@todate", obj.toDate); SqlDataAdapter daOnlyDrName = new SqlDataAdapter(cmdOnlyDrName); DataSet dsOnlyDrName = new DataSet(); daOnlyDrName.Fill(dsOnlyDrName); int ExistingCountPatient = Convert.ToInt32(dsOnlyDrName.Tables[0].Rows[0]["CurrentPatient"]); TempData["CurrentPatient"] = ExistingCountPatient; } //Passed only from and todate else if ((Drname == string.Empty) && (fromdate != string.Empty) && (todate != string.Empty) && flagExitPatient == "ExistingPatient") { SqlCommand cmdfromToDate = new SqlCommand("[sp_getExistingPatientsByDrId]", con); obj.NameSpecialist = Drname.ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmdfromToDate.CommandType = CommandType.StoredProcedure; cmdfromToDate.Parameters.AddWithValue("@DrId", obj.DrId); cmdfromToDate.Parameters.AddWithValue("@fromdate", obj.fromDate); cmdfromToDate.Parameters.AddWithValue("@todate", obj.toDate); SqlDataAdapter dafromToDate = new SqlDataAdapter(cmd); DataSet dsfromToDate = new DataSet(); dafromToDate.Fill(dsfromToDate); int ExistingCountPatient = Convert.ToInt32(dsfromToDate.Tables[0].Rows[0]["CurrentPatient"]); TempData["CurrentPatient"] = ExistingCountPatient; } //Passed all the Values else if ((Drname != string.Empty) && (fromdate != string.Empty) && (todate != string.Empty) && flagExitPatient == "ExistingPatient") { SqlCommand cmdAllValues = new SqlCommand("[sp_getExistingPatientsByDrId]", con); obj.NameSpecialist = Drname.ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DrId", obj.DrId); cmd.Parameters.AddWithValue("@fromdate", obj.fromDate); cmd.Parameters.AddWithValue("@todate", obj.toDate); SqlDataAdapter daAllValues = new SqlDataAdapter(cmd); DataSet dsAllValues = new DataSet(); daAllValues.Fill(dsAllValues); int ExistingCountPatient = Convert.ToInt32(dsAllValues.Tables[0].Rows[0]["CurrentPatient"]); TempData["CurrentPatient"] = ExistingCountPatient; } DashboardDetail GetDashboardCount = new DashboardDetail(); GetDashboardCount.CountExistingPatient = (int)TempData["CurrentPatient"]; // ViewBag.CountExistingPatient = (int)TempData["CurrentPatient"] return(Json(GetDashboardCount, JsonRequestBehavior.AllowGet)); }
public ActionResult GetAppointCount(FormCollection frm) { HospitalManagementEntities db = new Models.HospitalManagementEntities(); DoctorNameSpeciality obj = new DoctorNameSpeciality(); string fromdate = string.Empty; string todate = string.Empty; string Drname = string.Empty; string flagExitPatient = string.Empty; string flagCurrentEarning = string.Empty; if (frm["fromappDate"] != string.Empty) { fromdate = Convert.ToString(frm["fromappDate"]); } if (frm["toappDate"] != string.Empty) { todate = Convert.ToString(frm["toappDate"]); } if (frm["DrNameAndSpeciality"] != string.Empty) { Drname = Convert.ToString(frm["DrNameAndSpeciality"]); } if (frm["hfAppointments"] != string.Empty) { flagExitPatient = Convert.ToString(frm["hfAppointments"]); } if (frm["CurrentOPEarning"] != string.Empty) { flagCurrentEarning = Convert.ToString(frm["hfTotalAccounts"]); } //Current Appointment Details By DrName! if ((Drname != string.Empty) && (fromdate == string.Empty) && (todate == string.Empty) && flagExitPatient != "ExistingPatient") { SqlCommand cmd = new SqlCommand("[sp_getCurrentAppointmentByDrId]", con); obj.NameSpecialist = frm["DrNameAndSpeciality"].ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DrId", obj.DrId); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); int CurrentCountAppointment = Convert.ToInt32(ds.Tables[0].Rows[0]["CurrentAppointmentCount"]); TempData["CurrentCountAppointment"] = CurrentCountAppointment; } else if ((Drname != string.Empty) && (fromdate == string.Empty) && (todate == string.Empty) && flagExitPatient == "ExistingPatient") { SqlCommand cmdOnlyDrName = new SqlCommand("[sp_getExistingPatientsByDrId]", con); obj.NameSpecialist = Drname.ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmdOnlyDrName.CommandType = CommandType.StoredProcedure; cmdOnlyDrName.Parameters.AddWithValue("@DrId", obj.DrId); cmdOnlyDrName.Parameters.AddWithValue("@fromdate", obj.fromDate); cmdOnlyDrName.Parameters.AddWithValue("@todate", obj.toDate); SqlDataAdapter daOnlyDrName = new SqlDataAdapter(cmdOnlyDrName); DataSet dsOnlyDrName = new DataSet(); daOnlyDrName.Fill(dsOnlyDrName); int ExistingCountPatient = Convert.ToInt32(dsOnlyDrName.Tables[0].Rows[0]["CurrentPatient"]); TempData["CurrentPatient"] = ExistingCountPatient; } //Passed only from and todate else if ((Drname == string.Empty) && (fromdate != string.Empty) && (todate != string.Empty) && flagExitPatient == "ExistingPatient") { SqlCommand cmdfromToDate = new SqlCommand("sp_getExistingPatientsByDrId", con); con.Open(); cmdfromToDate.CommandType = CommandType.StoredProcedure; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == "").Select(s => s.DoctorId).FirstOrDefault()); if (obj.DrId == 0) { obj.DrId = null; } cmdfromToDate.Parameters.AddWithValue("@DrId", obj.DrId); cmdfromToDate.Parameters.AddWithValue("@fromdate", Convert.ToString(fromdate)); cmdfromToDate.Parameters.AddWithValue("@todate", Convert.ToString(todate)); SqlDataAdapter dafromToDate = new SqlDataAdapter(cmdfromToDate); DataSet dsfromToDate = new DataSet(); dafromToDate.Fill(dsfromToDate); int ExistingCountPatient = Convert.ToInt32(dsfromToDate.Tables[0].Rows[0]["CurrentPatient"]); TempData["CurrentPatient"] = ExistingCountPatient; } //Passed all the Values else if ((Drname != string.Empty) && (fromdate != string.Empty) && (todate != string.Empty) && flagExitPatient == "ExistingPatient") { SqlCommand cmdAllValues = new SqlCommand("[sp_getExistingPatientsByDrId]", con); obj.NameSpecialist = Drname.ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmdAllValues.CommandType = CommandType.StoredProcedure; cmdAllValues.Parameters.AddWithValue("@DrId", obj.DrId); cmdAllValues.Parameters.AddWithValue("@fromdate", fromdate); cmdAllValues.Parameters.AddWithValue("@todate", todate); SqlDataAdapter daAllValues = new SqlDataAdapter(cmdAllValues); DataSet dsAllValues = new DataSet(); daAllValues.Fill(dsAllValues); int ExistingCountPatient = Convert.ToInt32(dsAllValues.Tables[0].Rows[0]["CurrentPatient"]); TempData["CurrentPatient"] = ExistingCountPatient; } //DashboardDetail GetDashboardCount = new DashboardDetail(); //GetDashboardCount.CountExistingPatient = (int)TempData["CurrentPatient"]; // Billing Information based on Doctor name for current Date else if ((Drname != string.Empty) && (fromdate == string.Empty) && (todate == string.Empty) && flagCurrentEarning == "CurrentOPEarning") { SqlCommand cmdOnlyDrName = new SqlCommand("[sp_getCurrentAccountDetailsByDrId]", con); obj.NameSpecialist = Drname.ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmdOnlyDrName.CommandType = CommandType.StoredProcedure; cmdOnlyDrName.Parameters.AddWithValue("@DrId", obj.DrId); cmdOnlyDrName.Parameters.AddWithValue("@fromdate", fromdate); cmdOnlyDrName.Parameters.AddWithValue("@todate", todate); SqlDataAdapter daOnlyDrName = new SqlDataAdapter(cmdOnlyDrName); DataSet dsOnlyDrName = new DataSet(); daOnlyDrName.Fill(dsOnlyDrName); int CurrentEarningOP = Convert.ToInt32(dsOnlyDrName.Tables[0].Rows[0]["TotalEarning"]); TempData["TotalEarning"] = CurrentEarningOP; } //Passed only from and todate else if ((Drname == string.Empty) && (fromdate != string.Empty) && (todate != string.Empty) && flagCurrentEarning == "CurrentOPEarning") { SqlCommand cmdfromToDate = new SqlCommand("sp_getCurrentAccountDetailsByDrId", con); con.Open(); cmdfromToDate.CommandType = CommandType.StoredProcedure; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == "").Select(s => s.DoctorId).FirstOrDefault()); if (obj.DrId == 0) { obj.DrId = null; } cmdfromToDate.Parameters.AddWithValue("@DrId", obj.DrId); cmdfromToDate.Parameters.AddWithValue("@fromdate", Convert.ToString(fromdate)); cmdfromToDate.Parameters.AddWithValue("@todate", Convert.ToString(todate)); SqlDataAdapter dafromToDate = new SqlDataAdapter(cmdfromToDate); DataSet dsfromToDate = new DataSet(); dafromToDate.Fill(dsfromToDate); int CurrentEarningOP = Convert.ToInt32(dsfromToDate.Tables[0].Rows[0]["TotalEarning"]); TempData["TotalEarning"] = CurrentEarningOP; } //Passed all the Values else if ((Drname != string.Empty) && (fromdate != string.Empty) && (todate != string.Empty) && flagCurrentEarning == "CurrentOPEarning") { SqlCommand cmdAllValues = new SqlCommand("[sp_getCurrentAccountDetailsByDrId]", con); obj.NameSpecialist = Drname.ToString(); con.Open(); string name = obj.NameSpecialist.Split('-')[0]; string specialist = obj.NameSpecialist.Split('-')[1]; obj.DrId = Convert.ToInt32(db.Doctors.Where(s => s.Name == name && s.Specialist == specialist).Select(s => s.DoctorId).FirstOrDefault()); cmdAllValues.CommandType = CommandType.StoredProcedure; cmdAllValues.Parameters.AddWithValue("@DrId", obj.DrId); cmdAllValues.Parameters.AddWithValue("@fromdate", fromdate); cmdAllValues.Parameters.AddWithValue("@todate", todate); SqlDataAdapter daAllValues = new SqlDataAdapter(cmdAllValues); DataSet dsAllValues = new DataSet(); daAllValues.Fill(dsAllValues); int CurrentEarningOP = Convert.ToInt32(dsAllValues.Tables[0].Rows[0]["TotalEarning"]); TempData["TotalEarning"] = CurrentEarningOP; } return(RedirectToAction("Index")); }
public ActionResult PatientReport(PatientReport obj, TabNameandDoses tbandDosesobj) { HospitalManagementEntities db = new Models.HospitalManagementEntities(); int Pid = obj.Pid <= 0 ? 0 :obj.Pid; if (Pid != 0) { SqlCommand cmd = new SqlCommand("sp_insertPatientReport", con); con.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Pid", Pid); cmd.Parameters.AddWithValue("@did", 1); cmd.Parameters.AddWithValue("@PTName", obj.PName != string.Empty?obj.PName:""); cmd.Parameters.AddWithValue("@Gender", obj.Gender != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@ReferBy", obj.Referby != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@HT", obj.HT != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@WT", obj.WT != string.Empty ? obj.WT : ""); cmd.Parameters.AddWithValue("@Age", obj.Age != string.Empty ? obj.Age : ""); cmd.Parameters.AddWithValue("@Emergency", obj.Emergency != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@Review", obj.Reveiw != string.Empty ? obj.Reveiw : ""); cmd.Parameters.AddWithValue("@Complain", obj.Complain != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@History", obj.History != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@Dx", obj.Dx != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@Investigation", obj.Investigation != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@Advice", obj.Advice != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@GC", obj.GCs != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@Temp", obj.Temp != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@PR", obj.PR != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@LR", obj.LR != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@BP", obj.BP != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@SPO2", obj.SPO2 != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@PA", obj.PA != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@CNS", obj.CNS != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@GRBS", obj.GRBS); cmd.Parameters.AddWithValue("@HR", obj.HR != string.Empty ? obj.PName : ""); cmd.Parameters.AddWithValue("@CreatedBy", obj.CreatedBY); cmd.Parameters.AddWithValue("@CreatedDatetime", DateTime.Now); cmd.Parameters.AddWithValue("@UpdatedBy", obj.Updatedby); cmd.Parameters.AddWithValue("@Updateddatetime", DateTime.Now); Int32 i = Convert.ToInt32(cmd.ExecuteScalar()); if (i > 0) { TabNameandDoses tbobj = new TabNameandDoses(); StringBuilder tb = new StringBuilder(); if (tbandDosesobj.txtSearchMedicines1 != string.Empty) { } tb.Append(tbandDosesobj.Doses1); return(View(obj)); } else { ViewBag.Visable = false; ViewBag.Message = "Record Failed To Insert"; return(View(obj)); } } else { ViewBag.Visable = false; ViewBag.Message = "Record Failed To Insert"; return(View(obj)); } }