添加项目文件。

This commit is contained in:
lxd 2024-12-25 17:21:40 +08:00
parent e2f99bd99f
commit 6f9369ef8e
39 changed files with 6149 additions and 0 deletions

996
1200gFtp/EcgDataDraw_New.cs Normal file
View File

@ -0,0 +1,996 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.IO;
namespace ECG数据解析服务端
{
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>
/// 绘制心电波形
/// </summary>
public void Draw_EcgWave(int Draw_InitHeight,int BottomHeight,int wucan)
{
Ecg_Pen = new Pen(Color.Black, float.Parse("2"));
double IntervalPixCountPerPoint = double.Parse("0.302");
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 / (LeadInfo.Count / 2)) / 2 + ((i - 6) * LeadHeight);
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);
}
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;
}
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.165;
}
catch { }
SecondPosition.Y = BaseLine - (Int32)y_values;//后一点Y轴位置
double x = double.Parse(b.ToString()) * IntervalPixCountPerPoint*1;
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_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.302");
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("宋体", 40);
Brush brush = Brushes.Black;
PointF point2 = new PointF(Ecg_Canvas.Width/2-200, 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 = 400;
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, y, 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>
/// <param name="ap"></param>
public void Draw_analysisParas(analysisParas ap)
{
Pen pen_1 = new Pen(Color.Black, float.Parse("2"));
Font font1 = new Font("楷体", 25);
Brush brush = Brushes.Black;
PointF point2 = new PointF(20,60);
Ecg_Graphics.DrawString("ID"+ap.patientid, font1, brush, point2);//患者id
PointF point3 = new PointF(420, 60);
Ecg_Graphics.DrawString(ap.patientName, font1, brush, point3);//姓名
PointF point4 = new PointF(570, 60);
Ecg_Graphics.DrawString(ap.gender, font1, brush, point4);//性别
PointF point5 = new PointF(720, 60);
Ecg_Graphics.DrawString(ap.age, font1, brush, point5);//年龄
PointF point6 = new PointF(20, 110);
Ecg_Graphics.DrawString("HR " + ap.heartRate+" bpm", font1, brush, point6);//心率
PointF point7 = new PointF(20, 140);
Ecg_Graphics.DrawString("P " + ap.P+" ms", font1, brush, point7);//P波
PointF point8= new PointF(20, 170);
Ecg_Graphics.DrawString("QRS " + ap.QRS + " ms", font1, brush, point8);//QRS波
PointF point9 = new PointF(20, 200);
Ecg_Graphics.DrawString("RR " + ap.RR + " ms", font1, brush, point9);//RR
PointF point10 = new PointF(20, 230);
Ecg_Graphics.DrawString("PR " + ap.PR + " ms", font1, brush, point10);//PR
PointF point11 = new PointF(20, 260);
Ecg_Graphics.DrawString("PQ " + ap.PQ + " ms", font1, brush, point11);//PQ
PointF point12 = new PointF(20, 290);
Ecg_Graphics.DrawString("QT " + ap.QT + " ms", font1, brush, point12);//QT
PointF point13 = new PointF(20, 320);
Ecg_Graphics.DrawString("QTc " + ap.QTc + " ms", font1, brush, point13);//QTc
PointF point14 = new PointF(20, 350);
Ecg_Graphics.DrawString("P/QRS/T " + ap.P_degrees+"/"+ ap.QRS_degrees+ "/" + ap.T_degrees+ " °", font1, brush, point14);//P/QRS/T 电轴
PointF point15 = new PointF(20, 380);
Ecg_Graphics.DrawString("RV5/SV1 " + ap.RV5+"/"+ ap.SV1+" mV", font1, brush, point15);//RV5/SV1
PointF point16 = new PointF(20, 410);
Ecg_Graphics.DrawString("RV5+SV1 " + ap.RV5PLUSSV1 + " mV", font1, brush, point16);//RV5+SV1
PointF point17 = new PointF(20, 440);
Ecg_Graphics.DrawString("QT/QTc " + ap.QT+"/"+ap.QTc+" ms", font1, brush, point17);//QT/QTc
Font font2 = new Font("宋体", 30,FontStyle.Bold);
PointF point18 = new PointF(1000, 110);
Ecg_Graphics.DrawString("诊断信息:", font2, brush, point18);//诊断信息
PointF point21 = new PointF(2500, 440);
Ecg_Graphics.DrawString("报告医生:", font2, brush, point21);//报告医生
PointF point19 = new PointF(120, 2300);
Ecg_Graphics.DrawString("25mm/s 10mm/mV", font1, brush, point19);//增益 走速
PointF point20 = new PointF(2500, 2300);
Ecg_Graphics.DrawString(ap.collectTime, font1, brush, point20);//采集时间
}
/// <summary>
/// 绘制心电图的背景网格
/// </summary>
public void Draw_EcgBackGroundGrid(int GridHeight)
{
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;
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, GridHeight, x, Ecg_Canvas.Height);
}
x += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
if (x < Ecg_Canvas.Width && GridHeight < Ecg_Canvas.Height)
{
Ecg_Canvas.SetPixel(x, GridHeight, Color.Black);
}
else
{
x = 0;
break;
}
}
shuxianFlag = true;
if (GridHeight % 5 == 0)
{
Ecg_Graphics.DrawLine(Ecg_Pen, 0, GridHeight, Ecg_Canvas.Width, GridHeight);
}
GridHeight += int.Parse(Math.Round(double.Parse(PointCountPerMM.ToString("0.0"))).ToString());
if (GridHeight > 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" };
//报告标题下画一条线
Pen Ecg_Penx = new Pen(Color.Black, float.Parse("3"));
Ecg_Graphics.DrawLine(Ecg_Penx, 0, 100, 3319, 100);
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("宋体", 25);
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("宋体", 25);
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;
//}
}
}

131
1200gFtp/EcgViewModel.cs Normal file
View File

@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class EcgViewModel
{
///// <summary>
///// 机构
///// </summary>
//public OrgModel Org { get; set; }
/// <summary>
/// 病例ID
/// </summary>
public Guid? CaseId { get; set; }
/// <summary>
/// 患者ID
/// </summary>
public Guid? PatientId { get; set; }
/// <summary>
/// 是否可以编辑界面
/// </summary>
public bool IsEdit { get; set; }
/// <summary>
/// 患者姓名
/// </summary>
public string PatientName { get; set; }
/// <summary>
/// 性别
/// </summary>
public string Gender { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int? Age { get; set; }
/// <summary>
/// 部门
/// </summary>
public string Department { get; set; }
/// <summary>
/// 病房号
/// </summary>
public string RoomNum { get; set; }
/// <summary>
/// 病床号
/// </summary>
public string BedNum { get; set; }
/// <summary>
/// 住院号
/// </summary>
public string HospNum { get; set; }
/// <summary>
/// 心率
/// </summary>
public int? Heart { get; set; }
/// <summary>
/// PR间期
/// </summary>
public int? PR { get; set; }
/// <summary>
/// QRS时限
/// </summary>
public int? QRS { get; set; }
public int? QT { get; set; }
public int? QTc { get; set; }
/// <summary>
/// P电轴
/// </summary>
public double? PAxis { get; set; }
/// <summary>
/// QRS电轴
/// </summary>
public double? QRSAxis { get; set; }
/// <summary>
/// T电轴
/// </summary>
public double? TAxis { get; set; }
/// <summary>
/// P时限
/// </summary>
public int? PDuration { get; set; }
/// <summary>
/// T时限
/// </summary>
public int? TDuration { get; set; }
public double? RV5 { get; set; }
public double? SV1 { get; set; }
/// <summary>
/// 自动诊断
/// </summary>
public string AutoResult { get; set; }
/// <summary>
/// 检查开始日期
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 检查结束日期
/// </summary>
public DateTime? EndTime { get; set; }
/// <summary>
/// 心电数据
/// </summary>
public Dictionary<string, string> DicData { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// 医生ID
/// </summary>
public Guid? DocId { get; set; }
}
}

24
1200gFtp/FLYecgReport.cs Normal file
View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class FLYecgReport
{
public string appointmentId { get; set; }
public string reportTime { get; set;}
public string reportDoctor { get; set; }
public string reportDoctorCode { get; set; }
public string reportDepartmentCode { get; set; }
public string reportDepartmentName { get; set; }
public string reportHospitalCode { get; set; }
public string reportHospitalName { get; set; }
public string dcmFileUrl { get; set; }
public string isAbnormal { get; set; }//是否正常 是否异常0阳性1阴性
public string remark { get; set; }//结论
public int status { get; set; }
}
}

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class FlyHisEcgDataModel
{
public int total { get; set; }
public List<patientInfo> rows { get; set; }
}
public class patientInfo
{
public string jianchaid { get; set; }
public string jianchabh { get; set; }
public string name { get; set; }
public string sfz { get; set; }
public string birthdate { get; set; }
public int age { get; set; }
public string sex { get; set; }
public string yiyuanname { get; set; }
public string yiyuanid { get; set; }
public string kaifangsj { get; set; }
public string departmentCode { get; set; }
public string departmentName { get; set; }
public string resDoctorName { get; set; }
public string resDoctorCode { get; set; }
public string nation { get; set; }
public string patientCode { get; set; }
public string visitType { get; set; }
public List<projectsInfo> projects { get; set; }
public int code { get; set; }
public string msg { get; set; }
}
public class projectsInfo
{
public string jianchamingcheng { get; set; }
public string nhbm { get; set; }
public string category { get; set;}
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
//福乐云HIS的token信息结构
public class FlyHisTokenMsgModel
{
public int code { get; set; }
public dataInfo data { get; set; }
}
public class dataInfo
{
public string access_token { get; set; }
public string expires_in { get; set; }
}
}

