public string ReserveStateShow(BeingHospitalized bh)
        {
            Sqlhelper sqlhelper = new Sqlhelper();
            DataTable datatable = new DataTable();

            datatable = sqlhelper.Exesql("SELECT * from BeingHospitalized WHERE  IDNumber = '" + bh.IDNumber + "' ");
            if (datatable.Rows.Count > 0)
            {
                int    state   = int.Parse(datatable.Rows[0]["State"].ToString());
                string resualt = "";
                switch (state)
                {
                case 0:
                    resualt = "申请已提交,请等待审查;";
                    break;

                case 1:
                    resualt = "申请已通过,请去住院部领取办理相应手续";
                    break;

                case 2:
                    resualt = "申请未通过,请去住院部查问";
                    break;
                }
                return(resualt);
            }
            else
            {
                return("请先提交预约");
            }
        }
Beispiel #2
0
        private void BtnRegister_Click(object sender, EventArgs e)
        {
            if (txIDNum.Text == "" || txAge.Text == "" || txName.Text == "" || txTell.Text == "")
            {
                MessageBox.Show("请输入完整信息", "信息提示", MessageBoxButtons.OKCancel);
            }
            else
            {
                PatientReserve    pr         = new PatientReserve();
                BeingHospitalized newpatient = new BeingHospitalized();
                newpatient.IDNumber = txIDNum.Text;
                newpatient.Name     = txName.Text;
                if (rdBtnF.Checked == true)
                {
                    newpatient.Sex = "女";
                }
                else if (rdBtnM.Checked == true)
                {
                    newpatient.Sex = "男";
                }
                else
                {
                    MessageBox.Show("请选择性别!", "信息提示", MessageBoxButtons.OKCancel);
                }

                //AGE
                string str  = txAge.Text;
                bool   flag = true;
                char[] ch   = new char[str.Length];
                ch = str.ToCharArray();
                for (int i = 0; i < str.Length; i++)
                {
                    if (ch[i] < '0' || ch[i] > '9')
                    {
                        MessageBox.Show("年龄格式不正确,请重新输入!", "信息提示", MessageBoxButtons.OKCancel);
                        flag = false;
                        break;
                    }
                }
                if (flag && (int.Parse(txAge.Text) > 0 && int.Parse(txAge.Text) < 200))
                {
                    newpatient.Age       = int.Parse(txAge.Text);
                    newpatient.Phone     = txTell.Text;
                    newpatient.Situation = 0;

                    MessageBox.Show(pr.ReserveSubmit(newpatient), "信息提示", MessageBoxButtons.OKCancel);
                    txIDNum.Text   = null;
                    txName.Text    = null;
                    rdBtnF.Checked = false;
                    rdBtnM.Checked = false;
                    txAge.Text     = null;
                    txTell.Text    = null;
                }
                else
                {
                    MessageBox.Show("年龄大小不正确,请重新输入!", "信息提示", MessageBoxButtons.OKCancel);
                }
            }
        }
        /// <summary>
        /// 查询入院表里是否有此人几录,若有,返回state状态,若为0,为已提交申请但还未通过,1,已通过,2未通过
        /// </summary>
        /// <param name="bh"></param>
        /// <returns></returns>
        public string ReserveSubmit(BeingHospitalized bh)
        {
            Sqlhelper sqlhelper = new Sqlhelper();
            DataTable datatable = new DataTable();

            datatable = sqlhelper.Exesql("SELECT * from BeingHospitalized WHERE  IDNumber = '" + bh.IDNumber + "' ");
            if (datatable.Rows.Count > 0)
            {
                int    state   = int.Parse(datatable.Rows[0]["State"].ToString());
                string resualt = "";
                switch (state)
                {
                case 0:
                    resualt = "申请已提交,请等待审查;";
                    break;

                case 1:
                    resualt = "申请已通过,请去住院部领取办理相应手续";
                    break;

                case 2:
                    resualt = "申请未通过,请去住院部查问";
                    break;
                }
                return(resualt);
            }
            else
            {
                string resualt;
                int    state = sqlhelper.ExecuteNonQuery("INSERT INTO BeingHospitalized( IDNumber,Name,Sex,Age,Phone) VAlUES('" + bh.IDNumber + "', '" + bh.Name + "','" + bh.Sex + "','" + bh.Age + "','" + bh.Phone + "') ");
                if (state > 0)
                {
                    resualt = "申请已提交";
                    return(resualt);
                }
                else
                {
                    resualt = "提交失败,请重新提交";
                    return(resualt);
                }
            }
        }