From f419a4556105c06aca44950ef5b865194f308905 Mon Sep 17 00:00:00 2001
From: lxd <1004405501@qq.com>
Date: Wed, 25 Dec 2024 17:24:22 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
1200Gxml心电图绘制.sln | 22 +
1200Gxml心电图绘制/App.config | 18 +
1200Gxml心电图绘制/CommonPrintEcgWave.cs | 2417 +++++++++++++++++
1200Gxml心电图绘制/CommonVerifyUrlResult.cs | 9 +
1200Gxml心电图绘制/ConfigHelper.cs | 1003 +++++++
1200Gxml心电图绘制/DESEncrypt.cs | 97 +
1200Gxml心电图绘制/EcgDataDraw_New.cs | 901 ++++++
1200Gxml心电图绘制/Form3.Designer.cs | 289 ++
1200Gxml心电图绘制/Form3.cs | 510 ++++
1200Gxml心电图绘制/Form3.resx | 126 +
1200Gxml心电图绘制/FtpHelper.cs | 266 ++
1200Gxml心电图绘制/LocalStorage.cs | 22 +
1200Gxml心电图绘制/Msg.cs | 22 +
1200Gxml心电图绘制/Program.cs | 21 +
1200Gxml心电图绘制/Properties/AssemblyInfo.cs | 36 +
.../Properties/Resources.Designer.cs | 63 +
1200Gxml心电图绘制/Properties/Resources.resx | 117 +
.../Properties/Settings.Designer.cs | 26 +
.../Properties/Settings.settings | 7 +
1200Gxml心电图绘制/SqliteOptions.cs | 204 ++
1200Gxml心电图绘制/ecgMeasure.cs | 76 +
1200Gxml心电图绘制/leadDataModel.cs | 24 +
1200Gxml心电图绘制/o23www.qsheal.com.ico | Bin 0 -> 4286 bytes
1200Gxml心电图绘制/packages.config | 5 +
1200Gxml心电图绘制/心电图绘制.csproj | 128 +
1200Gxml心电图绘制/服务/ConsoleLogger.cs | 53 +
1200Gxml心电图绘制/服务/ExampleServer.cs | 274 ++
1200Gxml心电图绘制/服务/LogHelper.cs | 128 +
1200Gxml心电图绘制/服务/PatientInfo.cs | 48 +
1200Gxml心电图绘制/服务/UniversalFun.cs | 133 +
1200Gxml心电图绘制/服务/print.cs | 328 +++
31 files changed, 7373 insertions(+)
create mode 100644 1200Gxml心电图绘制.sln
create mode 100644 1200Gxml心电图绘制/App.config
create mode 100644 1200Gxml心电图绘制/CommonPrintEcgWave.cs
create mode 100644 1200Gxml心电图绘制/CommonVerifyUrlResult.cs
create mode 100644 1200Gxml心电图绘制/ConfigHelper.cs
create mode 100644 1200Gxml心电图绘制/DESEncrypt.cs
create mode 100644 1200Gxml心电图绘制/EcgDataDraw_New.cs
create mode 100644 1200Gxml心电图绘制/Form3.Designer.cs
create mode 100644 1200Gxml心电图绘制/Form3.cs
create mode 100644 1200Gxml心电图绘制/Form3.resx
create mode 100644 1200Gxml心电图绘制/FtpHelper.cs
create mode 100644 1200Gxml心电图绘制/LocalStorage.cs
create mode 100644 1200Gxml心电图绘制/Msg.cs
create mode 100644 1200Gxml心电图绘制/Program.cs
create mode 100644 1200Gxml心电图绘制/Properties/AssemblyInfo.cs
create mode 100644 1200Gxml心电图绘制/Properties/Resources.Designer.cs
create mode 100644 1200Gxml心电图绘制/Properties/Resources.resx
create mode 100644 1200Gxml心电图绘制/Properties/Settings.Designer.cs
create mode 100644 1200Gxml心电图绘制/Properties/Settings.settings
create mode 100644 1200Gxml心电图绘制/SqliteOptions.cs
create mode 100644 1200Gxml心电图绘制/ecgMeasure.cs
create mode 100644 1200Gxml心电图绘制/leadDataModel.cs
create mode 100644 1200Gxml心电图绘制/o23www.qsheal.com.ico
create mode 100644 1200Gxml心电图绘制/packages.config
create mode 100644 1200Gxml心电图绘制/心电图绘制.csproj
create mode 100644 1200Gxml心电图绘制/服务/ConsoleLogger.cs
create mode 100644 1200Gxml心电图绘制/服务/ExampleServer.cs
create mode 100644 1200Gxml心电图绘制/服务/LogHelper.cs
create mode 100644 1200Gxml心电图绘制/服务/PatientInfo.cs
create mode 100644 1200Gxml心电图绘制/服务/UniversalFun.cs
create mode 100644 1200Gxml心电图绘制/服务/print.cs
diff --git a/1200Gxml心电图绘制.sln b/1200Gxml心电图绘制.sln
new file mode 100644
index 0000000..7dc6d93
--- /dev/null
+++ b/1200Gxml心电图绘制.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34723.18
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "心电图绘制", "1200Gxml心电图绘制\心电图绘制.csproj", "{3EBA2F41-DB73-407D-95D6-06293096F945}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3EBA2F41-DB73-407D-95D6-06293096F945}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3EBA2F41-DB73-407D-95D6-06293096F945}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3EBA2F41-DB73-407D-95D6-06293096F945}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3EBA2F41-DB73-407D-95D6-06293096F945}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/1200Gxml心电图绘制/App.config b/1200Gxml心电图绘制/App.config
new file mode 100644
index 0000000..ea3c09c
--- /dev/null
+++ b/1200Gxml心电图绘制/App.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/1200Gxml心电图绘制/CommonPrintEcgWave.cs b/1200Gxml心电图绘制/CommonPrintEcgWave.cs
new file mode 100644
index 0000000..988cafb
--- /dev/null
+++ b/1200Gxml心电图绘制/CommonPrintEcgWave.cs
@@ -0,0 +1,2417 @@
+//using DevExpress.Drawing.Internal.Fonts.Interop;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Drawing.Text;
+using System.Linq;
+using System.Security.Cryptography;
+
+namespace _1200Gxml心电图绘制
+{
+ public class CommonPrintEcgWave
+ {
+ private const int LeadCount12 = 12;
+ private const int LeadCount15 = 15;
+ private const int LeadCount18 = 18;
+ private const double PerInch = 1.03f; //振幅高度百分比(y值) 显示波形
+ private const float PrintInch = 0.30f;//0.95 //打印时波形
+ private const int LeadWaveLenth = 4; //前排波形的尾部与后排波形的标压名称之间的间隔
+ private const int LeadLenght = 550;
+ private readonly Dictionary _firstPointArray = new Dictionary(); //标压的坐标集合
+
+ private readonly List _leadList = new List
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 };
+
+ private readonly string[] _leadNameArray =
+ {
+ "I", "II", "III", "aVR", "aVL", "aVF", "V1", "V2", "V3", "V4", "V5", "V6", "V3R", "V4R", "V5R", "V7", "V8",
+ "V9"
+ };
+
+ private readonly Dictionary> _points = new Dictionary>(); //下坡线点集合
+ private double _amplitude = 10; //振幅,默认值
+ private int _baseLine;
+ private int _clearCount; //绘制QRS滤掉的点数
+ private readonly int _dpi = 300; //打印DPI,默认300
+ private Bitmap _ecgCanvas;
+ private Dictionary> _ecgDatas = new Dictionary>(); //心电数据集合
+ private Graphics _ecgGraphics;
+ private Pen _ecgPen; //画笔普通波形(除QRS波之外)
+ private Pen _ecgPenQrs; //画笔QRS波
+ private Point _firstPosition = new Point(0, 0);
+ private int _freePixs;
+ private double _intervalPixCountPerPoint;
+ private string _isQb; //是否起搏
+ private readonly double _lenthPerInch = 25.4;
+ private readonly int _oldDpi = 96; //电脑DPI,默认96
+ private double _paperSpeed = 25; //走速,默认值
+ private Pen _pen; //画笔报告标题和参数
+ private readonly double _samplingRate = 1000; //默认值
+ private Point _secondPosition = new Point(0, 0);
+
+ ///
+ /// 波形打印初始化参数
+ ///
+ ///
+ ///
+ ///
+ public void InitEcgParameter(Bitmap btmp, Dictionary> ecgDatas, string isQiBo,
+ double paperSpeed, double amplitude)
+ {
+ _paperSpeed = paperSpeed;
+ _amplitude = amplitude;
+ _ecgCanvas = btmp;
+ _ecgGraphics = Graphics.FromImage(_ecgCanvas);
+ _ecgGraphics.Clear(Color.White); //填充指定颜色
+ _ecgGraphics.SmoothingMode = SmoothingMode.AntiAlias; //抗锯齿
+ //Ecg_Graphics.CompositingQuality = CompositingQuality.HighQuality;//消除锯齿,最高品质
+ _ecgDatas = ecgDatas;
+ _pen = new Pen(Color.Black, float.Parse("2"));
+ _ecgPen = new Pen(Color.Black, float.Parse("2"));
+ _ecgPenQrs = new Pen(Color.Black,2); //ConfigHelper.WaveColor
+ _freePixs = (int)(Math.Round(_dpi / _lenthPerInch) * 5);
+ _isQb = isQiBo;
+ _intervalPixCountPerPoint = _paperSpeed / _samplingRate * _dpi / _lenthPerInch;
+ }
+
+ ///
+ /// 绘制心电图的背景网格
+ ///
+ public void PrintBackGroundGrid(int height1, int height2)
+ {
+ var ep = new Pen(Color.Gray, float.Parse("1")); //Black 背景网格颜色深 Gray 背景网格颜色浅
+
+ //if (ConfigHelper.IsDashOrSolid)
+ // ep.DashStyle = DashStyle.Solid;
+ //else
+ // ep.DashStyle = DashStyle.Dash;
+
+ ep.DashStyle = DashStyle.Dash;
+
+ const float
+ pointCountPerMM = 12f; //每个小网格间距 12mm;// Math.Abs(float.Parse(Dpi.ToString()) / (float)LenthPerInch);
+ var heightTop = height1 * pointCountPerMM + 8; //+ 0.2f
+ var heightBottm = height2 * (pointCountPerMM - 0.2f);
+ float x;
+ float y;
+ var cHeight = (int)heightBottm; //网格高度
+ _ecgGraphics.SmoothingMode = SmoothingMode.None; //保证网格线的清晰
+ for (int i = _ecgCanvas.Width, j = 0; i >= -72; i -= (int)pointCountPerMM, j++) //72 代表宽度相差6个小格间距
+ if (j % 5 == 0)
+ {
+ x = (float)Math.Round(i + j / 5 * 1.2, 2); //每个大格相差1.2mm
+ _ecgGraphics.DrawLine(ep, x, heightTop, x, cHeight);
+ // EcgViewPro.WatchDog.WriteMsg(j / 5 + "两竖线间距:" + Math.Round((xtest - x),2)+"----"+x+":"+i);
+ }
+
+ //绘制横线
+ for (int i = cHeight, j = 0; i >= heightTop - 36; i -= (int)pointCountPerMM, j++) //36 代表高度相差3个小格的间距
+ if (j % 5 == 0)
+ {
+ y = (float)Math.Round(i + j / 5 * 1.2, 2); //每个大格相差1.2mm
+ _ecgGraphics.DrawLine(ep, 0, y, _ecgCanvas.Width, y);
+ // EcgViewPro.WatchDog.WriteMsg(j / 5 + "两横线间距:" + Math.Round((xtest - y), 2) + "----" + y + ":" + i);
+ }
+ else
+ {
+ y = (float)Math.Round(i + j * 0.24, 2);
+ for (int k = _ecgCanvas.Width, t = 0; k >= -72; k -= (int)pointCountPerMM, t++)
+ {
+ x = (float)Math.Round(k + t * 0.24, 2); //每个小格相差0.24
+ if ((int)y < cHeight && (int)x < _ecgCanvas.Width)
+ if (t % 5 != 0)
+ _ecgCanvas.SetPixel((int)x, (int)y, Color.Black); //ConfigHelper.WaveColor
+ }
+ }
+ }
+
+ ///
+ /// 绘制心电报告的报告头
+ ///
+ public void PrintReportHeadInfo(string reportTitle, string reportDate)
+ {
+ var height = _freePixs * 3 - 55;
+ var font = new Font("隶书", 20);
+ var brush = Brushes.Black;
+ float reportLength = reportTitle.Any(t => t >= 0x4e00 && t <= 0x9fbb)? 20 * _dpi / _oldDpi * reportTitle.Length: 10 * _dpi / _oldDpi * reportTitle.Length;
+
+
+ var pointF = new PointF((_ecgCanvas.Width - reportLength) / 2 - 20 * _dpi / _oldDpi * 3, 15);
+ _ecgGraphics.DrawString(reportTitle, font, brush, pointF);
+
+ font = new Font("宋体", 10);
+ pointF = new PointF(_ecgCanvas.Width - 470, height - 50);
+ //_ecgGraphics.DrawString(LocalStorage.ResManager.GetString("ReportDate") + reportDate, font, brush, pointF); //报告日期
+ _ecgGraphics.DrawString( reportDate, font, brush, pointF); //报告日期
+
+ _ecgGraphics.DrawLine(_pen, 0, height, _ecgCanvas.Width, height); //第一条横线
+ }
+
+ ///
+ /// 绘制长十二导心电报告的报告头
+ ///
+ ///
+ public void PrintLongReportHeadInfo(string reportTitle)
+ {
+ var font = new Font("隶书", 20);
+ var brush = Brushes.Black;
+ //float reportLength = 20 * _dpi / _oldDpi * reportTitle.Length;
+ float reportLength = reportTitle.Any(t => t >= 0x4e00 && t <= 0x9fbb) ? 20 * _dpi / _oldDpi * reportTitle.Length : 10 * _dpi / _oldDpi * reportTitle.Length;
+ var point = new PointF((_ecgCanvas.Width - reportLength) / 2 - 20 * _dpi / _oldDpi * 3, (_freePixs * 3 + 20) / 3);
+ _ecgGraphics.DrawString(reportTitle, font, brush, point);
+
+ _ecgGraphics.DrawLine(_pen, 0, _freePixs * 3 + 20, _ecgCanvas.Width, _freePixs * 3 + 20);
+ }
+
+ ///
+ /// 绘制患者的心电识别的参数
+ ///
+ public void PrintEcgInfo(string[] diagInfoList, string idStr)
+ {
+ var font = new Font("宋体", 10, FontStyle.Regular);
+ var brush = Brushes.Black;
+ var firstPoint = 0;
+ var secondPoint = 850;
+ var height = _freePixs * 2 + 15;
+ //第一排
+ // var pId = LocalStorage.ResManager.GetString("pId");
+ var pointF = new PointF(firstPoint, height);
+ //_ecgGraphics.DrawString(pId + ":" + idStr, font, brush, pointF); //ID
+ _ecgGraphics.DrawString("编号:" + idStr, font, brush, pointF); //ID
+
+ pointF = new PointF(firstPoint, height + _freePixs);
+ _ecgGraphics.DrawString(diagInfoList[0], font, brush, pointF); //姓名
+
+ pointF = new PointF(firstPoint, height + _freePixs * 2);
+ _ecgGraphics.DrawString(diagInfoList[1], font, brush, pointF); //性别
+
+ pointF = new PointF(firstPoint, height + _freePixs * 3);
+ _ecgGraphics.DrawString(diagInfoList[2], font, brush, pointF); //年龄
+
+ pointF = new PointF(firstPoint, height + _freePixs * 4);
+ _ecgGraphics.DrawString(diagInfoList[10], font, brush, pointF); //病室
+
+ pointF = new PointF(firstPoint, height + _freePixs * 5);
+ _ecgGraphics.DrawString(diagInfoList[12], font, brush, pointF); //住院号
+
+ //第二排
+
+ pointF = new PointF(secondPoint, height);
+ _ecgGraphics.DrawString(diagInfoList[9], font, brush, pointF); //心率
+
+
+ pointF = new PointF(secondPoint, height + _freePixs * 1);
+ _ecgGraphics.DrawString(diagInfoList[4], font, brush, pointF); //P-R
+
+ pointF = new PointF(secondPoint, height + _freePixs * 2);
+ _ecgGraphics.DrawString(diagInfoList[5], font, brush, pointF); //QRS
+
+ pointF = new PointF(secondPoint, height + _freePixs * 3);
+ _ecgGraphics.DrawString(diagInfoList[6], font, brush, pointF); //QT/QTC
+
+ pointF = new PointF(secondPoint, height + _freePixs * 4);
+ //_ecgGraphics.DrawString(diagInfoList[7], font, brush, pointF); //QRS电轴
+ //_ecgGraphics.DrawString("", font, brush, pointF); //QRS电轴
+ _ecgGraphics.DrawString(diagInfoList[8].Replace(" ", string.Empty), font, brush, pointF); //RV5/SV1
+
+ pointF = new PointF(secondPoint, height + _freePixs * 5);
+ _ecgGraphics.DrawString(diagInfoList[3], font, brush, pointF); //RV5+SV1
+ //第三排
+ //pointF = new PointF(secondPoint + 550, height + _freePixs * 5);
+ //_ecgGraphics.DrawString(diagInfoList[3], font, brush, pointF); //RV5+SV1
+
+ //_ecgGraphics.DrawLine(_pen, 0, height + _freePixs * 5 + 54, _ecgCanvas.Width, height + _freePixs * 5 + 54);//第二条横线
+
+ //if (ConfigHelper.IsPrintQuickResponse && File.Exists(Application.StartupPath + "\\wx.gif"))
+ //{
+ // using (Image img = Image.FromFile(Application.StartupPath + "\\wx.gif"))
+ // {
+ // _ecgGraphics.DrawImage(img, _ecgCanvas.Width - 229, _freePixs * 2 + 20, 229, 230);
+ // }
+ //}
+ }
+
+ ///
+ /// 绘制长十二导心电识别的参数
+ ///
+ ///
+ public void PrintLongEcgInfo(string[] diagInfoList, string idStr)
+ {
+ var font = new Font("宋体", 10);
+ var brush = Brushes.Black;
+ var num = 3;
+
+ var point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * num + 65);
+ _ecgGraphics.DrawString(LocalStorage.ResManager.GetString("pId") + ":" + idStr, font, brush, point); //ID
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 1) + 65);
+ _ecgGraphics.DrawString(diagInfoList[0], font, brush, point); //姓名
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 2) + 65);
+ _ecgGraphics.DrawString(diagInfoList[1], font, brush, point); //性别
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 3) + 65);
+ _ecgGraphics.DrawString(diagInfoList[2], font, brush, point); //年龄
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 4) + 65);
+ _ecgGraphics.DrawString(diagInfoList[10], font, brush, point); //病室
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 5) + 65);
+ _ecgGraphics.DrawString(diagInfoList[12], font, brush, point); //住院号
+
+ //point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * 2 + 10);
+ //_ecgGraphics.DrawString(diagInfoList[11], font, brush, point);//床号
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 6) + 65);
+ _ecgGraphics.DrawString(diagInfoList[9], font, brush, point); //心率
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 7) + 65);
+ _ecgGraphics.DrawString(diagInfoList[4], font, brush, point); //P-R
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 8) + 65);
+ _ecgGraphics.DrawString(diagInfoList[5], font, brush, point); //QRS
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 9) + 65);
+ _ecgGraphics.DrawString(diagInfoList[6], font, brush, point); //QT/QTC
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 10) + 65);
+ _ecgGraphics.DrawString(diagInfoList[7], font, brush, point); //QRS电轴
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 11) + 65);
+ _ecgGraphics.DrawString(diagInfoList[8].Replace(" ", string.Empty), font, brush, point); //RV5/SV1
+
+ point = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (num + 12) + 65);
+ _ecgGraphics.DrawString(diagInfoList[3], font, brush, point); //RV5+SV1
+ //_ecgGraphics.DrawLine(_pen, 0, _freePixs * 3 + 48, _ecgCanvas.Width, _freePixs * 3 + 48);
+
+ //if (ConfigHelper.IsPrintQuickResponse && File.Exists(Application.StartupPath + "\\wx.gif"))
+ //{
+ // if (File.Exists(Application.StartupPath + "\\wx.gif"))
+ // {
+ // using (Image img = Image.FromFile(Application.StartupPath + "\\wx.gif"))
+ // {
+ // _ecgGraphics.DrawImage(img, _ecgCanvas.Width - 320, _freePixs * 2 + 1480, 229, 230);
+ // }
+ // }
+ //}
+ }
+
+ ///
+ /// 绘制心电诊断结论
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void PrintDiagInfo(string diagInfoContent, string reportDoctorName, string filter, string collectTime,
+ string dept, string amp, string ps, Image img, string addr)
+ {
+ var font = new Font("宋体", 10, FontStyle.Regular);
+ var brush = Brushes.Black;
+ var firstPoint = 0;
+ var threePoint = 1800;
+ var height = _freePixs * 2 + 15;
+ filter = filter.Replace("低通:", "");
+
+ //diagInfoContent = $"{LocalStorage.ResManager.GetString("DiagnosticTips")}:{diagInfoContent}" ;
+ diagInfoContent = $"{"诊断结论:"}{diagInfoContent}";
+ var len = diagInfoContent.Any(t => t >= 0x4e00 && t <= 0x9fbb) ? 33 : 72;
+
+ var drCnt = new string[diagInfoContent.Length / len + 1];
+ for (var a = 0; a < diagInfoContent.Length / len + 1; a++)
+ if (a < diagInfoContent.Length / len)
+ {
+ drCnt[a] = diagInfoContent.Substring(a * len, len);
+ }
+ else
+ {
+ if (diagInfoContent.Length - a * len > len)
+ {
+ drCnt[a] = diagInfoContent.Substring(a * len, len);
+ drCnt[a + 1] =
+ diagInfoContent.Substring((a + 1) * len, diagInfoContent.Length - a * len);
+ }
+ else
+ {
+ drCnt[a] = diagInfoContent.Substring(a * len, diagInfoContent.Length - a * len);
+ }
+ }
+
+ var pointF = new PointF(threePoint, height);
+
+ //_ecgGraphics.DrawString($"{diagnosticTips}:", font, brush, pointF); //诊断结果
+
+ for (var i = 0; i < drCnt.Length; i++)
+ {
+ pointF = new PointF(threePoint, height + i * _freePixs);
+ _ecgGraphics.DrawString(drCnt[i].Trim(), font, brush, pointF); //诊断结果
+ }
+
+
+
+
+ //var len = diagInfoContent.Any(t => t >= 0x4e00 && t <= 0x9fbb) ? 33 : 66;
+
+ //var drCnt = new string[diagInfoContent.Length / len + 1];
+ //for (var a = 0; a < diagInfoContent.Length / len + 1; a++)
+ // if (a < diagInfoContent.Length / len)
+ // {
+ // drCnt[a] = diagInfoContent.Substring(a * len, len);
+ // }
+ // else
+ // {
+ // if (diagInfoContent.Length - a * len > len)
+ // {
+ // drCnt[a] = diagInfoContent.Substring(a * len, len);
+ // drCnt[a + 1] =
+ // diagInfoContent.Substring((a + 1) * len, diagInfoContent.Length - a * len);
+ // }
+ // else
+ // {
+ // drCnt[a] = diagInfoContent.Substring(a * len, diagInfoContent.Length - a * len);
+ // }
+ // }
+
+ /* //23.11.21分号换行
+ var font = new Font("宋体", 10, FontStyle.Regular);
+ var brush = Brushes.Black;
+ var firstPoint = 0;
+ var threePoint = 1800;
+ var height = _freePixs * 2 + 15;
+ filter = filter.Replace("低通:", "");
+
+ var drCnt = diagInfoContent.Split(';');
+ PointF pointF;
+ var diagnosticTips = LocalStorage.ResManager.GetString("DiagnosticTips");
+ //_ecgGraphics.DrawString(diagnosticTips + ":", font, brush, pointF); //诊断结果
+ if (drCnt.Length > 0) drCnt[0] = $"{diagnosticTips}:{drCnt[0]}";
+
+ for (var i = 0; i < drCnt.Length; i++)
+ {
+ pointF = new PointF(threePoint, height + i * _freePixs);//threePoint + 200
+ _ecgGraphics.DrawString(drCnt[i].Trim(), font, brush, pointF); //诊断结果
+ }
+ */
+
+
+
+ //pointF = new PointF(_ecgCanvas.Width - 1000, height + _freePixs * 5);
+ pointF = new PointF(threePoint, height + _freePixs * 5);
+ _ecgGraphics.DrawString(dept, font, brush, pointF); //科室
+
+ pointF = new PointF(_ecgCanvas.Width - 750, height + _freePixs * 5);
+ if (img == null)
+ {
+ //var report = LocalStorage.ResManager.GetString("Report");
+ var report = "报告医生:";
+ _ecgGraphics.DrawString(report + reportDoctorName, font, brush, pointF); //报告医生
+ }
+ else
+ using (var bmpSource = new Bitmap((Bitmap)img, 160, 80))
+ {
+ bmpSource.SetResolution(200, 200);
+ //var reportDoctor = LocalStorage.ResManager.GetString("ReportDoctor");
+ //_ecgGraphics.DrawString(reportDoctor + ":", font, brush, pointF); //报告医生
+ var report = "报告医生:";
+ _ecgGraphics.DrawString(report, font, brush, pointF); //报告医生
+ pointF = new PointF(_ecgCanvas.Width - 444, height + _freePixs * 4 - 10);
+ _ecgGraphics.DrawImage(bmpSource, pointF);
+ // bmpSource.Dispose();
+ }
+
+
+ pointF = new PointF(_ecgCanvas.Width - 450, _ecgCanvas.Height - _freePixs - 50);
+ _ecgGraphics.DrawString(Convert.ToDateTime(collectTime).ToString("yyyy-MM-dd HH:mm:ss"), font, brush,
+ pointF); //波形的起始时间点
+
+ //_ecgGraphics.DrawLine(_pen, 0, _ecgCanvas.Height - _freePixs + 49, _ecgCanvas.Width, _ecgCanvas.Height - _freePixs + 49);//第四条横线_ecgCanvas.Height==2375
+
+ font = new Font("宋体", 8, FontStyle.Regular);
+ //var address = LocalStorage.ResManager.GetString("Address") + ":" + addr;
+ var address = "地址:" + addr;
+ var parameters = ps + " " + amp + " " + filter;
+ //var reportDec = LocalStorage.ResManager.GetString("ReportDec");
+ var reportDec = "";
+ var r1w = GetStrWidth(reportDec) * font.Size;
+ var l1w = GetStrWidth(address) * font.Size;
+ var c1w = GetStrWidth(parameters) * font.Size;
+
+ var locX = l1w + (_ecgCanvas.Width - r1w - l1w - c1w) / 2;
+
+ //pointF = new PointF((_ecgCanvas.Width - parameters.Length) / 2 - 20 * _dpi / _oldDpi * 3, _ecgCanvas.Height - _freePixs);
+ pointF = new PointF(locX, _ecgCanvas.Height - _freePixs);
+ _ecgGraphics.DrawString(parameters, font, brush, pointF); //振幅 走纸速度 滤波
+
+
+
+ pointF = new PointF(firstPoint, _ecgCanvas.Height - _freePixs);
+ _ecgGraphics.DrawString(address, font, brush, pointF); //地址
+
+ //pointF = new PointF(secondPoint, _ecgCanvas.Height - _freePixs);
+
+ pointF = new PointF(_ecgCanvas.Width - 20 - r1w, _ecgCanvas.Height - _freePixs);
+ _ecgGraphics.DrawString(reportDec, font, brush, pointF);
+ }
+
+ ///
+ /// 绘制QRS波群
+ ///
+ ///
+ ///
+ private void PointContrast(List xp, int leadindex)
+ {
+ var lp = new List();
+ for (var k = 1; k < xp.Count; k++)
+ if (k + 1 < xp.Count)
+ {
+ if (_isQb == "1")
+ {
+ if (xp[k + 1].X - xp[k].X < 10 && xp[k + 1].X - xp[k].X >= 0) //
+ lp.Add(xp[k]);
+ }
+ else
+ {
+ if ((xp[k + 1].X - xp[k].X < 10 && xp[k + 1].X - xp[k].X > 0) ||
+ (xp[k].Y >= xp[k + 1].Y && xp[k].Y > xp[k - 1].Y) ||
+ (xp[k].Y <= xp[k + 1].Y && xp[k].Y < xp[k - 1].Y)) //
+ {
+ if (!lp.Contains(xp[k])) lp.Add(xp[k]);
+ }
+ else
+ {
+ if (xp[k].X == xp[k + 1].X && xp[k].Y != xp[k + 1].Y &&
+ leadindex == 0) //leadindex==0 以I导为标准
+ _clearCount++;
+ }
+ }
+ }
+
+ if (_clearCount > xp.Count * 0.6) //0.7 代表滤掉的点数大于总点数的百分之七十
+ {
+ lp.Clear();
+ lp = xp;
+ }
+
+ _ecgGraphics.SmoothingMode = SmoothingMode.AntiAlias; //抗锯齿
+ _ecgGraphics.DrawLines(_ecgPenQrs, lp.ToArray());
+ }
+
+ ///
+ /// 绘制长十二导心电诊断结论
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void PrintLongDiagInfo(string diagInfoContent, string reportDoctorName, string reportDate, string filter,
+ string collectTime, string dept, string amp, string ps, Image img, string addr)
+ {
+ //ConfigHelper.EcgReportTitle = "注:本报告仅供临床医师参考,不作疾病证明。";
+ var flag = diagInfoContent.Any(t => t >= 0x4e00 && t <= 0x9fbb);
+ var diagResult = flag ? diagInfoContent.Split(';', ' ', ',', ',', '。', ';') : diagInfoContent.Split(';');
+ var brush = Brushes.Black;
+ var font = new Font("宋体", 8, FontStyle.Regular);
+ var address = LocalStorage.ResManager.GetString("Address") + ":" + addr;
+ var parameters = ps + " " + amp + " " + filter;
+ var reportDec = LocalStorage.ResManager.GetString("ReportDec");
+ var r1w = GetStrWidth(reportDec) * font.Size;
+ var l1w = GetStrWidth(address) * font.Size;
+ var c1w = GetStrWidth(parameters) * font.Size;
+
+ var locX = l1w + (_ecgCanvas.Width - r1w - l1w - c1w) / 2;
+
+ var pointF = new PointF(locX, _ecgCanvas.Height - _freePixs + 10);
+ _ecgGraphics.DrawString(parameters, font, brush, pointF); //振幅 走纸速度 滤波
+
+
+
+ pointF = new PointF(0, _ecgCanvas.Height - _freePixs + 10);
+ _ecgGraphics.DrawString(address, font, brush, pointF); //地址
+
+ //pointF = new PointF(secondPoint, _ecgCanvas.Height - _freePixs);
+
+ pointF = new PointF(_ecgCanvas.Width - 20 - r1w, _ecgCanvas.Height - _freePixs + 10);
+ _ecgGraphics.DrawString(reportDec, font, brush, pointF);
+
+
+
+ //var pointF = new PointF(_ecgCanvas.Width - 3400, _ecgCanvas.Height - _freePixs + 10);
+ //_ecgGraphics.DrawString("地址:" + addr, font, brush, pointF); //地址
+
+ //pointF = new PointF(_ecgCanvas.Width - LeadLenght * 1.25f, _ecgCanvas.Height - _freePixs + 10);
+ //_ecgGraphics.DrawString(LocalStorage.ResManager.GetString("ReportDec"), font, brush, pointF); //注意 ConfigHelper.EcgReportTitle
+
+ //pointF = new PointF(_ecgCanvas.Width - 1800, _ecgCanvas.Height - _freePixs + 10);
+ //_ecgGraphics.DrawString(ps + " " + amp + " " + filter, font, brush, pointF); //振幅 走纸速度滤波低通
+
+
+
+
+ font = new Font("宋体", 10);
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght, _ecgCanvas.Height - _freePixs * 7 - 18);
+ //var len = GetStrWidth(dept) * 8;
+ //if (len > 24)
+ //{
+ // _ecgGraphics.DrawString(dept.Substring(0, 12), font, brush, pointF); //科室
+
+ // pointF = new PointF(_ecgCanvas.Width - LeadLenght, _ecgCanvas.Height - _freePixs * 6);
+ // _ecgGraphics.DrawString(dept.Substring(12, dept.Length - 12), font, brush, pointF); //科室
+ //}
+ //else
+ //{
+ // _ecgGraphics.DrawString(dept, font, brush, pointF); //科室
+
+ var layoutRect = new RectangleF(pointF.X, pointF.Y, 550, 132);
+ var sf = new StringFormat
+ {
+ Alignment = StringAlignment.Far,
+ LineAlignment = StringAlignment.Near,
+ Trimming = StringTrimming.None
+ };
+ sf.Alignment = StringAlignment.Near;
+ sf.LineAlignment = StringAlignment.Center;
+ sf.Trimming = StringTrimming.EllipsisCharacter;
+ _ecgGraphics.DrawString(dept, font, brush, layoutRect, sf); //科室
+ //}
+
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght, _ecgCanvas.Height - _freePixs * 5);
+ if (img == null)
+ _ecgGraphics.DrawString(LocalStorage.ResManager.GetString("Report") + reportDoctorName, font, brush, pointF); //报告医生
+ else
+ using (var bmpSource = new Bitmap(img, 160, 80))
+ {
+ bmpSource.SetResolution(200, 200);
+ var point2Img = new PointF(_ecgCanvas.Width - LeadLenght + 200, _ecgCanvas.Height - _freePixs * 5);
+ //_ecgGraphics.DrawString(LocalStorage.ResManager.GetString("ReportDoctor") + ":", font, brush, pointF); //报告医生
+ _ecgGraphics.DrawImage(bmpSource, point2Img);
+ }
+
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * 3 - 20);
+ _ecgGraphics.DrawString(LocalStorage.ResManager.GetString("ReportDate") + reportDate, font, brush, pointF); //报告日期
+
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght * 0.8f, _ecgCanvas.Height - _freePixs * 1.9f); //
+ _ecgGraphics.DrawString(collectTime, font, brush, pointF); //波形的起始时间点
+
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * 17 + 65);
+ _ecgGraphics.DrawString(LocalStorage.ResManager.GetString("DiagnosticTips") + ":", font, brush, pointF); //诊断结果
+
+ //layoutRect = new RectangleF(pointF.X, pointF.Y, 550, 132);
+ //_ecgGraphics.DrawString(diagResult, font, brush, layoutRect, sf); //科室
+
+ diagResult = diagResult.Where(it => !string.IsNullOrEmpty(it)).Select(it => it.Trim()).ToArray();
+ var k = 0;
+ var len = diagInfoContent.Any(t => t >= 0x4e00 && t <= 0x9fbb) ? 12 : 24;
+ for (var i = 0; i < diagResult.Length; i++)
+ {
+ if (!diagInfoContent.Any(t => t >= 0x4e00 && t <= 0x9fbb))
+ diagResult[i] += "";
+ if (diagResult[i].Length <= len)
+ {
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (18 + i + k) + 65);
+ _ecgGraphics.DrawString(diagResult[i].Substring(0, diagResult[i].Length), font,
+ brush, pointF, sf); //诊断结果
+ }
+ else
+ {
+ var ok = true;
+ while (ok)
+ if (diagResult[i].Length - k * len > len)
+ {
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (18 + i + k) + 65);
+ _ecgGraphics.DrawString(diagResult[i].Substring(k * len, len), font, brush,
+ pointF, sf); //诊断结果
+ k++;
+ }
+ else
+ {
+ pointF = new PointF(_ecgCanvas.Width - LeadLenght, _freePixs * (18 + i + k) + 65);
+ _ecgGraphics.DrawString(
+ diagResult[i].Substring(k * len, diagResult[i].Length - k * len), font,
+ brush, pointF, sf); //诊断结
+ ok = false;
+ }
+ }
+ }
+
+ _ecgGraphics.DrawLine(_pen, 0, _ecgCanvas.Height - _freePixs, _ecgCanvas.Width,
+ _ecgCanvas.Height - _freePixs);
+ }
+
+ ///
+ /// 绘制6x2模式波形--打印
+ ///
+ ///
+ ///
+ ///
+ public void PrintEcgWave(int drawInitHeight, int bottomHeight, int dataIndex)
+ {
+ _points.Clear();
+ _firstPointArray.Clear();
+ drawInitHeight *= _freePixs;
+ bottomHeight *= _freePixs;
+
+ for (var i = 0; i < LeadCount12; i++)
+ {
+ var leadIndex = _leadList[i]; //取导联下标 0 1 2 3 ...11
+ if (i < 6)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2) / 2 +
+ i * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2)) +
+ drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ else
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2) / 2 +
+ (i - 6) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2)) +
+ drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ // int aaa = 1000 / ConfigHelper.PrintSampleRate;
+ if (_ecgDatas.Count > 0)
+ // for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 /1000)
+ {
+ if (i < 6)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width / 2 - 5) break;
+ }
+ else
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ }
+
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)Math.Round(x);
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ if (i < 6)
+ _secondPosition.X = nextX + _freePixs;
+ else
+ _secondPosition.X = _ecgCanvas.Width / 2 + _freePixs + nextX;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(i))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(i, xp);
+ }
+ else
+ {
+ _points[i].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[leadIndex], leadIndex); //绘制所有导联的QRS波群
+ }
+ }
+
+ ///
+ /// 绘制6X2模式标压名称---打印
+ ///
+ ///
+ public void PrintEcgLeadName(double cVoltagescale)
+ {
+ _ecgPen = new Pen(Color.Black, float.Parse("1"));
+
+ for (var d = 0; d < LeadCount12; d++)
+ if (d < 6)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y,
+ _freePixs / 3 * 3, _firstPointArray[_leadList[d]].Y);
+
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ else
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 2 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ ///
+ /// 绘制6x2+2模式波形--打印
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void PrintEcgWave(int drawInitHeight, int bottomHeight, List longLeadInfo, int dataIndex,
+ int dataLengthIndex)
+ {
+ _points.Clear();
+ _firstPointArray.Clear();
+ drawInitHeight *= _freePixs;
+ bottomHeight = bottomHeight * _freePixs;
+ for (var i = 0; i < LeadCount12; i++)
+ {
+ var leadIndex = _leadList[i]; //取导联下标 0 1 2 3 ...11
+ if (i < 6)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2 + 2) / 2 +
+ i * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2 + 2)) +
+ drawInitHeight;
+ //_baseLine = _baseLine - drawInitHeight / 10 * i;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ else
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2 + 2) / 2 +
+ (i - 6) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) /
+ (LeadCount12 / 2 + 2)) + drawInitHeight;
+ //_baseLine = _baseLine - drawInitHeight / 10 * (i - 6);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (i < 6)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width / 2 - 5) break;
+ }
+ else
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ }
+
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ if (i < 6)
+ _secondPosition.X = nextX + _freePixs;
+ else
+ _secondPosition.X = _ecgCanvas.Width / 2 + _freePixs + nextX;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(i))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(i, xp);
+ }
+ else
+ {
+ _points[i].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[i], i); //绘制所有导联的QRS波群
+ }
+
+ _points.Clear();
+ for (var i = 0; i < longLeadInfo.Count; i++)
+ {
+ var leadIndex = _leadList[longLeadInfo[i]]; //取导联下标 0 1 2 3 ...11
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2 + 2) / 2 +
+ (i + 6) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2 + 2)) +
+ drawInitHeight;
+
+ //_baseLine = _baseLine - drawInitHeight / 10 * (i + 6);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(i + 12, fp);
+ if (_ecgDatas.Count > 0)
+ for (var b = dataLengthIndex;
+ b < _ecgDatas[leadIndex].Count;
+ b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+
+ var x = (b - dataLengthIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ _secondPosition.X = nextX + _freePixs;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(leadIndex))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(leadIndex, xp);
+ }
+ else
+ {
+ _points[leadIndex].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[leadIndex], leadIndex); //绘制所有导联的QRS波群
+ }
+ }
+
+ ///
+ /// 绘制6X2+2模式标压名称--打印
+ ///
+ ///
+ ///
+ public void PrintEcgLeadName(double cVoltagescale, List longLeadInfo)
+ {
+ _ecgPen = new Pen(Color.Black, float.Parse("1"));
+ for (var d = 0; d < LeadCount12; d++)
+ if (d < 6)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y,
+ _freePixs / 3 * 3, _firstPointArray[_leadList[d]].Y);
+
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ else
+ {
+ //1
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 2 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+ //2
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //3
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //4
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+ //5
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+
+ for (var d = 0; d < 2; d++)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[d + LeadCount12].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[d + LeadCount12].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[d + LeadCount12].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[d + LeadCount12].Y,
+ _freePixs / 3 * 3, _firstPointArray[d + LeadCount12].Y);
+ var str = _leadNameArray[_leadList[longLeadInfo[d]]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[d + LeadCount12].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ ///
+ /// 绘制12x1模式波形--打印
+ ///
+ ///
+ ///
+ ///
+ public void PrintLongEcgWave(int drawInitHeight, int bottomHeight, int dataIndex)
+ {
+ _points.Clear();
+ _firstPointArray.Clear();
+ drawInitHeight *= _freePixs;
+ bottomHeight *= _freePixs;
+
+ for (var i = 0; i < LeadCount12; i++)
+ {
+ var leadIndex = _leadList[i]; //取导联下标 0 1 2 3 ...11
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / LeadCount12 / 2 +
+ i * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / LeadCount12) + drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width - LeadLenght) break;
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ _secondPosition.X = nextX + _freePixs;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(i))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(i, xp);
+ }
+ else
+ {
+ _points[i].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[i], leadIndex); //绘制所有导联的QRS波群
+ }
+ }
+
+ ///
+ /// 绘制12长导模式标压名称--显打印示
+ ///
+ ///
+ public void PrintLongEcgLeadName(double cVoltagescale)
+ {
+ _ecgPen = new Pen(Color.Black, float.Parse("1"));
+ for (var d = 0; d < LeadCount12; d++)
+ {
+ //1
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y);
+ //2
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+ //3
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale), _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+ //4
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale), _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y);
+ //5
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y, _freePixs / 3 * 3,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+
+ ///
+ /// 绘制4x3+1模式波形--打印
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void PrintEcgWaveFourOne(int drawInitHeight, int bottomHeight, int dataIndex, int dataLengthIndex)
+ {
+ _points.Clear();
+ _firstPointArray.Clear();
+ drawInitHeight *= _freePixs;
+ bottomHeight = bottomHeight * _freePixs;
+ for (var i = 0; i < LeadCount12; i++)
+ {
+ var leadIndex = _leadList[i]; //取导联下标 0 1 2 3 ...11
+ if (i < 6)
+ {
+ if (i < 3)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 4 + 1) / 2 +
+ i * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 4 + 1)) +
+ drawInitHeight;
+ //_baseLine = _baseLine - drawInitHeight / 4 * i;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ else
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 4 + 1) / 2 +
+ (i - 3) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) /
+ (LeadCount12 / 4 + 1)) + drawInitHeight;
+ //_baseLine = _baseLine - drawInitHeight / 4 * (i - 3);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 4;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 4;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ }
+ else
+ {
+ if (i < 9)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 4 + 1) / 2 +
+ (i - 6) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) /
+ (LeadCount12 / 4 + 1)) + drawInitHeight;
+ //_baseLine = _baseLine - drawInitHeight / 4 * (i - 6);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ else
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 4 + 1) / 2 +
+ (i - 9) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) /
+ (LeadCount12 / 4 + 1)) + drawInitHeight;
+ //_baseLine = _baseLine - drawInitHeight / 4 * (i - 9);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + 3 * _ecgCanvas.Width / 4;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + 3 * _ecgCanvas.Width / 4;
+ var fp2 = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp2);
+ }
+ }
+
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (i < 6)
+ {
+ if (i < 3)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width / 4 - 5) break;
+ }
+ else
+ {
+ if (_firstPosition.X > _ecgCanvas.Width / 2 - 5) break;
+ }
+ }
+ else
+ {
+ if (i < 9)
+ {
+ if (_firstPosition.X > 3 * _ecgCanvas.Width / 4) break;
+ }
+ else
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ }
+ }
+
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ if (i < 6)
+ {
+ if (i < 3)
+ _secondPosition.X = nextX + _freePixs;
+ else
+ _secondPosition.X = _ecgCanvas.Width / 4 + _freePixs + nextX;
+ }
+ else
+ {
+ if (i < 9)
+ _secondPosition.X = _ecgCanvas.Width / 2 + _freePixs + nextX;
+ else
+ _secondPosition.X = 3 * _ecgCanvas.Width / 4 + _freePixs + nextX;
+ }
+
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(i))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(i, xp);
+ }
+ else
+ {
+ _points[i].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[i], leadIndex); //绘制所有导联的QRS波群
+ }
+
+ _points.Clear();
+ for (var i = 0; i < 1; i++)
+ {
+ var leadIndex = _leadList[ConfigHelper.SingleLead]; //取导联下标 0 1 2 3 ...11
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 4 + 1) / 2 +
+ (i + 3) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 4 + 1)) +
+ drawInitHeight;
+ //_baseLine = _baseLine - drawInitHeight / 4 * (i + 3);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(i + LeadCount12, fp);
+ if (_ecgDatas.Count > 0)
+ for (var b = dataLengthIndex;
+ b < _ecgDatas[leadIndex].Count;
+ b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+ var x = (b - dataLengthIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ _secondPosition.X = nextX + _freePixs;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(leadIndex))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(leadIndex, xp);
+ }
+ else
+ {
+ _points[leadIndex].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[leadIndex], leadIndex); //绘制所有导联的QRS波群
+ }
+ }
+
+ ///
+ /// 绘制4x3+1导联模式标压名称--打印
+ ///
+ ///
+ ///
+ public void PrintLeadNameFourOne(double cVoltagescale, List longLeadInfo)
+ {
+ _ecgPen = new Pen(Color.Black, float.Parse("1"));
+ for (var d = 0; d < LeadCount12; d++)
+ if (d < 6)
+ {
+ if (d < 3)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y,
+ _freePixs / 3 * 3, _firstPointArray[_leadList[d]].Y);
+
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ else
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 4 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _ecgCanvas.Width / 4 + _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _ecgCanvas.Width / 4 + _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 4 + _freePixs / 3 * 3,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+ else
+ {
+ if (d < 9)
+ {
+ //1
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 2 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+ //2
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //3
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //4
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+ //5
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ else
+ {
+ //1
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y,
+ 3 * _ecgCanvas.Width / 4 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+ //2
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, 3 * _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //3
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //4
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+ //5
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, 3 * _ecgCanvas.Width / 4 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(3 * _ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ for (var d = 0; d < 1; d++)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[d + LeadCount12].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[d + LeadCount12].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[d + LeadCount12].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[d + LeadCount12].Y,
+ _freePixs / 3 * 3, _firstPointArray[d + LeadCount12].Y);
+ var str = _leadNameArray[ConfigHelper.SingleLead];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[d + LeadCount12].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ ///
+ /// 绘制4x3+3导联模式波形--打印
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void PrintEcgWaveFourThree(int drawInitHeight, int bottomHeight, List longLeadInfo, int dataIndex,
+ int dataLengthIndex)
+ {
+ _points.Clear();
+ _firstPointArray.Clear();
+ drawInitHeight *= _freePixs;
+ bottomHeight *= _freePixs;
+ for (var i = 0; i < LeadCount12; i++)
+ {
+ var leadIndex = _leadList[i]; //取导联下标 0 1 2 3 ...11
+ if (i < 6)
+ {
+ if (i < 3)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2) / 2 +
+ i * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2)) +
+ drawInitHeight; //
+
+ //_baseLine = _baseLine - drawInitHeight / 8 * i;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ else
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2) / 2 +
+ (i - 3) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) /
+ (LeadCount12 / 2)) + drawInitHeight; //+ Draw_InitHeight
+
+ //_baseLine = _baseLine - drawInitHeight / 8 * (i - 3);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 4;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 4;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ }
+ else
+ {
+ if (i < 9)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2) / 2 +
+ (i - 6) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) /
+ (LeadCount12 / 2)) + drawInitHeight; // + Draw_InitHeight
+
+ //_baseLine = _baseLine - drawInitHeight / 8 * (i - 6);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 2;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+ else
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2) / 2 +
+ (i - 9) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) /
+ (LeadCount12 / 2)) + drawInitHeight; //+ Draw_InitHeight
+
+ //_baseLine = _baseLine - drawInitHeight / 8 * (i - 9);
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + 3 * _ecgCanvas.Width / 4;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + 3 * _ecgCanvas.Width / 4;
+ var fp2 = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp2);
+ }
+ }
+
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (i < 6)
+ {
+ if (i < 3)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width / 4 - 5) break;
+ }
+ else
+ {
+ if (_firstPosition.X > _ecgCanvas.Width / 2 - 5) break;
+ }
+ }
+ else
+ {
+ if (i < 9)
+ {
+ if (_firstPosition.X > 3 * _ecgCanvas.Width / 4) break;
+ }
+ else
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ }
+ }
+
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ if (i < 6)
+ {
+ if (i < 3)
+ _secondPosition.X = nextX + _freePixs;
+ else
+ _secondPosition.X = _ecgCanvas.Width / 4 + _freePixs + nextX;
+ }
+ else
+ {
+ if (i < 9)
+ _secondPosition.X = _ecgCanvas.Width / 2 + _freePixs + nextX;
+ else
+ _secondPosition.X = 3 * _ecgCanvas.Width / 4 + _freePixs + nextX;
+ }
+
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(i))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(i, xp);
+ }
+ else
+ {
+ _points[i].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[i], leadIndex); //绘制所有导联的QRS波群
+ }
+
+ _points.Clear();
+ for (var i = 0; i < longLeadInfo.Count; i++)
+ {
+ var leadIndex = _leadList[longLeadInfo[i]]; //取导联下标 0 1 2 3 ...11
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2) / 2 +
+ (i + 3) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / (LeadCount12 / 2)) +
+ drawInitHeight;
+
+ //_baseLine = _baseLine - drawInitHeight / 8 * (i + 3);
+
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(i + 12, fp);
+ if (_ecgDatas.Count > 0)
+ for (var b = dataLengthIndex;
+ b < _ecgDatas[leadIndex].Count;
+ b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+ var x = (b - dataLengthIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ _secondPosition.X = nextX + _freePixs;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(leadIndex))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(leadIndex, xp);
+ }
+ else
+ {
+ _points[leadIndex].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[leadIndex], leadIndex); //绘制所有导联的QRS波群
+ }
+ }
+
+ ///
+ /// 绘制4x3+3导联模式标压名称--打印
+ ///
+ ///
+ ///
+ public void PrintLeadNameFourThree(double cVoltagescale, List longLeadInfo)
+ {
+ _ecgPen = new Pen(Color.Black, float.Parse("1"));
+ for (var d = 0; d < LeadCount12; d++)
+ if (d < 6)
+ {
+ if (d < 3)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y,
+ _freePixs / 3 * 3, _firstPointArray[_leadList[d]].Y);
+
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ else
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 4 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _ecgCanvas.Width / 4 + _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _ecgCanvas.Width / 4 + _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 4 + _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 4 + _freePixs / 3 * 3,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+ else
+ {
+ if (d < 9)
+ {
+ //1
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 2 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+ //2
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //3
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //4
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 2 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+ //5
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 2 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 2 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 2, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ else
+ {
+ //1
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y,
+ 3 * _ecgCanvas.Width / 4 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+ // //2
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, 3 * _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //3
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+ //4
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+ //5
+ _ecgGraphics.DrawLine(_ecgPen, 3 * _ecgCanvas.Width / 4 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, 3 * _ecgCanvas.Width / 4 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(3 * _ecgCanvas.Width / 4, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ for (var d = 0; d < longLeadInfo.Count; d++)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[d + LeadCount12].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[d + LeadCount12].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount12].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[d + LeadCount12].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[d + LeadCount12].Y,
+ _freePixs / 3 * 3, _firstPointArray[d + LeadCount12].Y);
+ var str = _leadNameArray[longLeadInfo[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[d + LeadCount12].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ ///
+ /// 绘制5x3+1导联模式波形--打印
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void PrintEcgWaveFifteen(int drawInitHeight, int bottomHeight, int dataIndex)
+ {
+ _points.Clear();
+ _firstPointArray.Clear();
+ drawInitHeight = drawInitHeight * _freePixs;
+ bottomHeight = bottomHeight * _freePixs;
+ const int rowCount = 6; //分六行
+
+ #region 5x3
+
+ for (var i = 0; i < LeadCount15; i++)
+ {
+ var leadIndex = _leadList[i]; //取导联下标 0 1 2 3 ...11
+ if (i < 5)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount / 2 +
+ i * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount) + drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ if (i >= 5 && i < 10)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount / 2 +
+ (i - 5) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount) +
+ drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 3;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 3;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ if (i >= 10 && i < 15)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount / 2 +
+ (i - 10) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount) +
+ drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + 2 * _ecgCanvas.Width / 3;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + 2 * _ecgCanvas.Width / 3;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ if (leadIndex < LeadCount15)
+ {
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (i < 5)
+ if (_firstPosition.X > _ecgCanvas.Width / 3 - 5)
+ break;
+ if (i >= 5 && i < 10)
+ if (_firstPosition.X > 2 * _ecgCanvas.Width / 3 - 5)
+ break;
+ if (i >= 10 && i < 15)
+ if (_firstPosition.X > _ecgCanvas.Width)
+ break;
+
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ if (i < 5) _secondPosition.X = nextX + _freePixs;
+ if (i >= 5 && i < 10) _secondPosition.X = _ecgCanvas.Width / 3 + nextX + _freePixs;
+ if (i >= 10 && i < 15) _secondPosition.X = 2 * _ecgCanvas.Width / 3 + _freePixs + nextX;
+
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(i))
+ {
+ var xp = new List();
+ xp.Add(_firstPosition);
+ _points.Add(i, xp);
+ }
+ else
+ {
+ _points[i].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[i], leadIndex); //绘制所有导联的QRS波群
+ }
+ }
+
+ #endregion
+
+ #region 任意长一导
+
+ _points.Clear();
+ for (var i = 0; i < 1; i++)
+ {
+ var leadIndex = _leadList[ConfigHelper.SingleLead]; //取导联下标 0 1 2 3 ...11
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount / 2 +
+ (i + 5) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / rowCount) + drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(i + LeadCount15, fp);
+ if (_ecgDatas.Count > 0)
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (_firstPosition.X > _ecgCanvas.Width) break;
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ _secondPosition.X = nextX + _freePixs;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(leadIndex))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(leadIndex, xp);
+ }
+ else
+ {
+ _points[leadIndex].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[leadIndex], leadIndex); //绘制所有导联的QRS波群
+ }
+
+ #endregion
+ }
+
+ ///
+ /// 绘制5x3+1导联模式标压名称--打印
+ ///
+ ///
+ ///
+ public void PrintLeadNameFifteen(double cVoltagescale, string leaderType)
+ {
+ _ecgPen = new Pen(Color.Black, float.Parse("1"));
+ for (var d = 0; d < LeadCount15; d++)
+ {
+ if (d < 5)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y,
+ _freePixs / 3 * 3, _firstPointArray[_leadList[d]].Y);
+
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+
+ if (d >= 5 && d < 10)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 3 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 3 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 3 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+
+ if (d >= 10 && d < 15)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y,
+ 2 * _ecgCanvas.Width / 3 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, 2 * _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, 2 * _ecgCanvas.Width / 3 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ if (d >= 12 && leaderType == "LeaderR") str = _leadNameArray[_leadList[d] + 3];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(2 * _ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ for (var d = 0; d < 1; d++)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[d + LeadCount15].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount15].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[d + LeadCount15].Y, _freePixs / 5,
+ _firstPointArray[d + LeadCount15].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[d + LeadCount15].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount15].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[d + LeadCount15].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[d + LeadCount15].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[d + LeadCount15].Y,
+ _freePixs / 3 * 3, _firstPointArray[d + LeadCount15].Y);
+ var str = _leadNameArray[ConfigHelper.SingleLead];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[d + LeadCount15].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+
+ ///
+ /// 绘制6x3导联模式波形--打印
+ ///
+ ///
+ ///
+ ///
+ public void PrintEcgWaveEighteen(int drawInitHeight, int bottomHeight, int dataIndex)
+ {
+ _points.Clear();
+ _firstPointArray.Clear();
+ drawInitHeight = drawInitHeight * _freePixs;
+ bottomHeight = bottomHeight * _freePixs;
+ for (var i = 0; i < LeadCount18; i++)
+ {
+ var leadIndex = _leadList[i]; //取导联下标 0 1 2 3 ...11
+ if (i < 6)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / 6 / 2 +
+ i * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / 6) + drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ if (i >= 6 && i < 12)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / 6 / 2 +
+ (i - 6) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / 6) + drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + _ecgCanvas.Width / 3;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + _ecgCanvas.Width / 3;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ if (i >= 12 && i < 18)
+ {
+ _baseLine = (_ecgCanvas.Height - drawInitHeight - bottomHeight) / 6 / 2 +
+ (i - 12) * ((_ecgCanvas.Height - drawInitHeight - bottomHeight) / 6) + drawInitHeight;
+ _firstPosition.Y = _baseLine;
+ _firstPosition.X = _freePixs + 2 * _ecgCanvas.Width / 3;
+ _secondPosition.Y = _baseLine;
+ _secondPosition.X = _freePixs + 2 * _ecgCanvas.Width / 3;
+ var fp = new Point(_firstPosition.X + _freePixs, _firstPosition.Y);
+ _firstPointArray.Add(leadIndex, fp);
+ }
+
+ if (leadIndex < LeadCount18)
+ {
+ for (var b = dataIndex; b < _ecgDatas[leadIndex].Count; b += 1000 / ConfigHelper.PrintSampleRate)
+ {
+ if (i < 6)
+ if (_firstPosition.X > _ecgCanvas.Width / 3 - 5)
+ break;
+ if (i >= 6 && i < 12)
+ if (_firstPosition.X > 2 * _ecgCanvas.Width / 3 - 5)
+ break;
+
+ if (i >= 12 && i < 18)
+ if (_firstPosition.X > _ecgCanvas.Width)
+ break;
+ var yValues = _ecgDatas[leadIndex][b] * (_dpi / _lenthPerInch) * _amplitude * PrintInch;
+
+
+ _secondPosition.Y = _baseLine - (int)yValues; //后一点Y轴位置
+
+ var x = (b - dataIndex) * _intervalPixCountPerPoint;
+ var nextX = (int)x;
+ if (Math.Abs(_firstPosition.X - _secondPosition.X) < 5)
+ {
+ if (i < 6) _secondPosition.X = nextX + _freePixs;
+ if (i >= 6 && i < 12) _secondPosition.X = _ecgCanvas.Width / 3 + nextX + _freePixs;
+ if (i >= 12 && i < 18) _secondPosition.X = 2 * _ecgCanvas.Width / 3 + _freePixs + nextX;
+ if (_firstPosition.X != _secondPosition.X && _firstPosition.Y == _secondPosition.Y) //
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _firstPosition, _secondPosition);
+ }
+ else
+ {
+ if (!_points.ContainsKey(i))
+ {
+ var xp = new List { _firstPosition };
+ _points.Add(i, xp);
+ }
+ else
+ {
+ _points[i].Add(_firstPosition);
+ }
+ }
+ }
+
+ _firstPosition = _secondPosition;
+ }
+
+ PointContrast(_points[i], leadIndex); //绘制所有导联的QRS波群
+ }
+ }
+ }
+
+ ///
+ /// 绘制6x3导联模式标压名称--显示
+ ///
+ ///
+ public void PrintLeadNameEighteen(double cVoltagescale)
+ {
+ _ecgPen = new Pen(Color.Black, float.Parse("1"));
+ for (var d = 0; d < LeadCount18; d++)
+ {
+ if (d < 6)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 0, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5, _firstPointArray[_leadList[d]].Y, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale));
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(_freePixs * cVoltagescale),
+ _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _freePixs * 5 / 6, _firstPointArray[_leadList[d]].Y,
+ _freePixs / 3 * 3, _firstPointArray[_leadList[d]].Y);
+
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(0, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+
+ if (d >= 6 && d < 12)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y,
+ _ecgCanvas.Width / 3 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ _ecgCanvas.Width / 3 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, _ecgCanvas.Width / 3 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(_ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+
+ if (d >= 12 && d < 18)
+ {
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y,
+ 2 * _ecgCanvas.Width / 3 + _freePixs / 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y, 2 * _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs));
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y - (short)Math.Round(cVoltagescale * _freePixs),
+ 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5, _firstPointArray[_leadList[d]].Y);
+
+ _ecgGraphics.DrawLine(_ecgPen, 2 * _ecgCanvas.Width / 3 + _freePixs / 6 * 5,
+ _firstPointArray[_leadList[d]].Y, 2 * _ecgCanvas.Width / 3 + _freePixs,
+ _firstPointArray[_leadList[d]].Y);
+ var str = _leadNameArray[_leadList[d]];
+ var font = new Font("宋体", 11);
+ var brush = Brushes.Black;
+ if (d < _firstPointArray.Count)
+ {
+ var point = new PointF(2 * _ecgCanvas.Width / 3, _firstPointArray[_leadList[d]].Y);
+ _ecgGraphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+ }
+
+ private float GetStrWidth(string text)
+ {
+ var array = text.ToCharArray();
+ return array.Sum(it => it >= 0x4e00 && it <= 0x9fbb ? 4.26f : 2.13f);
+ //return c.Any(t => t >= 0x4e00 && t <= 0x9fbb);
+ }
+ }
+}
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/CommonVerifyUrlResult.cs b/1200Gxml心电图绘制/CommonVerifyUrlResult.cs
new file mode 100644
index 0000000..73f0861
--- /dev/null
+++ b/1200Gxml心电图绘制/CommonVerifyUrlResult.cs
@@ -0,0 +1,9 @@
+namespace _1200Gxml心电图绘制
+{
+ public class CommonVerifyUrlResult
+ {
+ public string access_token { get; set; }
+ public string token_type { get; set; }
+ public string expires_in { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/ConfigHelper.cs b/1200Gxml心电图绘制/ConfigHelper.cs
new file mode 100644
index 0000000..8349d8c
--- /dev/null
+++ b/1200Gxml心电图绘制/ConfigHelper.cs
@@ -0,0 +1,1003 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace _1200Gxml心电图绘制
+{
+ public class ConfigHelper
+ {
+ ///
+ /// 是否有远程判读服务
+ ///
+ public static bool RemoteServcie;
+
+ ///
+ /// 是否自动上传数据
+ ///
+ public static bool UploadServcie;
+
+ ///
+ ///
+ /// 远程判读URL
+ ///
+ private static string UrlDistance = string.Empty;
+
+ ///
+ /// 远程申请判读地址URL
+ ///
+ private static string UrlApplication = "/api/RestEcg/Create";
+
+ ///
+ /// 远程只申请不判读URL用于统计
+ ///
+ private static string UrlApplicationNo = "/api/dataservice/upload";
+
+ ///
+ /// 获取远程判读结果地址URL
+ ///
+ private static string UrlReturn = "/api/RestEcg/Result";
+
+ ///
+ /// 获取远程修正结果地址URL
+ ///
+ private static string UrlNewReturn = "/api/RestEcg/NewResult";
+
+ ///
+ /// 通知远程端收到修正结果的地址URL
+ ///
+ private static string UrlChangeState = "/api/RestEcg/ChangeState";
+
+ ///
+ /// 获取远程判读医生签名
+ ///
+ private static string UrlGraph = "/api/RestEcg/Graph";
+
+
+ ///
+ /// 远程验证用户名
+ ///
+ public static string UrlUserName = string.Empty;
+
+ ///
+ /// 远程验证密码
+ ///
+ public static string UrlPassWord = string.Empty;
+
+ ///
+ /// 从HIS系统中获取过来的患者有多少未执行过
+ ///
+ public static List ProjectIds = new List();
+
+ public static DataTable NoSignatureDoctor;
+
+ ///
+ /// 缓存远程电子签章的容器
+ ///
+ public static Dictionary RemoteDocImages = new Dictionary();
+
+ ///
+ /// 网络版数据库连接字符串
+ ///
+ private static string LocalConStr = string.Empty;
+
+ ///
+ /// 社区机构编号
+ ///
+ private static readonly string OrgID = string.Empty;
+
+ ///
+ /// 提交到几级判读设置
+ ///
+ private static string InptLevel = "1";
+
+ ///
+ /// 0:Access 1:SqlServer
+ ///
+ public static int DbSign;
+
+ //0远程1急诊
+ public static int LongDistanceType = 1;
+
+ ///
+ /// 设置分页的
+ ///
+ public static int PageSize = 20;
+
+ ///
+ /// 默认采集时间设置
+ ///
+ public static int CaiSJ = 10;
+
+ ///
+ /// 打印采样点设置
+ ///
+ public static int PrintSampleRate = 1000;
+
+ ///
+ /// 远程结果是否需要闪烁
+ ///
+ public static bool IsNeedBland = false;
+
+ ///
+ /// 是否需要隐藏
+ ///
+ public static bool IsShowFlag;
+
+ ///
+ /// 地区
+ ///
+ public static string Area = string.Empty;
+
+ ///
+ /// 是否有服务端修正的结果
+ ///
+ public static bool HasCorrectResult = false;
+
+ ///
+ /// E100命令端口
+ ///
+ public static string CommandComPort = "COM4";
+
+ ///
+ /// E100数据端口
+ ///
+ public static string EcgDataComPort = "COM3";
+
+
+ ///
+ /// BlueTooth命令端口
+ ///
+ public static string CommandComPortBlueTooth = "COM6";
+
+ ///
+ /// BlueTooth数据端口
+ ///
+ public static string EcgDataComPortBlueTooth = "COM5";
+
+ ///
+ /// 尿液分析仪数据和命令端口
+ ///
+ public static string EcgDataOrCommandPortUrine = "COM7";
+
+ ///
+ /// 波形颜色
+ ///
+ public static Color WaveColor = Color.Black;
+
+ ///
+ /// 波形网格颜色
+ ///
+ public static Color WaveGridColor = Color.LightCoral;
+
+ ///
+ /// 波形背景色
+ ///
+ public static Color WaveBackColor = Color.White;
+
+ ///
+ /// 4*3+1导联默认显示
+ ///
+ public static int SingleLead = 1;
+
+ ///
+ /// 打印波形线条粗细
+ ///
+ public static float WaveSize = 2.0f;
+
+ ///
+ /// 是否自动采集
+ ///
+ public static bool IsAutoCollect = true;
+
+ ///
+ /// 0关闭;1株洲;2体检
+ ///
+ public static int EcgPrintMode;
+
+ ///
+ /// 是否进行采集
+ ///
+ public static bool IsRecordEcg = false;
+
+ ///
+ /// 是否网络版还是单机版
+ ///
+ public static string VersionType;
+
+ ///
+ /// 是否打印危险提醒
+ ///
+ public static bool IsPrintQuickResponse = false;
+
+ ///
+ /// 皮肤名称
+ ///
+ public static string SkinName = "Caramel";
+
+
+ ///
+ /// 打印类型,比如:普通打印,B5打印,热敏打印
+ ///
+ public static string PrintType = "A4";
+
+
+ ///
+ /// 是否有HIS
+ ///
+ public static bool HasHis;
+ ///
+ /// 心电图报告模式
+ ///
+ public static CbItemObj[] ReportModel = null;
+ ///
+ /// 心电图测量方向
+ ///
+ public static CbItemObj[] Measure = null;
+ ///
+ /// 心电图类型
+ ///
+ public static CbItemObj[] ProjectTypes = null;
+ ///
+ /// 心电图判读状态
+ ///
+ public static CbItemObj[] EcgStates = null;
+ ///
+ /// 性别选项
+ ///
+ public static CbItemObj[] GenderItems = null;
+
+ ///
+ /// 缓存的病室信息
+ ///
+ public static DataTable PatientRooms = null;
+
+ ///
+ /// 缓存的病床信息
+ ///
+ public static DataTable PatientBeds = null;
+
+ ///
+ /// 本地报告地址
+ ///
+ public static string LocalAddress = string.Empty;
+
+ ///
+ /// 判读是否有返回结果
+ ///
+ public static bool IsNeedBlandOk = false;
+
+ ///
+ /// 是否获取远程报告名称
+ ///
+ public static bool IsGetAddress; //false为不获取远端报告名称
+
+ public static bool IsPrintEcg = true; //默认是否打印纸质报告
+
+ public static bool IsShowPrint; //默认不显示是否打印纸质报告
+
+ ///
+ /// 采集界面记录按钮 快捷键
+ ///
+ public static string KeysCode = "F1";
+
+ ///
+ /// 是否Ctrl+组合
+ ///
+ public static bool CtrlBool;
+
+ ///
+ /// 是否Alt+组合
+ ///
+ public static bool AltBool;
+
+ ///
+ /// 是否Shift+组合
+ ///
+ public static bool ShiftBool;
+
+ ///
+ /// 打印背景网格线是实线还虚线
+ ///
+ public static bool IsDashOrSolid;
+
+ ///
+ /// 是否显示远程医生签名
+ ///
+ public static bool IsDistalSign = true;
+
+ ///
+ /// 基线
+ ///
+ public static int BaseOff = 0x00000001;
+
+ public static int Base005Hz = 0x00000002;
+ public static int Base05Hz = 0x00000004;
+ public static int Base075Hz = 0x00000008;
+
+ ///
+ /// 肌电
+ ///
+ public static int McOff = 0x00000100;
+
+ public static int Mc25Hz = 0x00000200;
+ public static int Mc35Hz = 0x00000400;
+ public static int Mc45Hz = 0x00000800;
+
+ ///
+ /// 工频
+ ///
+ public static int AcOff = 0x00010000;
+
+ public static int Ac50Hz = 0x00020000;
+ public static int Ac60Hz = 0x00040000;
+
+ ///
+ /// 低通
+ ///
+ public static int LpOff = 0x01000000;
+
+ public static int Lp75Hz = 0x02000000;
+ public static int Lp100Hz = 0x04000000;
+ public static int Lp150Hz = 0x08000000;
+
+ ///
+ /// 基线变量参数
+ ///
+ public static int BaseHz = Base075Hz;
+
+ ///
+ /// 肌电变量参数
+ ///
+ public static int McHz = Mc35Hz;
+
+ ///
+ /// 工频变量参数
+ ///
+ public static int AcHz = Ac50Hz;
+
+ ///
+ /// 低通变量参数
+ ///
+ public static int LpHz = Lp75Hz;
+
+ ///
+ /// 是否允许自动下载的标志
+ ///
+ public static volatile bool CanDownLoadPackage = true;
+
+ public static string EcgReportTitle = "本报告仅供临床参考,不作证明之用。";
+
+ ///
+ /// 是否第一次检查系统是64位还是32位
+ ///
+ public static bool IsFirstLoad = true;
+
+ ///
+ /// 接收数据的字节数据,默认24个字节 原始数据中的实际字节数 III avr avf avl 这四个导联都是算出来的
+ ///
+ public static int SourceLeadCount = 24;
+
+ ///
+ /// 导联数
+ ///
+ public static int LeadCounts = 12;
+
+ ///
+ /// 采集界面显示行数 12导 6*2排列。15导 7*2排列。18导 9*2 排列
+ ///
+ public static int ShowLeadCount = 6;
+
+ ///
+ /// 采集到的数据实际导联数,12导实际导8导。15导实际导11导,18导实际导14导。
+ ///
+ public static int FactLeadNum = 8;
+
+ public static List LeadInfo = new List
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }; //导联信息
+
+ public static string[] LeadNameArray =
+ {
+ "I", "II", "III", "aVR", "aVL", "aVF", "V1", "V2", "V3", "V4", "V5", "V6", "V3R", "V4R", "V5R", "V7", "V8",
+ "V9"
+ }; //导联类别
+
+ ///
+ /// 申请令牌
+ ///
+ public static CommonVerifyUrlResult Cvur;
+
+ ///
+ /// 本地医生ID
+ ///
+ public static string LocalDoctorId = string.Empty;
+
+ ///
+ /// 本地医生名称
+ ///
+ public static string LocalDoctorName = string.Empty;
+
+ ///
+ /// 本地医生科室
+ ///
+ public static string LocalDoctorDept = string.Empty;
+
+ ///
+ /// 本地医生签名
+ ///
+ public static byte[] LocalDoctorElectronicSignature;
+
+ ///
+ /// 项目类型,比如:十二导---0,十五导(V3R,V4R,V5R----1或V7,V8,V9----2),十八导---3
+ ///
+ public static int EcgProjectType;
+
+ ///
+ /// 是否有微信支付
+ ///
+ public static bool WxIsPay;
+
+ /*百度翻译*/
+ public static string BdTransBaseAddr { get; private set; }
+ public static string BdTransKey { get; private set; }
+ public static string BdTransSecret { get; private set; }
+
+ ///
+ /// 用户接口
+ ///
+ public static string WebApi { get; private set; } = "http://localhost:15873/";
+
+ static ConfigHelper()
+ {
+ if (string.IsNullOrEmpty(UrlDistance))
+ {
+ var ds = new DataSet();
+ var sr = new StreamReader(Application.StartupPath + @"\MedicalCloudPlatform.exe.yjl", Encoding.UTF8);
+ var str = DesEncrypt.Decrypt(sr.ReadToEnd());
+ var ms = new MemoryStream(Encoding.UTF8.GetBytes(str));
+ ds.ReadXml(ms);
+ ms.Close();
+ sr.Close();
+ LocalConStr = ds.Tables[0].Rows[0]["LocalConnectionString"].ToString().Trim();
+ UrlDistance = ds.Tables[0].Rows[0]["UrlDistanceString"].ToString().Trim();
+ DbSign = Convert.ToInt32(ds.Tables[0].Rows[0]["DB_SIGN"].ToString().Trim());
+ UrlUserName = ds.Tables[0].Rows[0]["UrlUserName"].ToString();
+ UrlPassWord = ds.Tables[0].Rows[0]["UrlPassWord"].ToString();
+ RemoteServcie = bool.Parse(ds.Tables[0].Rows[0]["RemoteServcie"].ToString());
+ UploadServcie = bool.Parse(ds.Tables[0].Rows[0]["UploadServcie"].ToString());
+ IsShowFlag = Convert.ToInt32(ds.Tables[0].Rows[0]["ShowFlag"].ToString().Trim()) != 0;
+ PageSize = Convert.ToInt32(ds.Tables[0].Rows[0]["PAGE_SIZE"].ToString().Trim());
+ LongDistanceType = Convert.ToInt32(ds.Tables[0].Rows[0]["LongDistanceType"].ToString().Trim());
+ InptLevel = ds.Tables[0].Rows[0]["InterpretationLevel"].ToString().Trim();
+ Area = ds.Tables[0].Rows[0]["AREA"].ToString();
+ OrgID = ds.Tables[0].Rows[0]["ORGID"].ToString();
+ var isEx = ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "IsFirstLoad");
+ if (isEx)
+ {
+ IsFirstLoad = ds.Tables[0].Rows[0]["IsFirstLoad"] == null ||
+ bool.Parse(ds.Tables[0].Rows[0]["IsFirstLoad"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "PrintType")) isEx = true;
+ if (isEx)
+ {
+ PrintType = ds.Tables[0].Rows[0]["PrintType"] != null
+ ? ds.Tables[0].Rows[0]["PrintType"].ToString()
+ : "A4";
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "DashOrSolid")) isEx = true;
+ if (isEx)
+ {
+ IsDashOrSolid = ds.Tables[0].Rows[0]["DashOrSolid"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["DashOrSolid"].ToString());
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "IsDistalSign")) isEx = true;
+ if (isEx)
+ {
+ IsDistalSign = ds.Tables[0].Rows[0]["IsDistalSign"] == null ||
+ bool.Parse(ds.Tables[0].Rows[0]["IsDistalSign"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "CaiSJ")) isEx = true;
+ if (isEx)
+ {
+ CaiSJ = ds.Tables[0].Rows[0]["CaiSJ"] != null
+ ? int.Parse(ds.Tables[0].Rows[0]["CaiSJ"].ToString())
+ : 12;
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "EcgProjectType")) isEx = true;
+ if (isEx)
+ {
+ EcgProjectType = ds.Tables[0].Rows[0]["EcgProjectType"] != null
+ ? int.Parse(ds.Tables[0].Rows[0]["EcgProjectType"].ToString())
+ : 0;
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "KeysCode")) isEx = true;
+ if (isEx)
+ {
+ KeysCode = ds.Tables[0].Rows[0]["KeysCode"] != null
+ ? ds.Tables[0].Rows[0]["KeysCode"].ToString()
+ : "F1";
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "CtrlBool")) isEx = true;
+ if (isEx)
+ {
+ CtrlBool = ds.Tables[0].Rows[0]["CtrlBool"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["CtrlBool"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "AltBool")) isEx = true;
+ if (isEx)
+ {
+ AltBool = ds.Tables[0].Rows[0]["AltBool"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["AltBool"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "ShiftBool")) isEx = true;
+ if (isEx)
+ {
+ ShiftBool = ds.Tables[0].Rows[0]["ShiftBool"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["ShiftBool"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "PrintSampleRate")) isEx = true;
+ if (isEx)
+ {
+ PrintSampleRate = ds.Tables[0].Rows[0]["PrintSampleRate"] != null
+ ? int.Parse(ds.Tables[0].Rows[0]["PrintSampleRate"].ToString())
+ : 250;
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "WaveColor")) isEx = true;
+ if (isEx)
+ {
+ WaveColor = ds.Tables[0].Rows[0]["WaveColor"] != null
+ ? Color.FromArgb(int.Parse(ds.Tables[0].Rows[0]["WaveColor"].ToString()))
+ : Color.Black;
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "WaveGridColor")) isEx = true;
+ if (isEx)
+ {
+ WaveGridColor = ds.Tables[0].Rows[0]["WaveGridColor"] != null
+ ? Color.FromArgb(int.Parse(ds.Tables[0].Rows[0]["WaveGridColor"].ToString()))
+ : Color.LightCoral;
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "WaveBackColor")) isEx = true;
+ if (isEx)
+ {
+ WaveBackColor = ds.Tables[0].Rows[0]["WaveBackColor"] != null
+ ? Color.FromArgb(int.Parse(ds.Tables[0].Rows[0]["WaveBackColor"].ToString()))
+ : Color.White;
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "SingleLead")) isEx = true;
+ if (isEx)
+ {
+ SingleLead = ds.Tables[0].Rows[0]["SingleLead"] != null
+ ? int.Parse(ds.Tables[0].Rows[0]["SingleLead"].ToString())
+ : 1;
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "WaveSize")) isEx = true;
+ if (isEx)
+ {
+ WaveSize = ds.Tables[0].Rows[0]["WaveSize"] != null
+ ? float.Parse(ds.Tables[0].Rows[0]["WaveSize"].ToString())
+ : 2.0f;
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "IsAutoCollect")) isEx = true;
+ if (isEx)
+ {
+ IsAutoCollect = ds.Tables[0].Rows[0]["IsAutoCollect"] == null ||
+ bool.Parse(ds.Tables[0].Rows[0]["IsAutoCollect"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "EcgPrintMode")) isEx = true;
+ if (isEx)
+ {
+ EcgPrintMode = ds.Tables[0].Rows[0]["EcgPrintMode"] != null
+ ? int.Parse(ds.Tables[0].Rows[0]["EcgPrintMode"].ToString())
+ : 0;
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "HasHIS")) isEx = true;
+ if (isEx)
+ {
+ HasHis = ds.Tables[0].Rows[0]["HasHIS"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["HasHIS"].ToString());
+ isEx = false;
+ }
+
+ //WebApi
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "WebApi")) isEx = true;
+ if (isEx)
+ {
+ WebApi = ds.Tables[0].Rows[0]["WebApi"] != null ? ds.Tables[0].Rows[0]["WebApi"].ToString() : "";
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "EcgReportTitle")) isEx = true;
+ if (isEx)
+ {
+ EcgReportTitle = ds.Tables[0].Rows[0]["EcgReportTitle"] != null
+ ? ds.Tables[0].Rows[0]["EcgReportTitle"].ToString()
+ : "";
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "IsGetAddress")) isEx = true;
+ if (isEx)
+ {
+ IsGetAddress = ds.Tables[0].Rows[0]["IsGetAddress"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["IsGetAddress"].ToString());
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "IsPrintEcg")) isEx = true;
+ if (isEx)
+ {
+ IsPrintEcg = ds.Tables[0].Rows[0]["IsPrintEcg"] == null ||
+ bool.Parse(ds.Tables[0].Rows[0]["IsPrintEcg"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "IsShowPrint")) isEx = true;
+ if (isEx)
+ {
+ IsShowPrint = ds.Tables[0].Rows[0]["IsShowPrint"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["IsShowPrint"].ToString());
+ isEx = false;
+ }
+
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "WxIsPay")) isEx = true;
+ if (isEx)
+ {
+ WxIsPay = ds.Tables[0].Rows[0]["WxIsPay"] != null &&
+ bool.Parse(ds.Tables[0].Rows[0]["WxIsPay"].ToString());
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == nameof(BdTransBaseAddr))) isEx = true;
+ if (isEx)
+ {
+ BdTransBaseAddr = ds.Tables[0].Rows[0][nameof(BdTransBaseAddr)] != null ?
+ ds.Tables[0].Rows[0][nameof(BdTransBaseAddr)].ToString() : "http://api.fanyi.baidu.com/api/trans/vip/translate";
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == nameof(BdTransKey))) isEx = true;
+ if (isEx)
+ {
+ BdTransKey = ds.Tables[0].Rows[0][nameof(BdTransKey)] != null ? ds.Tables[0].Rows[0][nameof(BdTransKey)].ToString() : "";
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == nameof(BdTransSecret))) isEx = true;
+ if (isEx)
+ {
+ BdTransSecret = ds.Tables[0].Rows[0][nameof(BdTransSecret)] != null ? ds.Tables[0].Rows[0][nameof(BdTransSecret)].ToString() : string.Empty;
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "BASE_HZ")) isEx = true;
+ if (isEx)
+ {
+ switch (ds.Tables[0].Rows[0]["BASE_HZ"].ToString().Trim())
+ {
+ case "关":
+ BaseHz = BaseOff;
+ break;
+ case "0.05":
+ BaseHz = Base005Hz;
+ break;
+ case "0.5":
+ BaseHz = Base05Hz;
+ break;
+ case "0.75":
+ BaseHz = Base075Hz;
+ break;
+ }
+
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "MC_HZ")) isEx = true;
+ if (isEx)
+ {
+ switch (ds.Tables[0].Rows[0]["MC_HZ"].ToString().Trim())
+ {
+ case "关":
+ McHz = McOff;
+ break;
+ case "25":
+ McHz = Mc25Hz;
+ break;
+ case "35":
+ McHz = Mc35Hz;
+ break;
+ case "45":
+ McHz = Mc45Hz;
+ break;
+ }
+
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "AC_HZ")) isEx = true;
+ if (isEx)
+ {
+ switch (ds.Tables[0].Rows[0]["AC_HZ"].ToString().Trim())
+ {
+ case "关":
+ AcHz = AcOff;
+ break;
+ case "50":
+ AcHz = Ac50Hz;
+ break;
+ case "60":
+ AcHz = Ac60Hz;
+ break;
+ }
+
+ isEx = false;
+ }
+
+ if (ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == "LP_HZ")) isEx = true;
+ if (isEx)
+ switch (ds.Tables[0].Rows[0]["LP_HZ"].ToString().Trim())
+ {
+ case "关":
+ LpHz = LpOff;
+ break;
+ case "75":
+ LpHz = Lp75Hz;
+ break;
+ case "100":
+ LpHz = Lp100Hz;
+ break;
+ case "150":
+ LpHz = Lp150Hz;
+ break;
+ }
+
+
+ ds.Dispose();
+ }
+
+ try
+ {
+ var addrPath = Application.StartupPath + "\\LOCAL_INFOMATION.INFO";
+ if (File.Exists(addrPath))
+ {
+ var sr = new StreamReader(addrPath);
+ var cnt = sr.ReadToEnd();
+ sr.Close();
+ LocalAddress = cnt;
+ }
+ else
+ {
+ const string addr = "北京市亦庄经济技术开发区宏达北路16号1楼202室";
+ var fs = new FileStream(addrPath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ var sw = new StreamWriter(fs);
+ sw.Write(addr);
+ sw.Close();
+ fs.Close();
+ LocalAddress = addr;
+ }
+ }
+ catch (Exception)
+ {
+ // ignored
+ }
+ }
+
+ ///
+ /// 获取本地网络连接字符串
+ ///
+ public static string LocalConnectionStr
+ {
+ get => LocalConStr;
+ set => LocalConStr = value;
+ }
+
+ ///
+ /// 远程判读URL
+ ///
+ public static string UrlDistanceString
+ {
+ get => UrlDistance;
+ set => UrlDistance = value;
+ }
+
+ ///
+ /// 远程申请判读地址URL
+ ///
+ ///
+ public static string UrlApplicationString
+ {
+ get => UrlApplication;
+ set => UrlApplication = value;
+ }
+
+ ///
+ /// 只申请不判读地址URL
+ ///
+ ///
+ public static string UrlApplicationStringNo
+ {
+ get => UrlApplicationNo;
+ set => UrlApplicationNo = value;
+ }
+
+ ///
+ /// 获得远程判读结果URL
+ ///
+ ///
+ public static string UrlReturnString
+ {
+ get => UrlReturn;
+ set => UrlReturn = value;
+ }
+
+ ///
+ /// 获得远程判读修正结果URL
+ ///
+ ///
+ public static string UrlNewReturnString
+ {
+ get => UrlNewReturn;
+ set => UrlNewReturn = value;
+ }
+
+
+ ///
+ /// 通知远程判读结果收到URL
+ ///
+ ///
+ public static string UrlChangeStateString
+ {
+ get => UrlChangeState;
+ set => UrlChangeState = value;
+ }
+
+ ///
+ /// 获取远程判读医生签名URL
+ ///
+ public static string UrlGraphString
+ {
+ get => UrlGraph;
+ set => UrlGraph = value;
+ }
+
+ ///
+ /// 获得社区机构编号
+ ///
+ ///
+ public static string ORGID => OrgID;
+
+ ///
+ /// 获取提交判读等级
+ ///
+ public static string InterpretationLevel
+ {
+ get => InptLevel;
+ set => InptLevel = value;
+ }
+
+ ///
+ /// 保存配置文件
+ ///
+ /// 列名
+ /// 值
+ public static void SaveConfig(string columnName, string value)
+ {
+ try
+ {
+ var ds = new DataSet();
+ var sr = new StreamReader(Application.StartupPath + @"\MedicalCloudPlatform.exe.yjl", Encoding.UTF8);
+ var str = DesEncrypt.Decrypt(sr.ReadToEnd());
+ var ms = new MemoryStream(Encoding.UTF8.GetBytes(str));
+ ds.ReadXml(ms);
+ var isEx = ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == columnName);
+ if (!isEx) ds.Tables[0].Columns.Add(new DataColumn(columnName, typeof(string)));
+ ds.Tables[0].Rows[0][columnName] = value;
+ ms.Close();
+ sr.Close();
+
+ var msm = new MemoryStream();
+ ds.Tables[0].WriteXml(msm);
+ var s = Encoding.UTF8.GetString(msm.ToArray()).Insert(0, "");
+ File.WriteAllText(Application.StartupPath + @"\MedicalCloudPlatform.exe.yjl", DesEncrypt.Encrypt(s),
+ Encoding.UTF8);
+
+ msm.Close();
+ ds.Dispose();
+ }
+ catch (Exception)
+ {
+ }
+ }
+
+ ///
+ /// 保存多个配置文件节点
+ ///
+ /// 配置字符串
+ public static void SaveConfig(Dictionary config)
+ {
+ try
+ {
+ var ds = new DataSet();
+ var sr = new StreamReader(Application.StartupPath + @"\MedicalCloudPlatform.exe.yjl", Encoding.UTF8);
+ var str = DesEncrypt.Decrypt(sr.ReadToEnd());
+ var ms = new MemoryStream(Encoding.UTF8.GetBytes(str));
+ ds.ReadXml(ms);
+
+ if (config != null)
+ foreach (var kvp in config)
+ {
+ var isEx = ds.Tables[0].Columns.Cast().Any(dc => dc.ColumnName == kvp.Key);
+ if (!isEx) ds.Tables[0].Columns.Add(new DataColumn(kvp.Key, typeof(string)));
+ ds.Tables[0].Rows[0][kvp.Key] = kvp.Value;
+ }
+
+ ms.Close();
+ sr.Close();
+
+ var msm = new MemoryStream();
+ ds.Tables[0].WriteXml(msm);
+ var s = Encoding.UTF8.GetString(msm.ToArray()).Insert(0, "");
+ File.WriteAllText(Application.StartupPath + @"\MedicalCloudPlatform.exe.yjl", DesEncrypt.Encrypt(s),
+ Encoding.UTF8);
+
+ msm.Close();
+ ds.Dispose();
+ }
+ catch (Exception)
+ {
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/DESEncrypt.cs b/1200Gxml心电图绘制/DESEncrypt.cs
new file mode 100644
index 0000000..6b1d2bd
--- /dev/null
+++ b/1200Gxml心电图绘制/DESEncrypt.cs
@@ -0,0 +1,97 @@
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using System.Web.Security;
+
+namespace _1200Gxml心电图绘制
+{
+ public class DesEncrypt
+ {
+ #region ========加密========
+
+ ///
+ /// 加密
+ ///
+ ///
+ ///
+ public static string Encrypt(string text)
+ {
+ return Encrypt(text, "da1ff5@1b453d1f66d83bc6e7c5cab4$");
+ }
+
+ ///
+ /// 加密数据
+ ///
+ ///
+ ///
+ ///
+ public static string Encrypt(string text, string sKey)
+ {
+ var des = new DESCryptoServiceProvider();
+ var inputByteArray = Encoding.Default.GetBytes(text);
+ var hashPasswordForStoringInConfigFile =
+ FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5");
+ if (hashPasswordForStoringInConfigFile != null)
+ des.Key = Encoding.ASCII.GetBytes(hashPasswordForStoringInConfigFile.Substring(0, 8));
+ var passwordForStoringInConfigFile = FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5");
+ if (passwordForStoringInConfigFile != null)
+ des.IV = Encoding.ASCII.GetBytes(passwordForStoringInConfigFile.Substring(0, 8));
+ var ms = new MemoryStream();
+ var cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write);
+ cs.Write(inputByteArray, 0, inputByteArray.Length);
+ cs.FlushFinalBlock();
+ var ret = new StringBuilder();
+ foreach (var b in ms.ToArray()) ret.AppendFormat("{0:X2}", b);
+ return ret.ToString();
+ }
+
+ #endregion
+
+ #region ========解密========
+
+ ///
+ /// 解密
+ ///
+ ///
+ ///
+ public static string Decrypt(string text)
+ {
+ return Decrypt(text, "da1ff5@1b453d1f66d83bc6e7c5cab4$");
+ }
+
+ ///
+ /// 解密数据
+ ///
+ ///
+ ///
+ ///
+ public static string Decrypt(string text, string sKey)
+ {
+ var des = new DESCryptoServiceProvider();
+ var len = text.Length / 2;
+ var inputByteArray = new byte[len];
+ int x, i;
+ for (x = 0; x < len; x++)
+ {
+ i = Convert.ToInt32(text.Substring(x * 2, 2), 16);
+ inputByteArray[x] = (byte)i;
+ }
+
+ var hashPasswordForStoringInConfigFile =
+ FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5");
+ if (hashPasswordForStoringInConfigFile != null)
+ des.Key = Encoding.ASCII.GetBytes(hashPasswordForStoringInConfigFile.Substring(0, 8));
+ var passwordForStoringInConfigFile = FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5");
+ if (passwordForStoringInConfigFile != null)
+ des.IV = Encoding.ASCII.GetBytes(passwordForStoringInConfigFile.Substring(0, 8));
+ var ms = new MemoryStream();
+ var cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write);
+ cs.Write(inputByteArray, 0, inputByteArray.Length);
+ cs.FlushFinalBlock();
+ return Encoding.Default.GetString(ms.ToArray());
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/EcgDataDraw_New.cs b/1200Gxml心电图绘制/EcgDataDraw_New.cs
new file mode 100644
index 0000000..bb6d9fa
--- /dev/null
+++ b/1200Gxml心电图绘制/EcgDataDraw_New.cs
@@ -0,0 +1,901 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using System.Data;
+using System.Windows.Forms;
+using System.IO;
+
+
+namespace _1200Gxml心电图绘制
+{
+ public class EcgDataDraw_New
+ {
+ int Amplitude = 10;//振幅
+ int PaperSpeed = 25;
+ double AmplificationFactor = 140.00;
+ //int AmplificationFactor = 60;
+ int SamplingRate = 300;
+ int LeadCount = 12;
+ int byteLength = 2;
+ int Dpi = 96;
+ double LenthPerInch = 25.4;
+ int BaseLine = 0;
+ int LeadHeight = 0;
+ Pen Ecg_Pen;
+ Graphics Ecg_Graphics;
+ Bitmap Ecg_Canvas;
+ public List LeadInfo = new List();
+ Dictionary> EcgDataList;
+ int FreePixs = 0;
+ Point FirstPosition = new Point(0, 0);
+ Point SecondPosition = new Point(0, 0);
+ Dictionary FirstPointArray = new Dictionary();
+
+ //存放心电数据的字典 按照 每导联顺序进行存储
+ Dictionary> EcgData_Dic = new Dictionary>();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void InitEcgParameter(Bitmap btmp, int leadCount, Dictionary> EcgTable, int NewDpi, List leadinfo)
+ {
+ //string[] WavePara = File.ReadAllText(Application.StartupPath + @"\WavePara.txt").Trim().Split(',');
+ //SamplingRate = int.Parse(WavePara[0].Trim());
+ //AmplificationFactor = double.Parse(WavePara[1].Trim());
+
+
+ SamplingRate =300;
+ AmplificationFactor = 10;
+
+ Ecg_Canvas = btmp;
+ Ecg_Graphics = Graphics.FromImage(Ecg_Canvas);
+ Ecg_Graphics.Clear(Color.White);//填充指定颜色
+
+ LeadCount = leadCount;
+ LeadInfo = leadinfo;
+ BaseLine = (btmp.Height / LeadInfo.Count) / 2;
+
+ LeadHeight = (btmp.Height / (LeadInfo.Count/2));
+ Dpi = NewDpi;
+ EcgData_Dic = EcgTable;
+ Ecg_Pen = new Pen(Color.Gray, float.Parse("0.5"));
+ FreePixs = int.Parse(Math.Round((double.Parse(Dpi.ToString()) / LenthPerInch) * 5).ToString());
+ }
+
+
+ ///
+ /// 把识别的R波位置标示出来
+ ///
+ ///
+ public void drawRWavePos(List rPosList)
+ {
+ Ecg_Pen = new Pen(Color.Green, float.Parse("1"));
+ double IntervalPixCountPerPoint = double.Parse("0.102");
+ for (int i = 0; i < rPosList.Count; i++)
+ {
+ double x = double.Parse(rPosList[i].ToString()) * IntervalPixCountPerPoint * 3.3;
+ int nextX = (int.Parse(Math.Round(x).ToString()));
+ Point pt1 = new Point(nextX,0); Point pt2 = new Point(nextX, 1024);
+ Ecg_Graphics.DrawLine(Ecg_Pen, pt1, pt2);
+ }
+
+ }
+
+ ///
+ /// 绘制心电波形
+ ///
+ public void Draw_EcgWave()
+ {
+ Ecg_Pen = new Pen(Color.Black, float.Parse("1"));
+ //double IntervalPixCountPerPoint = (double.Parse(PaperSpeed.ToString()) / double.Parse(SamplingRate.ToString())) * (double.Parse(Dpi.ToString()) / LenthPerInch);
+ //double IntervalPixCountPerPoint = double.Parse("0.095");
+
+ //double IntervalPixCountPerPoint = double.Parse("0.134");
+ double IntervalPixCountPerPoint = double.Parse("0.102");
+ //double IntervalPixCountPerPoint = double.Parse("0.126");
+ for (int i = 0; i < LeadInfo.Count; i++)
+ {
+ int LeadIndex = LeadInfo[i];//取导联下标 0 1 2 3 ...11
+ if (i < 6)
+ {
+ BaseLine = (Ecg_Canvas.Height / (LeadInfo.Count / 2)) / 2 + (i * LeadHeight);
+ FirstPosition.Y = BaseLine;
+ FirstPosition.X = FreePixs;
+ SecondPosition.Y = BaseLine;
+ SecondPosition.X = FreePixs;
+ Point FP = new Point(FirstPosition.X + FreePixs, FirstPosition.Y);
+ FirstPointArray.Add(LeadIndex.ToString(), FP);
+ }
+ else
+ {
+ BaseLine = (Ecg_Canvas.Height / (LeadInfo.Count / 2)) / 2 + ((i - 6) * LeadHeight);
+ FirstPosition.Y = BaseLine;
+ FirstPosition.X = FreePixs + Ecg_Canvas.Width / 2;
+ SecondPosition.Y = BaseLine;
+ SecondPosition.X = FreePixs + Ecg_Canvas.Width / 2;
+ Point FP = new Point(FirstPosition.X + FreePixs, FirstPosition.Y);
+ FirstPointArray.Add(LeadIndex.ToString(), FP);
+ }
+ if (EcgData_Dic.Count > 0)
+ for (int b = 0; b < EcgData_Dic[LeadIndex].Count; b++)
+ {
+ if (i < 6)
+ {
+ if (FirstPosition.X > Ecg_Canvas.Width / 2 - 5)
+ break;
+ }
+ else
+ {
+ if (FirstPosition.X > Ecg_Canvas.Width)
+ break;
+ }
+ //double c = double.Parse(EcgData_Dic[LeadIndex][b].ToString());
+ //double d = double.Parse((double.Parse(Dpi.ToString()) / double.Parse("96")).ToString());
+ //SecondPosition.Y = BaseLine - (int)(c * d);
+ float y_values = 0;
+ try
+ {
+ //y_values = EcgData_Dic[LeadIndex][b] * (float)(96 / 25.4)*10;
+ y_values = EcgData_Dic[LeadIndex][b] * (float)(96 / 25.4) * (float)0.041;
+ }
+ catch { }
+ SecondPosition.Y = BaseLine - (Int32)y_values;//后一点Y轴位置
+
+ double x = double.Parse(b.ToString()) * IntervalPixCountPerPoint*3.3;
+ int nextX = (int.Parse(Math.Round(x).ToString()));
+ if (Math.Abs(FirstPosition.X - SecondPosition.X) < 5)
+ {
+ if (i < 6)
+ {
+ SecondPosition.X = nextX + FreePixs;
+ Ecg_Graphics.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ FirstPosition = SecondPosition;
+
+ //Ecg_Graphics.DrawLine(new Pen(Color.Green, float.Parse("1")), FirstPosition.X, BaseLine+150, SecondPosition.X, BaseLine + 150);
+ }
+ else
+ {
+ SecondPosition.X = Ecg_Canvas.Width / 2 + FreePixs + nextX;
+ Ecg_Graphics.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ FirstPosition = SecondPosition;
+ }
+ }
+ else
+ FirstPosition = SecondPosition;
+ }
+ }
+ }
+
+ ///
+ /// 绘制心电波形
+ ///
+ public void Draw_EcgWave(int Draw_InitHeight,int BottomHeight)
+ {
+ FirstPointArray.Clear();
+ Draw_InitHeight = Draw_InitHeight * FreePixs;
+ BottomHeight = BottomHeight * FreePixs;
+ Ecg_Pen = new Pen(Color.Black, float.Parse("2"));
+ //double IntervalPixCountPerPoint = (double.Parse(PaperSpeed.ToString()) / double.Parse(SamplingRate.ToString())) * (double.Parse(Dpi.ToString()) / LenthPerInch);
+
+ //double IntervalPixCountPerPoint = double.Parse("0.134");
+ double IntervalPixCountPerPoint = double.Parse("0.296");
+ for (int i = 0; i < LeadInfo.Count; i++)
+ {
+ int LeadIndex = LeadInfo[i];//取导联下标 0 1 2 3 ...11
+ if (i < 6)
+ {
+ //BaseLine = (Ecg_Canvas.Height / (LeadInfo.Count / 2)) / 2 + (i * LeadHeight);
+ BaseLine = ((Ecg_Canvas.Height - Draw_InitHeight - BottomHeight) / (LeadInfo.Count / 2)) / 2 + (i * ((Ecg_Canvas.Height - Draw_InitHeight - BottomHeight) / (LeadInfo.Count / 2))) + Draw_InitHeight;
+ FirstPosition.Y = BaseLine;
+ FirstPosition.X = FreePixs;
+ SecondPosition.Y = BaseLine;
+ SecondPosition.X = FreePixs;
+ Point FP = new Point(FirstPosition.X + FreePixs, FirstPosition.Y);
+ FirstPointArray.Add(LeadIndex.ToString(), FP);
+ }
+ else
+ {
+ BaseLine = ((Ecg_Canvas.Height - Draw_InitHeight - BottomHeight) / (LeadInfo.Count / 2)) / 2 + ((i - 6) * ((Ecg_Canvas.Height - Draw_InitHeight - BottomHeight) / (LeadInfo.Count / 2))) + Draw_InitHeight;
+ FirstPosition.Y = BaseLine;
+ FirstPosition.X = FreePixs + Ecg_Canvas.Width / 2;
+ SecondPosition.Y = BaseLine;
+ SecondPosition.X = FreePixs + Ecg_Canvas.Width / 2;
+ Point FP = new Point(FirstPosition.X + FreePixs, FirstPosition.Y);
+ FirstPointArray.Add(LeadIndex.ToString(), FP);
+ }
+ for (int b = 0; b < EcgData_Dic[LeadIndex].Count; b+=3)
+ {
+ if (i < 6)
+ {
+ if (FirstPosition.X > Ecg_Canvas.Width / 2 - 5)
+ break;
+ }
+ else
+ {
+ if (FirstPosition.X > Ecg_Canvas.Width)
+ break;
+ }
+ //double c = double.Parse(EcgData_Dic[LeadIndex][b].ToString());
+ //double d = double.Parse((double.Parse(Dpi.ToString()) / double.Parse("96")).ToString());
+ //SecondPosition.Y = BaseLine - (int)(c * d);
+ float y_values = 0;
+ try
+ {
+ //y_values = EcgData_Dic[LeadIndex][b] * (float)(300 / 25.4)*10;
+ y_values = EcgData_Dic[LeadIndex][b] * (float)(300 / 25.4) * (float)9.5;
+ }
+ catch { }
+ SecondPosition.Y = BaseLine - (Int32)y_values;//后一点Y轴位置
+
+ double x = double.Parse(b.ToString()) * IntervalPixCountPerPoint;
+ int nextX = (int.Parse(Math.Round(x).ToString()));
+ if (Math.Abs(FirstPosition.X - SecondPosition.X) < 5)
+ {
+ if (i < 6)
+ {
+ SecondPosition.X = nextX + FreePixs;
+ Ecg_Graphics.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ FirstPosition = SecondPosition;
+ }
+ else
+ {
+ SecondPosition.X = Ecg_Canvas.Width / 2 + FreePixs + nextX;
+ Ecg_Graphics.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ FirstPosition = SecondPosition;
+ }
+ }
+ else
+ FirstPosition = SecondPosition;
+ }
+ }
+ }
+
+
+ ///
+ /// 绘制心电报告的报告头
+ ///
+ public void Draw_ReportHeadInfo(string ReportHeadTile, string SectionName,string IdStr)
+ {
+ Pen pen_1 = new Pen(Color.Black, float.Parse("4"));
+
+ Font font1 = new Font("隶书", 20);
+ Brush brush = Brushes.Black;
+
+ PointF point2 = new PointF(Ecg_Canvas.Width/2-300, FreePixs/2);
+ Ecg_Graphics.DrawString(ReportHeadTile, font1, brush, point2);
+
+ Font font = new Font("宋体", 10);
+ //PointF point = new PointF(10, FreePixs * 3-20);
+ //Ecg_Graphics.DrawString("科室:" + SectionName, font, brush, point);
+
+ PointF pointId = new PointF(Ecg_Canvas.Width - 3400, FreePixs * 4-20);
+ Ecg_Graphics.DrawString("ID:" + IdStr, font, brush, pointId);
+
+ //PointF point1 = new PointF(Ecg_Canvas.Width-1200, FreePixs * 3-20);
+ //Ecg_Graphics.DrawString("报告日期:" + ReportDate, font, brush, point1);
+
+ // Ecg_Graphics.DrawLine(pen_1, 0, FreePixs * 4-60, Ecg_Canvas.Width, FreePixs * 4-60);
+ }
+ /////
+ ///// 绘制患者的心电识别的参数
+ /////
+ //public void Draw_EcgInfo(string[] Diag_Info_List)
+ //{
+ // Pen pen_1 = new Pen(Color.Black, float.Parse("4"));
+ // Font font1 = new Font("宋体", 10);
+ // Brush brush = Brushes.Black;
+
+ // PointF point = new PointF(10, FreePixs * 4+10);
+ // Ecg_Graphics.DrawString(Diag_Info_List[0], font1, brush, point);//姓名
+ // PointF point_1 = new PointF(10, FreePixs * 5 + 25);
+ // Ecg_Graphics.DrawString(Diag_Info_List[1], font1, brush, point_1);//性别
+ // PointF point_2 = new PointF(10, FreePixs * 6 + 35);
+ // Ecg_Graphics.DrawString(Diag_Info_List[2], font1, brush, point_2);//年龄
+
+ // PointF point_3 = new PointF(600, FreePixs * 4 + 10);
+ // Ecg_Graphics.DrawString(Diag_Info_List[3], font1, brush, point_3);//P
+ // PointF point_4 = new PointF(600, FreePixs * 5 + 25);
+ // Ecg_Graphics.DrawString(Diag_Info_List[4], font1, brush, point_4);//P-R
+ // PointF point_5 = new PointF(600, FreePixs * 6 + 35);
+ // Ecg_Graphics.DrawString(Diag_Info_List[5], font1, brush, point_5);//QRS
+
+ // PointF point_6 = new PointF(1200, FreePixs * 4 + 10);
+ // Ecg_Graphics.DrawString(Diag_Info_List[6], font1, brush, point_6);//QT/QTC
+ // PointF point_7 = new PointF(1200, FreePixs * 5 + 25);
+ // Ecg_Graphics.DrawString(Diag_Info_List[7], font1, brush, point_7);//QRS电轴
+ // PointF point_8 = new PointF(1200, FreePixs * 6 + 35);
+ // Ecg_Graphics.DrawString(Diag_Info_List[8], font1, brush, point_8);//RV5/SV1
+
+ // PointF point_9 = new PointF(1800, FreePixs * 4 + 10);
+ // Ecg_Graphics.DrawString(Diag_Info_List[9], font1, brush, point_9);//心率
+
+
+ // Ecg_Graphics.DrawLine(pen_1, 0, FreePixs * 8, Ecg_Canvas.Width, FreePixs * 8);
+ //}
+ ///
+ /// 绘制患者的心电识别的参数
+ ///
+ public void Draw_EcgInfo(string[] Diag_Info_List)
+ {
+ Pen pen_1 = new Pen(Color.Black, float.Parse("4"));
+ Font font1 = new Font("宋体", 10);
+ Brush brush = Brushes.Black;
+
+ PointF point = new PointF(600, FreePixs * 4-20);
+ Ecg_Graphics.DrawString(Diag_Info_List[0], font1, brush, point);//姓名
+
+ PointF point_1 = new PointF(1200, FreePixs * 4 -20);
+ Ecg_Graphics.DrawString(Diag_Info_List[1], font1, brush, point_1);//性别
+
+ PointF point_2 = new PointF(1800, FreePixs * 4-20);
+ Ecg_Graphics.DrawString(Diag_Info_List[2], font1, brush, point_2);//年龄
+
+
+
+ //PointF point_4 = new PointF(600, FreePixs * 5 + 25);
+ //Ecg_Graphics.DrawString(Diag_Info_List[3], font1, brush, point_4);//P
+
+ PointF point_5 = new PointF(10, FreePixs * 5 + 5);
+ Ecg_Graphics.DrawString(Diag_Info_List[4], font1, brush, point_5);//P-R
+
+ PointF point_6 = new PointF(600, FreePixs * 5 + 5);
+ Ecg_Graphics.DrawString(Diag_Info_List[5], font1, brush, point_6);//QRS
+
+ PointF point_3 = new PointF(1200, FreePixs * 5 + 5);
+ Ecg_Graphics.DrawString(Diag_Info_List[9], font1, brush, point_3);//心率
+
+
+ PointF point_7 = new PointF(10, FreePixs * 6 + 35);
+ Ecg_Graphics.DrawString(Diag_Info_List[6], font1, brush, point_7);//QT/QTC
+
+ PointF point_8 = new PointF(600, FreePixs * 6 + 35);
+ Ecg_Graphics.DrawString(Diag_Info_List[7], font1, brush, point_8);//QRS电轴
+
+ PointF point_9 = new PointF(1200, FreePixs * 6 + 35);
+ Ecg_Graphics.DrawString(Diag_Info_List[8], font1, brush, point_9);//RV5/SV1
+
+
+ Ecg_Graphics.DrawLine(pen_1, 0, FreePixs * 8, Ecg_Canvas.Width, FreePixs * 8);
+ }
+
+ ///
+ /// 绘制医生的诊断结果
+ ///
+ public void Draw_DiagInfo(string DiagInfoContent,string ReportDoctorName,string ReportDate,string Filter,string collectTime,string dept)
+ {
+ string[] diagresultecontent = new string[DiagInfoContent.Length/48+1];
+ for (int a = 0; a < DiagInfoContent.Length / 48 + 1;a++ )
+ {
+ if (a < DiagInfoContent.Length / 48)
+ diagresultecontent[a] = DiagInfoContent.Substring(a * 48, 48);
+ else
+ diagresultecontent[a] = DiagInfoContent.Substring(a * 48, DiagInfoContent.Length - a * 48);
+ }
+ Pen pen_1 = new Pen(Color.Black, float.Parse("4"));
+ Font font1 = new Font("宋体", 12);
+ Brush brush = Brushes.Black;
+ Ecg_Graphics.DrawLine(pen_1, 0, Ecg_Canvas.Height - FreePixs * 6, Ecg_Canvas.Width, Ecg_Canvas.Height - FreePixs * 6);
+
+ PointF point1 = new PointF(10, Ecg_Canvas.Height - FreePixs * 6 + 10);
+ Ecg_Graphics.DrawString("诊断提示:", font1, brush, point1);//诊断结果
+ for (int i = 0; i < diagresultecontent.Length; i++)
+ {
+ PointF point5 = new PointF(230, Ecg_Canvas.Height - FreePixs * (6-i) + 10);
+ Ecg_Graphics.DrawString(diagresultecontent[i].Trim(), font1, brush, point5);//诊断结果
+ }
+
+ PointF pointb = new PointF(Ecg_Canvas.Width - 1800, Ecg_Canvas.Height - FreePixs * 2);
+ Ecg_Graphics.DrawString("科室:" + dept, font1, brush, pointb);//报告医生
+
+ PointF point2 = new PointF(Ecg_Canvas.Width - 1200, Ecg_Canvas.Height - FreePixs * 2);
+ Ecg_Graphics.DrawString("报告医生:" + ReportDoctorName, font1, brush, point2);//报告医生
+
+ PointF point9 = new PointF(Ecg_Canvas.Width - 600, Ecg_Canvas.Height - FreePixs * 2);
+ Ecg_Graphics.DrawString("报告日期:" + ReportDate, font1, brush, point9);//报告医生
+
+ PointF point10 = new PointF(1800, FreePixs * 6 + 35);
+ Ecg_Graphics.DrawString("25mm/s 10mm/mV " + Filter, font1, brush, point10);//振幅 走纸速度 滤波
+ PointF point11 = new PointF(Ecg_Canvas.Width - 600, Ecg_Canvas.Height - FreePixs * 7 - 5);
+ Ecg_Graphics.DrawString(collectTime, font1, brush, point11);//波形的起始时间点
+
+ Ecg_Graphics.DrawLine(pen_1, 0, Ecg_Canvas.Height - FreePixs, Ecg_Canvas.Width, Ecg_Canvas.Height - FreePixs);
+ }
+ /////
+ ///// 绘制心电波形
+ /////
+ //public void Draw_EcgWave()
+ //{
+ // Ecg_Pen = new Pen(Color.Black, float.Parse("0.5"));
+ // for (int i = 0; i < LeadInfo.Count; i++)
+ // {
+ // int LeadIndex = LeadInfo[i];//取导联下标 0 1 2 3 ...11
+ // BaseLine = (Ecg_Canvas.Height / LeadInfo.Count) / 2 + (i * LeadHeight);
+ // FirstPosition.Y = BaseLine;
+ // FirstPosition.X = FreePixs;
+ // SecondPosition.Y = BaseLine;
+ // SecondPosition.X = FreePixs;
+ // Point FP = new Point(FirstPosition.X + FreePixs, FirstPosition.Y);
+ // FirstPointArray.Add(LeadIndex.ToString(), FP);
+ // for (int b = 0; b < EcgDataList[LeadIndex].Count; b++)
+ // {
+ // if (FirstPosition.X > Ecg_Canvas.Width)
+ // break;
+ // if (EcgDataList[LeadIndex][b] > 0)
+ // SecondPosition.Y = Math.Abs(BaseLine - EcgDataList[LeadIndex][b]);
+ // if (EcgDataList[LeadIndex][b] < 0)
+ // SecondPosition.Y = BaseLine + Math.Abs(EcgDataList[LeadIndex][b]);
+ // double x = double.Parse(b.ToString()) * (double.Parse(Dpi.ToString()) / double.Parse(SamplingRate.ToString()));//获得点的X轴位置
+ // int nextX = (int.Parse(Math.Round(x).ToString()));
+ // if (Math.Abs(FirstPosition.X - SecondPosition.X) < 5)
+ // {
+ // SecondPosition.X = nextX + FreePixs;
+ // Ecg_Graphics.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ // FirstPosition = SecondPosition;
+ // }
+ // else
+ // FirstPosition = SecondPosition;
+ // }
+ // }
+ //}
+
+ /////
+ ///// 绘制心电图的背景网格
+ /////
+ //public void Draw_EcgBackGroundGrid()
+ //{
+ // Ecg_Pen = new Pen(Color.LightCoral, float.Parse("0.1"));
+ // bool shuxianFlag = false;
+ // double PointCountPerMM = Math.Abs(double.Parse(Dpi.ToString()) / LenthPerInch);
+ // int x = 0;
+ // int y = 0;
+ // for (int p = 0; p < Ecg_Canvas.Height / PointCountPerMM; p++)
+ // {
+ // for (int R = 0; R < Ecg_Canvas.Width / PointCountPerMM; R++)
+ // {
+ // if (x % 5 == 0 && !shuxianFlag)
+ // {
+ // Ecg_Graphics.DrawLine(Ecg_Pen, x, 0, x, Ecg_Canvas.Height);
+ // }
+ // x += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+ // if (x < Ecg_Canvas.Width && y < Ecg_Canvas.Height)
+ // {
+ // Ecg_Canvas.SetPixel(x, y, Color.LightCoral);
+ // }
+ // else
+ // {
+ // x = 0;
+ // break;
+ // }
+ // }
+ // shuxianFlag = true;
+ // if (y % 5 == 0)
+ // {
+ // Ecg_Graphics.DrawLine(Ecg_Pen, 0, y, Ecg_Canvas.Width, y);
+ // }
+ // y += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+
+ // if (y > Ecg_Canvas.Height)
+ // {
+ // break;
+ // }
+ // }
+ //}
+
+ ///
+ /// 绘制心电图的背景网格
+ ///
+ public void Draw_EcgBackGroundGrid()
+ {
+ Ecg_Pen = new Pen(Color.LightCoral, float.Parse("0.1"));
+ //Ecg_Pen = new Pen(Color.Black, float.Parse("0.1"));
+ bool shuxianFlag = false;
+ double PointCountPerMM = Math.Abs(double.Parse(Dpi.ToString()) / LenthPerInch);
+ int x = 0;
+ int y = 0;
+ for (int p = 0; p < Ecg_Canvas.Height / PointCountPerMM; p++)
+ {
+ for (int R = 0; R < Ecg_Canvas.Width / PointCountPerMM; R++)
+ {
+ if (x % 5 == 0 && !shuxianFlag)
+ {
+ Ecg_Graphics.DrawLine(Ecg_Pen, x, 0, x, Ecg_Canvas.Height);
+ }
+ x += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+ if (x < Ecg_Canvas.Width && y < Ecg_Canvas.Height)
+ {
+ Ecg_Canvas.SetPixel(x, y, Color.Black);
+ }
+ else
+ {
+ x = 0;
+ break;
+ }
+ }
+ shuxianFlag = true;
+ if (y % 5 == 0)
+ {
+ Ecg_Graphics.DrawLine(Ecg_Pen, 0, y, Ecg_Canvas.Width, y);
+ }
+ y += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+
+ if (y > Ecg_Canvas.Height)
+ {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// 绘制心电图的背景网格
+ ///
+ public void Draw_EcgBackGroundGrid(int height1,int height2,int PenWidth)
+ {
+ if (PenWidth == 0)
+ Ecg_Pen = new Pen(Color.LightCoral, float.Parse("0.1"));
+ else
+ Ecg_Pen = new Pen(Color.Black, float.Parse("1"));
+ //Ecg_Pen = new Pen(Color.Black, PenWidth);
+ bool shuxianFlag = false;
+ double PointCountPerMM = Math.Abs(double.Parse(Dpi.ToString()) / LenthPerInch);
+ height1 = height1 * (int)PointCountPerMM;
+ height2 = height2 * (int)PointCountPerMM;
+ int x = 0;
+ int y = 0;
+ for (int p = 0; p < Ecg_Canvas.Height / PointCountPerMM; p++)
+ {
+ for (int R = 0; R < Ecg_Canvas.Width / PointCountPerMM; R++)
+ {
+ if (x % 5 == 0 && !shuxianFlag)
+ {
+ //Ecg_Graphics.DrawLine(Ecg_Pen, x, 0, x, Ecg_Canvas.Height);
+ Ecg_Graphics.DrawLine(Ecg_Pen, x, height1, x, height2);
+ }
+ x += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+ if (x < Ecg_Canvas.Width && y < Ecg_Canvas.Height)
+ {
+ if (y >= height1 && y <= height2)
+ Ecg_Canvas.SetPixel(x, y, Color.Black);
+ //Ecg_Canvas.SetPixel(x, y, Color.LightCoral);
+ }
+ else
+ {
+ x = 0;
+ break;
+ }
+ }
+ shuxianFlag = true;
+ if (y % 5 == 0)
+ {
+ if (y >= height1 && y <= height2)
+ Ecg_Graphics.DrawLine(Ecg_Pen, 0, y, Ecg_Canvas.Width, y);
+ }
+ y += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+
+ if (y > Ecg_Canvas.Height)
+ {
+ break;
+ }
+ }
+ }
+ ///
+ /// 绘制心电图的大网格 5mm大网格
+ ///
+ public void Draw_BigGrid()
+ {
+ Ecg_Pen = new Pen(Color.LightCoral, float.Parse("0.1"));
+ bool shuxianFlag = false;
+ double PointCountPerMM = Math.Abs(double.Parse(Dpi.ToString()) / LenthPerInch);
+ int x = 0;
+ int y = 0;
+ for (int p = 0; p < Ecg_Canvas.Height / PointCountPerMM; p++)
+ {
+ for (int R = 0; R < Ecg_Canvas.Width / PointCountPerMM; R++)
+ {
+ if (x % 5 == 0 && !shuxianFlag)
+ {
+ Ecg_Graphics.DrawLine(Ecg_Pen, x, 0, x, Ecg_Canvas.Height);
+ }
+ x += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+ if (x < Ecg_Canvas.Width && y < Ecg_Canvas.Height)
+ {
+ //Ecg_Canvas.SetPixel(x, y, Color.LightCoral);
+ }
+ else
+ {
+ x = 0;
+ break;
+ }
+ }
+ shuxianFlag = true;
+ if (y % 5 == 0)
+ {
+ Ecg_Graphics.DrawLine(Ecg_Pen, 0, y, Ecg_Canvas.Width, y);
+ }
+ y += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
+
+ if (y > Ecg_Canvas.Height)
+ {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// 绘制心电图的定标电压和导联名称
+ ///
+ public void Draw_CalibrationVoltage_And_LeadName()
+ {
+ Ecg_Pen = new Pen(Color.Black, float.Parse("1.5"));
+ string[] LeadNameArray = new string[12] { "I", "II", "III", "aVR", "aVL", "aVF", "V1", "V2", "V3", "V4", "V5", "V6" };
+ for (int d = 0; d < LeadInfo.Count; d++)
+ {
+ if (d < 6)
+ {
+ Ecg_Graphics.DrawLine(Ecg_Pen, 0, FirstPointArray[LeadInfo[d].ToString()].Y, Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y);
+ Ecg_Graphics.DrawLine(Ecg_Pen, Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y, Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y - Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) * 2).ToString()));
+ Ecg_Graphics.DrawLine(Ecg_Pen, Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y - Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) * 2).ToString()), Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()) * 2, FirstPointArray[LeadInfo[d].ToString()].Y - Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) * 2).ToString()));
+ Ecg_Graphics.DrawLine(Ecg_Pen, Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()) * 2, FirstPointArray[LeadInfo[d].ToString()].Y - Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) * 2).ToString()), Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()) * 2, FirstPointArray[LeadInfo[d].ToString()].Y);
+ Ecg_Graphics.DrawLine(Ecg_Pen, Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()) * 2, FirstPointArray[LeadInfo[d].ToString()].Y, Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()) * 3, FirstPointArray[LeadInfo[d].ToString()].Y);
+ string str = LeadNameArray[LeadInfo[d]];
+ Font font = new Font("宋体", 11);
+ Brush brush = Brushes.Black;
+ if (d < FirstPointArray.Count)
+ {
+ PointF point = new PointF(0, FirstPointArray[LeadInfo[d].ToString()].Y);
+ Ecg_Graphics.DrawString(str, font, brush, point);
+ }
+ }
+ else
+ {
+ Ecg_Graphics.DrawLine(Ecg_Pen, Ecg_Canvas.Width / 2, FirstPointArray[LeadInfo[d].ToString()].Y, Ecg_Canvas.Width / 2+Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y);
+ Ecg_Graphics.DrawLine(Ecg_Pen, Ecg_Canvas.Width / 2 + Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y, Ecg_Canvas.Width / 2 + Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y - 2 * FreePixs);
+ Ecg_Graphics.DrawLine(Ecg_Pen, Ecg_Canvas.Width / 2 + Int16.Parse(Math.Round(double.Parse(FreePixs.ToString()) / 3).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y - 2 * FreePixs, Ecg_Canvas.Width / 2 + Int16.Parse(Math.Round((double.Parse(FreePixs.ToString()) / 3)*2).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y - 2 * FreePixs);
+ Ecg_Graphics.DrawLine(Ecg_Pen, Ecg_Canvas.Width / 2 + Int16.Parse(Math.Round((double.Parse(FreePixs.ToString()) / 3) * 2).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y - 2 * FreePixs, Ecg_Canvas.Width / 2 + Int16.Parse(Math.Round((double.Parse(FreePixs.ToString()) / 3) * 2).ToString()), FirstPointArray[LeadInfo[d].ToString()].Y);
+ Ecg_Graphics.DrawLine(Ecg_Pen, Ecg_Canvas.Width / 2 + (FreePixs / 3) * 2, FirstPointArray[LeadInfo[d].ToString()].Y, Ecg_Canvas.Width / 2 + FreePixs, FirstPointArray[LeadInfo[d].ToString()].Y);
+ string str = LeadNameArray[LeadInfo[d]];
+ Font font = new Font("宋体", 11);
+ Brush brush = Brushes.Black;
+ if (d < FirstPointArray.Count)
+ {
+ PointF point = new PointF(Ecg_Canvas.Width / 2, FirstPointArray[LeadInfo[d].ToString()].Y);
+ Ecg_Graphics.DrawString(str, font, brush, point);
+ }
+ }
+ }
+ }
+
+
+ ///
+ /// 获得心电数据
+ ///
+ ///
+ public Dictionary> GetEcgData(DataTable EcgDataTable)
+ {
+ string[] WavePara = File.ReadAllText(Application.StartupPath + @"\WavePara.txt").Trim().Split(',');
+ SamplingRate = int.Parse(WavePara[0].Trim());
+ AmplificationFactor = double.Parse(WavePara[1].Trim());
+
+ Dictionary> get_EcgDataList = new Dictionary>();
+ for (int y = 0; y < EcgDataTable.Rows.Count; y++)
+ {
+ byte[] ecgdata = (byte[])EcgDataTable.Rows[y]["pureData"];
+ Int16[,] ecg = new Int16[LeadCount, ecgdata.Length / (LeadCount * byteLength)];
+ Int16[,] EcgPixData = new Int16[LeadCount, ecgdata.Length / (LeadCount * byteLength)];
+ int index = 0;
+ for (int q = 0; q < LeadCount; q++)
+ {
+ for (int i = 0; i < SamplingRate*5; i++)
+ {
+ byte a = ecgdata[index];
+ index++;
+ byte b = ecgdata[index];
+ index++;
+ ecg[q, i] = (Int16)(a + (b << 8));
+ string sss = ((double.Parse(ecg[q, i].ToString()) / AmplificationFactor) * 10.0).ToString();
+ double cc = double.Parse(sss) * double.Parse(Dpi.ToString()) / double.Parse(LenthPerInch.ToString());
+ if (get_EcgDataList.ContainsKey(q))
+ get_EcgDataList[q].Add(cc);
+ //get_EcgDataList[q].Add(short.Parse(cc.ToString()));
+ else
+ {
+
+ short f = (short)cc;
+ List ecg_List = new List();
+ ecg_List.Add((double)f);
+ //ecg_List.Add(short.Parse(cc.ToString()));
+ get_EcgDataList.Add(q, ecg_List);
+ }
+ }
+ }
+ }
+ return get_EcgDataList;
+ }
+ ///
+ /// 获得心电数据
+ ///
+ ///
+ public Dictionary> GetEcgData(DataTable EcgDataTable,bool ReturnFloat)
+ {
+ string[] WavePara = File.ReadAllText(Application.StartupPath + @"\WavePara.txt").Trim().Split(',');
+ SamplingRate = int.Parse(WavePara[0].Trim());
+ AmplificationFactor = double.Parse(WavePara[1].Trim());
+
+ Dictionary> get_EcgDataList = new Dictionary>();
+ for (int y = 0; y < EcgDataTable.Rows.Count; y++)
+ {
+ byte[] ecgdata = (byte[])EcgDataTable.Rows[y]["pureData"];
+ Int16[,] ecg = new Int16[LeadCount, ecgdata.Length / (LeadCount * byteLength)];
+ Int16[,] EcgPixData = new Int16[LeadCount, ecgdata.Length / (LeadCount * byteLength)];
+ int index = 0;
+ for (int q = 0; q < LeadCount; q++)
+ {
+ for (int i = 0; i < SamplingRate*5; i++)
+ {
+ byte a = ecgdata[index];
+ index++;
+ byte b = ecgdata[index];
+ index++;
+ ecg[q, i] = (Int16)(a + (b << 8));
+ double sss = double.Parse(ecg[q, i].ToString()) / AmplificationFactor;
+ float resulte_cc = (float)sss;
+ //double cc = double.Parse(sss) * double.Parse(Dpi.ToString()) / double.Parse(LenthPerInch.ToString());
+ if (get_EcgDataList.ContainsKey(q))
+ get_EcgDataList[q].Add(resulte_cc);
+ //get_EcgDataList[q].Add(short.Parse(cc.ToString()));
+ else
+ {
+ List ecg_List = new List();
+ ecg_List.Add(resulte_cc);
+ get_EcgDataList.Add(q, ecg_List);
+ }
+ }
+ }
+ }
+ return get_EcgDataList;
+ }
+ /////
+ ///// 波形放大或缩小
+ /////
+ //public void AmplifyOrLessen(int OptionParameter)
+ //{
+
+ // // double a = Math.Abs(double.Parse(Dpi.ToString()) / LenthPerInch) * OptionParameter;
+ // // int WaveAmplify = (int)a;
+ // Ecg_Pen = new Pen(Color.Black, float.Parse("0.5"));
+ // for (int i = 0; i < LeadInfo.Count; i++)
+ // {
+ // int LeadIndex = LeadInfo[i];//取导联下标 0 1 2 3 ...11
+ // BaseLine = (Ecg_Canvas.Height / LeadInfo.Count) / 2 + (i * LeadHeight);
+ // FirstPosition.Y = BaseLine;
+ // FirstPosition.X = FreePixs;
+ // SecondPosition.Y = BaseLine;
+ // SecondPosition.X = FreePixs;
+
+ // Point FP = new Point(FirstPosition.X + FreePixs, FirstPosition.Y);
+ // FirstPointArray.Add(LeadIndex.ToString(), FP);
+ // for (int b = 0; b < EcgDataList[LeadIndex].Count; b++)
+ // {
+ // if (FirstPosition.X > Ecg_Canvas.Width)
+ // break;
+ // if (EcgDataList[LeadIndex][b] > 0)
+ // SecondPosition.Y = Math.Abs(BaseLine - EcgDataList[LeadIndex][b]) + OptionParameter;
+ // if (EcgDataList[LeadIndex][b] < 0)
+ // SecondPosition.Y = BaseLine + Math.Abs(EcgDataList[LeadIndex][b]) + OptionParameter;
+ // double x = double.Parse(b.ToString()) * (double.Parse(Dpi.ToString()) / double.Parse(SamplingRate.ToString())) * (PaperSpeed * OptionParameter)/Amplitude;//获得点的X轴位置
+ // int nextX = (int.Parse(Math.Round(x).ToString()));
+ // if (Math.Abs(FirstPosition.X - SecondPosition.X) < 5)
+ // {
+ // SecondPosition.X = nextX + FreePixs;
+ // Ecg_Graphics.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ // FirstPosition = SecondPosition;
+ // }
+ // else
+ // FirstPosition = SecondPosition;
+ // }
+ // }
+ //}
+
+//**************************动态播放十二导联波形************************************************************************************
+ ///
+ /// 绘制屏幕墙窗体背景
+ ///
+ ///
+ public void DrawBackGround(Graphics Graphics)
+ {
+ Graphics.FillRectangle(Brushes.White, Graphics.ClipBounds);
+ }
+ public void DrawStandardGrid(PictureBox EV, Graphics Graphics)
+ {
+ int GridSize = int.Parse((Math.Round(double.Parse("96") * double.Parse("5") / double.Parse("25.4"))).ToString());
+ Pen GridColor = new Pen(Color.LightCoral, float.Parse("0.1"));
+ //绘制网格大格竖线
+ for (int i = 0; i < EV.Width; i += GridSize)
+ {
+ Graphics.DrawLine(GridColor, i, 0, i, EV.Height);
+ }
+ //绘制网格大格横线
+ for (int i = 0; i < EV.Height; i += GridSize)
+ {
+ Graphics.DrawLine(GridColor, 0, i, EV.Width, i);
+ }
+ }
+
+
+ DateTime CurrentDateTime;
+ string V_WardshipId = string.Empty;
+ int Ecg_Index = 0;//数据队列中的游标
+ double PixCountPerPoint;//求出 心电 相邻两点之间的 像素点个数
+ ///
+ /// 绘制心电波形
+ ///
+ //public void Play_EcgWave(PictureEdit pictureEdit3, Graphics Graphics_1, string WardshipId, DateTime CurrDatetime)
+ //{
+ // PixCountPerPoint = double.Parse("0.3");
+ // V_WardshipId = WardshipId;
+ // if (CurrDatetime != null)
+ // CurrentDateTime = CurrDatetime;
+ // Ecg_Pen = new Pen(Color.Black, float.Parse("0.5"));//心电波形颜色
+ // FirstPointArray.Clear();
+ // LeadHeight = pictureEdit3.Height / LeadInfo.Count;
+ // FreePixs = int.Parse(Math.Round((double.Parse(Dpi.ToString()) / LenthPerInch) * 5).ToString());
+ // for (int i = 0; i < LeadInfo.Count; i++)
+ // {
+ // int LeadIndex = LeadInfo[i];//取导联下标 0 1 2 3 ...11
+ // BaseLine = (pictureEdit3.Height / LeadInfo.Count) / 2 + (i * LeadHeight);
+ // FirstPosition.Y = BaseLine;
+ // FirstPosition.X = FreePixs;
+ // SecondPosition.Y = BaseLine;
+ // SecondPosition.X = FreePixs;
+
+ // Point FP = new Point(FirstPosition.X + FreePixs, FirstPosition.Y);
+ // FirstPointArray.Add(LeadIndex.ToString(), FP);
+ // int ScreenPointCount = (int)(double.Parse(pictureEdit3.Width.ToString()) / PixCountPerPoint);
+ // for (int b = Ecg_Index; b < Ecg_Index + ScreenPointCount; b++)
+ // {
+ // if (EcgDataList == null)
+ // LoadEcgData_BaseDatabase(WardshipId);//加载心电数据队列
+ // else
+ // if (EcgDataList[LeadIndex].Count <= 0 || b + 500 >= EcgDataList[LeadIndex].Count)
+ // LoadEcgData_BaseDatabase(WardshipId);//加载心电数据队列
+
+
+ // if (b + 1 >= EcgDataList[LeadIndex].Count)
+ // {
+ // Graphics_1.DrawLine(new Pen(Brushes.Black), 0, pictureEdit3.Height / 2, pictureEdit3.Width, pictureEdit3.Height / 2);
+ // }
+ // else
+ // {
+ // if (FirstPosition.X > pictureEdit3.Width)
+ // break;
+ // if (EcgDataList[LeadIndex][b] > 0)
+ // SecondPosition.Y = Math.Abs(BaseLine - EcgDataList[LeadIndex][b]);
+ // if (EcgDataList[LeadIndex][b] < 0)
+ // SecondPosition.Y = BaseLine + Math.Abs(EcgDataList[LeadIndex][b]);
+ // double x = double.Parse(b.ToString()) * (double.Parse(Dpi.ToString()) / double.Parse(SamplingRate.ToString()));//获得点的X轴位置
+ // int nextX = (int.Parse(Math.Round(x).ToString()));
+ // if (Math.Abs(FirstPosition.X - SecondPosition.X) < 5)
+ // {
+ // SecondPosition.X = nextX + FreePixs;
+ // //Ecg_Graphics.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ // Graphics_1.DrawLine(Ecg_Pen, FirstPosition, SecondPosition);
+ // FirstPosition = SecondPosition;
+ // }
+ // else
+ // FirstPosition = SecondPosition;
+ // }
+ // }
+ // }
+ // Ecg_Index += 14;
+ //}
+
+
+
+
+
+
+ }
+}
diff --git a/1200Gxml心电图绘制/Form3.Designer.cs b/1200Gxml心电图绘制/Form3.Designer.cs
new file mode 100644
index 0000000..cdd8173
--- /dev/null
+++ b/1200Gxml心电图绘制/Form3.Designer.cs
@@ -0,0 +1,289 @@
+namespace _1200Gxml心电图绘制
+{
+ partial class Form3
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.生成高精度打印报告ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.cBoxSpeed = new System.Windows.Forms.ComboBox();
+ this.cBoxAmplitude = new System.Windows.Forms.ComboBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.combo_reportModel = new System.Windows.Forms.ComboBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.tabControl1 = new System.Windows.Forms.TabControl();
+ this.tabPage1 = new System.Windows.Forms.TabPage();
+ this.txt_msg = new System.Windows.Forms.TextBox();
+ this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.contextMenuStrip1.SuspendLayout();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.tabControl1.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.tabPage2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.生成高精度打印报告ToolStripMenuItem});
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(280, 38);
+ //
+ // 生成高精度打印报告ToolStripMenuItem
+ //
+ this.生成高精度打印报告ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.生成高精度打印报告ToolStripMenuItem.Name = "生成高精度打印报告ToolStripMenuItem";
+ this.生成高精度打印报告ToolStripMenuItem.Size = new System.Drawing.Size(279, 34);
+ this.生成高精度打印报告ToolStripMenuItem.Text = "生成高精度打印报告";
+ this.生成高精度打印报告ToolStripMenuItem.Click += new System.EventHandler(this.生成高精度打印报告ToolStripMenuItem_Click);
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.cBoxSpeed);
+ this.groupBox1.Controls.Add(this.cBoxAmplitude);
+ this.groupBox1.Controls.Add(this.label3);
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.combo_reportModel);
+ this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.groupBox1.Location = new System.Drawing.Point(0, 0);
+ this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
+ this.groupBox1.Size = new System.Drawing.Size(1185, 67);
+ this.groupBox1.TabIndex = 5;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "操作";
+ //
+ // cBoxSpeed
+ //
+ this.cBoxSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cBoxSpeed.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.cBoxSpeed.FormattingEnabled = true;
+ this.cBoxSpeed.Items.AddRange(new object[] {
+ "5mm/s",
+ "10mm/s",
+ "12.5mm/s",
+ "25mm/s",
+ "50mm/s"});
+ this.cBoxSpeed.Location = new System.Drawing.Point(422, 28);
+ this.cBoxSpeed.Name = "cBoxSpeed";
+ this.cBoxSpeed.Size = new System.Drawing.Size(113, 29);
+ this.cBoxSpeed.TabIndex = 4;
+ this.cBoxSpeed.SelectedIndexChanged += new System.EventHandler(this.cBoxSpeed_SelectedIndexChanged);
+ //
+ // cBoxAmplitude
+ //
+ this.cBoxAmplitude.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cBoxAmplitude.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.cBoxAmplitude.FormattingEnabled = true;
+ this.cBoxAmplitude.Items.AddRange(new object[] {
+ "2.5mm/mv",
+ "5mm/mv",
+ "10mm/mv",
+ "20mm/mv",
+ "40mm/mv"});
+ this.cBoxAmplitude.Location = new System.Drawing.Point(648, 28);
+ this.cBoxAmplitude.Name = "cBoxAmplitude";
+ this.cBoxAmplitude.Size = new System.Drawing.Size(105, 29);
+ this.cBoxAmplitude.TabIndex = 5;
+ this.cBoxAmplitude.SelectedIndexChanged += new System.EventHandler(this.cBoxAmplitude_SelectedIndexChanged);
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.label3.Location = new System.Drawing.Point(586, 33);
+ this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(58, 21);
+ this.label3.TabIndex = 3;
+ this.label3.Text = "增益:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.label2.Location = new System.Drawing.Point(360, 33);
+ this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(58, 21);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "走速:";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.label1.Location = new System.Drawing.Point(32, 33);
+ this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(90, 21);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "报告版式:";
+ //
+ // combo_reportModel
+ //
+ this.combo_reportModel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.combo_reportModel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.combo_reportModel.FormattingEnabled = true;
+ this.combo_reportModel.Items.AddRange(new object[] {
+ "6x2报告模式",
+ "6x2任意长两导联",
+ "12x1报告模式",
+ "4x3任意单长模式",
+ "4x3任意长三导联"});
+ this.combo_reportModel.Location = new System.Drawing.Point(126, 28);
+ this.combo_reportModel.Name = "combo_reportModel";
+ this.combo_reportModel.Size = new System.Drawing.Size(223, 29);
+ this.combo_reportModel.TabIndex = 2;
+ this.combo_reportModel.SelectedIndexChanged += new System.EventHandler(this.combo_reportModel_SelectedIndexChanged);
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.tabControl1);
+ this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupBox2.Location = new System.Drawing.Point(0, 67);
+ this.groupBox2.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 3, 2, 3);
+ this.groupBox2.Size = new System.Drawing.Size(1185, 574);
+ this.groupBox2.TabIndex = 6;
+ this.groupBox2.TabStop = false;
+ //
+ // tabControl1
+ //
+ this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tabControl1.Controls.Add(this.tabPage1);
+ this.tabControl1.Controls.Add(this.tabPage2);
+ this.tabControl1.Location = new System.Drawing.Point(5, 20);
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new System.Drawing.Size(1175, 554);
+ this.tabControl1.TabIndex = 1;
+ //
+ // tabPage1
+ //
+ this.tabPage1.Controls.Add(this.txt_msg);
+ this.tabPage1.Location = new System.Drawing.Point(4, 22);
+ this.tabPage1.Name = "tabPage1";
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage1.Size = new System.Drawing.Size(1167, 528);
+ this.tabPage1.TabIndex = 0;
+ this.tabPage1.Text = "服务日志";
+ this.tabPage1.UseVisualStyleBackColor = true;
+ //
+ // txt_msg
+ //
+ this.txt_msg.BackColor = System.Drawing.Color.Black;
+ this.txt_msg.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txt_msg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.txt_msg.ForeColor = System.Drawing.Color.GreenYellow;
+ this.txt_msg.Location = new System.Drawing.Point(3, 3);
+ this.txt_msg.Margin = new System.Windows.Forms.Padding(2);
+ this.txt_msg.Multiline = true;
+ this.txt_msg.Name = "txt_msg";
+ this.txt_msg.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.txt_msg.Size = new System.Drawing.Size(1161, 522);
+ this.txt_msg.TabIndex = 1;
+ //
+ // tabPage2
+ //
+ this.tabPage2.Controls.Add(this.pictureBox1);
+ this.tabPage2.Location = new System.Drawing.Point(4, 22);
+ this.tabPage2.Name = "tabPage2";
+ this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage2.Size = new System.Drawing.Size(1167, 528);
+ this.tabPage2.TabIndex = 1;
+ this.tabPage2.Text = "tabPage2";
+ this.tabPage2.UseVisualStyleBackColor = true;
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.ContextMenuStrip = this.contextMenuStrip1;
+ this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBox1.Location = new System.Drawing.Point(3, 3);
+ this.pictureBox1.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(1161, 522);
+ this.pictureBox1.TabIndex = 0;
+ this.pictureBox1.TabStop = false;
+ //
+ // Form3
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1185, 641);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
+ this.Name = "Form3";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "心电图绘制";
+ this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form3_FormClosed);
+ this.Load += new System.EventHandler(this.Form3_Load);
+ this.contextMenuStrip1.ResumeLayout(false);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.tabControl1.ResumeLayout(false);
+ this.tabPage1.ResumeLayout(false);
+ this.tabPage1.PerformLayout();
+ this.tabPage2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem 生成高精度打印报告ToolStripMenuItem;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.ComboBox combo_reportModel;
+ private System.Windows.Forms.ComboBox cBoxSpeed;
+ private System.Windows.Forms.ComboBox cBoxAmplitude;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TabControl tabControl1;
+ private System.Windows.Forms.TabPage tabPage1;
+ private System.Windows.Forms.TabPage tabPage2;
+ private System.Windows.Forms.TextBox txt_msg;
+ }
+}
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/Form3.cs b/1200Gxml心电图绘制/Form3.cs
new file mode 100644
index 0000000..f84e5cb
--- /dev/null
+++ b/1200Gxml心电图绘制/Form3.cs
@@ -0,0 +1,510 @@
+using HTTPServerLib;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration;
+using System.Data;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Reflection;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Text;
+using System.Windows.Forms;
+using 心电图绘制;
+
+namespace _1200Gxml心电图绘制
+{
+ public partial class Form3 : Form
+ {
+ ExampleServer server;
+ public Form3()
+ {
+ InitializeComponent();
+ }
+
+ void DataRead()
+ {
+
+ }
+ private void Form3_Load(object sender, EventArgs e)
+ {
+
+ string strip = ConfigurationManager.AppSettings["ip"];
+ string stport = ConfigurationManager.AppSettings["port"];
+
+ server = new ExampleServer(strip, int.Parse(stport), txt_msg);
+
+ EcgDataDraw_New EDDN = new EcgDataDraw_New();
+ var btmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
+ pictureBox1.Image = btmp;
+ Graphics Ecg_Graphics = Graphics.FromImage(pictureBox1.Image);
+ combo_reportModel.SelectedIndex = 0;
+ cBoxSpeed.SelectedIndex = 3;
+ cBoxAmplitude.SelectedIndex = 2;
+ Start();
+ //加载心电数据
+ // #region
+ //Dictionary> EcgTable = new Dictionary>();
+ //for (int k = 0; k < 8; k++)
+ // EcgTable.Add(k, new List());
+
+ //string contentStr = File.ReadAllText(Application.StartupPath + @"\蓝牙holter数据\dc93ee94-c0e8-4dba-8d29-ed86b2dcb6e8.ecg");
+ //var contenList = JsonConvert.DeserializeObject>(contentStr);
+
+ ////这里是把8个通道的数据转换出来 放到一个 字典里
+
+ //for (int i = 0; i < contenList.Count; i++)
+ //{
+ // for (int j = 0; j < contenList[i].Length; j += 16)
+ // {
+ // EcgTable[0].Add((float)((short)(byteToShort(contenList[i][j], contenList[i][j + 1]))));
+ // EcgTable[1].Add((float)((short)(byteToShort(contenList[i][j + 2], contenList[i][j + 3]))));
+ // EcgTable[2].Add((float)((short)(byteToShort(contenList[i][j + 4], contenList[i][j + 5]))));
+ // EcgTable[3].Add((float)((short)(byteToShort(contenList[i][j + 6], contenList[i][j + 7]))));
+ // EcgTable[4].Add((float)((short)(byteToShort(contenList[i][j + 8], contenList[i][j + 9]))));
+ // EcgTable[5].Add((float)((short)(byteToShort(contenList[i][j + 10], contenList[i][j + 11]))));
+ // EcgTable[6].Add((float)((short)(byteToShort(contenList[i][j + 12], contenList[i][j + 13]))));
+ // EcgTable[7].Add((float)((short)(byteToShort(contenList[i][j + 14], contenList[i][j + 15]))));
+ // }
+
+ //}
+
+ ////在这里你就可以对这8个通道的数据进行滤波了 在这里写滤波代码
+
+
+ //Dictionary> EcgTable2 = new Dictionary>();
+ ////把 I II导联加入字典中
+ //for (int i = 0; i < 2; i++)
+ // EcgTable2.Add(i, EcgTable[i]);
+
+ //List list3 = new List();
+ //List list4 = new List();
+ //List list5 = new List();
+ //List list6 = new List();
+ ////把 III AVR AVL AVF 这四个导联计算出来 加入字典
+ //for (int A = 0; A < EcgTable[0].Count; A++)
+ //{
+ // list3.Add(EcgTable[1][A] - EcgTable[0][A]);//III
+ // list4.Add(-(EcgTable[1][A] + EcgTable[0][A]) / 2);//avR
+ // list5.Add(EcgTable[0][A] - EcgTable[1][A] / 2);//avL
+ // list6.Add(EcgTable[1][A] - EcgTable[0][A] / 2);//avF
+ //}
+ //EcgTable2.Add(2, list3);
+ //EcgTable2.Add(3, list4);
+ //EcgTable2.Add(4, list5);
+ //EcgTable2.Add(5, list6);
+ ////把 V1-V6导联 加入字典
+ //for (int i = 6; i < 12; i++)
+ // EcgTable2.Add(i, EcgTable[i - 4]);
+
+ //Dictionary> EcgTable3 = new Dictionary>();
+ //for (int i = 0; i < EcgTable2.Count; i++)
+ // EcgTable3.Add(i, baseLineFilter(i, EcgTable2[i]));
+
+ //this.samplingRate = 300;
+ //this.windowSize = 60000;
+
+ //List rPosList = DetectRWave(EcgTable3[1].ToArray());
+
+
+ ////for (int i = 0; i < 12; i++)
+ //// EcgTable2[i].RemoveRange(0, 500);
+
+
+ ////string[] ecgDataArray = dataStr.Split(' ');//把xml中每一导联的数据 变成数组 然后把数据赋值给 EcgTable 字典中的每一导联
+ ////List ecg_List = new List();
+ ////for (int i = 0; i < ecgDataArray.Length; i++)
+ //// ecg_List.Add(float.Parse(ecgDataArray[i]));
+ ////for (int i = 0; i < 12; i++)
+ //// EcgTable.Add(i, ecg_List);
+ //#endregion
+
+
+
+ //List leadInfo = new List();
+ //for (int i = 0; i < 12; i++)
+ // leadInfo.Add(i);
+ //EDDN.InitEcgParameter(btmp, 12, EcgTable3, 96, leadInfo);//初始化
+ //EDDN.Draw_EcgBackGroundGrid();//画背景网格
+ //EDDN.Draw_EcgWave();//画波形
+ //EDDN.Draw_CalibrationVoltage_And_LeadName();//画定标电压和导联名称
+
+ // EDDN.drawRWavePos(rPosList);//绘制R波位置
+
+ }
+
+ private void groupBox2_Enter(object sender, EventArgs e)
+ {
+
+ }
+
+ private void pictureBox1_Click(object sender, EventArgs e)
+ {
+
+ }
+
+
+ short byteToShort(byte a, byte b)
+ {
+ short volV = (short)((a << 8) + b);//正确
+ return (short)(volV / 45);
+ }
+
+ private void pictureBox1_DoubleClick(object sender, EventArgs e)
+ {
+
+ }
+
+ List baseLineFilter(int leadIndex, List inputDatas)
+ {
+ List outPutDatas = new List();
+ float sum = 0;
+ for (int i = 0; i < inputDatas.Count; i++)
+ sum += inputDatas[i];
+ float avgVal = sum / inputDatas.Count;
+ for (int i = 0; i < inputDatas.Count; i++)
+ outPutDatas.Add(inputDatas[i] - avgVal);
+ if (leadIndex == 1)
+ {
+ float sum2 = 0;
+ int indexCount = 0;
+ for (int i = 0; i < outPutDatas.Count; i++)
+ {
+ if (outPutDatas[i] > 0)
+ {
+ sum2 += outPutDatas[i];
+ indexCount++;
+ }
+ }
+ float avgVal1 = sum2 / indexCount;
+ threshold = avgVal1 + 130;
+
+ }
+ return outPutDatas;
+ }
+
+
+ private int samplingRate;
+ private int windowSize;
+ private double threshold;
+
+
+
+
+ public List DetectRWave(float[] ecg_data)
+ {
+ List rWaveIndices = new List(); int maxIndex = 0;
+ // R波识别
+ int r_wave_count = 0;
+ for (int i = 1; i < ecg_data.Length; i++)
+ {
+ if (ecg_data[i] > ecg_data[i - 1] && ecg_data[i] > ecg_data[i + 1] && ecg_data[i] > threshold)
+ {
+ if (!rWaveIndices.Contains(i))
+ rWaveIndices.Add(i);
+ }
+ }
+ return rWaveIndices;
+ }
+
+ private void 生成高精度打印报告ToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ GetEcgViewDataImage(null, "这是地址"); //普通打印
+ }
+
+ float[] valueConvert(float[] valueArray)
+ {
+ float[] quotients = valueArray.Select(n => n / 500).ToArray();
+ return quotients;
+ }
+
+ private string _printFilter = "0Hz";
+ private Bitmap _ecgBitMap;
+ private static int _printDpi = 300;//打印DPI
+ private const int Dpi = 96; //屏幕DIP
+ private readonly string _isQiBo;//是否是起搏信号
+ private int _leadindexdata;
+ private const string LeaderName15 = "5x3+1导报告模式";
+ private const string LeaderName18 = "18导报告模式";
+ private string _reportTitleContent = string.Empty;
+ private string _idStr;
+ private string collectTime;//心电数据采集时间
+ private const double Coefficient = 1.02; //放大缩小的系数
+ private List _longLeadInfo = new List(); //存储任意长两导联的导联下标
+ private readonly List _longLeadInfo3 = new List(); //存储任意长三导联的导联下标
+ public string LeaderType; //导联类别
+ private Dictionary> _ecgDataDicAfterFilter = new Dictionary>(); //滤波后的数据都存在这个字典中
+ private int _filterIndex; //滤波时 此标志 指示从数组中 哪一个位置开始滤波
+ ///
+ /// 获得心电诊断快照数据
+ ///
+ public void GetEcgViewDataImage(Image img, string addr)
+ {
+ _ecgDataDicAfterFilter.Clear();
+ string ecgDataJsonStr = File.ReadAllText(Application.StartupPath + @"\60心拍心电图数据JSON.txt");
+ leadDataModel LDM = JsonConvert.DeserializeObject(ecgDataJsonStr);
+ float[] LEAD_I = valueConvert(Array.ConvertAll(LDM.LEAD_I.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(0, LEAD_I.ToList());
+ float[] LEAD_II = valueConvert(Array.ConvertAll(LDM.LEAD_II.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(1, LEAD_II.ToList());
+ float[] LEAD_III = valueConvert(Array.ConvertAll(LDM.LEAD_III.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(2, LEAD_III.ToList());
+ float[] LEAD_AVR = valueConvert(Array.ConvertAll(LDM.LEAD_AVR.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(3, LEAD_AVR.ToList());
+ float[] LEAD_AVL = valueConvert(Array.ConvertAll(LDM.LEAD_AVL.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(4, LEAD_AVL.ToList());
+ float[] LEAD_AVF = valueConvert(Array.ConvertAll(LDM.LEAD_AVF.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(5, LEAD_AVF.ToList());
+ float[] LEAD_V1 = valueConvert(Array.ConvertAll(LDM.LEAD_V1.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(6, LEAD_V1.ToList());
+ float[] LEAD_V2 = valueConvert(Array.ConvertAll(LDM.LEAD_V2.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(7, LEAD_V2.ToList());
+ float[] LEAD_V3 = valueConvert(Array.ConvertAll(LDM.LEAD_V3.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(8, LEAD_V3.ToList());
+ float[] LEAD_V4 = valueConvert(Array.ConvertAll(LDM.LEAD_V4.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(9, LEAD_V4.ToList());
+ float[] LEAD_V5 = valueConvert(Array.ConvertAll(LDM.LEAD_V5.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(10, LEAD_V5.ToList());
+ float[] LEAD_V6 = valueConvert(Array.ConvertAll(LDM.LEAD_V6.Split(' '), float.Parse));
+ _ecgDataDicAfterFilter.Add(11, LEAD_V6.ToList());
+
+
+ _reportTitleContent = "十二导联静态心电图报告";
+ _idStr = "5566778899";
+ collectTime = "2024-12-20 13:28:51";
+ //长两导的模式下 默认添加 第一导 和 第二导联 为 长显示两导联
+ _longLeadInfo.Add(0);
+ _longLeadInfo.Add(1);
+ //长三导的模式下 默认添加 第一导 和 第二导联和第三导联 为 长显示三导联
+ _longLeadInfo3.Add(0);
+ _longLeadInfo3.Add(1);
+ _longLeadInfo3.Add(2);
+ var cpew = new CommonPrintEcgWave();
+ var filter = _printFilter;
+ _ecgBitMap = new Bitmap(1090 * _printDpi / Dpi, 760 * _printDpi / Dpi);
+ _ecgBitMap.SetResolution(_printDpi, _printDpi);
+ cpew.InitEcgParameter(_ecgBitMap, _ecgDataDicAfterFilter, _isQiBo, _paperSpeed, _amplitude);
+
+ //************************************************************************
+ var ecgInfoList = new string[13];
+ ecgInfoList[0] = "张三";
+ ecgInfoList[1] = "女";
+ ecgInfoList[2] = "28";
+ ecgInfoList[3] = "RV5+SV1";
+ ecgInfoList[4] = "PR间期";
+ ecgInfoList[5] = "QRS间期";
+ ecgInfoList[6] = "QT/QTC";
+ ecgInfoList[7] = "QRS电轴";
+ ecgInfoList[8] = "RV5/SV1";
+ ecgInfoList[9] = "心率";
+ ecgInfoList[10] = "病室";
+ ecgInfoList[11] = "床号";
+ ecgInfoList[12] = "住院号";
+ SetAandP(); //设置增益和走速
+
+ var diagContent = "这里是心电图的诊断结论";
+ var diagArray = diagContent.Split('\n');
+ diagContent = string.Empty;
+ for (var i = 0; i < diagArray.Length; i++) diagContent += diagArray[i].Trim();
+
+ if (_ecgDataDicAfterFilter.Count > 0)
+ _filterIndex = 0;
+ else
+ _filterIndex = 0;
+ // _leadindexdata = hScrollBar_Lead.Value * _filterIndex;
+ _leadindexdata = _filterIndex;
+
+ if (combo_reportModel.Text == LeaderName15) filter += " 十五加一长导模式";
+ if (combo_reportModel.Text == LeaderName18) filter += " 十八导模式";
+ if (combo_reportModel.SelectedIndex == 2)
+ {
+ cpew.PrintBackGroundGrid(16, 196);
+ cpew.PrintLongReportHeadInfo(_reportTitleContent);
+ cpew.PrintLongEcgInfo(ecgInfoList, _idStr);
+ cpew.PrintLongDiagInfo(diagContent, "医生姓名",
+ "2024-12-20", filter,
+ collectTime, "心电图科", _amp, _ps, img, addr);
+ }
+ else
+ {
+ cpew.PrintBackGroundGrid(40, 196); //(197-42)*12=1860像素
+ cpew.PrintReportHeadInfo(_reportTitleContent, "2024-12-20");
+ cpew.PrintEcgInfo(ecgInfoList, _idStr);
+ cpew.PrintDiagInfo(diagContent, "医生姓名", filter,
+ collectTime, "心电图科", _amp, _ps, img, addr);
+ }
+
+ //6x2
+ if (combo_reportModel.SelectedIndex == 0)
+ {
+ cpew.PrintEcgWave(8, 1, _leadindexdata);
+ cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient);
+ }
+
+ //6x2+2
+ if (combo_reportModel.SelectedIndex == 1)
+ {
+ cpew.PrintEcgWave(8, 1, _longLeadInfo, _leadindexdata, _leadindexdata);
+ cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient, _longLeadInfo);
+ }
+
+ //十二长导
+ if (combo_reportModel.SelectedIndex == 2)
+ {
+ cpew.PrintLongEcgWave(5, 1, _leadindexdata);
+ //cpew.PrintLongEcgWave(8, 1, _leadindexdata);
+ cpew.PrintLongEcgLeadName(_calibrationVoltage * Coefficient);
+ }
+
+ //4*3 II长导模式
+ if (combo_reportModel.SelectedIndex == 3)
+ {
+ cpew.PrintEcgWaveFourOne(8, 1, _leadindexdata, _leadindexdata);
+ cpew.PrintLeadNameFourOne(_calibrationVoltage * Coefficient, _longLeadInfo);
+ }
+
+
+ //4*3+3 长导模式
+ if (combo_reportModel.SelectedIndex == 4)
+ {
+ cpew.PrintEcgWaveFourThree(8, 1, _longLeadInfo3, _leadindexdata, _leadindexdata);
+ cpew.PrintLeadNameFourThree(_calibrationVoltage * Coefficient, _longLeadInfo3);
+ }
+
+
+ //15x1+1导
+ if (combo_reportModel.Text.Trim() == LeaderName15)
+ {
+ cpew.PrintEcgWaveFifteen(8, 1, _leadindexdata);
+ cpew.PrintLeadNameFifteen(_calibrationVoltage * Coefficient, LeaderType);
+ }
+
+ //十八导
+ if (combo_reportModel.Text.Trim() == LeaderName18)
+ {
+ cpew.PrintEcgWaveEighteen(8, 1, _leadindexdata);
+ cpew.PrintLeadNameEighteen(_calibrationVoltage * Coefficient);
+ }
+
+ //_sourceCegBmp = _ecgBitMap;
+ _ecgBitMap.Save("1.jpg", ImageFormat.Jpeg);
+ }
+
+
+
+ private double _paperSpeed = 25.0; //走速
+ private string _ps = "25mm/s"; //打印时的走速
+ private double _amplitude = 10.0; //振幅
+ private string _amp = "10mm/mV"; //打印时的振幅
+ private double _calibrationVoltage = 2.0;//定标电压
+ ///
+ /// 设置增益和走速和定标电压
+ ///
+ private void SetAandP()
+ {
+ if (cBoxSpeed.SelectedIndex == 0) //走速
+ {
+ _paperSpeed = 5;
+ _ps = "5mm/s";
+ }
+
+ if (cBoxSpeed.SelectedIndex == 1)
+ {
+ _paperSpeed = 10;
+ _ps = "10mm/s";
+ }
+
+ if (cBoxSpeed.SelectedIndex == 2) //走速
+ {
+ _paperSpeed = 12.5;
+ _ps = "12.5mm/s";
+ }
+
+ if (cBoxSpeed.SelectedIndex == 3)
+ {
+ _paperSpeed = 25.0;
+ _ps = "25mm/s";
+ }
+
+ if (cBoxSpeed.SelectedIndex == 4)
+ {
+ _paperSpeed = 50.0;
+ _ps = "50mm/s";
+ }
+
+ if (cBoxAmplitude.SelectedIndex == 0) //振幅
+ {
+ _amplitude = 2.5;
+ _amp = "2.5mm/mV";
+ _calibrationVoltage = 0.5;
+ }
+
+ if (cBoxAmplitude.SelectedIndex == 1)
+ {
+ _amplitude = 5.0;
+ _amp = "5mm/mV";
+ _calibrationVoltage = 1.0;
+ }
+
+ if (cBoxAmplitude.SelectedIndex == 2)
+ {
+ _amplitude = 10.0;
+ _amp = "10mm/mV";
+ _calibrationVoltage = 2.0;
+ }
+
+ if (cBoxAmplitude.SelectedIndex == 3)
+ {
+ _amplitude = 20.0;
+ _amp = "20mm/mV";
+ _calibrationVoltage = 4.0;
+ }
+
+ if (cBoxAmplitude.SelectedIndex == 4)
+ {
+ _amplitude = 40.0;
+ _amp = "40mm/mV";
+ _calibrationVoltage = 8.0;
+ }
+ }
+
+ ///
+ /// 开启服务
+ ///
+ private void Start()
+ {
+ server.SetRoot(AppDomain.CurrentDomain.BaseDirectory);
+ server.Logger = new ConsoleLogger(txt_msg);
+ server.Start();
+ }
+ #region 类型改变事件
+
+
+ private void combo_reportModel_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ server.reportMode = combo_reportModel.SelectedIndex;
+
+ server.strreportMode = combo_reportModel.Text.Trim();
+ }
+
+ private void cBoxSpeed_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ server.cBoxSpeed = cBoxSpeed.SelectedIndex;
+ }
+
+ private void cBoxAmplitude_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ server.cBoxAmplitude = cBoxAmplitude.SelectedIndex;
+ }
+ #endregion
+
+ private void Form3_FormClosed(object sender, FormClosedEventArgs e)
+ {
+ server.Stop();
+ }
+ }
+}
diff --git a/1200Gxml心电图绘制/Form3.resx b/1200Gxml心电图绘制/Form3.resx
new file mode 100644
index 0000000..fb0a7a9
--- /dev/null
+++ b/1200Gxml心电图绘制/Form3.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 62
+
+
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/FtpHelper.cs b/1200Gxml心电图绘制/FtpHelper.cs
new file mode 100644
index 0000000..2a75ef6
--- /dev/null
+++ b/1200Gxml心电图绘制/FtpHelper.cs
@@ -0,0 +1,266 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace _1200Gxml心电图绘制
+{
+ public class FtpHelper
+ {
+ //基本设置
+ //private static string ftppath = @"ftp://" + "10.13.1.36" + "/";
+ private static string ftppath = ConfigurationManager.AppSettings["ftppath"];
+ private static string username = ConfigurationManager.AppSettings["username"];
+ private static string password = ConfigurationManager.AppSettings["password"];
+
+ //获取FTP上面的文件夹和文件
+ public static string[] GetFolderAndFileList(string s)
+ {
+ string[] getfolderandfilelist;
+ FtpWebRequest request;
+ StringBuilder sb = new StringBuilder();
+ try
+ {
+ request = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftppath));
+ request.UseBinary = true;
+ request.Credentials = new NetworkCredential(username, password);
+ request.Method = WebRequestMethods.Ftp.ListDirectory;
+ request.UseBinary = true;
+ WebResponse response = request.GetResponse();
+ StreamReader reader = new StreamReader(response.GetResponseStream());
+ string line = reader.ReadLine();
+ while (line != null)
+ {
+ sb.Append(line);
+ sb.Append("\n");
+ Console.WriteLine(line);
+ line = reader.ReadLine();
+ }
+ sb.Remove(sb.ToString().LastIndexOf('\n'), 1);
+ reader.Close();
+ response.Close();
+ return sb.ToString().Split('\n');
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("获取FTP上面的文件夹和文件:" + ex.Message);
+ getfolderandfilelist = null;
+ return getfolderandfilelist;
+ }
+ }
+
+ //获取FTP上面的文件大小
+ public static int GetFileSize(string fileName)
+ {
+ FtpWebRequest request;
+ try
+ {
+ request = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftppath + fileName));
+ request.UseBinary = true;
+ request.Credentials = new NetworkCredential(username, password);
+ request.Method = WebRequestMethods.Ftp.GetFileSize;
+ int n = (int)request.GetResponse().ContentLength;
+ return n;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("获取FTP上面的文件大小:" + ex.Message);
+ return -1;
+ }
+ }
+
+ //FTP上传文件
+ public static string FileUpLoad(string filePath, string objPath = "")
+ {
+ try
+ {
+ string url = ftppath;
+ if (objPath != "")
+ url += objPath + "/";
+ try
+ {
+ FtpWebRequest request = null;
+ try
+ {
+ FileInfo fi = new FileInfo(filePath);
+ using (FileStream fs = fi.OpenRead())
+ {
+ request = (FtpWebRequest)FtpWebRequest.Create(new Uri(url + fi.Name));
+ request.Credentials = new NetworkCredential(username, password);
+ request.KeepAlive = false;
+ request.Method = WebRequestMethods.Ftp.UploadFile;
+ request.UseBinary = true;
+ using (Stream stream = request.GetRequestStream())
+ {
+ int bufferLength = 5120;
+ byte[] buffer = new byte[bufferLength];
+ int i;
+ while ((i = fs.Read(buffer, 0, bufferLength)) > 0)
+ {
+ stream.Write(buffer, 0, i);
+ }
+ return "上传成功";
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ return ex.ToString();
+ }
+ finally
+ {
+
+ }
+ }
+ catch (Exception ex)
+ {
+ return ex.ToString();
+ }
+ finally
+ {
+
+ }
+ }
+ catch (Exception ex)
+ {
+ return ex.ToString();
+ }
+ }
+
+
+ //FTP上传文件
+ public static string FileUpLoad(string filePath, string objPath ,string ftpFileName)
+ {
+ try
+ {
+ string url = ftppath;
+ if (objPath != "")
+ url += objPath + "/";
+ FtpWebRequest request = null;
+
+ FileInfo fi = new FileInfo(filePath);
+ using (FileStream fs = fi.OpenRead())
+ {
+ request = (FtpWebRequest)FtpWebRequest.Create(new Uri(url + ftpFileName));
+ request.Credentials = new NetworkCredential(username, password);
+ request.KeepAlive = false;
+ request.Method = WebRequestMethods.Ftp.UploadFile;
+ request.UseBinary = true;
+ request.UsePassive = false;//被动传输模式 设置
+ using (Stream stream = request.GetRequestStream())
+ {
+ int bufferLength = 5120;
+ byte[] buffer = new byte[bufferLength];
+ int i;
+ while ((i = fs.Read(buffer, 0, bufferLength)) > 0)
+ {
+ stream.Write(buffer, 0, i);
+ }
+ return "上传成功";
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ return ex.ToString();
+ }
+ }
+
+
+ //FTP下载文件
+ public static void FileDownLoad(string fileName)
+ {
+ FtpWebRequest request;
+ try
+ {
+ string downloadPath = @"D:";
+ FileStream fs = new FileStream(downloadPath + "\\" + fileName, FileMode.Create);
+ request = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftppath + fileName));
+ request.Method = WebRequestMethods.Ftp.DownloadFile;
+ request.UseBinary = true;
+ request.Credentials = new NetworkCredential(username, password);
+ request.UsePassive = false;
+ FtpWebResponse response = (FtpWebResponse)request.GetResponse();
+ Stream stream = response.GetResponseStream();
+ int bufferLength = 5120;
+ int i;
+ byte[] buffer = new byte[bufferLength];
+ i = stream.Read(buffer, 0, bufferLength);
+ while (i > 0)
+ {
+ fs.Write(buffer, 0, i);
+ i = stream.Read(buffer, 0, bufferLength);
+ }
+ stream.Close();
+ fs.Close();
+ response.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("FTP下载文件:" + ex.Message);
+ }
+ }
+
+ //FTP删除文件
+ public static void FileDelete(string fileName)
+ {
+ try
+ {
+ string uri = ftppath + fileName;
+ FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
+ request.UseBinary = true;
+ request.Credentials = new NetworkCredential(username, password);
+ request.KeepAlive = false;
+ request.Method = WebRequestMethods.Ftp.DeleteFile;
+ FtpWebResponse response = (FtpWebResponse)request.GetResponse();
+ response.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("FTP删除文件:" + ex.Message);
+ }
+ }
+
+ //FTP新建目录,上一级须先存在
+ public static void MakeDir(string dirName)
+ {
+ try
+ {
+ string uri = ftppath + dirName;
+ FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
+ request.UseBinary = true;
+ request.Credentials = new NetworkCredential(username, password);
+ request.Method = WebRequestMethods.Ftp.MakeDirectory;
+ FtpWebResponse response = (FtpWebResponse)request.GetResponse();
+ response.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("FTP新建目录:" + ex.Message);
+ }
+ }
+
+ //FTP删除目录,上一级须先存在
+ public static void DelDir(string dirName)
+ {
+ try
+ {
+ string uri = ftppath + dirName;
+ FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
+ reqFTP.Credentials = new NetworkCredential(username, password);
+ reqFTP.Method = WebRequestMethods.Ftp.RemoveDirectory;
+ FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
+ response.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("FTP删除目录:" + ex.Message);
+ }
+ }
+ }
+}
diff --git a/1200Gxml心电图绘制/LocalStorage.cs b/1200Gxml心电图绘制/LocalStorage.cs
new file mode 100644
index 0000000..a9cc5c9
--- /dev/null
+++ b/1200Gxml心电图绘制/LocalStorage.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+using System.Resources;
+
+namespace _1200Gxml心电图绘制
+{
+ public class LocalStorage
+ {
+ ///
+ /// 翻译支持的语言
+ ///
+ public static Dictionary DClanguage = new Dictionary();
+ ///
+ /// 当前语言
+ ///
+ public static string CurrentLanguage = "zh-CN";
+ ///
+ /// 语言资源管理器
+ ///
+ public static ResourceManager ResManager;
+
+ }
+}
diff --git a/1200Gxml心电图绘制/Msg.cs b/1200Gxml心电图绘制/Msg.cs
new file mode 100644
index 0000000..2c8a1ca
--- /dev/null
+++ b/1200Gxml心电图绘制/Msg.cs
@@ -0,0 +1,22 @@
+namespace _1200Gxml心电图绘制
+{
+
+ public class CbItemObj
+ {
+ ///
+ /// 显示
+ ///
+ public string Display { get; set; }
+ ///
+ /// 值
+ ///
+ public string Value { get; set; }
+ }
+
+ public class Msg
+ {
+ public bool IsOk { get; set; }
+
+ public string Content { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/Program.cs b/1200Gxml心电图绘制/Program.cs
new file mode 100644
index 0000000..94a3e48
--- /dev/null
+++ b/1200Gxml心电图绘制/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace _1200Gxml心电图绘制
+{
+ static class Program
+ {
+ ///
+ /// 应用程序的主入口点。
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form3());
+ }
+ }
+}
diff --git a/1200Gxml心电图绘制/Properties/AssemblyInfo.cs b/1200Gxml心电图绘制/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dbe9eaf
--- /dev/null
+++ b/1200Gxml心电图绘制/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("1200Gxml心电图绘制")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("1200Gxml心电图绘制")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//将 ComVisible 设置为 false 将使此程序集中的类型
+//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("3eba2f41-db73-407d-95d6-06293096f945")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/1200Gxml心电图绘制/Properties/Resources.Designer.cs b/1200Gxml心电图绘制/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..1d9259c
--- /dev/null
+++ b/1200Gxml心电图绘制/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace 心电图绘制.Properties {
+ using System;
+
+
+ ///
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// 返回此类使用的缓存的 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("心电图绘制.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/1200Gxml心电图绘制/Properties/Resources.resx b/1200Gxml心电图绘制/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/1200Gxml心电图绘制/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/Properties/Settings.Designer.cs b/1200Gxml心电图绘制/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..51e3a26
--- /dev/null
+++ b/1200Gxml心电图绘制/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace 心电图绘制.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/1200Gxml心电图绘制/Properties/Settings.settings b/1200Gxml心电图绘制/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/1200Gxml心电图绘制/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/1200Gxml心电图绘制/SqliteOptions.cs b/1200Gxml心电图绘制/SqliteOptions.cs
new file mode 100644
index 0000000..b50f537
--- /dev/null
+++ b/1200Gxml心电图绘制/SqliteOptions.cs
@@ -0,0 +1,204 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Data;
+using System.Windows.Forms;
+using System.Data.SqlClient;
+
+namespace _1200Gxml心电图绘制
+{
+ public class SqliteOptions_sql
+ {
+ public SqlConnection sqliteConn = null;
+ ///
+ /// 让此类创建一个单例类
+ ///
+ public static SqliteOptions_sql _instance = null;//申明一个EcgDrawing对象,复制Null
+ private static readonly object lockHelper = new object();
+
+ public static SqliteOptions_sql CreateInstance()
+ {
+ if (_instance == null)
+ {
+ lock (lockHelper)
+ {
+ if (_instance == null)
+ _instance = new SqliteOptions_sql();
+ }
+ }
+ return _instance;
+ }
+
+ public SqliteOptions_sql()
+ {
+ GetSqliteConnection();
+ }
+ ///
+ /// 获得sqlite数据库连接
+ ///
+ ///
+ ///
+ public bool GetSqliteConnection()
+ {
+ try
+ {
+ //给数据库连接类赋值
+ string ConnectionStr = File.ReadAllText(Application.StartupPath+ @"\conn.dll");
+ //string ConnectionStr = "server='rds75123g9jf9kk05833public.sqlserver.rds.aliyuncs.com,3433';database='ainia_holter_test';uid='ainia_test';pwd='ain4nhcEqV3gkAP7';";
+ SqlConnection Conn = new SqlConnection(ConnectionStr);
+
+ sqliteConn = Conn;
+ }
+ catch { return false; }
+ return true;
+ }
+
+ ///
+ /// 执行sqlite查询语句,并返回一个 DataTable
+ ///
+ ///
+ ///
+ public DataTable ExcuteSqlite(string sqliteStr)
+ {
+ SqlDataAdapter sqliteDp = new SqlDataAdapter(sqliteStr, sqliteConn);
+ DataSet sqliteds = new DataSet();
+ try
+ {
+ //if (sqliteConn.State == ConnectionState.Open)
+ // sqliteConn.Close();
+ sqliteDp.SelectCommand.CommandTimeout = 600000;
+ sqliteDp.Fill(sqliteds);
+ return sqliteds.Tables[0];
+ }
+ catch { }
+ return new DataTable();
+ }
+
+ ///
+ /// Sqlite 添加数据的操作函数
+ ///
+ ///
+ ///
+ public bool SqliteAdd(string sqliteSQL)
+ {
+ try
+ {
+ if (sqliteConn.State == ConnectionState.Closed)
+ sqliteConn.Open();
+ SqlCommand sqliteCmd = new SqlCommand(sqliteSQL, sqliteConn);
+ sqliteCmd.ExecuteNonQuery();
+ sqliteCmd.Dispose();
+ sqliteConn.Close();
+ }
+ catch { return false; }
+ return true;
+ }
+
+ ///
+ /// Sqlite 删除数据的操作函数
+ ///
+ ///
+ ///
+ public bool SqliteDelete(string sqliteSQL)
+ {
+ try
+ {
+ if (sqliteConn.State == ConnectionState.Closed)
+ sqliteConn.Open();
+ SqlCommand sqliteCmd = new SqlCommand(sqliteSQL, sqliteConn);
+ sqliteCmd.CommandTimeout = 3600;
+ sqliteCmd.ExecuteNonQuery();
+ sqliteCmd.Dispose();
+ sqliteConn.Close();
+ }
+ catch { return false; }
+ return true;
+ }
+
+ ///
+ /// Sqlite 更新数据的操作函数
+ ///
+ ///
+ ///
+ public bool SqliteUpdate(string sqliteSQL)
+ {
+ try
+ {
+ if (sqliteConn.State == ConnectionState.Closed)
+ sqliteConn.Open();
+ SqlCommand sqliteCmd = new SqlCommand(sqliteSQL, sqliteConn);
+ sqliteCmd.ExecuteNonQuery();
+ sqliteCmd.Dispose();
+ sqliteConn.Close();
+ }
+ catch { return false; }
+ return true;
+ }
+
+ ///
+ /// 执行SQL语句函数
+ ///
+ /// SQL语句
+ /// SQL语句中的参数组
+ /// 返回受影响记录条数
+ public int ExecuteSql(string sqlcmd, params SqlParameter[] paras)
+ {
+
+ SqlCommand cmd = new SqlCommand(sqlcmd, sqliteConn);
+ if (sqliteConn.State == ConnectionState.Closed)
+ {
+ sqliteConn.Open();
+ }
+
+ foreach (SqlParameter p in paras)
+ {
+ cmd.Parameters.Add(p);
+ }
+
+ int cnt = cmd.ExecuteNonQuery();
+ sqliteConn.Close();
+ return cnt;
+ }
+
+
+
+
+ ///
+ /// Sqlite 执行数据库的多条语句,
+ ///
+ ///
+ ///
+ public bool SqliteExecuteNonQuery(string[] sqliteSQL)
+ {
+
+ if (sqliteConn.State == ConnectionState.Closed)
+ {
+ sqliteConn.Open();
+ }
+ SqlTransaction sqlTran = sqliteConn.BeginTransaction();
+ try
+ {
+ foreach (string sql in sqliteSQL)
+ {
+ SqlCommand sqliteCmd = new SqlCommand(sql, sqliteConn, sqlTran);
+ sqliteCmd.ExecuteNonQuery();
+ sqliteCmd.Dispose();
+ }
+ sqlTran.Commit();
+ }
+ catch
+ {
+ sqlTran.Rollback();
+ return false;
+ }
+ finally
+ {
+
+ sqliteConn.Close();
+ }
+ return true;
+ }
+
+ }
+}
diff --git a/1200Gxml心电图绘制/ecgMeasure.cs b/1200Gxml心电图绘制/ecgMeasure.cs
new file mode 100644
index 0000000..18ab7fd
--- /dev/null
+++ b/1200Gxml心电图绘制/ecgMeasure.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+
+namespace _1200Gxml心电图绘制
+{
+ public class ecgMeasure
+ {
+ //画垂直的 和水平的线
+ public void Draw_Measure(Bitmap bit, Point p1, Point p2)
+ {
+
+ Graphics gg = Graphics.FromImage(bit);
+ Pen pp = new Pen(Color.Blue, float.Parse("1"));
+ Pen pp1 = new Pen(Color.Blue, float.Parse("1"));
+ //画水平线
+ gg.DrawLine(pp, new Point(p1.X,0), new Point(p1.X, bit.Height));
+ gg.DrawLine(pp1, p1, p2);
+ gg.DrawLine(pp1, p1.X, p1.Y, p1.X, p1.Y - 3);
+ gg.DrawLine(pp1, p2.X, p2.Y, p2.X, p2.Y - 3);
+ gg.DrawLine(pp, new Point(p2.X, 0), new Point(p2.X, bit.Height));
+ double ecgValue = ((double.Parse((p2.X - p1.X).ToString()) / (96 / 25.4)) / 25) * 1000;
+ string heartRate = ((int)60000 / ecgValue).ToString("0.0");
+ if (ecgValue > 0)
+ Draw_Rectangular_And_Text(bit, p2.X, p2.Y, ((int)ecgValue).ToString() + " 毫秒,心率:"+ heartRate);
+
+
+ //Graphics gg = Graphics.FromImage(bit);
+ //Pen pp = new Pen(Color.Blue, float.Parse("3"));
+ ////画水平线
+ //gg.DrawLine(pp, p1, p2);
+
+ //gg.DrawLine(pp, p1.X, p1.Y, p1.X, p1.Y - 3);
+ //gg.DrawLine(pp, p2.X, p2.Y, p2.X, p2.Y - 3);
+ //double ecgValue=((double.Parse((p2.X - p1.X).ToString())/(96/25.4))/25)*1000;
+ //Draw_Rectangular_And_Text(bit, p2.X, p2.Y, ((int)ecgValue).ToString() + " 毫秒");
+ }
+
+ //垂直的线
+ public void Draw_V_Measure(Bitmap bit, Point p1, Point p2)
+ {
+ Graphics gg = Graphics.FromImage(bit);
+ Pen pp = new Pen(Color.Red, float.Parse("1"));
+ //画水平线
+ //gg.DrawLine(pp, p1, p2);
+
+ gg.DrawLine(pp, p1.X - 10, p1.Y, p2.X - 10, p2.Y);
+ gg.DrawLine(pp, 0, p1.Y, bit.Width , p1.Y);
+ gg.DrawLine(pp, 0, p2.Y, bit.Width, p2.Y);
+ //gg.DrawLine(pp, p1.X - 10, p1.Y, p2.X - 10, p2.Y);
+ //gg.DrawLine(pp, p1.X - 10, p1.Y, p1.X + 30, p1.Y);
+ //gg.DrawLine(pp, p2.X - 10, p2.Y, p2.X + 30, p2.Y);
+ double ecgMV = ((double.Parse((p2.Y - p1.Y).ToString()) / ((96 / 25.4) * 10)));
+ if (ecgMV < 0)
+ ecgMV = -ecgMV;
+ if (p1.Y < p2.Y)
+ Draw_Rectangular_And_Text(bit, p1.X + 10, p1.Y, ecgMV.ToString("0.000") + " mv");
+ else
+ Draw_Rectangular_And_Text(bit, p2.X + 10, p2.Y, ecgMV.ToString("0.000") + " mv");
+ }
+
+
+ //画矩形和文字
+ public void Draw_Rectangular_And_Text(Bitmap bit, int x, int y, string Text)
+ {
+ //画垂直线
+ Graphics gg = Graphics.FromImage(bit);
+ Font font = new Font("宋体", 15,FontStyle.Bold); //字体
+ Brush brush = Brushes.Red; //字体颜色;
+ PointF point = new PointF(x, y); //写字的起始位置
+ gg.DrawString(Text, font, brush, point);
+ }
+
+ }
+}
diff --git a/1200Gxml心电图绘制/leadDataModel.cs b/1200Gxml心电图绘制/leadDataModel.cs
new file mode 100644
index 0000000..514ff20
--- /dev/null
+++ b/1200Gxml心电图绘制/leadDataModel.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace 心电图绘制
+{
+ public class leadDataModel
+ {
+ public string LEAD_I { get; set; }// I导联
+ public string LEAD_II { get; set; }// II导联
+ public string LEAD_III { get; set; }// III导联
+ public string LEAD_AVR { get; set; }// AVR导联
+ public string LEAD_AVL { get; set; }// AVL导联
+ public string LEAD_AVF { get; set; }// AVF导联
+ public string LEAD_V1 { get; set; }// V1导联
+ public string LEAD_V2 { get; set; }// V2导联
+ public string LEAD_V3 { get; set; }// V3导联
+ public string LEAD_V4 { get; set; }// V4导联
+ public string LEAD_V5 { get; set; }// V5导联
+ public string LEAD_V6 { get; set; }// V6导联
+ }
+}
diff --git a/1200Gxml心电图绘制/o23www.qsheal.com.ico b/1200Gxml心电图绘制/o23www.qsheal.com.ico
new file mode 100644
index 0000000000000000000000000000000000000000..839cd2cfdaa7ca1633a230eb3957e761d7d355e0
GIT binary patch
literal 4286
zcmcJT32;@_8OOhu^%(;R5t2ZId88qY5F5;(Y^FepX;?afG~!@u(UC5Q)3LS7v}3_4
zWm@W_%7CU+X^NDFr4S+_f{=(TVi95xNJ9*mQcW#O3P@h^-ud_ce>V(trgaF>%lx?S
zo_o%>pYL2S^YKq0VEWtsoNShAX1RnzHjZdKa`9cyFBfMPoNCs-nKbfutJ%rd%=Rua
ztGmnWeX0KpFHm-nHnb;@M6-?*v*zJuyXTl4dfu#cr`g4YW}#2T+wM8?9_>1lL7Sd1
z3s30Y+MdilMZI-7X8RQXa5;VVFLp6zAD5UlazE^@Hmff&-@XL%EsZk!RrkeR%Zjz!ldI1M
zEdRhPi)+~F^PQ~o$Jdu9__q$TBQDu$nWGBX`B`4`%$_;a+kRF*#PZ(QSYOznY*$uzBXoD87
zx2&g!7}PI#J;{3f*0t7T1^3sAJhKv=s{M=HrmBAb3sWJ?+CT*UqP
z>j779!FtBHYNXl5HD;UI%(hU@YovzMlATwe=N)7l(Y#G$16e~}B#O(@AY)QVTe8R}
zm@$vu#dB$PUG06?uVjpIbsZ
z{zpB$dL!*-|JcPGYyG=KI^QQBkdMe2(nija^Ihm!Pt(kq#gf01;;=L;h$+94_ih>j(^>sjMG^T@~KENLaO
zLvoZKwOnJo16Gve#j^4rR?Z9hxqFq5|V(#8-U*Z
zfTUFK-iyx~k56!jiE*4C;yT%Jnn;dfs2s{S+3*snWQ;4GB8pBey?IbZ9d
zV=vjDd`Pb3YoDkdv`^QuFZ^ky*<1U~4zrIb-=|10vQ{$WbN_70zuD7wQz3A35s-fe
zFzhR&7|7$Z#$}V{X?`EBi`Wo}L$FJ(>ftbXi)dd|)91r)#?UW?FmOl+bAJ#<<1vRZg`G%B3L-iA4C3RZUp-Pau$@%#Ogq9eu4OU(XK(xj
z|LLFnl)qDd2u%MeFzv^{q=&unTcOOD0V}4!Rm>I6V=zdpS@?E!N
z;#{|^_&aWY(fz>f_t5vRI+Wb&Fpc$4e5b=N7CIblaQON+!YC~4z}T^E$jE46E~H=m
za2xBt`f*Rc{yxn<7!3HL-Awk7vgCBPGCkWZ59GTAUl`?P=1*`1Bc{6a!WqtAS_&(A
z$VH92&kYz|>K0OWTmA&r-U#+3+MJl?@ZcOrpB;wXqWr5LswX#*I-)amOAF&a`m+9O
z`&BU6`G<~kPvner7X}TZ{v7J(-kW}pL-k7zxw+c^>Op@eI!ART)zbIPVy<&>QBh%j7k8}WInv0Ur{4Av_dL&<{VUk_
z_;0iA{}pqDczB_ObdqzVjO-u>NE-=>J6O$
literal 0
HcmV?d00001
diff --git a/1200Gxml心电图绘制/packages.config b/1200Gxml心电图绘制/packages.config
new file mode 100644
index 0000000..32e0852
--- /dev/null
+++ b/1200Gxml心电图绘制/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/心电图绘制.csproj b/1200Gxml心电图绘制/心电图绘制.csproj
new file mode 100644
index 0000000..11ef250
--- /dev/null
+++ b/1200Gxml心电图绘制/心电图绘制.csproj
@@ -0,0 +1,128 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {3EBA2F41-DB73-407D-95D6-06293096F945}
+ WinExe
+ Properties
+ 心电图绘制
+ 心电图打印服务
+ v4.8
+ 512
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+ o23www.qsheal.com.ico
+
+
+
+ False
+ bin\Debug\HttpServerLib.dll
+
+
+ ..\packages\iTextSharp.5.5.5\lib\itextsharp.dll
+
+
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form3.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form3.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1200Gxml心电图绘制/服务/ConsoleLogger.cs b/1200Gxml心电图绘制/服务/ConsoleLogger.cs
new file mode 100644
index 0000000..35c9c2e
--- /dev/null
+++ b/1200Gxml心电图绘制/服务/ConsoleLogger.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using HTTPServerLib;
+
+namespace _1200Gxml心电图绘制
+{
+ public class ConsoleLogger:ILogger
+ {
+ private Control _logControl; // 假设你有一个用于显示日志的Control
+ private const int MaxLogLength = 10000; // 设置最大日志长度
+
+ public ConsoleLogger(Control logControl)
+ {
+ _logControl = logControl;
+ }
+
+ public void Log(object message)
+ {
+ try
+ {
+ // 是否进行书写日志
+ if (ConfigurationManager.AppSettings["log"] == "1")
+ {
+ if (_logControl.InvokeRequired)
+ {
+ _logControl.Invoke(new Action