642 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			642 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using AIMSBLL;
 | |
| using AIMSExtension;
 | |
| using DCSoftDotfuscate;
 | |
| using DevComponents.DotNetBar;
 | |
| using DrawGraph;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| using System.Drawing;
 | |
| using System.Linq;
 | |
| using System.Runtime.Remoting.Metadata.W3cXsd2001;
 | |
| using System.Windows.Forms;
 | |
| 
 | |
| namespace AIMS.OperationAanesthesia
 | |
| {
 | |
|     public partial class frmPhysioDataEdit : Form
 | |
|     {
 | |
|         #region 界面参数
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 手术记录
 | |
|         /// </summary>
 | |
|         public OperationRecord _record;
 | |
| 
 | |
|         #endregion
 | |
| 
 | |
|         public System.Windows.Forms.Label selectTime;
 | |
|         public System.Windows.Forms.Label selectConfig;
 | |
|         public System.Windows.Forms.Panel paneltop;
 | |
|         public System.Windows.Forms.Panel paneltop2;
 | |
| 
 | |
|         #region 窗体构造函数
 | |
|         public frmPhysioDataEdit(OperationRecord operationRecord)
 | |
|         {
 | |
|             InitializeComponent();
 | |
|             _record = operationRecord;
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 窗体加载事件
 | |
|         private void FormPrintBGYYNew_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             dtpInsertBegin.Value = _record.InRoomTime.Value;
 | |
|             dtpInsertEnd.Value = _record.InRoomTime.Value.AddMinutes(240);
 | |
| 
 | |
|             int rows1 = 2;
 | |
|             //循环加载CheckBox控件
 | |
|             foreach (PhysioDataConfig ade in _record.PhysioConfigList)
 | |
|             {
 | |
|                 if (ade.IsDefalultShow == false) continue;
 | |
|                 System.Windows.Forms.Label cb = new System.Windows.Forms.Label();
 | |
|                 cb.Tag = ade;
 | |
|                 cb.Text = ade.Name;
 | |
|                 cb.Font = new System.Drawing.Font("微软雅黑", 8f);
 | |
|                 cb.Width = 75;
 | |
|                 cb.Tag = ade;
 | |
|                 cb.Location = new Point(5, rows1 * (cb.Height + 5));
 | |
|                 groupBox3.Controls.Add(cb);
 | |
| 
 | |
|                 System.Windows.Forms.TextBox text = new System.Windows.Forms.TextBox();
 | |
|                 text.Tag = ade;
 | |
|                 text.Font = new System.Drawing.Font("微软雅黑", 8f);
 | |
|                 text.Width = 40;
 | |
|                 text.Tag = ade;
 | |
|                 text.Location = new Point(80, rows1 * (cb.Height + 5));
 | |
|                 groupBox3.Controls.Add(text);
 | |
| 
 | |
|                 System.Windows.Forms.Label unit = new System.Windows.Forms.Label();
 | |
|                 unit.Tag = ade;
 | |
|                 unit.Text = ade.Unit;
 | |
|                 unit.Font = new System.Drawing.Font("微软雅黑", 7f);
 | |
|                 unit.Width = 50;
 | |
|                 unit.Tag = ade;
 | |
|                 unit.Location = new Point(120, rows1 * (unit.Height + 5));
 | |
|                 groupBox3.Controls.Add(unit);
 | |
|                 rows1++;
 | |
|             }
 | |
|             foreach (PhysioDataConfig ade in _record.PhysioAnesConfigList)
 | |
|             {
 | |
|                 if (ade.IsDefalultShow == false) continue;
 | |
|                 System.Windows.Forms.Label cb = new System.Windows.Forms.Label();
 | |
|                 cb.Tag = ade;
 | |
|                 cb.Text = ade.Name;
 | |
|                 cb.Font = new System.Drawing.Font("微软雅黑", 8f);
 | |
|                 cb.Width = 75;
 | |
|                 cb.Tag = ade;
 | |
|                 cb.Location = new Point(5, rows1 * (cb.Height + 5));
 | |
|                 groupBox3.Controls.Add(cb);
 | |
| 
 | |
|                 System.Windows.Forms.TextBox text = new System.Windows.Forms.TextBox();
 | |
|                 text.Tag = ade;
 | |
|                 text.Font = new System.Drawing.Font("微软雅黑", 8f);
 | |
|                 text.Width = 40;
 | |
|                 text.Tag = ade;
 | |
|                 text.Location = new Point(80, rows1 * (cb.Height + 5));
 | |
|                 groupBox3.Controls.Add(text);
 | |
| 
 | |
|                 System.Windows.Forms.Label unit = new System.Windows.Forms.Label();
 | |
|                 unit.Tag = ade;
 | |
|                 unit.Text = ade.Unit;
 | |
|                 unit.Font = new System.Drawing.Font("微软雅黑", 7f);
 | |
|                 unit.Width = 50;
 | |
|                 unit.Tag = ade;
 | |
|                 unit.Location = new Point(120, rows1 * (unit.Height + 5));
 | |
|                 groupBox3.Controls.Add(unit);
 | |
|                 rows1++;
 | |
|             }
 | |
| 
 | |
|             LoadPhysioData();
 | |
| 
 | |
|             btnAdd.Focus();
 | |
|         }
 | |
| 
 | |
|         private void LoadPhysioData()
 | |
|         {
 | |
|             System.Data.DataTable dtPhysioData = BOperationRecord.getByOpeIDIsPhysioData(_record.Id.Value);
 | |
| 
 | |
|             panel2.Controls.Clear();
 | |
|             int rows = 2;
 | |
|             int Width = panel2.Width - (panel2.Width / (240 / 5) * 3);
 | |
|             //循环加载麻醉体征控件  
 | |
|             for (int x = _record.PhysioAnesConfigList.Count - 1; x >= 0; x--)
 | |
|             {
 | |
|                 PhysioDataConfig ade = _record.PhysioAnesConfigList[x];
 | |
|                 if (ade.IsDefalultShow == false) continue;
 | |
|                 List<PhysioData> list = new List<PhysioData>();
 | |
|                 for (int i = 0; i < dtPhysioData.Rows.Count; i++)
 | |
|                 {
 | |
|                     if (dtPhysioData.Rows[i]["Name"].ToString().Equals(ade.Name.ToString()))
 | |
|                     {
 | |
|                         PhysioData pdTemp = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString());
 | |
|                         list.Add(pdTemp);
 | |
|                     }
 | |
|                 }
 | |
|                 System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel();
 | |
|                 panel.Tag = ade;
 | |
|                 panel.Dock = System.Windows.Forms.DockStyle.Top;
 | |
|                 panel.Size = new System.Drawing.Size(Width, 30);
 | |
|                 for (int i = (240 / ade.YAisx) - 1; i >= 0; i--)
 | |
|                 {
 | |
|                     DateTime SpanTime = _record.InRoomTime.Value.AddMinutes(i * ade.YAisx);
 | |
|                     PhysioData pdNew = null;
 | |
|                     foreach (var item in list)
 | |
|                     {
 | |
|                         if (item.RecordTime == SpanTime)
 | |
|                         {
 | |
|                             pdNew = item;
 | |
|                             pdNew.config = ade;
 | |
|                             break;
 | |
|                         }
 | |
|                     }
 | |
|                     if (pdNew == null)
 | |
|                     {
 | |
|                         pdNew = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, SpanTime, -1);
 | |
|                     }
 | |
|                     if (ade.ImgPath != null && ade.ImgPath != "")
 | |
|                     {
 | |
|                         System.Windows.Forms.ComboBox textNum = new System.Windows.Forms.ComboBox();
 | |
|                         textNum.Items.AddRange(ade.ImgPath.Split('|'));
 | |
|                         textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm");
 | |
|                         textNum.Tag = pdNew;
 | |
|                         if (pdNew.ValueString != "-1")
 | |
|                             textNum.Text = pdNew.ValueString.ToString();
 | |
|                         textNum.Width = Width / (240 / ade.YAisx);
 | |
|                         textNum.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|                         textNum.DropDownStyle = ComboBoxStyle.DropDownList;
 | |
|                         textNum.Font = new System.Drawing.Font("微软雅黑", 7f);
 | |
|                         textNum.Click += TextNum_Click;
 | |
|                         textNum.Leave += ComeBoxNum_Leave;
 | |
|                         panel.Controls.Add(textNum);
 | |
|                     }
 | |
|                     else
 | |
|                     {
 | |
|                         System.Windows.Forms.TextBox textNum = new System.Windows.Forms.TextBox();
 | |
|                         textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm");
 | |
|                         textNum.Tag = pdNew;
 | |
|                         if (pdNew.ValueString != "-1")
 | |
|                             textNum.Text = pdNew.ValueString.ToString();
 | |
|                         textNum.Width = Width / (240 / ade.YAisx);
 | |
|                         textNum.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|                         textNum.Font = new System.Drawing.Font("微软雅黑", 7f);
 | |
|                         textNum.Click += TextNum_Click;
 | |
|                         textNum.Leave += TextNum_Leave;
 | |
|                         textNum.DoubleClick += TextNum_DoubleClick;
 | |
|                         panel.Controls.Add(textNum);
 | |
|                     }
 | |
|                 }
 | |
|                 System.Windows.Forms.Label textName = new System.Windows.Forms.Label();
 | |
|                 textName.Name = "txt" + ade.Name;
 | |
|                 textName.Text = ade.Name;
 | |
|                 textName.Font = new System.Drawing.Font("微软雅黑", 8f);
 | |
|                 textName.Width = panel2.Width / (240 / 5) * 3;
 | |
|                 textName.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|                 panel.Controls.Add(textName);
 | |
|                 panel2.Controls.Add(panel);
 | |
| 
 | |
|                 rows++;
 | |
|             }
 | |
|             //循环加载数值生命体征
 | |
|             for (int x = _record.PhysioConfigList.Count - 1; x >= 0; x--)
 | |
|             {
 | |
|                 PhysioDataConfig ade = _record.PhysioConfigList[x];
 | |
|                 if (ade.IsDefalultShow == false) continue;
 | |
|                 List<PhysioData> list = new List<PhysioData>();
 | |
|                 for (int i = 0; i < dtPhysioData.Rows.Count; i++)
 | |
|                 {
 | |
|                     if (dtPhysioData.Rows[i]["Name"].ToString().Equals(ade.Name.ToString()))
 | |
|                     {
 | |
|                         PhysioData pdTemp = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString());
 | |
|                         list.Add(pdTemp);
 | |
|                     }
 | |
|                 }
 | |
|                 System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel();
 | |
|                 panel.Tag = ade;
 | |
|                 panel.Dock = System.Windows.Forms.DockStyle.Top;
 | |
|                 panel.Size = new System.Drawing.Size(Width, 30);
 | |
|                 for (int i = (240 / 5) - 1; i >= 0; i--)
 | |
|                 {
 | |
|                     DateTime SpanTime = _record.InRoomTime.Value.AddMinutes(i * 5);
 | |
|                     System.Windows.Forms.TextBox textNum = new System.Windows.Forms.TextBox();
 | |
|                     PhysioData pdNew = null;
 | |
|                     foreach (var item in list)
 | |
|                     {
 | |
|                         if (item.RecordTime == SpanTime)
 | |
|                         {
 | |
|                             pdNew = item;
 | |
|                             pdNew.config = ade;
 | |
|                             textNum.Text = pdNew.ValueString.ToString();
 | |
|                             break;
 | |
|                         }
 | |
|                     }
 | |
|                     if (pdNew == null)
 | |
|                     {
 | |
|                         pdNew = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, SpanTime, -1);
 | |
|                     }
 | |
| 
 | |
|                     textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm");
 | |
|                     textNum.Tag = pdNew;
 | |
|                     textNum.Width = Width / (240 / 5);
 | |
|                     textNum.Font = new System.Drawing.Font("微软雅黑", 7f);
 | |
|                     textNum.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|                     textNum.Click += TextNum_Click;
 | |
|                     textNum.Leave += TextNum_Leave;
 | |
|                     textNum.DoubleClick += TextNum_DoubleClick;
 | |
|                     panel.Controls.Add(textNum);
 | |
|                 }
 | |
