public static void Reflocation(UcInout_Amount ucAmount) { x = 0; y = 0; flag = false; Pal.Controls.Remove(ucAmount); foreach (Control control in Pal.Controls) { UcInout_Amount amount = control as UcInout_Amount; if (flag) { y = y + amount.Height; } amount.Location = new System.Drawing.Point(x, y); flag = true; } }
/// <summary> /// 添加项目 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { int count = 0; if (panel1.Controls.Count > 0) { foreach (Control control in panel1.Controls) { //UcInout_Amount.UcInout_Amount amount = (UcInout_Amount.UcInout_Amount)control; UcInout_Amount amount = (UcInout_Amount)control; if (amount.txtValue.Text != "" && IsFloat(amount.txtValue.Text)) { string userName = null; string userId = null; if (App.UserAccount.UserInfo != null) { userName = App.UserAccount.UserInfo.User_name; userId = App.UserAccount.UserInfo.User_id; } string sql = "insert into t_inout_amount_record (pid,record_time,record_id,record_name,item_code,item_value)" + " values('" + Pid + "',to_timestamp(to_char(sysdate,'yyyy-MM-dd hh24:mi'),'yyyy-MM-dd hh24:mi'),'" + userId + "'," + "'" + userName + "','" + amount.Item_code + "','" + amount.txtValue.Text + "')"; try { count += App.ExecuteSQL(sql); } catch { } } else { App.MsgErr("请输入大于的数字!"); } } if (count > 0) { App.Msg("保存成功!"); ShowSumGrid(); } else { App.Msg("保存失败!"); } } }
/// <summary> /// 添加其他项 /// </summary> /// <param name="Itemname"></param> /// <param name="Itemcode"></param> public static void OtherName(string Itemname, string Itemcode) { UcInout_Amount amounts = new UcInout_Amount(Itemname, Itemcode, false); //订阅事件 amounts.EventRef += new RefPanel(Reflocation); amounts.Name = Itemcode; y = y + amounts.Height; amounts.Location = new System.Drawing.Point(x, y); if (y > 325) { Pal.Size = new System.Drawing.Size(349, y + 5); } Pal.Controls.Add(amounts); //int ys = 0; //foreach (Control control in Pal.Controls) //{ // UcInout_Amount amount = control as UcInout_Amount; // if (amount.Item_code == amounts.Name) // { // ys = ys + amount.Height; // if (y > 325) // { // Pal.Size = new System.Drawing.Size(349, ys + 5); // } // amount.Location = new System.Drawing.Point(x, ys); // ys = ys + amount.Height; // amounts.Location = new System.Drawing.Point(x, ys); // Pal.Controls.Add(amounts); // } // else // { // ys = ys + amount.Height; // if (y > 325) // { // Pal.Size = new System.Drawing.Size(349, y + 5); // } // amount.Location = new System.Drawing.Point(x, y); // } //} }
/// <summary> /// 判断当前选中的节点在Panel2里面是否已经存在,存在不做任何操作,不存在添加到Panel1 /// </summary> /// <param name="node">当前选中的节点</param> /// <returns>true 已经存在,false 不存在</returns> private bool IsSameItem(TreeNode node) { bool flag = false; foreach (Control control in panel2.Controls) { if (!control.GetType().FullName.Contains("ButtonX")) { UcInout_Amount Ucamount = control as UcInout_Amount; if (Ucamount != null) { if (node.Name == Ucamount.Item_code) { flag = true; break; } } } } return(flag); }
private void btnSave_Click_1(object sender, EventArgs e) { ArrayList Sqls = new ArrayList(); Sqls.Clear(); string sql = ""; //string Sql = "select * from t_inout_summ t where PATIENT_ID='" + Pid + "' and to_char(start_time,'yyyy-MM-dd hh24:mi')<='" + RecodeTime + "' and '" + RecodeTime + "'<=to_char(end_time,'yyyy-MM-dd hh24:mi')"; //DataSet ds = App.GetDataSet(Sql); if (panel2.Controls.Count > 0) { foreach (Control control in panel2.Controls) { if (!control.GetType().FullName.Contains("ButtonX")) { UcInout_Amount amount = (UcInout_Amount)control; if (amount.txtValue.Text != "" && amount.txtValue.Text != null && IsFloat(amount.txtValue.Text)) { if (amount.Name != "" && amount.Name != null) { string userName = null; string userId = null; if (App.UserAccount.UserInfo != null) { userName = App.UserAccount.UserInfo.User_name; userId = App.UserAccount.UserInfo.User_id; } string sqlSelect = string.Format(@"select count(id) count from t_inout_amount_record t where t.patient_id={0} and to_char(t.record_time,'yyyy-MM-dd hh24:mi')='{1}' and t.item_name='{2}' and t.item_value='{3}'", Patient_Id, dtpCheckDate.Value.ToString("yyyy-MM-dd HH:mm"), amount.Name, amount.txtValue.Text); string result = App.ReadSqlVal(sqlSelect, 0, "count"); if (result == "1") { continue; } else { sql = "insert into t_inout_amount_record (pid,record_time,record_id,record_name,item_code,item_value,patient_Id,Item_Name)" + " values('" + Pid + "',to_timestamp('" + dtpCheckDate.Value.ToString("yyyy-MM-dd HH:mm") + "','yyyy-MM-dd hh24:mi'),'" + userId + "'," + "'" + userName + "','" + amount.Item_code + "','" + amount.txtValue.Text + "'," + Patient_Id + ",'" + amount.Name + "')"; Sqls.Add(sql); string RecodeTime = dtpCheckDate.Value.ToString("yyyy-MM-dd HH:mm"); string Sql = "select * from t_inout_summ t where PATIENT_ID=" + Patient_Id + " and to_char(start_time,'yyyy-MM-dd hh24:mi')<='" + RecodeTime + "' and '" + RecodeTime + "'<=to_char(end_time,'yyyy-MM-dd hh24:mi')"; DataSet ds = App.GetDataSet(Sql); if (ds.Tables[0].Rows.Count > 0 && ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string sumid = ds.Tables[0].Rows[i]["id"].ToString(); /* * 109 入量 110出量 */ string ItemSql = ""; //更新的SQL语句 int currentSumIn = 0; //当前总入量 int cuttrntMOUTH_IN_SUM = 0; //当前口入量 int cuttrntPIPE_IN_SUM = 0; //当前管入量 int cuttrntVEIN_IN_SUM = 0; //当前静脉入量 int newMOUTH_IN_SUM = 0; //新的口入量 int newPIPE_IN_SUM = 0; //新的管入量 int newVEIN_IN_SUM = 0; //新的静脉入量 int newSumIn = 0; //新的总入量 int currentoutSum = 0; //当前总出量 int newoutSum = 0; //新的总出量 int currentniao = 0; //尿的总量 int currentdabian = 0; //大便总量 int currentoutu = 0; //呕吐总量 int currentxueye = 0; //渗血渗液总量 int newniao = 0; //新的尿量 int newdabian = 0; //新的大便量 int newoutu = 0; //新的呕吐量 int newxueye = 0; //新的渗血渗液总量 int currentSumyinliu = 0; //当前的引流总量 int newyinliu = 0; //新的引流总量 if (amount.ItemType.ToString() == "109") { //总入量 if (ds.Tables[0].Rows[i]["SUM_IN"].ToString().Trim() != "") { currentSumIn = Convert.ToInt32(ds.Tables[0].Rows[i]["SUM_IN"].ToString()); newSumIn = currentSumIn + Convert.ToInt32(amount.txtValue.Text); } //具体项入量 if (amount.ItemMode.ToString() == "111") { if (ds.Tables[0].Rows[i]["MOUTH_IN_SUM"] != null && ds.Tables[0].Rows[i]["MOUTH_IN_SUM"].ToString() != "") { cuttrntMOUTH_IN_SUM = Convert.ToInt32(ds.Tables[0].Rows[i]["MOUTH_IN_SUM"]); } newMOUTH_IN_SUM = cuttrntMOUTH_IN_SUM + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set SUM_IN=" + newSumIn.ToString() + ",MOUTH_IN_SUM=" + newMOUTH_IN_SUM.ToString() + " where ID=" + sumid + ""; } else if (amount.ItemMode.ToString() == "112") { if (ds.Tables[0].Rows[i]["PIPE_IN_SUM"] != null && ds.Tables[0].Rows[i]["PIPE_IN_SUM"].ToString() != "") { cuttrntPIPE_IN_SUM = Convert.ToInt32(ds.Tables[0].Rows[i]["PIPE_IN_SUM"]); } newPIPE_IN_SUM = cuttrntPIPE_IN_SUM + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set SUM_IN=" + newSumIn.ToString() + ",PIPE_IN_SUM=" + newPIPE_IN_SUM.ToString() + " where ID=" + sumid + ""; } else if (amount.ItemMode.ToString() == "113") { if (ds.Tables[0].Rows[i]["VEIN_IN_SUM"] != null && ds.Tables[0].Rows[i]["VEIN_IN_SUM"].ToString() != "") { cuttrntVEIN_IN_SUM = Convert.ToInt32(ds.Tables[0].Rows[i]["VEIN_IN_SUM"]); } newVEIN_IN_SUM = cuttrntVEIN_IN_SUM + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set SUM_IN=" + newSumIn.ToString() + ",VEIN_IN_SUM=" + newVEIN_IN_SUM.ToString() + " where ID=" + sumid + ""; } Sqls.Add(ItemSql); } else { //总出量 if (ds.Tables[0].Rows[i]["sum_out"].ToString().Trim() != "") { currentoutSum = Convert.ToInt32(ds.Tables[0].Rows[i]["sum_out"]); newoutSum = currentoutSum + Convert.ToInt32(amount.txtValue.Text); } if (amount.Name == "尿") { if (ds.Tables[0].Rows[i]["urine_amount_sum"] != null && ds.Tables[0].Rows[i]["urine_amount_sum"].ToString() != "") { currentniao = Convert.ToInt32(ds.Tables[0].Rows[i]["urine_amount_sum"]); } newniao = currentniao + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set sum_out='" + newoutSum.ToString() + "',urine_amount_sum='" + newniao.ToString() + "' where ID=" + sumid + ""; } else if (amount.Name == "大便") { if (ds.Tables[0].Rows[i]["faceces_amount_sum"] != null && ds.Tables[0].Rows[i]["faceces_amount_sum"].ToString() != "") { currentdabian = Convert.ToInt32(ds.Tables[0].Rows[i]["faceces_amount_sum"]); } newdabian = currentdabian + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set sum_out='" + newoutSum.ToString() + "',faceces_amount_sum='" + newdabian.ToString() + "' where ID=" + sumid + ""; } else if (amount.Name == "呕吐") { if (ds.Tables[0].Rows[i]["vomit_amount_sum"] != null && ds.Tables[0].Rows[i]["vomit_amount_sum"].ToString() != "") { currentoutu = Convert.ToInt32(ds.Tables[0].Rows[i]["vomit_amount_sum"]); } newoutu = currentoutu + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set sum_out='" + newoutSum.ToString() + "',vomit_amount_sum='" + newoutu.ToString() + "' where ID=" + sumid + ""; } else if (amount.Name == "渗血渗液") { if (ds.Tables[0].Rows[i]["oozingandexudate_sum"] != null && ds.Tables[0].Rows[i]["oozingandexudate_sum"].ToString() != "") { currentxueye = Convert.ToInt32(ds.Tables[0].Rows[i]["oozingandexudate_sum"]); } newxueye = currentxueye + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set sum_out='" + newoutSum.ToString() + "',oozingandexudate_sum='" + newxueye.ToString() + "' where ID=" + sumid + ""; } else if (amount.ItemType == "110" && amount.ItemMode == "0") { if (ds.Tables[0].Rows[i]["drainage_amount_sum"] != null && ds.Tables[0].Rows[i]["drainage_amount_sum"].ToString() != "") { currentSumyinliu = Convert.ToInt32(ds.Tables[0].Rows[i]["drainage_amount_sum"]); } newyinliu = currentSumyinliu + Convert.ToInt32(amount.txtValue.Text); ItemSql = "update T_INOUT_SUMM set sum_out='" + newoutSum.ToString() + "',drainage_amount_sum='" + newyinliu.ToString() + "' where ID=" + sumid + ""; } } Sqls.Add(ItemSql); } } } } } } } if (Sqls.Count > 0) { string[] strsqls = new string[Sqls.Count]; for (int i = 0; i < Sqls.Count; i++) { strsqls[i] = Sqls[i].ToString(); } if (App.ExecuteBatch(strsqls) > 0) { App.Msg("保存成功!"); UCAT.UcInout_Amount_Dist_Load(sender, e); btnReset_Click(sender, e); } else { App.Msg("保存失败!"); } } } }
//public delegate void RefPanel(UcInout_AmountC ucAmount); /// <summary> /// 显示项目编辑列表 /// </summary> private void DisProjList(TreeNodeCollection nodes) { foreach (TreeNode Pnode in nodes) { if (Pnode.Tag != null) { if (Pnode.Checked == true) { if (!IsSameItem(Pnode)) { Inout_amount_dist dist = (Inout_amount_dist)Pnode.Tag; UcInout_Amount amount = new UcInout_Amount(Pnode.Text, dist.Id.ToString(), dist.Item_type.ToString(), dist.Item_mode.ToString()); //订阅事件 amount.EventRef += new RefPanel(Reflocation); amount.Name = dist.Id.ToString(); if (flag) { y = y + amount.Height; } amount.Location = new System.Drawing.Point(x, y); if (y > 325) { Pal.Size = new System.Drawing.Size(349, y + 5); } Pal = panel2; Pal.Controls.Add(amount); flag = true; //Inout_amount_dist dist = (Inout_amount_dist)Pnode.Tag; //UcInout_AmountC amount = new UcInout_AmountC(Pnode.Text, dist.Id.ToString()); //amount.Tag = Pnode.Text.ToString() + dist.Id.ToString(); ////订阅事件 //amount.EventRef += new RefPanel(Reflocation); //amount.Name = dist.Id.ToString(); //if (flag) // amount.Location = new System.Drawing.Point(x, y); //panel2.Controls.Add(amount); ////按钮位置判断 //if (Pnode.Text == "其它" && dist.Id.ToString() == "4") //{ // btncad4.Visible = true; // ax = x + 265; // ay = y; // btncad.Location = new System.Drawing.Point(ax, ay); //} //if (Pnode.Text == "其它" && dist.Id.ToString() == "8") //{ // btncad.Visible = true; // ax = x + 265; // ay = y; // btncad4.Location = new System.Drawing.Point(ax, ay); //} //if (Pnode.Text == "其它" && dist.Id.ToString() == "17") //{ // btncad17.Visible = true; // ax = x + 265; // ay = y; // btncad17.Location = new System.Drawing.Point(ax, ay); //} //if (Pnode.Text == "其它" && dist.Id.ToString() == "30") //{ // btncad30.Visible = true; // ax = x + 265; // ay = y; // btncad30.Location = new System.Drawing.Point(ax, ay); //} //y = y + amount.Height; //flag = true; } } } if (Pnode.Nodes.Count > 0) { DisProjList(Pnode.Nodes); } } }