818 lines
28 KiB
C#
818 lines
28 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.IO;
|
|
using System.IO.Packaging;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Xps;
|
|
using System.Windows.Xps.Packaging;
|
|
|
|
namespace DrawGraphManagement
|
|
{
|
|
public partial class MainUp : Form
|
|
{
|
|
TemplateManage templateManage = new TemplateManage();
|
|
TemplateManage templateManage2 = new TemplateManage();
|
|
object operationRecor = new DrawGraph.OperationRecord();
|
|
|
|
public MainUp()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void MainUp_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);
|
|
|
|
}
|
|
public string DocumentName = "";
|
|
public string PrintAanesthesiaRecord(string PatientId)
|
|
{
|
|
textBox1.Text = PatientId;
|
|
button10_Click(null, null);
|
|
BtnBind_Click(null, null);
|
|
OperationRecord _record = operationRecor as OperationRecord;
|
|
DocumentName = "麻醉记录单_" + _record.InHospitalNo + "_" + _record.PatientId;
|
|
btnPrint_Click(null, null);
|
|
return DocumentName;
|
|
}
|
|
|
|
public string PrintAanesthesiaRecover(string PatientId)
|
|
{
|
|
textBox1.Text = PatientId;
|
|
button6_Click(null, null);
|
|
BtnBind1(int.Parse(PatientId), 2);
|
|
templateManage2 = null;
|
|
OperationRecord _record = operationRecor as OperationRecord;
|
|
DocumentName = "恢复记录单_" + _record.InHospitalNo + "_" + _record.PatientId;
|
|
btnPrint_Click(null, null);
|
|
return DocumentName;
|
|
}
|
|
|
|
public string PrintAanesthesiaPainlessRecord(string PatientId)
|
|
{
|
|
textBox1.Text = PatientId;
|
|
button12_Click(null, null);
|
|
BtnBind1(int.Parse(PatientId), 1);
|
|
templateManage2 = null;
|
|
OperationRecord _record = operationRecor as OperationRecord;
|
|
DocumentName = "镇静镇痛评估记录_" + _record.InHospitalNo + "_" + _record.PatientId;
|
|
btnPrint_Click(null, null);
|
|
return DocumentName;
|
|
}
|
|
|
|
/// <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()
|
|
{
|
|
foreach (AreaManageBase area in templateManage.ManageList)
|
|
{
|
|
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();
|
|
}
|
|
|
|
private void drawArea()
|
|
{
|
|
templateManage.ZedControl = zgcAnaesRecord;
|
|
templateManage.DrawArea();
|
|
}
|
|
|
|
private void AllRefresh2()
|
|
{
|
|
foreach (AreaManageBase area in templateManage2.ManageList)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
//画区域
|
|
drawArea2();
|
|
}
|
|
|
|
private void drawArea2()
|
|
{
|
|
templateManage2.ZedControl = zgcAnaesRecord2;
|
|
templateManage2.DrawArea();
|
|
}
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
bool reVal = templateManage.Save();
|
|
if (reVal)
|
|
{
|
|
new frmMessageBox().Show();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
}
|
|
|
|
private bool zgcAnaesRecord_MouseDownEvent(ZedGraphControl sender, MouseEventArgs e)
|
|
{
|
|
if (templateManage != null)
|
|
{
|
|
templateManage.zedControl_MouseDownEvent(sender, e);
|
|
}
|
|
return default(bool);
|
|
}
|
|
|
|
private bool zgcAnaesRecord_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
|
|
{
|
|
if (templateManage != null)
|
|
{
|
|
templateManage.zedControl_MouseMoveEvent(sender, e);
|
|
}
|
|
return default(bool);
|
|
}
|
|
|
|
private bool zgcAnaesRecord_MouseUpEvent(ZedGraphControl sender, MouseEventArgs e)
|
|
{
|
|
if (templateManage != null)
|
|
{
|
|
templateManage.zedControl_MouseUpEvent(sender, e);
|
|
}
|
|
return default(bool);
|
|
}
|
|
|
|
private void zgcAnaesRecord_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
{
|
|
if (templateManage != null)
|
|
{
|
|
ZedGraphControl send = sender as ZedGraphControl;
|
|
templateManage.zedControl_MouseDoubleClick(send, e);
|
|
}
|
|
}
|
|
|
|
private void zgcAnaesRecord_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();
|
|
|
|
templateManage2.OpeRecord = operationRecor;
|
|
|
|
//指定对象的所有值属性的绑定
|
|
templateManage2.BindOperationRecordValueAll(templateManage2.OpeRecord);
|
|
//非值对象的数据绑定
|
|
templateManage2.Bind();
|
|
#endregion
|
|
|
|
foreach (AreaManageBase area in templateManage.ManageList)
|
|
{
|
|
area.setPrint(true);
|
|
}
|
|
foreach (AreaManageBase area in templateManage2.ManageList)
|
|
{
|
|
area.setPrint(true);
|
|
}
|
|
|
|
zgcAnaesRecord.Refresh();
|
|
zgcAnaesRecord2.Refresh();
|
|
}
|
|
|
|
private void BtnBind1(int id, int RecoverId)
|
|
{
|
|
if (textBox1.Text == "") return;
|
|
#region 绑定所有手术记录的值
|
|
operationRecor = BOperationRecord.getRecord(new OperationRecord(), id, RecoverId);
|
|
templateManage.OpeRecord = operationRecor;
|
|
|
|
//指定对象的所有值属性的绑定
|
|
templateManage.BindOperationRecordValueAll(templateManage.OpeRecord);
|
|
//非值对象的数据绑定
|
|
templateManage.Bind();
|
|
|
|
#endregion
|
|
|
|
foreach (AreaManageBase area in templateManage.ManageList)
|
|
{
|
|
area.setPrint(true);
|
|
}
|
|
|
|
zgcAnaesRecord.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 button4_Click(object sender, EventArgs e)
|
|
{
|
|
templateManage.BindDefaultValue();
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
templateManage.ClearEdit();
|
|
}
|
|
|
|
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 = zgcAnaesRecord;
|
|
templateManage.OpeRecord = operationRecor;
|
|
templateManage.Id = 1;
|
|
bool reVal = templateManage.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
|
|
}
|
|
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 = zgcAnaesRecord;
|
|
templateManage.OpeRecord = operationRecor;
|
|
templateManage.Id = 10;
|
|
bool reVal = templateManage.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
|
|
}
|
|
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 = zgcAnaesRecord;
|
|
templateManage.OpeRecord = operationRecor;
|
|
templateManage.Id = 20;
|
|
bool reVal = templateManage.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
}
|
|
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 = zgcAnaesRecord;
|
|
templateManage.OpeRecord = operationRecor;
|
|
templateManage.Id = 50;
|
|
bool reVal = templateManage.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
|
|
}
|
|
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 = zgcAnaesRecord;
|
|
templateManage.OpeRecord = operationRecor;
|
|
templateManage.Id = 30;
|
|
bool reVal = templateManage.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
|
|
}
|
|
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 = zgcAnaesRecord;
|
|
templateManage.OpeRecord = operationRecor;
|
|
templateManage.Id = 40;
|
|
bool reVal = templateManage.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
|
|
try
|
|
{
|
|
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=50").ToString();
|
|
if (jsonStr != null && jsonStr != "")
|
|
{
|
|
templateManage2 = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
|
templateManage2.ZedControl = zgcAnaesRecord2;
|
|
templateManage2.OpeRecord = operationRecor;
|
|
templateManage2.Id = 50;
|
|
bool reVal = templateManage2.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh2();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage2.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
|
|
}
|
|
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 = zgcAnaesRecord;
|
|
templateManage.OpeRecord = operationRecor;
|
|
templateManage.Id = 60;
|
|
bool reVal = templateManage.Load();
|
|
if (reVal)
|
|
{
|
|
AllRefresh();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(templateManage.MsgStr);
|
|
}
|
|
AutoSizeF();
|
|
|
|
}
|
|
}
|
|
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);
|
|
|
|
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(33, 0, 35, 0);
|
|
pDoc.PrintPage -= new PrintPageEventHandler(pDoc_PrintPage);
|
|
pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPage);
|
|
pDoc.PrinterSettings.PrintFileName =
|
|
Application.StartupPath + "\\" + DocumentName + ".xps";
|
|
pDoc.PrinterSettings.PrintToFile = true;
|
|
pDoc.PrinterSettings.PrinterName = "XPS";
|
|
pDoc.DefaultPageSettings.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
|
|
pDoc.Print();
|
|
|
|
byte[] bytes = File.ReadAllBytes(Application.StartupPath + "\\" + DocumentName + ".xps");
|
|
// Print to PDF
|
|
var outputFilePath = @"E:\PatientDocuments\" + DocumentName + ".pdf";
|
|
PdfFilePrinter.PrintXpsToPdf(bytes, outputFilePath, "Document Title");
|
|
|
|
File.Delete(Application.StartupPath + "\\" + DocumentName + ".xps");
|
|
}
|
|
catch (Exception exp)
|
|
{
|
|
PublicMethod.WriteLog(exp, "");
|
|
}
|
|
}
|
|
|
|
int m_startPrintPage;// 打印的起始页码
|
|
int m_endPrintPage;//打印的终止页码
|
|
//int m_PageIndex;// 当前打印页码
|
|
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;
|
|
}
|
|
}
|
|
public List<MasterPane> mPanes = new List<MasterPane>();
|
|
public List<MasterPane> UpPanes = new List<MasterPane>();
|
|
private void PrintDocPage(object sender, PrintPageEventArgs e)
|
|
{
|
|
OperationRecord _record = operationRecor as OperationRecord;
|
|
if (_record.currentPage == 1)
|
|
{
|
|
PrintDocPane(e, zgcAnaesRecord, templateManage, true);
|
|
if (templateManage2!=null)
|
|
{
|
|
PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int i = 1; i <= _record.pageCount; i++)
|
|
{
|
|
PrintDocPane(e, zgcAnaesRecord, templateManage, true);
|
|
if (i == 1 && templateManage2!=null)
|
|
{
|
|
PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
|
}
|
|
btnNextPage_Click(_record.PatientId.Value);
|
|
if (i != 1 && templateManage2!=null)
|
|
{
|
|
MasterPane mPane = new MasterPane();
|
|
mPane.Border.IsVisible = false;
|
|
mPanes.Add(mPane);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public void SetNextPageTime()
|
|
{
|
|
OperationRecord _record = operationRecor as OperationRecord;
|
|
//当下一页的开始时间,小于当前最大时间
|
|
DateTime curTimeTemp = OperationRecord.getOpeMaxTime(_record);
|
|
if (_record.lastPageBegin > curTimeTemp) return;
|
|
//先设置新页的开始时间
|
|
_record.PageBegin = _record.lastPageBegin;
|
|
_record.lastPageBegin = _record.PageBegin.AddMinutes(240);
|
|
_record.pageCount++;
|
|
if (_record.pageCount > _record.currentPage) _record.pageCount = _record.currentPage;
|
|
|
|
}
|
|
|
|
private void btnNextPage_Click(int PatientId)
|
|
{
|
|
OperationRecord _record = operationRecor as OperationRecord;
|
|
if (PatientId == 0) return;
|
|
if (_record.pageCount == _record.currentPage) return;
|
|
SetNextPageTime();
|
|
|
|
try
|
|
{
|
|
if (PatientId != 0)
|
|
{
|
|
templateManage.OpeRecord = BOperationRecord.getRecord(_record, PatientId, 1);
|
|
templateManage2.OpeRecord = templateManage.OpeRecord;
|
|
templateManage.BindOperationRecordValueAll(templateManage.OpeRecord);
|
|
templateManage2.BindOperationRecordValueAll(templateManage2.OpeRecord);
|
|
|
|
templateManage.Bind();
|
|
templateManage2.Bind();
|
|
|
|
zgcAnaesRecord.Refresh();
|
|
zgcAnaesRecord2.Refresh();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicMethod.WriteLog(ex);
|
|
}
|
|
}
|
|
|
|
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 = 765;
|
|
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);
|
|
}
|
|
UpPanes.Add(mPane.Clone());
|
|
|
|
|
|
zedGraph.Size = new Size(zedGraphMainWidth, zedGraphMainHeight);
|
|
if (InitChart == true)
|
|
template.initChart();
|
|
|
|
if (InitChart == true)
|
|
foreach (PhysioDataConfig pp in _record.PhysioConfigList)
|
|
{
|
|
if (pp.ShowText == true)
|
|
{
|
|
pp.IsValid = true;
|
|
///重新设置曲线属性
|
|
pp.reSetCurveSpo2();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|