Ejemplo n.º 1
0
        public void tiaoban_application(string user_name, DateTimePicker dateTimePicker2, DateTimePicker dateTimePicker4, ComboBox comboBox3, TextBox textBox1)
        {
            int arrangementId_self, arrangementId_others;

            Barrangement  ba = new Barrangement();
            Bchangerecord bc = new Bchangerecord();

            DTO4Arrangement dto4a_self = new DTO4Arrangement();

            dto4a_self         = ba.QueryArrangementIdByDoctorNameAndBeginTime(user_name, dateTimePicker2.Value.Date);
            arrangementId_self = int.Parse(dto4a_self.Id);

            DTO4Arrangement dto4a_others = new DTO4Arrangement();

            dto4a_others         = ba.QueryArrangementIdByDoctorNameAndBeginTime(comboBox3.SelectedValue.ToString(), dateTimePicker4.Value.Date);
            arrangementId_others = int.Parse(dto4a_others.Id);

            if (bc.InsertChangeRecord(arrangementId_self, arrangementId_others, textBox1.Text, "untreated"))
            {
                MessageBox.Show("申请成功!");
            }
            else
            {
                MessageBox.Show("申请失败,请确认是否正确选择班次!");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 按姓名查找排班信息(模糊查找)
        /// </summary>
        /// <param name="_doctorName">string doctorName</param>
        /// <returns>DTO4Arrangement对象数组</returns>
        public DTO4Arrangement[] selectAllByDoctorName(string _doctorName)
        {
            string  sql = "select * from arrangement where doctorName like '%" + _doctorName + "%'";
            DataSet dt  = DBOperater.selectSql(sql);

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                DTO4Arrangement[] dto4aArray = new DTO4Arrangement[dt.Tables[0].Rows.Count];

                for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
                {
                    dto4aArray[i]                = new DTO4Arrangement();
                    dto4aArray[i].Id             = dt.Tables[0].Rows[i]["id"].ToString();
                    dto4aArray[i].Office         = (string)dt.Tables[0].Rows[i]["office"];
                    dto4aArray[i].BeginTime      = (DateTime)dt.Tables[0].Rows[i]["beginTime"];
                    dto4aArray[i].FinishTime     = (DateTime)dt.Tables[0].Rows[i]["finishTime"];
                    dto4aArray[i].DoctorId       = dt.Tables[0].Rows[i]["doctorId"].ToString();
                    dto4aArray[i].DoctorName     = (string)dt.Tables[0].Rows[i]["doctorName"];
                    dto4aArray[i].DoctorJobTitle = (string)dt.Tables[0].Rows[i]["doctorJobTitle"];
                }
                return(dto4aArray);
            }
            else
            {
                DTO4Arrangement[] dto4aArray = new DTO4Arrangement[1];
                return(dto4aArray);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 按开始时间和科室查找排班表信息
        /// </summary>
        /// <param name="_doctorId">DateTime doctorId</param>
        /// <returns>DTO4Arrangement对象数组</returns>
        public DTO4Arrangement[] selectAllByBeginTime(DateTime _beginTime, string _office)
        {
            string  sql = "select * from arrangement where convert(varchar,beginTime,120) like '%" + _beginTime.ToString("yyyy-MM-dd") + "%' and office ='" + _office + "'";
            DataSet dt  = DBOperater.selectSql(sql);

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                DTO4Arrangement[] dto4aArray = new DTO4Arrangement[dt.Tables[0].Rows.Count];

                for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
                {
                    dto4aArray[i]                = new DTO4Arrangement();
                    dto4aArray[i].Id             = dt.Tables[0].Rows[i]["id"].ToString();
                    dto4aArray[i].Office         = (string)dt.Tables[0].Rows[i]["office"];
                    dto4aArray[i].BeginTime      = (DateTime)dt.Tables[0].Rows[i]["beginTime"];
                    dto4aArray[i].FinishTime     = (DateTime)dt.Tables[0].Rows[i]["finishTime"];
                    dto4aArray[i].DoctorId       = dt.Tables[0].Rows[i]["doctorId"].ToString();
                    dto4aArray[i].DoctorName     = (string)dt.Tables[0].Rows[i]["doctorName"];
                    dto4aArray[i].DoctorJobTitle = (string)dt.Tables[0].Rows[i]["doctorJobTitle"];
                    //dto4aArray[i].Img = (string)dt.Tables[0].Rows[i]["img"];
                }
                return(dto4aArray);
            }
            else
            {
                DTO4Arrangement[] dto4aArray = new DTO4Arrangement[1];
                return(dto4aArray);
            }
        }
Ejemplo n.º 4
0
        public string[] ShowChangeRecord(DataGridView dataGridView1, ComboBox comboBox1, int z)       //显示申请记录
        {
            string[] ChangeRecordIds = new string[20];
            dataGridView1.Rows.Clear();
            string status;

            if (comboBox1.Text.ToString() == "已处理的申请")
            {
                status = "processed";
            }
            else
            {
                status = "untreated";
            }

            Barrangement  ba = new Barrangement();
            Bchangerecord bc = new Bchangerecord();

            DTO4ChangeRecord[] dto4c = new DTO4ChangeRecord[20];
            DTO4Arrangement    dto4a = new DTO4Arrangement();

            dto4c = bc.QueryChangerecordByStatus(status);
            int j = 0;

            for (int i = 0; i < dto4c.Count(); i++)
            {
                if (dto4c[i].ArrangementId_others == "0" && z == 1)
                {
                    int index = dataGridView1.Rows.Add(1);
                    dto4a = ba.QueryArrangementById(dto4c[i].ArrangementId_self);
                    dataGridView1.Rows[j].Cells[0].Value = dto4a.DoctorName;
                    dataGridView1.Rows[j].Cells[1].Value = dto4a.BeginTime;
                    dataGridView1.Rows[j].Cells[2].Value = dto4c[i].Remark;
                    ChangeRecordIds[j] = dto4c[i].Id;
                    j++;
                }
                if (dto4c[i].ArrangementId_others != "0" && z == 0)
                {
                    int             index        = dataGridView1.Rows.Add(1);
                    DTO4Arrangement dto4a_others = new DTO4Arrangement();
                    dto4a        = ba.QueryArrangementById(dto4c[i].ArrangementId_self);
                    dto4a_others = ba.QueryArrangementById(dto4c[i].ArrangementId_others);
                    dataGridView1.Rows[j].Cells[0].Value = dto4a.DoctorName;
                    dataGridView1.Rows[j].Cells[1].Value = dto4a_others.DoctorName;
                    dataGridView1.Rows[j].Cells[2].Value = dto4a.BeginTime;
                    dataGridView1.Rows[j].Cells[3].Value = dto4a_others.BeginTime;
                    dataGridView1.Rows[j].Cells[4].Value = dto4c[i].Remark;
                    ChangeRecordIds[j] = dto4c[i].Id;
                    j++;
                }
            }
            return(ChangeRecordIds);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 按排班表id查找排班表信息
        /// </summary>
        /// <param name="_id">string id</param>
        /// <returns>DTO4Arrangement对象</returns>
        public DTO4Arrangement selectAllById(string _id)
        {
            string          sql   = "select * from arrangement where id = " + _id;
            DataSet         dt    = DBOperater.selectSql(sql);
            DTO4Arrangement dto4a = new DTO4Arrangement();

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                dto4a.Id             = dt.Tables[0].Rows[0]["id"].ToString();
                dto4a.Office         = (string)dt.Tables[0].Rows[0]["office"];
                dto4a.BeginTime      = (DateTime)dt.Tables[0].Rows[0]["beginTime"];
                dto4a.FinishTime     = (DateTime)dt.Tables[0].Rows[0]["finishTime"];
                dto4a.DoctorId       = dt.Tables[0].Rows[0]["doctorId"].ToString();
                dto4a.DoctorName     = (string)dt.Tables[0].Rows[0]["doctorName"];
                dto4a.DoctorJobTitle = (string)dt.Tables[0].Rows[0]["doctorJobTitle"];
            }
            return(dto4a);
        }
Ejemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            int   Row = 1, Cell = 1;
            BUser arg = new BUser();

            DAO4Arrangement darrang = new DAO4Arrangement();

            for (Row = 1; Row <= 18; Row++)
            {
                for (Cell = 1; Cell <= 7; Cell++)
                {
                    if (dataGridView1.Rows[Row].Cells[Cell].Value != null)
                    {
                        DTO4Arrangement getarg = arg.getarrangment(Row, Cell, dataGridView1, dateTimePicker1, comboBox1);
                        darrang.insertArrangement(getarg.BeginTime, getarg.FinishTime, getarg.DoctorId, getarg.Office, getarg.DoctorName, getarg.DoctorJobTitle);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void Search(DataGridView dataGridView1, ComboBox comboBox1)
        {
            datagridviewHelper dg = new datagridviewHelper();

            dg.CleanDataGridView(dataGridView1);

            string   _strWorkingDayNig = "12:00";//介于0-12为早班,否则为晚班
            TimeSpan dspWorkingDayNig  = TimeSpan.Parse(_strWorkingDayNig);

            for (int i = 1; i < 8; i++)
            {
                DateTime t = DateTime.Parse(dataGridView1.Rows[0].Cells[i].Value.ToString());//分别取周一到周日的日期

                Barrangement      Ba   = new Barrangement();
                DTO4Arrangement[] dto4 = new DTO4Arrangement[10];//科室每天排班上限为10名医生
                for (int z = 0; z < 10; z++)
                {
                    dto4[z] = new DTO4Arrangement();
                }


                dto4 = Ba.QueryArrangementByOfficeAndBeginTime(t, comboBox1.SelectedValue.ToString());

                int morn = 1, nig = 10; //不同班次对应行号
                try
                {
                    for (int j = 0; j < dto4.Count(); j++)
                    {
                        if ((dto4[j].BeginTime - t) < dspWorkingDayNig)                   //显示早班
                        {
                            dataGridView1.Rows[morn].Cells[i].Value = dto4[j].DoctorName; //将对应医生姓名放置到对应日期的早班,并换行
                            morn++;
                        }
                        else//显示晚班
                        {
                            dataGridView1.Rows[nig].Cells[i].Value = dto4[j].DoctorName;//将对应医生姓名放置到对应日期的晚班,并换行
                            nig++;
                        }
                    }
                }
                catch { }
            }
        }
Ejemplo n.º 8
0
        public void qingjia_application(string user_name, DateTimePicker dateTimePicker3, TextBox textBox2)
        {
            int arrangementId_self;

            Barrangement  ba = new Barrangement();
            Bchangerecord bc = new Bchangerecord();

            DTO4Arrangement dto4a_self = new DTO4Arrangement();

            dto4a_self         = ba.QueryArrangementIdByDoctorNameAndBeginTime(user_name, dateTimePicker3.Value.Date);
            arrangementId_self = int.Parse(dto4a_self.Id);

            if (bc.InsertChangeRecord(arrangementId_self, 0, textBox2.Text, "untreated"))
            {
                MessageBox.Show("申请成功!");
            }
            else
            {
                MessageBox.Show("申请失败,请确认是否正确选择班次!");
            }
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
        public void Execution(CheckBox checkBox4, CheckBox checkBox3, DataGridView dataGridView1, TextBox textBox1, string[] Ids, int z)//执行申请管理操作
        {
            string        operate;
            Bchangerecord bc = new Bchangerecord();

            if (checkBox4.Checked)
            {
                if (z == 0)       //自动执行调班处理;
                {
                    Barrangement    ba = new Barrangement();
                    DTO4Arrangement self_arrangement = new DTO4Arrangement();
                    DTO4Arrangement others_arrangement = new DTO4Arrangement();
                    DateTime        begin_time, finish_time;
                    self_arrangement   = ba.QueryArrangementIdByDoctorNameAndBeginTime(dataGridView1.CurrentRow.Cells[0].Value.ToString(), DateTime.Parse(dataGridView1.CurrentRow.Cells[2].Value.ToString()));
                    others_arrangement = ba.QueryArrangementIdByDoctorNameAndBeginTime(dataGridView1.CurrentRow.Cells[1].Value.ToString(), DateTime.Parse(dataGridView1.CurrentRow.Cells[3].Value.ToString()));
                    begin_time         = self_arrangement.BeginTime;
                    finish_time        = self_arrangement.FinishTime;
                    ba.UpdateById(self_arrangement.Id, others_arrangement.BeginTime, others_arrangement.FinishTime, self_arrangement.DoctorId, self_arrangement.Office, self_arrangement.DoctorName, self_arrangement.DoctorJobTitle);
                    ba.UpdateById(others_arrangement.Id, begin_time, finish_time, others_arrangement.DoctorId, others_arrangement.Office, others_arrangement.DoctorName, others_arrangement.DoctorJobTitle);
                    MessageBox.Show("已成功将" + self_arrangement.DoctorName + "与" + others_arrangement.DoctorName + "的班次对调!");
                }
                operate = "approve";
                bc.UpdateChangeRecordById(Ids[dataGridView1.CurrentCell.RowIndex], "processed", textBox1.Text, operate);
                MessageBox.Show("处理成功!");
            }
            else if (checkBox3.Checked)
            {
                operate = "disapprove";
                bc.UpdateChangeRecordById(Ids[dataGridView1.CurrentCell.RowIndex], "processed", textBox1.Text, operate);
                MessageBox.Show("处理成功!");
            }
            else
            {
                MessageBox.Show("请先选择处理结果:批准/不批准");
            }
        }
Ejemplo n.º 11
0
        public DTO4Arrangement selectArrangementIdByNameAndBegintime(string _name, DateTime _beginTime)
        {
            string  sql = "select * from arrangement where convert(varchar,beginTime,120) like '%" + _beginTime.ToString("yyyy-MM-dd") + "%' and doctorName ='" + _name + "'";
            DataSet dt  = DBOperater.selectSql(sql);

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                DTO4Arrangement dto4 = new DTO4Arrangement();
                dto4.Id             = dt.Tables[0].Rows[0]["id"].ToString();
                dto4.Office         = (string)dt.Tables[0].Rows[0]["office"];
                dto4.BeginTime      = (DateTime)dt.Tables[0].Rows[0]["beginTime"];
                dto4.FinishTime     = (DateTime)dt.Tables[0].Rows[0]["finishTime"];
                dto4.DoctorId       = dt.Tables[0].Rows[0]["doctorId"].ToString();
                dto4.DoctorName     = (string)dt.Tables[0].Rows[0]["doctorName"];
                dto4.DoctorJobTitle = (string)dt.Tables[0].Rows[0]["doctorJobTitle"];

                return(dto4);
            }
            else
            {
                DTO4Arrangement dto4 = new DTO4Arrangement();
                return(dto4);
            }
        }