341 lines
15 KiB
C#
341 lines
15 KiB
C#
using HelperDB;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
|
|
namespace DrawGraph
|
|
{
|
|
/// <summary>
|
|
/// 监测管理类
|
|
/// </summary>
|
|
public class MonitorManage : AreaManageBase
|
|
{
|
|
/// <summary>
|
|
/// 监测文本的对象
|
|
/// </summary>
|
|
TextPackObj janCePack = null;
|
|
/// <summary>
|
|
/// 图表的对象
|
|
/// </summary>
|
|
ChartPackObj chartPack = null;
|
|
/// <summary>
|
|
/// 当前手术对象
|
|
/// </summary>
|
|
private OperationRecord myOpeRecord = null;
|
|
public MonitorManage()
|
|
{
|
|
init();
|
|
}
|
|
public MonitorManage(object _operationRecor, ZedGraphControl _zedControl, TemplateManage _template, string _name) : base(_operationRecor, _zedControl, _template, _name)
|
|
{
|
|
init();
|
|
}
|
|
|
|
public void init()
|
|
{
|
|
//监测文本的对象
|
|
janCePack = GetPackObjectOTag("PhysioDataManage_TextPackObj_17") as TextPackObj;
|
|
//图表的对象
|
|
chartPack = GetPackObjectOTag("PhysioDataManage_ChartPackObj_6") as ChartPackObj;
|
|
//自己要用的手术对象
|
|
myOpeRecord = OpeRecord as OperationRecord;
|
|
}
|
|
#region 重写的事件
|
|
/// <summary>
|
|
/// 鼠标点击画板
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public override void MouseDown(ZedGraphControl sender, MouseEventArgs e)
|
|
{
|
|
//if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
|
//{
|
|
// MessageBox.Show(this.GetType().Name + "is Click Left Button");
|
|
//}
|
|
}
|
|
public override void MouseMove(ZedGraphControl sender, MouseEventArgs e)
|
|
{
|
|
}
|
|
public override void MouseUp(ZedGraphControl sender, MouseEventArgs e)
|
|
{
|
|
}
|
|
public override void MouseDoubleClick(ZedGraphControl sender, MouseEventArgs e)
|
|
{
|
|
}
|
|
public override void KeyUp(ZedGraphControl sender, KeyEventArgs e)
|
|
{
|
|
}
|
|
public override void Bind()
|
|
{
|
|
init();
|
|
|
|
List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
|
foreach (PackObjBase pack in ables)
|
|
{
|
|
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
|
|
|
if (ableEdit != null)
|
|
{
|
|
if (ableEdit.ControlType == EControlType.Panel)
|
|
{
|
|
ableEdit.IsVisible = true;
|
|
Panel pan = ableEdit.CControl as Panel;
|
|
if (pan != null)
|
|
{
|
|
pan.Controls.Clear();
|
|
int Width = pan.Width;
|
|
int Height = pan.Height / 3;
|
|
List<Panel> panPanels = new List<Panel>();
|
|
//循环加载数值生命体征
|
|
for (int x = 0; x < myOpeRecord.PhysioConfigList.Count; x++)
|
|
{
|
|
PhysioDataConfig ade = myOpeRecord.PhysioConfigList[x];
|
|
if (ade.IsDefalultShow == false) continue;
|
|
if (!ade.ShowText) continue;
|
|
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, Height);
|
|
for (int i = (240 / 5); i >= 0; i--)
|
|
{
|
|
DateTime SpanTime = getInRoomSpanTime(myOpeRecord.pageBegin.AddMinutes(i * 5));
|
|
System.Windows.Forms.TextBox textNum = new System.Windows.Forms.TextBox();
|
|
|
|
PhysioData pdNew = PhysioDataConfig.newPhysioData(ade, myOpeRecord.Id.Value, SpanTime, -1);
|
|
|
|
textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm");
|
|
textNum.Tag = pdNew;
|
|
textNum.Font = new System.Drawing.Font("微软雅黑", 7f);
|
|
textNum.Multiline = true;
|
|
textNum.Width = Width / (240 / 5) + 1;
|
|
textNum.Height = panel.Height;
|
|
textNum.Dock = System.Windows.Forms.DockStyle.Left;
|
|
textNum.Leave += TextNum_Leave;
|
|
textNum.DoubleClick += TextNum_DoubleClick;
|
|
panel.Controls.Add(textNum);
|
|
}
|
|
panPanels.Add(panel);
|
|
}
|
|
for (int x = 0; x < myOpeRecord.PhysioAnesConfigList.Count; x++)
|
|
{
|
|
PhysioDataConfig ade = myOpeRecord.PhysioAnesConfigList[x];
|
|
if (ade.IsDefalultShow == false) continue;
|
|
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, Height);
|
|
for (int i = (240 / ade.YAisx); i >= 0; i--)
|
|
{
|
|
DateTime SpanTime = getInRoomSpanTime(myOpeRecord.pageBegin.AddMinutes(i * ade.YAisx));
|
|
System.Windows.Forms.TextBox textNum = new System.Windows.Forms.TextBox();
|
|
|
|
PhysioData pdNew = PhysioDataConfig.newPhysioData(ade, myOpeRecord.Id.Value, SpanTime, -1);
|
|
|
|
textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm");
|
|
textNum.Tag = pdNew;
|
|
textNum.Font = new System.Drawing.Font("微软雅黑", 7f);
|
|
textNum.Multiline = true;
|
|
textNum.Width = Width / (240 / ade.YAisx) + 1;
|
|
textNum.Height = panel.Height;
|
|
textNum.Dock = System.Windows.Forms.DockStyle.Left;
|
|
textNum.Leave += TextNum_Leave;
|
|
textNum.DoubleClick += TextNum_DoubleClick;
|
|
panel.Controls.Add(textNum);
|
|
}
|
|
panPanels.Add(panel);
|
|
}
|
|
for (int i = 2; i >= 0; i--)
|
|
{
|
|
pan.Controls.Add(panPanels[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
DrawPhysioData();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 画生理数据
|
|
/// </summary>
|
|
private void DrawPhysioData()
|
|
{
|
|
DataTable dtPhysioData = getByOpeIDIsPhysioData(myOpeRecord.Id.Value);
|
|
if (dtPhysioData.Rows.Count <= 0)
|
|
{
|
|
foreach (PhysioDataConfig item in myOpeRecord.PhysioConfigList)
|
|
{
|
|
item.clearAddObj(ZedControl);
|
|
}
|
|
foreach (PhysioDataConfig item in myOpeRecord.PhysioAnesConfigList)
|
|
{
|
|
item.clearAddObj(ZedControl);
|
|
}
|
|
return;
|
|
}
|
|
if (dtPhysioData != null && dtPhysioData.Rows.Count > 0)
|
|
{
|
|
foreach (PhysioDataConfig addPP in myOpeRecord.PhysioConfigList)
|
|
{
|
|
addPP.clearAddObj(ZedControl);
|
|
if (addPP.IsDefalultShow == false) continue;
|
|
for (int i = 0; i < dtPhysioData.Rows.Count; i++)
|
|
{
|
|
if (dtPhysioData.Rows[i]["Name"].ToString().Equals(addPP.Name.ToString()))
|
|
{
|
|
PhysioData pdTemp = PhysioDataConfig.newPhysioData(addPP, myOpeRecord.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString());
|
|
addPP.AddPoition(pdTemp);
|
|
}
|
|
}
|
|
}
|
|
foreach (PhysioDataConfig addPP in myOpeRecord.PhysioAnesConfigList)
|
|
{
|
|
addPP.clearAddObj(ZedControl);
|
|
if (addPP.IsDefalultShow == false) continue;
|
|
for (int i = 0; i < dtPhysioData.Rows.Count; i++)
|
|
{
|
|
if (dtPhysioData.Rows[i]["Name"].ToString().Equals(addPP.Name.ToString()))
|
|
{
|
|
PhysioData pdTemp = PhysioDataConfig.newPhysioData(addPP, myOpeRecord.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString());
|
|
addPP.AddText(pdTemp);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public DateTime getInRoomSpanTime(DateTime time)
|
|
{
|
|
DateTime resultTime = time;
|
|
for (int i = (240 / 5); i >= 0; i--)
|
|
{
|
|
DateTime spanTime = myOpeRecord.InRoomTime.Value.AddMinutes(i * 5);
|
|
if (spanTime >= resultTime && spanTime < resultTime.AddMinutes(5))
|
|
{
|
|
resultTime = spanTime;
|
|
break;
|
|
}
|
|
|
|
}
|
|
return resultTime;
|
|
}
|
|
|
|
public string TempValue;
|
|
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);
|
|
if (value != "")
|
|
{
|
|
pdNew.ValueString = value;
|
|
if (pdNew.config.ConfigType == "麻醉体征")
|
|
pdNew.config.EditModifyItem(pdNew, pdNew);
|
|
else
|
|
pdNew.config.ModItem(pdNew, pdNew);
|
|
txtNum.Tag = pdNew;
|
|
TempValue = txtNum.Text.Trim();
|
|
}
|
|
}
|
|
}
|
|
else if (txtNum.Text.Trim() != "")
|
|
{
|
|
string value = checkValue(txtNum, pdNew);
|
|
if (value != "")
|
|
{
|
|
pdNew.ValueString = value;
|
|
if (pdNew.config.ConfigType == "麻醉体征")
|
|
pdNew.config.EditAddItem(pdNew);
|
|
else
|
|
pdNew.config.AddFillItem(pdNew);
|
|
txtNum.Tag = pdNew;
|
|
TempValue = txtNum.Text.Trim();
|
|
}
|
|
}
|
|
}
|
|
public string checkValue(TextBox txtNum, PhysioData pdNew)
|
|
{
|
|
string Result = "";
|
|
double value = -1;
|
|
if (pdNew.config.ConfigType == "生命体征" || pdNew.config.ShowText == true)
|
|
{
|
|
if (!double.TryParse(txtNum.Text.ToString(), out value))
|
|
{
|
|
MessageBox.Show("请填写正确数值!", "系统提示");
|
|
txtNum.Focus();
|
|
}
|
|
else
|
|
{
|
|
if (value < pdNew.config.WarningLowLimit || value > pdNew.config.WarningHighLimit)
|
|
{
|
|
DialogResult dr = MessageBox.Show("数值:" + value + " 超出 " + pdNew.config.Name + "[" + pdNew.config.WarningLowLimit + "-" + pdNew.config.WarningHighLimit + "] 报警范围! ", "系统提示");//, MessageBoxButtons.YesNo); //if (dr != DialogResult.Yes) { txtNum.Focus(); }
|
|
if (value < pdNew.config.WarningLowLimit)
|
|
{
|
|
value = pdNew.config.WarningLowLimit;
|
|
}
|
|
if (value > pdNew.config.WarningHighLimit)
|
|
{
|
|
value = pdNew.config.WarningHighLimit;
|
|
}
|
|
}
|
|
}
|
|
if (value > 0) Result = value.ToString();
|
|
}
|
|
else
|
|
{
|
|
Result = txtNum.Text.ToString();
|
|
}
|
|
return Result;
|
|
}
|
|
private void TextNum_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
TextBox txtNum = sender as TextBox;
|
|
if (TempValue != "")
|
|
{
|
|
txtNum.Text = TempValue;
|
|
}
|
|
}
|
|
|
|
#endregion 重写的事件结束
|
|
public static DataTable getByOpeIDIsPhysioData(int operationId)
|
|
{
|
|
string sqlStr = "SELECT [PhysioDataConfig].Name , PhysioData.RecordTime, PhysioData.[Value] FROM [dbo].[PhysioDataConfig] INNER JOIN PhysioData ON [PhysioDataConfig].Id = PhysioData.PhysioDataConfigId where PatientId = " + operationId + " order by PhysioDataConfigId,PhysioData.RecordTime ASC";
|
|
return DBHelper.GetDataTable(sqlStr);
|
|
}
|
|
public double getYPositionByListIndex(double index, double yTop, double yBottom, int rowCount)
|
|
{
|
|
double heightT = ZedControl.Height * (yBottom - yTop);
|
|
double setpTemp = heightT / rowCount;
|
|
//求一格在实际高度中的百分比
|
|
double bfb = (setpTemp / heightT);
|
|
//两线之间度*百分比得到一格的百分比高度
|
|
double ygBFB = (yBottom - yTop) * bfb;
|
|
double y = ygBFB * index;
|
|
return y;
|
|
}
|
|
}
|
|
}
|