Example #1
0
        /// <summary>
        /// Creates a new appointment
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public Message AddAppointment([FromBody] JToken value)
        {
            int doctorid = 0, patientid = 0;

            int.TryParse((string)value.SelectToken("doctorid"), out doctorid);
            int.TryParse((string)value.SelectToken("patientid"), out patientid);
            if (!DoctorDAL.DoctorExists(doctorid))
            {
                return(MessageHandler.Error("Incorrect doctorid. Not authorized to update patients"));
            }
            if (!PatientDAL.PatientExist(patientid))
            {
                return(MessageHandler.Error("Incorrect patientid. Patient not found!"));
            }
            string date = (string)value.SelectToken("date");
            string time = (string)value.SelectToken("time");

            if (date == null)
            {
                return(MessageHandler.Error("Please specify a date for this appointment."));
            }
            if (time == null)
            {
                return(MessageHandler.Error("Please specify a time for this appointment."));
            }

            AppointmentDAL.InsertAppointment(doctorid, patientid, (int)StatusEnum.Success, date, time,
                                             (string)value.SelectToken("notes"));

            UserActivity.AddDoctorActivity((int)ActivityEnum.CreateAppointment, doctorid, (int)StatusEnum.Success, "Success", value.ToString());
            return(MessageHandler.Success("Appointment added!"));
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            StreamReader reader    = new StreamReader(context.Request.InputStream, Encoding.UTF8);
            string       jObjStr   = reader.ReadToEnd();
            DoctorModel  userModel = JsonConvert.DeserializeObject <DoctorModel>(jObjStr);

            JObject jObj = new JObject();

            //检查用户名是否存在
            if (DoctorDAL.CheckUsernameExist(userModel.Name))
            {
                jObj.Add("state", "username exist");
            }
            else
            {
                if (DoctorDAL.Insert(userModel))
                {
                    jObj.Add("state", "success");
                }
                else
                {
                    jObj.Add("state", "failed");
                }
            }
            byte[] buf = Encoding.UTF8.GetBytes(jObj.ToString());
            context.Response.OutputStream.Write(buf, 0, buf.Length);
        }
        private async void LlenarCombo()
        {
            DoctorDAL           DAL         = new DoctorDAL();
            List <ClinicaModel> listClinica = await DAL.listarClinica();

            List <EspecialidadModel> listEspecialidad = await DAL.listarEspecialidad();

            listClinica.Insert(0, new ClinicaModel {
                IdClinica = 0, Nombre = "--SELECCIONE--"
            });
            listEspecialidad.Insert(0, new EspecialidadModel {
                IdEspecialidad = 0, Nombre = "--SELECCIONE--"
            });

            this.Invoke(new MethodInvoker(() =>
            {
                //Clinica
                cboClinica.DataSource    = listClinica;
                cboClinica.DisplayMember = "Nombre";
                cboClinica.ValueMember   = "IdClinica";

                //Especialidad
                cboEspecialidad.DataSource    = listEspecialidad;
                cboEspecialidad.DisplayMember = "Nombre";
                cboEspecialidad.ValueMember   = "IdEspecialidad";
            }));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientManagement"/> class.
        /// </summary>
        /// <param name="patientInfo">The patient information.</param>
        /// <param name="nurseUserId">The nurse user identifier.</param>
        public PatientManagement(Person patientInfo, int nurseUserId)
        {
            InitializeComponent();

            this.patient            = patientInfo;
            this.nurseUserId        = nurseUserId;
            this.detailsTabEditMode = false;
            this.toggleCurrentlyEditingAppointment(false);
            this.currentlyEditingVisit = false;

            this.enableDetailsTabAllowEdit(false);
            this.hideDetailsTabErrorMessages();
            this.comboBoxStates.DataSource       = Enum.GetValues(typeof(StateAbbreviations));
            this.buttonSavePatient.Enabled       = detailsTabEditMode;
            this.buttonCancelEditPatient.Enabled = detailsTabEditMode;
            this.populateFields();
            this.dateTimeAppointmentDate.CustomFormat = Constants.Constants.DATE_TIME_PICKER_FORMAT;
            this.dateTimePickerVisit.CustomFormat     = Constants.Constants.DATE_TIME_PICKER_FORMAT;
            List <Person> allDoctors = DoctorDAL.GetAllDoctors();

            this.comboBoxAppointmentDoctor.ValueMember   = "DoctorId";
            this.comboBoxAppointmentDoctor.DisplayMember = "FullNameLastFirst";
            this.comboBoxAppointmentDoctor.DataSource    = allDoctors;
            this.comboBoxVisitDoctor.ValueMember         = "DoctorId";
            this.comboBoxVisitDoctor.DisplayMember       = "FullNameLastFirst";
            this.comboBoxVisitDoctor.DataSource          = allDoctors;

            this.initializeAppointmentsListView();
            this.listViewVisits.Columns.Add("Date & Time", 150);
            this.reloadAppointments();
            this.loadVisits();
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string name = Request.Params["name"];

            if (!string.IsNullOrEmpty(name))
            {
                DoctorModel doctor = DoctorDAL.GetByName(name);
                if (doctor != null)
                {
                    lbl_username.Text = doctor.Name;
                    lbl_realname.Text = doctor.RealName;

                    HospitalModel hospital = HospitalDAL.GetById((long)doctor.Hospital_id);
                    if (hospital != null)
                    {
                        lbl_hospital.Text    = hospital.Name;
                        lbl_hospitalPos.Text = hospital.Address;
                    }

                    string imageUrl = string.Format("~/ImageWebForm.aspx?picName={0}&fileType=doctor", doctor.PhotoPath);
                    graphPlaceHolder.Controls.Add(new Image()
                    {
                        ImageUrl = imageUrl, Width = 114, Height = 150
                    });
                }
            }
        }
Example #6
0
        public List <PatientData> SearchPatientData([FromBody] JToken value)
        {
            int docId = 0;

            int.TryParse((string)value.SelectToken("doctorid"), out docId);

            if (DoctorDAL.DoctorExists(docId))
            {
                List <PatientData> patients = PatientDAL.GetPatients((string)value.SelectToken("firstname"),
                                                                     (string)value.SelectToken("lastname"),
                                                                     (string)value.SelectToken("nationalid"),
                                                                     (string)value.SelectToken("mobilenumber")
                                                                     );
                if (patients == null)
                {
                    UserActivity.AddDoctorActivity((int)ActivityEnum.PatientSearch, docId, (int)StatusEnum.Failure, "No patients found", value.ToString());
                }
                else
                {
                    UserActivity.AddDoctorActivity((int)ActivityEnum.PatientSearch, docId, (int)StatusEnum.Success, "Success", value.ToString());
                    return(patients);
                }
            }
            return(null);
        }
 public ActionResult Submit(Doctor doc)
 {
     if (verifyDoctor() == false)
     {
         TempData["WarningMessage"] = "Don't go to places you are not allowed.";
         return(RedirectToAction("LogOut", "Home"));
     }
     if (ModelState.IsValid)
     {
         using (var db = new DoctorDAL())
         {
             db.Doctors.Attach(doc);
             db.Entry(doc).Property(x => x.DID).IsModified       = true;
             db.Entry(doc).Property(x => x.FirstName).IsModified = true;
             db.Entry(doc).Property(x => x.LastName).IsModified  = true;
             db.Entry(doc).Property(x => x.Age).IsModified       = true;
             db.Entry(doc).Property(x => x.Email).IsModified     = true;
             db.Entry(doc).Property(x => x.Phone).IsModified     = true;
             db.Entry(doc).Property(x => x.Password).IsModified  = true;
             db.SaveChanges();
             return(RedirectToAction("MyInfo", "Doctor"));
         }
     }
     return(RedirectToAction("MyInfo", "Doctor"));
 }
 /// <summary>
 /// Method to add new doctor to the DB.
 /// </summary>
 /// <param name="doc"></param>
 /// <returns></returns>
 public ActionResult AddDoctor(Doctor doc)
 {
     if (verifyAdmin() == false)
     {
         TempData["WarningMessage"] = "Don't go to places you are not allowed.";
         return(RedirectToAction("LogOut", "Home"));
     }
     if (ModelState.IsValid)
     {
         DoctorDAL  docDAL       = new DoctorDAL();
         Encryption enc          = new Encryption();
         string     hashPassword = enc.CreateHash(doc.Password);
         doc.Password = hashPassword;
         try
         {
             docDAL.Doctors.Attach(doc);
             docDAL.Doctors.Add(doc);
             docDAL.SaveChanges();
             TempData["DuplicateDoctor"] = null;
             return(RedirectToAction("ShowDoctors", "Admin"));
         }
         catch (Exception)
         {
             docDAL.Doctors.Remove(doc);
             TempData["DuplicateDoctor"] = true;
             return(RedirectToAction("ShowDoctors", "Admin"));
         }
     }
     TempData["DuplicateDoctor"] = null;
     return(RedirectToAction("ShowDoctors", "Admin"));
 }
        public DoctorData GetDoctorData([FromBody] JToken value)
        {
            int docId = 0;

            int.TryParse((string)value.SelectToken("doctorid"), out docId);

            return(DoctorDAL.GetDoctorData(docId));
        }
Example #10
0
 /// <see cref="DoctorDAL.GetDoctorsSpecialties(Doctor)"/>
 public List <Specialty> GetDoctorsSpecialties(Doctor doctor)
 {
     if (doctor == null || doctor.ID == null)
     {
         throw new ArgumentNullException("doctor and its id cannot be null");
     }
     return(DoctorDAL.GetDoctorsSpecialties(doctor));
 }
        public List <DoctorData> SearchDoctorData([FromBody] JToken value)
        {
            List <DoctorData> doctors = DoctorDAL.GetDoctors((string)value.SelectToken("firstname"),
                                                             (string)value.SelectToken("lastname"),
                                                             (string)value.SelectToken("city")
                                                             );

            return(doctors);
        }
Example #12
0
        public static bool AddDoctorActivity(int activityType, int doctorID, int statusID, string details, string data)
        {
            if (doctorID < 0 || activityType < 0 || statusID < 0)
            {
                return(false);
            }

            DoctorDAL.AddDoctorActivity(activityType, doctorID, statusID, details, data);
            return(true);
        }
Example #13
0
        public async void ListarDoctores()
        {
            DoctorDAL          oDoctorDAL = new DoctorDAL();
            List <DoctorModel> model      = await oDoctorDAL.listarDoctor();

            dgvDoctor.DataSource = model;
            for (int i = 6; i < dgvDoctor.Columns.Count; i++)
            {
                dgvDoctor.Columns[i].Visible = false;
            }
        }
Example #14
0
        public List <Appointment> GetDoctorAppointments([FromBody] JToken value)
        {
            int docId = 0;

            int.TryParse((string)value.SelectToken("doctorid"), out docId);
            if (DoctorDAL.DoctorExists(docId))
            {
                UserActivity.AddDoctorActivity((int)ActivityEnum.ViewAppointments, docId, (int)StatusEnum.Success, "Success", value.ToString());
                return(AppointmentDAL.GetDoctorAppointments(docId));
            }
            return(null);
        }
 /// <summary>
 /// Initalizes DAL objects
 /// </summary>
 public HealthcareController()
 {
     visitDAL       = new VisitDAL();
     appointmentDAL = new AppointmentDAL();
     doctorDAL      = new DoctorDAL();
     personDAL      = new PersonDAL();
     loginDAL       = new LoginDAL();
     patientDAL     = new PatientDAL();
     nurseDAL       = new NurseDAL();
     testDAL        = new TestDAL();
     specialtyDAL   = new SpecialityDAL();
 }
Example #16
0
        // GET: Patient/Details/5
        public ActionResult Details()
        {
            string dfirstname = TempData["dfirstname"].ToString();

            TempData.Keep();
            string dlastname = TempData["dlastname"].ToString();

            TempData.Keep();
            Doctor doctor = DoctorDAL.Get(dfirstname, dlastname);

            return(View(doctor));
        }
Example #17
0
        public void ProcessRequest(HttpContext context)
        {
            StreamReader reader     = new StreamReader(context.Request.InputStream, Encoding.UTF8);
            string       requestStr = reader.ReadToEnd();

            UserModel userModel = new UserModel();
            JObject   jObj      = JObject.Parse(requestStr);

            userModel.Name     = jObj["name"].ToString();
            userModel.Password = jObj["password"].ToString();

            if (jObj["male"] == null || string.IsNullOrEmpty(jObj["male"].ToString()))
            {
                userModel.Male = null;
            }
            else
            {
                userModel.Male = bool.Parse(jObj["male"].ToString());
            }

            if (jObj["date_of_birth"] == null ||
                string.IsNullOrEmpty(jObj["date_of_birth"].ToString()))
            {
                userModel.Date_of_birth = null;
            }
            else
            {
                userModel.Date_of_birth = DateTime.Parse(jObj["date_of_birth"].ToString());
            }

            JObject jResponse = new JObject();

            //检查用户名是否存在
            if (DoctorDAL.CheckUsernameExist(userModel.Name))
            {
                jResponse.Add("state", "username exist");
            }
            else
            {
                if (UserDAL.Insert(userModel))
                {
                    jResponse.Add("state", "success");
                }
                else
                {
                    jResponse.Add("state", "failed");
                }
            }

            byte[] buf = Encoding.UTF8.GetBytes(jResponse.ToString());
            context.Response.OutputStream.Write(buf, 0, buf.Length);
        }
Example #18
0
 public ActionResult Login(string username, string password)
 {
     if (DoctorDAL.ValidateUser(username, password))
     {
         TempData["username"] = username;
         return(RedirectToAction("Index"));
     }
     else
     {
         ModelState.AddModelError("", "Invalid Username OR Password");
         return(View());
     }
 }
Example #19
0
 public ActionResult ListDoctors(string specialization)
 {
     if (ModelState.IsValid)
     {
         List <Doctor> doctorList = new List <Doctor>();
         doctorList = DoctorDAL.GetAll(specialization);
         return(View(doctorList));
     }
     else
     {
         ModelState.AddModelError("", "Select Specialization");
         return(View());
     }
 }
        // GET: Admin
        /// <summary>
        /// Method to show all current doctors & users
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowAllUsers()
        {
            //if (verifyAdmin() == false)
            //{
            //    TempData["WarningMessage"] = "Don't go to places you are not allowed.";

            //    return RedirectToAction("LogOut", "Home");
            //}
            UserDAL        dalUser = new UserDAL();
            DoctorDAL      dalDoc  = new DoctorDAL();
            VMUsersDoctors vm      = new VMUsersDoctors(dalDoc.Doctors.ToList <Doctor>(), dalUser.Users.ToList <User>());

            return(View(vm));
        }
        public Boolean Insert(DoctorENT entDoctor)
        {
            DoctorDAL DALDoctor = new DoctorDAL();

            if (DALDoctor.Insert(entDoctor))
            {
                return(true);
            }
            else
            {
                Message = DALDoctor.Message;
                return(false);
            }
        }
        /// <summary>
        /// Method to edit the doctor information.
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit()
        {
            if (verifyDoctor() == false)
            {
                TempData["WarningMessage"] = "Don't go to places you are not allowed.";
                return(RedirectToAction("LogOut", "Home"));
            }
            DoctorDAL     queDAL  = new DoctorDAL();
            var           tempID  = Session["DoctorLoggedIn"].ToString();
            List <Doctor> doc     = (from x in queDAL.Doctors where x.DID.Equals(tempID) select x).ToList <Doctor>();
            Doctor        thisDoc = doc[0];

            return(View(thisDoc));
        }
Example #23
0
        public ActionResult UpdateTime_Post(string checkin, string checkout)
        {    // Retrieve form data using form collection
            string username = TempData["username"].ToString();

            TempData.Keep();
            if (ModelState.IsValid)
            {
                DoctorDAL.UpdateTime(username, checkin, checkout);
                return(RedirectToAction("Index", "Doctor"));
            }
            else
            {
                return(View());
            }
        }
        private async void FRMPopupDoctor_Load(object sender, EventArgs e)
        {
            await Task.Run(() => { LlenarCombo(); });

            if (IdDoctor == 0)
            {
                this.Text           = "Agregar Doctor";
                rbMasculino.Checked = true;
            }
            else
            {
                this.Text = "Editar Doctor";
                DoctorDAL   DAL   = new DoctorDAL();
                DoctorModel model = await DAL.recuperarDoctor(IdDoctor);

                txtId.Text                    = model.IdDoctor.ToString();
                txtNombre.Text                = model.nombre;
                txtApPaterno.Text             = model.ApPaterno;
                txtApMaterno.Text             = model.ApMaterno;
                cboClinica.SelectedValue      = model.IdClinica;
                cboEspecialidad.SelectedValue = model.IdEspecialidad;
                txtEmail.Text                 = model.Email;
                txtCelular.Text               = model.celular == null?"": model.celular.ToString();
                txtSueldo.Text                = model.Sueldo.ToString();

                if (model.Sexo == 1)
                {
                    rbMasculino.Checked = true;
                }
                else
                {
                    rbFemenino.Checked = true;
                }

                //data:image/formatoImagen;base64;
                string foto = model.Archivo;
                nombreArchivo = model.nombreArchivo;

                if (foto != null && foto != "")
                {
                    string extension = Path.GetExtension(nombreArchivo).Substring(1);
                    foto = foto.Replace("data:image/" + extension + ";base64,", "");
                    byte[]       arrayFoto = Convert.FromBase64String(foto);
                    MemoryStream ms        = new MemoryStream(arrayFoto);
                    pbFoto.Image = Image.FromStream(ms);
                }
            }
        }
Example #25
0
        public void PieChartInsert()
        {
            UserDAL   usr          = new UserDAL();
            DoctorDAL doc          = new DoctorDAL();
            var       countUsers   = (from x in usr.Users where x.ID != null select x).Count();
            var       countDoctors = (from x in doc.Doctors where x.DID != null select x).Count();
            float     temp1        = (float)countUsers;
            float     temp2        = (float)countDoctors;
            float     sum          = temp1 + temp2;

            temp1 = (temp1 / sum) * 100;
            temp2 = (temp2 / sum) * 100;

            Session["countUsers"]   = countUsers;
            Session["countDoctors"] = countDoctors;
        }
Example #26
0
        private async void toolStripEliminar_Click(object sender, EventArgs e)
        {
            int       idDoc = (int)dgvDoctor.CurrentRow.Cells[0].Value;
            DoctorDAL DAL   = new DoctorDAL();
            int       rpta  = await DAL.eliminarDoctor(idDoc);

            if (rpta == 1)
            {
                MessageBox.Show("Se elimino correctamente");
                ListarDoctores();
            }
            else
            {
                MessageBox.Show("Ocurrio un error!");
            }
        }
        /// <summary>
        /// Method to delete doctor from DB.
        /// </summary>
        /// <param name="docID"></param>
        /// <returns></returns>
        public ActionResult DeleteDoctor(string docID)
        {
            if (verifyAdmin() == false)
            {
                Session["TempData"] = "Don't go to places you are not allowed.";
                return(RedirectToAction("LogOut", "Home"));
            }
            DoctorDAL     docDAL      = new DoctorDAL();
            List <Doctor> doc         = (from x in docDAL.Doctors where x.DID.Equals(docID) select x).ToList <Doctor>();
            Doctor        docToDelete = doc[0];

            docDAL.Doctors.Attach(docToDelete);
            docDAL.Doctors.Remove(docToDelete);
            docDAL.SaveChanges();
            return(RedirectToAction("ShowDoctors", "Admin"));
        }
Example #28
0
        static void Main(string[] args)
        {
            IDoctor  doctordal  = new DoctorDAL();
            IPatient patientdal = new PatientDAL();

            Console.WriteLine("Enter 1 For Create & save /n Eneter 2 for Delete /n Enter 3 for display patients");
            int    number = Convert.ToInt32(Console.ReadLine());
            string name   = string.Empty;
            string email  = string.Empty;
            uint   id;
            uint   type;

            switch (number)
            {
            case 1:
                //Create , Save and Assign patient to doctor
                Console.WriteLine("enter Patient Name");
                name = Console.ReadLine();
                Console.WriteLine("enter Patient email");
                email = Console.ReadLine();
                Console.WriteLine("enter Patient type \n Cardiologist \n Physcician \n Dietician \n Psychtraist");
                type = Convert.ToUInt16(Console.ReadLine());

                Patient patient = patientdal.CreatePatient(name, patientdal.GetPatients().Max(x => x.iD) + 1, email, (Constants.Speciality)type);

                if (patientdal.AddPatient(patient))
                {
                    doctordal.AssignPatient(patient);
                }

                break;

            case 2:
                //Delete patients
                Console.WriteLine("enter the id of patient");
                id = Convert.ToUInt16(Console.ReadLine());
                patientdal.DeletePatient(id);
                break;

            case 3:
                //Show Patient
                Console.WriteLine("Enter the id of patient");
                id = Convert.ToUInt16(Console.ReadLine());
                patientdal.ShowPatient(patientdal.GetPatients(id));
                break;
            }
        }
        /// <summary>
        /// Method to show doctors
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowDoctors()
        {
            if (verifyAdmin() == false)
            {
                TempData["WarningMessage"] = "Don't go to places you are not allowed.";
                return(RedirectToAction("LogOut", "Home"));
            }
            //UserDAL dalUser = new UserDAL();
            DoctorDAL     dalDoc = new DoctorDAL();
            List <Doctor> docs   = dalDoc.Doctors.ToList <Doctor>();

            ViewBag.DoctorsList = docs;
            //VMUsersDoctors vm = new VMUsersDoctors(dalDoc.Doctors.ToList<Doctor>(), dalUser.Users.ToList<User>());


            return(View());
        }
Example #30
0
        public void ProcessRequest(HttpContext context)
        {
            StreamReader reader     = new StreamReader(context.Request.InputStream, Encoding.UTF8);
            string       requestStr = reader.ReadToEnd();

            long    record_id;
            JObject jObj = new JObject();

            if (long.TryParse(requestStr, out record_id))
            {
                //获取对自检编号为该整数的医生所有意见
                DiagnosisModel[] diagnoses = DiagnosisDAL.GetAllByRecordId(record_id);
                int nbDiagnoses            = diagnoses.Length;
                jObj.Add("count", nbDiagnoses);
                JArray jArr = new JArray();
                for (int i = 0; i < nbDiagnoses; i++)
                {
                    DiagnosisModel diagnosis = diagnoses[i];
                    DoctorModel    doctor    = DoctorDAL.GetById(diagnosis.Doc_id);
                    JObject        jArrObj   = new JObject();
                    jArrObj.Add("realname", doctor.RealName);
                    jArrObj.Add("time", diagnosis.Time);
                    jArrObj.Add("comment", diagnosis.Result);
                    jArr.Add(jArrObj);
                }
                jObj.Add("content", jArr);
            }
            else
            {
                //添加医生意见
                DiagnosisModel diagnosis = JsonConvert.DeserializeObject <DiagnosisModel>(requestStr);
                if (DiagnosisDAL.Insert(diagnosis))
                {
                    jObj.Add("state", "success");
                }
                else
                {
                    jObj.Add("state", "failed");
                }
            }

            byte[] buf = Encoding.UTF8.GetBytes(jObj.ToString());
            context.Response.OutputStream.Write(buf, 0, buf.Length);
        }