Пример #1
0
        /// <summary>
        /// 按科室和职称查询医生信息(模糊查找)
        /// </summary>
        /// <param name="_office">string类型 科室名称</param>
        /// <param name="_jobTitle">string类型 职称名称</param>
        /// <returns>DTO4DoctorInfo的对象数组</returns>
        public DTO4DoctorInfo[] selectAllByJobTitleAndOffice(string _office, string _jobTitle)
        {
            string  sql = "select * from doctorInfo where office like '%" + _office + "%' and jobTitle like '%" + _jobTitle + "%'";
            DataSet dt  = DBOperater.selectSql(sql);

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                DTO4DoctorInfo[] dto4dArray = new DTO4DoctorInfo[dt.Tables[0].Rows.Count];
                for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
                {
                    dto4dArray[i]          = new DTO4DoctorInfo();
                    dto4dArray[i].Id       = dt.Tables[0].Rows[i]["id"].ToString();
                    dto4dArray[i].Name     = (string)dt.Tables[0].Rows[i]["name"];
                    dto4dArray[i].JobTitle = (string)dt.Tables[0].Rows[i]["jobTitle"];
                    dto4dArray[i].Office   = (string)dt.Tables[0].Rows[i]["office"];
                    dto4dArray[i].Psw      = (string)dt.Tables[0].Rows[i]["psw"];
                    dto4dArray[i].Upper    = dt.Tables[0].Rows[i]["upper"].ToString();
                    dto4dArray[i].Gender   = (string)dt.Tables[0].Rows[i]["gender"];
                    dto4dArray[i].Birth    = (DateTime)dt.Tables[0].Rows[i]["birth"];
                }
                return(dto4dArray);
            }
            else
            {
                DTO4DoctorInfo[] dto4dArray = new DTO4DoctorInfo[1];
                return(dto4dArray);
            }
        }
Пример #2
0
        public void UpdateArrangement(DataGridView dataGridView1, ComboBox comboBox1, ComboBox comboBox2)
        {
            string begin, end;

            if (dataGridView1.CurrentCell.RowIndex < 10)
            {
                begin = " 00:00:00";
                end   = " 12:00:00";
            }
            else
            {
                begin = " 12:00:00";
                end   = " 23:59:59";
            }

            DateTime bT = DateTime.Parse(dataGridView1.Rows[0].Cells[dataGridView1.CurrentCell.ColumnIndex].Value.ToString() + begin);
            DateTime fT = DateTime.Parse(dataGridView1.Rows[0].Cells[dataGridView1.CurrentCell.ColumnIndex].Value.ToString() + end);

            Barrangement Ba            = new Barrangement();
            string       arrangementId = Ba.QueryArrangementIdByDoctorNameAndBeginTime(dataGridView1.CurrentCell.Value.ToString(), bT).Id;

            Bdoctorinfo    Bd = new Bdoctorinfo();
            DTO4DoctorInfo updatedoctorinfo = new DTO4DoctorInfo();

            updatedoctorinfo = Bd.QuaryDoctorinfoByNameAndOffice(comboBox2.SelectedValue.ToString(), comboBox1.SelectedValue.ToString());
            try
            {
                Ba.UpdateById(arrangementId, bT, fT, updatedoctorinfo.Id, updatedoctorinfo.Office, updatedoctorinfo.Name, updatedoctorinfo.JobTitle);
                dataGridView1.CurrentCell.Value = comboBox2.SelectedValue.ToString();//立即显示修改
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #3
0
        public DTO4DoctorInfo DoctorLogin(string id)
        {
            DAO4DoctorInfo dDao   = new DAO4DoctorInfo();
            DTO4DoctorInfo doctor = dDao.selectAllById(id);

            if (doctor != null)
            {
                return(doctor);
            }
            else
            {
                throw new Exception("登录失败");
            }
        }
Пример #4
0
        //按医生姓名和科室查找医生信息
        public DTO4DoctorInfo selectAllByNameAndOffice(string _name, string _office)
        {
            string         sql   = "select * from doctorInfo where name ='" + _name + "' and office ='" + _office + "'";
            DataSet        dt    = DBOperater.selectSql(sql);
            DTO4DoctorInfo dto4d = new DTO4DoctorInfo();

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                dto4d.Id       = dt.Tables[0].Rows[0]["id"].ToString();
                dto4d.Name     = (string)dt.Tables[0].Rows[0]["name"];
                dto4d.JobTitle = (string)dt.Tables[0].Rows[0]["jobTitle"];
                dto4d.Office   = (string)dt.Tables[0].Rows[0]["office"];
                dto4d.Psw      = (string)dt.Tables[0].Rows[0]["psw"];
                dto4d.Upper    = dt.Tables[0].Rows[0]["upper"].ToString();
                dto4d.Gender   = (string)dt.Tables[0].Rows[0]["gender"];
            }
            return(dto4d);
        }
Пример #5
0
        /// <summary>
        /// 通过id,psw查找医生信息
        /// </summary>
        /// <param name="_id">string类型 医生id</param>
        /// <param name="_psw">string类型 医生密码</param>
        /// <returns>DTO4DoctorInfo的对象</returns>
        public DTO4DoctorInfo selectAllByIdAndPsw(string _id, string _psw)
        {
            string         sql   = "select * from doctorInfo where id =" + _id + " and psw = '" + _psw + "'";
            DataSet        dt    = DBOperater.selectSql(sql);
            DTO4DoctorInfo dto4d = new DTO4DoctorInfo();

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                dto4d.Id       = dt.Tables[0].Rows[0]["id"].ToString();
                dto4d.Name     = (string)dt.Tables[0].Rows[0]["name"];
                dto4d.JobTitle = (string)dt.Tables[0].Rows[0]["jobTitle"];
                dto4d.Office   = (string)dt.Tables[0].Rows[0]["office"];
                dto4d.Psw      = (string)dt.Tables[0].Rows[0]["psw"];
                dto4d.Upper    = dt.Tables[0].Rows[0]["upper"].ToString();
                dto4d.Gender   = (string)dt.Tables[0].Rows[0]["gender"];
                dto4d.Birth    = (DateTime)dt.Tables[0].Rows[0]["birth"];
            }
            return(dto4d);
        }
