867 lines
32 KiB
C#
867 lines
32 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);
|
|
LoadManageList();
|
|
|
|
button10_Click(null, null);
|
|
BtnBind_Click(null, null);
|
|
}
|
|
/// <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()
|
|
{
|
|
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 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 + "\\backup.xps";
|
|
pDoc.PrinterSettings.PrintToFile = true;
|
|
pDoc.PrinterSettings.PrinterName = "XPS";
|
|
pDoc.DefaultPageSettings.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
|
|
pDoc.Print();
|
|
|
|
FixedDocument2Pdf();
|
|
}
|
|
catch (Exception exp)
|
|
{
|
|
PublicMethod.WriteLog(exp, "");
|
|
}
|
|
}
|
|
public static void FixedDocument2Pdf( )
|
|
{
|
|
//// Convert FixedDocument to XPS file in memory
|
|
//var ms = new MemoryStream();
|
|
//var package = Package.Open(ms, FileMode.Create);
|
|
//var doc = new XpsDocument(package);
|
|
//var writer = XpsDocument.CreateXpsDocumentWriter(doc);
|
|
//writer.Write(fd.DocumentPaginator);
|
|
//doc.Close();
|
|
//package.Close();
|
|
|
|
//// Get XPS file bytes
|
|
//var bytes = ms.ToArray();
|
|
//ms.Dispose();
|
|
|
|
byte[] bytes = File.ReadAllBytes( Application.StartupPath + "\\backup.xps");
|
|
|
|
// Print to PDF
|
|
var outputFilePath = @"D:\test.pdf";
|
|
PdfFilePrinter.PrintXpsToPdf(bytes, outputFilePath, "Document Title");
|
|
}
|
|
|
|
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 static void ImageConvertToPdfAnes(List<System.Drawing.Image> Images, string SvaePath = @"D:\Temp.pdf")
|
|
//{
|
|
// try
|
|
// {
|
|
// System.Drawing.Image pic = Images[0];//strFilePath是该图片的绝对路径
|
|
// int intWidth = pic.Width;//长度像素值
|
|
// int intHeight = pic.Height;//高度像素值
|
|
// //pic.Dispose();
|
|
// iTextSharp.text.Rectangle pagesize = new iTextSharp.text.Rectangle(intWidth, intHeight);
|
|
// Document pdfdoc = new Document(pagesize);//建立Document对象的实例,并设置Document的大小与边距。
|
|
|
|
// PdfWriter writer = PdfWriter.GetInstance(pdfdoc, new FileStream(SvaePath, FileMode.Create)); //建立一个PdWf riter对象Writer与document对象关联,通过Writer可以将文档写入到磁盘中。
|
|
// pdfdoc.Open(); //打开文档。
|
|
// PdfContentByte cb = writer.DirectContent;
|
|
// foreach (System.Drawing.Image image in Images)
|
|
// {
|
|
// image.Save(@"D:\temp.Jpeg", ImageFormat.Jpeg);
|
|
// iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(@"D:\temp.Jpeg");
|
|
// img.SetAbsolutePosition(0, 0);
|
|
// cb.AddImage(img); //向文档中添加图像数据。
|
|
// pdfdoc.NewPage();
|
|
// }
|
|
// pdfdoc.Close(); //关闭文档,将缓冲区的内容写入磁盘以保存文件。
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// }
|
|
//}
|
|
//public void ImageConvertToPdfAnes2(string SvaePath = @"D:\Temp.pdf")
|
|
//{
|
|
// try
|
|
// {
|
|
// int intWidth = zgcAnaesRecord.Width;//长度像素值
|
|
// int intHeight = zgcAnaesRecord.Height;//高度像素值
|
|
// //pic.Dispose();
|
|
// iTextSharp.text.Rectangle pagesize = new iTextSharp.text.Rectangle(intWidth, intHeight);
|
|
// Document pdfdoc = new Document(pagesize);//建立Document对象的实例,并设置Document的大小与边距。
|
|
|
|
// PdfWriter writer = PdfWriter.GetInstance(pdfdoc, new FileStream(SvaePath, FileMode.Create)); //建立一个PdWf riter对象Writer与document对象关联,通过Writer可以将文档写入到磁盘中。
|
|
// pdfdoc.Open(); //打开文档。
|
|
// PdfContentByte cb = writer.DirectContent;
|
|
// foreach (MasterPane image in mPanes)
|
|
// {
|
|
// // 创建一个位图对象
|
|
// Bitmap bitmap = new Bitmap(intWidth, intHeight);
|
|
// // 创建一个画布对象
|
|
// Graphics g = Graphics.FromImage(bitmap);
|
|
// g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
|
// g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
|
// g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
|
// // 清除画布表面,填充指定的颜色
|
|
// //g.Clear(Color.White);
|
|
// image.Draw(g);
|
|
// // 释放资源
|
|
// g.Dispose();
|
|
// bitmap.Save(@"D:\temp.Jpeg", ImageFormat.Png);
|
|
// iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(@"D:\temp.Jpeg");
|
|
// img.SetAbsolutePosition(0, 0);
|
|
// cb.AddImage(img); //向文档中添加图像数据。
|
|
// pdfdoc.NewPage();
|
|
// }
|
|
// pdfdoc.Close(); //关闭文档,将缓冲区的内容写入磁盘以保存文件。
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// }
|
|
//}
|
|
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);
|
|
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(_record.PatientId.Value);
|
|
if (i != 1)
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|