添加项目文件。
This commit is contained in:
parent
2f330b4273
commit
f419a45561
22
1200Gxml心电图绘制.sln
Normal file
22
1200Gxml心电图绘制.sln
Normal file
@ -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
|
18
1200Gxml心电图绘制/App.config
Normal file
18
1200Gxml心电图绘制/App.config
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appSettings>
|
||||||
|
<add key="ftppath" value="ftp://47.94.80.150:21/"/>
|
||||||
|
<add key="username" value="ecg"/>
|
||||||
|
<add key="password" value="ecg"/>
|
||||||
|
<add key="path1" value=""/>
|
||||||
|
<add key="ecgHttpUrl" value=""/>
|
||||||
|
<!--服务启用的ip地址-->
|
||||||
|
<add key="ip" value="0.0.0.0"/>
|
||||||
|
<!--服务启用端口-->
|
||||||
|
<add key="port" value="4050"/>
|
||||||
|
<!--是否屏幕输出信息-->
|
||||||
|
<add key="log" value="1"/>
|
||||||
|
<!--保存心电报告路径-->
|
||||||
|
<add key="path" value=""/>
|
||||||
|
</appSettings>
|
||||||
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
2417
1200Gxml心电图绘制/CommonPrintEcgWave.cs
Normal file
2417
1200Gxml心电图绘制/CommonPrintEcgWave.cs
Normal file
File diff suppressed because it is too large
Load Diff
9
1200Gxml心电图绘制/CommonVerifyUrlResult.cs
Normal file
9
1200Gxml心电图绘制/CommonVerifyUrlResult.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
1003
1200Gxml心电图绘制/ConfigHelper.cs
Normal file
1003
1200Gxml心电图绘制/ConfigHelper.cs
Normal file
File diff suppressed because it is too large
Load Diff
97
1200Gxml心电图绘制/DESEncrypt.cs
Normal file
97
1200Gxml心电图绘制/DESEncrypt.cs
Normal file
@ -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 ========加密========
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string Encrypt(string text)
|
||||||
|
{
|
||||||
|
return Encrypt(text, "da1ff5@1b453d1f66d83bc6e7c5cab4$");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加密数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="sKey"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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 ========解密========
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 解密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string Decrypt(string text)
|
||||||
|
{
|
||||||
|
return Decrypt(text, "da1ff5@1b453d1f66d83bc6e7c5cab4$");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 解密数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="sKey"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
901
1200Gxml心电图绘制/EcgDataDraw_New.cs
Normal file
901
1200Gxml心电图绘制/EcgDataDraw_New.cs
Normal file
@ -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<int> LeadInfo = new List<int>();
|
||||||
|
Dictionary<int, List<double>> EcgDataList;
|
||||||
|
int FreePixs = 0;
|
||||||
|
Point FirstPosition = new Point(0, 0);
|
||||||
|
Point SecondPosition = new Point(0, 0);
|
||||||
|
Dictionary<string, Point> FirstPointArray = new Dictionary<string, Point>();
|
||||||
|
|
||||||
|
//存放心电数据的字典 按照 每导联顺序进行存储
|
||||||
|
Dictionary<int, List<float>> EcgData_Dic = new Dictionary<int, List<float>>();
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pb"></param>
|
||||||
|
/// <param name="Leads"></param>
|
||||||
|
/// <param name="EcgTable"></param>
|
||||||
|
/// <param name="NewDpi"></param>
|
||||||
|
public void InitEcgParameter(Bitmap btmp, int leadCount, Dictionary<int, List<float>> EcgTable, int NewDpi, List<int> 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 把识别的R波位置标示出来
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rPosList"></param>
|
||||||
|
public void drawRWavePos(List<int> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电波形
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电波形
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电报告的报告头
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
///// <summary>
|
||||||
|
///// 绘制患者的心电识别的参数
|
||||||
|
///// </summary>
|
||||||
|
//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);
|
||||||
|
//}
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制患者的心电识别的参数
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制医生的诊断结果
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
///// <summary>
|
||||||
|
///// 绘制心电波形
|
||||||
|
///// </summary>
|
||||||
|
//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;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 绘制心电图的背景网格
|
||||||
|
///// </summary>
|
||||||
|
//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;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电图的背景网格
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电图的背景网格
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电图的大网格 5mm大网格
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电图的定标电压和导联名称
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得心电数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Dictionary<int, List<double>> 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<int, List<double>> get_EcgDataList = new Dictionary<int, List<double>>();
|
||||||
|
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<double> ecg_List = new List<double>();
|
||||||
|
ecg_List.Add((double)f);
|
||||||
|
//ecg_List.Add(short.Parse(cc.ToString()));
|
||||||
|
get_EcgDataList.Add(q, ecg_List);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return get_EcgDataList;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获得心电数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Dictionary<int, List<float>> 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<int, List<float>> get_EcgDataList = new Dictionary<int, List<float>>();
|
||||||
|
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<float> ecg_List = new List<float>();
|
||||||
|
ecg_List.Add(resulte_cc);
|
||||||
|
get_EcgDataList.Add(q, ecg_List);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return get_EcgDataList;
|
||||||
|
}
|
||||||
|
///// <summary>
|
||||||
|
///// 波形放大或缩小
|
||||||
|
///// </summary>
|
||||||
|
//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;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//**************************动态播放十二导联波形************************************************************************************
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制屏幕墙窗体背景
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Graphics"></param>
|
||||||
|
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;//求出 心电 相邻两点之间的 像素点个数
|
||||||
|
/// <summary>
|
||||||
|
/// 绘制心电波形
|
||||||
|
/// </summary>
|
||||||
|
//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;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
289
1200Gxml心电图绘制/Form3.Designer.cs
generated
Normal file
289
1200Gxml心电图绘制/Form3.Designer.cs
generated
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
namespace _1200Gxml心电图绘制
|
||||||
|
{
|
||||||
|
partial class Form3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
510
1200Gxml心电图绘制/Form3.cs
Normal file
510
1200Gxml心电图绘制/Form3.cs
Normal file
@ -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<int, List<float>> EcgTable = new Dictionary<int, List<float>>();
|
||||||
|
//for (int k = 0; k < 8; k++)
|
||||||
|
// EcgTable.Add(k, new List<float>());
|
||||||
|
|
||||||
|
//string contentStr = File.ReadAllText(Application.StartupPath + @"\蓝牙holter数据\dc93ee94-c0e8-4dba-8d29-ed86b2dcb6e8.ecg");
|
||||||
|
//var contenList = JsonConvert.DeserializeObject<List<byte[]>>(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<int, List<float>> EcgTable2 = new Dictionary<int, List<float>>();
|
||||||
|
////把 I II导联加入字典中
|
||||||
|
//for (int i = 0; i < 2; i++)
|
||||||
|
// EcgTable2.Add(i, EcgTable[i]);
|
||||||
|
|
||||||
|
//List<float> list3 = new List<float>();
|
||||||
|
//List<float> list4 = new List<float>();
|
||||||
|
//List<float> list5 = new List<float>();
|
||||||
|
//List<float> list6 = new List<float>();
|
||||||
|
////把 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<int, List<float>> EcgTable3 = new Dictionary<int, List<float>>();
|
||||||
|
//for (int i = 0; i < EcgTable2.Count; i++)
|
||||||
|
// EcgTable3.Add(i, baseLineFilter(i, EcgTable2[i]));
|
||||||
|
|
||||||
|
//this.samplingRate = 300;
|
||||||
|
//this.windowSize = 60000;
|
||||||
|
|
||||||
|
//List<int> rPosList = DetectRWave(EcgTable3[1].ToArray());
|
||||||
|
|
||||||
|
|
||||||
|
////for (int i = 0; i < 12; i++)
|
||||||
|
//// EcgTable2[i].RemoveRange(0, 500);
|
||||||
|
|
||||||
|
|
||||||
|
////string[] ecgDataArray = dataStr.Split(' ');//把xml中每一导联的数据 变成数组 然后把数据赋值给 EcgTable 字典中的每一导联
|
||||||
|
////List<float> ecg_List = new List<float>();
|
||||||
|
////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<int> leadInfo = new List<int>();
|
||||||
|
//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<float> baseLineFilter(int leadIndex, List<float> inputDatas)
|
||||||
|
{
|
||||||
|
List<float> outPutDatas = new List<float>();
|
||||||
|
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<int> DetectRWave(float[] ecg_data)
|
||||||
|
{
|
||||||
|
List<int> rWaveIndices = new List<int>(); 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<int> _longLeadInfo = new List<int>(); //存储任意长两导联的导联下标
|
||||||
|
private readonly List<int> _longLeadInfo3 = new List<int>(); //存储任意长三导联的导联下标
|
||||||
|
public string LeaderType; //导联类别
|
||||||
|
private Dictionary<int, List<float>> _ecgDataDicAfterFilter = new Dictionary<int, List<float>>(); //滤波后的数据都存在这个字典中
|
||||||
|
private int _filterIndex; //滤波时 此标志 指示从数组中 哪一个位置开始滤波
|
||||||
|
/// <summary>
|
||||||
|
/// 获得心电诊断快照数据
|
||||||
|
/// </summary>
|
||||||
|
public void GetEcgViewDataImage(Image img, string addr)
|
||||||
|
{
|
||||||
|
_ecgDataDicAfterFilter.Clear();
|
||||||
|
string ecgDataJsonStr = File.ReadAllText(Application.StartupPath + @"\60心拍心电图数据JSON.txt");
|
||||||
|
leadDataModel LDM = JsonConvert.DeserializeObject<leadDataModel>(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;//定标电压
|
||||||
|
/// <summary>
|
||||||
|
/// 设置增益和走速和定标电压
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开启服务
|
||||||
|
/// </summary>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
1200Gxml心电图绘制/Form3.resx
Normal file
126
1200Gxml心电图绘制/Form3.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>62</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
266
1200Gxml心电图绘制/FtpHelper.cs
Normal file
266
1200Gxml心电图绘制/FtpHelper.cs
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
1200Gxml心电图绘制/LocalStorage.cs
Normal file
22
1200Gxml心电图绘制/LocalStorage.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Resources;
|
||||||
|
|
||||||
|
namespace _1200Gxml心电图绘制
|
||||||
|
{
|
||||||
|
public class LocalStorage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 翻译支持的语言
|
||||||
|
/// </summary>
|
||||||
|
public static Dictionary<string, string> DClanguage = new Dictionary<string, string>();
|
||||||
|
/// <summary>
|
||||||
|
/// 当前语言
|
||||||
|
/// </summary>
|
||||||
|
public static string CurrentLanguage = "zh-CN";
|
||||||
|
/// <summary>
|
||||||
|
/// 语言资源管理器
|
||||||
|
/// </summary>
|
||||||
|
public static ResourceManager ResManager;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
22
1200Gxml心电图绘制/Msg.cs
Normal file
22
1200Gxml心电图绘制/Msg.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
namespace _1200Gxml心电图绘制
|
||||||
|
{
|
||||||
|
|
||||||
|
public class CbItemObj
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 显示
|
||||||
|
/// </summary>
|
||||||
|
public string Display { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 值
|
||||||
|
/// </summary>
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Msg
|
||||||
|
{
|
||||||
|
public bool IsOk { get; set; }
|
||||||
|
|
||||||
|
public string Content { get; set; }
|
||||||
|
}
|
||||||
|
}
|
21
1200Gxml心电图绘制/Program.cs
Normal file
21
1200Gxml心电图绘制/Program.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace _1200Gxml心电图绘制
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 应用程序的主入口点。
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Form3());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
1200Gxml心电图绘制/Properties/AssemblyInfo.cs
Normal file
36
1200Gxml心电图绘制/Properties/AssemblyInfo.cs
Normal file
@ -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")]
|
63
1200Gxml心电图绘制/Properties/Resources.Designer.cs
generated
Normal file
63
1200Gxml心电图绘制/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace 心电图绘制.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||||
|
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
117
1200Gxml心电图绘制/Properties/Resources.resx
Normal file
117
1200Gxml心电图绘制/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
26
1200Gxml心电图绘制/Properties/Settings.Designer.cs
generated
Normal file
26
1200Gxml心电图绘制/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
1200Gxml心电图绘制/Properties/Settings.settings
Normal file
7
1200Gxml心电图绘制/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
204
1200Gxml心电图绘制/SqliteOptions.cs
Normal file
204
1200Gxml心电图绘制/SqliteOptions.cs
Normal file
@ -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;
|
||||||
|
/// <summary>
|
||||||
|
/// 让此类创建一个单例类
|
||||||
|
/// </summary>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获得sqlite数据库连接
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbpath"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行sqlite查询语句,并返回一个 DataTable
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sqliteStr"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sqlite 添加数据的操作函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sqliteSQL"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sqlite 删除数据的操作函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sqliteSQL"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sqlite 更新数据的操作函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sqliteSQL"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行SQL语句函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sqlcmd">SQL语句</param>
|
||||||
|
/// <param name="paras">SQL语句中的参数组</param>
|
||||||
|
/// <returns>返回受影响记录条数</returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sqlite 执行数据库的多条语句,
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sqliteSQL"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
76
1200Gxml心电图绘制/ecgMeasure.cs
Normal file
76
1200Gxml心电图绘制/ecgMeasure.cs
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
24
1200Gxml心电图绘制/leadDataModel.cs
Normal file
24
1200Gxml心电图绘制/leadDataModel.cs
Normal file
@ -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导联
|
||||||
|
}
|
||||||
|
}
|
BIN
1200Gxml心电图绘制/o23www.qsheal.com.ico
Normal file
BIN
1200Gxml心电图绘制/o23www.qsheal.com.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
5
1200Gxml心电图绘制/packages.config
Normal file
5
1200Gxml心电图绘制/packages.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="iTextSharp" version="5.5.5" targetFramework="net48" />
|
||||||
|
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||||
|
</packages>
|
128
1200Gxml心电图绘制/心电图绘制.csproj
Normal file
128
1200Gxml心电图绘制/心电图绘制.csproj
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{3EBA2F41-DB73-407D-95D6-06293096F945}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>心电图绘制</RootNamespace>
|
||||||
|
<AssemblyName>心电图打印服务</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>o23www.qsheal.com.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="HttpServerLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>bin\Debug\HttpServerLib.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="itextsharp, Version=5.5.5.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\iTextSharp.5.5.5\lib\itextsharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="CommonPrintEcgWave.cs" />
|
||||||
|
<Compile Include="CommonVerifyUrlResult.cs" />
|
||||||
|
<Compile Include="ConfigHelper.cs" />
|
||||||
|
<Compile Include="DESEncrypt.cs" />
|
||||||
|
<Compile Include="EcgDataDraw_New.cs" />
|
||||||
|
<Compile Include="ecgMeasure.cs" />
|
||||||
|
<Compile Include="Form3.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form3.Designer.cs">
|
||||||
|
<DependentUpon>Form3.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="FtpHelper.cs" />
|
||||||
|
<Compile Include="leadDataModel.cs" />
|
||||||
|
<Compile Include="LocalStorage.cs" />
|
||||||
|
<Compile Include="Msg.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="SqliteOptions.cs" />
|
||||||
|
<Compile Include="服务\ConsoleLogger.cs" />
|
||||||
|
<Compile Include="服务\ExampleServer.cs" />
|
||||||
|
<Compile Include="服务\LogHelper.cs" />
|
||||||
|
<Compile Include="服务\PatientInfo.cs" />
|
||||||
|
<Compile Include="服务\print.cs" />
|
||||||
|
<Compile Include="服务\UniversalFun.cs" />
|
||||||
|
<EmbeddedResource Include="Form3.resx">
|
||||||
|
<DependentUpon>Form3.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
</Compile>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="o23www.qsheal.com.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
53
1200Gxml心电图绘制/服务/ConsoleLogger.cs
Normal file
53
1200Gxml心电图绘制/服务/ConsoleLogger.cs
Normal file
@ -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<object>(Log), message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 检查日志内容是否超过最大长度
|
||||||
|
if (_logControl.Text.Length + message.ToString().Length + Environment.NewLine.Length > MaxLogLength)
|
||||||
|
{
|
||||||
|
// 清空日志控件
|
||||||
|
_logControl.Text = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将日志信息添加到Control中,例如TextBox或RichTextBox
|
||||||
|
_logControl.Text += message + Environment.NewLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
274
1200Gxml心电图绘制/服务/ExampleServer.cs
Normal file
274
1200Gxml心电图绘制/服务/ExampleServer.cs
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using HTTPServerLib;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
using 心电图绘制;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using 心电图绘制.Properties;
|
||||||
|
using 心电图绘制;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace _1200Gxml心电图绘制
|
||||||
|
{
|
||||||
|
public class ExampleServer : HTTPServerLib.HttpServer
|
||||||
|
{
|
||||||
|
private Control _logControl;
|
||||||
|
ConsoleLogger logger;
|
||||||
|
print print = new print();
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 报告样式类型
|
||||||
|
/// </summary>
|
||||||
|
public int reportMode;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 报告样式类型名称
|
||||||
|
/// </summary>
|
||||||
|
public string strreportMode = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 走速
|
||||||
|
/// </summary>
|
||||||
|
public int cBoxSpeed = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 振幅
|
||||||
|
/// </summary>
|
||||||
|
public int cBoxAmplitude = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ipAddress">IP地址</param>
|
||||||
|
/// <param name="port">端口号</param>
|
||||||
|
public ExampleServer(string ipAddress, int port, Control _logControl)
|
||||||
|
: base(ipAddress, port)
|
||||||
|
{
|
||||||
|
logger = new ConsoleLogger(_logControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnPost(HttpRequest request, HttpResponse response)
|
||||||
|
{
|
||||||
|
//获取客户端传递的参数
|
||||||
|
// string data = request.Params == null ? "" : string.Join(";", request.Params.Select(x => x.Key + "=" + x.Value).ToArray());
|
||||||
|
string strMQName = string.Empty;
|
||||||
|
LogHelper.Info("接收到请求", "");
|
||||||
|
string data = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request != null && request.Params != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (request.URL.Contains("printecg"))
|
||||||
|
{
|
||||||
|
string[] array = request.Params.Select(x => x.Value).ToArray();
|
||||||
|
if (array.Length > 0)
|
||||||
|
{
|
||||||
|
LogHelper.Info("请求参数", array[0]);
|
||||||
|
PatientInfo patientInfo = JsonConvert.DeserializeObject<PatientInfo>(array[0]);
|
||||||
|
print.cBoxSpeed = cBoxSpeed;
|
||||||
|
print.cBoxAmplitude = cBoxAmplitude;
|
||||||
|
print.strreportMode = strreportMode;
|
||||||
|
print.reportMode = reportMode;
|
||||||
|
|
||||||
|
if (patientInfo != null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(patientInfo.filepath))
|
||||||
|
{
|
||||||
|
Log("开始处理请求:" + patientInfo.regid);
|
||||||
|
Image image = null;
|
||||||
|
if (!string.IsNullOrEmpty(patientInfo.image))
|
||||||
|
{
|
||||||
|
image = UniversalFun.ConvertFromBase64String(patientInfo.image);
|
||||||
|
|
||||||
|
}
|
||||||
|
string ecgDataJsonStr = UniversalFun.GetTextFileContent(patientInfo.filepath);
|
||||||
|
print.GetEcgViewDataImage(image, "", patientInfo, patientInfo.type, ecgDataJsonStr);
|
||||||
|
if (patientInfo.type == 1)
|
||||||
|
{
|
||||||
|
data = print.imagebase;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = print.filename;
|
||||||
|
}
|
||||||
|
Log("请求处理完成:" + patientInfo.regid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = "心电数据为空";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = "解析数据不正确";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = "非指定请求方法";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = "请求参数为空";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LogHelper.Info("OnPost Error:", e.Message);
|
||||||
|
}
|
||||||
|
//设置返回信息
|
||||||
|
string content = data; //string.Format("<vtma><result>0000</result><desc>Successful!</desc><data><outputXml>{0}</outputXml></data></vtma>", data);
|
||||||
|
|
||||||
|
//构造响应报文
|
||||||
|
response.SetContent(content);
|
||||||
|
response.Content_Encoding = "utf-8";
|
||||||
|
response.StatusCode = "200";
|
||||||
|
response.Content_Type = "application/json; charset=UTF-8";
|
||||||
|
response.Server = "ExampleServer";
|
||||||
|
// LogHelper.Info("返回值:" ,content);
|
||||||
|
//发送响应
|
||||||
|
response.Send();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnGet(HttpRequest request, HttpResponse response)
|
||||||
|
{
|
||||||
|
|
||||||
|
LogHelper.Info("请求到接口", "");
|
||||||
|
|
||||||
|
//当文件不存在时应返回404状态码
|
||||||
|
string requestURL = request.URL;
|
||||||
|
requestURL = requestURL.Replace("/", @"\").Replace("\\..", "").TrimStart('\\');
|
||||||
|
/*
|
||||||
|
string requestFile = Path.Combine(ServerRoot, requestURL);
|
||||||
|
|
||||||
|
//根据不同业务进行修改
|
||||||
|
//判断地址中是否存在扩展名
|
||||||
|
string extension = Path.GetExtension(requestFile);
|
||||||
|
|
||||||
|
//根据有无扩展名按照两种不同链接进行处
|
||||||
|
if (extension != "")
|
||||||
|
{
|
||||||
|
//从文件中返回HTTP响应
|
||||||
|
response = LoadFromFile(response, requestFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//目录存在且不存在index页面时时列举目录
|
||||||
|
if (Directory.Exists(requestFile) && !File.Exists(requestFile + "\\index.html"))
|
||||||
|
{
|
||||||
|
requestFile = Path.Combine(ServerRoot, requestFile);
|
||||||
|
var content = ListDirectory(requestFile, requestURL);
|
||||||
|
response = response.SetContent(content, Encoding.UTF8);
|
||||||
|
response.Content_Type = "text/html; charset=UTF-8";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//加载静态HTML页面
|
||||||
|
requestFile = Path.Combine(requestFile, "index.html");
|
||||||
|
response = LoadFromFile(response, requestFile);
|
||||||
|
response.Content_Type = "text/html; charset=UTF-8";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//发送HTTP响应
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.Append("接收到接口数据");
|
||||||
|
|
||||||
|
|
||||||
|
response.SetContent(sb.ToString());
|
||||||
|
response.StatusCode = "200";
|
||||||
|
response.Content_Type = "text/html";
|
||||||
|
response.Server = "ExampleServer";
|
||||||
|
response.Send();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDefault(HttpRequest request, HttpResponse response)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async void GetFilePathUrl(string filepath)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 从文件返回一个HTTP响应
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName">文件名</param>
|
||||||
|
private HttpResponse LoadFromFile(HttpResponse response, string fileName)
|
||||||
|
{
|
||||||
|
//获取文件扩展名以判断内容类型
|
||||||
|
string extension = Path.GetExtension(fileName);
|
||||||
|
|
||||||
|
//获取当前内容类型
|
||||||
|
string contentType = GetContentType(extension);
|
||||||
|
|
||||||
|
//如果文件不存在则返回404否则读取文件内容
|
||||||
|
if (!File.Exists(fileName))
|
||||||
|
{
|
||||||
|
response.SetContent("<html><body><h1>404 - Not Found</h1></body></html>");
|
||||||
|
response.StatusCode = "404";
|
||||||
|
response.Content_Type = "text/html";
|
||||||
|
response.Server = "ExampleServer";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.SetContent(File.ReadAllBytes(fileName));
|
||||||
|
response.StatusCode = "200";
|
||||||
|
response.Content_Type = contentType;
|
||||||
|
response.Server = "ExampleServer";
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回数据
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ConvertPath(string[] urls)
|
||||||
|
{
|
||||||
|
string html = string.Empty;
|
||||||
|
int length = ServerRoot.Length;
|
||||||
|
foreach (var url in urls)
|
||||||
|
{
|
||||||
|
var s = url.StartsWith("..") ? url : url.Substring(length).TrimEnd('\\');
|
||||||
|
html += String.Format("<li><a href=\"{0}\">{0}</a></li>", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ListDirectory(string requestDirectory, string requestURL)
|
||||||
|
{
|
||||||
|
//列举子目录
|
||||||
|
var folders = requestURL.Length > 1 ? new string[] { "../" } : new string[] { };
|
||||||
|
folders = folders.Concat(Directory.GetDirectories(requestDirectory)).ToArray();
|
||||||
|
var foldersList = ConvertPath(folders);
|
||||||
|
|
||||||
|
//列举文件
|
||||||
|
var files = Directory.GetFiles(requestDirectory);
|
||||||
|
var filesList = ConvertPath(files);
|
||||||
|
|
||||||
|
//构造HTML
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.Append(string.Format("<html><head><title>{0}</title></head>", requestDirectory));
|
||||||
|
builder.Append(string.Format("<body><h1>{0}</h1><br/><ul>{1}{2}</ul></body></html>",
|
||||||
|
requestURL, filesList, foldersList));
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
128
1200Gxml心电图绘制/服务/LogHelper.cs
Normal file
128
1200Gxml心电图绘制/服务/LogHelper.cs
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace 心电图绘制
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日志类
|
||||||
|
/// </summary>
|
||||||
|
public sealed class LogHelper
|
||||||
|
{
|
||||||
|
public static int level = 3;
|
||||||
|
public static string path = AppDomain.CurrentDomain.BaseDirectory + "\\Content\\Log\\";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="content"></param>
|
||||||
|
public static void Info(string title, string content)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
new LogHelper().Log("info", title, content);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录调试日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="content"></param>
|
||||||
|
public static void Debug(string title, string content)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
new LogHelper().Log("debug", title, content);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录错误日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="content"></param>
|
||||||
|
public static void Error(string title, string content)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
new LogHelper().Log("error", title, content);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录异常日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="ex"></param>
|
||||||
|
public static void Error(string type, Exception ex)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
new LogHelper().Log(type, ex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录一般日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="content"></param>
|
||||||
|
private void Log(string type, string title, string content)
|
||||||
|
{
|
||||||
|
string name = string.Concat(DateTime.Now.ToString("yyyyMMdd"), ".TXT");
|
||||||
|
string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||||
|
string write_content = $"[{time}][{type}][{title}][{content}]";
|
||||||
|
using (FileStream fs = new FileStream(path + name, FileMode.Append, FileAccess.Write))
|
||||||
|
{
|
||||||
|
using (StreamWriter w = new StreamWriter(fs, System.Text.Encoding.GetEncoding("utf-8")))
|
||||||
|
{
|
||||||
|
w.WriteLine(write_content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录异常错误日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="ex"></param>
|
||||||
|
private void Log(string type, Exception ex)
|
||||||
|
{
|
||||||
|
string name = string.Concat(DateTime.Now.ToString("yyyyMMdd"), ".error.config");
|
||||||
|
string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||||
|
using (FileStream fs = new FileStream(path + name, FileMode.Append, FileAccess.Write))
|
||||||
|
{
|
||||||
|
using (StreamWriter w = new StreamWriter(fs, System.Text.Encoding.GetEncoding("utf-8")))
|
||||||
|
{
|
||||||
|
w.WriteLine("------------------------------------------------------------------");
|
||||||
|
w.WriteLine(string.Concat("[1.位置:", type, "]"));
|
||||||
|
w.WriteLine(string.Concat("[2.时间:", time, "]"));
|
||||||
|
w.WriteLine(string.Concat("[4.实例:", ex.InnerException, "]"));
|
||||||
|
w.WriteLine(string.Concat("[5.来源:", ex.Source, "]"));
|
||||||
|
w.WriteLine(string.Concat("[6.方法:", ex.TargetSite, "]"));
|
||||||
|
w.WriteLine(string.Concat("[7.堆栈:", ex.StackTrace, "]"));
|
||||||
|
w.WriteLine(string.Concat("[8.提示:", ex.Message, "]"));
|
||||||
|
w.WriteLine("------------------------------------------------------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
48
1200Gxml心电图绘制/服务/PatientInfo.cs
Normal file
48
1200Gxml心电图绘制/服务/PatientInfo.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace 心电图绘制
|
||||||
|
{
|
||||||
|
internal class PatientInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
public string examid { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string gender { get; set; }
|
||||||
|
public int age { get; set; }
|
||||||
|
public string ward { get; set; }
|
||||||
|
public string regid { get; set; }
|
||||||
|
public int hr { get; set; }
|
||||||
|
public double pr { get; set; }
|
||||||
|
public string qrs { get; set; }
|
||||||
|
public string qtqtc { get; set; } // QT/QTC 被转换为 qtqt
|
||||||
|
public string rv5sv1 { get; set; }
|
||||||
|
public string rv5sv1plus { get; set; } // RV5+SV1 被转换为 rv5sv1plus
|
||||||
|
public string pt { get; set; }
|
||||||
|
public string diagnosishint { get; set; }
|
||||||
|
public string department { get; set; }
|
||||||
|
public string image { get; set; }
|
||||||
|
|
||||||
|
public string doctorDiagTime { get; set; }
|
||||||
|
|
||||||
|
public string diagContent { get; set; }
|
||||||
|
|
||||||
|
public string DepartName { get; set; }
|
||||||
|
|
||||||
|
public string doctorName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 类型 1是返回base64 2是在指定路径保存pdf
|
||||||
|
/// </summary>
|
||||||
|
public int type { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string filepath { get; set; }
|
||||||
|
|
||||||
|
public string orgname { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
133
1200Gxml心电图绘制/服务/UniversalFun.cs
Normal file
133
1200Gxml心电图绘制/服务/UniversalFun.cs
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
using iTextSharp.text.pdf;
|
||||||
|
using iTextSharp.text;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace 心电图绘制
|
||||||
|
{
|
||||||
|
internal class UniversalFun
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// base64转换成图片
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="base64String"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static System.Drawing.Image ConvertFromBase64String(string base64String)
|
||||||
|
{
|
||||||
|
string [] baseary= base64String.Split(',');
|
||||||
|
if(baseary.Length<2)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 将Base64字符串转换为字节数组
|
||||||
|
byte[] imageBytes = Convert.FromBase64String(baseary[1]);
|
||||||
|
|
||||||
|
// 使用字节数组创建MemoryStream
|
||||||
|
using (MemoryStream ms = new MemoryStream(imageBytes))
|
||||||
|
{
|
||||||
|
// 从MemoryStream中创建Image对象
|
||||||
|
System.Drawing.Image image = System.Drawing.Image.FromStream(ms);
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 图片转换成base64
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bitmap"></param>
|
||||||
|
/// <param name="format"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ConvertToBase64String(Bitmap bitmap, ImageFormat format)
|
||||||
|
{
|
||||||
|
// 将Bitmap保存到MemoryStream中
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
bitmap.Save(ms, format); // 可以根据需要选择不同的图片格式,例如ImageFormat.Png或ImageFormat.Jpeg
|
||||||
|
// 将流的位置重置到开始位置
|
||||||
|
ms.Position = 0;
|
||||||
|
// 将MemoryStream中的字节数组编码为Base64字符串
|
||||||
|
byte[] imageBytes = ms.ToArray();
|
||||||
|
string base64String = Convert.ToBase64String(imageBytes);
|
||||||
|
return base64String;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图片转换成PDF
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bitmap"></param>
|
||||||
|
/// <param name="pdfPath"></param>
|
||||||
|
public static void ConvertBitmapToPdf(Bitmap bitmap, string pdfPath)
|
||||||
|
{
|
||||||
|
|
||||||
|
string directoryPath = Path.GetDirectoryName(pdfPath);
|
||||||
|
if (directoryPath != null && !Directory.Exists(directoryPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(directoryPath);
|
||||||
|
}
|
||||||
|
// 创建一个文档对象
|
||||||
|
Document document = new Document();
|
||||||
|
|
||||||
|
// 创建一个PdfWriter实例
|
||||||
|
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(pdfPath, FileMode.Create));
|
||||||
|
|
||||||
|
// 打开文档以便添加内容
|
||||||
|
document.Open();
|
||||||
|
// 设置页面尺寸与图像尺寸一致
|
||||||
|
iTextSharp.text.Rectangle pageSize = new iTextSharp.text.Rectangle(bitmap.Width, bitmap.Height+50);
|
||||||
|
document.SetPageSize(pageSize);
|
||||||
|
// 将Bitmap转换为iTextSharp的Image对象
|
||||||
|
iTextSharp.text.Image image = ConvertBitmapToImageSharp(bitmap);
|
||||||
|
|
||||||
|
// 将图像添加到文档
|
||||||
|
document.NewPage();
|
||||||
|
document.Add(image);
|
||||||
|
|
||||||
|
// 关闭文档
|
||||||
|
document.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static iTextSharp.text.Image ConvertBitmapToImageSharp(Bitmap bitmap)
|
||||||
|
{
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
// 将Bitmap保存到MemoryStream中,使用PNG格式
|
||||||
|
bitmap.Save(ms, ImageFormat.Png);
|
||||||
|
|
||||||
|
// 从MemoryStream中创建iTextSharp的Image对象
|
||||||
|
return iTextSharp.text.Image.GetInstance(new MemoryStream(ms.ToArray()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定 URL 的文本文件内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url">文本文件的 URL</param>
|
||||||
|
/// <returns>返回文件内容的字符串,如果失败则返回 null</returns>
|
||||||
|
public static string GetTextFileContent(string url)
|
||||||
|
{
|
||||||
|
// 忽略 SSL 证书错误
|
||||||
|
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
|
||||||
|
using (WebClient client = new WebClient())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 下载文件内容
|
||||||
|
return client.DownloadString(url);
|
||||||
|
}
|
||||||
|
catch (WebException e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("请求错误: " + e.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
328
1200Gxml心电图绘制/服务/print.cs
Normal file
328
1200Gxml心电图绘制/服务/print.cs
Normal file
@ -0,0 +1,328 @@
|
|||||||
|
using _1200Gxml心电图绘制;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using 心电图绘制;
|
||||||
|
|
||||||
|
namespace 心电图绘制
|
||||||
|
{
|
||||||
|
internal class print
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 报告样式类型
|
||||||
|
/// </summary>
|
||||||
|
public int reportMode = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 报告样式类型名称
|
||||||
|
/// </summary>
|
||||||
|
public string strreportMode = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 走速
|
||||||
|
/// </summary>
|
||||||
|
public int cBoxSpeed = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 振幅
|
||||||
|
/// </summary>
|
||||||
|
public int cBoxAmplitude = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PDF文件名称
|
||||||
|
/// </summary>
|
||||||
|
public string filename = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 生成报告base64
|
||||||
|
/// </summary>
|
||||||
|
public string imagebase = string.Empty;
|
||||||
|
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<int> _longLeadInfo = new List<int>(); //存储任意长两导联的导联下标
|
||||||
|
private readonly List<int> _longLeadInfo3 = new List<int>(); //存储任意长三导联的导联下标
|
||||||
|
public string LeaderType; //导联类别
|
||||||
|
private Dictionary<int, List<float>> _ecgDataDicAfterFilter = new Dictionary<int, List<float>>(); //滤波后的数据都存在这个字典中
|
||||||
|
private int _filterIndex; //滤波时 此标志 指示从数组中 哪一个位置开始滤波
|
||||||
|
|
||||||
|
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;//定标电压
|
||||||
|
|
||||||
|
float[] valueConvert(float[] valueArray)
|
||||||
|
{
|
||||||
|
float[] quotients = valueArray.Select(n => n / 500).ToArray();
|
||||||
|
return quotients;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得心电诊断快照数据
|
||||||
|
/// </summary>
|
||||||
|
public void GetEcgViewDataImage(Image img, string addr, PatientInfo info, int type, string json)
|
||||||
|
{
|
||||||
|
_ecgDataDicAfterFilter.Clear();
|
||||||
|
|
||||||
|
// string ecgDataJsonStr = File.ReadAllText(Application.StartupPath + @"\60心拍心电图数据JSON.txt");
|
||||||
|
string ecgDataJsonStr = json;
|
||||||
|
leadDataModel LDM = JsonConvert.DeserializeObject<leadDataModel>(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());
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.orgname))
|
||||||
|
{
|
||||||
|
_reportTitleContent = info.orgname;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_reportTitleContent = "心电图报告";
|
||||||
|
}
|
||||||
|
|
||||||
|
_idStr = info.examid;//编号
|
||||||
|
collectTime = info.doctorDiagTime;//报告日期
|
||||||
|
//长两导的模式下 默认添加 第一导 和 第二导联 为 长显示两导联
|
||||||
|
_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] = "姓名:" + info.name;//姓名
|
||||||
|
ecgInfoList[1] = "性别:" + info.gender;
|
||||||
|
ecgInfoList[2] = "年龄:" + info.age;
|
||||||
|
ecgInfoList[3] = "RV5+SV1:" + info.rv5sv1plus + " mV";
|
||||||
|
ecgInfoList[4] = "PR间期:" + info.pr + " ms";
|
||||||
|
ecgInfoList[5] = "P/T/QRS°:" + info.pt + "°";
|
||||||
|
ecgInfoList[6] = "QT/QTC:" + info.qtqtc + " ms";
|
||||||
|
ecgInfoList[7] = "QRS时限:" + info.qrs + " ms";
|
||||||
|
ecgInfoList[8] = "RV5/SV1:" + info.rv5sv1 + " mV";
|
||||||
|
ecgInfoList[9] = "HR:" + info.hr + " bpm";
|
||||||
|
ecgInfoList[10] = "病室:" + info.ward;
|
||||||
|
ecgInfoList[11] = "床号";
|
||||||
|
ecgInfoList[12] = "住院号:" + info.regid;
|
||||||
|
SetAandP(); //设置增益和走速
|
||||||
|
|
||||||
|
var diagContent = info.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 (strreportMode == LeaderName15) filter += " 十五加一长导模式";
|
||||||
|
if (strreportMode == LeaderName18) filter += " 十八导模式";
|
||||||
|
if (reportMode == 2)
|
||||||
|
{
|
||||||
|
cpew.PrintBackGroundGrid(16, 196);
|
||||||
|
cpew.PrintLongReportHeadInfo(_reportTitleContent);
|
||||||
|
cpew.PrintLongEcgInfo(ecgInfoList, _idStr);
|
||||||
|
cpew.PrintLongDiagInfo(diagContent, info.doctorName,
|
||||||
|
collectTime, filter,
|
||||||
|
collectTime, "科室:" + info.DepartName, _amp, _ps, img, addr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cpew.PrintBackGroundGrid(40, 196); //(197-42)*12=1860像素
|
||||||
|
cpew.PrintReportHeadInfo(_reportTitleContent, collectTime);
|
||||||
|
cpew.PrintEcgInfo(ecgInfoList, _idStr);
|
||||||
|
cpew.PrintDiagInfo(diagContent, info.doctorName, filter,
|
||||||
|
collectTime, "科室:" + info.DepartName, _amp, _ps, img, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//6x2
|
||||||
|
if (reportMode == 0)
|
||||||
|
{
|
||||||
|
cpew.PrintEcgWave(8, 1, _leadindexdata);
|
||||||
|
cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient);
|
||||||
|
}
|
||||||
|
|
||||||
|
//6x2+2
|
||||||
|
if (reportMode == 1)
|
||||||
|
{
|
||||||
|
cpew.PrintEcgWave(8, 1, _longLeadInfo, _leadindexdata, _leadindexdata);
|
||||||
|
cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient, _longLeadInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//十二长导
|
||||||
|
if (reportMode == 2)
|
||||||
|
{
|
||||||
|
cpew.PrintLongEcgWave(5, 1, _leadindexdata);
|
||||||
|
//cpew.PrintLongEcgWave(8, 1, _leadindexdata);
|
||||||
|
cpew.PrintLongEcgLeadName(_calibrationVoltage * Coefficient);
|
||||||
|
}
|
||||||
|
|
||||||
|
//4*3 II长导模式
|
||||||
|
if (reportMode == 3)
|
||||||
|
{
|
||||||
|
cpew.PrintEcgWaveFourOne(8, 1, _leadindexdata, _leadindexdata);
|
||||||
|
cpew.PrintLeadNameFourOne(_calibrationVoltage * Coefficient, _longLeadInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//4*3+3 长导模式
|
||||||
|
if (reportMode == 4)
|
||||||
|
{
|
||||||
|
cpew.PrintEcgWaveFourThree(8, 1, _longLeadInfo3, _leadindexdata, _leadindexdata);
|
||||||
|
cpew.PrintLeadNameFourThree(_calibrationVoltage * Coefficient, _longLeadInfo3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//15x1+1导
|
||||||
|
if (strreportMode == LeaderName15)
|
||||||
|
{
|
||||||
|
cpew.PrintEcgWaveFifteen(8, 1, _leadindexdata);
|
||||||
|
cpew.PrintLeadNameFifteen(_calibrationVoltage * Coefficient, LeaderType);
|
||||||
|
}
|
||||||
|
|
||||||
|
//十八导
|
||||||
|
if (strreportMode == LeaderName18)
|
||||||
|
{
|
||||||
|
cpew.PrintEcgWaveEighteen(8, 1, _leadindexdata);
|
||||||
|
cpew.PrintLeadNameEighteen(_calibrationVoltage * Coefficient);
|
||||||
|
}
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 1://返回base64
|
||||||
|
imagebase = UniversalFun.ConvertToBase64String(_ecgBitMap, ImageFormat.Jpeg);
|
||||||
|
break;
|
||||||
|
case 2://生成pdf
|
||||||
|
string path = string.IsNullOrEmpty(ConfigurationManager.AppSettings["path"]) ? Application.StartupPath : ConfigurationManager.AppSettings["path"];
|
||||||
|
UniversalFun.ConvertBitmapToPdf(_ecgBitMap, path + @"\" + info.examid + @"\" + info.examid + ".pdf");
|
||||||
|
filename = @"/" + info.examid + @"/" + info.examid + ".pdf";
|
||||||
|
// _ecgBitMap.Save("心电图报告.jpg", ImageFormat.Jpeg);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//_sourceCegBmp = _ecgBitMap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置增益和走速和定标电压
|
||||||
|
/// </summary>
|
||||||
|
private void SetAandP()
|
||||||
|
{
|
||||||
|
if (cBoxSpeed == 0) //走速
|
||||||
|
{
|
||||||
|
_paperSpeed = 5;
|
||||||
|
_ps = "5mm/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxSpeed == 1)
|
||||||
|
{
|
||||||
|
_paperSpeed = 10;
|
||||||
|
_ps = "10mm/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxSpeed == 2) //走速
|
||||||
|
{
|
||||||
|
_paperSpeed = 12.5;
|
||||||
|
_ps = "12.5mm/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxSpeed == 3)
|
||||||
|
{
|
||||||
|
_paperSpeed = 25.0;
|
||||||
|
_ps = "25mm/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxSpeed == 4)
|
||||||
|
{
|
||||||
|
_paperSpeed = 50.0;
|
||||||
|
_ps = "50mm/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxAmplitude == 0) //振幅
|
||||||
|
{
|
||||||
|
_amplitude = 2.5;
|
||||||
|
_amp = "2.5mm/mV";
|
||||||
|
_calibrationVoltage = 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxAmplitude == 1)
|
||||||
|
{
|
||||||
|
_amplitude = 5.0;
|
||||||
|
_amp = "5mm/mV";
|
||||||
|
_calibrationVoltage = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxAmplitude == 2)
|
||||||
|
{
|
||||||
|
_amplitude = 10.0;
|
||||||
|
_amp = "10mm/mV";
|
||||||
|
_calibrationVoltage = 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxAmplitude == 3)
|
||||||
|
{
|
||||||
|
_amplitude = 20.0;
|
||||||
|
_amp = "20mm/mV";
|
||||||
|
_calibrationVoltage = 4.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cBoxAmplitude == 4)
|
||||||
|
{
|
||||||
|
_amplitude = 40.0;
|
||||||
|
_amp = "40mm/mV";
|
||||||
|
_calibrationVoltage = 8.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user