Beispiel #1
0
        private void btnQuary_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtHospitalNumber.Text))
            {
                MessageBox.Show("住院号不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
            if (!SqlDeal.checkNumberExist(txtHospitalNumber.Text))
            {
                MessageBox.Show("住院号不存在", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                clearAllInput();
                clearOrder();
                return;
            }
            try
            {
                DataTable table = SqlDeal.getPatientByHospitalNumber(txtHospitalNumber.Text);

                txtName.Text           = table.Rows[0]["name"].ToString();
                txtHospitalNumber.Text = table.Rows[0]["hospitalnumber"].ToString();
                txtAge.Text            = table.Rows[0]["age"].ToString();
                cbSex.Text             = table.Rows[0]["sex"].ToString();
                txtCategory.Text       = table.Rows[0]["category"].ToString();
                txtBedNumber.Text      = table.Rows[0]["bednumber"].ToString();
                dateTimePicker1.Value  = Convert.ToDateTime(table.Rows[0]["time"].ToString());
                rtxtRemark.Text        = table.Rows[0]["remark"].ToString();
            }
            catch
            {
                MessageBox.Show("查询失败", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                clearAllInput();
                clearOrder();
            }
        }
Beispiel #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtName.Text))
     {
         MessageBox.Show("病人姓名不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         return;
     }
     if (string.IsNullOrEmpty(txtHospitalNumber.Text))
     {
         MessageBox.Show("住院号不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         return;
     }
     if (string.IsNullOrEmpty(txtBedNumber.Text))
     {
         MessageBox.Show("床号不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         return;
     }
     if (string.IsNullOrEmpty(txtCategory.Text))
     {
         MessageBox.Show("科别不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         return;
     }
     if (cbSex.SelectedIndex < 0)
     {
         MessageBox.Show("性别不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         return;
     }
     if (SqlDeal.checkNumberExist(txtHospitalNumber.Text))
     {
         MessageBox.Show("该住院号已存在,请更换", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         return;
     }
     patient = getPatient();
     try
     {
         SqlDeal.saveData(patient);
         Enable(btnAdd);
         disEnable(btnSave);
     }
     catch
     {
         MessageBox.Show("保存失败", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
     }
 }
Beispiel #3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (btnStart.Text == "开  始(S)")
            {
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    MessageBox.Show("病人姓名不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrEmpty(txtHospitalNumber.Text))
                {
                    MessageBox.Show("住院号不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrEmpty(txtBedNumber.Text))
                {
                    MessageBox.Show("床号不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrEmpty(txtCategory.Text))
                {
                    MessageBox.Show("科别不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }
                if (cbSex.SelectedIndex < 0)
                {
                    MessageBox.Show("性别不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }
                if (!SqlDeal.checkNumberExist(txtHospitalNumber.Text))
                {
                    MessageBox.Show("该住院号不存在,请更换", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }
                dateTimePicker1.Value = DateTime.Now;
                if (SqlDeal.ifChecked(txtHospitalNumber.Text))
                {
                    if (MessageBox.Show("该病人已检测过,继续检测将覆盖原有数据,是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
                    {
                        return;
                    }
                }
                string com = "";
                try
                {
                    com = OperatorFile.GetIniFileString("patientCheck", "port", "", Application.StartupPath + "\\setting.ini");
                    if (!serialPort1.IsOpen)
                    {
                        serialPort1.PortName = com;
                        serialPort1.Open();
                    }
                }
                catch
                {
                    MessageBox.Show(com + "串口打开失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    if (serialPort1.IsOpen)
                    {
                        serialPort1.Close();
                    }
                    return;
                }

                btnStart.Text = "暂  停(P)";
                if (serialPort1.IsOpen)
                {
                    //发送获取数据指令
                    sendTo();
                }
                else
                {
                    serialPort1.Open();
                    sendTo();
                }

                receiveData.Clear();
                WorkStatus = 1;
            }
            else if (btnStart.Text == "暂  停(P)")
            {
                btnStart.Text = "继  续(C)";
                WorkStatus    = 3;
            }
            else if (btnStart.Text == "继  续(C)")
            {
                btnStart.Text = "暂  停(P)";
                WorkStatus    = 1;
            }
        }