|                 System.Windows.Forms.Label textName = new System.Windows.Forms.Label();
 | |
|                 textName.Name = "txt" + ade.Name;
 | |
|                 textName.Text = ade.Name;
 | |
|                 textName.Font = new System.Drawing.Font("微软雅黑", 8f);
 | |
|                 textName.Width = panel2.Width / (240 / 5) * 3;
 | |
|                 textName.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|                 panel.Controls.Add(textName);
 | |
|                 panel2.Controls.Add(panel);
 | |
| 
 | |
|                 rows++;
 | |
|             }
 | |
|             paneltop = new System.Windows.Forms.Panel();
 | |
|             paneltop.Dock = System.Windows.Forms.DockStyle.Top;
 | |
|             paneltop.Location = new System.Drawing.Point(20, 0);
 | |
|             paneltop.Size = new System.Drawing.Size(792, 35);
 | |
|             for (int i = (240 / 5) - 1; i >= 0; i--)
 | |
|             {
 | |
|                 System.Windows.Forms.Label textNum = new System.Windows.Forms.Label();
 | |
|                 textNum.Name = "txt" + _record.InRoomTime.Value.AddMinutes(i * 5).ToString("yyyyMMddHHmm");
 | |
|                 textNum.Text = _record.InRoomTime.Value.AddMinutes(i * 5).ToString("HH mm");
 | |
|                 textNum.Font = new System.Drawing.Font("微软雅黑", 7f);
 | |
|                 textNum.Width = Width / (240 / 5);
 | |
|                 textNum.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|                 textNum.TextAlign = ContentAlignment.MiddleCenter;
 | |
|                 paneltop.Controls.Add(textNum);
 | |
|             }
 | |
