Ejemplo n.º 1
0
        private void butok_Click(object sender, EventArgs e)
        {
            try
            {
                int    htdwlx   = Convert.ToInt32(Convertor.IsNull(cmbhtdwlx.SelectedValue, "0"));
                int    htdwid   = Convert.ToInt32(Convertor.IsNull(txthtdwmc.Tag, "0"));
                int    err_code = -1;
                string err_text = "";
                ts_mz_class.mz_ghxx.UpdateHtdw(_ghxxid, htdwlx, htdwid, out err_code, out err_text, InstanceForm.BDatabase);
                if (err_code != 0)
                {
                    throw new Exception(err_text);
                }

                MessageBox.Show("修改成功", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                string str_old = "";
                str_old = "原合同单位信息:" + old_htdwlx.Trim() + " " + old_htdwmc.ToString() + "   修改后为:" + cmbhtdwlx.Text + "  " + txthtdwmc.Text;
                SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "修改合同单位", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 2);
                systemLog.Save();
                systemLog = null;

                this.Close();
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void menuItem4_Click(object sender, System.EventArgs e)
        {
            string msg = "";

            msg = MessageBox.Show(this, "删除数据将无法恢复,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
            if (msg.ToUpper() == "NO")
            {
                return;
            }

            if (InstanceForm.BCurrentUser.Name.Trim() != jbjlTb.Rows[myDataGrid1.CurrentRowIndex]["book_user"].ToString().Trim())
            {
                MessageBox.Show(this, "不是你录入的记录,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            sqlStr = "delete from zy_wardjbjl_brdt where jb_id=" + Convert.ToInt32(jbjlTb.Rows[myDataGrid1.CurrentRowIndex]["id"].ToString());
            InstanceForm.BDatabase.DoCommand(sqlStr);
            sqlStr = "delete from zy_wardjbjl where id=" + Convert.ToInt32(jbjlTb.Rows[myDataGrid1.CurrentRowIndex]["id"].ToString());
            InstanceForm.BDatabase.DoCommand(sqlStr);

            //写日志 Add By Tany 2005-01-12
            SystemLog _systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "删除交班记录", "记录号" + jbjlTb.Rows[myDataGrid1.CurrentRowIndex]["id"].ToString(), DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);

            _systemLog.Save();
            _systemLog = null;

            Show_Date();
        }
Ejemplo n.º 3
0
        private void btnDelPwd_Click(object sender, System.EventArgs e)
        {
            if (MessageBox.Show("确定要清除该用户的密码吗?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //定义多院操作日志 Modify By Tany 2010-01-24
                ts_HospData_Share.ts_update_log ts = new ts_HospData_Share.ts_update_log();
                Guid log_djid = Guid.Empty;

                db.BeginTransaction();
                try
                {
                    string sql = "update pub_user set [password]='' where id=" + cmbCode.SelectedValue.ToString() + " and employee_id=" + employee.EmployeeId + " and code = '" + this.cmbCode.Text + "'";
                    db.DoCommand(sql);

                    //处理多院数据处理,首先插入操作日志 Modify By Tany 2010-01-24
                    string cznr = "清空用户密码:【" + txtName.Text.Trim() + "】";
                    ts.Save_log(ts_HospData_Share.czlx.jc_用户修改, cznr, "pub_user", "id", cmbCode.SelectedValue.ToString(), jgbm, -999, "", out log_djid, db);

                    db.CommitTransaction();
                }
                catch (Exception err)
                {
                    db.RollbackTransaction();
                    MessageBox.Show("清空用户密码:" + err.Message);
                    return;
                }

                try
                {
                    //查看该类型操作是否属于立即执行 Modify By Tany 2010-01-21
                    string errtext = "";
                    ts_HospData_Share.ts_update_type ty = new ts_HospData_Share.ts_update_type((int)ts_HospData_Share.czlx.jc_用户修改, db);
                    if (ty.Bzx == 1 && log_djid != Guid.Empty)
                    {
                        //立即执行该操作 Modify By Tany 2010-01-21
                        ts.Pexec_log(log_djid, db, out errtext);
                    }
                    if (errtext != "")
                    {
                        throw new Exception(errtext);
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show("发生错误:" + err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                //写入日志 Add By Tany 2012-02-02
                SystemLog systemLog = new SystemLog(-1, FrmMdiMain.CurrentDept.DeptId, FrmMdiMain.CurrentUser.EmployeeId, "清空用户密码", FrmMdiMain.CurrentUser.Name + " 清空【" + employee.Name + "(EmployeeId:" + employee.EmployeeId + ")】密码", DateManager.ServerDateTimeByDBType(FrmMdiMain.Database), 0, "主机名:" + System.Environment.MachineName, (int)SystemModule.系统公共参数);
                systemLog.Save();
                systemLog = null;

                MessageBox.Show("密码已经清除,请及时通知该用户修改密码");
            }
        }
Ejemplo n.º 4
0
        public static void DeleteDj(Guid id, RelationalDatabase _DataBase)
        {
            string ssql = "delete from YF_RKSQMX  where djid='" + id + "'";

            _DataBase.DoCommand(ssql);

            ssql = "delete from YF_RKSQ  where id='" + id + "'  and shbz=0";
            int nrow = (int)_DataBase.DoCommand(ssql);

            if (nrow != 1)
            {
                throw new System.Exception("错误,数据影响了多行或零行,请和管理员联系");
            }

            SystemLog systemLog = new SystemLog(-1, TrasenFrame.Forms.FrmMdiMain.CurrentDept.DeptId,
                                                TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId, "删除药房申请单据", "删除药房申请单据 YF_RKSQ.ID='" + id.ToString() + "'",
                                                DateManager.ServerDateTimeByDBType(_DataBase), 0, "主机名:" + System.Environment.MachineName, 8);

            systemLog.Save();
            systemLog = null;
        }
Ejemplo n.º 5
0
        private DataTable DoGetScanBit(string inpatNo, long _baby_id, long WardDeptId, DateTime strDate, DateTime endDate)
        {
            DataTable rtnTb = new DataTable();
            string    sSql  = "";

            ParameterEx[] parameters = new ParameterEx[5];

            try
            {
                sSql = "SP_ZYHS_Pivas_SELECTFEE";

                parameters[0].Value = inpatNo;
                parameters[0].Text  = "@BINID";
                parameters[1].Value = _baby_id;
                parameters[1].Text  = "@BABYID";
                parameters[2].Value = WardDeptId;
                parameters[2].Text  = "@WARDDEPTID";

                parameters[3].Value = strDate;
                parameters[3].Text  = "@strDate";
                parameters[4].Value = endDate;
                parameters[4].Text  = "@endDate";


                rtnTb = FrmMdiMain.Database.GetDataTable(sSql, parameters, 60);

                return(rtnTb);
            }
            catch (Exception err)
            {
                //写错误日志 Add By Tany 2005-01-12
                SystemLog _systemErrLog = new SystemLog(-1, FrmMdiMain.CurrentDept.DeptId, FrmMdiMain.CurrentUser.EmployeeId, "程序错误", "SP_ZYHS_Pivas_SELECTFEE错误:" + err.Message + "  Source:" + err.Source, DateManager.ServerDateTimeByDBType(FrmMdiMain.Database), 1, "主机名:" + System.Environment.MachineName, 39);
                _systemErrLog.Save();
                _systemErrLog = null;

                MessageBox.Show("错误:" + err.Message + "\n" + "Source:" + err.Source, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(rtnTb);
            }
        }
Ejemplo n.º 6
0
        private void butsave_Click(object sender, System.EventArgs e)
        {
            if (MessageBox.Show(this, "您 [确定] 要保存参数设置吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            try
            {
                string str_old = "修改[" + cmbyjks.Text.Trim() + "]参数 ";
                InstanceForm.BDatabase.BeginTransaction();
                DataTable tb = (DataTable)this.myDataGrid1.DataSource;
                for (int i = 0; i <= tb.Rows.Count - 1; i++)
                {
                    int    _values = Convert.ToInt32(Convertor.IsNull(tb.Rows[i]["参数值"], "0"));
                    string _code   = Convertor.IsNull(tb.Rows[i]["参数编码"], "0");
                    string ssql    = "update yk_config set zt=" + _values + " where bh='" + _code + "' and deptid=" + Convertor.IsNull(cmbyjks.SelectedValue, "0") + "";
                    InstanceForm.BDatabase.DoCommand(ssql);

                    str_old = str_old + _code.ToString() + ":" + _values.ToString() + "|";
                }

                SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "修改药品参数", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 8);
                systemLog.Save();
                systemLog = null;

                Yp.InsertLog("修改药品参数", TrasenFrame.Forms.FrmMdiMain.CurrentDept.DeptId, 0, TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString(), str_old, InstanceForm.BDatabase);


                InstanceForm.BDatabase.CommitTransaction();

                MessageBox.Show("保存成功");
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show(err.Message);
            }
        }
Ejemplo n.º 7
0
        //删除模板头
        public static void Delete_Mb(Guid mbid, RelationalDatabase _DataBase)
        {
            string ssql = "update JC_CFMB set bscbz=1 where mbxh='" + mbid + "' and bscbz=0 ";
            int    i    = _DataBase.DoCommand(ssql);

            if (i == 0)
            {
                throw new Exception("删除模板时出错,可能该模板已删除,请刷新后重试");
            }

            Guid log_djid = Guid.Empty;

            ts_HospData_Share.ts_update_log ts = new ts_HospData_Share.ts_update_log();
            string _bz = "删除模板: mbid='" + mbid + "'";

            ts.Save_log(ts_HospData_Share.czlx.jc_处方模板, _bz, "jc_cfmb", "mbxh", mbid.ToString(), TrasenFrame.Forms.FrmMdiMain.Jgbm, 0, -999, "", out log_djid, _DataBase);


            SystemLog systemLog = new SystemLog(-1, TrasenFrame.Forms.FrmMdiMain.CurrentDept.DeptId, TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId, "删除模板", "删除模板 mbid=" + mbid.ToString() + "", DateManager.ServerDateTimeByDBType(_DataBase), 0, "主机名:" + System.Environment.MachineName, 3);
            bool      bok       = systemLog.Save();

            systemLog = null;
        }
Ejemplo n.º 8
0
        private void menuItem1_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (MessageBox.Show(this, "记录删除将不能恢复,确认删除这条记录吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }

                string strSql = @"delete from ZY_HLJLMODEL where id=" + dgShow[dgShow.CurrentCell.RowNumber, 0].ToString();

                InstanceForm.BDatabase.DoCommand(strSql);

                //写日志 Add By Tany 2005-06-21
                SystemLog _systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "删除护理记录模板", "将 " + dgShow[dgShow.CurrentCell.RowNumber, 0].ToString() + " 号护理记录模板删除", DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);
                _systemLog.Save();
                _systemLog = null;

                MessageBox.Show(this, "删除成功!", "保存", MessageBoxButtons.OK, MessageBoxIcon.Information);

                strSql = @"select id,name 名称,model_text 内容,py 拼音码,wb 五笔码,case model_type when 0 then '全院共用' when 1 then '病区使用' when 2 then '科室使用' " +
                         @"when 3 then '个人使用' end 类型 from ZY_HLJLMODEL where mng_type in (0,1) and " +
                         @"((model_type=0) or (model_type=1 and ward_id='" + InstanceForm.BCurrentDept.WardId + "')" +
                         @" or (model_type=2 and dept_id=" + InstanceForm.BCurrentDept.DeptId + ")" +
                         @" or (model_type=3 and user_id=" + InstanceForm.BCurrentUser.EmployeeId + "))";
                InitGrid(strSql);
            }
            catch (Exception err)
            {
                //写错误日志 Add By Tany 2005-01-12
                SystemLog _systemErrLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "程序错误", "保存一般患者护理记录错误:" + err.Message + "  Source:" + err.Source, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);
                _systemErrLog.Save();
                _systemErrLog = null;

                MessageBox.Show("错误:" + err.Message + "\n" + "Source:" + err.Source, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 9
0
        private void bt修改_Click(object sender, System.EventArgs e)
        {
            DataTable myTb     = (DataTable)this.myDataGrid1.DataSource;
            string    sBaby_ID = myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["BABY_ID"].ToString().Trim();

            //Modify By Tany 2004-12-13
            //			if (ClassStatic.Static_EmployeeID!=myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["BOOK_OPER"].ToString().Trim())
            //			{
            //				MessageBox.Show(this,"对不起,您没有修改该条记录的权利!", "错误", MessageBoxButtons.OK,MessageBoxIcon.Error);
            //				return;
            //			}

            if (this.textBox1.Text.Trim() == "")
            {
                MessageBox.Show(this, "对不起,请输入婴儿姓名!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textBox1.Focus();
                return;
            }
            //add by zouchihua 2012-10-1 必须选择性别
            if (comboBox1.Text.Trim() == "")
            {
                MessageBox.Show(this, "对不起,请你选择分娩婴儿的性别", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.comboBox1.Focus();
                return;
            }
            if (this.textBox1.Text.Trim() == sName)
            {
                MessageBox.Show(this, "对不起,婴儿姓名不允许和母亲的姓名相同!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textBox1.Focus();
                return;
            }

            string sMsg        = "";
            string OperContens = "将" + sName + "的婴儿“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["姓名"].ToString().Trim() + "”";

            if (this.dateTimePicker1.Value.ToString() != myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["出生日期"].ToString().Trim())
            {
                sMsg         = "“出生日期”由“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["出生日期"].ToString().Trim() + "”改为“" + this.dateTimePicker1.Value.ToString() + "”";
                OperContens += "“出生日期”由“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["出生日期"].ToString().Trim() + "”改为“" + this.dateTimePicker1.Value.ToString() + "”";
            }
            if (this.comboBox1.Text.Trim() != myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["性别"].ToString().Trim())
            {
                sMsg        += sMsg == "" ? "" : "、";
                sMsg        += "“性别”由“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["性别"].ToString().Trim() + "”改为“" + this.comboBox1.Text.Trim() + "”";
                OperContens += "“性别”由“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["性别"].ToString().Trim() + "”改为“" + this.comboBox1.Text.Trim() + "”";
            }
            if (this.textBox1.Text.Trim() != myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["姓名"].ToString().Trim())
            {
                sMsg        += sMsg == "" ? "" : "、";
                sMsg        += "“姓名”由“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["姓名"].ToString().Trim() + "”改为“" + this.textBox1.Text.Trim() + "”";
                OperContens += "“姓名”由“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["姓名"].ToString().Trim() + "”改为“" + this.textBox1.Text.Trim() + "”";
            }

            if (sMsg == "")
            {
                return;
            }
            if (MessageBox.Show(this, "确认" + sMsg + "吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            //修改
            string _outmsg = myFunc.ChildBearing("", 3, 1, ClassStatic.Current_BinID, Convert.ToInt16(myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["BABY_ID"]), this.comboBox1.Text.Trim(), this.textBox1.Text.Trim(), FrmMdiMain.CurrentUser.EmployeeId, this.dateTimePicker1.Value, FrmMdiMain.Jgbm);

            if (_outmsg.Trim() != "")
            {
                MessageBox.Show(_outmsg);
            }

            //写日志 Add By Tany 2005-01-12
            SystemLog _systemLog = new SystemLog(-1, FrmMdiMain.CurrentDept.DeptId, FrmMdiMain.CurrentUser.EmployeeId, "修改婴儿信息", OperContens, DateManager.ServerDateTimeByDBType(FrmMdiMain.Database), 1, "主机名:" + System.Environment.MachineName, 39);

            _systemLog.Save();
            _systemLog = null;

            this.Show_Date();
        }
Ejemplo n.º 10
0
        private void bt删除_Click(object sender, System.EventArgs e)
        {
            DataTable myTb     = (DataTable)this.myDataGrid1.DataSource;
            string    sBaby_ID = myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["BABY_ID"].ToString().Trim();

            //Modify By Tany 2004-12-13
            //			if (ClassStatic.Static_EmployeeID!=myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["BOOK_OPER"].ToString().Trim())
            //			{
            //				MessageBox.Show(this,"对不起,您没有删除该条记录的权利!", "错误", MessageBoxButtons.OK,MessageBoxIcon.Error);
            //				return;
            //			}

            //是否有医嘱、是否转过科
            string sSql = "select * from ( " +
                          " Select Order_ID,0 id1,dbo.fun_getemptyguid() id2 from zy_orderrecord a" +
                          "  where status_flag<>5 and delete_bit=0 and a.INPATIENT_ID='" + ClassStatic.Current_BinID + "' and a.Baby_ID=" + Convert.ToInt32(sBaby_ID) +
                          //				        " union "+
                          //						" Select 0,ID,0 from zy_fee_speci b"+
                          //				        "  where b.INPATIENT_ID="+ClassStatic.Current_BinID+ " and b.Baby_ID="+ Convert.ToInt32(sBaby_ID) +
                          " union " +
                          " Select Order_ID,0,c.id from ZY_TRANSFER_dept c" +
                          "   where c.INPATIENT_ID='" + ClassStatic.Current_BinID + "' and c.Baby_ID=" + Convert.ToInt32(sBaby_ID) +
                          " ) tmp ";
            DataTable tempTb1 = FrmMdiMain.Database.GetDataTable(sSql);

            if (tempTb1.Rows.Count > 0)
            {
                MessageBox.Show(this, "对不起,该婴儿有未停的医嘱或转科记录,不允许删除!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //是否有费用 单独统计 Add By Tany 2005-03-14
            sSql = "Select sum(acvalue) from ZY_FEE_SPECI" +
                   " where delete_bit=0 and charge_bit=1 and INPATIENT_ID='" + ClassStatic.Current_BinID + "' and Baby_ID=" + Convert.ToInt32(sBaby_ID);
            string fee = Convertor.IsNull(FrmMdiMain.Database.GetDataResult(sSql), "");

            if (fee != "0" && fee != "")
            {
                MessageBox.Show(this, "对不起,该婴儿总费用不为0,不允许删除!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (MessageBox.Show(this, "确认删除“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["姓名"].ToString().Trim() + "”的记录吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            //删除婴儿记录,减少母亲的母婴同室
            string _outmsg = myFunc.ChildBearing("", 2, 1, ClassStatic.Current_BinID, Convert.ToInt16(sBaby_ID), "", "", FrmMdiMain.CurrentUser.EmployeeId, this.dateTimePicker1.Value, FrmMdiMain.Jgbm);

            if (_outmsg.Trim() != "")
            {
                MessageBox.Show(_outmsg);
            }

            //写日志 Add By Tany 2005-01-12
            SystemLog _systemLog = new SystemLog(-1, FrmMdiMain.CurrentDept.DeptId, FrmMdiMain.CurrentUser.EmployeeId, "删除婴儿", "删除" + sName + "的婴儿“" + myTb.Rows[this.myDataGrid1.CurrentCell.RowNumber]["姓名"].ToString().Trim() + "”的记录", DateManager.ServerDateTimeByDBType(FrmMdiMain.Database), 1, "主机名:" + System.Environment.MachineName, 39);

            _systemLog.Save();
            _systemLog = null;

            this.Show_Date();
        }
Ejemplo n.º 11
0
        private void bt分娩_Click(object sender, System.EventArgs e)
        {
            int current_no = 0;

            int CWF = cbCWF.Checked ? 0 : 1;

            if (cfg7205.Config == "0")
            {
                if (this.textBox1.Text.Trim() == "")
                {
                    MessageBox.Show(this, "对不起,请输入婴儿姓名!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox1.Focus();
                    return;
                }

                if (this.textBox1.Text.Trim() == sName)
                {
                    MessageBox.Show(this, "对不起,婴儿姓名不允许和母亲的姓名相同!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox1.Focus();
                    return;
                }

                if (this.current_row != -1)
                {
                    if (MessageBox.Show(this, sName + "已经分娩过,确认还分娩吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return;
                    }
                    string    sSql   = "Select max(baby_no)  as max_no from zy_inpatient_baby where inpatient_id='" + ClassStatic.Current_BinID + "'";
                    DataTable tempTb = FrmMdiMain.Database.GetDataTable(sSql);
                    current_no = Convert.ToInt16(tempTb.Rows[0]["max_no"]);

                    sSql = "Select babyname from zy_inpatient_baby where inpatient_id='" + ClassStatic.Current_BinID + "' and rtrim(babyname)='" + this.textBox1.Text.Trim() + "'";
                    DataTable tempTb1 = FrmMdiMain.Database.GetDataTable(sSql);
                    if (tempTb1.Rows.Count > 0)
                    {
                        MessageBox.Show(this, "对不起," + sName + "已经分娩过名叫“" + this.textBox1.Text.Trim() + "”的婴儿,请输入婴儿姓名!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.textBox1.Focus();
                        return;
                    }
                    //add by zouchihua 2012-10-1 必须选择性别
                    if (comboBox1.Text.Trim() == "")
                    {
                        MessageBox.Show(this, "对不起,请你选择分娩婴儿的性别", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.comboBox1.Focus();
                        return;
                    }
                    //string xx = "姓名:【" + textBox1.Text.Trim() + " 】";
                    // xx += "\r性别:【" + comboBox1.Text.Trim() + " 】";
                    //if (MessageBox.Show(this, sName + "确认分娩吗?\r分娩婴儿信息如下:\r" + xx, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    //    return;
                }
                else
                {
                    //add by zouchihua 2012-10-1 必须选择性别
                    if (comboBox1.Text.Trim() == "")
                    {
                        MessageBox.Show(this, "对不起,请你选择分娩婴儿的性别", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.comboBox1.Focus();
                        return;
                    }
                    string xx = "姓名:【" + textBox1.Text.Trim() + " 】";
                    xx += "\r性别:【" + comboBox1.Text.Trim() + " 】";
                    if (MessageBox.Show(this, sName + "确认分娩吗?\r分娩婴儿信息如下:\r" + xx, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return;
                    }
                }
                current_no += 1;
            }
            else
            {
                string    sSql    = "Select babyname from zy_inpatient_baby where inpatient_id='" + ClassStatic.Current_BinID + "' and rtrim(babyname)='" + this.textBox1.Text.Trim() + "'";
                DataTable tempTb1 = FrmMdiMain.Database.GetDataTable(sSql);
                if (tempTb1.Rows.Count > 0)
                {
                    MessageBox.Show(this, "对不起," + sName + "已经存在该附加名称!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            //分娩
            string _outmsg = myFunc.ChildBearing("", 1, CWF, ClassStatic.Current_BinID, current_no, this.comboBox1.Text.Trim(), this.textBox1.Text.Trim(), FrmMdiMain.CurrentUser.EmployeeId, this.dateTimePicker1.Value, FrmMdiMain.Jgbm);

            if (_outmsg.Trim() != "")
            {
                MessageBox.Show(_outmsg);
            }

            //写日志 Add By Tany 2005-01-12
            SystemLog _systemLog = new SystemLog(-1, FrmMdiMain.CurrentDept.DeptId, FrmMdiMain.CurrentUser.EmployeeId, "分娩", sName + "分娩名叫“" + this.textBox1.Text.Trim() + "”的婴儿", DateManager.ServerDateTimeByDBType(FrmMdiMain.Database), 1, "主机名:" + System.Environment.MachineName, 39);

            _systemLog.Save();
            _systemLog = null;

            this.Show_Date();
        }
Ejemplo n.º 12
0
        private void btOK_Click(object sender, System.EventArgs e)
        {
            string sSql = "", sMsg = "";

            new_bed_no = cmbNewBed.Text.Trim();          //.Substring(0,1)=="加"?cmbNewBed.Text.Trim().Substring(1):cmbNewBed.Text.Trim();
            sSql       = "select bed_id,INPATIENT_ID,isbf,dept_id,room_no from ZY_BEDDICTION where WARD_ID='" + InstanceForm.BCurrentDept.WardId + "' and bed_no='" + new_bed_no + "' and isinuse=0";
            DataTable new_tempTab = InstanceForm.BDatabase.GetDataTable(sSql);

            if (new_tempTab.Rows[0]["INPATIENT_ID"].ToString().Trim() != "")
            {
                MessageBox.Show(this, "对不起,目标床位不是空床!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Convert.ToInt16(new_tempTab.Rows[0]["isbf"].ToString()) == 1)
            {
                MessageBox.Show(this, "对不起,目标床位被包!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            new_bed_id  = new Guid(new_tempTab.Rows[0]["bed_id"].ToString());
            new_dept_id = Convert.ToInt64(new_tempTab.Rows[0]["dept_id"]);

            //性别判断
            sSql = @"select * from zy_BedDiction " +
                   " where ward_id='" + InstanceForm.BCurrentDept.WardId + "'" +
                   "   and room_no='" + new_tempTab.Rows[0]["room_no"].ToString().Trim() + "'" +
                   "   and inpatient_id is not null " +
                   "   and bedsex!='" + old_bed_sex + "'";
            DataTable tempTab = InstanceForm.BDatabase.GetDataTable(sSql);

            if (tempTab.Rows.Count > 0)
            {
                sMsg = "目标房间住有异性病人,";
            }

            if (new_dept_id != old_dept_id)
            {
                //if ( MessageBox.Show(this, "两个床位的所属科室不相同,"+sMsg+"是否确认转床?","转床", MessageBoxButtons.YesNo,MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)==DialogResult.No) return ;
                //Modify By Tany 2016-11-21 不允许跨科室转床
                MessageBox.Show(this, "目标床位属于【" + new Department(new_dept_id, InstanceForm.BDatabase).DeptName.Trim() + "】,当前病人属于【" + new Department(old_dept_id, InstanceForm.BDatabase).DeptName.Trim() + "】\r\n两个床位的所属科室不相同,不允许操作!", "转床", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            else
            {
                if (MessageBox.Show(this, sMsg + "是否确认将 [" + old_bed_no + "床] 病人转到 [" + new_bed_no + "床] ?", "转床", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
            }

            string _outmsg = myFunc.ChangeBed("", 1, old_bed_id, new_bed_id, InstanceForm.BCurrentUser.EmployeeId, FrmMdiMain.Jgbm);

            if (_outmsg.Trim() != "")
            {
                MessageBox.Show(_outmsg);
            }

            //写日志 Add By Tany 2005-01-12
            SystemLog _systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "转床", _outmsg + "把病人 " + ClassStatic.Current_BinID + " 从" + old_bed_id.ToString() + "床位代码转到" + new_bed_id.ToString() + "床位代码", DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);

            _systemLog.Save();
            _systemLog = null;

//			MessageBox.Show("转床成功,请重新确认病人的床位费!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

            this.Close();
        }
Ejemplo n.º 13
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            DataTable tb   = (DataTable)this.myDataGrid1.DataSource;
            int       nrow = Convert.ToInt32(this.myDataGrid1.CurrentCell.RowNumber);

            if (nrow > tb.Rows.Count - 1)
            {
                return;
            }
            if (MessageBox.Show("您确定要删除第" + Convert.ToString((nrow + 1)) + "行这个单据吗 ?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            this.button1.Enabled = false;

            string    err_text = "";
            int       wldw     = 0;
            string    ssql     = "select * from yf_rksq where id='" + tb.Rows[nrow]["id"].ToString() + "'";
            DataTable tbdj     = InstanceForm.BDatabase.GetDataTable(ssql);

            if (tbdj.Rows.Count > 0)
            {
                wldw = Convert.ToInt32(tbdj.Rows[0]["wldw"]);
            }


            //删除目标服务器的申领单
            DataTable tbyjks = Yp.SelectYjks(wldw, InstanceForm.BDatabase);

            TrasenClasses.DatabaseAccess.RelationalDatabase mbdb = null;
            if (Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]) != InstanceForm._menuTag.Jgbm)
            {
                mbdb = TrasenFrame.Classes.WorkStaticFun.GetJgbmDb(Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]));
                ssql = "select * from yf_rksq where id='" + tb.Rows[nrow]["id"].ToString() + "' and shbz=1";
                DataTable mbtb = mbdb.GetDataTable(ssql);
                if (mbtb.Rows.Count > 0)
                {
                    MessageBox.Show("", "该单据已审核,不能删除", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.button1.Enabled = true;
                    return;
                }
            }



            try
            {
                InstanceForm.BDatabase.BeginTransaction();


                YF_RKSQ_RKSQMX.DeleteDj(new Guid(tb.Rows[nrow]["id"].ToString()), InstanceForm.BDatabase);

                if (tbyjks.Rows.Count > 0)
                {
                    if (Convert.ToInt32(tbyjks.Rows[0]["QYBZ"]) == 1 && Convert.ToInt32(tbyjks.Rows[0]["deptid"]) != Convert.ToInt32(InstanceForm.BCurrentDept.DeptId))
                    {
                        if (Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]) != InstanceForm._menuTag.Jgbm && mbdb != null)
                        {
                            //Guid log_djid = Guid.Empty;
                            //ts_HospData_Share.ts_update_log ts = new ts_HospData_Share.ts_update_log();
                            //bool shbz = ts_HospData_Share.yp_lysq.GetShzt(new Guid(tb.Rows[nrow]["id"].ToString()), Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]), out err_text);
                            //if (shbz == true) throw new Exception(err_text);
                            //string bz = InstanceForm.BCurrentDept.DeptName.Trim() + " 删除申领单 ";
                            //ts.Save_log(ts_HospData_Share.czlx.yp_药房申请领药单, bz, "YF_RKSQ", "ID", tb.Rows[nrow]["id"].ToString(), InstanceForm._menuTag.Jgbm, Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]), 0, "", out log_djid, InstanceForm.BDatabase);
                            YF_RKSQ_RKSQMX.DeleteDj(new Guid(tb.Rows[nrow]["id"].ToString()), mbdb);
                        }
                    }
                }



                string    str_old   = InstanceForm.BCurrentUser.Name + "删除" + InstanceForm.BCurrentDept.DeptName + "药品申请单.单据主键:" + tb.Rows[nrow]["id"].ToString();
                SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "删除单据", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 8);
                systemLog.Save();
                systemLog = null;

                //提交事务
                InstanceForm.BDatabase.CommitTransaction();

                this.button1.Enabled = true;
                MessageBox.Show("删除成功");
                this.butref_Click(sender, e);
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                this.button1.Enabled = true;
                MessageBox.Show(err.Message);
            }
        }
Ejemplo n.º 14
0
        private void bt确认_Click(object sender, System.EventArgs e)
        {
            DataTable myTb = (DataTable)this.myDataGrid1.DataSource;

            //			if(!myOldTb.Equals(myTb))
            //			{
            //				MessageBox.Show("网格已经更新,请重新确认!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            //				return;
            //			}

            int    nrow = this.myDataGrid1.CurrentCell.RowNumber;
            string sSql = "";

            if (MessageBox.Show(this, "确认该项目不执行了吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            //Modify By Tany 2010-06-08 是否使用密码确认 0=使用 1=不使用
            if (new SystemCfg(7066).Config == "0")
            {
                frmInPassword f1 = new frmInPassword();
                f1.ShowDialog();
                if (f1.isLogin == false)
                {
                    return;
                }
                f1.Close();
            }

            InstanceForm.BDatabase.BeginTransaction();

            try
            {
                string _lisGroup = "-1";
                switch (Convert.ToInt16(myTb.Rows[nrow]["xh"]))
                {
                case 1:     //未安排 安排表cancel
                    //看看是否有lis组合
                    //sSql="select lis_group from yj_applyrecord "+
                    //    "  where id="+myTb.Rows[nrow]["id"].ToString()+" and isarrange=0";
                    //_lisGroup=InstanceForm.BDatabase.GetDataResult(sSql).ToString().Trim();
                    //if(_lisGroup!="-1" && _lisGroup!="")
                    //{
                    //    sSql="update yj_applyrecord set lis_group=-1 where lis_group="+_lisGroup;
                    //    InstanceForm.BDatabase.DoCommand(sSql);
                    //}
                    sSql = "update YJ_ZYSQ " +
                           "    set bscbz=1,scsj=getdate() ,scr=" + InstanceForm.BCurrentUser.EmployeeId +
                           "  where yjsqid='" + myTb.Rows[nrow]["id"].ToString() + "' and bjsbz=0";
                    if (InstanceForm.BDatabase.DoCommand(sSql) == 0)
                    {
                        throw new Exception("未找到需要更新的记录,请重新确认!");
                    }

                    sSql = "update zy_fee_speci " +
                           "    set delete_bit=  " +
                           "  (select 1 from zy_fee_speci a,VI_jc_ITEMS b " +
                           "   where a.hditem_id=b.itemid and a.tcid=b.tcid " +
                           "         and a.hditem_id=" + myTb.Rows[nrow]["hditem_id"].ToString() +
                           "   ) where prescription_id='" + myTb.Rows[nrow]["applycode"].ToString() + "' and charge_bit=0";
                    if (InstanceForm.BDatabase.DoCommand(sSql) == 0)
                    {
                        throw new Exception("未找到需要更新的记录,请重新确认!");
                    }

                    break;

                case 2:     //已安排,未记帐
                    //sSql="update yj_arrangequeue set affirm_user=-2 where id="+myTb.Rows[nrow]["id"].ToString();
                    //if(InstanceForm.BDatabase.DoCommand(sSql)==0)
                    //    throw new Exception("未找到需要更新的记录,请重新确认!");

                    sSql = "update zy_fee_speci " +
                           "    set delete_bit=  " +
                           "  (select 1 from zy_fee_speci a,VI_jc_ITEMS b " +
                           "   where a.hditem_id=b.itemid and a.tcid=b.tcid " +
                           "         and a.hditem_id=" + myTb.Rows[nrow]["hditem_id"].ToString() +
                           "   ) where prescription_id='" + myTb.Rows[nrow]["applycode"].ToString() + "' and charge_bit=0";
                    if (InstanceForm.BDatabase.DoCommand(sSql) == 0)
                    {
                        throw new Exception("未找到需要更新的记录,请重新确认!");
                    }

                    break;

                case 3:     //冲正
                    //sSql="update yj_arrangequeue set affirm_user=-2 where id="+myTb.Rows[nrow]["id"].ToString();
                    //if(InstanceForm.BDatabase.DoCommand(sSql)==0)
                    //    throw new Exception("未找到需要更新的记录,请重新确认!");

                    sSql = "update zy_fee_speci " +
                           "    set charge_bit=1,charge_date=getdate(),charge_user="******"  " +
                           " from zy_fee_speci a,VI_jc_ITEMS b " +
                           "   where a.hditem_id=b.itemid and a.tcid=b.tcid " +
                           "         and a.hditem_id=" + myTb.Rows[nrow]["hditem_id"].ToString() +
                           "         and a.cz_flag=2 and a.prescription_id='" + myTb.Rows[nrow]["applycode"].ToString() + "' and a.charge_bit=0";
                    if (InstanceForm.BDatabase.DoCommand(sSql) == 0)
                    {
                        throw new Exception("未找到需要更新的记录,请重新确认!");
                    }

                    break;
                }

                if (Convert.ToInt16(myTb.Rows[nrow]["xh"]) == 1 || Convert.ToInt16(myTb.Rows[nrow]["xh"]) == 2)
                {
                    //如果是临嘱,且不是冲账,均打上未执行标志
                    if (Convert.ToInt16(myTb.Rows[nrow]["mngtype"]) == 1 || Convert.ToInt16(myTb.Rows[nrow]["mngtype"]) == 5)
                    {
                        //Modify by Tany 2005-02-21 order_edate=getdate()
                        sSql = "update zy_orderrecord set wzx_flag=" + InstanceForm.BCurrentUser.EmployeeId + ",order_edate=getdate() where order_id='" + myTb.Rows[nrow]["order_id"].ToString() + "'";
                        if (InstanceForm.BDatabase.DoCommand(sSql) == 0)
                        {
                            throw new Exception("未找到需要更新的记录,请重新确认!");
                        }
                    }

                    //取消检查打印 Add By Tany 2004-12-02
                    sSql = "update zy_jy_print set delete_bit=1 where order_id='" + myTb.Rows[nrow]["order_id"].ToString() + "'";
                    InstanceForm.BDatabase.DoCommand(sSql);//Modify By Tany 2004-12-08
                }

                InstanceForm.BDatabase.CommitTransaction();

                //更新lis条形码表  暂时没有lis连接屏蔽 Modify By Tany 2006-12-04
                //				if(_lisGroup!="-1" && _lisGroup!="")
                //				{
                //					sSql="update ls_as_txm set delete_bit=1 where id="+_lisGroup;
                //					InstanceForm.BDatabase.DoCommand(sSql);
                //				}
            }
            catch (Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                //				database.Close();

                //写错误日志 Add By Tany 2005-01-12
                SystemLog _systemErrLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "程序错误", "取消医技检查错误:" + err.Message + "  Source:" + err.Source, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);
                _systemErrLog.Save();
                _systemErrLog = null;

                MessageBox.Show("错误:" + err.Message + "\n" + "Source:" + err.Source + "\n\n数据已经回滚,请检查后重新执行!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                myDataGrid1.DataSource = null;
                return;
            }

            //			database.Close();

            MessageBox.Show("取消成功!");
            myDataGrid1.DataSource = null;
        }
Ejemplo n.º 15
0
        void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                decimal d = 0M;
                if (!decimal.TryParse(txtJexz.Text.Trim(), out d))
                {
                    txtJexz.Focus();
                    MessageBox.Show("金额限制 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!decimal.TryParse(txtCfsl.Text.Trim(), out d))
                {
                    txtCfsl.Focus();
                    MessageBox.Show("处方数量 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!decimal.TryParse(txtCfslM.Text.Trim(), out d))
                {
                    txtCfslM.Focus();
                    MessageBox.Show("月处方数量 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!decimal.TryParse(txtRJcje.Text.Trim(), out d))
                {
                    txtRJcje.Focus();
                    MessageBox.Show("日检查金额 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!decimal.TryParse(txtRZlje.Text.Trim(), out d))
                {
                    txtRZlje.Focus();
                    MessageBox.Show("日治疗金额 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (MessageBox.Show("确定操作吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                {
                    return;
                }

                FrmMdiMain.Database.BeginTransaction();
                string id      = "";
                string strSql  = "";
                int    iReturn = 0;

                if (_isAdd)//新增
                {
                    //strSql = string.Format(@"select count(1) as NUM from  jc_gf_sflb where sflb='{0}'", txtCode.Text);

                    //DataTable dt = FrmMdiMain.Database.GetDataTable(strSql);
                    //if (dt == null || dt.Rows.Count <= 0)
                    //{
                    //    FrmMdiMain.Database.RollbackTransaction();
                    //    return;
                    //}

                    //if (int.Parse(dt.Rows[0]["NUM"].ToString()) > 0)
                    //{
                    //    FrmMdiMain.Database.RollbackTransaction();
                    //    MessageBox.Show(txtCode.Text + "的类别编码已存在,请重新命名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //    txtCode.Focus();
                    //    return;
                    //}

                    //id = TrasenClasses.GeneralClasses.PubStaticFun.NewGuid().ToString();
                    strSql = string.Format(@"insert into jc_gf_WrkUnit( name, pym, wbm, Wrk_Unit, fzr, bank, pay_id, tel_no, wrk_addr, del_bit, cfsl_xz, cfslM_xz, je_xz, jcje_xz, zlje_xz, memo, opr_date, opr_man) 
                                                VALUES('{0}','{1}',{2},'{3}','{4}','{5}','{6}','{7}',{8},'{9}','{10}','{11}','{12}','{13}',{14},'{15}','{16}','{17}')",
                                           txtWrkUnit.Text.Replace("'", ""),
                                           txtPym.Text.Replace("'", ""),
                                           txtWbm.Text.Replace("'", ""),
                                           cmbZone.SelectedValue.ToString(),
                                           txtFzr.Text.Replace("'", ""),
                                           txtKhyh.Text.Replace("'", ""),
                                           txtFkzh.Text.Replace("'", ""),
                                           txtTel.Text.Replace("'", ""),
                                           txtAddr.Text.Replace("'", ""),
                                           chkDel.Checked ? "1" : "0",
                                           txtCfsl.Text.Replace("'", ""),
                                           txtCfslM.Text.Replace("'", ""),
                                           txtJexz.Text.Replace("'", ""),
                                           txtRJcje.Text.Replace("'", ""),
                                           txtRZlje.Text.Replace("'", ""),
                                           txtMemo.Text.Replace("'", ""),
                                           DateManager.ServerDateTimeByDBType(InstanceForm._database),
                                           InstanceForm._currentUser.EmployeeId);
                    iReturn = FrmMdiMain.Database.DoCommand(strSql);
                }
                else//修改
                {
                    if (this.dataGridView1.CurrentRow == null)
                    {
                        FrmMdiMain.Database.RollbackTransaction();
                        return;
                    }

                    id = this.dataGridView1.CurrentRow.Cells["ID"].Value.ToString();

                    //strSql = string.Format(@"select count(1) as NUM from  jc_gf_sflb where sflb='{0}' and ID<>'{1}'", txtCode.Text, id);
                    //DataTable dt = FrmMdiMain.Database.GetDataTable(strSql);
                    //if (dt == null || dt.Rows.Count <= 0)
                    //{
                    //    FrmMdiMain.Database.RollbackTransaction();
                    //    return;
                    //}
                    //if (int.Parse(dt.Rows[0]["NUM"].ToString()) > 0)
                    //{
                    //    FrmMdiMain.Database.RollbackTransaction();
                    //    MessageBox.Show(txtCode.Text + "的类别编码已存在,请重新命名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //    return;
                    //}

                    strSql = string.Format(@"update   [jc_gf_WrkUnit] set  
                                            [name] = '{0}',
                                            [pym] = '{1}',
                                            [wbm] = '{2}',
                                            [Wrk_Unit] = '{3}',
                                            [fzr] = '{4}',
                                            [bank] = '{5}',
                                            [pay_id] = '{6}',
                                            [tel_no] = '{7}',
                                            [wrk_addr] = '{8}',
                                            [del_bit] = '{9}',
                                            [cfsl_xz] = {10},
                                            [cfslM_xz] = '{11}',
                                            [je_xz] = '{12}' ,
                                            [jcje_xz] = '{13}' ,
                                            [zlje_xz] = '{14}'  ,
                                            [Mod_date] = '{15}' ,
                                            [Mod_man] = '{16}'  ,
                                            [memo] = '{17}' 
                                            where ID='{18}'",
                                           txtWrkUnit.Text.Replace("'", ""),
                                           txtPym.Text.Replace("'", ""),
                                           txtWbm.Text.Replace("'", ""),
                                           cmbZone.SelectedValue.ToString(),
                                           txtFzr.Text.Replace("'", ""),
                                           txtKhyh.Text.Replace("'", ""),
                                           txtFkzh.Text.Replace("'", ""),
                                           txtTel.Text.Replace("'", ""),
                                           txtAddr.Text.Replace("'", ""),
                                           chkDel.Checked ? "1" : "0",
                                           txtCfsl.Text.Replace("'", ""),
                                           txtCfslM.Text.Replace("'", ""),
                                           txtJexz.Text.Replace("'", ""),
                                           txtRJcje.Text.Replace("'", ""),
                                           txtRZlje.Text.Replace("'", ""),
                                           txtMemo.Text.Replace("'", ""),
                                           DateManager.ServerDateTimeByDBType(InstanceForm._database),
                                           InstanceForm._currentUser.EmployeeId,
                                           id);
                    iReturn = FrmMdiMain.Database.DoCommand(strSql);

                    if (!this.dataGridView1.CurrentRow.Cells["del_bit"].Value.ToString().Equals(chkDel.Checked ? "1" : "0"))
                    {
                        //删除状态变更写日志  信息科要求
                        SystemLog _systemLog = new SystemLog(-1, InstanceForm._currentDept.DeptId, InstanceForm._currentUser.EmployeeId, "更新公费单位信息的删除状态", "将单位" + cmbZone.Text + "_" + txtWrkUnit.Text + " 的删除状态更新为 " + (chkDel.Checked ? "删除" : "正常") + " " + InstanceForm._currentUser.EmployeeId, DateManager.ServerDateTimeByDBType(InstanceForm._database), 1, "主机名:" + System.Environment.MachineName, 39);
                        _systemLog.Save();
                        _systemLog = null;
                    }
                }
                if (iReturn <= 0)
                {
                    FrmMdiMain.Database.RollbackTransaction();
                    MessageBox.Show("操作失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                FrmMdiMain.Database.CommitTransaction();

                _isAdd = false;
                DoQuery();
                //DoGetFocus(txtCode.Text);
                MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Ejemplo n.º 16
0
        void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                decimal d = 0M;
                if (!decimal.TryParse(txtJexz.Text.Trim(), out d))
                {
                    txtJexz.Focus();
                    MessageBox.Show("日金额限制 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!decimal.TryParse(txtMje.Text.Trim(), out d))
                {
                    txtMje.Focus();
                    MessageBox.Show("月金额限制 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!decimal.TryParse(txtCfsl.Text.Trim(), out d))
                {
                    txtCfsl.Focus();
                    MessageBox.Show("处方数量 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!decimal.TryParse(txtCfslM.Text.Trim(), out d))
                {
                    txtCfslM.Focus();
                    MessageBox.Show("月处方数量 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!decimal.TryParse(txtZfbl.Text.Trim(), out d))
                {
                    txtZfbl.Focus();
                    MessageBox.Show("自费比例 请输入数值型数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (string.IsNullOrEmpty(txtYlzh.Text.Trim()))
                {
                    txtYlzh.Focus();
                    MessageBox.Show("医疗证号不能为空,请输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (string.IsNullOrEmpty(txtName.Text.Trim()))
                {
                    txtName.Focus();
                    MessageBox.Show("姓名不能为空,请输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (MessageBox.Show("确定操作吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                {
                    return;
                }

                string    strZone = "";//insurecentral
                DataRow[] drZones = _dtYblx.Select("id='" + cmbGflx.SelectedValue.ToString().Trim() + "'");
                if (drZones.Length <= 0)
                {
                    FrmMdiMain.Database.RollbackTransaction();
                    MessageBox.Show("医保类型:" + cmbGflx.Text + " 未对应区域,请联系管理员", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                strZone = drZones[0]["insurecentral"].ToString().Trim();

                FrmMdiMain.Database.BeginTransaction();
                string id      = "";
                string strSql  = "";
                int    iReturn = 0;

                if (_isAdd)//新增
                {
                    strSql = string.Format(@"select count(1) as NUM from  jc_gf_patrec where ylzh='{0}' and gflx='{1}'", txtYlzh.Text.Trim(), cmbGflx.SelectedValue.ToString());

                    DataTable dt = FrmMdiMain.Database.GetDataTable(strSql);
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        FrmMdiMain.Database.RollbackTransaction();
                        return;
                    }

                    if (int.Parse(dt.Rows[0]["NUM"].ToString()) > 0)
                    {
                        FrmMdiMain.Database.RollbackTransaction();
                        MessageBox.Show(txtYlzh.Text + "的医疗证号已存在于:" + cmbGflx.Text + ",请重新确认后该病人的医疗证号是否重号或输错!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtYlzh.Focus();
                        return;
                    }

                    string strRDWBH, strDWBH, strRRYLB, strRGRBH;
                    strRDWBH = strDWBH = strRRYLB = strRGRBH = "";

                    if (cmbGflx.SelectedValue.ToString().Trim().Equals(_strWhsGf))
                    {
                        try
                        {
                            strRDWBH = txtYlzh.Text.Replace("'", "").Substring(0, 3);
                            strDWBH  = txtYlzh.Text.Replace("'", "").Substring(3, 2);
                            strRRYLB = txtYlzh.Text.Replace("'", "").Substring(5, 1);
                            strRGRBH = txtYlzh.Text.Replace("'", "").Substring(6, 4);
                        }
                        catch { }
                    }

                    strSql = string.Format(@"insert into jc_gf_patrec( id, ylzh,ylzh1,ylzh2, name, pym, wbm, gflx, gfzlx, qy, brlx, del_bit, cfsl_xz, cfslM_xz, je_xz, yje_xz, 
                                                                GRJB, RZQK, ZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, xb ,memo, DM,lxdh, memo_1,memo_2,memo_3, opr_date, opr_man,jcje_xz,zlje_xz) 
                                                VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}',
                                                        '{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}')",
                                           txtYlzh.Text.Replace("'", "") + strZone,
                                           txtYlzh.Text.Replace("'", "").Trim(),
                                           txtYlzh.Text.Replace("'", "").Replace("-", "").Trim(),
                                           txtYlzh.Text.Replace("'", "").Replace("-", "").Trim(),
                                           txtName.Text.Replace("'", "").Trim(),
                                           txtPym.Text.Replace("'", ""),
                                           txtWbm.Text.Replace("'", ""),
                                           cmbGflx.SelectedValue.ToString(),
                                           Convertor.IsNull(cmbGfzlx.SelectedValue, ""),
                                           strZone,             //cmbZone.SelectedValue.ToString(),
                                           _strYbjklx,
                                           chkDel.Checked ? "1" : "0",
                                           txtCfsl.Text.Replace("'", ""),
                                           txtCfslM.Text.Replace("'", ""),
                                           txtJexz.Text.Replace("'", ""),
                                           txtMje.Text.Replace("'", ""),
                                           cmbGrjb.Text,
                                           string.IsNullOrEmpty(cmbRzqk.Text.Trim()) ? cmbGfzlx.Text : cmbRzqk.Text.Trim(),
                                           txtZfbl.Text.Replace("'", ""),
                                           strRDWBH,
                                           strDWBH,
                                           strRRYLB,
                                           strRGRBH,
                                           "", "",
                                           txtMemo.Text.Replace("'", ""),
                                           "2",
                                           txtTel.Text.Replace("'", ""),
                                           txtWrkUnit.Text.Trim(),
                                           cmbGrjb.Text,
                                           string.IsNullOrEmpty(cmbRzqk.Text.Trim()) ? cmbGfzlx.Text : cmbRzqk.Text.Trim(),
                                           DateManager.ServerDateTimeByDBType(InstanceForm._database),
                                           InstanceForm._currentUser.EmployeeId, 200, 200);
                    iReturn = FrmMdiMain.Database.DoCommand(strSql);
                }
                else//修改
                {
                    if (this.dataGridView1.CurrentRow == null)
                    {
                        FrmMdiMain.Database.RollbackTransaction();
                        return;
                    }

                    id = this.dataGridView1.CurrentRow.Cells["ID"].Value.ToString();

                    strSql = string.Format(@"select count(1) as NUM from  jc_gf_patrec where ylzh='{0}' and gflx='{1}' and ID<>'{2}'", txtYlzh.Text.Trim(), cmbGflx.SelectedValue.ToString(), id);
                    DataTable dt = FrmMdiMain.Database.GetDataTable(strSql);
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        FrmMdiMain.Database.RollbackTransaction();
                        return;
                    }
                    if (int.Parse(dt.Rows[0]["NUM"].ToString()) > 0)
                    {
                        FrmMdiMain.Database.RollbackTransaction();
                        MessageBox.Show(txtYlzh.Text + "的医疗证号已存在于:" + cmbGflx.Text + ",请重新确认后该病人的医疗证号是否重号或输错!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtYlzh.Focus();
                        return;
                    }

                    string strRDWBH, strDWBH, strRRYLB, strRGRBH;
                    strRDWBH = strDWBH = strRRYLB = strRGRBH = "";

                    if (cmbGflx.SelectedValue.ToString().Trim().Equals(_strWhsGf))
                    {
                        try
                        {
                            strRDWBH = txtYlzh.Text.Replace("'", "").Substring(0, 3);
                            strDWBH  = txtYlzh.Text.Replace("'", "").Substring(3, 2);
                            strRRYLB = txtYlzh.Text.Replace("'", "").Substring(5, 1);
                            strRGRBH = txtYlzh.Text.Replace("'", "").Substring(6, 4);
                        }
                        catch { }
                    }


                    //id, ylzh,ylzh1,ylzh2, name, pym, wbm, gflx, gfzlx, qy, brlx, del_bit, cfsl_xz, cfslM_xz, je_xz, yje_xz,
                    //GRJB, RZQK, ZFBL, RDWBH, DWBH, RRYLB, RGRBH, SFZH, xb ,memo, DM,lxdh, memo_1,memo_2,memo_3, opr_date, opr_man
                    strSql = string.Format(@"update   [jc_gf_patrec] set  
                                            [name] = '{0}',
                                            [pym] = '{1}',
                                            [wbm] = '{2}',
                                            [gfzlx] = '{3}',
                                            [del_bit] = '{4}',
                                            [cfsl_xz] = {5},
                                            [cfslM_xz] = '{6}',
                                            [je_xz] = '{7}' ,
                                            [yje_xz] = '{8}' ,
                                            [GRJB] = '{9}',
                                            [RZQK] = '{10}',
                                            [ZFBL] = '{11}',
                                            [lxdh] = '{12}',
                                            [Mod_date] = '{13}',
                                            [Mod_man] = '{14}' ,
                                            [memo_1] = '{15}'  ,
                                            [memo_2] = '{16}'  ,
                                            [memo_3] = '{17}'  ,
                                            [memo] = '{18}' 
                                            where ID='{19}'",
                                           txtName.Text.Replace("'", ""),
                                           txtPym.Text.Replace("'", ""),
                                           txtWbm.Text.Replace("'", ""),
                                           cmbGfzlx.Text,
                                           chkDel.Checked ? "1" : "0",
                                           txtCfsl.Text.Replace("'", ""),
                                           txtCfslM.Text.Replace("'", ""),
                                           txtJexz.Text.Replace("'", ""),
                                           txtMje.Text.Replace("'", ""),
                                           cmbGrjb.Text,
                                           cmbRzqk.Text,
                                           txtZfbl.Text.Replace("'", ""),
                                           txtTel.Text.Replace("'", ""),
                                           DateManager.ServerDateTimeByDBType(InstanceForm._database),
                                           InstanceForm._currentUser.EmployeeId,
                                           txtMemo.Text.Replace("'", ""),
                                           txtWrkUnit.Text.Replace("'", "").Trim(),
                                           cmbGrjb.Text,
                                           cmbRzqk.Text,
                                           id);
                    iReturn = FrmMdiMain.Database.DoCommand(strSql);

                    if (!this.dataGridView1.CurrentRow.Cells["del_bit"].Value.ToString().Equals(chkDel.Checked ? "1" : "0"))
                    {
                        //删除状态变更写日志  信息科要求
                        SystemLog _systemLog = new SystemLog(-1, InstanceForm._currentDept.DeptId, InstanceForm._currentUser.EmployeeId, "更新公费 病员档案 信息的删除状态", "将医疗证号" + txtYlzh.Text.Replace("'", "") + "_" + strZone + " 的删除状态更新为 " + (chkDel.Checked ? "删除" : "正常") + " " + InstanceForm._currentUser.EmployeeId, DateManager.ServerDateTimeByDBType(InstanceForm._database), 1, "主机名:" + System.Environment.MachineName, 39);
                        _systemLog.Save();
                        _systemLog = null;
                    }
                }
                if (iReturn <= 0)
                {
                    FrmMdiMain.Database.RollbackTransaction();
                    MessageBox.Show("操作失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                FrmMdiMain.Database.CommitTransaction();

                _isAdd = false;
                DoQuery();
                DoGetFocus(txtYlzh.Text.Replace("'", "") + strZone);
                try
                {
                    if (treeView1.SelectedNode == null)
                    {
                        treeView1.SelectedNode = treeView1.Nodes[0];//.Nodes[Convertor.IsNull(cmbGflx.SelectedValue, "")];
                    }
                }
                catch { }
                MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                FrmMdiMain.Database.RollbackTransaction();
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Ejemplo n.º 17
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            if (MessageBox.Show("是否确定保存静脉采血相关费用?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            IsSave = true;

            string    sSql     = "";
            string    strSql   = "";
            DataTable myTempTb = new DataTable();
            bool      IsErr    = false;
            DataTable myTb     = (DataTable)myDataGrid1.DataSource;

            //取静脉采血费
            sSql = @"Select a.order_id,a.order_name,a.order_unit,a.order_type " +
                   "from jc_hoitemdiction a,jc_CONFIG b " +
                   "where a.order_id=convert(bigint,b.config) and b.id=7015 ";
            DataTable myJTb = InstanceForm.BDatabase.GetDataTable(sSql);

            //取静脉采血管费
            sSql = @"Select a.order_id,a.order_name,a.order_unit,a.order_type " +
                   "from jc_hoitemdiction a,jc_CONFIG b " +
                   "where a.order_id=convert(bigint,b.config) and b.id=7016";
            DataTable myGTb = InstanceForm.BDatabase.GetDataTable(sSql);

            //如果没有设置静脉采血费代码,将不插入煎药费
            if (myJTb.Rows.Count == 0 || myJTb == null)
            {
                MessageBox.Show("没有设置静脉采血费代码,请手工输入静脉采血费!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                IsErr = true;
            }
            else if (myGTb.Rows.Count == 0 || myGTb == null)
            {
                MessageBox.Show("没有设置静脉采血管代码,请手工输入静脉采血管费!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                IsErr = true;
            }
            else
            {
                decimal v_hoitem_id     = Convert.ToDecimal(myJTb.Rows[0]["order_id"].ToString());
                string  v_order_context = myJTb.Rows[0]["order_name"].ToString().Trim();
                string  v_unit          = myJTb.Rows[0]["order_unit"].ToString().Trim();
                int     v_order_type    = Convert.ToInt32(myJTb.Rows[0]["order_type"].ToString().Trim());

                decimal v_hoitem_id1     = Convert.ToDecimal(myGTb.Rows[0]["order_id"].ToString());
                string  v_order_context1 = myGTb.Rows[0]["order_name"].ToString().Trim();
                string  v_unit1          = myGTb.Rows[0]["order_unit"].ToString().Trim();
                int     v_order_type1    = Convert.ToInt32(myGTb.Rows[0]["order_type"].ToString().Trim());

                int i    = 0;
                int iYZH = 0;

//				//生成数据访问对象
//				RelationalDatabase database=RelationalDatabase.GetDatabase(DatabaseType.IbmDb2ZY);
//				database.Initialize("");
//				database.Open();
//				//开始一个事物
//				database.BeginTransaction();

                InstanceForm.BDatabase.BeginTransaction();

                try
                {
                    for (i = 0; i < myTb.Rows.Count; i++)
                    {
                        if (myTb.Rows[i]["采血费次数"].ToString().Trim() != "0" && myTb.Rows[i]["采血费次数"].ToString().Trim() != "")
                        {
                            //取组号
                            sSql = @"select max(Group_Id) as YZH " +
                                   "  from Zy_OrderRecord " +
                                   " where inpatient_id='" + myTb.Rows[i]["inpatient_id"].ToString().Trim() + "'" +
                                   "       and baby_id=" + myTb.Rows[i]["baby_id"].ToString().Trim();                              //+
//								"       and mngtype=3";
                            myTempTb.Clear();
                            myTempTb = InstanceForm.BDatabase.GetDataTable(sSql);
                            if (myTempTb.Rows[0]["YZH"].ToString().Trim() == "")
                            {
                                iYZH = 0;
                            }
                            else
                            {
                                iYZH = Convert.ToInt32(myTempTb.Rows[0]["YZH"]) + 1;
                            }

                            //插入医嘱记录表
                            strSql = @"INSERT INTO ZY_ORDERRECORD( " +
                                     "order_id,jgbm,xmly,INPATIENT_ID,Baby_ID,WARD_ID,DEPT_BR,DEPT_ID, " +
                                     "MNGTYPE,ORDER_BDATE,GROUP_ID,NTYPE, " +
                                     "HOITEM_ID,ORDER_CONTEXT,NUM,DOSAGE,UNIT,ORDER_USAGE,FREQUENCY, " +
                                     "EXEC_DEPT,FIRST_TIMES,STATUS_FLAG, " +
                                     "AUDITING_USER,AUDITING_DATE,OPERATOR,BOOK_DATE,SERIAL_NO ) " +
                                     "VALUES('" + PubStaticFun.NewGuid() + "'," + FrmMdiMain.Jgbm + ",2, '" +
                                     myTb.Rows[i]["inpatient_id"].ToString().Trim() + "'," + Convert.ToDecimal(myTb.Rows[i]["baby_id"].ToString().Trim()) +
                                     ",'" + InstanceForm.BCurrentDept.WardId + "'," + Convert.ToDecimal(myTb.Rows[i]["dept_br"].ToString().Trim()) + "," + Convert.ToDecimal(myTb.Rows[i]["dept_id"].ToString().Trim()) +
                                     ",3,getdate()," + iYZH.ToString() + "," + v_order_type + "," +
                                     v_hoitem_id + ",'" + v_order_context + "'," + myTb.Rows[i]["采血费次数"] + ",1,'" + v_unit + "','',''," +
                                     Convert.ToDecimal(myTb.Rows[i]["dept_br"].ToString().Trim()) + ", 1,2," +
                                     InstanceForm.BCurrentUser.EmployeeId + ",getdate() ," + InstanceForm.BCurrentUser.EmployeeId + ",getdate(),0)";

                            InstanceForm.BDatabase.DoCommand(strSql);
                        }
                        //Add By Tany 2004-11-13
                        if (myTb.Rows[i]["采血管次数"].ToString().Trim() != "0" && myTb.Rows[i]["采血管次数"].ToString().Trim() != "")
                        {
                            //取组号
                            sSql = @"select max(Group_Id) as YZH " +
                                   "  from Zy_OrderRecord " +
                                   " where inpatient_id='" + myTb.Rows[i]["inpatient_id"].ToString().Trim() + "'" +
                                   "       and baby_id=" + myTb.Rows[i]["baby_id"].ToString().Trim();                              //+
//								"       and mngtype=3";
                            myTempTb.Clear();
                            myTempTb = InstanceForm.BDatabase.GetDataTable(sSql);
                            if (myTempTb.Rows[0]["YZH"].ToString().Trim() == "")
                            {
                                iYZH = 0;
                            }
                            else
                            {
                                iYZH = Convert.ToInt32(myTempTb.Rows[0]["YZH"]) + 1;
                            }

                            //插入医嘱记录表
                            strSql = @"INSERT INTO ZY_ORDERRECORD( " +
                                     "order_id,jgbm,xmly,INPATIENT_ID,Baby_ID,WARD_ID,DEPT_BR,DEPT_ID, " +
                                     "MNGTYPE,ORDER_BDATE,GROUP_ID,NTYPE, " +
                                     "HOITEM_ID,ORDER_CONTEXT,NUM,DOSAGE,UNIT,ORDER_USAGE,FREQUENCY, " +
                                     "EXEC_DEPT,FIRST_TIMES,STATUS_FLAG, " +
                                     "AUDITING_USER,AUDITING_DATE,OPERATOR,BOOK_DATE,SERIAL_NO ) " +
                                     "VALUES( '" + PubStaticFun.NewGuid() + "'," + FrmMdiMain.Jgbm + ",2,'" +
                                     myTb.Rows[i]["inpatient_id"].ToString().Trim() + "'," + myTb.Rows[i]["baby_id"].ToString().Trim() +
                                     ",'" + InstanceForm.BCurrentDept.WardId + "'," + Convert.ToDecimal(myTb.Rows[i]["dept_br"].ToString().Trim()) + "," + Convert.ToDecimal(myTb.Rows[i]["dept_id"].ToString().Trim()) +
                                     ",3,getdate()," + iYZH.ToString() + "," + v_order_type1 + "," +
                                     v_hoitem_id1 + ",'" + v_order_context1 + "'," + myTb.Rows[i]["采血管次数"] + ",1,'" + v_unit1 + "','',''," +
                                     Convert.ToDecimal(myTb.Rows[i]["dept_br"].ToString().Trim()) + ", 1,2," +
                                     InstanceForm.BCurrentUser.EmployeeId + ",getdate() ," + InstanceForm.BCurrentUser.EmployeeId + ",getdate(),0)";

                            InstanceForm.BDatabase.DoCommand(strSql);
                        }
                    }

                    InstanceForm.BDatabase.CommitTransaction();
                }
                catch (Exception err)
                {
                    InstanceForm.BDatabase.RollbackTransaction();

                    //写错误日志 Add By Tany 2005-01-12
                    SystemLog _systemErrLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "程序错误", "保存静脉采血费用错误:" + err.Message + "  Source:" + err.Source, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);
                    _systemErrLog.Save();
                    _systemErrLog = null;

                    MessageBox.Show("错误:将静脉采血相关费用插入临时账单错误,请手工生成静脉采血相关费用!\n系统:" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    IsErr = true;
                }

//				database.Close();
            }

            if (IsErr == false)
            {
                MessageBox.Show("已经成功生成静脉采血相关费用临时账单!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            this.Close();
        }
Ejemplo n.º 18
0
        //系统对账 月末结存
        private void button1_Click(object sender, System.EventArgs e)
        {
            if (_menuTag.Function_Name.Trim() != "Fun_ts_yk_unymjz")
            {
                #region 系统对账
                //系统对账
                this.Text = "正在进行系统对账.....";
                try
                {
                    ParameterEx[] parameters = new ParameterEx[2];
                    parameters[0].Text  = "@jsrq";
                    parameters[0].Value = dtp1.Value.ToString();

                    parameters[1].Text  = "@deptid";
                    parameters[1].Value = InstanceForm.BCurrentDept.DeptId;

                    DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_YK_XTDZ", parameters, 30);
                    tb.TableName = "myTb";

                    if (tb.Rows.Count > 0)
                    {
                        this.Close();
                        Frmxtdzmx f = new Frmxtdzmx(_menuTag, _chineseName, _mdiParent);
                        f.MdiParent = _mdiParent;
                        f.Show();
                        f.FillData(tb);
                        return;
                    }

                    if (_menuTag.Function_Name.Trim() == "Fun_ts_yk_xtdz")
                    {
                        MessageBox.Show("系统对帐完成");
                        this.Text = _chineseName.Trim();
                        this.Close();
                        return;
                    }
                }
                catch (System.Exception err)
                {
                    MessageBox.Show("出错" + err.Message);
                    return;
                }

                #endregion
            }

            #region 取消上次月结
            //取消上次月结
            if (_menuTag.Function_Name.Trim() == "Fun_ts_yk_unymjz" && MessageBox.Show("您确定要取消 [" + txtbz.Text + "] 这次月结吗 ?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                this.Text = "正在取消上次月结.....";
                try
                {
                    int    err_code = -1;
                    string err_text = "";

                    InstanceForm.BDatabase.BeginTransaction();

                    ParameterEx[] parameters = new ParameterEx[5];
                    parameters[0].Text  = "@deptid";
                    parameters[0].Value = InstanceForm.BCurrentDept.DeptId;

                    parameters[1].Text  = "@djsj";
                    parameters[1].Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();

                    parameters[2].Text  = "@djy";
                    parameters[2].Value = InstanceForm.BCurrentUser.EmployeeId;

                    parameters[3].Text          = "@err_code";
                    parameters[3].ParaDirection = ParameterDirection.Output;
                    parameters[3].DataType      = System.Data.DbType.Int32;
                    parameters[3].ParaSize      = 100;

                    parameters[4].Text          = "@err_text";
                    parameters[4].ParaDirection = ParameterDirection.Output;
                    parameters[4].ParaSize      = 100;


                    InstanceForm.BDatabase.DoCommand("sp_yk_UNymjc", parameters, 30);
                    err_code = Convert.ToInt32(parameters[3].Value);
                    err_text = Convert.ToString(parameters[4].Value);


                    if (err_code != 0)
                    {
                        throw new System.Exception(err_text);
                    }

                    InstanceForm.BDatabase.CommitTransaction();

                    this.Text = _chineseName.Trim();

                    #region 日志记录
                    string str_old = "";
                    str_old = InstanceForm.BCurrentUser.Name + "取消月结.上次月结时间是" + dtp1.Value.ToString() + " 到:" + dtp2.Value.ToString();
                    SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "取消月结", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 8);
                    systemLog.Save();
                    systemLog = null;
                    #endregion


                    MessageBox.Show(err_text);
                    this.Close();
                    return;
                }
                catch (System.Exception err)
                {
                    InstanceForm.BDatabase.RollbackTransaction();
                    this.butok.Enabled = true;
                    MessageBox.Show(err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            #endregion

            #region 月未结账

            if (_menuTag.Function_Name.Trim() != "Fun_ts_yk_ymjz")
            {
                return;
            }
            //月未结帐
            this.Text = "正在进行月未结帐.....";

            try
            {
                if (dtp2.Value < dtp1.Value)
                {
                    MessageBox.Show("月结止日期不能小于开始日期", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (dtp2.Value > DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase))
                {
                    MessageBox.Show("月结止日期不能大于系统当前时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                this.butok.Enabled = false;
                int    err_code = -1;
                string err_text = "";

                InstanceForm.BDatabase.BeginTransaction();

                string    ssql = "select dept_id,name from jc_dept_property  where  dept_id in(select deptid from yp_yjks_gx where p_deptid=" + InstanceForm.BCurrentDept.DeptId + ")";
                DataTable tb   = InstanceForm.BDatabase.GetDataTable(ssql);
                if (tb.Rows.Count == 0)
                {
                    ssql = "select dept_id,name from jc_dept_property  where dept_id=" + InstanceForm.BCurrentDept.DeptId + " ";
                }
                tb = InstanceForm.BDatabase.GetDataTable(ssql);

                for (int xxx = 0; xxx <= tb.Rows.Count - 1; xxx++)
                {
                    #region 执行月结
                    int           _deptID    = Convert.ToInt32(tb.Rows[xxx]["dept_id"]);
                    ParameterEx[] parameters = new ParameterEx[9];
                    parameters[0].Text  = "@year";
                    parameters[0].Value = _year;

                    parameters[1].Text  = "@month";
                    parameters[1].Value = _month;

                    parameters[2].Text  = "@deptid";
                    parameters[2].Value = _deptID;

                    parameters[3].Text  = "@ksrq";
                    parameters[3].Value = dtp1.Value.ToString();// dtp1.Value.ToShortDateString();

                    parameters[4].Text  = "@jsrq";
                    parameters[4].Value = dtp2.Value.ToString();// dtp2.Value.ToShortDateString();

                    parameters[5].Text  = "@djsj";
                    parameters[5].Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();

                    parameters[6].Text  = "@djy";
                    parameters[6].Value = InstanceForm.BCurrentUser.EmployeeId;

                    parameters[7].Text          = "@err_code";
                    parameters[7].ParaDirection = ParameterDirection.Output;
                    parameters[7].DataType      = System.Data.DbType.Int32;
                    parameters[7].ParaSize      = 100;

                    parameters[8].Text          = "@err_text";
                    parameters[8].ParaDirection = ParameterDirection.Output;
                    parameters[8].ParaSize      = 100;


                    InstanceForm.BDatabase.DoCommand("sp_Yk_ymjc", parameters, 30);
                    err_code = Convert.ToInt32(parameters[7].Value);
                    err_text = Convert.ToString(parameters[8].Value);


                    if (err_code != 0)
                    {
                        throw new System.Exception(err_text);
                    }
                    #endregion
                }
                InstanceForm.BDatabase.CommitTransaction();

                YMJC   ymjc    = new YMJC(InstanceForm.BDatabase);
                string message = "";
                for (int xxx = 0; xxx <= tb.Rows.Count - 1; xxx++)
                {
                    #region 生成月结中间表数据
                    int    _deptID = Convert.ToInt32(tb.Rows[xxx]["dept_id"]);
                    string _name   = tb.Rows[xxx]["name"].ToString().Trim();
                    if (ymjc.GenerateDetailData(_deptID, _year, _month, out message) == false)
                    {
                        MessageBox.Show(_name + "月结成功,但生成中间表数据失败,请联系管理员处理", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    #endregion
                }


                this.Text = _chineseName.Trim();
                MessageBox.Show(err_text);
                butok.Enabled = true;
                this.Close();
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                this.butok.Enabled = true;
                MessageBox.Show(err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            #endregion
        }
Ejemplo n.º 19
0
        private void butusc_Click(object sender, EventArgs e)
        {
            #region 权限确认
            try
            {
                string dlgvalue = DlgPW.Show();
                string pwStr    = dlgvalue; //YS.Password;
                bool   bOk      = InstanceForm.BCurrentUser.CheckPassword(pwStr);
                if (!bOk)
                {
                    FrmMessageBox.Show("你没有通过权限确认!", new Font("宋体", 12f), Color.Red, "Sorry!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Cursor = Cursors.Default;
                    return;
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            #endregion

            #region 如果是删除盘点帐存表
            try
            {
                if (MessageBox.Show("删除 [" + InstanceForm.BCurrentDept.DeptName + "] 盘点帐存表的操作不可恢复,您确定要这样做吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    return;
                }

                DataTable tab = (DataTable)dataGridView1.DataSource;

                InstanceForm.BDatabase.BeginTransaction();

                for (int xxx = 0; xxx <= tab.Rows.Count - 1; xxx++)
                {
                    //仓库id
                    int deptid = Convert.ToInt32(tab.Rows[xxx]["deptid"]);

                    string    ssql = "select * from yf_pdcs where bdelete=0 and shbz=0 and deptid=" + deptid + "";
                    DataTable tb   = InstanceForm.BDatabase.GetDataTable(ssql);
                    if (tb.Rows.Count != 0)
                    {
                        throw new Exception("盘点录入操作已经开始了,您现在不能取消帐存表数据");
                    }
                    ssql = "delete yf_pdtemp where shbz=0 and deptid=" + deptid + "";
                    int iii = InstanceForm.BDatabase.DoCommand(ssql);
                    //if (iii == 0) throw new Exception("没有可删除的帐存数据,可能还没有生成");

                    string    str_old   = "删除盘点帐存表";
                    SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "删除盘点帐存表", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 8);
                    systemLog.Save();
                    systemLog = null;
                }

                InstanceForm.BDatabase.CommitTransaction();

                MessageBox.Show("删除成功");
                bool b = BegionPd();
                return;
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show(err.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            #endregion
        }
Ejemplo n.º 20
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            string    msg;
            int       i_jobtime = 1;
            DataTable myTb      = new DataTable();
            DataTable myTb1     = new DataTable();

            try
            {
                switch (lblJobtime.Text)
                {
                case "白班":
                    i_jobtime = 1;
                    break;

                case "晚班":
                    i_jobtime = 2;
                    break;

                case "夜班":
                    i_jobtime = 3;
                    break;
                }
                if (rtbShow.Text.Trim() == "")
                {
                    msg = MessageBox.Show(this, "特殊交班记录为空,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                    if (msg.ToUpper() == "NO")
                    {
                        rtbShow.Focus();
                        return;
                    }
                }
                msg = MessageBox.Show(this, "交班记录一旦保存将不能修改,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                if (msg.ToUpper() == "NO")
                {
                    rtbShow.Focus();
                    return;
                }

                sqlStr = "select 1 from zy_wardjbjl where jb_date='" + DtpbeginDate.Value.Date + "' and ward_id='" + InstanceForm.BCurrentDept.WardId +
                         "' and jobtime=" + i_jobtime;
                myTb1 = InstanceForm.BDatabase.GetDataTable(sqlStr);
                if (myTb1.Rows.Count > 0)
                {
                    MessageBox.Show("该时段的交班报告已经存在,请核对!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    this.Close();
                    return;
                }

                sqlStr = "INSERT INTO ZY_WARDJBJL(WARD_ID,JB_DATE,BOOK_USER,BOOK_DATE,JOBTIME,FORMERLY,GOOUT,TRANSOUT,DEATH," +
                         "COMEIN,TRANSIN,NOW,OPERATION,CHILDBIRTH,TERMINALLYILL,HEAVYILL,GOAWAY,SPECIALTEND,FIRSTTEND,JB_TEXT,jgbm) VALUES" +
                         "('" + InstanceForm.BCurrentDept.WardId + "','" + DtpbeginDate.Value.Date + "'," + InstanceForm.BCurrentUser.EmployeeId + ",getdate()," +
                         i_jobtime + "," + Convert.ToInt32(jbjlTb.Rows[0]["原有"].ToString()) + "," + Convert.ToInt32(jbjlTb.Rows[0]["出院"].ToString()) +
                         "," + Convert.ToInt32(jbjlTb.Rows[0]["转出"].ToString()) + "," + Convert.ToInt32(jbjlTb.Rows[0]["死亡"].ToString()) +
                         "," + Convert.ToInt32(jbjlTb.Rows[0]["入院"].ToString()) + "," + Convert.ToInt32(jbjlTb.Rows[0]["转入"].ToString()) +
                         "," + Convert.ToInt32(jbjlTb.Rows[0]["现有"].ToString()) + "," + Convert.ToInt32(jbjlTb.Rows[0]["手术"].ToString()) +
                         "," + Convert.ToInt32(jbjlTb.Rows[0]["分娩"].ToString()) + "," + Convert.ToInt32(jbjlTb.Rows[0]["病危"].ToString()) +
                         "," + Convert.ToInt32(jbjlTb.Rows[0]["病重"].ToString()) + "," + Convert.ToInt32(jbjlTb.Rows[0]["外出"].ToString()) +
                         "," + Convert.ToInt32(jbjlTb.Rows[0]["特护"].ToString()) + "," + Convert.ToInt32(jbjlTb.Rows[0]["一级护理"].ToString()) +
                         ",'" + rtbShow.Text + "'," + FrmMdiMain.Jgbm + ")";
                InstanceForm.BDatabase.DoCommand(sqlStr);

                sqlStr = "select id from ZY_WARDJBJL where book_user="******" and JB_DATE='" + DtpbeginDate.Value.Date + "'" +
                         " and jobtime=" + i_jobtime + " and ward_id='" + InstanceForm.BCurrentDept.WardId + "'";
                myTb = InstanceForm.BDatabase.GetDataTable(sqlStr);

                for (int i = 0; i < brdtTb.Rows.Count; i++)
                {
                    sqlStr = "INSERT INTO ZY_WARDJBJL_BRDT(JB_ID,ITEM,BED_NO,NAME,DIAGNOSES,TIME,jgbm) VALUES (" + Convert.ToInt32(myTb.Rows[0]["id"].ToString()) + "," +
                             "'" + brdtTb.Rows[i]["项目"].ToString() + "','" + brdtTb.Rows[i]["床号"].ToString() + "','" + brdtTb.Rows[i]["姓名"].ToString() + "'," +
                             "'" + brdtTb.Rows[i]["诊断"].ToString() + "','" + brdtTb.Rows[i]["时间"].ToString() + "'," + FrmMdiMain.Jgbm + ")";
                    InstanceForm.BDatabase.DoCommand(sqlStr);
                }

                MessageBox.Show(this, "保存成功!", "保存", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception err)
            {
                //写错误日志 Add By Tany 2005-01-12
                SystemLog _systemErrLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "程序错误", "保存交班记录错误:" + err.Message + "  Source:" + err.Source, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);
                _systemErrLog.Save();
                _systemErrLog = null;

                MessageBox.Show("错误:" + err.Message + "\n" + "Source:" + err.Source, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 21
0
        //取消作废 Modify By zp 2013-11-14 如果办卡金额不为0 则需要收取办卡金额
        private void toolStripMenuItem7_Click(object sender, EventArgs e)
        {
            if (dataGridView2.DataSource == null)
            {
                return;
            }
            if (dataGridView2.CurrentCell == null)
            {
                return;
            }

            Guid      _kdjid = new Guid(dataGridView2[kdjid.Name, dataGridView2.CurrentCell.RowIndex].Value.ToString());
            DataRow   drKxx  = InstanceForm.BDatabase.GetDataRow("select * from yy_kdjb where kdjid='" + _kdjid.ToString() + "'");
            DataTable cfmxtb = new DataTable();
            int       sfxmid = 0;

            if (_menuTag.Function_Name == "Fun_ts_mz_kgl_jhk_tf")
            {
                sfxmid = Convert.ToInt32(Convertor.IsNull(InstanceForm.BDatabase.GetDataResult("select sfxmid from jc_klx where klx=" + drKxx["klx"]), "0"));
                cfmxtb = InstanceForm.BDatabase.GetDataTable("select * from JC_HSITEM where delete_bit=0 and item_id=" + sfxmid.ToString());
                if (cfmxtb.Rows.Count != 1)
                {
                    MessageBox.Show("收费项目错误,卡费用关联ID不止1个或者为空。", "提示");
                    return;
                }

                string            Msg = "重新启用这张作废卡需要收取卡押金:" + Convert.ToDecimal(cfmxtb.Rows[0]["RETAIL_PRICE"]).ToString() + "元,确定要 [重新启用] 这张作废的卡吗?";
                ts_mz_class.Frmtf f   = new ts_mz_class.Frmtf(_menuTag, _chineseName, _mdiParent);
                f.lblbz.Text = Msg;
                f.ShowDialog();

                if (f.Bok == false)
                {
                    return;
                }
            }
            else
            {
                if (MessageBox.Show("确定要 [重新启用] 这张作废的卡吗?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }

            if (TrasenFrame.Classes.WorkStaticFun.CheckCurrentUserPassword() == true)
            {
                string djsj = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();
                string bkje = "0";
                FrmMdiMain.Database.BeginTransaction();
                try
                {
                    #region//Add by zp 2013-11-14 作废时候把办卡金额退给病人,启用卡后却没有收取办卡金额
                    if (_menuTag.Function_Name == "Fun_ts_mz_kgl_jhk_tf")
                    {
                        #region
                        bkje = drKxx["bkje"].ToString();
                        string ghsj      = djsj;
                        Guid   NewGhxxid = Guid.Empty;
                        int    err_code  = -1;
                        string err_text  = "";
                        Guid   brxxid    = new Guid(Convertor.IsNull(drKxx["brxxid"], Guid.Empty.ToString()));
                        int    ghlx      = 1;
                        string mzh       = Fun.GetNewMzh(InstanceForm.BDatabase);
                        int    ghks      = 0;
                        int    ghys      = 0;
                        int    ghjb      = 0;
                        string _ghck     = "";
                        int    _pdxh     = 0;//排队序号
                        long   Jgbm      = TrasenFrame.Forms.FrmMdiMain.Jgbm;
                        long   _dnlsh    = Convert.ToInt64(Fun.GetNewDnlsh(InstanceForm.BDatabase));
                        int    _zxksdm   = Convert.ToInt32(_cfg1079.Config);
                        string _ksmc     = _zxksdm != 0 ? Fun.SeekDeptName(_zxksdm, InstanceForm.BDatabase) : "";
                        //挂号登记
                        mz_ghxx.GhxxDj(Guid.Empty, brxxid, ghlx, _kdjid, mzh, ghks, ghys, ghjb, 0, InstanceForm.BCurrentUser.EmployeeId, 1, _ghck, ref _pdxh, _dnlsh, "0", Jgbm, out NewGhxxid, out err_code, out err_text, 0, 0, 0, "", "", "", 0, "", "", ghsj, InstanceForm.BDatabase);
                        if (NewGhxxid == Guid.Empty || err_code != 0)
                        {
                            throw new Exception(err_text);
                        }

                        //产生收费处方
                        Guid NewCfid = Guid.Empty;
                        mz_cf.SaveCf(Guid.Empty, brxxid, NewGhxxid, mzh, _ghck, Convert.ToDecimal(bkje), ghsj, InstanceForm.BCurrentUser.EmployeeId, InstanceForm.BCurrentUser.Name, _ghck, Guid.Empty, _zxksdm,
                                     _ksmc, 0, "", 0, _zxksdm, _ksmc, 2, 0, 2, 0, 1, Jgbm, out NewCfid, out err_code, out err_text, InstanceForm.BDatabase);
                        if (err_code != 0)
                        {
                            throw new Exception(err_text);
                        }

                        //修改处方收费状态
                        int Nrows = 0;
                        mz_cf.UpdateCfsfzt(NewCfid, InstanceForm.BCurrentUser.EmployeeId, InstanceForm.BCurrentUser.Name, ghsj, "", _dnlsh, "0", out Nrows, out err_code, out err_text, InstanceForm.BDatabase);
                        if (Nrows != 1)
                        {
                            throw new Exception("在更新处方的收费状态时,没有更新到处方头表,请和管理员联系");
                        }

                        string  _pym     = Convertor.IsNull(cfmxtb.Rows[0]["py_code"], "");
                        string  _bm      = "";
                        string  _pm      = Convertor.IsNull(cfmxtb.Rows[0]["item_name"], "");
                        string  _spm     = Convertor.IsNull(cfmxtb.Rows[0]["item_name"], "");
                        string  _gg      = "";
                        string  _cj      = "";
                        decimal _dj      = Convert.ToDecimal(Convertor.IsNull(cfmxtb.Rows[0]["RETAIL_PRICE"], "0"));
                        decimal _sl      = 1;
                        string  _tjdxmdm = Convertor.IsNull(cfmxtb.Rows[0]["statitem_code"], "");
                        string  _dw      = Convertor.IsNull(cfmxtb.Rows[0]["item_unit"], "");

                        Guid _NewCfmxid = Guid.Empty;
                        //产生处方明细
                        mz_cf.SaveCfmx(Guid.Empty, NewCfid, _pym, _bm, _pm, _spm, _gg, _cj, _dj, _sl, _dw, 0, 1, Convert.ToDecimal(bkje), _tjdxmdm, sfxmid, Guid.Empty, _bm, 0, 0,
                                       Guid.Empty, 0, "", "", 0, 0, "", 0, 0, Guid.Empty, 0, 0, 0, out _NewCfmxid, out err_code, out err_text, InstanceForm.BDatabase);
                        if ((_NewCfmxid == Guid.Empty) || err_code != 0)
                        {
                            throw new Exception(err_text);
                        }
                        //保存收银信息
                        Guid NewJsid = Guid.Empty;
                        mz_sf.SaveJs(Guid.Empty, brxxid, NewGhxxid, ghsj, InstanceForm.BCurrentUser.EmployeeId, (Convert.ToDecimal(bkje)), 0, 0, 0, 0, 0, 0, 0, (Convert.ToDecimal(bkje)), 0, 0, 0, 0, 1, 0, TrasenFrame.Forms.FrmMdiMain.Jgbm, out NewJsid, out err_code, out err_text, InstanceForm.BDatabase);
                        if (NewJsid == Guid.Empty || err_code != 0)
                        {
                            throw new Exception(err_text);
                        }
                        //保存发票
                        Guid NewFpid = Guid.Empty;

                        mz_sf.SaveFp(Guid.Empty, brxxid, NewGhxxid, mzh, dataGridView2.CurrentRow.Cells["name"].Value.ToString(), ghsj, InstanceForm.BCurrentUser.EmployeeId, "", _dnlsh, "0",
                                     Convert.ToDecimal(bkje), 0, 0, 0, 0, 0, 0, 0, Convert.ToDecimal(bkje), 0, 0, Guid.Empty, "", NewJsid, 2, _zxksdm, 0, 0, _zxksdm, 0, "", 0, _kdjid, Jgbm, Guid.Empty, "", out NewFpid, out err_code, out err_text, InstanceForm.BDatabase);
                        if (NewFpid == Guid.Empty || err_code != 0)
                        {
                            throw new Exception(err_text);
                        }

                        //产生发票明细费
                        mz_sf.SaveFpmx(NewFpid, _tjdxmdm, _spm, Convert.ToDecimal(bkje), 0, out err_code, out err_text, InstanceForm.BDatabase);
                        if (err_code != 0)
                        {
                            throw new Exception(err_text);
                        }
                        //产生发票大项目费
                        mz_sf.SaveFpdxmmx(NewFpid, _tjdxmdm, _spm, Convert.ToDecimal(bkje), 0, out err_code, out err_text, InstanceForm.BDatabase);
                        if (err_code != 0)
                        {
                            throw new Exception(err_text);
                        }
                        //取消挂号 并且修改发票

                        int i = InstanceForm.BDatabase.DoCommand("update mz_ghxx set byhbz=0,bqxghbz=1,qxghsj='" + ghsj + "',qxghczy=" + InstanceForm.BCurrentUser.EmployeeId + " where ghxxid='" + NewGhxxid + "' and bqxghbz=0 ");
                        if (i != 1)
                        {
                            throw new Exception("执行 DelRegisterRecord 方法时出错");
                        }

                        i = InstanceForm.BDatabase.DoCommand("update mz_fpb set bghpbz=2 where ghxxid='" + NewGhxxid + "'  and bghpbz=2 ");
                        if (i != 1)
                        {
                            throw new Exception("执行 DelRegisterRecord 方法时出错");
                        }
                        #endregion
                    }
                    #endregion
                    string sql = "update yy_kdjb set sdbz=0,zfbz=0,zfsj=null,zfdjy=0 where klx=" + Convert.ToInt32(drKxx["klx"]) + "  and kh='" + Convertor.IsNull(drKxx["kh"], "") + "'   ";
                    int    ret = InstanceForm.BDatabase.DoCommand(sql);
                    if (ret == 0)
                    {
                        throw new Exception("没有这张卡,请重新选择");
                    }
                    if (ret > 1)
                    {
                        throw new Exception("有" + ret.ToString() + "张卡号相同的有效卡存在,您不能重新启用");
                    }

                    sql = "update yy_brxx set bscbz=0 where brxxid='" + drKxx["brxxid"].ToString() + "'";
                    ret = InstanceForm.BDatabase.DoCommand(sql);
                    if (ret == 0)
                    {
                        throw new Exception("没有更新到和行");
                    }

                    string Contents     = "卡号:" + drKxx["KH"].ToString().Trim() + ",卡登记ID:" + drKxx["KDJID"].ToString().Trim();
                    long   OperatorID   = FrmMdiMain.CurrentUser.EmployeeId;
                    string OperatorType = "重新启用作废卡";
                    int    ModuleID     = FrmMdiMain.CurrentSystem.SystemId;
                    int    ErrLevel     = 0;
                    string WorkStation  = TrasenClasses.GeneralClasses.PubStaticFun.GetMacAddress();
                    int    deptId       = FrmMdiMain.CurrentDept.DeptId;

                    TrasenFrame.Classes.SystemLog log = new SystemLog(0, deptId, OperatorID, OperatorType, Contents, DateManager.ServerDateTimeByDBType(FrmMdiMain.Database)
                                                                      , ErrLevel, WorkStation, ModuleID);
                    log.Save();
                    FrmMdiMain.Database.CommitTransaction();
                    MessageBox.Show("卡启用成功!");
                }
                catch (Exception err)
                {
                    FrmMdiMain.Database.RollbackTransaction();
                    MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            butcx_Click(sender, e);
        }
Ejemplo n.º 22
0
        public static void update_DeleteDj(ts_HospData_Share.ts_update_log ts, RelationalDatabase LocalDatabase)
        {
            string    ssql       = "";
            string    sql_insert = "";
            string    sql_update = "";
            string    sql_delete = "";
            DataTable tb         = null;

            if (ts.Ymc.ToLower() != "yf_dj")
            {
                throw new Exception("源名称必须是Yf_DJ");
            }

            returnSql(LocalDatabase, ts.Ymc, ts.Ylm, ts.Yzj, out sql_insert, out sql_update, out sql_delete, out tb);

            string sDate = DateManager.ServerDateTimeByDBType(LocalDatabase).ToString();


            using (TransactionScope scope = new TransactionScope())
            {
                //目标服务器的链接
                RelationalDatabase MB_DB = TrasenFrame.Classes.WorkStaticFun.GetJgbmDb(Convert.ToInt32(ts.MbjgbM));
                //本地服务器的链接
                RelationalDatabase BD_DB = TrasenFrame.Classes.WorkStaticFun.GetJgbmDb(Convert.ToInt32(ts.Djjgbm));

                int    err_code = -1;
                string err_text = "";
                int    n        = 0;
                //删除目标单据
                ssql = "select * from yf_dj where ydjid='" + ts.Yzj + "' and shbz=0 ";
                DataTable tb_yfdj = MB_DB.GetDataTable(ssql);
                if (tb_yfdj.Rows.Count > 0)
                {
                    ssql = "delete from yf_djmx where djid in(select id from yf_dj where ydjid='" + ts.Yzj + "') ";
                    n    = MB_DB.DoCommand(ssql);

                    ssql = "delete from yf_dj where ydjid='" + ts.Yzj + "' and shbz=0 ";
                    n    = MB_DB.DoCommand(ssql);
                    if (n <= 0)
                    {
                        throw new Exception("删除目标单据时错误,可能已审核");
                    }
                    //删除本地单据
                    YpClass.YF_DJ_DJMX.UpdateKcDrt(new Guid(ts.Yzj), BD_DB);
                    YpClass.YF_DJ_DJMX.AddUpdateKcmx(new Guid(ts.Yzj), out err_code, out err_text, ts.Djjgbm, BD_DB);
                    if (err_code != 0)
                    {
                        throw new Exception(err_text);
                    }
                    YpClass.YF_DJ_DJMX.DeleteDj(new Guid(ts.Yzj), BD_DB);

                    SystemLog systemLog = new SystemLog(-1, 0, ts.Djy, "删除药房单据", "删除药房单据 YF_DJ.ID='" + ts.Yzj.ToString() + "'",
                                                        DateManager.ServerDateTimeByDBType(BD_DB), 0, "主机名:" + System.Environment.MachineName, 8);
                    systemLog.Save();
                    systemLog = null;
                }


                ssql = "select * from yk_dj where ydjid='" + ts.Yzj + "' and shbz=0 ";
                DataTable tb_ykdj = MB_DB.GetDataTable(ssql);
                if (tb_ykdj.Rows.Count > 0)
                {
                    ssql = "delete from yk_djmx where djid in(select id from yk_dj where ydjid='" + ts.Yzj + "') ";
                    n    = MB_DB.DoCommand(ssql);

                    ssql = "delete from yk_dj where ydjid='" + ts.Yzj + "' and shbz=0 ";
                    n    = MB_DB.DoCommand(ssql);
                    if (n <= 0)
                    {
                        throw new Exception("删除目标单据时错误,可能已审核");
                    }
                    //删除本地单据
                    YpClass.YF_DJ_DJMX.UpdateKcDrt(new Guid(ts.Yzj), BD_DB);
                    YpClass.YF_DJ_DJMX.AddUpdateKcmx(new Guid(ts.Yzj), out err_code, out err_text, ts.Djjgbm, BD_DB);
                    if (err_code != 0)
                    {
                        throw new Exception(err_text);
                    }
                    YpClass.YF_DJ_DJMX.DeleteDj(new Guid(ts.Yzj), BD_DB);

                    SystemLog systemLog = new SystemLog(-1, 0, ts.Djy, "删除药房单据", "删除药房单据 YF_DJ.ID='" + ts.Yzj.ToString() + "'",
                                                        DateManager.ServerDateTimeByDBType(BD_DB), 0, "主机名:" + System.Environment.MachineName, 8);
                    systemLog.Save();
                    systemLog = null;
                }



                BD_DB.DoCommand("UPDATE ts_update_log set bwcbz=1,wcsj='" + sDate + "',wcczy=" + TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId + " where id='" + ts.Id + "' and bwcbz=0");
                scope.Complete();
            }
        }
Ejemplo n.º 23
0
        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            int       nrow = myDataGrid1.CurrentCell.RowNumber;
            DataTable tab  = (DataTable)this.myDataGrid1.DataSource;

            if (myDataGrid1[nrow, 0].ToString().Trim() != "药品" && myDataGrid1[nrow, 0].ToString().Trim() != "费用")
            {
                return;
            }

            //Modify By Tany 2010-06-08 是否使用密码确认 0=使用 1=不使用
            if (new SystemCfg(7066).Config == "0")
            {
                frmInPassword f1 = new frmInPassword();
                f1.ShowDialog();
                if (f1.isLogin == false)
                {
                    return;
                }
            }
            if (!myFunc.IsHSZ(InstanceForm.BCurrentUser.EmployeeId))
            {
                MessageBox.Show("对不起,只有护士长能够取消费用和药品!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string sSql = "";

            if (Convert.ToDecimal(Convertor.IsNull(tab.Rows[nrow]["数量"], "0")) > 0)
            {
                //Modify By Tany 2015-03-20 只要有冲账,就不能取消
                sSql = "select * from zy_fee_speci where cz_id='" + myDataGrid1[nrow, 9].ToString() + "' and discharge_bit=0 and delete_bit=0";//and charge_bit=0
                DataTable tb = InstanceForm.BDatabase.GetDataTable(sSql);
                if (tb.Rows.Count > 0)
                {
                    MessageBox.Show("对不起,该记录已被冲正,请先取消相应的冲正记录,才能取消该记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            //Modify by jchl【校验该费用如果是检查或者检验   需要同步删除检查、检验申请】
            string feeid = myDataGrid1[nrow, 9].ToString();

            sSql = string.Format(@"select b.INPATIENT_ID,b.GROUP_ID,b.NTYPE from ZY_FEE_SPECI a 
                                    inner join ZY_ORDERRECORD b on a.ORDER_ID=b.ORDER_ID and b.DELETE_BIT=0
                                    where a.ID='{0}' and a.DELETE_BIT=0", feeid);

            DataTable dt = InstanceForm.BDatabase.GetDataTable(sSql);

            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("该费用对应的医嘱不存在有效记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            InstanceForm.BDatabase.BeginTransaction();
            try
            {
                string NTYPE = dt.Rows[0]["NTYPE"].ToString().Trim();

                //医技特殊处理
                if (NTYPE.Trim().Equals("5"))
                {
                    //医技的取消需要同步删除zy_jy_print或zy_jc_apply
                    string InpId = dt.Rows[0]["INPATIENT_ID"].ToString().Trim();
                    string GrpId = dt.Rows[0]["GROUP_ID"].ToString().Trim();


                    sSql = string.Format(@"select COUNT(1) as num from ZY_JC_RECORD where INPATIENT_ID='{0}' and GROUP_ID='{1}' and DELETE_BIT=0", InpId, GrpId);
                    int iRet = Convert.ToInt32(InstanceForm.BDatabase.GetDataResult(sSql).ToString());
                    if (iRet > 0)
                    {
                        sSql = string.Format(@"update  ZY_JC_RECORD set DELETE_BIT=1 where INPATIENT_ID='{0}' and GROUP_ID='{1}' and DELETE_BIT=0 ", InpId, GrpId);
                        InstanceForm.BDatabase.DoCommand(sSql);
                    }
                    else
                    {
                        //如果确定是检查  就不可能是检验了
                        sSql = string.Format(@"select COUNT(1) as num from zy_jy_print where INPATIENT_ID='{0}' and GROUP_ID='{1}' and DELETE_BIT=0", InpId, GrpId);

                        iRet = Convert.ToInt32(InstanceForm.BDatabase.GetDataResult(sSql).ToString());
                        if (iRet > 0)
                        {
                            sSql = string.Format(@"update  zy_jy_print set DELETE_BIT=1 where INPATIENT_ID='{0}' and GROUP_ID='{1}' and DELETE_BIT=0 ", InpId, GrpId);
                            InstanceForm.BDatabase.DoCommand(sSql);
                        }
                    }

                    sSql = string.Format(@"update zy_fee_speci set delete_bit=1 
                                            from zy_fee_speci a inner join ZY_ORDERRECORD b on a.ORDER_ID=b.ORDER_ID and b.INPATIENT_ID='{0}' and b.GROUP_ID='{1}'
                                            where a.DISCHARGE_BIT=0 and a.charge_bit=0", InpId, GrpId);
                    InstanceForm.BDatabase.DoCommand(sSql);
                }
                else
                {
                    sSql = "update zy_fee_speci set delete_bit=1 where discharge_bit=0 and charge_bit=0 and id='" + myDataGrid1[nrow, 9].ToString() + "'";
                    InstanceForm.BDatabase.DoCommand(sSql);
                }

                InstanceForm.BDatabase.CommitTransaction();
            }
            catch (Exception ex)
            {
                InstanceForm.BDatabase.RollbackTransaction();

                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                ShowData(_inpatinet_id, _baby_id);

                return;
            }

            //写日志 Add By Tany 2005-10-08
            SystemLog _systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "删除费用记录", "将 " + _inpatinet_id + " 病人的 ZY_FEE_SPECI.ID=" + myDataGrid1[nrow, 9].ToString().Trim() + " 的记录删除", DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);

            _systemLog.Save();
            _systemLog = null;

            ShowData(_inpatinet_id, _baby_id);



            MessageBox.Show("取消成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 24
0
        private void btOK_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (txtNewPwd.TextPass.Trim() != txtAffirmPwd.TextPass.Trim())
                {
                    MessageBox.Show("新密码两次输入不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //2013-1-15 修改 使用公共的过程验证 空密码与密码长度
                bool passwordlength = CheckPasswordLength(txtNewPwd.TextPass.Trim());
                if (passwordlength == false)
                {
                    return;
                }

                //SystemCfg cfgAllowEmptyPwd = new SystemCfg(16);
                //SystemCfg cfgPwdMinLength = new SystemCfg(17);
                //if (cfgAllowEmptyPwd.Config == "1" && txtNewPwd.TextPass.Trim() == "")
                //{
                //    MessageBox.Show("系统设置不允许设置空密码,请重新设置您的密码", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //    return;
                //}
                //if (cfgAllowEmptyPwd.Config == "1")
                //{
                //    int length = Convertor.IsInteger(cfgPwdMinLength.Config) ? Convert.ToInt32(cfgPwdMinLength.Config) : 0;
                //    if (txtNewPwd.TextPass.Trim().Length < length && length != 0)
                //    {
                //        MessageBox.Show("您设置的密码长度过短,系统要求密码长度不低于" + cfgPwdMinLength.Config + "位", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //        return;
                //    }
                //}
                //不是emr传入用户,就是用FrmMdiMain.CurrentUser  2012-11-16 增加
                if (UserPwdModify == null)
                {
                    UserPwdModify = FrmMdiMain.CurrentUser;
                }
                #region // jianqg 2012-10月 emr-his框架整合 增加,增加 用户公用密码与私有密码 不能相同的判断
                string    SqlTmp           = "select  Public_pwd from  dict_user_emr  where EMPLOYEE_ID=" + UserPwdModify.EmployeeId.ToString();
                DataTable dt_dict_user_emr = FrmMdiMain.Database.GetDataTable(SqlTmp);
                if (dt_dict_user_emr.Rows.Count > 0)
                {
                    string strPublicPwd = dt_dict_user_emr.Rows[0]["Public_pwd"].ToString();
                    if (Crypto.Instance().Decrypto(strPublicPwd) == txtNewPwd.TextPass.Trim())
                    {
                        //
                        MessageBox.Show("该用户新密码与电子病历中的公用密码相同,本次修改无效,请重新设置新密码!!!");
                        return;
                    }
                }


                #endregion
                ////更新数据库密码
                //FrmMdiMain.CurrentUser.ChangePassword(txtOldPwd.TextPass.Trim(), txtNewPwd.TextPass.Trim());

                ////写入日志 Add By jianqg 2012-8-25
                //SystemLog systemLog = new SystemLog(-1, FrmMdiMain.CurrentDept.DeptId, FrmMdiMain.CurrentUser.EmployeeId, "修改用户密码", FrmMdiMain.CurrentUser.Name + " 修改【" + FrmMdiMain.CurrentUser.Name + "(EmployeeId:" + FrmMdiMain.CurrentUser.EmployeeId + ")】密码", DateManager.ServerDateTimeByDBType(FrmMdiMain.Database), 0, "主机名:" + System.Environment.MachineName, (int)SystemModule.系统公共参数);

                // jianqg  2012-11-16 修改 使用UserPwdModify
                //更新数据库密码
                UserPwdModify.ChangePassword(txtOldPwd.TextPass.Trim(), txtNewPwd.TextPass.Trim());

                //写入日志 Add By jianqg 2012-8-25
                SystemLog systemLog = new SystemLog(-1, FrmMdiMain.CurrentDept.DeptId, FrmMdiMain.CurrentUser.EmployeeId, "修改用户密码", FrmMdiMain.CurrentUser.Name + " 修改【" + UserPwdModify.Name + "(EmployeeId:" + UserPwdModify.EmployeeId + ")】密码", DateManager.ServerDateTimeByDBType(FrmMdiMain.Database), 0, "主机名:" + System.Environment.MachineName, (int)SystemModule.系统公共参数);


                systemLog.Save();
                systemLog = null;

                if (btnOk_Login == null)
                {
                    MessageBox.Show("密码修改成功!重新启动程序后密码将生效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    btnOk_Login.Tag = "ok";//修改了密码
                    MessageBox.Show("密码修改成功!使用新密码登陆!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                allowCancel = true;

                this.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 25
0
        private void btOK_Click(object sender, System.EventArgs e)
        {
            string sSql    = "";
            int    i       = 0;
            string _outmsg = "";

            sSql = @"select bed_id from zy_BedDiction " +
                   " where ward_id='" + InstanceForm.BCurrentDept.WardId + "'" +
                   "   and rtrim(bed_no)='" + this.comboBox1.Text.Trim() + "'";
            DataTable tempTab1 = InstanceForm.BDatabase.GetDataTable(sSql);

            if (tempTab1.Rows.Count < 1)
            {
                return;
            }

            string OperType    = "";
            string OperContens = "";

            if (isBC)
            {
                //床位有效性判断
                //Add By Tany 2005-02-24
                string isInuse = Convertor.IsNull(InstanceForm.BDatabase.GetDataResult("select isinuse from zy_beddiction where bed_id='" + tempTab1.Rows[0]["bed_id"].ToString() + "'"), "");
                if (isInuse == "1")
                {
                    MessageBox.Show("该张床位已经被停用,请退出后重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //包床
                if (MessageBox.Show(this, "确认包" + this.comboBox1.Text.Trim() + "号床吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
                _outmsg     = myFunc.ChangeBed("", 5, this.old_bed_id, new Guid(tempTab1.Rows[0]["bed_id"].ToString()), InstanceForm.BCurrentUser.EmployeeId, FrmMdiMain.Jgbm);
                OperType    = "包床";
                OperContens = _outmsg + old_bed_id.ToString() + "床包" + this.comboBox1.Text.Trim() + "号床";
            }
            else
            {
                //取消包床
                if (MessageBox.Show(this, "确认不包" + this.comboBox1.Text.Trim() + "号床吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
                _outmsg     = myFunc.ChangeBed("", 6, this.old_bed_id, new Guid(tempTab1.Rows[0]["bed_id"].ToString()), InstanceForm.BCurrentUser.EmployeeId, FrmMdiMain.Jgbm);
                OperType    = "取消包床";
                OperContens = _outmsg + old_bed_id.ToString() + "床不包" + this.comboBox1.Text.Trim() + "号床";
            }

            if (_outmsg.Trim() != "")
            {
                MessageBox.Show(_outmsg);
            }

            //写日志 Add By Tany 2005-01-12
            SystemLog _systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, OperType, OperContens, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);

            _systemLog.Save();
            _systemLog = null;

            this.Close();
        }
Ejemplo n.º 26
0
        private void Error(object sender, EventArgs e)
        {
            SessionContext sessionContext = null;

            if (PersistenceContext.IsExisting)
            {
                if (PersistenceContext.SessionContext.IsDiagnosis)
                {
                    string        loginName     = User.Current.LoginName;
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.Append(loginName).Append(" ObjetkFrameworkWebAdapter ").Append("PersitentContextAutoFinish(Failure:Discard) ")
                    .Append(PersistenceContext.GetString());
                    diagnosis.Info(stringBuilder);
                }
                sessionContext = PersistenceContext.SessionContext;
                if (!PersistenceContext.IsTransaction)
                {
                    try
                    {
                        PersistenceContext.Discard();
                    }
                    catch (Exception exception)
                    {
                        log.Warn("未处理异常检查,自动结束(Discard)当前持久化上下文出错。", exception);
                    }
                }
                else
                {
                    PersistenceContext.Discard();
                }
            }
            string message    = httpApplication.Server.GetLastError().Message;
            string stackTrace = httpApplication.Server.GetLastError().StackTrace;

            log.Error(message + stackTrace);
            try
            {
                if (sessionContext == null)
                {
                    sessionContext = new SessionContext("Web未处理异常", ObjektFactory.Find <User>("e2c4e2f4ecec4d6d8dce2fe6c831352e@User"));
                }
                if (!PersistenceContext.IsExisting)
                {
                    PersistenceContext.BeginTransaction(sessionContext);
                }
                Objekt    value     = ObjektFactory.Find("3c757b8d46364133a2061a455394d640@Value");
                Objekt    value2    = ObjektFactory.Find("97dff0c8a32542bc8c28e5c10c9cc3c9@Value");
                string    value3    = $"{message}发生在{HttpContext.Current.Request.RawUrl},错误堆栈{stackTrace}";
                SystemLog systemLog = new SystemLog();
                systemLog.SetProperty("type", value);
                systemLog.SetProperty("logType", value2);
                systemLog.SetProperty("abstract", message);
                systemLog.SetProperty("detail", value3);
                systemLog.Save();
                PersistenceContext.Accept();
            }
            catch
            {
                PersistenceContext.Discard();
            }
        }
Ejemplo n.º 27
0
        private void InitView(int bit, int pxlx)//bit=0 图标 bit=1 床头卡 pxlx 0=床位号,1=病人姓名
        {
            string S_Data = "";
            string sSql   = "";

            try
            {
                if (bit == 1)
                {
                    int x = 9;
                    int y = 9;



                    //Modify by Tany 2005-02-24
                    //增加停用标志


                    this.panelBed.Controls.Clear();
                    if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                    {
                        SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
                    }

                    stagArr = new string[BedTb.Rows.Count];

                    if (BedTb.Rows.Count == 0)
                    {
                        return;
                    }

                    for (int i = 0; i <= BedTb.Rows.Count - 1; i++)
                    {
                        Button bt = new Button();

                        bt.AllowDrop = true;
                        bt.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(217)), ((System.Byte)(227)), ((System.Byte)(236)));
                        bt.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
                        bt.Font      = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                        bt.Size      = new System.Drawing.Size(120, 185 + 30);//80,105
                        bt.TextAlign = System.Drawing.ContentAlignment.TopLeft;
                        bt.Location  = new System.Drawing.Point(x, y);
                        bt.Click    += new EventHandler(bt_Click);
                        string ypfy = BedTb.Rows[i]["ypfy"].ToString();
                        string ypbl = " ";
                        try
                        {
                            if (BedTb.Rows[i]["inpatient_id"].ToString().Trim() != "" && BedTb.Rows[i]["zfy"].ToString().Trim() != "0")
                            {
                                ypbl = (Convert.ToDecimal(Convert.ToDouble(BedTb.Rows[i]["ypfy"].ToString()) * 100 / Convert.ToDouble(BedTb.Rows[i]["zfy"].ToString()))).ToString("0.00") + "%";
                            }
                            else
                            {
                                ypbl = "0%";
                            }
                        }
                        catch {
                            // MessageBox.Show(BedTb.Rows[i]["ypfy"].ToString() + "  :" + BedTb.Rows[i]["zfy"].ToString());
                        }
                        bt.Name = "bt" + i.ToString() + "," + BedTb.Rows[i]["WARD_NAME"].ToString() + "," + BedTb.Rows[i]["OUT_DATE"].ToString() + ","
                                  + BedTb.Rows[i]["OUT_DIAGNOSIS"].ToString() + "," + BedTb.Rows[i]["zfy"].ToString() + "," + BedTb.Rows[i]["ye"].ToString()
                                  + "," + BedTb.Rows[i]["ryts"].ToString() + "," + "(" + BedTb.Rows[i]["BF_NO"].ToString().Trim() + "床 )"
                                  + "," + ypfy.ToString() + "," + ypbl + "," + BedTb.Rows[i]["inpatient_id"].ToString();
                        bt.Paint += new System.Windows.Forms.PaintEventHandler(button_Paint);
                        //bt.Click += new EventHandler(bt_Click);
                        //						bt.DoubleClick += new EventHandler(bt_DoubleClick);
                        // bt.MouseDown += new MouseEventHandler(bt_MouseDown);
                        //						bt.MouseHover += new EventHandler(bt_Click);

                        if (x + 249 >= this.panelBed.Width)
                        {
                            y = y + 114 + 80 + 30;
                            x = this.panelBed.Location.X + 9 - 3;
                        }
                        else
                        {
                            x = x + 129;
                        }


                        int ll = 0;
                        //床号10位
                        if (BedTb.Rows[i]["bed_no"].ToString().Trim().Length <= 10)
                        {
                            ll     = 10 - BedTb.Rows[i]["bed_no"].ToString().Trim().Length;
                            bt.Tag = BedTb.Rows[i]["bed_no"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["bed_no"].ToString().Trim().Substring(0, 10);
                        }
                        //姓名6位
                        if (BedTb.Rows[i]["name"].ToString().Trim().Length <= 6)
                        {
                            ll     = 6 - BedTb.Rows[i]["name"].ToString().Trim().Length;
                            bt.Tag = bt.Tag + BedTb.Rows[i]["name"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["name"].ToString().Trim().Substring(0, 6);
                        }
                        //性别2位
                        if (BedTb.Rows[i]["sex_name"].ToString().Trim().Length <= 2)
                        {
                            ll     = 2 - BedTb.Rows[i]["sex_name"].ToString().Trim().Length;
                            bt.Tag = bt.Tag + BedTb.Rows[i]["sex_name"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["sex_name"].ToString().Trim().Substring(0, 2);
                        }
                        //年龄3位
                        if (BedTb.Rows[i]["age"].ToString().Trim().Length <= 3)
                        {
                            ll     = 3 - BedTb.Rows[i]["age"].ToString().Trim().Length;
                            bt.Tag = bt.Tag + BedTb.Rows[i]["age"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["age"].ToString().Trim().Substring(0, 3);
                        }
                        //费用类别6位
                        if (BedTb.Rows[i]["jsfs_name"].ToString().Trim().Length <= 6)
                        {
                            ll     = 6 - BedTb.Rows[i]["jsfs_name"].ToString().Trim().Length;
                            bt.Tag = bt.Tag + BedTb.Rows[i]["jsfs_name"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["jsfs_name"].ToString().Trim().Substring(0, 6);
                        }
                        //住院号10位
                        if (BedTb.Rows[i]["inpatient_no"].ToString().Trim().Length <= 10)
                        {
                            ll     = 10 - BedTb.Rows[i]["inpatient_no"].ToString().Trim().Length;
                            bt.Tag = bt.Tag + BedTb.Rows[i]["inpatient_no"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["inpatient_no"].ToString().Trim().Substring(0, 10);
                        }
                        //病情10位
                        string s_bq = "";
                        if (BedTb.Rows[i]["order_bw"].ToString() != "0" && BedTb.Rows[i]["order_bw"].ToString() != "" && BedTb.Rows[i]["inpatient_no"].ToString() != "")
                        {
                            s_bq = s_bq + "*" + "病危";
                        }
                        if (BedTb.Rows[i]["order_bz"].ToString() != "0" && BedTb.Rows[i]["order_bz"].ToString() != "" && BedTb.Rows[i]["inpatient_no"].ToString() != "")
                        {
                            s_bq = s_bq + "△" + "病重";
                        }
                        if (s_bq.Length <= 10)
                        {
                            ll     = 10 - s_bq.Length;
                            bt.Tag = bt.Tag + s_bq + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag += BedTb.Rows[i]["inpatient_no"].ToString().Trim().Substring(0, 10);
                        }
                        //护理10位
                        string s_hl = "";
                        switch (BedTb.Rows[i]["TENDLEVEL"].ToString())
                        {
                        case "4":
                            s_hl = "特级护理";
                            break;

                        case "3":
                            s_hl = "一级护理";
                            break;

                        case "2":
                            s_hl = "二级护理";
                            break;

                        case "1":
                            s_hl = "三级护理";
                            break;
                        }
                        if (s_hl.Length <= 10)
                        {
                            ll     = 10 - s_hl.Length;
                            bt.Tag = bt.Tag + s_hl + Space(ll);
                        }
                        else
                        {
                            //bt.Tag = bt.Tag + BedTb.Rows[i]["in_diagnosis"].ToString().Trim().Substring(0, 10);
                            //Modify by Tany 2010-03-17 入院诊断名称
                            bt.Tag = bt.Tag + BedTb.Rows[i]["ryzd"].ToString().Trim().Substring(0, 10);
                        }
                        //诊断10位
                        if (BedTb.Rows[i]["ryzd"].ToString().Trim().Length <= 10)
                        {
                            ll     = 10 - BedTb.Rows[i]["ryzd"].ToString().Trim().Length;
                            bt.Tag = bt.Tag + BedTb.Rows[i]["ryzd"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["ryzd"].ToString().Trim().Substring(0, 10);
                        }
                        //入院时间10位
                        if (BedTb.Rows[i]["in_date"].ToString().Trim().Length <= 10)
                        {
                            ll     = 10 - BedTb.Rows[i]["in_date"].ToString().Trim().Length;
                            bt.Tag = bt.Tag + BedTb.Rows[i]["in_date"].ToString().Trim() + Space(ll);
                        }
                        else
                        {
                            bt.Tag = bt.Tag + BedTb.Rows[i]["in_date"].ToString().Trim().Substring(0, 10);
                        }
                        //母婴同室6位
                        string s_myts = "";
                        if (BedTb.Rows[i]["ismyts"].ToString() == "1")
                        {
                            s_myts = "(母婴同室)";
                        }
                        else
                        {
                            s_myts = Space(6);
                        }
                        bt.Tag = bt.Tag + s_myts;
                        //包房3位
                        string s_bf = "";
                        if (BedTb.Rows[i]["isbf"].ToString() == "1")
                        {
                            s_bf = "(包)";
                        }
                        else
                        {
                            s_bf = Space(3);
                        }
                        bt.Tag = bt.Tag + s_bf;
                        //出院状态6位
                        string s_cy = "";
                        if (BedTb.Rows[i]["FLAG"].ToString() == "4")
                        {
                            s_cy = "(申请出院)";
                        }
                        else
                        {
                            s_cy = Space(6);
                        }
                        bt.Tag = bt.Tag + s_cy;


                        if (BedTb.Rows[i]["inpatient_id"].ToString().Trim() == "" || BedTb.Rows[i]["inpatient_no"].ToString().Trim() == "")
                        {
                            bt.TabIndex  = 0;
                            bt.BackColor = System.Drawing.Color.WhiteSmoke; //System.Drawing.Color.FromArgb(((System.Byte)(217)), ((System.Byte)(227)), ((System.Byte)(236)));

                            if (BedTb.Rows[i]["IsQj"].ToString().Trim() == "1")
                            {
                                bt.BackColor = System.Drawing.Color.Red;
                            }
                            if (BedTb.Rows[i]["ISPLUS"].ToString().Trim() == "1")
                            {
                                bt.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(152)), ((System.Byte)(251)), ((System.Byte)(152)));
                            }
                        }
                        else
                        {
                            if (BedTb.Rows[i]["IsQj"].ToString().Trim() == "1")
                            {
                                bt.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(160)), ((System.Byte)(122)));
                            }
                            if (BedTb.Rows[i]["ISPLUS"].ToString().Trim() == "1")
                            {
                                bt.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(255)), ((System.Byte)(255)));
                            }

                            if (this.maskedTextBox1.Text.Trim() != "")
                            {
                                if (Convert.ToDecimal(BedTb.Rows[i]["zfy"].ToString()) >= Convert.ToDecimal(this.maskedTextBox1.Text.Trim()))
                                {
                                    bt.BackColor = System.Drawing.Color.Gold;
                                }
                            }

                            int m     = 0;                               //护理级别
                            int n     = 0;                               //图片位置
                            int _type = 0;                               //类型
                            if (BedTb.Rows[i]["FLAG"].ToString() == "4") //申请出院
                            {
                                //死亡
                                if (Convert.ToInt32(BedTb.Rows[i]["OUT_MODE"]) == 4)
                                {
                                    _type = 1;
                                }
                                else
                                {
                                    _type = 2;
                                }
                                n           = GetBedImgNO(BedTb.Rows[i]["SEX_NAME"].ToString().Trim(), Convert.ToInt32(BedTb.Rows[i]["AGE"]), _type, Convert.ToInt32(BedTb.Rows[i]["ISMYTS"]));
                                bt.TabIndex = n;
                            }
                            else
                            {
                                m = (Convert.ToString(BedTb.Rows[i]["TENDLEVEL"]).Trim() == "" ? 0 : Convert.ToInt32(BedTb.Rows[i]["TENDLEVEL"]));  // 护理级别
                                switch (m)
                                {
                                case 0:    //普通
                                    _type = 0;
                                    break;

                                case 1:    //三级
                                    _type = 5;
                                    break;

                                case 2:    //二级
                                    _type = 4;
                                    break;

                                case 3:    //一级
                                    _type = 3;
                                    break;

                                case 4:    //特级
                                    _type = 6;
                                    break;

                                default:
                                    _type = 0;
                                    break;
                                }
                                n           = GetBedImgNO(BedTb.Rows[i]["SEX_NAME"].ToString().Trim(), Convert.ToInt32(BedTb.Rows[i]["AGE"]), _type, Convert.ToInt32(BedTb.Rows[i]["ISMYTS"]));
                                bt.TabIndex = n;
                            }
                        }


                        this.toolTip1.SetToolTip(bt, "床        号:" + bt.Tag.ToString().Substring(0, 10).Trim() +
                                                 bt.Tag.ToString().Substring(77, 6).Trim() + bt.Tag.ToString().Substring(83, 3).Trim() + bt.Tag.ToString().Substring(86, 6).Trim() + "\n" +
                                                 "姓        名:" + bt.Tag.ToString().Substring(10, 6) + "\n" +
                                                 "性        别:" + bt.Tag.ToString().Substring(16, 2) + "\n" +
                                                 "年        龄:" + bt.Tag.ToString().Substring(18, 3) + "\n" +
                                                 "费用类别:" + bt.Tag.ToString().Substring(21, 6) + "\n" +
                                                 "住  院  号:" + bt.Tag.ToString().Substring(27, 10) + "\n" +
                                                 "病        情:" + bt.Tag.ToString().Substring(37, 10) + "\n" +
                                                 "护理级别:" + bt.Tag.ToString().Substring(47, 10) + "\n" +
                                                 "入院诊断:" + bt.Tag.ToString().Substring(57, 10) + "\n" +
                                                 "入院日期:" + bt.Tag.ToString().Substring(67, 10));

                        stagArr[i] = BedTb.Rows[i]["stag"].ToString();
                        this.panelBed.Controls.Add(bt);
                    }
                }

                // rtbMsg.Text = ShowMsgText();
            }
            catch (Exception err)
            {
                //写错误日志 Add By Tany 2005-01-12
                SystemLog _systemErrLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "程序错误", "错误:" + err.Message + "  Source:" + err.Source, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);
                _systemErrLog.Save();
                _systemErrLog = null;

                MessageBox.Show("错误:" + err.Message + "\n" + "Source:" + err.Source, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            // PostMessage(this.listView1.Handle.ToInt32(), 0x020A, 0, 0);
        }
Ejemplo n.º 28
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            if (Yp.是否药库(InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase) == true)
            {
                MessageBox.Show("您现在进入的是药房系统,请核实您当前登陆的科室是否正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            #region 先上传发药明细
            butsc_Click(sender, e);
            #endregion

            string stext = "";
            if (_menuTag.Function_Name.Trim() != "Fun_ts_yf_unymjz")
            {
                #region 系统对账


                //系统对账
                this.Text = "正在进行系统对账.....";
                try
                {
                    this.Cursor = PubStaticFun.WaitCursor();

                    ParameterEx[] parameters = new ParameterEx[2];
                    parameters[0].Text  = "@jsrq";
                    parameters[1].Text  = "@deptid";
                    parameters[0].Value = dtp1.Value.ToString();// dtp1.Value.ToShortDateString();
                    parameters[1].Value = InstanceForm.BCurrentDept.DeptId;
                    DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_YF_XTDZ", parameters, 60);
                    tb.TableName = "myTb";

                    if (tb.Rows.Count > 0)
                    {
                        this.Close();
                        Frmxtdzmx f = new Frmxtdzmx(_menuTag, _chineseName, _mdiParent);
                        f.MdiParent = _mdiParent;
                        f.Show();
                        f.FillData(tb);
                        return;
                    }

                    if (_menuTag.Function_Name.Trim() == "Fun_ts_yf_xtdz")
                    {
                        MessageBox.Show("系统对帐完成");
                        this.Text = stext;
                        this.Close();
                        return;
                    }
                }
                catch (System.Exception err)
                {
                    MessageBox.Show("出错" + err.Message);
                    return;
                }
                finally
                {
                    this.Cursor = Cursors.Arrow;
                }

                #endregion
            }

            #region 取消上次月结

            //取消上次月结
            if (_menuTag.Function_Name.Trim() == "Fun_ts_yf_unymjz" &&
                MessageBox.Show("您确定要取消 [" + txtbz.Text + "] 这次月结吗 ?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                this.Cursor = PubStaticFun.WaitCursor();
                this.Text   = "正在取消上次月结.....";

                try
                {
                    int    err_code = -1;
                    string err_text = "";

                    InstanceForm.BDatabase.BeginTransaction();

                    ParameterEx[] parameters = new ParameterEx[5];
                    parameters[0].Text  = "@deptid";
                    parameters[0].Value = InstanceForm.BCurrentDept.DeptId;

                    parameters[1].Text  = "@djsj";
                    parameters[1].Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();

                    parameters[2].Text  = "@djy";
                    parameters[2].Value = InstanceForm.BCurrentUser.EmployeeId;

                    parameters[3].Text          = "@err_code";
                    parameters[3].ParaDirection = ParameterDirection.Output;
                    parameters[3].DataType      = System.Data.DbType.Int32;
                    parameters[3].ParaSize      = 100;

                    parameters[4].Text          = "@err_text";
                    parameters[4].ParaDirection = ParameterDirection.Output;
                    parameters[4].ParaSize      = 100;


                    InstanceForm.BDatabase.DoCommand("sp_Yf_unymjc", parameters, 60);
                    err_code = Convert.ToInt32(parameters[3].Value);
                    err_text = Convert.ToString(parameters[4].Value);

                    if (err_code != 0)
                    {
                        throw new Exception(err_text);
                    }
                    InstanceForm.BDatabase.CommitTransaction();

                    this.Text = stext;

                    #region 日志记录
                    string str_old = "";
                    str_old = InstanceForm.BCurrentUser.Name + "取消月结.上次月结时间是" + dtp1.Value.ToString() + " 到:" + dtp2.Value.ToString();
                    SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "取消月结", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 8);
                    systemLog.Save();
                    systemLog = null;
                    #endregion

                    MessageBox.Show(err_text);
                    this.Close();
                    return;
                }
                catch (System.Exception err)
                {
                    InstanceForm.BDatabase.RollbackTransaction();
                    this.butok.Enabled = true;
                    MessageBox.Show(err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    this.Cursor = Cursors.Arrow;
                }
            }
            #endregion

            #region 月未结账

            if (_menuTag.Function_Name.Trim() != "Fun_ts_yf_ymjz")
            {
                return;
            }


            //月未结帐
            this.Text = "正在进行月未结帐.....";

            try
            {
                if (dtp2.Value < dtp1.Value)
                {
                    MessageBox.Show("月结止日期不能小于开始日期", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (dtp2.Value > DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase))
                {
                    MessageBox.Show("月结止日期不能大于系统当前时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                butok.Enabled = false;
                this.Cursor   = PubStaticFun.WaitCursor();
                int    err_code = -1;
                string err_text = "";

                InstanceForm.BDatabase.BeginTransaction();

                ParameterEx[] parameters = new ParameterEx[9];
                parameters[0].Text  = "@year";
                parameters[0].Value = _year;

                parameters[1].Text  = "@month";
                parameters[1].Value = _month;

                parameters[2].Text  = "@deptid";
                parameters[2].Value = InstanceForm.BCurrentDept.DeptId;

                parameters[3].Text  = "@ksrq";
                parameters[3].Value = dtp1.Value.ToString();//dtp1.Value.ToShortDateString();;

                parameters[4].Text  = "@jsrq";
                parameters[4].Value = dtp2.Value.ToString(); //dtp2.Value.ToShortDateString();

                parameters[5].Text  = "@djsj";
                parameters[5].Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();

                parameters[6].Text  = "@djy";
                parameters[6].Value = InstanceForm.BCurrentUser.EmployeeId;

                parameters[7].Text          = "@err_code";
                parameters[7].ParaDirection = ParameterDirection.Output;
                parameters[7].DataType      = System.Data.DbType.Int32;
                parameters[7].ParaSize      = 100;

                parameters[8].Text          = "@err_text";
                parameters[8].ParaDirection = ParameterDirection.Output;
                parameters[8].ParaSize      = 100;


                InstanceForm.BDatabase.DoCommand("sp_YF_ymjc", parameters, 60);
                err_code = Convert.ToInt32(parameters[7].Value);
                err_text = Convert.ToString(parameters[8].Value);


                if (err_code != 0)
                {
                    throw new System.Exception(err_text);
                }

                InstanceForm.BDatabase.CommitTransaction();

                YMJC   ymjc    = new YMJC(InstanceForm.BDatabase);
                string message = "";
                bool   bOk     = ymjc.GenerateDetailData(InstanceForm.BCurrentDept.DeptId, _year, _month, out message);
                if (!bOk)
                {
                    this.Text = stext;
                    MessageBox.Show("月结成功,但生成中间表数据失败,请联系管理员处理", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    butok.Enabled = true;
                    this.Close();
                    return;
                }

                this.Text = stext;
                MessageBox.Show(err_text);
                butok.Enabled = true;
                this.Close();
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                this.butok.Enabled = true;
                MessageBox.Show(err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
            #endregion
        }
Ejemplo n.º 29
0
        private void buttzx_Click(object sender, EventArgs e)
        {
            bool _qfExeCurDeptOrder = false;//欠费是否能够发送本科室医嘱

            if (ClassStatic.Current_BinID == null || ClassStatic.Current_BinID == Guid.Empty)
            {
                MessageBox.Show("没有找到病人信息,请重新确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            decimal   _orderfee   = 0;
            int       GroupID     = -999;
            int       iMNGType    = 0;
            int       iSelectRows = 0;
            DataTable myTb        = (DataTable)myDataGrid1.DataSource;
            DateTime  ExecDate    = Convert.ToDateTime(Convertor.IsNull(((Button)sender).Tag, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString()));

            #region  效性判断
            for (int i = 0; i <= myTb.Rows.Count - 1; i++)
            {
                if (myTb.Rows[i]["选"].ToString() == "True")
                {
                    iSelectRows += 1;
                }
            }

            if (iSelectRows == 0)
            {
                MessageBox.Show(this, "对不起,没有选择医嘱!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion

            iMNGType             = GetMNGType();
            progressBar1.Maximum = myTb.Rows.Count;
            progressBar1.Value   = 0;
            for (int i = 0; i <= myTb.Rows.Count - 1; i++)
            {
                //如果是选择发送
                if (myTb.Rows[i]["选"].ToString() == "True")
                {
                    //如果组号与上一条医嘱相同,则不执行
                    if (GroupID == Convert.ToInt32(myTb.Rows[i]["Group_ID"]))
                    {
                        if (_orderfee > 0)
                        {
                            myTb.Rows[i]["选"] = false;
                        }
                        continue;
                    }

                    GroupID = Convert.ToInt32(myTb.Rows[i]["Group_ID"]);

                    _orderfee           = myFunc.GetOrderFee(ClassStatic.Current_BinID, ClassStatic.Current_BabyID, iMNGType, GroupID, ExecDate, ExecDate);
                    progressBar1.Value += 1;

                    if (_orderfee > 0)
                    {
                        myTb.Rows[i]["选"] = false;
                    }
                }
            }
            try
            {
                string[] rtnSql = ts_zyhs_classes.BaseFunc.GetBrzt(ClassStatic.Current_BinID);
                int      BrJgbm = Convert.ToInt32(rtnSql[1]);
                //发送
                myFunc.ExecOrdersWithData(this.myDataGrid1, iMNGType, 1, this.progressBar1, ClassStatic.Current_BinID, Convert.ToInt64(ClassStatic.Current_BabyID), ExecDate, ExecDate, _qfExeCurDeptOrder, BrJgbm);
                //myFunc.ExecOrdersWithData(this.myDataGrid1, 2, 1, this.progressBar1, ClassStatic.Current_BinID, Convert.ToInt64(ClassStatic.Current_BabyID), ExecDate, ExecDate, _qfExeCurDeptOrder, BrJgbm);
                MessageBox.Show("发送完毕!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //刷新界面
                this.tabControl1_SelectedIndexChanged(sender, e);
            }
            catch (Exception err)
            {
                SystemLog _systemErrLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "程序错误", "医嘱执行错误:" + err.Message + "  Source:" + err.Source, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 1, "主机名:" + System.Environment.MachineName, 39);
                _systemErrLog.Save();
                _systemErrLog = null;

                MessageBox.Show("错误:" + err.Message + "\n" + "Source:" + err.Source + "\n\n数据已经回滚,请检查后重新执行!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                progressBar1.Value = 0;

                return;
            }
        }