接入设备:BS-460
This commit is contained in:
commit
1b7539a083
@ -58,6 +58,15 @@
|
||||
<!--帝迈血常规DF55-->
|
||||
<add key="DF55-2" value="PC-202106061449,DF55-2,121,127.0.0.1,5600,GB18030" />
|
||||
|
||||
<!--尿常规U120-->
|
||||
<add key="U120" value="user-PC,U120,89,COM1,4800,NONE,8,1,GB18030" />
|
||||
|
||||
<!--BS-330E-->
|
||||
<add key="BS-330E" value="PC-202106061449,BS-330E,121,127.0.0.1,5600,GB18030" />
|
||||
|
||||
<!-- BC-5120 -->
|
||||
<add key="BC-5120" value="PC-202106061449,BC-5120,121,127.0.0.1,5600,GB18030" />
|
||||
|
||||
<add key="MA-4210" value="wstwsy-PC,MA-4210,90,COM1,9600,NONE,8,1" />
|
||||
<!--迈瑞BS-460-->
|
||||
<add key="BS-460" value="User-2024H-II,BS-460,91,127.0.0.1,6688,GB18030" />
|
||||
|
@ -17,9 +17,9 @@ using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
namespace FlyDockTool
|
||||
{
|
||||
public class deviceAnalysis
|
||||
public class deviceAnalysis
|
||||
{
|
||||
public EventHandler dataOutPutShow;
|
||||
public EventHandler dataOutPutShow;
|
||||
public static deviceAnalysis Instance; //申明一个EcgDrawing对象,复制Null
|
||||
private static readonly object LockHelper = new object();
|
||||
string tempData = string.Empty;//存储串口和TCP接收到的 累计数据
|
||||
@ -37,7 +37,7 @@ namespace FlyDockTool
|
||||
return Instance;
|
||||
}
|
||||
|
||||
deviceAnalysis()
|
||||
deviceAnalysis()
|
||||
{
|
||||
_tResult = new System.Threading.Timer(obj => TResultTick(), null, -1, 5000);//调用方法TResultTick 作为定时执行的方法 处于暂停状态
|
||||
_tcpResult = new System.Threading.Timer(obj => tcpResultTick(), null, -1, 10);//调用方法TResultTick 作为定时执行的方法 处于暂停状态
|
||||
@ -50,7 +50,7 @@ namespace FlyDockTool
|
||||
/// <param name="keyWords"></param>
|
||||
/// <param name="stringStr"></param>
|
||||
/// <returns></returns>
|
||||
int[] strCount(string keyWords,string stringStr)
|
||||
int[] strCount(string keyWords, string stringStr)
|
||||
{
|
||||
List<int> posList = new List<int>();
|
||||
for (int i = 0; (i + keyWords.Length) < stringStr.Length; i++)
|
||||
@ -1472,7 +1472,7 @@ namespace FlyDockTool
|
||||
ermList.Clear();
|
||||
if (i + 20 > resulteArray.Length)
|
||||
break;
|
||||
string[] spArray =resulteArray[3].Trim().Split(' ');
|
||||
string[] spArray = resulteArray[3].Trim().Split(' ');
|
||||
string sampleNo1 = resulteArray[3].Trim().Split(' ')[2].Replace("-", "0").TrimStart('0');
|
||||
//string testDate1 = jiexiDate(resulteArray[i + 1], resulteArray[i + 2]);
|
||||
string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
@ -1492,7 +1492,7 @@ namespace FlyDockTool
|
||||
erm1.sampleNo = sampleNo1;
|
||||
erm1.testDate = testDate1;
|
||||
erm1.chanelNo = "URO";//项目代号
|
||||
erm1.itemValue = resulteArray[i + 5].Substring(4,11).Trim();//项目结果
|
||||
erm1.itemValue = resulteArray[i + 5].Substring(4, 11).Trim();//项目结果
|
||||
erm1.itemUnit = "mg/dL";
|
||||
ermList.Add(erm1);
|
||||
|
||||
@ -1522,7 +1522,7 @@ namespace FlyDockTool
|
||||
erm4.sampleNo = sampleNo1;
|
||||
erm4.testDate = testDate1;
|
||||
erm4.chanelNo = "BIL";//项目代号
|
||||
erm4.itemValue = resulteArray[i + 8].Substring(5,13).Trim();//项目结果
|
||||
erm4.itemValue = resulteArray[i + 8].Substring(5, 13).Trim();//项目结果
|
||||
erm4.itemUnit = "";
|
||||
ermList.Add(erm4);
|
||||
|
||||
@ -1723,16 +1723,16 @@ namespace FlyDockTool
|
||||
string[] itemArray = new string[22] { "ALT", "AST", "ALP", "GGT", "IBIL", "TP", "ALB", "Crea", "UA", "GLU", "TG", "HDL", "LDL", "TB|TB", "TC", "DB", "CHE", "BUN|BUN", "TBA", "A/G", "BUN/CREA", "GLOB" };
|
||||
deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", "");
|
||||
deviceDataStr = deviceDataStr.Replace("OBX", "。");
|
||||
|
||||
|
||||
string[] valArray = deviceDataStr.Split('。');
|
||||
string sampleNo1 = string.Empty;//样本号
|
||||
for (int A = 0; A < valArray.Length; A++)
|
||||
{
|
||||
if (valArray[A].Contains("OBR|"))
|
||||
{
|
||||
int index1 = valArray[A].Substring(valArray[A].IndexOf("OBR|"), 20).IndexOf("||")+2;
|
||||
sampleNo1 = jiexisampleNo8(index1, valArray[A].Substring(valArray[A].IndexOf("OBR|"),18)).ToString();
|
||||
|
||||
int index1 = valArray[A].Substring(valArray[A].IndexOf("OBR|"), 20).IndexOf("||") + 2;
|
||||
sampleNo1 = jiexisampleNo8(index1, valArray[A].Substring(valArray[A].IndexOf("OBR|"), 18)).ToString();
|
||||
|
||||
}
|
||||
for (int i = 0; i < itemArray.Length; i++)
|
||||
{
|
||||
@ -1779,9 +1779,9 @@ namespace FlyDockTool
|
||||
itemStr = itemArray[i] + "^99MRC||";
|
||||
else
|
||||
itemStr = itemArray[i] + "^LN||";
|
||||
|
||||
int index1 = deviceDataStr.Substring(deviceDataStr.IndexOf("OBR|"), 20).IndexOf("||") + 2;
|
||||
sampleNo1 = jiexisampleNo8(index1, deviceDataStr.Substring(deviceDataStr.IndexOf("OBR|"), 18)).ToString();
|
||||
|
||||
int index1 = deviceDataStr.Substring(deviceDataStr.IndexOf("OBR|"), 20).IndexOf("||") + 2;
|
||||
sampleNo1 = jiexisampleNo8(index1, deviceDataStr.Substring(deviceDataStr.IndexOf("OBR|"), 18)).ToString();
|
||||
|
||||
|
||||
|
||||
@ -1858,7 +1858,7 @@ namespace FlyDockTool
|
||||
erm.sampleNo = sampleNo1;
|
||||
erm.testDate = testDate1;
|
||||
erm.chanelNo = "GLU";//项目代号
|
||||
erm.itemValue = resulteArray[i + 4].Substring(4,6).Trim();//项目结果
|
||||
erm.itemValue = resulteArray[i + 4].Substring(4, 6).Trim();//项目结果
|
||||
erm.itemUnit = "cells/uL";
|
||||
ermList.Add(erm);
|
||||
|
||||
@ -1970,7 +1970,7 @@ namespace FlyDockTool
|
||||
erm11.sampleNo = sampleNo1;
|
||||
erm11.testDate = testDate1;
|
||||
erm11.chanelNo = "Color";//项目代号
|
||||
erm11.itemValue = resulteArray[i + 15].Replace("Color:","").Trim();//项目结果
|
||||
erm11.itemValue = resulteArray[i + 15].Replace("Color:", "").Trim();//项目结果
|
||||
erm11.itemUnit = "mmol/L";
|
||||
ermList.Add(erm11);
|
||||
//将结果提交到LIS系统
|
||||
@ -2014,6 +2014,13 @@ namespace FlyDockTool
|
||||
ermList.Add(erm1);
|
||||
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "BC-5120")//BC-5120
|
||||
{
|
||||
string MachineCode = apiOptions.MachineCode;
|
||||
string MachineID = apiOptions.MachineID;
|
||||
deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", "");
|
||||
//string[] resulteArray = deviceDataStr.Split('\n');
|
||||
string sampleNo1 = string.Empty;//样本号
|
||||
|
||||
|
||||
//将结果提交到LIS系统
|
||||
@ -2030,7 +2037,7 @@ namespace FlyDockTool
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -2082,7 +2089,7 @@ namespace FlyDockTool
|
||||
string jiexiItemValueLast(string itemStr, string deviceDataStr)
|
||||
{
|
||||
string ItemValueStr = "";
|
||||
string Str1 = deviceDataStr.Substring(deviceDataStr.LastIndexOf(itemStr) + itemStr.Length+1, 10);
|
||||
string Str1 = deviceDataStr.Substring(deviceDataStr.LastIndexOf(itemStr) + itemStr.Length + 1, 10);
|
||||
int firstIndex = Str1.IndexOf('|');
|
||||
ItemValueStr = Str1.Substring(0, firstIndex);
|
||||
return ItemValueStr;
|
||||
@ -2138,14 +2145,14 @@ namespace FlyDockTool
|
||||
/// <param name="itemStr"></param>
|
||||
/// <param name="deviceDataStr"></param>
|
||||
/// <returns></returns>
|
||||
string jiexiVal(int index1,string keyStr, string dataStr)
|
||||
string jiexiVal(int index1, string keyStr, string dataStr)
|
||||
{
|
||||
string val1 ="";
|
||||
string val1 = "";
|
||||
for (int i = 1; i < 100; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
string str1 = dataStr.Substring(index1+ keyStr.Length, i);
|
||||
string str1 = dataStr.Substring(index1 + keyStr.Length, i);
|
||||
double valx = double.Parse(str1);
|
||||
val1 = str1;
|
||||
}
|
||||
@ -2155,7 +2162,7 @@ namespace FlyDockTool
|
||||
return val1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从字符串中 解析出 jiexiBase64 图像
|
||||
/// </summary>
|
||||
@ -2164,28 +2171,28 @@ namespace FlyDockTool
|
||||
/// <returns></returns>
|
||||
List<string> jiexiBase64(int[] array1, string keyStr, string dataStr)
|
||||
{
|
||||
List<string> imageBase64List=new List<string>();
|
||||
List<string> imageBase64List = new List<string>();
|
||||
for (int i = 0; i < array1.Length; i++)
|
||||
{
|
||||
for (int b = array1[i]; b< dataStr.Length; b++)
|
||||
for (int b = array1[i]; b < dataStr.Length; b++)
|
||||
{
|
||||
string str1 = dataStr.Substring(b, keyStr.Length);
|
||||
if(str1== keyStr)
|
||||
{
|
||||
string ImgBase64Str = dataStr.Substring(array1[i]+ 8, b- array1[i]- 8);
|
||||
if (str1 == keyStr)
|
||||
{
|
||||
string ImgBase64Str = dataStr.Substring(array1[i] + 8, b - array1[i] - 8);
|
||||
imageBase64List.Add(ImgBase64Str);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return imageBase64List;
|
||||
}
|
||||
|
||||
static string jiexiDate(string dateStr,string TimeStr)
|
||||
static string jiexiDate(string dateStr, string TimeStr)
|
||||
{
|
||||
string[] spArray = dateStr.Trim().Split(' ');
|
||||
string[] varArray= spArray[2].Trim().Trim('\r').Split('-');
|
||||
return varArray[2]+"-"+ varArray[0]+"-"+ varArray[1]+" "+ TimeStr.Trim().Trim('\r');
|
||||
string[] varArray = spArray[2].Trim().Trim('\r').Split('-');
|
||||
return varArray[2] + "-" + varArray[0] + "-" + varArray[1] + " " + TimeStr.Trim().Trim('\r');
|
||||
}
|
||||
|
||||
|
||||
@ -2555,7 +2562,7 @@ namespace FlyDockTool
|
||||
dataOutPutShow(o, null);//把数据显示到屏幕上
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (apiOptions.CurrentDevice == "HSYH-II")//华晟源尿常规型号:H-II
|
||||
_tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时
|
||||
if (apiOptions.CurrentDevice == "BT-200")//盛世东唐BT-200尿常规
|
||||
@ -2587,7 +2594,7 @@ namespace FlyDockTool
|
||||
if (apiOptions.CurrentDevice == "BS-430")//生化BS-430
|
||||
{
|
||||
//File.WriteAllText("deviceDataLog.txt", deviceDataStr, Encoding.GetEncoding("GB18030"));
|
||||
|
||||
|
||||
deviceAnalysisOption(tempData);
|
||||
tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据
|
||||
// _tResult.Change(10000, 10000);// 数据处理:延迟5秒开始 5秒计时
|
||||
@ -2623,9 +2630,9 @@ namespace FlyDockTool
|
||||
if (apiOptions.CurrentDevice == "BC-5130")//BC-5130
|
||||
{
|
||||
// _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时
|
||||
if (tempData.Contains("OBX|30|")|| tempData.Contains("OBX|29|"))//OBX|12|ST| 为结束符 说明字符串完整了
|
||||
if (tempData.Contains("OBX|30|") || tempData.Contains("OBX|29|"))//OBX|12|ST| 为结束符 说明字符串完整了
|
||||
{
|
||||
// MessageBox.Show(tempData);
|
||||
// MessageBox.Show(tempData);
|
||||
deviceAnalysisOption(tempData);
|
||||
tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据
|
||||
}
|
||||
@ -2694,12 +2701,12 @@ namespace FlyDockTool
|
||||
if (clientSocket == null)
|
||||
clientSocket = listener.Accept(); //一旦接受连接,创建一个客户端
|
||||
}
|
||||
|
||||
|
||||
int recv = clientSocket.Receive(data);
|
||||
if (recv > 0)
|
||||
{
|
||||
byte[] data1=new byte[recv];
|
||||
for (int i = 0;i<recv;i++)
|
||||
byte[] data1 = new byte[recv];
|
||||
for (int i = 0; i < recv; i++)
|
||||
data1[i] = data[i];
|
||||
|
||||
string encodingStr = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[5];
|
||||
@ -2709,17 +2716,17 @@ namespace FlyDockTool
|
||||
string[] msgArray = stringData.Split('\n');
|
||||
for (int i = 0; i < msgArray.Length; i++)
|
||||
{
|
||||
if (msgArray[i].Contains("MSH|")&& msgArray[i].Contains("||UNICODE||"))
|
||||
if (msgArray[i].Contains("MSH|") && msgArray[i].Contains("||UNICODE||"))
|
||||
{
|
||||
string msgId = msgArray[i].Substring(msgArray[i].IndexOf("R01|") +4, msgArray[i].IndexOf("|P|") -msgArray[i].IndexOf("R01|") - 4);
|
||||
string msgId = msgArray[i].Substring(msgArray[i].IndexOf("R01|") + 4, msgArray[i].IndexOf("|P|") - msgArray[i].IndexOf("R01|") - 4);
|
||||
string dateTimeNowStr = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
string responseMsg = "<SB>MSH|^~\\&|1|1|11|1|"+ dateTimeNowStr + "||ACK^R01|"+ msgId + "|P|2.3.1||||0||UNICODE|||<CR>MSA|AA|"+ msgId + "||||0|<CR><EB><CR>";
|
||||
string responseMsg = "<SB>MSH|^~\\&|1|1|11|1|" + dateTimeNowStr + "||ACK^R01|" + msgId + "|P|2.3.1||||0||UNICODE|||<CR>MSA|AA|" + msgId + "||||0|<CR><EB><CR>";
|
||||
byte[] sendBytes = Encoding.Unicode.GetBytes(responseMsg);
|
||||
clientSocket.Send(sendBytes);
|
||||
onReData("应答消息:"+responseMsg, null);//数据处理 并将数据显示在软件界面上
|
||||
onReData("应答消息:" + responseMsg, null);//数据处理 并将数据显示在软件界面上
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
onReData(stringData, null);//数据处理 并将数据显示在软件界面上
|
||||
}
|
||||
@ -2738,13 +2745,13 @@ namespace FlyDockTool
|
||||
accessDbPath = DateTime.Now.ToString("yyyy-MM-dd") + ".mdb";
|
||||
//string sql = "select a.sampleProgramID,b.SampleNo,a.ResultValue as ItemValue,a.EName as ItemCode from sampleProgram a inner join sampleInfo b on a.SampleInfoID=b.SampleInfoID where a.stateS is NULL ";
|
||||
string sql = "select a.sampleProgramID,b.SampleNo,a.ResultValue as ItemValue,a.EName as ItemCode from sampleProgram a inner join sampleInfo b on a.SampleInfoID=b.SampleInfoID";
|
||||
DataTable dt_2=new DataTable();
|
||||
DataTable dt_2 = new DataTable();
|
||||
try
|
||||
{
|
||||
dt_2 = accessOptions.CreateInstance(accessDbPath).ExcuteSql(sql);
|
||||
}
|
||||
catch { dt_2 = null; }
|
||||
if(dt_2==null)
|
||||
if (dt_2 == null)
|
||||
return;
|
||||
List<examResultMode> ermList = new List<examResultMode>();
|
||||
string MachineCode = apiOptions.MachineCode;
|
||||
|
@ -24,6 +24,8 @@ namespace FlyDockTool
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
string CurrentDevice= ConfigurationManager.AppSettings["CurrentDevice"];
|
||||
apiOptions.CurrentDevice = CurrentDevice;
|
||||
apiOptions.MacAddress = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[0];
|
||||
|
Loading…
Reference in New Issue
Block a user