Пример #6
0
        public DTO4Arrangement getarrangment(int row, int cell, DataGridView dataGridView1, DateTimePicker dateTimePicker1, ComboBox comboBox1)
        {
            DTO4Arrangement arrangement = new DTO4Arrangement();
            DAO4DoctorInfo  dDAO        = new DAO4DoctorInfo();

            try
            {
                arrangement.DoctorName = dataGridView1.Rows[row].Cells[cell].Value.ToString();
                arrangement.Office     = comboBox1.SelectedValue.ToString();
                DTO4DoctorInfo doctor = dDAO.selectAllByNameAndOffice(arrangement.DoctorName, arrangement.Office);

                //根据排班表的行数来判断该医生是早班还是中班还是晚班

                if (row < 7)
                {
                    arrangement.BeginTime  = Convert.ToDateTime(dataGridView1.Rows[0].Cells[cell].Value.ToString() + " 08:00:00");
                    arrangement.FinishTime = Convert.ToDateTime(dataGridView1.Rows[0].Cells[cell].Value.ToString() + " 14:00:00");
                }
                else if (row < 13)
                {
                    arrangement.BeginTime  = Convert.ToDateTime(dataGridView1.Rows[0].Cells[cell].Value.ToString() + " 14:00:00");
                    arrangement.FinishTime = Convert.ToDateTime(dataGridView1.Rows[0].Cells[cell].Value.ToString() + " 20:00:00");
                }
                else
                {
                    arrangement.BeginTime  = Convert.ToDateTime(dataGridView1.Rows[0].Cells[cell].Value.ToString() + " 20:00:00");
                    arrangement.FinishTime = Convert.ToDateTime(dataGridView1.Rows[0].Cells[cell].Value.ToString() + " 23:59:59");
                }
                arrangement.DoctorId       = doctor.Id;
                arrangement.DoctorJobTitle = doctor.JobTitle;

                return(arrangement);
            }
            catch {
                return(null);
            }
        }
Пример #7
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                string          id       = TextUserid.Text.Trim();
                string          password = TextPassName.Text.Trim();
                BUser           mgr      = new BUser();
                DTO4ManagerInfo manager  = mgr.ManagerLogin(id, password);

                if (id == null || id == "")                                     //输入名和密码不能为空
                {
                    MessageBox.Show("输入名为空!");
                }
                if (password == null || password == "")
                {
                    MessageBox.Show("输入密码不能为空!");
                }

                //通过设置公共类app在窗体之间传递参数

                if (manager.Id == id && manager.Psw == password)
                {
                    app.a             = 1;
                    app.user_name     = manager.Name;
                    app.user_id       = manager.Id;
                    app.user_office   = "管理层";
                    app.user_jobtitle = "管理者";

                    Form1 form1 = new Form1();
                    this.Hide();
                    if (form1.ShowDialog() == DialogResult.OK)
                    {
                        this.Close();
                    }
                }
                else
                {
                    DTO4DoctorInfo doctor = mgr.DoctorLogin(id);
                    if (doctor.Psw == password)
                    {
                        app.a = 0;

                        app.user_name     = doctor.Name;
                        app.user_id       = doctor.Id;
                        app.user_office   = doctor.Office;
                        app.user_jobtitle = doctor.JobTitle;

                        Form1 form1 = new Form1();
                        this.Hide();
                        if (form1.ShowDialog() == DialogResult.OK)
                        {
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("登录失败");
                    }
                }
            }
            catch
            {
                MessageBox.Show("请确认您的账户密码是否正确");
            }
        }