diff --git a/app.config b/app.config index d9f2b23..a07c10f 100644 --- a/app.config +++ b/app.config @@ -58,8 +58,10 @@ + + - + diff --git a/deviceAnalysis.cs b/deviceAnalysis.cs index 4b7c3d3..49a738e 100644 --- a/deviceAnalysis.cs +++ b/deviceAnalysis.cs @@ -1985,7 +1985,149 @@ namespace FlyDockTool } + if (apiOptions.CurrentDevice == "U120")//尿常规U120 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] resulteArray = deviceDataStr.Split('\n'); + // File.WriteAllText("BT-200.TXT", deviceDataStr); + for (int i = 0; i < resulteArray.Length; i += 15) + { + //这里需要判断一下数据是否超过了 当前数据的长度 + ermList.Clear(); + if (i + 15 > resulteArray.Length) + break; + string[] spArray = resulteArray[3].Trim().Split(' '); + string sampleNo1 = spArray[2].Substring(0,1).TrimStart('0'); + // string sampleNo1 = resulteArray[2].Trim().Split(' ')[1]; .Replace("-", "0").TrimStart('0') + //string testDate1 = jiexiDate(resulteArray[i + 1], resulteArray[i + 2]); + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm = new examResultMode(); + erm.machineCode = MachineCode; + erm.machineID = MachineID; + erm.sampleNo = sampleNo1; + erm.testDate = testDate1; + erm.chanelNo = "LEU";//项目代号 + erm.itemValue = resulteArray[i + 4].Substring(4, 15).Trim();//项目结果//项目结果 + erm.itemUnit = ""; + ermList.Add(erm); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = "NIT";//项目代号 + erm1.itemValue = resulteArray[i + 5].Substring(4, 11).Trim();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + + examResultMode erm2 = new examResultMode(); + erm2.machineCode = MachineCode; + erm2.machineID = MachineID; + erm2.sampleNo = sampleNo1; + erm2.testDate = testDate1; + erm2.chanelNo = "URO";//项目代号 + erm2.itemValue = resulteArray[i + 6].Substring(4, 13).Trim();//项目结果 + erm2.itemUnit = ""; + ermList.Add(erm2); + + examResultMode erm3 = new examResultMode(); + erm3.machineCode = MachineCode; + erm3.machineID = MachineID; + erm3.sampleNo = sampleNo1; + erm3.testDate = testDate1; + erm3.chanelNo = "PRO";//项目代号 + erm3.itemValue = resulteArray[i + 7].Substring(4, 15).Trim();//项目结果 + erm3.itemUnit = ""; + ermList.Add(erm3); + + examResultMode erm4 = new examResultMode(); + erm4.machineCode = MachineCode; + erm4.machineID = MachineID; + erm4.sampleNo = sampleNo1; + erm4.testDate = testDate1; + erm4.chanelNo = "pH";//项目代号 + erm4.itemValue = resulteArray[i + 8].Substring(4, 12).Trim();//项目结果 + erm4.itemUnit = ""; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "BLO";//项目代号 + erm5.itemValue = resulteArray[i + 9].Substring(4, 15).Trim();//项目结果 + erm5.itemUnit = ""; + ermList.Add(erm5); + + + examResultMode erm6 = new examResultMode(); + erm6.machineCode = MachineCode; + erm6.machineID = MachineID; + erm6.sampleNo = sampleNo1; + erm6.testDate = testDate1; + erm6.chanelNo = "SG";//项目代号 + erm6.itemValue = resulteArray[i + 10].Substring(4, 13).Trim();//项目结果 + erm6.itemUnit = ""; + ermList.Add(erm6); + + examResultMode erm10 = new examResultMode(); + erm10.machineCode = MachineCode; + erm10.machineID = MachineID; + erm10.sampleNo = sampleNo1; + erm10.testDate = testDate1; + erm10.chanelNo = "KET";//项目代号 + erm10.itemValue = resulteArray[i + 11].Substring(4, 15).Trim();//项目结果 + erm10.itemUnit = ""; + ermList.Add(erm10); + + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "BIL";//项目代号 + erm7.itemValue = resulteArray[i + 12].Substring(4, 13).Trim();//项目结果 + erm7.itemUnit = ""; + ermList.Add(erm7); + + examResultMode erm8 = new examResultMode(); + erm8.machineCode = MachineCode; + erm8.machineID = MachineID; + erm8.sampleNo = sampleNo1; + erm8.testDate = testDate1; + erm8.chanelNo = "GLU";//项目代号 + erm8.itemValue = resulteArray[i + 13].Substring(4, 14).Trim();//项目结果 + erm8.itemUnit = ""; + ermList.Add(erm8); + + examResultMode erm9 = new examResultMode(); + erm9.machineCode = MachineCode; + erm9.machineID = MachineID; + erm9.sampleNo = sampleNo1; + erm9.testDate = testDate1; + erm9.chanelNo = "ASC";//项目代号 + erm9.itemValue = resulteArray[i + 14].Substring(4, 12).Trim();//项目结果 + erm9.itemUnit = ""; + ermList.Add(erm9); + + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据提交成功:" + jsonStr, null); + else + dataOutPutShow("数据提交失败:" + jsonStr, null); + } + + } return rerultJson; } @@ -2459,6 +2601,13 @@ namespace FlyDockTool SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 } + if (apiOptions.CurrentDevice == "U120")//尿常规U120 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + } /// @@ -2575,6 +2724,11 @@ namespace FlyDockTool } if (apiOptions.CurrentDevice == "MA-4210")//MA-4210 _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + + if (apiOptions.CurrentDevice == "U120")//尿常规U120 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } } /// @@ -2894,7 +3048,10 @@ namespace FlyDockTool { SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 } - + if (apiOptions.CurrentDevice == "U120")//尿常规U120 + { + SerialPortOption.CreateInstance().StopDataReadThread();//停止数据接收 + } }