239
1200gFtp/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,239 @@
namespace _1200gFtp
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button4 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(51, 32);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(102, 39);
this.button1.TabIndex = 0;
this.button1.Text = "开始监听";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(51, 96);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(283, 28);
this.textBox1.TabIndex = 1;
//
// button2
//
this.button2.Location = new System.Drawing.Point(196, 32);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(138, 39);
this.button2.TabIndex = 2;
this.button2.Text = "FTP接口调用";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(417, 88);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(102, 39);
this.button3.TabIndex = 3;
this.button3.Text = "xml解析";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 60000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button4
//
this.button4.Location = new System.Drawing.Point(816, 28);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(138, 39);
this.button4.TabIndex = 4;
this.button4.Text = "短信群发";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// textBox2
//
this.textBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox2.Location = new System.Drawing.Point(3, 24);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox2.Size = new System.Drawing.Size(1056, 444);
this.textBox2.TabIndex = 5;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1.Location = new System.Drawing.Point(110, 189);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(106, 22);
this.checkBox1.TabIndex = 6;
this.checkBox1.Text = "显示信息";
this.checkBox1.UseVisualStyleBackColor = true;
//
// button5
//
this.button5.Location = new System.Drawing.Point(290, 182);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(132, 45);
this.button5.TabIndex = 7;
this.button5.Text = "清空文本框";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(426, 32);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(144, 39);
this.button6.TabIndex = 8;
this.button6.Text = "rabbitMQ调用";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(609, 33);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(176, 39);
this.button7.TabIndex = 9;
this.button7.Text = "his03调用";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(639, 76);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(176, 50);
this.button8.TabIndex = 10;
this.button8.Text = "FTP";
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button8);
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Controls.Add(this.button5);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.button7);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.button6);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(1062, 237);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "操作";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textBox2);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 237);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(1062, 471);
this.groupBox2.TabIndex = 12;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "信息";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1062, 708);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "云心电ECG数据解析服务端2024122501";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
}
}

1502
1200gFtp/Form1.cs Normal file

File diff suppressed because it is too large Load Diff

200
1200gFtp/Form1.resx Normal file
View File

@ -0,0 +1,200 @@
<?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="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQUPYAUFD6AFBQ
1QBRUfUGUVH6BlJS7gNPT/YAUFD6AE9O+gBQTfsAUFT/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ
7gFQUPkYUFD5SVBQ+WdPT/ppT0/4WU9P+0FQUPouT035F1FH/ANQT/oAUFD9AFBQ/wAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AABQUPYAUFD5K1BQ+p5QUPr0T0/6/09P+v9PT/r/T0/6/k9P+t9PTvqhUE/6aFBQ+zBRUf8EUFD4AFBQ
9gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAFBQ9QlQUPqIUFD6+VBP+v9PT/r+UE/6/1BQ+v9PT/r/T0/6/09P+v9QUPr+UFD6x09P
/G9QUPgYTU38AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAUFD6K09P+sNPT/r/T0/6/1BQ+v9PT/r/T0/6/09P+v9PT/r/T0/6/lBQ
+v9QUPr/UFD79E9P+qROTvs2UFD5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFR9QBQUPpMUFD74k9P+v9PT/v+UFD6/09P+v9QUPr/UFD6/09P
+v9QUPr/T0/6/09P+v9PT/r/UFD6/09P+r5QUPk4UFD5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQUP4AUFD2DU9P+olPT/r6T0/7/k9P+v5QUPr/UFD6/09P
+v9QUPr/T0/6/1BP+v9QUPr/T0/6/09P+/5QUPr/UE/6/E9P+r5QUPk3UFD8AQAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUFD2AFFR/wFQUPs+UE/62VBP+v9PT/r/T0/6/1BQ
+/9PT/r/T0/6/1BQ+v9PT/r/T0/6/09P+v5QT/r/T0/6/09P+v5PT/r/T0/6/E9P+qRQUPsYTk75AAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ+wBOT/8AUFD7Ik9P+6ZPT/r9UE/6/09P
+v9PT/v+UFD6/1BP+v9PT/r/T0/7/k9P+v9PT/r/UFD6/09P+/5PT/r+T0/6/1BQ+v9PT/r/T0/79FBQ
+mhNTfkFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ/wBQUPoATk74AFBQ+iRQUPmbT0/6/FBQ
+v9OTvr/TU36/1BQ+v9MTPr/TEz6/05O+/5PT/v+UE/6/1BQ+v9QT/r/UFD7/1BQ+v9PT/r+UE/6/09P
+v9QUPr/UFD6xU5O+StQUPoAAAAAAAAAAAAAAAAAUFD/AFBQ+QBQUPoAT0/3AFBQ+hZPT/lJUFD6sFBP
+v1QT/r+Tk76/11d+v6Fhfz/l5f8/4eH+/9wcPv/V1f6/0xM+v9PT/r/UFD6/09P+v9QT/r/UE/6/09P
+v5QUPr/T0/6/lBQ+v9QUPr3UFD6YVBQ+gUAAAAAAAAAAAAAAABQUPYAUFD5E1BQ+kJPT/tuT0/6oE9P
+upPT/r/T0/7/k9P+v9UVPr/n5/8/vT0/////////Pz//9ra/v+urv3/e3v7/1VV+v9OTvr/UFD6/1BP
+v9QUPr/T0/6/1BQ+v9PT/r+T0/6/k9P+v9PT/qoUFD6GQAAAAAAAAAAUFD7AFBQ+i5QUPmhT0/62VBQ
+v5PT/v/T0/6/09P+/5QT/r+Tk76/2pq+/7U1P7////////////////////////////i4v7/qqr9/2Rj
+/9NTfr/UFD6/09P+v9PT/r/T0/7/k9P+v5QT/r/T0/6/1BQ+9hQUPsrAAAAAAAAAABQUPsRUFD6kFBQ
+v9QUPr/T0/6/09P+v9PT/r/UFD6/1BQ+v9MTPr/fn77/+bm/v//////////////////////////////
///4+P//wcH9/2xs+/9PT/r+T0/6/09P+v9QUPr/UFD6/1BQ+v9QT/r/UFD7+VBQ/EBMTPsAAAAAAFBQ
+jFQUPrnUFD6/1BQ+v9PT/r+T0/6/1BQ+v9PT/v+T0/6/0tL+v+QkPz/9/f/////////////////////
///////////////////7+///wsL9/2Ji+/9OTvr+UE/6/09P+v9QUPv/UFD6/09P+v9PT/v/Tk77YkxM
+wUAAAAAT0/6Ok9P+v9QUPr/T0/6/1BQ+v9PT/r+T0/6/lBP+v9QUPr/S0v6/5OT/P/6+v//////////
///////////////////////////////////6+v//fX38/k5O+v9QUPr/UFD7/09P+v5QUPr/T0/6/1BQ
+v9QUPtrT0/8BwAAAABPT/s6T0/7/lBQ+v9QUPr/T0/7/k9P+/5PT/r/T0/6/09P+/5LS/r+kpL8//n5
//////////////////////////////////////////////39//+EhPz/T0/6/lBQ+v9QUPv/T0/6/lBQ
+v5QUPr/UE/6/1BQ+2dQUfwGAAAAAFBQ+zRQUPrvUFD6/1BQ+v9QUPr/UFD6/1BQ+v9QT/v+UFD6/0tL
+v+Njfz/9PT////////////////////////////////////////+/v//z8/+/2Zm+/5OTvr+UFD7/09P
+v9QUPr/UFD6/1BQ+v9QUPr/UFD7UFBQ/gEAAAAAUE/6J1BP+sxPT/r/UFD6/1BQ+v9PT/v+UFD6/1BQ
+v9QUPr/TEz6/4SE/P/r6/7/////////////////////////////////+Pj//8rK/v9ycvz/T0/6/1BP
+v9QUPr/UFD6/1BQ+v9PT/r/T0/6/k9P+vpPT/tAUFD/AAAAAABQUPwXUFD7o1BQ+v9PT/r/UFD6/09P
+v9QUPr/UFD6/1BQ+v9OTvr/bm77/9bW/v///////////////////////////+np/v+qqv3/Y2P7/kxM
+v5PT/r+T0/6/k9P+v5QUPr/UFD6/1BQ+/5QT/v/T0/61E5P+ikAAAAAAAAAAFBQ/QZQUPtoUFD6/lBQ
+v9PT/r/T0/6/lBQ+v9PT/r/UFD6/09P+v9UVPr/np78//P0/////////////+Li/v+6uv3/goL7/1VV
+v9NTfr+UE/6/1BQ+v9QUPr/UFD6/1BQ+v9QUPr/UFD6/k9P+v9PT/uXT0/7EgAAAAAAAAAAUFD9AFBP
+jpQUPrdUFD6/1BQ+v9QUPv+UFD6/1BQ+v9QUPr/UFD6/05O+v9cXPr/ior8/6Sj/P+Skvz+dXX7/11d
+v9MTPr/T0/6/1BQ+/9QUPr/UFD6/1BQ+v9QUPr/UFD6/1BQ+v9PT/r/T0/661BQ+1JSUvwDAAAAAAAA
AAAAAAAAUE/4DVBQ+pFQUPr+UE/6/1BQ+v9PT/r/UE/7/lBQ+v9QUPn/UFD6/05O+v9QUPr/VVX6/k9P
+v9NTfr/T0/6/1BQ+v9QUPr/UFD6/1BQ+v9QUPr/UFD6/1BQ+/9QUPr/T0/7/lBQ+v9QUPqsUFD6HFFR
/AAAAAAAAAAAAAAAAABQS/8AUFD7Ok9P+sxQT/r/UFD7/k9P+v5QUPv/UFD6/1BQ+v9QUPr/UFD6/09P
+v5PT/r/T0/7/k9P+v5QUPr/UFD6/1BQ+v9QUPr/T0/6/lBQ+v9PT/v+T0/6/09P+v5QUPr/UFD651BQ
+ldQUPgCAAAAAAAAAAAAAAAAAAAAAFBQ8QBQUPwDUFD6cU9P+vBQUPr/UFD6/1BQ+v9PT/v+UFD6/1BQ
+v9QUPr/UFD6/1BQ+v9QUPr/UE/6/1BP+v9QUPr/UFD6/1BQ+v9PT/r/UFD6/09P+v5PT/r+UFD7/1BQ
+vhQUPqKUFD9C1BQ+QAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ+wBQUPcNT0/5g1BQ+vBQUPr/UFD6/09P
+v5QUPr/UFD6/1BQ+v9QUPr/UFD6/09P+v5QUPr/UFD6/1BQ+v9QUPr/UFD6/1BQ+v9QUPr/UFD6/1BQ
+v9PT/r8UFD6p01N+xpQUP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ9gBQUPcNUFD6g1BQ
+u1PT/v/UFD6/09P+v9QUPr/T0/6/lBQ+v9QUPr/UFD6/1BQ+v9QUPr/UFD6/1BQ+v9QUPr+UFD6/lBQ
+v9PT/r/UFD68lBQ+qJQUPwpTEz7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ
9wBQUPcNUFD6alBQ+sxQUPr+T0/6/1BQ+v9QUPr+UFD6/1BQ+v9QUPr/UFD6/1BQ+v9QUPr/UFD6/1BQ
+v9PT/r/UFD6/1BQ+ttQUPqAUFD6E1BQ/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAFBQ+ABQUPcAUFD7OFBQ+oBQUPrQUFD6/1BQ+v9QUPr/UFD6/1BQ+v9QUPr/UFD6/1BQ
+v9QUPr/UFD6/1BQ+uBQUPuRUFD6R1BQ9wtQUPsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ+wBQUPsAT0//BlBQ+zZQUPpqT0/6nU9P+tNQUPnqT0/6/VBQ
+v9PT/rxUFD62lBQ+rNQUPp8T0/6Q09P/Q1QUPkAUFD4AFBQ9gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQ/wBQUPwAUFD5AFFR/wNOTvsVT0/6KVBQ
+TJPT/o5UFD6Ok9P+jVQUPosUFD6HVBQ+whOTv4AT0/8AFFR/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQUP8AUFD8AE9P
+wBPT/oAUFD5AE9P+gBQUPoAT0/6AFBQ+gBQUPoAUFD7AFBQ9QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//w////wA///8AD//+AAf//gAD//4AAf/8AAB/+AAAf/gAAD/wAAA/wA
AAHgAAABwAAAAYAAAAGAAAAAgAAAAIAAAACAAAAAgAAAAYAAAAGAAAABwAAAAcAAAAPgAAAD4AAAB/AA
AAf4AAAf/AAAP/8AAH//gAH//+AH//////8=
</value>
</data>
</root>