|             System.Windows.Forms.Label textTipName2 = new System.Windows.Forms.Label();
 | |
|             textTipName2.Text = "时间 ";
 | |
|             textTipName2.Font = new System.Drawing.Font("微软雅黑", 9f, FontStyle.Bold);
 | |
|             textTipName2.Width = panel2.Width / (240 / 5) * 3 / 2;
 | |
|             textTipName2.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|             textTipName2.TextAlign = ContentAlignment.MiddleRight;
 | |
|             paneltop.Controls.Add(textTipName2);
 | |
|             System.Windows.Forms.Label textTipName = new System.Windows.Forms.Label();
 | |
|             textTipName.Text = " 名称";
 | |
|             textTipName.Font = new System.Drawing.Font("微软雅黑", 9f, FontStyle.Bold);
 | |
|             textTipName.Width = panel2.Width / (240 / 5) * 3 / 2;
 | |
|             textTipName.Dock = System.Windows.Forms.DockStyle.Left;
 | |
|             textTipName.TextAlign = ContentAlignment.MiddleLeft;
 | |
|             paneltop.Controls.Add(textTipName);
 | |
|             panel2.Controls.Add(paneltop);
 | |
|         }
 | |
| 
 | |
| 
 | |
|         private void LoadPhysioData(List<PhysioDataConfig> Lists)
 | |
