/// <summary> /// 保存参数设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (!updateFlag) { ////ID自增设置 chp.Id = App.GenId("T_QUALITY_VAR_HLB", "ID"); } //文书类型 if (cboTextKind.SelectedIndex != 0) { chp.Document_Type = Convert.ToInt32(this.cboTextKind.SelectedValue.ToString()); } else { App.MsgErr("请选择文书类型"); return; } //监控子项 if (this.cboMonitoring.Enabled == false) { chp.Sub_Item = 0; } else { chp.Sub_Item = Convert.ToInt32(this.cboMonitoring.SelectedValue.ToString()); } //监控患者类型 if (cboMonitorType.SelectedIndex != 0) { chp.Inpatient_Type = Convert.ToInt32(this.cboMonitorType.SelectedValue.ToString()); } else { App.MsgErr("请选择监控患者类型"); return; } //执行周期 if (txtExecCycles.Enabled == true && cboCyclesUnit.Enabled == true) { if (txtExecCycles.Text == "" || txtExecCycles.Text == null || cboCyclesUnit.SelectedItem.ToString() == "" || cboCyclesUnit.SelectedItem.ToString() == null) { App.MsgErr("请输入执行周期"); return; } chp.Runcycle = Convert.ToInt32(txtExecCycles.Text); chp.Runcycleunit = cboCyclesUnit.SelectedItem.ToString(); } else { chp.Runcycle = 0; chp.Runcycleunit = ""; } //参考时间 if (cboCKTime.SelectedIndex != 0) { chp.Base_Time = Convert.ToInt32(this.cboCKTime.SelectedValue.ToString()); } else { App.MsgErr("请选择参考时间"); return; } //是否预警 if (this.rdoIsOverAlert.Checked == true) { chp.Isprealert = 'Y'; } else { chp.Isprealert = 'N'; } //超时补上是否扣分 if (this.rdoIsMend.Checked == true) { chp.Is_Renew = 'Y'; } else { chp.Is_Renew = 'N'; } //是否当天检查一次 if (this.rdoIsCheck.Checked == true) { chp.Istoday = 'Y'; //是 } else { chp.Istoday = 'N'; } if (this.txtPrealertTime.Enabled == true) { //预警时间 if (this.txtPrealertTime.Text != "") { chp.Prealerttime = Convert.ToInt32(this.txtPrealertTime.Text); //预警时间 chp.Pretimeunit = this.cboPrealertUnit.SelectedItem.ToString(); //预警单位 } else { App.Msg("请输入预警时间"); } } else { chp.Prealerttime = 0; //预警时间 chp.Pretimeunit = ""; //预警单位 } //扣分值 if (txtDeduction.Enabled == true) { chp.Take_Grade = Convert.ToDouble(this.txtDeduction.Text); } //是否提醒 if (this.rdoIsNotice.Checked == true) { chp.Is_Notice = 'Y'; } else { chp.Is_Notice = 'N'; } chp.Isoveralert = 'Y'; //警告 chp.Overalerttime = 0; //报警提前时间(超过) chp.Overtimeunit = ""; //报警提前时间单位(超过) chp.ThreadState = 1; //线程状态-----------默认为1,启动 chp.Fix_Time = Con_CheckBoxListUtil.GetCheckedItems(this.gpbFixTime); //固定执行时间点 if (txtItemMax.Text != "") { chp.Item_Max = float.Parse(txtItemMax.Text); } else { chp.Item_Max = 0f; } if (txtItemMin.Text != "") { chp.Item_Min = float.Parse(txtItemMin.Text); } else { chp.Item_Min = 0f; } if (this.txtExceTimes.Text == null || this.txtExceTimes.Text == "") { chp.ExceTimes = 1; } else { chp.ExceTimes = Convert.ToInt32(this.txtExceTimes.Text); } if (updateFlag)//=true 修改 { string temp = "update t_quality_var_hlb hlb set hlb.document_type=" + chp.Document_Type + ",hlb.sub_item=" + chp.Sub_Item + ",hlb.inpatient_type=" + chp.Inpatient_Type + ",hlb.base_time=" + chp.Base_Time + ",hlb.runcycle=" + chp.Runcycle + ",hlb.runcycleunit='" + chp.Runcycleunit + "',hlb.isprealert='" + chp.Isprealert + "',hlb.prealerttime=" + chp.Prealerttime + ",hlb.pretimeunit='" + chp.Pretimeunit + "',hlb.isoveralert='" + chp.Isoveralert + "',hlb.overalerttime=" + chp.Overalerttime + ",hlb.overtimeunit='" + chp.Overtimeunit + "',hlb.take_grade=" + chp.Take_Grade + ",hlb.is_notice='" + chp.Is_Notice + "',hlb.is_renew='" + chp.Is_Renew + "',hlb.fix_time='" + chp.Fix_Time + "',hlb.istoday='" + chp.Istoday + "',hlb.excetimes=" + chp.ExceTimes + ",hlb.threadstate=" + chp.ThreadState + ",hlb.item_max=" + chp.Item_Max + ",hlb.item_min=" + chp.Item_Min + "where hlb.id=" + chp.Id; int i = 0; DialogResult result = MessageBox.Show("数据已修改,确认要保存?", "消息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { i = App.ExecuteSQL(temp); } else { return; } if (i > 0) { App.Msg("修改成功!"); QualityView(); ResetAll(); } else { App.MsgErr("修改失败!"); } } else //新增 { string temp = "insert into T_QUALITY_VAR_HLB values(" + chp.Id + "," + chp.Document_Type + "," + chp.Sub_Item + "," + "" + chp.Inpatient_Type + "," + chp.Base_Time + "," + chp.Runcycle + "," + "'" + chp.Runcycleunit + "','" + chp.Isprealert + "'," + chp.Prealerttime + ",'" + chp.Pretimeunit + "'," + "'" + chp.Isoveralert + "'," + chp.Overalerttime + ",'" + chp.Overtimeunit + "'," + "" + chp.Take_Grade + ",'" + chp.Is_Notice + "','" + chp.Is_Renew + "'," + "'" + chp.Fix_Time + "','" + chp.Istoday + "'," + chp.ExceTimes + "," + chp.ThreadState + "," + chp.Item_Max + "," + chp.Item_Min + ")"; int i = 0; DialogResult result = MessageBox.Show("确认要保存数据?", "消息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { i = App.ExecuteSQL(temp); } else { return; } if (i > 0) { App.Msg("添加成功!"); QualityView(); ResetAll(); } else { App.MsgErr("添加失败!"); } } }
private void btnSave_Click(object sender, EventArgs e) { if (chkSectionListBox.CheckedItems.Count <= 0) { //老代码注释掉 //App.MsgErr("请选择科室"); //return; #region 消息提醒使用 if (strT_Msg_Setting == 3) { App.MsgErr("请选择病区"); return; } else { App.MsgErr("请选择科室"); return; } #endregion } if (id != null) { ywcSectionID = Con_CheckBoxListUtil.GetCheckedItems(chkSectionListBox); string tempUpdate = "update t_quality_var_ywc t set t.effect_section='" + ywcSectionID + "' where t.id=" + id; int i = 0; DialogResult resultUpdate = MessageBox.Show("确认要保存已修改的数据?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (resultUpdate == DialogResult.OK) { i = App.ExecuteSQL(tempUpdate); } else { return; } if (i > 0) { App.Msg("数据修改成功!"); ShowUpdate(true); this.Close(); return; } else { App.MsgErr("数据修改失败!"); return; } } else { DialogResult resultInsert = MessageBox.Show("确认要保存数据?", "消息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (resultInsert == DialogResult.OK) { //老代码注释掉 //ywcSectionID = Con_CheckBoxListUtil.GetCheckedItems(chkSectionListBox); //ywcSectionName = Con_CheckBoxListUtil.GetCheckedItemsValue(chkSectionListBox); //ShowTextBoxValue(); //this.Close(); #region 消息提醒使用 flag = true;//消息提醒 if (strT_Msg_Setting != 1 && strT_Msg_Setting != 2 && strT_Msg_Setting != 3) { ywcSectionID = Con_CheckBoxListUtil.GetCheckedItems(chkSectionListBox); ywcSectionName = Con_CheckBoxListUtil.GetCheckedItemsValue(chkSectionListBox); ShowTextBoxValue(); this.Close(); } else//消息提醒使用 { ywcSectionID = Con_CheckBoxListUtil.GetCheckedItems(chkSectionListBox); ywcSectionName = Con_CheckBoxListUtil.GetCheckedItemsValue(chkSectionListBox); this.Close(); } #endregion } } }