289
1200gFtp/FtpHelper.cs Normal file
View File

@ -0,0 +1,289 @@
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 _1200gFtp
{
public class FtpHelper
{
//基本设置
//private static string ftppath = @"ftp://" + "10.1.99.5" + "/";
//private static string username = "";
//private static string password = "";
private static string ftppath = @"ftp://" + ConfigurationManager.AppSettings["ftpUrl"] + "/";
private static string username = ConfigurationManager.AppSettings["ftpName"];
private static string password = ConfigurationManager.AppSettings["ftpPwd"];
//获取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 + "/";
try
{
FtpWebRequest request = null;
try
{
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 = 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 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);
}
}
}
}

278
1200gFtp/Hl7EcgOptions.cs Normal file
View File

@ -0,0 +1,278 @@
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.Xml;
namespace ECG数据解析服务端
{
public class Hl7EcgOptions
{
float[] valueConvert(float[] valueArray)
{
float[] quotients = valueArray.Select(n => n / 9).ToArray();//把数值缩小9倍 这是用标准数据进行标定得到的 缩小倍数系数
return quotients;
}
/// <summary>
/// 读取HL7文件中的患者信息和心电分析参数
/// </summary>
/// <param name="xmlFilePath"></param>
public analysisParas getAnalysisParas(string xmlFilePath)
{
try
{
FileInfo fi = new FileInfo(xmlFilePath);
XmlDocument xmlDoc = new XmlDocument();
XmlReaderSettings settings = new XmlReaderSettings();
settings.IgnoreComments = true;//忽略文档里面的注释
XmlReader reader = XmlReader.Create(xmlFilePath, settings);
xmlDoc.Load(reader);
XmlNodeList xnList = xmlDoc.DocumentElement.GetElementsByTagName("annotation");
analysisParas ap = new analysisParas();
//先从hl7 ecg xml文件中读取心电数据
XmlNodeList xnListx1 = xmlDoc.DocumentElement.GetElementsByTagName("digits");
// Dictionary<int, List<float>> EcgTable = new Dictionary<int, List<float>>();
int leadDataIndex = 0;
for (int i = 0; i < 12; i++)
{
string[] ecgDataArray = new string[xnListx1.Item(leadDataIndex + i).InnerText.Split(' ').Length];
ecgDataArray = xnListx1.Item(leadDataIndex + i).InnerText.Split(' ');
//List<float> ecg_List = valueConvert(Array.ConvertAll(ecgDataArray, float.Parse)).ToList<float>();
List<float> ecg_List = new List<float>();
for (int b = 0; b < ecgDataArray.Length; b++)
if (!string.IsNullOrEmpty(ecgDataArray[b]))
ecg_List.Add(float.Parse(ecgDataArray[b]) / 9);
if (i == 0) ap.LEAD_I = ecg_List;
if (i == 1) ap.LEAD_II = ecg_List;
if (i == 2) ap.LEAD_III = ecg_List;
if (i == 3) ap.LEAD_AVR = ecg_List;
if (i == 4) ap.LEAD_AVL = ecg_List;
if (i == 5) ap.LEAD_AVF = ecg_List;
if (i == 6) ap.LEAD_V1 = ecg_List;
if (i == 7) ap.LEAD_V2 = ecg_List;
if (i == 8) ap.LEAD_V3 = ecg_List;
if (i == 9) ap.LEAD_V4 = ecg_List;
if (i == 10) ap.LEAD_V5 = ecg_List;
if (i == 11) ap.LEAD_V6 = ecg_List;
// EcgTable.Add(i, ecg_List);
}
XmlNodeList xnList1 = xmlDoc.DocumentElement.GetElementsByTagName("family");
ap.patientName = xnList1[0].InnerText;//姓名
XmlNodeList xnList2 = xmlDoc.DocumentElement.GetElementsByTagName("administrativeGenderCode");
string valStr = xnList2[0].OuterXml;
string sexStr = valStr.Substring(valStr.IndexOf("code="), valStr.IndexOf("codeSystem=") - valStr.IndexOf("code=")).Replace("code=", "").Replace("\"", "").Trim();//性别
if (sexStr.Trim() == "M")
ap.gender = "男";
if (sexStr.Trim() == "F")
ap.gender = "女";
XmlNodeList xnList4 = xmlDoc.DocumentElement.GetElementsByTagName("birthTime");
string birthday = xnList4[0].OuterXml;//出生日期
birthday = birthday.Substring(birthday.IndexOf("value="), birthday.IndexOf("xmlns=") - birthday.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
if (birthday.Length > 0)
{
ap.birthDay = birthday;
int year = int.Parse(ap.birthDay.Substring(0, 4));
ap.age = (DateTime.Now.Year - year).ToString();
}
XmlNodeList xnList5 = xmlDoc.DocumentElement.GetElementsByTagName("patientid");
string patientId = xnList5[0].OuterXml;//患者id
patientId = patientId.Substring(patientId.IndexOf("extension="), patientId.IndexOf("xmlns=") - patientId.IndexOf("extension=")).Replace("extension=", "").Replace("\"", "").Trim();
ap.patientid = patientId;
//获取日期和时间
XmlNodeList xnList3 = xmlDoc.DocumentElement.GetElementsByTagName("effectiveTime");
string collStr = xnList3[0].FirstChild.OuterXml;
string collectTime = collStr.Substring(collStr.IndexOf("value="), collStr.IndexOf("xmlns=") - collStr.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();//采集时间
if (collectTime.Length > 0)
{
ap.collectTime = collectTime.Insert(4, "-").Insert(7, "-").Insert(10, " ").Insert(13, ":").Insert(16, ":");//转换成日期时间格式
}
foreach (XmlNode xnx in xnList)
{
// string sss = xnx.FirstChild.Name;
string OuterXml1 = xnx.FirstChild.OuterXml;
// string xxx = xnx.LastChild.Name;
string OuterXml2 = xnx.LastChild.OuterXml;
if (OuterXml1.Contains("MDC_ECG_HEART_RATE"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.heartRate = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_TIME_PD_P") && !OuterXml1.Contains("MDC_ECG_TIME_PD_PR") && !OuterXml1.Contains("MDC_ECG_TIME_PD_PQ"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.P = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_TIME_PD_QRS"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.QRS = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_TIME_PD_RR"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.RR = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_TIME_PD_PR"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.PR = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_TIME_PD_PQ"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.PQ = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_TIME_PD_QT") && !OuterXml1.Contains("MDC_ECG_TIME_PD_QTc"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.QT = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_TIME_PD_QTc"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.QTc = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_ANGLE_P_FRONT"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.P_degrees = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_ANGLE_QRS_FRONT"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.QRS_degrees = valueStr;
}
if (OuterXml1.Contains("MDC_ECG_ANGLE_T_FRONT"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.T_degrees = valueStr;
}
if (OuterXml1.Contains("Biocare_RV5") && !OuterXml1.Contains("Biocare_RV5_PLUS_SV1"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.RV5 = valueStr;
}
if (OuterXml1.Contains("Biocare_SV1"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.SV1 = valueStr;
}
if (OuterXml1.Contains("Biocare_RV5_PLUS_SV1"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.RV5PLUSSV1 = valueStr;
}
if (OuterXml1.Contains("Biocare_PAPER_SPEED"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.paperSpeed = valueStr + "mm/s";
}
if (OuterXml1.Contains("Biocare_GAIN"))
{
string valueStr = OuterXml2.Substring(OuterXml2.IndexOf("value="), OuterXml2.IndexOf("unit=") - OuterXml2.IndexOf("value=")).Replace("value=", "").Replace("\"", "").Trim();
ap.Gain = valueStr + "mm/mV";
}
}
return ap;
}
catch (Exception ex) { }
return null;
}
/// <summary>
/// 根据HL7-ECG XML文件 生成心电图
/// </summary>
/// <param name="path">HL7-ECG XML 文件的路径</param>
/// <param name="reportInfo">心电图报告标题</param>
/// <returns></returns>
public string createEcgBmpByHL7XMLFile(string path, string reportInfo)
{
analysisParas ap = getAnalysisParas(path);
FileInfo fi = new FileInfo(path);
XmlDocument xmlDoc = new XmlDocument();
XmlReaderSettings settings = new XmlReaderSettings();
settings.IgnoreComments = true;//忽略文档里面的注释
XmlReader reader = XmlReader.Create(path, settings);
xmlDoc.Load(reader);
XmlNodeList xn = xmlDoc.ChildNodes;
XmlNodeList xnList = xmlDoc.DocumentElement.GetElementsByTagName("digits");
Dictionary<int, List<float>> EcgTable = new Dictionary<int, List<float>>();
int leadDataIndex = 0;
for (int i = 0; i < 12; i++)
{
string[] ecgDataArray = new string[xnList.Item(leadDataIndex + i).InnerText.Split(' ').Length];
ecgDataArray = xnList.Item(leadDataIndex + i).InnerText.Split(' ');
List<float> ecg_List = new List<float>();
for (int b = 0; b < ecgDataArray.Length; b++)
if (!string.IsNullOrEmpty(ecgDataArray[b]))
ecg_List.Add(float.Parse(ecgDataArray[b]) / 9);
EcgTable.Add(i, ecg_List);
}
EcgDataDraw_New EDDN = new EcgDataDraw_New();
var btmp = new Bitmap(3319, 2357);
Graphics Ecg_Graphics = Graphics.FromImage(btmp);
List<int> leadInfo = new List<int>();
for (int i = 0; i < 12; i++)
leadInfo.Add(i);
EDDN.InitEcgParameter(btmp, 12, EcgTable, 300, leadInfo);//初始化
EDDN.Draw_EcgBackGroundGrid(500);//画背景网格
EDDN.Draw_EcgWave(500, 0, 0);//画波形
EDDN.Draw_analysisParas(ap);//画患者信息和分析参数
EDDN.Draw_CalibrationVoltage_And_LeadName();//画定标电压和导联名称
EDDN.Draw_ReportHeadInfo(reportInfo, "", "");
//string bmpPath = fi.DirectoryName + @"\EcgDataFiles\" + reportInfo + ".jpg";
// string RotateEcgDataFilesPath = fi.DirectoryName + @"\RotateEcgDataFiles\" + reportInfo+ ".jpg";
//string xmlPath = fi.DirectoryName + @"\XmlDataFiles\" + reportInfo + ".xml";
string ecgBmpPath = fi.DirectoryName + @"\" + ap.patientName + "[" + Guid.NewGuid().ToString() + "].jpg";
btmp.Save(ecgBmpPath, ImageFormat.Jpeg);
//btmp.RotateFlip(RotateFlipType.Rotate90FlipNone);//顺时针旋转90°
//btmp.Save(RotateEcgDataFilesPath, ImageFormat.Jpeg);
btmp.Dispose();
reader.Close();
// fi.CopyTo(xmlPath, true);
//string returnStr = FtpHelper.FileUpLoad(bmpPath, ConfigurationManager.AppSettings["path1"], reportInfo + ".jpg");//上传 png文件
// textBox2.AppendText(bmpPath + "\r\n" + reportInfo + ".jpg" + "\r\n FTP" + returnStr + "\r\n"); // FtpHelper.FileUpLoad(xmlPath, ConfigurationManager.AppSettings["path1"], reportInfo.Split('_')[0] + ".xml");//上传 xml文件
//dataSubmit(reportInfo);//提交数据
//SqliteOptions_sql.CreateInstance().SqliteAdd("INSERT INTO [dbo].[tb_Pecg] ([ID],[medicalSN],[patientName],[sex],[birthday],[createDate],[ecgFilePath]) VALUES ('" + Guid.NewGuid().ToString() + "','" + reportInfo.Split('_')[0] + "','" + reportInfo.Split('_')[1] + "','" + reportInfo.Split('_')[2] + "','" + birthday + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + (reportInfo.Split('_')[0] + ".jpg") + "')");
//fi.Delete();
//textBox2.AppendText(label1.Text + "\r\n");
//label1.Text = string.Empty;
return ecgBmpPath;
}
}
}

188
1200gFtp/OssUnity.cs Normal file
View File

@ -0,0 +1,188 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Windows.Forms;
using Aliyun.OSS;
using Aliyun.OSS.Common;
namespace _1200gFtp
{
/// <summary>
/// 阿里云上传下载数据类
/// </summary>
public class OssUnity
{
public readonly OssClient _client;
const string endpoint = "http://oss-cn-beijing.aliyuncs.com";
//北京科麦迪账号下的 华东2 上海 oss
const string accessId = "LTAI5tA3YFzqR2qHSLYZP68T";
const string accessKey = "efjTmIWXCGcJO4vmnHnNhKsuXbiVo5";
public OssUnity()
{
_client = new OssClient(endpoint, accessId, accessKey);
}
/// <summary>
/// Bucket数据容器,出错返回错误信息.
/// </summary>
/// <param name="bucketName">Bucket名称</param>
/// <param name="msg">错误信息</param>
/// <returns>是否执行成功</returns>
public bool CreateBucket(string bucketName, out string msg)
{
bool reslut = true;
msg = string.Empty;
try
{
var buckets = _client.ListBuckets();
if (buckets.All(b => b.Name != bucketName))
{
_client.CreateBucket(bucketName);
}
}
catch (OssException ex)
{
reslut = false;
msg = ex.Message;
}
return reslut;
}
/// <summary>
/// 上传文件到Bucket容器
/// </summary>
/// <param name="bucketName">Bucket容器</param>
/// <param name="key">Key值</param>
/// <param name="path">文件路径</param>
/// <returns>返回MD5值</returns>
public string PutObject(String bucketName, String key, String path)
{
using (var fs = File.Open(path, FileMode.Open))
{
var metadata = new ObjectMetadata { ContentLength = fs.Length };
var result = _client.PutObject(bucketName, key, fs, metadata);
return result.ETag;
}
}
/// <summary>
/// 下载数据
/// </summary>
/// <param name="pb">进度条</param>
/// <param name="lbl">提示文本框</param>
/// <param name="saveFileName">文件保存路径</param>
/// <param name="bucketName">bucket名称</param>
/// <param name="key">KEY值</param>
/// <returns></returns>
public bool DownloadData(ProgressBar pb, Label lbl, string saveFileName, string bucketName, string key)
{
bool result = false;
short ticks = 0;
try
{
if (pb != null)
{
//if (pb.InvokeRequired)
//{
// pb.BeginInvoke((Action)(() =>
// {
// pb.Maximum = 100;
// }));
//}
//else
pb.Maximum = 100;
}
var obj = _client.GetObject(bucketName, key);
using (var requestStream = obj.Content)
{
var buf = new byte[1024];
using (var fs = File.Open(saveFileName, FileMode.OpenOrCreate))
{
var len = 0;
while ((len = requestStream.Read(buf, 0, 1024)) != 0)
{
fs.Write(buf, 0, len);
float percent = fs.Length / (float)obj.Metadata.ContentLength;
var n = (int)Math.Ceiling(percent * 100);
Application.DoEvents();
if (pb != null)
{
pb.Value = n <= 100 ? n : 100;
//pb.Refresh();
}
if (lbl != null)
{
lbl.Text = percent.ToString("00.00%");
//lbl.Refresh();
}
}
}
}
result = true;
}
catch (Exception ex)
{
ticks++;
if (ticks < 3)
{
DownloadData(pb, lbl, saveFileName, bucketName, key);
}
else
{
// Watching.Write(@"下载出错:", ex);
if (lbl != null)
lbl.Text = "下载出错,请稍后再试!";
}
}
return result;
}
/// <summary>
/// 判断OSS上的文件是否存在
/// </summary>
/// <param name="bucketName">BUCKET NAME</param>
/// <param name="key">KEY</param>
/// <returns></returns>
public bool Exists(string bucketName, string key)
{
bool flag = true;
try
{
OssObject obj = _client.GetObject(bucketName, key);
obj.Dispose();
}
catch (Exception)
{
flag = false;
}
return flag;
}
/// <summary>
/// 下载oss上的文件
/// </summary>
/// <param name="bucketName"></param>
/// <param name="key"></param>
/// <param name="localFilePath"></param>
public void GetObject(String bucketName, string key, string localFilePath)
{
var object1 = _client.GetObject(bucketName, key);
using (var requestStream = object1.Content)
{
var buf = new byte[1024];
var fs = File.Open(localFilePath, FileMode.OpenOrCreate);
int len;
while ((len = requestStream.Read(buf, 0, 1024)) != 0)
{
fs.Write(buf, 0, len);
}
fs.Close();
}
}
}
}

277
1200gFtp/PatientMd.cs Normal file
View File

@ -0,0 +1,277 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class PatientMd
{
public string REGISTDATE { get; set; }//东营体检系统的 登记日期
public string companyName { get; set; }
public string highLevelOrgID { get; set; }
/// <summary>
/// 时长
/// </summary>
public string ecgTimeLong { get; set; }
/// <summary>
/// 年龄
/// </summary>
public string age { get; set; }
/// <summary>
/// 主键
/// </summary>
public string ID { get; set; }
/// <summary>
/// 患者ID
/// </summary>
public string PatientID { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string PatientName { get; set; }
/// <summary>
/// 性别
/// </summary>
public string Gender { get; set; }
/// <summary>
/// 出生日期
/// </summary>
public string Birthday { get; set; }
/// <summary>
/// 民族
/// </summary>
public string Folk { get; set; }
/// <summary>
/// 身份证ID
/// </summary>
public string P_Id { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Address { get; set; }
/// <summary>
/// 签证机关
/// </summary>
public string Agency { get; set; }
/// <summary>
/// 有效期的开始时间
/// </summary>
public string ExpireStart { get; set; }
/// <summary>
/// 有效期的结束时间
/// </summary>
public string ExpireEnd { get; set; }
/// <summary>
/// 工作单位
/// </summary>
public string WorkUnits { get; set; }
/// <summary>
/// 联系电话
/// </summary>
public string Phone { get; set; }
/// <summary>
/// 文化程度
/// </summary>
public string Levelofeducation { get; set; }
/// <summary>
/// 婚姻状况
/// </summary>
public string Marriage { get; set; }
/// <summary>
/// 常住类型
/// </summary>
public string PermanentType { get; set; }
/// <summary>
/// 血型
/// </summary>
public string BloodType { get; set; }
/// <summary>
/// 睡眠情况
/// </summary>
public string SleepStatus { get; set; }
/// <summary>
/// 体育锻炼
/// </summary>
public string PhysicalExercise { get; set; }
/// <summary>
/// 饮酒情况
/// </summary>
public string Drinking { get; set; }
/// <summary>
/// 职业
/// </summary>
public string Professional { get; set; }
/// <summary>
/// 身高
/// </summary>
public string Height { get; set; }
/// <summary>
/// 腰围
/// </summary>
public string Waistline { get; set; }
/// <summary>
/// 臀围
/// </summary>
public string Hipline { get; set; }
/// <summary>
/// 体重
/// </summary>
public string Weight { get; set; }
/// <summary>
/// 残疾情况
/// </summary>
public string DisabilityStatus { get; set; }
/// <summary>
/// 药物过敏史
/// </summary>
public string Allergy { get; set; }
/// <summary>
/// 暴露史
/// </summary>
public string ExposureHistory { get; set; }
/// <summary>
/// 疾病史
/// </summary>
public string DiseasesHistory { get; set; }
/// <summary>
/// 手术史
/// </summary>
public string OperationHistory { get; set; }
/// <summary>
/// 外伤史
/// </summary>
public string RtaumaHistory { get; set; }
/// <summary>
/// 输血史
/// </summary>
public string TransfusionHistory { get; set; }
/// <summary>
/// 年龄开始
/// </summary>
public string AgeStart { get; set; }
/// <summary>
/// 年龄结束
/// </summary>
public string AgeEnd { get; set; }
/// <summary>
/// 采集开始时间
/// </summary>
public string CollectionStartDate { get; set; }
/// <summary>
/// 采集结束时间
/// </summary>
public string ConllectionEndDate { get; set; }
/// <summary>
/// 采集时间
/// </summary>
public string WardshipId { get; set; }
/// <summary>
/// 申请ID
/// </summary>
public string AppId { get; set; }
/// <summary>
/// 判读状态
/// </summary>
public string Pdstatus { get; set; }
/// <summary>
///
/// </summary>
public string LEU { get; set; }
public string NIT { get; set; }
public string UBG { get; set; }
public string PRO { get; set; }
public string PH { get; set; }
public string BLD { get; set; }
public string KET { get; set; }
public string BIL { get; set; }
public string GLU { get; set; }
public string VC { get; set; }
public string SG { get; set; }
public string Mmol { get; set; }
public string Spo2 { get; set; }
public string DIA { get; set; }
public string SYS { get; set; }
public string Temperature { get; set; }
/// <summary>
/// 门诊号
/// </summary>
public string mzh { get; set; }
/// <summary>
/// 病历号
/// </summary>
public string blh { get; set; }
/// <summary>
/// 科室
/// </summary>
public string keshi { get; set; }
/// <summary>
/// 病房病床
/// </summary>
public string bfbc { get; set; }
/// <summary>
/// 是否是心电患者
/// </summary>
public string isEcg { get; set; }
/// <summary>
/// 是否是血压患者
/// </summary>
public string isBp { get; set; }
/// <summary>
/// 是否是单导心电贴患者
/// </summary>
public string isSingleEcg { get; set; }
/// <summary>
/// 是否是心电图患者
/// </summary>
public string isXinDianTu { get; set; }
/// <summary>
/// 是否是 精神压力分析患者
/// </summary>
public string isHrvBalance { get; set; }
/// <summary>
/// 体检编号
/// </summary>
public string medicalSN { get; set; }
}
}

21
1200gFtp/Program.cs Normal file
View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace _1200gFtp
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("1200gFtp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("1200gFtp")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("09be6454-1cea-403f-81be-5a7170fd5d7f")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ECG数据解析服务端.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("云心电ECG数据解析服务端.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;
}
}
}
}

View 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
1200gFtp/Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ECG数据解析服务端.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;
}
}
}
}

View 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>

75
1200gFtp/SMS.cs Normal file
View File

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
namespace _1200gFtp
{
class SMS
{
public static string smsSend(string phone, string content)
{
string userid = "1699";//企业ID
string account = "XDKJ168"; //用户名
string password = "qwe18601017090"; //密码
StringBuilder sbTemp = new StringBuilder();
//POST 传值
sbTemp.Append("action=send&userid=" + userid + "&account=" + account + "&password=" + password + "&mobile=" + phone + "&content=" + content);
byte[] bTemp = System.Text.Encoding.GetEncoding("GBK").GetBytes(sbTemp.ToString());
string postReturn = doPostRequest("http://www.uehyt.com/smsGBK.aspx", bTemp);
//Response.Write("Post response is: " + postReturn); //测试返回结果
return postReturn;
}
private static String doPostRequest(string url, byte[] bData)
{
System.Net.HttpWebRequest hwRequest;
System.Net.HttpWebResponse hwResponse;
string strResult = string.Empty;
try
{
hwRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
hwRequest.Timeout = 5000;
hwRequest.Method = "POST";
hwRequest.ContentType = "application/x-www-form-urlencoded";
hwRequest.ContentLength = bData.Length;
System.IO.Stream smWrite = hwRequest.GetRequestStream();
smWrite.Write(bData, 0, bData.Length);
smWrite.Close();
}
catch (System.Exception err)
{
WriteErrLog(err.ToString());
return strResult;
}
//get response
try
{
hwResponse = (HttpWebResponse)hwRequest.GetResponse();
StreamReader srReader = new StreamReader(hwResponse.GetResponseStream(), Encoding.ASCII);
strResult = srReader.ReadToEnd();
srReader.Close();
hwResponse.Close();
}
catch (System.Exception err)
{
WriteErrLog(err.ToString());
}
return strResult;
}
private static void WriteErrLog(string strErr)
{
Console.WriteLine(strErr);
System.Diagnostics.Trace.WriteLine(strErr);
}
}
}

263
1200gFtp/SqliteOptions.cs Normal file
View File

@ -0,0 +1,263 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Data;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Security.Cryptography;
namespace _1200gFtp
{
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>
/// DES加密
/// </summary>
/// <param name="data">加密数据</param>
/// <param name="key">8位字符的密钥字符串</param>
/// <param name="iv">8位字符的初始化向量字符串</param>
/// <returns></returns>
public string DESEncrypt(string data, string key, string iv)
{
byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(key);
byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(iv);
DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
int i = cryptoProvider.KeySize;
MemoryStream ms = new MemoryStream();
CryptoStream cst = new CryptoStream(ms, cryptoProvider.CreateEncryptor(byKey, byIV), CryptoStreamMode.Write);
StreamWriter sw = new StreamWriter(cst);
sw.Write(data);
sw.Flush();
cst.FlushFinalBlock();
sw.Flush();
return Convert.ToBase64String(ms.GetBuffer(), 0, (int)ms.Length);
}
/// <summary>
/// DES解密
/// </summary>
/// <param name="data">解密数据</param>
/// <param name="key">8位字符的密钥字符串(需要和加密时相同)</param>
/// <param name="iv">8位字符的初始化向量字符串(需要和加密时相同)</param>
/// <returns></returns>
public string DESDecrypt(string data, string key, string iv)
{
byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(key);
byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(iv);
byte[] byEnc;
try
{
byEnc = Convert.FromBase64String(data);
}
catch
{
return null;
}
DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
MemoryStream ms = new MemoryStream(byEnc);
CryptoStream cst = new CryptoStream(ms, cryptoProvider.CreateDecryptor(byKey, byIV), CryptoStreamMode.Read);
StreamReader sr = new StreamReader(cst);
return sr.ReadToEnd();
}
/// <summary>
/// 获得sqlite数据库连接
/// </summary>
/// <param name="dbpath"></param>
/// <returns></returns>
public bool GetSqliteConnection()
{
try
{
//给数据库连接类赋值
string ConnectionStr = File.ReadAllText(Application.StartupPath + @"\conn.dll");
ConnectionStr = DESDecrypt(ConnectionStr, "51220151", "51220151");
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;
}
}
}

48
1200gFtp/analysisParas.cs Normal file
View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ECG数据解析服务端
{
public class analysisParas
{
public string patientid { get; set; }//患者id
public string collectTime { get; set; }//采集时间
public string birthDay { get; set; }//出生日期
public string age { get; set; }//年龄
public string patientName { get; set; }//姓名
public string gender { get; set; }//性别
public string heartRate { get; set; }//心率
public string P { get; set; }//P波宽度 ms
public string QRS { get; set; }//QRS波宽度 ms
public string RR { get; set; }//RR波间期 ms
public string PR { get; set; }//PR间期 ms
public string PQ { get; set; }//PQ间期 ms
public string QT { get; set; }//QT间期 ms
public string QTc { get; set; }//QTC ms
public string P_degrees { get; set; }//电轴 度数
public string QRS_degrees { get; set; }//电轴 度数
public string T_degrees { get; set; }//电轴 度数
public string RV5 { get; set; }//mv
public string SV1 { get; set; }//mv
public string RV5PLUSSV1 { get; set; }//mv
public string paperSpeed { get; set; }//走速 mm/s
public string Gain { get; set; }//增益 mm/mV
public List<float> LEAD_I { get; set; }// I导联数据
public List<float> LEAD_II { get; set; }// II导联数据
public List<float> LEAD_III { get; set; }// III导联数据
public List<float> LEAD_AVR { get; set; }// AVR导联数据
public List<float> LEAD_AVL { get; set; }// AVL导联数据
public List<float> LEAD_AVF { get; set; }// AVF导联数据
public List<float> LEAD_V1 { get; set; }// V1导联数据
public List<float> LEAD_V2 { get; set; }// V2导联数据
public List<float> LEAD_V3 { get; set; }// V3导联数据
public List<float> LEAD_V4 { get; set; }// V4导联数据
public List<float> LEAD_V5 { get; set; }// V5导联数据
public List<float> LEAD_V6 { get; set; }// V6导联数据
}
}

21
1200gFtp/apiList.cs Normal file
View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _1200gFtp
{
public class apiList
{
public static string loginUrl = "";
public static string patientUrl = "";
public static string blUrl = "";//病历Url
//public static string submitXmlInfo= "http://localhost:20086/api/DiagnosticApply/SubmitDiagnosticApply";//张家口的新版HIS接口提交 心电 xml信息给何冰冰 。 他申请判读
public static string submitXmlInfo = "http://47.104.235.204:8015/api/DiagnosticApply/SubmitDiagnosticApply";//河北省的新版HIS接口提交 心电 xml信息给何冰冰 。 他申请判读
public static string his03 = "http://his.hebjcws.com:7086/pm-s-report/ECG/HIS03";
}
}

19
1200gFtp/app.config Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>
<appSettings>
<add key="ftpUrl" value="218.21.250.148"/>
<add key="ftpName" value="datasum"/>
<add key="ftpPwd" value="datasum"/>
<add key="flowygtUserName" value="tuguilaEcg"/>
<add key="flowygtUserPwd" value="Aa123456"/>
<add key="flowygtLoginUrl" value="https://pacs.gw12320.com/flowygt/thirdLogin" />
<add key="flowygtUploadFileUrl" value="https://pacs.gw12320.com/flowygt/ecg/record/uploadIma" />
<add key="flowygtReportAddUrl" value="https://pacs.gw12320.com/flowygt/ecg/record/reportAdd" />
<add key="flowygtRegistrationAddUrl" value="https://pacs.gw12320.com/flowygt/ecg/record/registrationAdd" />
<add key="hisGetEcgTokenUrl" value="https://wlcbhis.gw12320.com:8443/histest/web/api/ecg/getecgToken"/>
<add key="hisGetEcgDataUrl" value="https://wlcbhis.gw12320.com:8443/histest/web/api/ecg/getecgdata"/>
<add key="hisAppkey" value="873449856452552544"/>
<add key="appsecret" value="hduCGgmtmrriHO#g"/>
</appSettings>
</configuration>

14
1200gFtp/baseModel.cs Normal file
View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _1200gFtp
{
public class baseModel
{
public bool successed { get; set; }
public string msg { get; set; }
public object data { get; set; }
}
}

636
1200gFtp/commonOptions.cs Normal file
View File

@ -0,0 +1,636 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class commonOptions
{
/// <summary>
/// 获取福乐云HIS系统的token
/// </summary>
/// <param name="username"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public static string getHisToken(string url1,string appkey, string appsecret)
{
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("appkey", appkey);
dic.Add("appsecret", appsecret);
string resultV = commonOptions.PostFile3(url1, dic);
FlyHisTokenMsgModel tm = JsonConvert.DeserializeObject<FlyHisTokenMsgModel>(resultV);
return tm.data.access_token;
}
/// <summary>
/// 获取福乐云HIS系统的患者基本信息
/// </summary>
/// <param name="username"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public static FlyHisEcgDataModel GetHisEcgData(string url1, string Yiyuanid, string kaifangsj,string token)
{
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("Yiyuanid", Yiyuanid);
dic.Add("kaifangsj", kaifangsj);
dic.Add("token", token);
string resultV = commonOptions.PostFile3(url1, dic);
FlyHisEcgDataModel tm = JsonConvert.DeserializeObject<FlyHisEcgDataModel>(resultV);
return tm;
}
/// <summary>
/// post form-data 参数
/// </summary>
/// <param name="url"></param>
/// <param name="items"></param>
/// <returns></returns>
public static string PostFile3(string url, Dictionary<string, object> items)
{
string boundary = DateTime.Now.Ticks.ToString("x");
HttpWebRequest request = null;
//如果是发送HTTPS请求              
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
{
//处理HttpWebRequest访问https有安全证书的问题 请求被中止: 未能创建 SSL/TLS 安全通道。)
ServicePointManager.ServerCertificateValidationCallback += (s, cert, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
request = WebRequest.Create(url) as HttpWebRequest;
request.ProtocolVersion = HttpVersion.Version10;
}
else
{
request = WebRequest.Create(url) as HttpWebRequest;
}
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Method = "POST";
// request.Headers.Add("Authorization", "Bearer " + token);
// 最后的结束符
var endBoundary = Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n");
//文件数据
string fileFormdataTemplate =
"--" + boundary +
"\r\nContent-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"" +
"\r\nContent-Type: application/octet-stream" +
"\r\n\r\n";
//文本数据
string dataFormdataTemplate =
"\r\n--" + boundary +
"\r\nContent-Disposition: form-data; name=\"{0}\"" +
"\r\n\r\n{1}";
//FileInfo fi = new FileInfo(filePath);
//string fileHeader = string.Format(fileFormdataTemplate, "file", fi.Name);
//var fileBytes = Encoding.UTF8.GetBytes(fileHeader);
using (var postStream = new MemoryStream())
{
////写入文件格式串
//postStream.Write(fileBytes, 0, fileBytes.Length);
//#region 写入文件流
//using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
//{
// byte[] buffer = new byte[1024];
// int bytesRead = 0;
// while ((bytesRead = fs.Read(buffer, 0, buffer.Length)) != 0)
// {
// postStream.Write(buffer, 0, bytesRead);
// }
//}
//#endregion
#region
foreach (KeyValuePair<string, object> key in items)
{
var p = string.Format(dataFormdataTemplate, key.Key, key.Value);
var bp = Encoding.UTF8.GetBytes(p);
postStream.Write(bp, 0, bp.Length);
}
#endregion
//写入结束边界
postStream.Write(endBoundary, 0, endBoundary.Length);
#region
request.ContentLength = postStream.Length;
postStream.Position = 0;
using (Stream ds = request.GetRequestStream())
{
byte[] buffer = new byte[1024];
int bytesRead = 0;
while ((bytesRead = postStream.Read(buffer, 0, buffer.Length)) != 0)
{
ds.Write(buffer, 0, bytesRead);
}
}
#endregion
#region
string result = string.Empty;
using (HttpWebResponse rep = (HttpWebResponse)request.GetResponse())
{
using (Stream ds = rep.GetResponseStream())
{
using (StreamReader sr = new StreamReader(ds))
{
result = sr.ReadToEnd();
}
}
}
return result;
#endregion
}
}
//public static string PostMoths8(string url, string appkey, string appsecret)
//{
// string strURL = url;
// HttpWebRequest request;
// request = (HttpWebRequest)WebRequest.Create(strURL);
// request.Method = "POST";
// request.ContentType = "application/json;charset=UTF-8";
// string paraUrlCoded = param;
// byte[] payload;
// payload = Encoding.UTF8.GetBytes(paraUrlCoded);
// request.ContentLength = payload.Length;
// Stream writer = request.GetRequestStream();
// writer.Write(payload, 0, payload.Length);
// writer.Close();
// System.Net.HttpWebResponse response;
// response = (System.Net.HttpWebResponse)request.GetResponse();
// System.IO.Stream s;
// s = response.GetResponseStream();
// string StrDate = "";
// string strValue = "";
// StreamReader Reader = new StreamReader(s, Encoding.UTF8);
// while ((StrDate = Reader.ReadLine()) != null)
// {
// strValue += StrDate + "\r\n";
// }
// return strValue;
//}
/// <summary>
/// 获取福乐云的token
/// </summary>
/// <param name="username"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public static string gettoken(string username, string pwd, string url1)
{
loginPara lp = new loginPara();
lp.username = username;
lp.password = commonOptions.Encrypt(pwd);//非对称公钥加密
string loginJson = JsonConvert.SerializeObject(lp);
string resultV = commonOptions.PostMoths(url1, loginJson);
tokenMsg tm = JsonConvert.DeserializeObject<tokenMsg>(resultV);
return tm.data;
}
// 非对称公钥加密 使用公钥加密数据
public static string Encrypt(string plainText)
{
string base64EncryptedData = string.Empty;
// 创建 RSA 密钥对
using (var rsa = new RSACryptoServiceProvider())
{
// 获取公钥
string publicKey = rsa.ToXmlString(false);
// 加载公钥
rsa.FromXmlString("<RSAKeyValue><Modulus>gMIre8vicEqHjwhyrMUSMbwyR+STy9vGDyqmOd9xA4JI9/ghqAQAl5T9R8z87gwKMosPsEaRf4/1tg8taa/q2g0xwcZZ3dZlBzDSQ7k7I7t/Cv+m3YUZDp1U1TooSw8NzX3MQ36u1uiniWAUMvA0PT17dR6dxsQmMdDN4xSJO/0=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
// 将待加密数据转换成字节数组
byte[] dataToEncrypt = Encoding.UTF8.GetBytes(plainText);
// 使用公钥加密数据
byte[] encryptedData = rsa.Encrypt(dataToEncrypt, false);
// 将加密后的数据转换为 Base64 编码的字符串
base64EncryptedData = Convert.ToBase64String(encryptedData);
string aaa = "公钥:" + publicKey;
}
return base64EncryptedData;
//byte[] encryptedData = Encoding.UTF8.GetBytes(plainText);
//using (RSA rsa = RSA.Create())
//{
// rsa.ImportParameters(publicKey);
// // return rsa.Encrypt(data, RSAEncryptionPadding.Pkcs1);
// return Encoding.UTF8.GetString(rsa.Encrypt(encryptedData, RSAEncryptionPadding.Pkcs1));
//}
}
//----------------------------------------------------------------------------------------------------------------------------
// 非对称公钥加密 使用公钥加密数据
public static string Encrypt(string plainText, RSAParameters publicKey)
{
byte[] encryptedData = Encoding.UTF8.GetBytes(plainText);
using (RSA rsa = RSA.Create())
{
rsa.ImportParameters(publicKey);
// return rsa.Encrypt(data, RSAEncryptionPadding.Pkcs1);
return Encoding.UTF8.GetString(rsa.Encrypt(encryptedData, RSAEncryptionPadding.Pkcs1));
}
}
/// <summary>
/// DES加密
/// </summary>
/// <param name="data">加密数据</param>
/// <param name="key">8位字符的密钥字符串</param>
/// <param name="iv">8位字符的初始化向量字符串</param>
/// <returns></returns>
public static string DESEncrypt(string data, string key, string iv)
{
byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(key);
byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(iv);
DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
int i = cryptoProvider.KeySize;
MemoryStream ms = new MemoryStream();
CryptoStream cst = new CryptoStream(ms, cryptoProvider.CreateEncryptor(byKey, byIV), CryptoStreamMode.Write);
StreamWriter sw = new StreamWriter(cst);
sw.Write(data);
sw.Flush();
cst.FlushFinalBlock();
sw.Flush();
return Convert.ToBase64String(ms.GetBuffer(), 0, (int)ms.Length);
}
/// <summary>
/// DES解密
/// </summary>
/// <param name="data">解密数据</param>
/// <param name="key">8位字符的密钥字符串(需要和加密时相同)</param>
/// <param name="iv">8位字符的初始化向量字符串(需要和加密时相同)</param>
/// <returns></returns>
public static string DESDecrypt(string data, string key, string iv)
{
byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(key);
byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(iv);
byte[] byEnc;
try
{
byEnc = Convert.FromBase64String(data);
}
catch
{
return null;
}
DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
MemoryStream ms = new MemoryStream(byEnc);
CryptoStream cst = new CryptoStream(ms, cryptoProvider.CreateDecryptor(byKey, byIV), CryptoStreamMode.Read);
StreamReader sr = new StreamReader(cst);
return sr.ReadToEnd();
}
public static string PostMoths(string url, string param)
{
string strURL = url;
HttpWebRequest request;
request = (HttpWebRequest)WebRequest.Create(strURL);
request.Method = "POST";
request.ContentType = "application/json;charset=UTF-8";
string paraUrlCoded = param;
byte[] payload;
payload = Encoding.UTF8.GetBytes(paraUrlCoded);
request.ContentLength = payload.Length;
Stream writer = request.GetRequestStream();
writer.Write(payload, 0, payload.Length);
writer.Close();
System.Net.HttpWebResponse response;
response = (System.Net.HttpWebResponse)request.GetResponse();
System.IO.Stream s;
s = response.GetResponseStream();
string StrDate = "";
string strValue = "";
StreamReader Reader = new StreamReader(s, Encoding.UTF8);
while ((StrDate = Reader.ReadLine()) != null)
{
strValue += StrDate + "\r\n";
}
return strValue;
}
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <param name="token"></param>
/// <param name="jsonContent"></param>
/// <returns></returns>
public static string PostByParas(string url, string token, string jsonContent)
{
string result = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/json";
req.Headers.Add("Authorization", "Bearer " + token);
byte[] data = Encoding.UTF8.GetBytes(jsonContent);
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
return result;
}
/// <summary>
/// 海军给的 http 上传文件 好用版
/// </summary>
/// <param name="url"></param>
/// <param name="filePath"></param>
/// <param name="items"></param>
/// <param name="token"></param>
/// <returns></returns>
public static string PostFile2(string url, string filePath, Dictionary<string, object> items, string token)
{
string boundary = DateTime.Now.Ticks.ToString("x");
HttpWebRequest request = null;
//如果是发送HTTPS请求              
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
{
//处理HttpWebRequest访问https有安全证书的问题 请求被中止: 未能创建 SSL/TLS 安全通道。)
ServicePointManager.ServerCertificateValidationCallback += (s, cert, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
request = WebRequest.Create(url) as HttpWebRequest;
request.ProtocolVersion = HttpVersion.Version10;
}
else
{
request = WebRequest.Create(url) as HttpWebRequest;
}
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Method = "POST";
request.Headers.Add("Authorization", "Bearer " + token);
// 最后的结束符
var endBoundary = Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n");
//文件数据
string fileFormdataTemplate =
"--" + boundary +
"\r\nContent-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"" +
"\r\nContent-Type: application/octet-stream" +
"\r\n\r\n";
//文本数据
string dataFormdataTemplate =
"\r\n--" + boundary +
"\r\nContent-Disposition: form-data; name=\"{0}\"" +
"\r\n\r\n{1}";
FileInfo fi = new FileInfo(filePath);
string fileHeader = string.Format(fileFormdataTemplate, "file", fi.Name);
var fileBytes = Encoding.UTF8.GetBytes(fileHeader);
using (var postStream = new MemoryStream())
{
//写入文件格式串
postStream.Write(fileBytes, 0, fileBytes.Length);
#region
using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
byte[] buffer = new byte[1024];
int bytesRead = 0;
while ((bytesRead = fs.Read(buffer, 0, buffer.Length)) != 0)
{
postStream.Write(buffer, 0, bytesRead);
}
}
#endregion
#region
foreach (KeyValuePair<string, object> key in items)
{
var p = string.Format(dataFormdataTemplate, key.Key, key.Value);
var bp = Encoding.UTF8.GetBytes(p);
postStream.Write(bp, 0, bp.Length);
//System.Diagnostics.Debug.WriteLine(p);
}
#endregion
//写入结束边界
postStream.Write(endBoundary, 0, endBoundary.Length);
#region
request.ContentLength = postStream.Length;
postStream.Position = 0;
using (Stream ds = request.GetRequestStream())
{
byte[] buffer = new byte[1024];
int bytesRead = 0;
while ((bytesRead = postStream.Read(buffer, 0, buffer.Length)) != 0)
{
ds.Write(buffer, 0, bytesRead);
}
}
#endregion
#region
string result = string.Empty;
using (HttpWebResponse rep = (HttpWebResponse)request.GetResponse())
{
using (Stream ds = rep.GetResponseStream())
{
using (StreamReader sr = new StreamReader(ds))
{
result = sr.ReadToEnd();
}
}
}
return result;
#endregion
}
}
/// <summary>
/// 指定Post地址使用Get 方式获取全部字符串
/// </summary>
/// <param name="url">请求后台地址</param>
/// <returns></returns>
public static string PostByParas(string url, Dictionary<string, string> dic)
{
string result = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
#region Post
StringBuilder builder = new StringBuilder();
int i = 0;
foreach (var item in dic)
{
if (i > 0)
builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++;
}
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
#endregion
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
return result;
}
public static string HttpGet(string url)
{
//ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Accept = "text/html, application/xhtml+xml, */*";
request.ContentType = "application/json";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
return reader.ReadToEnd();
}
}
//public static Image CreateBarCode(string content)
//{
// using (var barcode = new Barcode()
// {
// //true显示contentfalse反之
// IncludeLabel = true,
// //content的位置
// Alignment = AlignmentPositions.CENTER,
// //条形码的宽高
// Width = 145,
// Height = 39,
// //类型
// RotateFlipType = RotateFlipType.RotateNoneFlipNone,
// //颜色
// BackColor = Color.White,
// ForeColor = Color.Black,
// })
// {
// return barcode.Encode(TYPE.CODE128B, content);
// }
//}
/// <summary>
/// 格式化磁盘
/// </summary>
/// <param name="DiskName">盘符名称C:、D:、E:、F:</param>
/// <returns></returns>
public static bool FormatDisk(string DiskName)
{
ProcessStartInfo processStartInfo = new ProcessStartInfo("cmd.exe");
processStartInfo.RedirectStandardInput = true;
processStartInfo.RedirectStandardOutput = true;
processStartInfo.UseShellExecute = false;
Process process = Process.Start(processStartInfo);
if (process != null)
{
process.StandardInput.WriteLine($"FORMAT {DiskName} /y /FS:FAT32 /V:BMECG /Q");
process.StandardInput.Close();
string outputString = process.StandardOutput.ReadToEnd();
if (outputString.Contains("已完成"))
{
return true;
}
}
return false;
}
//public static void PdfToImages(string pdfFilePath, string outputFolder)
//{
// string imgpath = @"D:/PDFFF/";
// var pathList = GetPdfAllPageImgs(pdfFilePath, imgpath, "11556699");
//}
}
}

52
1200gFtp/his03Model.cs Normal file
View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class his03Model
{
public int status { get; set; }
public string posId { get; set; }
public string id { get; set; }
public string testDate { get; set; }
public string hisCode { get; set; }
public string name { get; set; }
public string identityCode { get; set; }
public string sex { get; set; }
public int age { get; set; }
public string ageUnit { get; set; }
public string itemId { get; set; }
public string itemName { get; set; }
public string departmentId { get; set; }
public string doctorId { get; set; }
public string patientType { get; set; }
public string evidence { get; set; }
public string pdfUrl { get; set; }
public string optName { get; set; }
public string auditName { get; set; }
public string bedNum { get; set; }
public string testNum { get; set; }
public string barCode { get; set; }
public string specimenType { get; set; }
public string dicomUrl { get; set; }
public string conclusion { get; set; }
public string departmentName { get; set; }
public string doctorName { get; set; }
public string birthday { get; set; }
public string negaPosiTive { get; set; }
}
}

14
1200gFtp/loginPara.cs Normal file
View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class loginPara
{
public string username { get; set; }
public string password { get; set; }
}
}