|         {
 | |
|             System.Data.DataTable dtPhysioData = BOperationRecord.getByOpeIDIsPhysioData(_record.Id.Value);
 | |
| 
 | |
|             int Width = panel2.Width - (panel2.Width / (240 / 5) * 3);
 | |
|             foreach (Control pan in panel2.Controls)
 | |
|             {
 | |
|                 if (pan is Panel)
 | |
|                 {
 | |
|                     System.Windows.Forms.Panel panel = pan as Panel;
 | |
|                     PhysioDataConfig ade = panel.Tag as PhysioDataConfig;
 | |
|                     if (ade != null && IsInPhysioConfigList(ade, Lists))
 | |
|                     {
 | |
|                         if (ade.ConfigType == "麻醉体征")
 | |
|                         {
 | |
|                             List<PhysioData> list = new List<PhysioData>();
 | |
|                             for (int i = 0; i < dtPhysioData.Rows.Count; i++)
 | |
|                             {
 | |
|                                 if (dtPhysioData.Rows[i]["Name"].ToString().Equals(ade.Name.ToString()))
 | |
|                                 {
 | |
|                                     PhysioData pdTemp = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString());
 | |
|                                     list.Add(pdTemp);
 | |
|                                 }
 | |
|                             }
 | |
|                             foreach (Control txt in panel.Controls)
 | |
|                             {
 | |
|                                 if (ade.ImgPath != null && ade.ImgPath != "")
 | |
|                                 {
 | |
|                                     System.Windows.Forms.ComboBox  textNum = txt as  ComboBox;
 | |
|                                     PhysioData pdNew = textNum.Tag as PhysioData;
 | |
|                                     DateTime SpanTime = pdNew.RecordTime;
 | |
|                                     foreach (var item in list)
 | |
|                                     {
 | |
|                                         if (item.RecordTime == SpanTime)
 | |
|                                         {
 | |
|                                             pdNew = item;
 | |
|                                             pdNew.config = ade;
 | |
|                                             if (pdNew.ValueString != "-1") 
 | |
|                                             textNum.Text = pdNew.ValueString.ToString();
 | |
|                                             break;
 | |
|                                         }
 | |
|                                     }  
 | |
|                                 }
 | |
|                                 else
 | |
|                                 {
 | |
|                                     System.Windows.Forms.TextBox textNum = txt as TextBox;
 | |
|                                     PhysioData pdNew = textNum.Tag as PhysioData;
 | |
|                                     DateTime SpanTime = pdNew.RecordTime;
 | |
|                                     foreach (var item in list)
 | |
|                                     {
 | |
|                                         if (item.RecordTime == SpanTime)
 | |
|                                         {
 | |
|                                             pdNew = item;
 | |
|                                             pdNew.config = ade;
 | |
|                                             if (pdNew.ValueString != "-1") 
 | |
|                                             textNum.Text = pdNew.ValueString.ToString();
 | |
|                                             break;
 | |
|                                         }
 | |
|                                     } 
 | |
|                                 } 
 | |
|                             } 
 | |
|                         }
 | |
|                         else
 | |
|                         {
 | |
|                             List<PhysioData> list = new List<PhysioData>();
 | |
|                             for (int i = 0; i < dtPhysioData.Rows.Count; i++)
 | |
|                             {
 | |
|                                 if (dtPhysioData.Rows[i]["Name"].ToString().Equals(ade.Name.ToString()))
 | |
|                                 {
 | |
|                                     PhysioData pdTemp = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString());
 | |
|                                     list.Add(pdTemp);
 | |
|                                 }
 | |
|                             }
 | |
|                             foreach (Control txt in panel.Controls)
 | |
|                             {
 | |
|                                 if (txt is TextBox)
 | |
|                                 {
 | |
|                                     System.Windows.Forms.TextBox textNum = txt as TextBox;
 | |
|                                     PhysioData pdNew = textNum.Tag as PhysioData;
 | |
|                                     DateTime SpanTime = pdNew.RecordTime;  
 | |
|                                     foreach (var item in list)
 | |
|                                     {
 | |
|                                         if (item.RecordTime == SpanTime)
 | |
|                                         {
 | |
|                                             pdNew = item;
 | |
|                                             pdNew.config = ade;
 | |
|                                             textNum.Text = pdNew.ValueString.ToString();
 | |
|                                             break;
 | |
|                                         }
 | |
|                                     } 
 | |
|                                 }
 | |
|                             } 
 | |
|                         }
 | |
| 
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         public bool IsInPhysioConfigList(PhysioDataConfig ade, List<PhysioDataConfig> Lists)
 | |
|         {
 | |
|             bool isInPhysioConfigList = false;
 | |
|             foreach (var item in Lists)
 | |
|             {
 | |
|                 if (item.Id == ade.Id)
 | |
|                 {
 | |
|                     isInPhysioConfigList = true;
 | |
|                 }
 | |
|             }
 | |
|             return isInPhysioConfigList;
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void TextNum_Leave(object sender, EventArgs e)
 | |
|         {
 | |
|             TextBox txtNum = sender as TextBox;
 | |
|             PhysioData pdNew = txtNum.Tag as PhysioData;
 | |
|             if (txtNum.Text.Trim() == "" && pdNew.Value > -1)
 | |
|             {
 | |
|                 if (pdNew.config.ConfigType == "麻醉体征")
 | |
|                     pdNew.config.EditDelItem(pdNew);
 | |
|                 else
 | |
|                     pdNew.config.DelItem(pdNew);
 | |
|                 pdNew.Value = -1;
 | |
|                 txtNum.Tag = pdNew;
 | |
|                 TempValue = "";
 | |
|             }
 | |
|             else if (txtNum.Text.Trim() != "" && pdNew.Value > -1)
 | |
|             {
 | |
|                 if (pdNew.Value.ToString() != txtNum.Text)
 | |
|                 {
 | |
|                     string value = checkValue(txtNum, pdNew.config);
 | |
|                     if (value != "")
 | |
|                     {
 | |
|                         pdNew.ValueString = value;
 | |
|                         if (pdNew.config.ConfigType == "麻醉体征")
 | |
|                             pdNew.config.EditModifyItem(pdNew, pdNew);
 | |
|                         else
 | |
|                             pdNew.config.ModifyItem(pdNew, pdNew);
 | |
|                         txtNum.Tag = pdNew;
 | |
|                         TempValue = txtNum.Text.Trim();
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|             else if (txtNum.Text.Trim() != "")
 | |
|             {
 | |
|                 string value = checkValue(txtNum, pdNew.config);
 | |
|                 if (value != "")
 | |
|                 {
 | |
|                     pdNew.ValueString = value;
 | |
|                     if (pdNew.config.ConfigType == "麻醉体征")
 | |
|                         pdNew.config.EditAddItem(pdNew);
 | |
|                     else
 | |
|                         pdNew.config.AddPointItem(pdNew);
 | |
|                     txtNum.Tag = pdNew;
 | |
|                     TempValue = txtNum.Text.Trim();
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         private void ComeBoxNum_Leave(object sender, EventArgs e)
 | |
|         {
 | |
|             ComboBox txtNum = sender as ComboBox;
 | |
|             PhysioData pdNew = txtNum.Tag as PhysioData;
 | |
|             if (txtNum.Text.Trim() == "" && pdNew.Value > -1)
 | |
|             {
 | |
|                 pdNew.config.EditDelItem(pdNew);
 | |
|                 pdNew.Value = -1;
 | |
|                 txtNum.Tag = pdNew;
 | |
|                 TempValue = "";
 | |
|             }
 | |
|             else if (txtNum.Text.Trim() != "" && pdNew.Value > -1)
 | |
|             {
 | |
|                 if (pdNew.Value.ToString() != txtNum.Text)
 | |
|                 {
 | |
|                     pdNew.ValueString = txtNum.Text.Trim();
 | |
|                     pdNew.config.EditModifyItem(pdNew, pdNew);
 | |
|                     txtNum.Tag = pdNew;
 | |
|                     TempValue = txtNum.Text.Trim();
 | |
|                 }
 | |
|             }
 | |
|             else if (txtNum.Text.Trim() != "")
 | |
|             {
 | |
|                 pdNew.ValueString = txtNum.Text.Trim();
 | |
|                 pdNew.config.EditAddItem(pdNew);
 | |
|                 txtNum.Tag = pdNew;
 | |
|                 TempValue = txtNum.Text.Trim();
 | |
|             }
 | |
|         }
 | |
|         public string checkValue(TextBox txtNum, PhysioDataConfig config)
 | |
|         {
 | |
|             string Result = "";
 | |
|             double value = -1;
 | |
|             if (config.ConfigType == "生命体征" || config.ShowText == true)
 | |
|             {
 | |
|                 if (!double.TryParse(txtNum.Text.ToString(), out value))
 | |
|                 {
 | |
|                     MessageBox.Show("请填写正确数值!", "系统提示");
 | |
|                     txtNum.Focus();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     if (value < config.WarningLowLimit || value > config.WarningHighLimit)
 | |
|                     {
 | |
|                         //DialogResult dr = MessageBox.Show("数值:" + value + " 超出 " + config.Name + "[" + config.WarningLowLimit + "-" + config.WarningHighLimit + "] 报警范围! ", "系统提示");//, MessageBoxButtons.YesNo); //if (dr != DialogResult.Yes) { txtNum.Focus(); }
 | |
|                         if (value < config.WarningLowLimit)
 | |
|                         {
 | |
|                             value = config.WarningLowLimit;
 | |
|                         }
 | |
|                         if (value > config.WarningHighLimit)
 | |
|                         {
 | |
|                             value = config.WarningHighLimit;
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|                 if (value > 0) Result = value.ToString();
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 Result = txtNum.Text.ToString();
 | |
|             }
 | |
|             return Result;
 | |
|         }
 | |
| 
 | |
|         public bool checkValue2(TextBox txtNum, PhysioDataConfig config)
 | |
|         {
 | |
|             bool Result = true;
 | |
|             double value = -1;
 | |
|             if (config.ConfigType == "生命体征" || config.ShowText == true)
 | |
|             {
 | |
|                 if (!double.TryParse(txtNum.Text.ToString(), out value))
 | |
|                 {
 | |
|                     MessageBox.Show("请填写正确数值!", "系统提示");
 | |
|                     txtNum.Focus();
 | |
|                     Result = false;
 | |
|                 }
 | |
|             }
 | |
|             return Result;
 | |
|         }
 | |
|         private void TextNum_DoubleClick(object sender, EventArgs e)
 | |
|         {
 | |
|             Control txtNum = sender as Control;
 | |
|             if (TempValue != "")
 | |
|             {
 | |
|                 txtNum.Text = TempValue;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         public string TempValue;
 | |
|         private void TextNum_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             Control txtNum = sender as Control;
 | |
|             PhysioData pdNew = txtNum.Tag as PhysioData;
 | |
|             if (selectConfig != null)
 | |
|             {
 | |
|                 selectConfig.ForeColor = System.Drawing.Color.Black;
 | |
|             }
 | |
|             selectConfig = txtNum.Parent.Controls.Find("txt" + pdNew.config.Name, true)[0] as System.Windows.Forms.Label;
 | |
|             selectConfig.ForeColor = System.Drawing.Color.Blue;
 | |
| 
 | |
|             if (selectTime != null)
 | |
|             {
 | |
|                 selectTime.ForeColor = System.Drawing.Color.Black;
 | |
|             }
 | |
|             selectTime = paneltop.Controls.Find("txt" + pdNew.RecordTime.ToString("yyyyMMddHHmm"), true)[0] as System.Windows.Forms.Label;
 | |
|             selectTime.ForeColor = System.Drawing.Color.Blue;
 | |
| 
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         private void frmPhysioDataEdit_FormClosed(object sender, FormClosedEventArgs e)
 | |
|         {
 | |
|             if (selectConfig != null)
 | |
|                 selectConfig.Focus();
 | |
|         } 
 | |
| 
 | |
|         private void btnAdd_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 if (dtpInsertEnd.Value < dtpInsertBegin.Value) return;
 | |
|                 if (dtpInsertBegin.Value < _record.PageBegin) return;
 | |
|                 bool RESULT = true;
 | |
|                 foreach (var item in groupBox3.Controls)
 | |
|                 {
 | |
|                     if (item is TextBox)
 | |
|                     {
 | |
|                         TextBox txtNum = (item as TextBox);
 | |
|                         PhysioDataConfig ade = txtNum.Tag as PhysioDataConfig;
 | |
|                         if (txtNum.Text.Trim() != "")
 | |
|                         {
 | |
|                             bool value = checkValue2(txtNum, ade);
 | |
|                             if (value == false) RESULT = false;
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|                 if (RESULT == false) return;
 | |
|                 List<PhysioDataConfig> ades = new List<PhysioDataConfig>();
 | |
|                 List<PhysioData> list = new List<PhysioData>();
 | |
|                 foreach (var item in groupBox3.Controls)
 | |
|                 {
 | |
|                     if (item is TextBox)
 | |
|                     {
 | |
|                         TextBox txtNum = (item as TextBox);
 | |
|                         PhysioDataConfig ade = txtNum.Tag as PhysioDataConfig;
 | |
|                         if (txtNum.Text.Trim() != "")
 | |
|                         {
 | |
|                             string value = checkValue(txtNum, ade);
 | |
|                             int spanNun = ade.ConfigType == "麻醉体征" ? ade.YAisx : 5;
 | |
|                             for (int i = 0; i < (240 / spanNun); i++)
 | |
|                             {
 | |
|                                 DateTime SpanTime = _record.InRoomTime.Value.AddMinutes(i * spanNun);
 | |
|                                 if (SpanTime >= dtpInsertBegin.Value && SpanTime <= dtpInsertEnd.Value)
 | |
|                                 {
 | |
|                                     PhysioData pdNew = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, SpanTime, value);
 | |
|                                     if (value != "")
 | |
|                                     {
 | |
|                                         pdNew.ValueString = value;
 | |
|                                         list.Add(pdNew);
 | |
|                                     }
 | |
|                                 }
 | |
|                             }
 | |
|                             ades.Add(ade);
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|                 if (list.Count > 0)
 | |
|                 {
 | |
|                     PhysioDataService.AddPhysioDatas(list);
 | |
|                     LoadPhysioData(ades);
 | |
|                     btnClear_Click(null, null);
 | |
|                     MessageBox.Show("添加成功!", "系统提示");
 | |
|                 }
 | |
|             }
 | |
|             catch (Exception ex)
 | |
|             {
 | |
|                 PublicMethod.WriteLog(ex);
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void btnClear_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             foreach (var item in groupBox3.Controls)
 | |
|             {
 | |
|                 if (item is TextBox)
 | |
|                 {
 | |
|                     (item as TextBox).Text = "";
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |