出入区管理

界面导读

对病人进行出入区管理将已办好入院手续的病人电子档案进行入区操作,将准备出院的病人电子档案进行出区操作

①控件的使用:RadioButton控件(出入区选择)、文本框(查询)、GradView控件(数据)、DateTimePicker控件(时间的选择)

②功能的实现:已实现对GradView控件进行制定数据表的插入、

                         已实现通过对RadioButton控件、DateTimePicker控件双重指定的数据的挑选并显示

过程导读

控件代码

GradView控件、RadioButton控件的使用:

private void bt_查询_Click(object sender, EventArgs e)

        {

            string type = null;

            if (ra_出区.Checked == true)

            {

                type = ra_出区.Text.Trim();

            }

            else if (ra_入区.Checked == true)

            {

                type = ra_入区.Text.Trim();

            }

            else { MessageBox.Show("请选择类型"); }

            SqlConnection sqlConnection = new SqlConnection();                                             

            sqlConnection.ConnectionString =

                "Server=(local);Database=病区管理;Integrated Security=sspi";                            

            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.Connection = sqlConnection;                                                         

            sqlCommand.CommandText = "SELECT pa_no,pa_name,pa_sex,pa_depart,pa_RuYuanTime FROM patients WHERE pa_type='" + type + "'AND pa_RuYuanTime='" +date_入院时间.Text.Trim() + "'";                                          

            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();                                       

            sqlDataAdapter.SelectCommand = sqlCommand;                                                    

            DataTable patientsTable = new DataTable();                                                      

            sqlConnection.Open();                                                                       

            sqlDataAdapter.Fill(patientsTable);                                                         

            sqlConnection.Close();                                                                     

            this.dg_出入区管理.Columns.Clear();                                                         

            this.dg_出入区管理.DataSource = patientsTable;                                                   

            this.dg_出入区管理.Columns["pa_no"].HeaderText = "病号";                                          

            this.dg_出入区管理.Columns["pa_name"].HeaderText = "姓名";

            this.dg_出入区管理.Columns["pa_sex"].HeaderText = "性别";

            this.dg_出入区管理.Columns["pa_depart"].HeaderText = "科室";

            this.dg_出入区管理.Columns["pa_RuYuanTime"].HeaderText = "入院时间";

            this.dg_出入区管理.Columns[this.dg_出入区管理.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

        }

DateTimePicker控件的使用: 

        private void date_入院时间_ValueChanged(object sender, EventArgs e)

        {

            date_入院时间.Format = DateTimePickerFormat.Custom;

            date_入院时间.CustomFormat = "yyyy/MM/dd";

       }

效果截图

猜你喜欢

转载自www.cnblogs.com/hujianwei/p/9846600.html