Example #1
0
 private bool CheckPatientTabData(Model.Patient_Tab patient_tab, out string msg)
 {
     msg = "";
     if (patient_tab == null)
     {
         msg = "用户诊断信息为空";
         return(false);
     }
     else if (patient_tab.Chufang_count <= 0)
     {
         msg = "处方记数出错!";
         return(false);
     }
     else if ("".Equals(patient_tab.Xianbingshi) || patient_tab.Xianbingshi == null)
     {
         msg = "未填入病人病史";
         return(false);
     }
     else if ("".Equals(patient_tab.Zhengduan) || patient_tab.Zhengduan == null)
     {
         msg = "未填入病人诊断信息";
         return(false);
     }
     return(true);
 }
Example #2
0
 private void baocun_btn_Click(object sender, EventArgs e)
 {
     //将输入的信息封装成类对象,传入bll层
     Model.Patient patient = new Model.Patient();
     Model.Patient_Tab patient_tab = new Model.Patient_Tab();
     patient.P_name = tb_pname.Text.Trim();
     //年龄信息出错,提醒用户
     try
     {
         patient.Old = Convert.ToInt16(tb_old.Text.Trim());
     }
     catch (Exception exp)
     {
         MessageBoxBuilder.buildbox((exp.Message), "错误!");
         return;
     }
     patient.Tel = tb_tel.Text.Trim();
     patient.Idcard = tb_idcard.Text.Trim();
     patient.D_ID = UserHelper.id;
     //用与得到用户转入的病人照片信息
     if (FileName != null && !"".Equals(FileName))
     {
         if ((pictureBox1.Image != null))
         {
             pictureBox1.Image.Dispose();
             pictureBox1.Image = null;
         }
         patient.Thumb = Common.Util.GetImageByte(FileName);
     }
     if (rb_man.Checked)
     {
         patient.Gender = "男";
     }
     else if (rb_woman.Checked)
     {
         patient.Gender = "女";
     }
     else
     {
         patient.Gender = "不详";
     }
     patient_tab.Chufang_count = Convert.ToInt32(tb_jishu.Text.Trim());
     patient_tab.Xianbingshi = tb_bingshi.Text.Trim();
     patient_tab.Zhengduan = tb_zhenduan.Text.Trim();
     string msg = "";
     //添加处方信息与病人信息
     if (patientInstance.AddPatient(patient, patient_tab, out msg))
     {
         MessageBoxBuilder.buildbox("保存成功!", "ok");
         ShowPhoto();
     }
     else if (!"".Equals(msg))
     {
         MessageBoxBuilder.buildbox(msg,"错误");
     }
     else
     {
         MessageBoxBuilder.buildbox("未知错误!插入失败!","错误");
     }
 }
Example #3
0
        public bool AddPatient(Model.Patient patient, Model.Patient_Tab patient_tab, out string msg)
        {
            msg = "";
            if (!CheckPatientData(patient, out msg))
            {
                return(false);
            }
            int id = pa.AddPatientRetId(patient);

            if (id != -1)
            {
                patient_tab.Pid = id;
                if (!CheckPatientTabData(patient_tab, out msg))
                {
                    return(false);
                }
                if ((paT.AddPatientTab(patient_tab)))
                {
                    return(true);
                }
                else
                {
                    pa.DeletePatientById(id);
                    msg = "插入病人诊断信息失败!";
                    return(false);
                }
            }
            msg = "插入病人信息失败!";
            return(false);
        }
