989 lines
35 KiB
C#
989 lines
35 KiB
C#
using AIMSBLL;
|
||
using AIMSExtension;
|
||
using AIMSModel;
|
||
using DrawGraph;
|
||
using HelperDB;
|
||
using Newtonsoft.Json;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Drawing.Printing;
|
||
using System.Linq;
|
||
using System.Reflection;
|
||
using System.Windows.Forms;
|
||
|
||
namespace DrawGraphManagement
|
||
{
|
||
public partial class Main : Form
|
||
{
|
||
TemplateManage templateManage = new TemplateManage();
|
||
object operationRecor = new DrawGraph.OperationRecord();
|
||
AreaManageBase areaManageBase = new AreaManageBase();
|
||
|
||
public Main()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
private void Main_Load(object sender, EventArgs e)
|
||
{
|
||
HospitalInfo hospital = BHospitalInfo.SelectSingle(1);
|
||
txtHospitalName.Text = hospital.HospitalName;
|
||
Person PersonObj = BPerson.GetModelByNo("admin");
|
||
AIMSExtension.PublicMethod.OperatorId = PersonObj.Id.Value;
|
||
AIMSExtension.PublicMethod.OperatorNo = PersonObj.No;
|
||
AIMSExtension.PublicMethod.OperatorName = PersonObj.Name;
|
||
AIMSExtension.PublicMethod.RoleId = PersonObj.RoleId.Value;
|
||
AIMSExtension.PublicMethod.DepId = PersonObj.DepId.Value;
|
||
AIMSExtension.PublicMethod.DeptName = BDepartment.GetModel(PersonObj.DepId.Value).Name;
|
||
Role role = BRole.GetModel(PersonObj.RoleId.Value);
|
||
AIMSExtension.PublicMethod.PermissionLevel = role.PermissionLevel == null ? 0 : role.PermissionLevel.Value;
|
||
AIMSExtension.PublicMethod.RoleName = BMenu.GetMenuRootListManageStr(AIMSExtension.PublicMethod.RoleId, "功能权限");
|
||
myPanel1.MouseWheel += new System.Windows.Forms.MouseEventHandler(panel1_MouseWheel);
|
||
LoadManageList();
|
||
}
|
||
/// <summary>
|
||
/// 加载管理器列表
|
||
/// </summary>
|
||
private void LoadManageList()
|
||
{
|
||
Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "DrawGraph.dll");//你的loadfile
|
||
Type baseType = typeof(AreaManageBase);
|
||
List<Type> types = assembly.GetTypes().Where<Type>(t => t.IsSubclassOf(baseType)).ToList<Type>();
|
||
List<Type> viewTypes = types.Where<Type>(s => s.FullName.IndexOf(".document.") < 0).ToList<Type>();
|
||
List<Type> wsTypes = types.Where<Type>(s => s.FullName.IndexOf(".document.") >= 0).ToList<Type>();
|
||
|
||
cmbManageList.Items.Clear();
|
||
foreach (Type t in viewTypes)
|
||
{
|
||
cmbManageList.Items.Add(t.Name);
|
||
}
|
||
cmbManageList.Items.Add("-------------------");
|
||
foreach (Type t in wsTypes)
|
||
{
|
||
cmbManageList.Items.Add(t.Name);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置界面自适应
|
||
/// </summary>
|
||
private void AutoSizeF()
|
||
{
|
||
#region 设置界面自适应
|
||
if (templateManage.ZedControl == null) return;
|
||
|
||
if (templateManage.Typesetting == TypesettingEnum.Horizontal)
|
||
{
|
||
//在此处可随时设置板子的属性
|
||
templateManage.ZedControl.Height = templateManage.GetPageWidth();
|
||
templateManage.ZedControl.Width = Convert.ToInt32(templateManage.ZedControl.Height * 1.414) + 2;
|
||
}
|
||
else
|
||
{
|
||
//在此处可随时设置板子的属性
|
||
templateManage.ZedControl.Width = templateManage.GetPageWidth();// templateManage.ZedControl.Parent.Width - 54;
|
||
templateManage.ZedControl.Height = Convert.ToInt32(templateManage.ZedControl.Width * 1.414) + 2;
|
||
}
|
||
templateManage.ZedControl.AxisChange();
|
||
templateManage.ZedControl.Refresh();
|
||
//最后还要调整图表进行自适应
|
||
PackObjBase pack = templateManage.GetPackObjectOTag<PackObjBase>("PhysioDataManage_ChartPackObj_6");
|
||
if (pack != null)
|
||
pack.Draw();
|
||
#endregion
|
||
}
|
||
|
||
/// <summary>
|
||
/// 全部刷新
|
||
/// </summary>
|
||
private void AllRefresh()
|
||
{
|
||
treeView1.Nodes.Clear();
|
||
foreach (AreaManageBase area in templateManage.ManageList)
|
||
{
|
||
//把管理器增加到树控件里
|
||
InsertPackObjTree(area);
|
||
List<PackObjBase> ables = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack in ables)
|
||
{
|
||
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
||
if (ableEdit != null) ableEdit.IsVisible = false;
|
||
}
|
||
}
|
||
//画区域
|
||
drawArea();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新建管理器
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void btnCreate_Click(object sender, EventArgs e)
|
||
{
|
||
string instanceName = cmbManageList.Text.Trim();
|
||
string name = txtManageName.Text.Trim();
|
||
string projectName = txtProjectName.Text.Trim();
|
||
if (instanceName == "" || name == "" || projectName == "")
|
||
{
|
||
MessageBox.Show("类名称及区域名称或项目名称不能为空!!!");
|
||
return;
|
||
}
|
||
|
||
areaManageBase = BoardFormUtil.AreaManageFactory(instanceName, templateManage.OpeRecord, zedGraphMain, templateManage, name);
|
||
bool isAddOk = templateManage.AddManage(areaManageBase);
|
||
if (isAddOk)
|
||
{
|
||
templateManage.ProjectName = projectName;
|
||
Point point = templateManage.GetBorderPackWH();
|
||
AreaManageForm form = form = new AreaManageForm(areaManageBase, PageStatus.Create, point.X, point.Y);
|
||
form.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.AreaManageForm_FormClosed);
|
||
form.Show();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("不能增加重复的管理器名称或管理器类名称");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 插入指定树结点的管理器控件内容
|
||
/// </summary>
|
||
/// <param name="areaManage"></param>
|
||
private void InsertPackObjTree(AreaManageBase areaManage)
|
||
{
|
||
TreeNode tnSub = new TreeNode();
|
||
tnSub.Name = areaManage.Name;
|
||
tnSub.Tag = areaManage;
|
||
tnSub.Text = areaManage.ClassName + "-" + areaManage.Name;
|
||
treeView1.Nodes.Add(tnSub);
|
||
//treeView1.SelectedNode = tnSub;
|
||
TreeNodeMouseClickEventArgs e = new TreeNodeMouseClickEventArgs(tnSub, 0, 0, 0, 0);
|
||
//treeView1_NodeMouseClick(treeView1, e);
|
||
}
|
||
|
||
private void drawArea()
|
||
{
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.DrawArea();
|
||
}
|
||
|
||
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||
{
|
||
if (e.Button == MouseButtons.Right)
|
||
{
|
||
//选中点击的节点
|
||
treeView1.SelectedNode = e.Node;
|
||
//获取节点区域的右下角坐标值
|
||
Point pos = new Point(e.Node.Bounds.X + e.Node.Bounds.Width, e.Node.Bounds.Y + e.Node.Bounds.Height);
|
||
//在选中的节点的右下角,弹出右键菜单,并设定控制者为treeView
|
||
contextMenuStrip1.Show(treeView1, pos);
|
||
}
|
||
if (e.Button == MouseButtons.Left)
|
||
{
|
||
TreeNode tn = e.Node;
|
||
AreaManageBase area = (AreaManageBase)tn.Tag;
|
||
if (area != null)
|
||
{
|
||
txtAreaX.DataBindings.Clear();
|
||
txtAreaX.DataBindings.Add("text", area.PackManage, "X");
|
||
txtAreaY.DataBindings.Clear();
|
||
txtAreaY.DataBindings.Add("text", area.PackManage, "Y");
|
||
}
|
||
}
|
||
}
|
||
|
||
private void EditAreaMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
TreeNode treeNode = treeView1.SelectedNode;
|
||
AreaManageBase selectAreaManage = treeNode.Tag as AreaManageBase;
|
||
|
||
Point point = templateManage.GetBorderPackWH();
|
||
AreaManageForm form = new AreaManageForm(selectAreaManage, PageStatus.Edit, point.X, point.Y);
|
||
form.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.AreaManageForm_FormClosed);
|
||
form.Show();
|
||
}
|
||
private void AreaManageForm_FormClosed(object sender, EventArgs e)
|
||
{
|
||
AreaManageForm form = sender as AreaManageForm;
|
||
if (form != null && form.pageStatus == PageStatus.Create)
|
||
{
|
||
InsertPackObjTree(areaManageBase);
|
||
}
|
||
//画区域
|
||
drawArea();
|
||
|
||
AutoSizeF();
|
||
}
|
||
|
||
private void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
bool reVal = templateManage.Save();
|
||
if (reVal)
|
||
{
|
||
new frmMessageBox().Show();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 删除区域
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void ToolStripMenuItem2_Click(object sender, EventArgs e)
|
||
{
|
||
DialogResult result = MessageBox.Show("确认要删除所有内容吗", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||
if (result == DialogResult.Yes)
|
||
{
|
||
TreeNode node = treeView1.SelectedNode;
|
||
if (node != null)
|
||
{
|
||
AreaManageBase area = node.Tag as AreaManageBase;
|
||
if (area != null)
|
||
{
|
||
templateManage.DelManage(area);
|
||
treeView1.Nodes.Remove(node);
|
||
//画区域
|
||
drawArea();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
private bool zedGraphMain_MouseDownEvent(ZedGraphControl sender, MouseEventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.zedControl_MouseDownEvent(sender, e);
|
||
}
|
||
return default(bool);
|
||
}
|
||
|
||
private bool zedGraphMain_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.zedControl_MouseMoveEvent(sender, e);
|
||
}
|
||
return default(bool);
|
||
}
|
||
|
||
private bool zedGraphMain_MouseUpEvent(ZedGraphControl sender, MouseEventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.zedControl_MouseUpEvent(sender, e);
|
||
}
|
||
return default(bool);
|
||
}
|
||
|
||
private void zedGraphMain_MouseDoubleClick(object sender, MouseEventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
ZedGraphControl send = sender as ZedGraphControl;
|
||
templateManage.zedControl_MouseDoubleClick(send, e);
|
||
}
|
||
}
|
||
|
||
private void zedGraphMain_KeyUp(object sender, KeyEventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
ZedGraphControl send = sender as ZedGraphControl;
|
||
templateManage.zedControl_KeyUp(send, e);
|
||
}
|
||
}
|
||
|
||
private void BtnBind_Click(object sender, EventArgs e)
|
||
{
|
||
if (textBox1.Text == "") return;
|
||
#region 绑定所有手术记录的值
|
||
int id = 14;
|
||
if (textBox1.Text != "") id = int.Parse(textBox1.Text);
|
||
operationRecor = BOperationRecord.getRecord(new OperationRecord(), id, 1);
|
||
templateManage.OpeRecord = operationRecor;
|
||
|
||
//指定对象的所有值属性的绑定
|
||
templateManage.BindOperationRecordValueAll(templateManage.OpeRecord);
|
||
//非值对象的数据绑定
|
||
templateManage.Bind();
|
||
#endregion
|
||
|
||
#region 单独赋值绑定
|
||
//设置对象属性的值,单独属性付值
|
||
//EntityObjectChangeNotifier.SetValue(templateManage.OpeRecord, "OperationRecord .MZQYY", "麻醉前用药文本", "麻醉前用药值");
|
||
//EntityObjectChangeNotifier.SetValue(templateManage.OpeRecord, "PatientRef.Bed", "12", "12值");
|
||
//EntityObjectChangeNotifier<OperationRecord>.SetValue(operationRecor, "OperationSiteId", "体位1", "TY1");
|
||
//EntityObjectChangeNotifier<OperationRecord>.SetValue(operationRecor, "InRoomTime", "2020-08-20 16:09");
|
||
//EntityObjectChangeNotifier<OperationRecord>.SetValue(operationRecor, "OperationApplyRef.ApplyDepartmentRef.HospitalName", "dep234");
|
||
#endregion
|
||
//templateManage.NotificationAreaBindingUpdate("备注区域").NotificationAreaBindingUpdate("监测区域");
|
||
zedGraphMain.Refresh();
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
this.Close();
|
||
this.Close();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
}
|
||
private void panel1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
|
||
{
|
||
templateManage.SetPYL();
|
||
}
|
||
private void myPanel1_Scroll(object sender, ScrollEventArgs e)
|
||
{
|
||
templateManage.SetPYL();
|
||
}
|
||
|
||
private void button1_Click_1(object sender, EventArgs e)
|
||
{
|
||
if (templateManage != null && templateManage.ManageList.Count > 0)
|
||
{
|
||
int OperationApplyId = 10;
|
||
if (textBox1.Text.Trim() != "") OperationApplyId = int.Parse(textBox1.Text.Trim());
|
||
DocumentParent documentParent = new DocumentParent();
|
||
documentParent.OperationApplyId = OperationApplyId;
|
||
//documentParent.OpeRecord = BOperationRecord.SelectSingle("OperationApplyId=@OperationApplyId", new ParameterList("@OperationApplyId", OperationApplyId), RecursiveType.Parent, 3);
|
||
|
||
if (templateManage.OpeRecord == null) return;
|
||
//指定对象的所有值属性的绑定
|
||
templateManage.BindOperationRecordValueAll(templateManage.OpeRecord);
|
||
templateManage.SetPYL(); //得设置一下偏移量
|
||
//非值对象的数据绑定
|
||
templateManage.Bind();
|
||
}
|
||
}
|
||
|
||
private void button3_Click(object sender, EventArgs e)
|
||
{
|
||
string txtFont = txtFontSize.Text.Trim();
|
||
foreach (AreaManageBase manage in templateManage.ManageList)
|
||
{
|
||
List<PackObjBase> ables = manage.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack in ables)
|
||
{
|
||
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
||
ableEdit.EditFontSize = int.Parse(txtFont);
|
||
}
|
||
}
|
||
}
|
||
|
||
private void button4_Click(object sender, EventArgs e)
|
||
{
|
||
templateManage.BindDefaultValue();
|
||
}
|
||
|
||
private void button5_Click(object sender, EventArgs e)
|
||
{
|
||
templateManage.ClearEdit();
|
||
}
|
||
|
||
private void cmbTypesetting_SelectedValueChanged(object sender, EventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
string typeset = cmbTypesetting.Text;
|
||
if (typeset == "横向")
|
||
{
|
||
templateManage.Typesetting = TypesettingEnum.Horizontal;
|
||
}
|
||
else
|
||
{
|
||
templateManage.Typesetting = TypesettingEnum.Vertical;
|
||
}
|
||
AutoSizeF();
|
||
}
|
||
}
|
||
|
||
private void cmbPageType_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
string pageType = cmbPageType.Text;
|
||
if (pageType == "A4")
|
||
{
|
||
templateManage.PageType = PageTypeEnum.A4;
|
||
}
|
||
else
|
||
{
|
||
templateManage.PageType = PageTypeEnum.A3;
|
||
}
|
||
AutoSizeF();
|
||
}
|
||
}
|
||
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.ControlClear();
|
||
}
|
||
|
||
try
|
||
{
|
||
|
||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=1").ToString();
|
||
if (jsonStr != null && jsonStr != "")
|
||
{
|
||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.OpeRecord = operationRecor;
|
||
templateManage.Id = 1;
|
||
bool reVal = templateManage.Load();
|
||
if (reVal)
|
||
{
|
||
AllRefresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
AutoSizeF();
|
||
|
||
}
|
||
|
||
//设置排版值
|
||
if (templateManage.Typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
cmbTypesetting.Text = "竖向";
|
||
}
|
||
else
|
||
{
|
||
cmbTypesetting.Text = "横向";
|
||
}
|
||
//设置纸张类型
|
||
if (templateManage.PageType == PageTypeEnum.A4)
|
||
{
|
||
cmbPageType.Text = "A4";
|
||
}
|
||
else
|
||
{
|
||
cmbPageType.Text = "A3";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
private void button6_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.ControlClear();
|
||
}
|
||
|
||
try
|
||
{
|
||
|
||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=10").ToString();
|
||
if (jsonStr != null && jsonStr != "")
|
||
{
|
||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.OpeRecord = operationRecor;
|
||
templateManage.Id = 10;
|
||
bool reVal = templateManage.Load();
|
||
if (reVal)
|
||
{
|
||
AllRefresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
AutoSizeF();
|
||
|
||
}
|
||
|
||
//设置排版值
|
||
if (templateManage.Typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
cmbTypesetting.Text = "竖向";
|
||
}
|
||
else
|
||
{
|
||
cmbTypesetting.Text = "横向";
|
||
}
|
||
//设置纸张类型
|
||
if (templateManage.PageType == PageTypeEnum.A4)
|
||
{
|
||
cmbPageType.Text = "A4";
|
||
}
|
||
else
|
||
{
|
||
cmbPageType.Text = "A3";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
private void button7_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.ControlClear();
|
||
}
|
||
|
||
try
|
||
{
|
||
|
||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=20").ToString();
|
||
if (jsonStr != null && jsonStr != "")
|
||
{
|
||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.OpeRecord = operationRecor;
|
||
templateManage.Id = 20;
|
||
bool reVal = templateManage.Load();
|
||
if (reVal)
|
||
{
|
||
AllRefresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
AutoSizeF();
|
||
|
||
}
|
||
|
||
//设置排版值
|
||
if (templateManage.Typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
cmbTypesetting.Text = "竖向";
|
||
}
|
||
else
|
||
{
|
||
cmbTypesetting.Text = "横向";
|
||
}
|
||
//设置纸张类型
|
||
if (templateManage.PageType == PageTypeEnum.A4)
|
||
{
|
||
cmbPageType.Text = "A4";
|
||
}
|
||
else
|
||
{
|
||
cmbPageType.Text = "A3";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
|
||
private void button9_Click(object sender, EventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.ControlClear();
|
||
}
|
||
|
||
try
|
||
{
|
||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=50").ToString();
|
||
if (jsonStr != null && jsonStr != "")
|
||
{
|
||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.OpeRecord = operationRecor;
|
||
templateManage.Id = 50;
|
||
bool reVal = templateManage.Load();
|
||
if (reVal)
|
||
{
|
||
AllRefresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
AutoSizeF();
|
||
|
||
}
|
||
|
||
//设置排版值
|
||
if (templateManage.Typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
cmbTypesetting.Text = "竖向";
|
||
}
|
||
else
|
||
{
|
||
cmbTypesetting.Text = "横向";
|
||
}
|
||
//设置纸张类型
|
||
if (templateManage.PageType == PageTypeEnum.A4)
|
||
{
|
||
cmbPageType.Text = "A4";
|
||
}
|
||
else
|
||
{
|
||
cmbPageType.Text = "A3";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
}
|
||
|
||
private void button8_Click(object sender, EventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.ControlClear();
|
||
}
|
||
|
||
try
|
||
{
|
||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=30").ToString();
|
||
if (jsonStr != null && jsonStr != "")
|
||
{
|
||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.OpeRecord = operationRecor;
|
||
templateManage.Id = 30;
|
||
bool reVal = templateManage.Load();
|
||
if (reVal)
|
||
{
|
||
AllRefresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
AutoSizeF();
|
||
|
||
}
|
||
|
||
//设置排版值
|
||
if (templateManage.Typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
cmbTypesetting.Text = "竖向";
|
||
}
|
||
else
|
||
{
|
||
cmbTypesetting.Text = "横向";
|
||
}
|
||
//设置纸张类型
|
||
if (templateManage.PageType == PageTypeEnum.A4)
|
||
{
|
||
cmbPageType.Text = "A4";
|
||
}
|
||
else
|
||
{
|
||
cmbPageType.Text = "A3";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
|
||
}
|
||
|
||
private void button10_Click(object sender, EventArgs e)
|
||
{
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.ControlClear();
|
||
}
|
||
|
||
try
|
||
{
|
||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=40").ToString();
|
||
if (jsonStr != null && jsonStr != "")
|
||
{
|
||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.OpeRecord = operationRecor;
|
||
templateManage.Id = 40;
|
||
bool reVal = templateManage.Load();
|
||
if (reVal)
|
||
{
|
||
AllRefresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
AutoSizeF();
|
||
|
||
}
|
||
|
||
//设置排版值
|
||
if (templateManage.Typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
cmbTypesetting.Text = "竖向";
|
||
}
|
||
else
|
||
{
|
||
cmbTypesetting.Text = "横向";
|
||
}
|
||
//设置纸张类型
|
||
if (templateManage.PageType == PageTypeEnum.A4)
|
||
{
|
||
cmbPageType.Text = "A4";
|
||
}
|
||
else
|
||
{
|
||
cmbPageType.Text = "A3";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
|
||
}
|
||
|
||
private void button11_Click(object sender, EventArgs e)
|
||
{
|
||
frmTemplateD frmTemplateD = new frmTemplateD();
|
||
frmTemplateD.Show();
|
||
}
|
||
|
||
private void button12_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
if (templateManage != null)
|
||
{
|
||
templateManage.ControlClear();
|
||
}
|
||
|
||
try
|
||
{
|
||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=60").ToString();
|
||
if (jsonStr != null && jsonStr != "")
|
||
{
|
||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||
templateManage.ZedControl = zedGraphMain;
|
||
templateManage.OpeRecord = operationRecor;
|
||
templateManage.Id = 60;
|
||
bool reVal = templateManage.Load();
|
||
if (reVal)
|
||
{
|
||
AllRefresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(templateManage.MsgStr);
|
||
}
|
||
AutoSizeF();
|
||
|
||
}
|
||
|
||
//设置排版值
|
||
if (templateManage.Typesetting == TypesettingEnum.Vertical)
|
||
{
|
||
cmbTypesetting.Text = "竖向";
|
||
}
|
||
else
|
||
{
|
||
cmbTypesetting.Text = "横向";
|
||
}
|
||
//设置纸张类型
|
||
if (templateManage.PageType == PageTypeEnum.A4)
|
||
{
|
||
cmbPageType.Text = "A4";
|
||
}
|
||
else
|
||
{
|
||
cmbPageType.Text = "A3";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message);
|
||
}
|
||
|
||
}
|
||
|
||
private void btnPrint_Click(object sender, EventArgs e)
|
||
{
|
||
if (textBox1.Text == "") return;
|
||
try
|
||
{
|
||
mPanes = new List<MasterPane>();
|
||
UpPanes = new List<MasterPane>();
|
||
|
||
PrintDocPage(null, null);
|
||
|
||
count = 0;
|
||
int pylWidth = 3;
|
||
System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
|
||
pDoc.DefaultPageSettings.Landscape = false;
|
||
pDoc.OriginAtMargins = true;
|
||
pDoc.DefaultPageSettings.PrinterResolution.Kind = PrinterResolutionKind.High;
|
||
pDoc.DefaultPageSettings.Margins = new Margins(pylWidth, 0, 0, 0);
|
||
pDoc.PrintPage -= new PrintPageEventHandler(pDoc_PrintPage);
|
||
pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPage);
|
||
|
||
System.Windows.Forms.PrintDialog pDlg = new System.Windows.Forms.PrintDialog();
|
||
pDlg.Document = pDoc;
|
||
if (pDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||
{
|
||
pDoc.Print();
|
||
}
|
||
count = 0;
|
||
}
|
||
catch (Exception exp)
|
||
{
|
||
PublicMethod.WriteLog(exp, "");
|
||
}
|
||
}
|
||
public List<MasterPane> mPanes = new List<MasterPane>();
|
||
public List<MasterPane> UpPanes = new List<MasterPane>();
|
||
int m_startPrintPage;// 打印的起始页码
|
||
int m_endPrintPage;//打印的终止页码
|
||
int count = 0;
|
||
private void pDoc_PrintPage(object sender, PrintPageEventArgs e)
|
||
{
|
||
System.Drawing.Printing.PrintDocument pDoc = sender as System.Drawing.Printing.PrintDocument;
|
||
m_startPrintPage = pDoc.PrinterSettings.FromPage;
|
||
m_endPrintPage = pDoc.PrinterSettings.ToPage;
|
||
|
||
int printCount = mPanes.Count;
|
||
if (mPanes.Count > 0 && count < printCount)
|
||
{
|
||
mPanes[count].Draw(e.Graphics);
|
||
count++;
|
||
if (count < printCount)
|
||
{
|
||
e.HasMorePages = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
e.HasMorePages = false;
|
||
}
|
||
}
|
||
private void PrintDocPage(object sender, PrintPageEventArgs e)
|
||
{
|
||
OperationRecord _record = operationRecor as OperationRecord;
|
||
if (_record.currentPage == 1)
|
||
{
|
||
PrintDocPane(e, zedGraphMain, templateManage, true);
|
||
//PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
||
}
|
||
//else
|
||
//{
|
||
// for (int i = 1; i <= _record.pageCount; i++)
|
||
// {
|
||
// PrintDocPane(e, zgcAnaesRecord, templateManage, true);
|
||
// if (i == 1)
|
||
// {
|
||
// PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
||
// }
|
||
// btnNextPage_Click(null, null);
|
||
// if (i != 1)
|
||
// {
|
||
// MasterPane mPane = new MasterPane();
|
||
// mPane.Border.IsVisible = false;
|
||
// mPanes.Add(mPane);
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
}
|
||
|
||
|
||
private void PrintDocPane(PrintPageEventArgs e, ZedGraphControl zedGraph, TemplateManage template, bool InitChart)
|
||
{
|
||
OperationRecord _record = operationRecor as OperationRecord;
|
||
foreach (AreaManageBase area in template.ManageList)
|
||
{
|
||
area.setPrint(false);
|
||
area.BindTempData();
|
||
}
|
||
int zedGraphMainWidth = zedGraph.Size.Width;
|
||
int zedGraphMainHeight = zedGraph.Size.Height;
|
||
|
||
int width = 825;
|
||
int height = Convert.ToInt32(width * 1.414) + 2;
|
||
zedGraph.Size = new Size(width, height);
|
||
zedGraph.Width = width;
|
||
zedGraph.Height = height;
|
||
|
||
if (InitChart == true)
|
||
foreach (PhysioDataConfig pp in _record.PhysioConfigList)
|
||
{
|
||
if (pp.ShowText == true)
|
||
{
|
||
pp.IsValid = false;
|
||
///重新设置曲线属性
|
||
pp.reSetCurveSpo2();
|
||
}
|
||
}
|
||
TipBox.Hidden();
|
||
|
||
MasterPane mPane = zedGraph.MasterPane; //this.MasterPane;
|
||
mPane.Border.IsVisible = false;
|
||
//当前窗体中的矩形区域大小
|
||
RectangleF saveRect = mPane.Rect;
|
||
if (InitChart == true)
|
||
template.initChart();
|
||
mPanes.Add(mPane.Clone());
|
||
if (e != null)
|
||
mPane.Draw(e.Graphics); //在打印文档中画出MasterPane内容
|
||
using (Graphics g = zedGraph.CreateGraphics())
|
||
{
|
||
mPane.ReSize(g, saveRect);
|
||
}
|
||
|
||
zedGraph.Size = new Size(zedGraphMainWidth, zedGraphMainHeight);
|
||
if (InitChart == true)
|
||
template.initChart();
|
||
UpPanes.Add(mPane.Clone());
|
||
|
||
if (InitChart == true)
|
||
foreach (PhysioDataConfig pp in _record.PhysioConfigList)
|
||
{
|
||
if (pp.ShowText == true)
|
||
{
|
||
pp.IsValid = true;
|
||
///重新设置曲线属性
|
||
pp.reSetCurveSpo2();
|
||
}
|
||
}
|
||
//if (InitChart == false)
|
||
//{
|
||
// int LocationY = Convert.ToInt32(templateManage2.ZedControl.Height * 0.065);
|
||
// templateManage2.LocationY = LocationY;
|
||
// templateManage2.SetPYL();
|
||
// foreach (AreaManageBase area in template.ManageList)
|
||
// {
|
||
// area.setPrint(true);
|
||
// }
|
||
//}
|
||
//else
|
||
//{
|
||
int LocationY = Convert.ToInt32(templateManage.ZedControl.Height * 0.04);
|
||
templateManage.LocationY = LocationY;
|
||
templateManage.SetPYL();
|
||
foreach (AreaManageBase area in template.ManageList)
|
||
{
|
||
area.setPrint(true);
|
||
}
|
||
//}
|
||
}
|
||
}
|
||
}
|