123 lines
4.4 KiB
C#
123 lines
4.4 KiB
C#
|
|
using SOH.JianYan.YiQi.Base;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace SOH.JianYan.DEC_UT500
|
|||
|
|
{
|
|||
|
|
public partial class UT500 : SOH.JianYan.YiQi.Base.baseMain
|
|||
|
|
{
|
|||
|
|
public UT500()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
protected override void decoder()
|
|||
|
|
{
|
|||
|
|
base.decoder();
|
|||
|
|
string decodefile = Application.StartupPath + "\\raw\\data.txt";
|
|||
|
|
if (System.IO.File.Exists(decodefile))
|
|||
|
|
{
|
|||
|
|
int a = 0;
|
|||
|
|
string data = "";
|
|||
|
|
aa:
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
FileStream fs = new FileStream(decodefile, FileMode.Open, FileAccess.Read, FileShare.None);
|
|||
|
|
StreamReader sr = new StreamReader(fs);
|
|||
|
|
data = sr.ReadToEnd();
|
|||
|
|
sr.Close();
|
|||
|
|
sr.Dispose();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
a++;
|
|||
|
|
if (a > 11)
|
|||
|
|
goto aa;
|
|||
|
|
}
|
|||
|
|
if (data.EndsWith("\u000d\u000a\u0003"))
|
|||
|
|
{
|
|||
|
|
File.Delete(decodefile);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string[] sjs = data.Split(ETX);
|
|||
|
|
|
|||
|
|
foreach (string sj in sjs)
|
|||
|
|
{
|
|||
|
|
string[] items = sj.Split("\r\n".ToCharArray());
|
|||
|
|
string sampleno = "";
|
|||
|
|
DateTime sampletime = DateTime.Now;
|
|||
|
|
foreach (string item in items)
|
|||
|
|
{
|
|||
|
|
if (item.StartsWith("\u0002"))
|
|||
|
|
continue;
|
|||
|
|
if (item.StartsWith("NO."))
|
|||
|
|
{
|
|||
|
|
sampleno = item.Substring(0,"NO.000001".Length).Replace("NO.", "");
|
|||
|
|
sampletime = DateTime.Parse(item.Substring("NO.000001 ".Length));
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
if (item.StartsWith(" "))
|
|||
|
|
{
|
|||
|
|
//string date = item.Replace(" Date:", "");
|
|||
|
|
//sampletime = DateTime.Parse(date);
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
if (item == "")
|
|||
|
|
continue;
|
|||
|
|
// LEU - 0 cells/u
|
|||
|
|
//if (item.Length == "*BIL 3+ 100 umol/l".Length)
|
|||
|
|
//{
|
|||
|
|
string tdh = item.Substring(0, 4);
|
|||
|
|
string z1 = item.Substring(4, 3);
|
|||
|
|
string z2 = item.Substring(7).Replace("Cell/uL","").Replace("mmol/L", "").Replace("umol/L", "").Replace("mg/L", "").Replace("g/L", "").Replace("mg/mmol","").Replace("<=","").Replace(">=","").Replace("<", "").Replace("Normal", "-");
|
|||
|
|
if (Lis_result.canmodify(_yqbm, sampletime.Date, sampleno))
|
|||
|
|
{
|
|||
|
|
Lis_result.addresult(sampletime.Date, _yqbm, sampleno, tdh.Remove(0, 1).Trim(), z1.Trim() == "" ? z2.Trim() : z1.Trim());
|
|||
|
|
}
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if (sampleno == "")
|
|||
|
|
continue;
|
|||
|
|
Lis_result.calcsample(_yqbm, sampletime.Date, sampleno);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string _yqbm = "";
|
|||
|
|
|
|||
|
|
private void UT500_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
System.Configuration.Configuration conf = System.Configuration.ConfigurationManager.OpenExeConfiguration(Application.StartupPath + "\\local.ext");
|
|||
|
|
|
|||
|
|
if (conf.AppSettings.Settings.AllKeys.Contains("yqbm"))
|
|||
|
|
{
|
|||
|
|
_yqbm = conf.AppSettings.Settings["yqbm"].Value;
|
|||
|
|
}
|
|||
|
|
if (System.IO.File.Exists(Application.StartupPath + "\\SOH.OnLine.exe"))
|
|||
|
|
{
|
|||
|
|
System.Diagnostics.Process p = System.Diagnostics.Process.Start(Application.StartupPath + "\\SOH.OnLine.exe");
|
|||
|
|
Program.ps = p;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void UT500_FormClosing(object sender, FormClosingEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!Program.ps.HasExited)
|
|||
|
|
Program.ps.Kill();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|