Example #4
0
        public bool AddPatientTab(Model.Patient_Tab pat_tab)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [patient_tab]");
            strSql.Append("(pid,xianbingshi,zhenduan,chufang_count) values");
            strSql.Append("(@pid,@xianbingshi,@zhenduan,@chufang_count)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@pid",           SqlDbType.Int),
                new SqlParameter("@xianbingshi",   SqlDbType.VarChar, 32),
                new SqlParameter("@zhenduan",      SqlDbType.VarChar, 32),
                new SqlParameter("@chufang_count", SqlDbType.Int)
            };
            parameters[0].Value = pat_tab.Pid;
            parameters[1].Value = pat_tab.Xianbingshi;
            parameters[2].Value = pat_tab.Zhengduan;
            parameters[3].Value = pat_tab.Chufang_count;
            int row = SqlDbHelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);

            if (row == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #5
0
        private void baocun_btn_Click(object sender, EventArgs e)
        {
            Model.Patient     patient     = new Model.Patient();
            Model.Patient_Tab patient_tab = new Model.Patient_Tab();
            patient.P_name = tb_pname.Text.Trim();
            try
            {
                patient.Old = Convert.ToInt16(tb_old.Text.Trim());
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
                return;
            }
            patient.Tel    = tb_tel.Text.Trim();
            patient.Idcard = tb_idcard.Text.Trim();
            patient.D_ID   = 10000;
            if (FileName != null && !"".Equals(FileName))
            {
                if ((pictureBox1.Image != null))
                {
                    pictureBox1.Image.Dispose();
                }
                patient.Thumb = Common.Util.GetImageByte(FileName);
            }
            if (rb_man.Checked)
            {
                patient.Gender = "男";
            }
            else if (rb_woman.Checked)
            {
                patient.Gender = "女";
            }
            else
            {
                patient.Gender = "不详";
            }
            patient_tab.Chufang_count = Convert.ToInt32(tb_jishu.Text.Trim());
            patient_tab.Xianbingshi   = tb_bingshi.Text.Trim();
            patient_tab.Zhengduan     = tb_zhenduan.Text.Trim();
            string msg = "";

            if (patientInstance.AddPatient(patient, patient_tab, out msg))
            {
                MessageBox.Show("保存成功!");
            }
            else if (!"".Equals(msg))
            {
                MessageBox.Show(msg);
            }
            else
            {
                MessageBox.Show("未知错误!插入失败!");
            }
        }
Example #6
0
        public bool AddPatient(Model.Patient patient, Model.Patient_Tab patient_tab, out string msg)
        {
            msg = "";
            bool isOK = false;

            if (!CheckPatientData(patient, out msg))
            {
                return(isOK);
            }
            using (TransactionScope tsCope = new TransactionScope())
            {
                try
                {
                    int id = pa.AddPatientRetId(patient);
                    if (id != -1)
                    {
                        patient_tab.Pid = id;
                        if (!CheckPatientTabData(patient_tab, out msg))
                        {
                            return(false);
                        }
                        if ((paT.AddPatientTab(patient_tab)))
                        {
                            isOK = true;
                        }
                    }
                }
                catch (Exception exp)
                {
                    msg = exp.Message;
                    return(false);
                }

                tsCope.Complete();
            }
            msg = "插入病人信息失败!";
            return(isOK);
        }
Example #7
0
        private void baocun_btn_Click(object sender, EventArgs e)
        {
            //将输入的信息封装成类对象,传入bll层
            Model.Patient     patient     = new Model.Patient();
            Model.Patient_Tab patient_tab = new Model.Patient_Tab();
            patient.P_name = tb_pname.Text.Trim();
            //年龄信息出错,提醒用户
            try
            {
                patient.Old = Convert.ToInt16(tb_old.Text.Trim());
            }
            catch (Exception exp)
            {
                MessageBoxBuilder.buildbox((exp.Message), "错误!");
                return;
            }
            patient.Tel    = tb_tel.Text.Trim();
            patient.Idcard = tb_idcard.Text.Trim();
            patient.D_ID   = UserHelper.id;
            //用与得到用户转入的病人照片信息
            if (FileName != null && !"".Equals(FileName))
            {
                if ((pictureBox1.Image != null))
                {
                    pictureBox1.Image.Dispose();
                    pictureBox1.Image = null;
                }
                patient.Thumb = Common.Util.GetImageByte(FileName);
            }
            if (rb_man.Checked)
            {
                patient.Gender = "男";
            }
            else if (rb_woman.Checked)
            {
                patient.Gender = "女";
            }
            else
            {
                patient.Gender = "不详";
            }
            patient_tab.Chufang_count = Convert.ToInt32(tb_jishu.Text.Trim());
            patient_tab.Xianbingshi   = tb_bingshi.Text.Trim();
            patient_tab.Zhengduan     = tb_zhenduan.Text.Trim();
            string msg = "";

            //添加处方信息与病人信息
            if (patientInstance.AddPatient(patient, patient_tab, out msg))
            {
                MessageBoxBuilder.buildbox("保存成功!", "ok");
                ShowPhoto();
            }
            else if (!"".Equals(msg))
            {
                MessageBoxBuilder.buildbox(msg, "错误");
            }
            else
            {
                MessageBoxBuilder.buildbox("未知错误!插入失败!", "错误");
            }
        }