AIMS/DrawGraph/AreaManage/IconManage.cs
leomon 82591fb825 器械清点生命体征不显示
数千访视添加了Ada分级,术中麻醉记录单应该同步过来
4间9:54血压显示的不对
点击获取数据的时候才会把有创血压加载出来 不自动画点血压
2022-11-09 20:32:37 +08:00

371 lines
14 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using HelperDB;
using Newtonsoft.Json;
using AIMSExtension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DrawGraph
{
public class IconManage : AreaManageBase
{
public RectangleFramePackObj IconPpack;
public LinePackObj H5pack;
/// <summary>
/// 当前手术对象
/// </summary>
private OperationRecord myOpeRecord = null;
public IconManage() { }
public IconManage(object _operationRecor, ZedGraphControl _zedControl, TemplateManage _template, string _name) : base(_operationRecor, _zedControl, _template, _name)
{
init();
}
public void init()
{
//自己要用的手术对象
myOpeRecord = OpeRecord as OperationRecord;
}
/// <summary>
/// 初始画的后置方法
/// </summary>
public override void FollowUpMethod()
{
H5pack = template.GetPackObjectOTag<LinePackObj>("IconManage_LinePackObj_5");
if (H5pack != null)
{
eventstartX = H5pack.RealX;
eventy = H5pack.RealY;
eventendy = H5pack.RealEndY;
}
IconPpack = template.GetPackObjectOTag<RectangleFramePackObj>("IconManage_RectangleFramePackObj_2");
if (IconPpack != null)
{
eventy = IconPpack.RealY;
eventendy = IconPpack.RealEndY;
}
LinePackObj line = template.GetPackObjectOTag<LinePackObj>("IconManage_LinePackObj_6");
if (line != null)
{
eventstartX = line.RealX;
eventendX = line.RealEndX + 0.02;
}
}
#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)
{
}
#endregion
public override void Bind()
{
init();
DrawEvent();
}
/// <summary>
/// 画事件
/// </summary>
private void DrawEvent()
{
if (myOpeRecord.FactEventsList.Count > 0)
{
foreach (FactEvents temp in myOpeRecord.FactEventsList)
{
temp.clearAddObj(ZedControl);
}
reDrawEvent();
}
}
double eventy;
double eventendy;
double eventendX;
double eventstartX;
/// <summary>
/// 重新画事件文本
/// </summary>
private void reDrawEvent()
{
//画在第几行
int rowIndex = 0;
DateTime? drawDatetime = null;
FactEvents drawEvent = null;
string LastNumber = "";
double span = getYPositionByListIndex(1, eventy, eventendy, 2);
List<string> eventListstr = new List<string>();
eventListstr.Add("【事件】");
//myOpeRecord.FactEventsList.Sort(new FactEventsComparer());
//List<string> eventlist =
//.GetNode(EVENTPARAMPATH, "name");
//循环加药集体
for (int i = 0; i < myOpeRecord.FactEventsList.Count; i++)
{
FactEvents temp = myOpeRecord.FactEventsList[i];
//ShowRespDate(temp, null);
//判断该事件是否存在当前时间段
if (IfInTimeExist(temp.EventBeginTime.Value, temp.EventEndTime.Value) == false) continue;
if (temp.EventBeginTime.Value.ToShortTimeString() == temp.EventEndTime.Value.ToShortTimeString())
{
eventListstr.Add(string.Format("{0}{1} {2} {3}{4}", getNumber(i), temp.EventBeginTime.Value.ToShortTimeString(), temp.EventName, "", temp.Remark == null ? "" : temp.Remark.ToString()));
}
else
{
eventListstr.Add(string.Format("{0}{1}->{2} {3} {4}{5}", getNumber(i), temp.EventBeginTime.Value.ToShortTimeString(), temp.EventEndTime.Value.ToShortTimeString(), temp.EventName, "", temp.Remark == null ? "" : temp.Remark.ToString()));
}
//设置事件对象的相应属性,只达到了基本解耦,封装有限,有待完善
temp.setAnasArr(ZedControl, eventstartX, eventendX, myOpeRecord.pageBegin, myOpeRecord.pageBegin.AddMinutes(EVERY_PAGE_TIME_SPAN));
try
{
//循环XML文件,文件中的内容是只画图不写字的事件对旬
//DataRow[] dr = myOpeRecord.PhysioParamList.Select("Name ='" + temp.EventName + "' ", "");
//if (dr.Length > 0)
//{
// temp.clearDNAndDT(ZedControl);
// string tagName = dr[0]["imgPath"].ToString();
// temp.drawIMG(ZedControl, tagName, eventy, 0.013);
//}
//else
//{
// int DValue = 0;
// string drawNumber = "";
// if (drawDatetime != null && temp.EventBeginTime > drawDatetime.Value.AddMinutes(-1) && temp.EventBeginTime < drawDatetime.Value.AddMinutes(10) && LastNumber != "" && drawEvent != null)
// {
// drawEvent.clearDNAndDT(ZedControl);
// drawEvent = temp;
// drawNumber = LastNumber + "-" + getNumber(i);// (i + 1).ToString();//
// DValue = (int)(((TimeSpan)(temp.EventBeginTime - drawDatetime.Value)).TotalMinutes / 2);
// }
// else
// {
// LastNumber = getNumber(i);// (i + 1).ToString();//
// drawNumber = LastNumber;
// drawEvent = temp;
// drawDatetime = temp.EventBeginTime.Value;
// }
// //画图上的序号
// temp.drawNumber(ZedControl, drawNumber, eventy + span - 0.001, DValue, Color.DarkBlue);
//}
//rowIndex++;
//循环XML文件,文件中的内容是只画图不写字的事件对旬
DataRow[] dr = myOpeRecord.PhysioParamList.Select("Name ='" + temp.EventName + "' ", "");
if (dr.Length > 0)
{
temp.clearDNAndDT(ZedControl);
string tagName = dr[0]["imgPath"].ToString();
temp.drawIMG(ZedControl, tagName, eventy, 0.013);
}
else
{
int DValue = 0;
string drawNumber = "";
if (drawDatetime != null && temp.EventBeginTime > drawDatetime.Value.AddMinutes(-1) && temp.EventBeginTime < drawDatetime.Value.AddMinutes(10) && LastNumber != "" && drawEvent != null)
{
drawEvent.clearDNAndDT(ZedControl);
drawEvent = temp;
drawNumber = LastNumber + "-" + getNumber(i);
DValue = (int)(((TimeSpan)(temp.EventBeginTime - drawDatetime.Value)).TotalMinutes / 2);
}
else
{
LastNumber = getNumber(i);
drawNumber = LastNumber;
drawEvent = temp;
drawDatetime = temp.EventBeginTime.Value;
}
//画图上的序号
temp.drawNumber(ZedControl, drawNumber, eventy + span - 0.001, DValue, Color.DarkBlue);
}
rowIndex++;
}
catch (Exception exp)
{
PublicMethod.WriteLog(exp, "");
}
}
myOpeRecord.EventListstr = eventListstr;
}
#region
/// <summary>
/// 格式化字符串长度
/// </summary>
/// <param name="str">输入的字符串</param>
/// <param name="n">截取的长度</param>
/// <returns>被截取完的字符串</returns>
public static List<string> stringformat(string str, int n)
{
///
///格式化字符串长度,超出部分显示省略号,区分汉字跟字母。汉字2个字节字母数字一个字节
///
List<string> strList = new List<string>();
string temp = string.Empty;
if (System.Text.Encoding.Default.GetByteCount(str) <= n)//如果长度比需要的长度n小,返回原字符串
{
strList.Add(str);
}
else
{
int t = 0;
char[] q = str.ToCharArray();
for (int i = 0; i <= q.Length; i++)
{
if (t > n)
{
strList.Add(temp);
temp = "";
t = 0;
}
if (i == q.Length)// - 1
{
strList.Add(temp);
break;
}
//判断是否汉字:
if ((int)q[i] >= 0x4E00 && (int)q[i] <= 0x9FA5)
{
temp += q[i];
t += 2;
}
//判断半角如下:
else if (q[i].ToString().Length == Encoding.Default.GetByteCount(q[i].ToString()))
{
temp += q[i];
t++;
}
//判断全角如下:
else if (2 * q[i].ToString().Length == Encoding.Default.GetByteCount(q[i].ToString()))
{
temp += q[i];
t += 2;
}
else
{
temp += q[i];
t++;
}
}
}
return strList;
}
#endregion
private bool IfInTimeExist(DateTime Begin, DateTime End)
{
DateTime lastime = myOpeRecord.lastPageBegin.AddSeconds(59);
bool b = false;
if (End == null)
{
if (Begin > myOpeRecord.pageBegin && Begin < lastime)
{
b = true;
}
}
else
{
if (Begin >= myOpeRecord.pageBegin && Begin <= lastime)
{
b = true;
}
else if (End >= myOpeRecord.pageBegin && End <= lastime)
{
b = true;
}
else if (Begin < myOpeRecord.pageBegin && End > lastime)
{
b = true;
}
}
return b;
}
private DateTime GetInsertTime(DateTime pdTemp, bool IsInRToomTime = false)
{
DateTime insTime = pdTemp.Date.AddHours(pdTemp.Hour).AddMinutes(pdTemp.Minute);
if (collectInterval == 5)
{
int minute = pdTemp.Minute % 5;//计算5的整数分钟
if (minute >= 3)
insTime = insTime.AddMinutes(5 - minute);
else if (minute != 0 && IsInRToomTime == true)
insTime = insTime.AddMinutes(5 - minute);
else
insTime = insTime.AddMinutes(0 - minute);
}
else if (collectInterval == 10)
{
double minute = pdTemp.Minute % 10;//计算5的整数分钟
if (minute >= 5)
insTime = insTime.AddMinutes(10 - minute);
else
insTime = insTime.AddMinutes(0 - minute);
}
return insTime;
}
/// <summary>
/// 根据顶部加药序号确定数值生命体征的纵向位置以1为单位
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
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;
}
public static string getNumber(int number)
{
try
{
string str = "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮";
if (number >= 15)
str = "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿";
str = str.Substring(number, 1);
return str;
}
catch (Exception)
{
return number.ToString() + ":";
}
}
}
}