using DrawGraph;
using DrawGraph.AreaManage;
using DrawGraph.BoardPack;
using DrawGraph.GUtil;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace AIMS.EF
{
[Serializable, JsonObject(MemberSerialization.OptOut)]
public class DrugsManage : AreaManageBase
{
///
/// 药品区域
///
public RectangleFramePackObj drugPpack;
public LinePackObj H3pack;
public LinePackObj H5pack;
public LinesPackObj lines;
public int RowsCount;
///
/// 当前手术对象
///
private OperationRecord myOpeRecord = null;
#region 初始化药品区域
public DrugsManage()
{ init(); }
public DrugsManage(object _operationRecor, ZedGraphControl _zedControl, TemplateManage _template, string _name) : base(_operationRecor, _zedControl, _template, _name)
{ init(); }
public void init()
{
//自己要用的手术对象
myOpeRecord = OpeRecord as OperationRecord;
}
///
/// 初始画的后置方法
///
public override void FollowUpMethod()
{
lines = template.GetPackObjectOTag("DrugsManage_LinesPackObj_5");
RowsCount =Convert.ToInt32(lines.XPageSpan / lines.XMajorGridStep);
H3pack = template.GetPackObjectOTag("DrugsManage_LinePackObj_6");
H5pack = template.GetPackObjectOTag("DrugsManage_LinePackObj_9");
drugPpack = template.GetPackObjectOTag("DrugsManage_RectangleFramePackObj_2");
}
#endregion
#region 重写的事件
///
/// 鼠标点击画板
///
///
///
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 重写的事件结束
#region 绑定区域数据
public override void Bind()
{
init();
DrawDrug();
}
///
/// 画加药
///
private void DrawDrug()
{
//try
//{
// foreach (DrugsRecord temp in myOpeRecord.DrugsRecordList)
// {
// if (!isSapDrugs(temp))
// {
// temp.clearAddObj(ZedControl);
// }
// }
// reDrawDrug();
//}
//catch (Exception exp)
//{
// PublicMethod.WriteLog(exp);
//}
}
#endregion
#region 当前区域公用事件方法
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;
}
///
/// 根据顶部加药序号,确定数值生命体征的纵向位置(以1为单位)
///
///
///
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;
}
#endregion
}
}