Exemplo n.º 1
0
        public ActionResult GetAppointments(int?patientID = 0)
        {
            if (Convert.ToString(Session["key"]) != "patient")
            {
                return(RedirectToAction("Login", "Home"));
            }

            int         id         = (int)Session["UserId"];
            Patient_Api patientApi = new Patient_Api();

            IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(id).Where(a => a.cancelled == false);

            foreach (var p in patientAppointments)
            {
                if (p.appointment_Date > DateTime.Now)
                {
                    p.canCancel = true;
                }
            }

            if (patientAppointments != null)
            {
                return(View("~/Views/Patient/PatientViewAppointments.cshtml", patientAppointments));
            }

            return(View("~Views/Error.cshtml"));
        }
        public ActionResult ViewPatientAppointments(AppointmentModel person)
        {
            if (Convert.ToString(Session["key"]) != "nurse")
            {
                return(RedirectToAction("Login", "Home"));
            }
            Patient_Api patientApi    = new Patient_Api();
            var         patientApmnts = patientApi.GetAppointments(person.paitent_ID).Where(a => (a.cancelled == false && a.appointment_Date > DateTime.Now));

            return(View("~/Views/Nurse/NurseViewPatientAppointments.cshtml", patientApmnts));
        }
        public ActionResult GetAppointments(int id)
        {
            if (Convert.ToString(Session["key"]) != "labIncharge")
            {
                return(RedirectToAction("Login", "Home"));
            }
            Patient_Api patientApi = new Patient_Api();

            IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(id);
            ReportModel rptmOld = new ReportModel();
            //if (patientAppointments)
            {
                foreach (var a in patientAppointments)
                {
                    try
                    {
                        if (a.requestedReport)
                        {
                            rptmOld.appointmentIntIDs.Add(a.appointment_ID);
                        }
                    }
                    catch (Exception ex)
                    {
                        string test = ex.ToString();
                    }
                }
            }
            LabIncharge_Api inchargeApi  = new LabIncharge_Api();
            var             reportsModel = inchargeApi.GetPatientReports_Api(id);

            ReportModel rptmNew = new ReportModel();

            foreach (var a in reportsModel)
            {
                {
                    rptmNew.appointmentIntIDs.Add(a.appointment_ID);
                }
            }
            foreach (var a in rptmNew.appointmentIntIDs)
            {
                rptmOld.appointmentIntIDs.Remove(a);
            }

            foreach (var a in rptmOld.appointmentIntIDs)
            {
                rptmOld.appointmentIDs.Add(new SelectListItem {
                    Text = a.ToString(), Value = a.ToString()
                });
            }

            return(Json(rptmOld.appointmentIDs, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ActionResult SendAppointmentEmail(int appID)
        {
            PatientModel pat = new PatientModel();

            pat.pid = (int)Session["UserID"];
            Patient_Api      patApi     = new Patient_Api();
            var              appDetails = patApi.GetAppointments((int)Session["UserId"]).Where(a => a.appointment_ID == appID).First();
            EmailsController emails     = new EmailsController();

            emails.EmailBooking(appDetails);

            return(RedirectToAction("GetAppointments"));
        }
Exemplo n.º 5
0
        public ActionResult GetAvailableTimings(AppointmentModel apmtModel)
        {
            Doctor_Api doctorApi = new Doctor_Api();

            apmtModel.appointment_Date = DateTime.Parse(apmtModel.timings);
            apmtModel.paitent_ID       = (int)Session["UserId"];
            List <string> bookedTimings = doctorApi.GetAvailableTimings(apmtModel);

            AppointmentTimings   appTimings = new AppointmentTimings();
            List <timingsValues> timings    = appTimings.timingsDropDown;

            int         id         = (int)Session["UserId"];
            Patient_Api patientApi = new Patient_Api();

            IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(id);

            List <timingsValues> displayTimings = new List <timingsValues>();

            if (bookedTimings.Count == 0)
            {
                var app = patientAppointments.Where(a => a.appointment_Date == apmtModel.appointment_Date).Select(t => t.timings).ToList();
                if (app.Count() > 0)
                {
                    List <timingsValues> t = new List <timingsValues>();
                    foreach (var a in app)
                    {
                        var aa = a.Trim('0');
                        t.Add(new timingsValues {
                            Text = aa.Trim(':'), Value = aa.Trim(':')
                        });
                    }
                    var i = 0;
                    foreach (var val in t)
                    {
                        displayTimings = timings.Where(d => d.Text != t.ElementAt(i).Text).ToList();
                        i++;
                    }
                }
                else
                {
                    displayTimings = timings;//.Where(t => !bookedTimings.Contains(t.Value)).ToList();
                }
            }
            if (bookedTimings.Count != 0)
            {
                displayTimings.Add(new timingsValues {
                    Value = "00:00", Text = "00:00"
                });
            }
            return(Json(displayTimings, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ViewAppointmentsForReport(int patientID)
        {
            int         id         = (int)Session["UserId"];
            Patient_Api patientApi = new Patient_Api();

            IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(patientID).Where(a => (a.appointment_Date < DateTime.Now &&
                                                                                                                   a.reqReportNotes == "N/A" && a.requestedReport == false && a.doctor_ID == id && a.cancelled == false));
            List <int> patapts = new List <int>();

            foreach (var a in patientAppointments)
            {
                patapts.Add(a.appointment_ID);
            }

            PatientModel patient = new PatientModel();

            patient.pid = patientID;

            Reports_Api reports_Api = new Reports_Api();
            var         allReports  = reports_Api.GetReportsByPatient(patient);
            List <int>  patrptapts  = new List <int>();

            foreach (var a in allReports)
            {
                patrptapts.Add(a.appointment_ID);
            }

            {
                patapts = patapts.Except(patrptapts).ToList();
            }
            List <SelectListItem> patReports = new List <SelectListItem>();

            foreach (var a in patapts)
            {
                patReports.Add(new SelectListItem {
                    Text = a.ToString(), Value = a.ToString()
                });
            }
            return(Json(patReports, JsonRequestBehavior.AllowGet));
        }