14
1200gFtp/msgModel.cs Normal file
View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _1200gFtp
{
public class msgModel
{
public string successed { get; set; }
public string msg { get; set; }
public string data { get; set; }
}
}

102
1200gFtp/netOptions.cs Normal file
View File

@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
namespace _1200gFtp
{
public class netOptions
{
public static string HttpPost(string Url, string postDataStr)
{
WebRequest request = WebRequest.Create(Url);
request.Method = "POST";
request.ContentType = "application/json";
byte[] buf = Encoding.UTF8.GetBytes(postDataStr);
byte[] byteArray = System.Text.Encoding.Default.GetBytes(postDataStr);
request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr);
request.GetRequestStream().Write(buf, 0, buf.Length);
WebResponse response = request.GetResponse();
Stream myResponseStream = response.GetResponseStream();
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
string retString = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close();
return retString;
}
public static string HttpPost(string Url, string postDataStr, string Method)
{
WebRequest request = WebRequest.Create(Url);
request.Method = Method;
request.ContentType = "application/json";
byte[] buf = Encoding.UTF8.GetBytes(postDataStr);
byte[] byteArray = System.Text.Encoding.Default.GetBytes(postDataStr);
request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr);
request.GetRequestStream().Write(buf, 0, buf.Length);
WebResponse response = request.GetResponse();
Stream myResponseStream = response.GetResponseStream();
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
string retString = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close();
return retString;
}
public static string PostWebRequest(string Url, string postDataStr, string Method, Dictionary<string, string> headerDic)
{
string ret = string.Empty;
try
{
WebRequest request = WebRequest.Create(Url);
foreach (KeyValuePair<string, string> kvp in headerDic)
request.Headers[kvp.Key] = kvp.Value;
request.Method = Method;
request.ContentType = "application/json";
byte[] buf = Encoding.UTF8.GetBytes(postDataStr);
byte[] byteArray = System.Text.Encoding.Default.GetBytes(postDataStr);
request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr);
request.GetRequestStream().Write(buf, 0, buf.Length);
WebResponse response = request.GetResponse();
Stream myResponseStream = response.GetResponseStream();
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
string retString = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close();
return retString;
}
catch (Exception ex)
{
}
return ret;
}
/// <summary>
/// 获取url的返回值
/// </summary>
/// <param name="url"></param>
public static string GethttpInfo(string url)
{
string strBuff = "";
Uri httpURL = new Uri(url);
///HttpWebRequest类继承于WebRequest并没有自己的构造函数需通过WebRequest的Creat方法 建立,并进行强制的类型转换
HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(httpURL);
///通过HttpWebRequest的GetResponse()方法建立HttpWebResponse,强制类型转换
HttpWebResponse httpResp = (HttpWebResponse)httpReq.GetResponse();
///GetResponseStream()方法获取HTTP响应的数据流,并尝试取得URL中所指定的网页内容
///若成功取得网页的内容则以System.IO.Stream形式返回若失败则产生ProtoclViolationException错 误。在此正确的做法应将以下的代码放到一个try块中处理。这里简单处理
Stream respStream = httpResp.GetResponseStream();
///返回的内容是Stream形式的所以可以利用StreamReader类获取GetResponseStream的内容并以
//StreamReader类的Read方法依次读取网页源程序代码每一行的内容直至行尾读取的编码格式UTF8
StreamReader respStreamReader = new StreamReader(respStream, Encoding.UTF8);
strBuff = respStreamReader.ReadToEnd();
return strBuff;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

5
1200gFtp/packages.config Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Diagnostics.Tracing.EventSource.Redist" version="1.1.28" targetFramework="net46" />
<package id="RabbitMQ.Client" version="5.1.2" targetFramework="net46" />
</packages>

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class panduReturnModel
{
public string applyId { get; set; }//申请id
public int applyStatus { get; set; }//申请状态
public string auditorTime { get; set; }//审核时间
public string auditorUserId { get; set; }//审核用户的用户ID
public string auditorUserName { get; set; }//审核用户的用户名
public string crisis { get; set; }//危机值
public string diagnosticPosId { get; set; }//诊断机构的机构id
public string patientBirthday { get; set; }//患者生日
public string patientId { get; set; }//患者ID
public string patientName { get; set; }//患者姓名
public string patientSex { get; set; }//患者性别
public string positive { get; set; }//积极
public string reportConclusion { get; set; }//诊断结论
public string reportFeatures { get; set; }//特征说明
public string reportPdf { get; set; }//报告地址
public string reportTime { get; set; }//报告时间
public string reportUserId { get; set; }//出报告的医生id
public string reportUserName { get; set; }//出报告的医生的用户名
public string supplierId { get; set; }//供应商ID
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class patientInfoFLY
{
public string patientName { get; set; }
public string idCard { get; set; }
public string sex { get; set; }
public string birthday { get; set; }
public string yearold { get; set; }
public string area { get; set; }
public string Items { get; set; }
public string appointmentTimes { get; set; }
public string symptom { get; set; }
public string hospitalCode { get; set; }
public string hospitalName { get; set; }
public string departmentCode { get; set; }
public string departmentName { get; set; }
public string resDoctorName { get; set; }
public string resDoctorCode { get; set; }
public string patientType { get; set; }
public int patientTypeCode { get; set; }
public string nation { get; set; }
public string appointmentId { get; set; }
public string wearTime { get; set; }
public int status { get; set; }
public string patientCode { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _1200gFtp
{
public class patientInfoModel
{
public string ftpPath { get; set; }
public string patientName { get; set; }
public string patientSex { get; set; }
public int patientAge { get; set; }
public string startTime { get; set; }
public string endTime { get; set; }
public string dicomUrl { get; set; }
public bool isPanDu { get; set; }
public string pdfUrl { get; set; }
public string testDate { get; set; }
public string evidence { get; set; }
public string conclusion { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
public class returnPatientModel
{
public string code { get; set; }
public string message { get; set; }
public string result { get; set; }
public string data { get; set; }
}
}

15
1200gFtp/tokenMsg.cs Normal file
View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1200gFtp
{
internal class tokenMsg
{
public string msg { get; set; }
public string code { get; set; }
public string data { get; set; }
}
}

View File

@ -0,0 +1,138 @@
<?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>{09BE6454-1CEA-403F-81BE-5A7170FD5D7F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>云心电ECG数据解析服务端</RootNamespace>
<AssemblyName>云心电ECG数据解析服务端</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\</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>o13www.ixigua.com.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aliyun.OSS, Version=2.2.0.0, Culture=neutral, PublicKeyToken=0ad4175f0dac0b9b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Aliyun.OSS.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Diagnostics.Tracing.EventSource, Version=1.1.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Diagnostics.Tracing.EventSource.Redist.1.1.28\lib\net46\Microsoft.Diagnostics.Tracing.EventSource.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RabbitMQ.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce, processorArchitecture=MSIL">
<HintPath>..\packages\RabbitMQ.Client.5.1.2\lib\net451\RabbitMQ.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<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="analysisParas.cs" />
<Compile Include="apiList.cs" />
<Compile Include="baseModel.cs" />
<Compile Include="commonOptions.cs" />
<Compile Include="EcgDataDraw_New.cs" />
<Compile Include="EcgViewModel.cs" />
<Compile Include="FLYecgReport.cs" />
<Compile Include="FlyHisEcgdataModel.cs" />
<Compile Include="FlyHisTokenMsg.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="FtpHelper.cs" />
<Compile Include="his03Model.cs" />
<Compile Include="Hl7EcgOptions.cs" />
<Compile Include="loginPara.cs" />
<Compile Include="msgModel.cs" />
<Compile Include="netOptions.cs" />
<Compile Include="OssUnity.cs" />
<Compile Include="panduReturnModel.cs" />
<Compile Include="patientInfoFLY.cs" />
<Compile Include="patientInfoModel.cs" />
<Compile Include="PatientMd.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="returnPatientModel.cs" />
<Compile Include="SMS.cs" />
<Compile Include="SqliteOptions.cs" />
<Compile Include="tokenMsg.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.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="o13www.ixigua.com.ico" />
</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>

139
xml读取.txt Normal file
View File

@ -0,0 +1,139 @@
调用:
ReadXMLByPath(@"C:\Users\PETER\Desktop\芯动心电网络管理系统\FTP数据\e30c180b-2512-4073-ae7a-d65be041f424.XML");
string ReadXMLByPath(string path)
{
string caseName = "";
string age = "";
string sex = "";
string HR = string.Empty, PR = string.Empty, P = string.Empty, QRS = string.Empty, T = string.Empty, QT = string.Empty, QTc = string.Empty, PAxis = string.Empty, QRSAxis = string.Empty, TAxis = string.Empty, R_V5 = string.Empty, S_V1 = string.Empty;
try
{
XmlDocument doc1 = new XmlDocument();
doc1.Load(path);
//获取当前XML文档的根 一级
XmlNode oNode = doc1.DocumentElement;
//获取根节点的所有子节点列表
XmlNodeList oList = oNode.ChildNodes;
//标记当前节点
XmlNode oCurrentNode;
//遍历所有二级节点
for (int i = 0; i < oList.Count; i++)
{
//二级
oCurrentNode = oList[i];
//检测当前节点的名称,节点的值是否与已知匹配
if (oCurrentNode.Name.Equals("caseinformation"))
{
//检测是否有子节点 三级
if (oCurrentNode.HasChildNodes)
{
//遍历当前节点的所有子节点
for (int n = 0; n < oCurrentNode.ChildNodes.Count; n++)
{
//检测当前节点的子节点名称是否与已知匹配
if (oCurrentNode.ChildNodes[n].Name.ToLower() == "otherparam")
{
//遍历当前节点的所有子节点
for (int ii = 0; ii < oCurrentNode.ChildNodes[n].ChildNodes.Count; ii++)
{
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.ToLower().Equals("caseName"))
{
caseName = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.ToLower().Equals("sex"))
{
sex = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.ToLower().Equals("age"))
{
age = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.ToLower().Equals("age"))
{
age = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
}
}
//检测当前节点的子节点名称是否与已知匹配
if (oCurrentNode.ChildNodes[n].Name== "Parameters")
{
//遍历当前节点的所有子节点
for (int ii = 0; ii < oCurrentNode.ChildNodes[n].ChildNodes.Count; ii++)
{
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("HR"))//心率
{
HR = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("PRInterval"))
{
PR = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("PDuration"))
{
P = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("QRSDuration"))
{
QRS = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("TDuration"))
{
T = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("QTInterval"))
{
QT = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("QTcInterval"))
{
QTc = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("PAxis"))
{
PAxis = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("QRSAxis"))
{
QRSAxis = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("TAxis"))
{
TAxis = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("R_V5"))
{
R_V5 = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
if (oCurrentNode.ChildNodes[n].ChildNodes[ii].Name.Equals("S_V1"))
{
S_V1 = oCurrentNode.ChildNodes[n].ChildNodes[ii].InnerText;
}
}
}
}
}
}
}
}
catch { }
return caseName + "," + sex + "," + age;
}

View File

@ -0,0 +1,25 @@

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}") = "云心电ECG数据解析服务端", "1200gFtp\云心电ECG数据解析服务端.csproj", "{09BE6454-1CEA-403F-81BE-5A7170FD5D7F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{09BE6454-1CEA-403F-81BE-5A7170FD5D7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09BE6454-1CEA-403F-81BE-5A7170FD5D7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09BE6454-1CEA-403F-81BE-5A7170FD5D7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09BE6454-1CEA-403F-81BE-5A7170FD5D7F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FEA323F1-3B5C-4E60-BF47-2D7F6CBC4CDA}
EndGlobalSection
EndGlobal