修改解析接受到的数据逻辑 和实体

This commit is contained in:
lxd 2024-12-27 17:21:36 +08:00
parent 5c7d6bf7b4
commit de63d5c4f9
4 changed files with 161 additions and 158 deletions

View File

@ -244,154 +244,154 @@ namespace _1200Gxml心电图绘制
/// </summary>
public void GetEcgViewDataImage(Image img, string addr)
{
_ecgDataDicAfterFilter.Clear();
string ecgDataJsonStr = File.ReadAllText(Application.StartupPath + @"\60心拍心电图数据JSON.txt");
leadDataModel LDM = JsonConvert.DeserializeObject<leadDataModel>(ecgDataJsonStr);
float[] LEAD_I = valueConvert(Array.ConvertAll(LDM.LEAD_I.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(0, LEAD_I.ToList());
float[] LEAD_II = valueConvert(Array.ConvertAll(LDM.LEAD_II.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(1, LEAD_II.ToList());
float[] LEAD_III = valueConvert(Array.ConvertAll(LDM.LEAD_III.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(2, LEAD_III.ToList());
float[] LEAD_AVR = valueConvert(Array.ConvertAll(LDM.LEAD_AVR.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(3, LEAD_AVR.ToList());
float[] LEAD_AVL = valueConvert(Array.ConvertAll(LDM.LEAD_AVL.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(4, LEAD_AVL.ToList());
float[] LEAD_AVF = valueConvert(Array.ConvertAll(LDM.LEAD_AVF.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(5, LEAD_AVF.ToList());
float[] LEAD_V1 = valueConvert(Array.ConvertAll(LDM.LEAD_V1.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(6, LEAD_V1.ToList());
float[] LEAD_V2 = valueConvert(Array.ConvertAll(LDM.LEAD_V2.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(7, LEAD_V2.ToList());
float[] LEAD_V3 = valueConvert(Array.ConvertAll(LDM.LEAD_V3.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(8, LEAD_V3.ToList());
float[] LEAD_V4 = valueConvert(Array.ConvertAll(LDM.LEAD_V4.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(9, LEAD_V4.ToList());
float[] LEAD_V5 = valueConvert(Array.ConvertAll(LDM.LEAD_V5.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(10, LEAD_V5.ToList());
float[] LEAD_V6 = valueConvert(Array.ConvertAll(LDM.LEAD_V6.Split(' '), float.Parse));
_ecgDataDicAfterFilter.Add(11, LEAD_V6.ToList());
//_ecgDataDicAfterFilter.Clear();
//string ecgDataJsonStr = File.ReadAllText(Application.StartupPath + @"\60心拍心电图数据JSON.txt");
//leadDataModel LDM = JsonConvert.DeserializeObject<leadDataModel>(ecgDataJsonStr);
//float[] LEAD_I = valueConvert(Array.ConvertAll(LDM.LEAD_I.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(0, LEAD_I.ToList());
//float[] LEAD_II = valueConvert(Array.ConvertAll(LDM.LEAD_II.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(1, LEAD_II.ToList());
//float[] LEAD_III = valueConvert(Array.ConvertAll(LDM.LEAD_III.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(2, LEAD_III.ToList());
//float[] LEAD_AVR = valueConvert(Array.ConvertAll(LDM.LEAD_AVR.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(3, LEAD_AVR.ToList());
//float[] LEAD_AVL = valueConvert(Array.ConvertAll(LDM.LEAD_AVL.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(4, LEAD_AVL.ToList());
//float[] LEAD_AVF = valueConvert(Array.ConvertAll(LDM.LEAD_AVF.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(5, LEAD_AVF.ToList());
//float[] LEAD_V1 = valueConvert(Array.ConvertAll(LDM.LEAD_V1.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(6, LEAD_V1.ToList());
//float[] LEAD_V2 = valueConvert(Array.ConvertAll(LDM.LEAD_V2.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(7, LEAD_V2.ToList());
//float[] LEAD_V3 = valueConvert(Array.ConvertAll(LDM.LEAD_V3.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(8, LEAD_V3.ToList());
//float[] LEAD_V4 = valueConvert(Array.ConvertAll(LDM.LEAD_V4.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(9, LEAD_V4.ToList());
//float[] LEAD_V5 = valueConvert(Array.ConvertAll(LDM.LEAD_V5.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(10, LEAD_V5.ToList());
//float[] LEAD_V6 = valueConvert(Array.ConvertAll(LDM.LEAD_V6.Split(' '), float.Parse));
//_ecgDataDicAfterFilter.Add(11, LEAD_V6.ToList());
_reportTitleContent = "十二导联静态心电图报告";
_idStr = "5566778899";
collectTime = "2024-12-20 13:28:51";
//长两导的模式下 默认添加 第一导 和 第二导联 为 长显示两导联
_longLeadInfo.Add(0);
_longLeadInfo.Add(1);
//长三导的模式下 默认添加 第一导 和 第二导联和第三导联 为 长显示三导联
_longLeadInfo3.Add(0);
_longLeadInfo3.Add(1);
_longLeadInfo3.Add(2);
var cpew = new CommonPrintEcgWave();
var filter = _printFilter;
_ecgBitMap = new Bitmap(1090 * _printDpi / Dpi, 760 * _printDpi / Dpi);
_ecgBitMap.SetResolution(_printDpi, _printDpi);
cpew.InitEcgParameter(_ecgBitMap, _ecgDataDicAfterFilter, _isQiBo, _paperSpeed, _amplitude);
//_reportTitleContent = "十二导联静态心电图报告";
//_idStr = "5566778899";
//collectTime = "2024-12-20 13:28:51";
////长两导的模式下 默认添加 第一导 和 第二导联 为 长显示两导联
//_longLeadInfo.Add(0);
//_longLeadInfo.Add(1);
////长三导的模式下 默认添加 第一导 和 第二导联和第三导联 为 长显示三导联
//_longLeadInfo3.Add(0);
//_longLeadInfo3.Add(1);
//_longLeadInfo3.Add(2);
//var cpew = new CommonPrintEcgWave();
//var filter = _printFilter;
//_ecgBitMap = new Bitmap(1090 * _printDpi / Dpi, 760 * _printDpi / Dpi);
//_ecgBitMap.SetResolution(_printDpi, _printDpi);
//cpew.InitEcgParameter(_ecgBitMap, _ecgDataDicAfterFilter, _isQiBo, _paperSpeed, _amplitude);
//************************************************************************
var ecgInfoList = new string[13];
ecgInfoList[0] = "张三";
ecgInfoList[1] = "女";
ecgInfoList[2] = "28";
ecgInfoList[3] = "RV5+SV1";
ecgInfoList[4] = "PR间期";
ecgInfoList[5] = "QRS间期";
ecgInfoList[6] = "QT/QTC";
ecgInfoList[7] = "QRS电轴";
ecgInfoList[8] = "RV5/SV1";
ecgInfoList[9] = "心率";
ecgInfoList[10] = "病室";
ecgInfoList[11] = "床号";
ecgInfoList[12] = "住院号";
SetAandP(); //设置增益和走速
////************************************************************************
//var ecgInfoList = new string[13];
//ecgInfoList[0] = "张三";
//ecgInfoList[1] = "女";
//ecgInfoList[2] = "28";
//ecgInfoList[3] = "RV5+SV1";
//ecgInfoList[4] = "PR间期";
//ecgInfoList[5] = "QRS间期";
//ecgInfoList[6] = "QT/QTC";
//ecgInfoList[7] = "QRS电轴";
//ecgInfoList[8] = "RV5/SV1";
//ecgInfoList[9] = "心率";
//ecgInfoList[10] = "病室";
//ecgInfoList[11] = "床号";
//ecgInfoList[12] = "住院号";
//SetAandP(); //设置增益和走速
var diagContent = "这里是心电图的诊断结论";
var diagArray = diagContent.Split('\n');
diagContent = string.Empty;
for (var i = 0; i < diagArray.Length; i++) diagContent += diagArray[i].Trim();
//var diagContent = "这里是心电图的诊断结论";
//var diagArray = diagContent.Split('\n');
//diagContent = string.Empty;
//for (var i = 0; i < diagArray.Length; i++) diagContent += diagArray[i].Trim();
if (_ecgDataDicAfterFilter.Count > 0)
_filterIndex = 0;
else
_filterIndex = 0;
// _leadindexdata = hScrollBar_Lead.Value * _filterIndex;
_leadindexdata = _filterIndex;
//if (_ecgDataDicAfterFilter.Count > 0)
// _filterIndex = 0;
//else
// _filterIndex = 0;
//// _leadindexdata = hScrollBar_Lead.Value * _filterIndex;
//_leadindexdata = _filterIndex;
if (combo_reportModel.Text == LeaderName15) filter += " 十五加一长导模式";
if (combo_reportModel.Text == LeaderName18) filter += " 十八导模式";
if (combo_reportModel.SelectedIndex == 2)
{
cpew.PrintBackGroundGrid(16, 196);
cpew.PrintLongReportHeadInfo(_reportTitleContent);
cpew.PrintLongEcgInfo(ecgInfoList, _idStr);
cpew.PrintLongDiagInfo(diagContent, "医生姓名",
"2024-12-20", filter,
collectTime, "心电图科", _amp, _ps, img, addr);
}
else
{
cpew.PrintBackGroundGrid(40, 196); //(197-42)*12=1860像素
cpew.PrintReportHeadInfo(_reportTitleContent, "2024-12-20");
cpew.PrintEcgInfo(ecgInfoList, _idStr);
cpew.PrintDiagInfo(diagContent, "医生姓名", filter,
collectTime, "心电图科", _amp, _ps, img, addr);
}
//if (combo_reportModel.Text == LeaderName15) filter += " 十五加一长导模式";
//if (combo_reportModel.Text == LeaderName18) filter += " 十八导模式";
//if (combo_reportModel.SelectedIndex == 2)
//{
// cpew.PrintBackGroundGrid(16, 196);
// cpew.PrintLongReportHeadInfo(_reportTitleContent);
// cpew.PrintLongEcgInfo(ecgInfoList, _idStr);
// cpew.PrintLongDiagInfo(diagContent, "医生姓名",
// "2024-12-20", filter,
// collectTime, "心电图科", _amp, _ps, img, addr);
//}
//else
//{
// cpew.PrintBackGroundGrid(40, 196); //(197-42)*12=1860像素
// cpew.PrintReportHeadInfo(_reportTitleContent, "2024-12-20");
// cpew.PrintEcgInfo(ecgInfoList, _idStr);
// cpew.PrintDiagInfo(diagContent, "医生姓名", filter,
// collectTime, "心电图科", _amp, _ps, img, addr);
//}
//6x2
if (combo_reportModel.SelectedIndex == 0)
{
cpew.PrintEcgWave(8, 1, _leadindexdata);
cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient);
}
////6x2
//if (combo_reportModel.SelectedIndex == 0)
//{
// cpew.PrintEcgWave(8, 1, _leadindexdata);
// cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient);
//}
//6x2+2
if (combo_reportModel.SelectedIndex == 1)
{
cpew.PrintEcgWave(8, 1, _longLeadInfo, _leadindexdata, _leadindexdata);
cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient, _longLeadInfo);
}
////6x2+2
//if (combo_reportModel.SelectedIndex == 1)
//{
// cpew.PrintEcgWave(8, 1, _longLeadInfo, _leadindexdata, _leadindexdata);
// cpew.PrintEcgLeadName(_calibrationVoltage * Coefficient, _longLeadInfo);
//}
//十二长导
if (combo_reportModel.SelectedIndex == 2)
{
cpew.PrintLongEcgWave(5, 1, _leadindexdata);
//cpew.PrintLongEcgWave(8, 1, _leadindexdata);
cpew.PrintLongEcgLeadName(_calibrationVoltage * Coefficient);
}
////十二长导
//if (combo_reportModel.SelectedIndex == 2)
//{
// cpew.PrintLongEcgWave(5, 1, _leadindexdata);
// //cpew.PrintLongEcgWave(8, 1, _leadindexdata);
// cpew.PrintLongEcgLeadName(_calibrationVoltage * Coefficient);
//}
//4*3 II长导模式
if (combo_reportModel.SelectedIndex == 3)
{
cpew.PrintEcgWaveFourOne(8, 1, _leadindexdata, _leadindexdata);
cpew.PrintLeadNameFourOne(_calibrationVoltage * Coefficient, _longLeadInfo);
}
////4*3 II长导模式
//if (combo_reportModel.SelectedIndex == 3)
//{
// cpew.PrintEcgWaveFourOne(8, 1, _leadindexdata, _leadindexdata);
// cpew.PrintLeadNameFourOne(_calibrationVoltage * Coefficient, _longLeadInfo);
//}
//4*3+3 长导模式
if (combo_reportModel.SelectedIndex == 4)
{
cpew.PrintEcgWaveFourThree(8, 1, _longLeadInfo3, _leadindexdata, _leadindexdata);
cpew.PrintLeadNameFourThree(_calibrationVoltage * Coefficient, _longLeadInfo3);
}
////4*3+3 长导模式
//if (combo_reportModel.SelectedIndex == 4)
//{
// cpew.PrintEcgWaveFourThree(8, 1, _longLeadInfo3, _leadindexdata, _leadindexdata);
// cpew.PrintLeadNameFourThree(_calibrationVoltage * Coefficient, _longLeadInfo3);
//}
//15x1+1导
if (combo_reportModel.Text.Trim() == LeaderName15)
{
cpew.PrintEcgWaveFifteen(8, 1, _leadindexdata);
cpew.PrintLeadNameFifteen(_calibrationVoltage * Coefficient, LeaderType);
}
////15x1+1导
//if (combo_reportModel.Text.Trim() == LeaderName15)
//{
// cpew.PrintEcgWaveFifteen(8, 1, _leadindexdata);
// cpew.PrintLeadNameFifteen(_calibrationVoltage * Coefficient, LeaderType);
//}
//十八导
if (combo_reportModel.Text.Trim() == LeaderName18)
{
cpew.PrintEcgWaveEighteen(8, 1, _leadindexdata);
cpew.PrintLeadNameEighteen(_calibrationVoltage * Coefficient);
}
////十八导
//if (combo_reportModel.Text.Trim() == LeaderName18)
//{
// cpew.PrintEcgWaveEighteen(8, 1, _leadindexdata);
// cpew.PrintLeadNameEighteen(_calibrationVoltage * Coefficient);
//}
//_sourceCegBmp = _ecgBitMap;
_ecgBitMap.Save("1.jpg", ImageFormat.Jpeg);
////_sourceCegBmp = _ecgBitMap;
//_ecgBitMap.Save("1.jpg", ImageFormat.Jpeg);
}

View File

@ -8,17 +8,20 @@ namespace 心电图绘制
{
public class leadDataModel
{
public string LEAD_I { get; set; }// I导联
public string LEAD_II { get; set; }// II导联
public string LEAD_III { get; set; }// III导联
public string LEAD_AVR { get; set; }// AVR导联
public string LEAD_AVL { get; set; }// AVL导联
public string LEAD_AVF { get; set; }// AVF导联
public string LEAD_V1 { get; set; }// V1导联
public string LEAD_V2 { get; set; }// V2导联
public string LEAD_V3 { get; set; }// V3导联
public string LEAD_V4 { get; set; }// V4导联
public string LEAD_V5 { get; set; }// V5导联
public string LEAD_V6 { get; set; }// V6导联
public string[] LEAD_I { get; set; }// I导联
public string[] LEAD_II { get; set; }// II导联
public string[] LEAD_III { get; set; }// III导联
public string[] LEAD_AVR { get; set; }// AVR导联
public string[] LEAD_AVL { get; set; }// AVL导联
public string[] LEAD_AVF { get; set; }// AVF导联
public string[] LEAD_V1 { get; set; }// V1导联
public string[] LEAD_V2 { get; set; }// V2导联
public string[] LEAD_V3 { get; set; }// V3导联
public string[] LEAD_V4 { get; set; }// V4导联
public string[] LEAD_V5 { get; set; }// V5导联
public string[] LEAD_V6 { get; set; }// V6导联
}
}

View File

@ -12,10 +12,10 @@ namespace 心电图绘制
public string examid { get; set; }
public string name { get; set; }
public string gender { get; set; }
public int age { get; set; }
public string age { get; set; }
public string ward { get; set; }
public string regid { get; set; }
public int hr { get; set; }
public string hr { get; set; }
public double pr { get; set; }
public string qrs { get; set; }
public string qtqtc { get; set; } // QT/QTC 被转换为 qtqt

View File

@ -85,29 +85,29 @@ namespace 心电图绘制
// string ecgDataJsonStr = File.ReadAllText(Application.StartupPath + @"\60心拍心电图数据JSON.txt");
string ecgDataJsonStr = json;
leadDataModel LDM = JsonConvert.DeserializeObject<leadDataModel>(ecgDataJsonStr);
float[] LEAD_I = valueConvert(Array.ConvertAll(LDM.LEAD_I.Split(' '), float.Parse));
float[] LEAD_I = valueConvert(Array.ConvertAll(LDM.LEAD_I, float.Parse));
_ecgDataDicAfterFilter.Add(0, LEAD_I.ToList());
float[] LEAD_II = valueConvert(Array.ConvertAll(LDM.LEAD_II.Split(' '), float.Parse));
float[] LEAD_II = valueConvert(Array.ConvertAll(LDM.LEAD_II, float.Parse));
_ecgDataDicAfterFilter.Add(1, LEAD_II.ToList());
float[] LEAD_III = valueConvert(Array.ConvertAll(LDM.LEAD_III.Split(' '), float.Parse));
float[] LEAD_III = valueConvert(Array.ConvertAll(LDM.LEAD_III, float.Parse));
_ecgDataDicAfterFilter.Add(2, LEAD_III.ToList());
float[] LEAD_AVR = valueConvert(Array.ConvertAll(LDM.LEAD_AVR.Split(' '), float.Parse));
float[] LEAD_AVR = valueConvert(Array.ConvertAll(LDM.LEAD_AVR, float.Parse));
_ecgDataDicAfterFilter.Add(3, LEAD_AVR.ToList());
float[] LEAD_AVL = valueConvert(Array.ConvertAll(LDM.LEAD_AVL.Split(' '), float.Parse));
float[] LEAD_AVL = valueConvert(Array.ConvertAll(LDM.LEAD_AVL, float.Parse));
_ecgDataDicAfterFilter.Add(4, LEAD_AVL.ToList());
float[] LEAD_AVF = valueConvert(Array.ConvertAll(LDM.LEAD_AVF.Split(' '), float.Parse));
float[] LEAD_AVF = valueConvert(Array.ConvertAll(LDM.LEAD_AVF, float.Parse));
_ecgDataDicAfterFilter.Add(5, LEAD_AVF.ToList());
float[] LEAD_V1 = valueConvert(Array.ConvertAll(LDM.LEAD_V1.Split(' '), float.Parse));
float[] LEAD_V1 = valueConvert(Array.ConvertAll(LDM.LEAD_V1, float.Parse));
_ecgDataDicAfterFilter.Add(6, LEAD_V1.ToList());
float[] LEAD_V2 = valueConvert(Array.ConvertAll(LDM.LEAD_V2.Split(' '), float.Parse));
float[] LEAD_V2 = valueConvert(Array.ConvertAll(LDM.LEAD_V2, float.Parse));
_ecgDataDicAfterFilter.Add(7, LEAD_V2.ToList());
float[] LEAD_V3 = valueConvert(Array.ConvertAll(LDM.LEAD_V3.Split(' '), float.Parse));
float[] LEAD_V3 = valueConvert(Array.ConvertAll(LDM.LEAD_V3, float.Parse));
_ecgDataDicAfterFilter.Add(8, LEAD_V3.ToList());
float[] LEAD_V4 = valueConvert(Array.ConvertAll(LDM.LEAD_V4.Split(' '), float.Parse));
float[] LEAD_V4 = valueConvert(Array.ConvertAll(LDM.LEAD_V4, float.Parse));
_ecgDataDicAfterFilter.Add(9, LEAD_V4.ToList());
float[] LEAD_V5 = valueConvert(Array.ConvertAll(LDM.LEAD_V5.Split(' '), float.Parse));
float[] LEAD_V5 = valueConvert(Array.ConvertAll(LDM.LEAD_V5, float.Parse));
_ecgDataDicAfterFilter.Add(10, LEAD_V5.ToList());
float[] LEAD_V6 = valueConvert(Array.ConvertAll(LDM.LEAD_V6.Split(' '), float.Parse));
float[] LEAD_V6 = valueConvert(Array.ConvertAll(LDM.LEAD_V6, float.Parse));
_ecgDataDicAfterFilter.Add(11, LEAD_V6.ToList());
if (!string.IsNullOrEmpty(info.orgname))