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(); }
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(); }