diff --git a/FlyDockTool.csproj b/FlyDockTool.csproj new file mode 100644 index 0000000..52d1b81 --- /dev/null +++ b/FlyDockTool.csproj @@ -0,0 +1,122 @@ + + + + + Debug + AnyCPU + {038F3E03-92BE-44E8-B672-69312A8CF19F} + WinExe + FlyDockTool + FlyDockTool + v4.0 + 512 + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + logo.ico + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + 7.3 + prompt + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + 7.3 + prompt + + + + packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + Form + + + mainForm.cs + + + + + + + mainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/FlyDockTool.sln b/FlyDockTool.sln new file mode 100644 index 0000000..b30b0ca --- /dev/null +++ b/FlyDockTool.sln @@ -0,0 +1,31 @@ + +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}") = "FlyDockTool", "FlyDockTool.csproj", "{038F3E03-92BE-44E8-B672-69312A8CF19F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Debug|x86.ActiveCfg = Debug|x86 + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Debug|x86.Build.0 = Debug|x86 + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Release|Any CPU.Build.0 = Release|Any CPU + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Release|x86.ActiveCfg = Release|x86 + {038F3E03-92BE-44E8-B672-69312A8CF19F}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4EBBBB63-17F4-466F-909A-A502565AFE4F} + EndGlobalSection +EndGlobal diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..0ba595d --- /dev/null +++ b/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace FlyDockTool +{ + internal static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new mainForm()); ; + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..eb95e44 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("FlyDockTool")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FlyDockTool")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("038f3e03-92be-44e8-b672-69312a8cf19f")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..2250a61 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace FlyDockTool.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 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() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [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("FlyDockTool.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..2a33df1 --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace FlyDockTool.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; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/accessOptions.cs b/accessOptions.cs new file mode 100644 index 0000000..cee23b6 --- /dev/null +++ b/accessOptions.cs @@ -0,0 +1,226 @@ +using System.Data; +using System.IO; +using System.Windows.Forms; +using System.Drawing; +using System.Data.SqlClient; +using System; +using System.Text; +using System.Data.OleDb; + +namespace FlyDockTool +{ + public class accessOptions + { + public OleDbConnection SqlConn = null; + /// + /// 让此类创建一个单例类 + /// + public static accessOptions Instance = null;//申明一个EcgDrawing对象,复制Null + private static readonly object LockHelper = new object(); + + public static accessOptions CreateInstance(string accessDbPath) + { + if (Instance == null) + { + lock (LockHelper) + { + if (Instance == null) + Instance = new accessOptions(accessDbPath); + } + } + return Instance; + } + + public accessOptions(string accessDbPath) + { + GetSqlConnection(accessDbPath); + } + + /// + /// 获得sqlite数据库连接 + /// + /// + public bool GetSqlConnection(string accessDbPath) + { + try + { + string ConnectionStr = "Provider=Microsoft.Jet.OleDb.4.0;"; + ConnectionStr += @"Data Source="+ accessDbPath + ""; + OleDbConnection conn = new OleDbConnection(ConnectionStr); + SqlConn = conn; + } + catch { return false; } + return true; + } + + /// + /// 执行sqlite查询语句,并返回一个 DataTable + /// + /// + /// + public DataTable ExcuteSql(string sqliteStr) + { + try + { + if (SqlConn.State == ConnectionState.Closed) + { + SqlConn.Open(); + } + + + var sqliteDp = new OleDbDataAdapter(sqliteStr, SqlConn) {SelectCommand = {CommandTimeout = 600000}}; + var sqliteds = new DataSet(); + sqliteDp.Fill(sqliteds); + return sqliteds.Tables[0]; + } + catch(Exception ex) + { + //byte[] ecgDataArray = Encoding.UTF8.GetBytes(sqliteStr.ToString() + "\r\n"+ex.ToString()+"\r\n"); + //ecgFileWrite(ecgDataArray, @"d:\log.txt"); + return null; + } + } + + private void ecgFileWrite(byte[] ecgDataArray, string FilePath) + { + FileStream fs = new FileStream(FilePath, FileMode.OpenOrCreate); + fs.Position = fs.Length; + //开始写入 + fs.Write(ecgDataArray, 0, ecgDataArray.Length); + //清空缓冲区、关闭流 + fs.Flush(); + fs.Close(); + } + /// + /// Sqlite 添加数据的操作函数 + /// + /// + /// + public bool SqlAdd(string sqliteSQL) + { + try + { + if (SqlConn.State == ConnectionState.Closed) + SqlConn.Open(); + var sqliteCmd = new OleDbCommand(sqliteSQL, SqlConn); + sqliteCmd.ExecuteNonQuery(); + sqliteCmd.Dispose(); + SqlConn.Close(); + } + catch { return false; } + return true; + } + + /// + /// Sqlite 删除数据的操作函数 + /// + /// + /// + public bool SqlDelete(string sqliteSQL) + { + try + { + if (SqlConn.State == ConnectionState.Closed) + SqlConn.Open(); + var sqliteCmd = new OleDbCommand(sqliteSQL, SqlConn); + sqliteCmd.ExecuteNonQuery(); + sqliteCmd.Dispose(); + SqlConn.Close(); + } + catch { return false; } + return true; + } + + /// + /// Sqlite 更新数据的操作函数 + /// + /// + /// + public bool SqlUpdate(string sqliteSQL) + { + try + { + if (SqlConn.State == ConnectionState.Closed) + SqlConn.Open(); + var sqliteCmd = new OleDbCommand(sqliteSQL, SqlConn); + sqliteCmd.ExecuteNonQuery(); + sqliteCmd.Dispose(); + SqlConn.Close(); + } + catch { return false; } + return true; + } + + /// + /// 执行SQL语句函数 + /// + /// SQL语句 + /// SQL语句中的参数组 + /// 返回受影响记录条数 + public int ExecuteSql(string sqlcmd, params SqlParameter[] paras) + { + + var cmd = new OleDbCommand(sqlcmd, SqlConn); + if (SqlConn.State == ConnectionState.Closed) + { + SqlConn.Open(); + } + + foreach (SqlParameter p in paras) + { + cmd.Parameters.Add(p); + } + + int cnt = cmd.ExecuteNonQuery(); + SqlConn.Close(); + return cnt; + } + + + + + /// + /// Sqlite 执行数据库的多条语句, + /// + /// + /// + public bool SqlExecuteNonQuery(string[] sqliteSQL) + { + + if (SqlConn.State == ConnectionState.Closed) + { + SqlConn.Open(); + } + + OleDbTransaction sqlTran = SqlConn.BeginTransaction(); + try + { + foreach (string sql in sqliteSQL) + { + var sqliteCmd = new OleDbCommand(sql, SqlConn, sqlTran); + int i = sqliteCmd.ExecuteNonQuery(); + sqliteCmd.Dispose(); + } + sqlTran.Commit(); + } + catch + { + sqlTran.Rollback(); + return false; + } + finally + { + + SqlConn.Close(); + } + return true; + } + + public Image GetImg(byte[] imgBytes) + { + var ms = new MemoryStream(imgBytes); + Image img = Image.FromStream(ms); + return img; + } + } +} diff --git a/apiOptions.cs b/apiOptions.cs new file mode 100644 index 0000000..14e6ad2 --- /dev/null +++ b/apiOptions.cs @@ -0,0 +1,89 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.IO.Ports; +using System.Linq; +using System.Text; +using System.Threading; +using System.Windows.Forms; + +namespace FlyDockTool +{ + + internal class apiOptions + { + /// + /// 让此类创建一个API操作的单例类 + /// + public static apiOptions Instance; //申明一个EcgDrawing对象,复制Null + private static readonly object LockHelper = new object(); + public static string MacAddress;//计算机名称 设备唯一代码,这个代码是LIS系统里添加设备时,给设备生成的唯一设备码 + public static string MachineCode;//设备型号 + public static string MachineID;//设备编码 + public static string CurrentDevice;//当前设备 + + public static apiOptions CreateInstance() + { + if (Instance == null) + lock (LockHelper) + { + if (Instance == null) + Instance = new apiOptions(); + } + return Instance; + } + + /// + /// 1.根据MacAddress获取设备信息,请求方式:get + /// + /// 计算机名称 + /// 设备型号 + /// + public baseMsgModel getMacAddressInfo() + { + string apiUrl = ConfigurationManager.AppSettings["getMacAddressInfo"];//获取设备信息URL + if (MacAddress.Trim().Length > 0) + apiUrl += "?MacAddress="+ apiOptions.MacAddress; + if (MachineCode.Trim().Length > 0) + apiUrl += "&MachineCode=" + apiOptions.MachineCode; + + //string returnDeviceInfoJson=commonOptions.HttpGet(apiUrl); + string returnDeviceInfoJson = commonOptions.HttpGet(apiUrl); + + baseMsgModel bmm=JsonConvert.DeserializeObject(returnDeviceInfoJson); + return bmm; + } + + /// + /// 上传检查结果到LIS系统 + /// + /// + /// + public baseMsgModel upLoadExamResult(List ermList) + { + string apiUrl = ConfigurationManager.AppSettings["upLoadExamResult"]; + string examListJson = JsonConvert.SerializeObject(ermList); + string returnJson = commonOptions.PostMoths(apiUrl, examListJson); + baseMsgModel bmm = JsonConvert.DeserializeObject(returnJson); + return bmm; + } + + /// + /// 上传图片结果到LIS系统 + /// + /// + /// + public baseMsgModel uploadExamImage(List EIPM) + { + string apiUrl = ConfigurationManager.AppSettings["upLoadExamImage"]; + string examImageListJson = JsonConvert.SerializeObject(EIPM); + string returnJson = commonOptions.PostMoths(apiUrl, examImageListJson); + baseMsgModel bmm = JsonConvert.DeserializeObject(returnJson); + return bmm; + } + + + } +} diff --git a/app.config b/app.config new file mode 100644 index 0000000..d9f2b23 --- /dev/null +++ b/app.config @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/baseMsgModel.cs b/baseMsgModel.cs new file mode 100644 index 0000000..6fc88a8 --- /dev/null +++ b/baseMsgModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FlyDockTool +{ + public class baseMsgModel + { + public string msg { get; set; }// + public int code { get; set; } + public object data { get; set; } + } +} diff --git a/commonOptions.cs b/commonOptions.cs new file mode 100644 index 0000000..5b11ecf --- /dev/null +++ b/commonOptions.cs @@ -0,0 +1,797 @@ +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; +using System.Windows.Forms; + +namespace FlyDockTool +{ + public class commonOptions + { + /// + /// 获取验证码文本 + /// + /// + /// + public static string RandomVerificationCode(int lengths) + { + string[] chars = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "P", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; + string code = ""; + Random random = new Random(); + for (int i = 0; i < lengths; i++) + { + code += chars[random.Next(chars.Length)]; + } + return code; + } + + + /// + /// 生成验证码图片 + /// + /// + /// + public static Bitmap VerificationCodeImg(string code) + { + Color[] colors = { + Color.Red, Color.OrangeRed,Color.SaddleBrown, + Color.LimeGreen,Color.Green,Color.MediumAquamarine, + Color.Blue,Color.MediumOrchid,Color.Black, + Color.DarkBlue,Color.Orange,Color.Brown, + Color.DarkCyan,Color.Purple + }; + string[] fonts = { "Verdana", "Microsoft Sans Serif", "Comic Sans MS", "Arial", "宋体" }; + Random random = new Random(); + // 创建一个 Bitmap 图片类型对象 + //Bitmap bitmap = new Bitmap(code.Length * 18, 32); + Bitmap bitmap = new Bitmap(80, 33); + // 创建一个图形画笔 + Graphics graphics = Graphics.FromImage(bitmap); + // 将图片背景填充成白色 + graphics.Clear(Color.White); + // 绘制验证码噪点 + //for (int i = 0; i < random.Next(60, 80); i++) + //{ + // int pointX = random.Next(bitmap.Width); + // int pointY = random.Next(bitmap.Height); + // graphics.DrawLine(new Pen(Color.LightGray, 1), pointX, pointY, pointX + 1, pointY); + //} + // 绘制随机线条 1 条 + //graphics.DrawLine( + // new Pen(colors[random.Next(colors.Length)], random.Next(3)), + // new Point( + // random.Next(bitmap.Width), + // random.Next(bitmap.Height)), + // new Point(random.Next(bitmap.Width), + // random.Next(bitmap.Height))); + // 绘制验证码 + for (int i = 0; i < code.Length; i++) + { + graphics.DrawString( + code.Substring(i, 1), + new System.Drawing.Font(fonts[random.Next(fonts.Length)], 17, FontStyle.Bold), + new SolidBrush(colors[random.Next(colors.Length)]), + 16 * i + 1, + random.Next(0, 5) + ); + } + // 绘制验证码噪点 + //for (int i = 0; i < random.Next(30, 50); i++) + //{ + // int pointX = random.Next(bitmap.Width); + // int pointY = random.Next(bitmap.Height); + // graphics.DrawLine(new Pen(colors[random.Next(colors.Length)], 1), pointX, pointY, pointX, pointY + 1); + //} + // 绘制随机线条 1 条 + //graphics.DrawLine( + // new Pen(colors[random.Next(colors.Length)], random.Next(3)), + // new Point( + // random.Next(bitmap.Width), + // random.Next(bitmap.Height)), + // new Point(random.Next(bitmap.Width), + // random.Next(bitmap.Height))); + return bitmap; + } + + + + ///// + ///// 获取福乐云HIS系统的token + ///// + ///// + ///// + ///// + //public static string getHisToken(string url1,string appkey, string appsecret) + //{ + // Dictionary dic = new Dictionary(); + // dic.Add("appkey", appkey); + // dic.Add("appsecret", appsecret); + + // string resultV = commonOptions.PostFile3(url1, dic); + // FlyHisTokenMsgModel tm = JsonConvert.DeserializeObject(resultV); + // return tm.data.access_token; + //} + + ///// + ///// 获取福乐云HIS系统的患者基本信息 + ///// + ///// + ///// + ///// + //public static FlyHisEcgDataModel GetHisEcgData(string url1, string Yiyuanid, string kaifangsj,string token) + //{ + // Dictionary dic = new Dictionary(); + // dic.Add("Yiyuanid", Yiyuanid); + // dic.Add("kaifangsj", kaifangsj); + // dic.Add("token", token); + // string resultV = commonOptions.PostFile3(url1, dic); + // FlyHisEcgDataModel tm = JsonConvert.DeserializeObject(resultV); + // return tm; + //} + + + + /// + /// post form-data 参数 + /// + /// + /// + /// + //public static string PostFile3(string url, Dictionary 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 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 Encrypt(string plainText) + { + string base64EncryptedData = string.Empty; + // 创建 RSA 密钥对 + using (var rsa = new RSACryptoServiceProvider()) + { + // 获取公钥 + string publicKey = rsa.ToXmlString(false); + // 加载公钥 + rsa.FromXmlString("gMIre8vicEqHjwhyrMUSMbwyR+STy9vGDyqmOd9xA4JI9/ghqAQAl5T9R8z87gwKMosPsEaRf4/1tg8taa/q2g0xwcZZ3dZlBzDSQ7k7I7t/Cv+m3YUZDp1U1TooSw8NzX3MQ36u1uiniWAUMvA0PT17dR6dxsQmMdDN4xSJO/0=AQAB"); + // 将待加密数据转换成字节数组 + 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)); + // } + //} + + + /// + /// DES加密 + /// + /// 加密数据 + /// 8位字符的密钥字符串 + /// 8位字符的初始化向量字符串 + /// + 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); + } + + /// + /// DES解密 + /// + /// 解密数据 + /// 8位字符的密钥字符串(需要和加密时相同) + /// 8位字符的初始化向量字符串(需要和加密时相同) + /// + 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; + } + + + /// + /// + /// + /// + /// + /// + /// + 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; + } + + + + /// + /// http 上传文件 好用版 + /// + /// + /// + /// + /// + /// + public static string PostFile2(string url, string filePath, Dictionary 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, "img", 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 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 + } + } + + + + /// + /// 图片转base64 + /// + /// + /// + public static string DocumentToBase64Str(string fileName) + { + FileStream filestream = new FileStream(fileName, FileMode.Open); + byte[] bt = new byte[filestream.Length]; + //调用read读取方法 + filestream.Read(bt, 0, bt.Length); + string base64Str = Convert.ToBase64String(bt); + filestream.Close(); + return base64Str; + } + + + /// + /// 海军给的 http 上传文件 好用版 + /// + /// + /// + /// + /// + /// + //public static string PostFile2(string url, string filePath, Dictionary 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 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 + // } + //} + + + + + + + + + /// + /// 指定Post地址使用Get 方式获取全部字符串 + /// + /// 请求后台地址 + /// + public static string PostByParas(string url, Dictionary 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; + } + + + ///// + ///// 发送HttpGet请求 + ///// + ///// + ///// + //public static string HttpGet1(string Url) + //{ + // try + // { + // HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); + // HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + + // //response.Cookies = cookie.GetCookies(response.ResponseUri); + // 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 e) + // { + + // return "error:" + e.ToString(); + // } + + //} + + + + public static string HttpGet(string url) + { + //ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); + try + { + // MessageBox.Show(url); + // 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(); + } + }catch (Exception ex) { MessageBox.Show(ex.ToString()); } + return ""; + } + + + + /// + /// 格式化磁盘 + /// + /// 盘符名称:C:、D:、E:、F: + /// + 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; + } + + + + } +} diff --git a/deviceAnalysis.cs b/deviceAnalysis.cs new file mode 100644 index 0000000..fc593de --- /dev/null +++ b/deviceAnalysis.cs @@ -0,0 +1,2897 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Net; +using System.Text; +using System.Threading; +using System.Configuration; +using System.Windows.Forms; +using System.IO; +using System.Drawing; +using System.Drawing.Imaging; +using System.Data; +using System.Security.Cryptography; +using System.Runtime.InteropServices.ComTypes; + +namespace FlyDockTool +{ + public class deviceAnalysis + { + public EventHandler dataOutPutShow; + public static deviceAnalysis Instance; //申明一个EcgDrawing对象,复制Null + private static readonly object LockHelper = new object(); + string tempData = string.Empty;//存储串口和TCP接收到的 累计数据 + private System.Threading.Timer _tResult;//串口数据接收 声明一个计时器变量 + private System.Threading.Timer _tcpResult;//tcp数据接收 声明一个计时器变量 + private System.Threading.Timer _AccessResult;//定时读取Access数据库的数据 声明一个计时器变量 + public static deviceAnalysis CreateInstance() + { + if (Instance == null) + lock (LockHelper) + { + if (Instance == null) + Instance = new deviceAnalysis(); + } + return Instance; + } + + deviceAnalysis() + { + _tResult = new System.Threading.Timer(obj => TResultTick(), null, -1, 5000);//调用方法TResultTick 作为定时执行的方法 处于暂停状态 + _tcpResult = new System.Threading.Timer(obj => tcpResultTick(), null, -1, 10);//调用方法TResultTick 作为定时执行的方法 处于暂停状态 + _AccessResult = new System.Threading.Timer(obj => accessResultTick(), null, -1, 10000);//调用方法TResultTick 作为定时执行的方法 处于暂停状态 + } + + /// + /// 查找某个字符小串在 字符大串中出现的位置数组 + /// + /// + /// + /// + int[] strCount(string keyWords,string stringStr) + { + List posList = new List(); + for (int i = 0; (i + keyWords.Length) < stringStr.Length; i++) + { + string val1 = stringStr.Substring(i, keyWords.Length); + if (val1 == keyWords) + posList.Add(i); + } + return posList.ToArray(); + } + /// + /// 数据处理 + /// + /// + /// + public string deviceAnalysisOption(string deviceDataStr) + { + //MessageBox.Show(deviceDataStr); + string rerultJson = string.Empty; + if (apiOptions.CurrentDevice == "HSYH-II")//华晟源尿常规型号:H-II + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] resulteArray = deviceDataStr.Split('\n'); + for (int i = 0; i < resulteArray.Length; i += 16) + { + //这里需要判断一下数据是否超过了 当前数据的长度 + ermList.Clear(); + if (i + 16 > resulteArray.Length) + break; + string[] spArray = resulteArray[i + 1].Trim().Split(' '); + string sampleNo1 = spArray[0].Trim().Replace("NO", "").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].Replace("LEU", "").Replace("cells/uL", "").Trim().Split(' ')[0].Trim();//项目结果 + erm.itemUnit = "cells/uL"; + 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].Replace("NIT", "").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].Replace("URO", "").Replace("umol/L", "").Trim().Split(' ')[0].Trim();//项目结果 + erm2.itemUnit = "umol/L"; + 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].Replace("PRO", "").Replace("g/L", "").Trim().Split(' ')[0].Trim();//项目结果 + erm3.itemUnit = "g/L"; + 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].Replace("PH", "").Trim();//项目结果 + erm4.itemUnit = ""; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "BLD";//项目代号 + erm5.itemValue = resulteArray[i + 9].Replace("BLD", "").Replace("cells/uL", "").Trim().Split(' ')[0].Trim();//项目结果 + erm5.itemUnit = "cells/uL"; + 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].Replace("SG", "").Trim();//项目结果 + erm6.itemUnit = ""; + ermList.Add(erm6); + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "KET";//项目代号 + erm7.itemValue = resulteArray[i + 11].Replace("KET", "").Replace("mmol/L", "").Trim().Split(' ')[0].Trim();//项目结果 + erm7.itemUnit = "mmol/L"; + ermList.Add(erm7); + + examResultMode erm8 = new examResultMode(); + erm8.machineCode = MachineCode; + erm8.machineID = MachineID; + erm8.sampleNo = sampleNo1; + erm8.testDate = testDate1; + erm8.chanelNo = "BIL";//项目代号 + erm8.itemValue = resulteArray[i + 12].Replace("BIL", "").Replace("umol/L", "").Trim().Split(' ')[0].Trim();//项目结果 + erm8.itemUnit = "umol/L"; + ermList.Add(erm8); + + examResultMode erm9 = new examResultMode(); + erm9.machineCode = MachineCode; + erm9.machineID = MachineID; + erm9.sampleNo = sampleNo1; + erm9.testDate = testDate1; + erm9.chanelNo = "GLU";//项目代号 + erm9.itemValue = resulteArray[i + 13].Replace("GLU", "").Replace("mmol/L", "").Trim().Split(' ')[0].Trim();//项目结果 + erm9.itemUnit = "mmol/L"; + ermList.Add(erm9); + + examResultMode erm10 = new examResultMode(); + erm10.machineCode = MachineCode; + erm10.machineID = MachineID; + erm10.sampleNo = sampleNo1; + erm10.testDate = testDate1; + erm10.chanelNo = "VC";//项目代号 + erm10.itemValue = resulteArray[i + 14].Replace("VC", "").Replace("mmol/L", "").Trim().Split(' ')[0].Trim();//项目结果 + erm10.itemUnit = "mmol/L"; + ermList.Add(erm10); + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据提交成功:" + jsonStr, null); + else + dataOutPutShow("数据提交失败:" + jsonStr, null); + } + + } + if (apiOptions.CurrentDevice == "BT-200")//盛世东唐BT-200尿常规 + { + 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[i + 1].Trim().Split(' '); + string sampleNo1 = resulteArray[2].Trim().Replace("Seq:", "").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 + 3].Replace("LEU", "").Replace("Neg", "").Trim().Split(' ')[0].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 + 4].Replace("NIT", "").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 + 5].Replace("URO", "").Replace("umol/L", "").Trim().Split(' ')[0].Trim();//项目结果 + erm2.itemUnit = "umol/L"; + 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 + 6].Replace("PRO", "").Replace("Neg", "").Trim().Split(' ')[0].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 + 7].Replace("PH", "").Trim();//项目结果 + erm4.itemUnit = ""; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "BLD";//项目代号 + erm5.itemValue = resulteArray[i + 8].Replace("BLD", "").Replace("Neg", "").Trim().Split(' ')[0].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 + 9].Replace("SG", "").Trim();//项目结果 + erm6.itemUnit = ""; + ermList.Add(erm6); + + examResultMode erm10 = new examResultMode(); + erm10.machineCode = MachineCode; + erm10.machineID = MachineID; + erm10.sampleNo = sampleNo1; + erm10.testDate = testDate1; + erm10.chanelNo = "VC";//项目代号 + erm10.itemValue = resulteArray[i + 10].Replace("VC", "").Replace("Neg", "").Trim().Split(' ')[0].Trim();//项目结果 + erm10.itemUnit = ""; + ermList.Add(erm10); + + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "KET";//项目代号 + erm7.itemValue = resulteArray[i + 11].Replace("KET", "").Replace("Neg", "").Trim().Split(' ')[0].Trim();//项目结果 + erm7.itemUnit = ""; + ermList.Add(erm7); + + examResultMode erm8 = new examResultMode(); + erm8.machineCode = MachineCode; + erm8.machineID = MachineID; + erm8.sampleNo = sampleNo1; + erm8.testDate = testDate1; + erm8.chanelNo = "BIL";//项目代号 + erm8.itemValue = resulteArray[i + 12].Replace("BIL", "").Replace("Neg", "").Trim().Split(' ')[0].Trim();//项目结果 + erm8.itemUnit = ""; + ermList.Add(erm8); + + examResultMode erm9 = new examResultMode(); + erm9.machineCode = MachineCode; + erm9.machineID = MachineID; + erm9.sampleNo = sampleNo1; + erm9.testDate = testDate1; + erm9.chanelNo = "GLU";//项目代号 + erm9.itemValue = resulteArray[i + 13].Replace("GLU", "").Replace("Neg", "").Trim().Split(' ')[0].Trim();//项目结果 + erm9.itemUnit = "mmol/L"; + 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); + } + + } + if (apiOptions.CurrentDevice == "URIT-5181")//优利特血常规 5181 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[31] { "WBC", "LYM%", "MON%", "NEU%", "EOS%", "BASO%", "LYM#", "MON#", "NEU#", "EOS#", "BASO#", "ALY%", "ALY#", "LIC%", "LIC#", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW_CV", "RDW_SD", "PLT", "MPV", "PDW", "PCT", "P_LCR", "P_LCC", "NRBC%", "NRBC#" }; + //string[] resulteArray = deviceDataStr.Split('\n'); + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = itemArray[i] + "||"; + sampleNo1 = deviceDataStr.Substring(deviceDataStr.IndexOf("|URIT^URIT-5160|||") - 7, 7).TrimStart('0'); + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + erm1.itemValue = jiexiItemValue(itemStr, deviceDataStr);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + + //把血常规的图也传上去 + List eipmList = new List(); + int[] array1 = strCount("^Base64^", deviceDataStr); + int[] array2 = strCount("||||||F||||||", deviceDataStr); + for (int i = 0; i < array2.Length; i++) + { + string base64Str = deviceDataStr.Substring(array1[i] + 8, array2[i] - array1[i] - 8); + examImageParaModel EIPM1 = new examImageParaModel(); + EIPM1.machineCode = MachineCode; + EIPM1.machineID = MachineID; + EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + EIPM1.sampleNo = sampleNo1; + EIPM1.img = "data:image/jpeg;base64," + base64Str; + eipmList.Add(EIPM1); + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (eipmList.Count > 0) + { + baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + //if (bmm2.code == 200) + // dataOutPutShow("图像提交成功:" + jsonStr, null); + //else + // dataOutPutShow("图像提交失败:" + jsonStr, null); + } + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "DF55")//帝迈血常规DF55 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[27] { "WBC", "NEU%", "LYM%", "MON%", "EOS%", "BAS%", "NEU#", "LYM#", "MON#", "EOS#", "BAS#", "*ALY%", "*LIC#", "*LIC%", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW-SD", "PLT", "MPV", "PDW", "PCT", "*ALY#", "RDW-CV" }; + //string[] resulteArray = deviceDataStr.Split('\n'); + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = string.Empty; + if (itemArray[i] == "*LIC#" || itemArray[i] == "*LIC%" || itemArray[i] == "PCT") + itemStr = itemArray[i] + "^99MRC||"; + else + itemStr = itemArray[i] + "^LN||"; + string val1 = jiexiVal(deviceDataStr.IndexOf("PID|"), "PID|", deviceDataStr).ToString(); + sampleNo1 = val1; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i]; //项目代号 + erm1.itemValue = jiexiVal(deviceDataStr.IndexOf(itemStr), itemStr, deviceDataStr).ToString();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + string jsonStr12 = JsonConvert.SerializeObject(ermList); + //把血常规的图也传上去 + List eipmList = new List(); + int[] array1 = strCount("^Base64^", deviceDataStr); + string keyStr = "||||||F";//结束符 + List imgBase64StrList = jiexiBase64(array1, keyStr, deviceDataStr);//解析出数据中的图片base64 + //int[] array2 = strCount("||||||F||||||", deviceDataStr); + for (int i = 0; i < imgBase64StrList.Count; i++) + { + string base64Str = imgBase64StrList[i]; + examImageParaModel EIPM1 = new examImageParaModel(); + EIPM1.machineCode = MachineCode; + EIPM1.machineID = MachineID; + EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + EIPM1.sampleNo = sampleNo1; + EIPM1.img = "data:image/jpeg;base64," + base64Str; + eipmList.Add(EIPM1); + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (eipmList.Count > 0) + { + baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + //if (bmm2.code == 200) + // dataOutPutShow("图像提交成功:" + jsonStr, null); + //else + // dataOutPutShow("图像提交失败:" + jsonStr, null); + } + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "TCPTEST")//tcp数据接收测试 数据不做任何处理 + { + + } + if (apiOptions.CurrentDevice == "CS-480")//迪瑞全自动生化分析仪 CS-480 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[10] { "ALT", "AST", "TBIL", "UREA", "CRE-E", "GLU", "TC", "TG", "HDL-C", "LDL-C" }; + //deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string[] valArray = deviceDataStr.Split('\n'); + string sampleNo1 = string.Empty;//样本号 + for (int A = 0; A < valArray.Length; A++) + { + if (valArray[A].Contains("|480^480|")) + { + // int index3 = jiexisampleNo(valArray[A].IndexOf("|480^480|"), valArray[A]); + sampleNo1 = jiexisampleNo(valArray[A].IndexOf("|480^480|"), valArray[A]).ToString(); + // File.WriteAllText("test1.txt","哈哈哈 " + index3.ToString() + " " + valArray[A] + " 原样字符串:" + deviceDataStr); + // MessageBox.Show("哈哈哈 "+index3.ToString()+" "+ valArray[A]+" 原样字符串:"+ deviceDataStr); + } + for (int i = 0; i < itemArray.Length; i++) + { + + if (valArray[A].Contains(itemArray[i])) + { + string itemStr = itemArray[i] + "^1|"; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + erm1.itemValue = jiexiItemValue(itemStr, valArray[A]);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + } + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "SL300C")//Senlo生化SL300C + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[20] { "ALT", "AST", "AST/ALT", "ALP", "GGT", "TBIL", "DBIL", "IBIL", "TP", "ALB", "GLB", "A/G", "Urea", "CREA", "UA", "GLU", "TCHO", "TG", "HDL-C", "LDL-C" }; + //deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string[] valArray = deviceDataStr.Split('\n'); + string sampleNo1 = string.Empty;//样本号 + for (int A = 0; A < valArray.Length; A++) + { + if (valArray[A].Contains("OBR||")) + { + // int index3 = jiexisampleNo(valArray[A].IndexOf("|480^480|"), valArray[A]); + sampleNo1 = jiexiVal(valArray[A].IndexOf("OBR||"), "OBR||", valArray[A]).ToString(); + // File.WriteAllText("test1.txt","哈哈哈 " + index3.ToString() + " " + valArray[A] + " 原样字符串:" + deviceDataStr); + // MessageBox.Show("哈哈哈 "+index3.ToString()+" "+ valArray[A]+" 原样字符串:"+ deviceDataStr); + } + for (int i = 0; i < itemArray.Length; i++) + { + + if (valArray[A].Contains(itemArray[i])) + { + string itemStr = itemArray[i] + "^1|"; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + erm1.itemValue = jiexiItemValue(itemStr, valArray[A]);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + } + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "BA600")//尿常规 GeniusBA600 + { + 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 += 16) + { + //这里需要判断一下数据是否超过了 当前数据的长度 + ermList.Clear(); + if (i + 16 > resulteArray.Length) + break; + //string[] spArray = resulteArray[i + 1].Trim().Split(' '); + string sampleNo1 = resulteArray[3].Trim().Split(':')[1].Replace("ID", "").Trim(); + //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 = "VC";//项目代号 + erm.itemValue = resulteArray[i + 4].Replace("VC", "").Trim().Split(' ')[0].Trim();//项目结果 + erm.itemUnit = ""; + ermList.Add(erm); + + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = "URO";//项目代号 + erm1.itemValue = resulteArray[i + 5].Replace("URO", "").Trim();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + + examResultMode erm2 = new examResultMode(); + erm2.machineCode = MachineCode; + erm2.machineID = MachineID; + erm2.sampleNo = sampleNo1; + erm2.testDate = testDate1; + erm2.chanelNo = "BIL";//项目代号 + erm2.itemValue = resulteArray[i + 6].Replace("BIL", "").Trim().Trim();//项目结果 + erm2.itemUnit = ""; + ermList.Add(erm2); + + examResultMode erm3 = new examResultMode(); + erm3.machineCode = MachineCode; + erm3.machineID = MachineID; + erm3.sampleNo = sampleNo1; + erm3.testDate = testDate1; + erm3.chanelNo = "KET";//项目代号 + erm3.itemValue = resulteArray[i + 7].Replace("KET", "").Trim();//项目结果 + erm3.itemUnit = ""; + ermList.Add(erm3); + + examResultMode erm4 = new examResultMode(); + erm4.machineCode = MachineCode; + erm4.machineID = MachineID; + erm4.sampleNo = sampleNo1; + erm4.testDate = testDate1; + erm4.chanelNo = "BLD";//项目代号 + erm4.itemValue = resulteArray[i + 8].Replace("BLD", "").Replace("Cell/uL", "").Trim();//项目结果 + erm4.itemUnit = "Cell/uL"; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "PRO";//项目代号 + erm5.itemValue = resulteArray[i + 9].Replace("PRO", "").Trim();//项目结果 + erm5.itemUnit = ""; + ermList.Add(erm5); + + + examResultMode erm6 = new examResultMode(); + erm6.machineCode = MachineCode; + erm6.machineID = MachineID; + erm6.sampleNo = sampleNo1; + erm6.testDate = testDate1; + erm6.chanelNo = "NIT";//项目代号 + erm6.itemValue = resulteArray[i + 10].Replace("NIT", "").Trim();//项目结果 + erm6.itemUnit = ""; + ermList.Add(erm6); + + examResultMode erm10 = new examResultMode(); + erm10.machineCode = MachineCode; + erm10.machineID = MachineID; + erm10.sampleNo = sampleNo1; + erm10.testDate = testDate1; + erm10.chanelNo = "LEU";//项目代号 + erm10.itemValue = resulteArray[i + 11].Replace("LEU", "").Trim();//项目结果 + erm10.itemUnit = ""; + ermList.Add(erm10); + + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "GLU";//项目代号 + erm7.itemValue = resulteArray[i + 12].Replace("GLU", "").Trim();//项目结果 + erm7.itemUnit = ""; + ermList.Add(erm7); + + examResultMode erm8 = new examResultMode(); + erm8.machineCode = MachineCode; + erm8.machineID = MachineID; + erm8.sampleNo = sampleNo1; + erm8.testDate = testDate1; + erm8.chanelNo = "SG";//项目代号 + erm8.itemValue = resulteArray[i + 13].Replace("SG", "").Trim();//项目结果 + erm8.itemUnit = ""; + ermList.Add(erm8); + + examResultMode erm9 = new examResultMode(); + erm9.machineCode = MachineCode; + erm9.machineID = MachineID; + erm9.sampleNo = sampleNo1; + erm9.testDate = testDate1; + erm9.chanelNo = "PH";//项目代号 + erm9.itemValue = resulteArray[i + 14].Replace("PH", "").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); + } + + } + if (apiOptions.CurrentDevice == "BA600MY")//煤窑中心卫生院的尿常规 GeniusBA600 + { + 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 += 16) + { + //这里需要判断一下数据是否超过了 当前数据的长度 + ermList.Clear(); + if (i + 16 > resulteArray.Length) + break; + //string[] spArray = resulteArray[i + 1].Trim().Split(' '); + string sampleNo1 = resulteArray[2].TrimStart('0').Trim(); + //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 = "VC";//项目代号 + erm.itemValue = resulteArray[i + 4].Replace("VC", "").Trim().Split(' ')[0].Trim();//项目结果 + erm.itemUnit = ""; + ermList.Add(erm); + + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = "URO";//项目代号 + erm1.itemValue = resulteArray[i + 5].Replace("URO", "").Trim();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + + examResultMode erm2 = new examResultMode(); + erm2.machineCode = MachineCode; + erm2.machineID = MachineID; + erm2.sampleNo = sampleNo1; + erm2.testDate = testDate1; + erm2.chanelNo = "BIL";//项目代号 + erm2.itemValue = resulteArray[i + 6].Replace("BIL", "").Trim().Trim();//项目结果 + erm2.itemUnit = ""; + ermList.Add(erm2); + + examResultMode erm3 = new examResultMode(); + erm3.machineCode = MachineCode; + erm3.machineID = MachineID; + erm3.sampleNo = sampleNo1; + erm3.testDate = testDate1; + erm3.chanelNo = "KET";//项目代号 + erm3.itemValue = resulteArray[i + 7].Replace("KET", "").Trim();//项目结果 + erm3.itemUnit = ""; + ermList.Add(erm3); + + examResultMode erm4 = new examResultMode(); + erm4.machineCode = MachineCode; + erm4.machineID = MachineID; + erm4.sampleNo = sampleNo1; + erm4.testDate = testDate1; + erm4.chanelNo = "BLD";//项目代号 + erm4.itemValue = resulteArray[i + 8].Replace("BLD", "").Replace("Cell/uL", "").Trim();//项目结果 + erm4.itemUnit = "Cell/uL"; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "PRO";//项目代号 + erm5.itemValue = resulteArray[i + 9].Replace("PRO", "").Trim();//项目结果 + erm5.itemUnit = ""; + ermList.Add(erm5); + + + examResultMode erm6 = new examResultMode(); + erm6.machineCode = MachineCode; + erm6.machineID = MachineID; + erm6.sampleNo = sampleNo1; + erm6.testDate = testDate1; + erm6.chanelNo = "NIT";//项目代号 + erm6.itemValue = resulteArray[i + 10].Replace("NIT", "").Trim();//项目结果 + erm6.itemUnit = ""; + ermList.Add(erm6); + + examResultMode erm10 = new examResultMode(); + erm10.machineCode = MachineCode; + erm10.machineID = MachineID; + erm10.sampleNo = sampleNo1; + erm10.testDate = testDate1; + erm10.chanelNo = "LEU";//项目代号 + erm10.itemValue = resulteArray[i + 11].Replace("LEU", "").Trim();//项目结果 + erm10.itemUnit = ""; + ermList.Add(erm10); + + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "GLU";//项目代号 + erm7.itemValue = resulteArray[i + 12].Replace("GLU", "").Trim();//项目结果 + erm7.itemUnit = ""; + ermList.Add(erm7); + + examResultMode erm8 = new examResultMode(); + erm8.machineCode = MachineCode; + erm8.machineID = MachineID; + erm8.sampleNo = sampleNo1; + erm8.testDate = testDate1; + erm8.chanelNo = "SG";//项目代号 + erm8.itemValue = resulteArray[i + 13].Replace("SG", "").Trim();//项目结果 + erm8.itemUnit = ""; + ermList.Add(erm8); + + examResultMode erm9 = new examResultMode(); + erm9.machineCode = MachineCode; + erm9.machineID = MachineID; + erm9.sampleNo = sampleNo1; + erm9.testDate = testDate1; + erm9.chanelNo = "PH";//项目代号 + erm9.itemValue = resulteArray[i + 14].Replace("PH", "").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); + } + + } + if (apiOptions.CurrentDevice == "MC-600")//血常规MAC-600 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray1 = new string[20] { "WBC", "Lymph#", "Mid#", "Gran#", "Lymph%", "Mid%", "Gran%", "RBC", "HGB", "MCV", "MCH", "MCHC", "RDW-CV", "RDW-SD", "HCT", "PLT", "MPV", "PDW", "PCT", "P-LCR" }; + string[] itemArray = new string[20] { "WBC", "LYMC", "MIDC", "GRNC", "LYMR", "MIDR", "GRNR", "RBC", "HGB", "MCV", "MCH", "MCHC", "RDW-CV", "RDW-SD", "HCT", "PLT", "MPV", "PDW", "PCT", "P-LCR" }; + //string[] resulteArray = deviceDataStr.Split('\n'); + // deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string[] valArray = deviceDataStr.Split('\n'); + string sampleNo1 = string.Empty;//样本号 + for (int A = 0; A < valArray.Length; A++) + { + if (valArray[A].Contains("

ID")) + { + sampleNo1 = jiexiVal(valArray[A].IndexOf("

ID"), "

ID", valArray[A]).ToString().TrimStart('0'); + } + for (int i = 0; i < itemArray.Length; i++) + { + string keyItem = "

" + itemArray[i]; + if (valArray[A].Contains(keyItem)) + { + string itemStr = itemArray[i] + ""; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray1[i];//项目代号 这是屏幕上显示的代号 + erm1.itemValue = valArray[A].Substring(valArray[A].IndexOf("") + 3, valArray[A].IndexOf("") - valArray[A].IndexOf("") - 3);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + } + } + + string jsonStr12 = JsonConvert.SerializeObject(ermList); + //把血常规的图也传上去 + List eipmList = new List(); + int[] array1 = strCount("^Base64^", deviceDataStr); + string keyStr = "||||||F";//结束符 + List imgBase64StrList = jiexiBase64(array1, keyStr, deviceDataStr);//解析出数据中的图片base64 + //int[] array2 = strCount("||||||F||||||", deviceDataStr); + for (int i = 0; i < imgBase64StrList.Count; i++) + { + string base64Str = imgBase64StrList[i]; + examImageParaModel EIPM1 = new examImageParaModel(); + EIPM1.machineCode = MachineCode; + EIPM1.machineID = MachineID; + EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + EIPM1.sampleNo = sampleNo1; + EIPM1.img = "data:image/jpeg;base64," + base64Str; + eipmList.Add(EIPM1); + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (eipmList.Count > 0) + { + baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + //if (bmm2.code == 200) + // dataOutPutShow("图像提交成功:" + jsonStr, null); + //else + // dataOutPutShow("图像提交失败:" + jsonStr, null); + } + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "CS-1300B")//迪瑞全自动生化分析仪 CS-1300B + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[16] { "ALT", "AST", "TBIL", "UREA", "CRE-E", "GLU", "TC", "TG", "HDL-C", "LDL-C", "TP", "ALB", "DBIL", "ALP", "GGT", "UA" }; + //deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string[] valArray = deviceDataStr.Split('\n'); + string sampleNo1 = string.Empty;//样本号 + for (int A = 0; A < valArray.Length; A++) + { + if (valArray[A].Contains("|1200^1300B|")) + { + // int index3 = jiexisampleNo(valArray[A].IndexOf("|480^480|"), valArray[A]); + sampleNo1 = jiexisampleNo(valArray[A].IndexOf("|1200^1300B|"), valArray[A]).ToString(); + // File.WriteAllText("test1.txt","哈哈哈 " + index3.ToString() + " " + valArray[A] + " 原样字符串:" + deviceDataStr); + // MessageBox.Show("哈哈哈 "+index3.ToString()+" "+ valArray[A]+" 原样字符串:"+ deviceDataStr); + } + for (int i = 0; i < itemArray.Length; i++) + { + + if (valArray[A].Contains(itemArray[i])) + { + string itemStr = itemArray[i] + "^1|"; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + erm1.itemValue = jiexiItemValue(itemStr, valArray[A]);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + } + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "URIT-1500")//优利特尿常规URIT-1500 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[11] { "VC", "WBC", "KET", "NIT", "URO", "BIL", "PRO", "GLU", "SG", "BLD", "pH" }; + string[] resulteArray = deviceDataStr.Split('\n'); + for (int i = 0; i < resulteArray.Length; i += 18) + { + //这里需要判断一下数据是否超过了 当前数据的长度 + ermList.Clear(); + if (i + 18 > resulteArray.Length) + break; + string[] spArray = resulteArray[i + 2].Trim().Split(' '); + string sampleNo1 = spArray[0].Trim().Replace("NO.", "").TrimStart('0'); + 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 = "VC";//项目代号 + erm.itemValue = resulteArray[i + 5].Substring(resulteArray[i + 5].IndexOf("VC") + 2, 6).Trim();//项目结果 + erm.itemUnit = "mmol/L"; + ermList.Add(erm); + + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = "WBC";//项目代号 + erm1.itemValue = resulteArray[i + 6].Substring(resulteArray[i + 6].IndexOf("WBC") + 3, 6).Trim();//项目结果 + erm1.itemUnit = "CELL/uL"; + ermList.Add(erm1); + + examResultMode erm2 = new examResultMode(); + erm2.machineCode = MachineCode; + erm2.machineID = MachineID; + erm2.sampleNo = sampleNo1; + erm2.testDate = testDate1; + erm2.chanelNo = "KET";//项目代号 + erm2.itemValue = resulteArray[i + 7].Substring(resulteArray[i + 7].IndexOf("KET") + 3, 6).Trim();//项目结果 + erm2.itemUnit = "mmol/L"; + ermList.Add(erm2); + + examResultMode erm3 = new examResultMode(); + erm3.machineCode = MachineCode; + erm3.machineID = MachineID; + erm3.sampleNo = sampleNo1; + erm3.testDate = testDate1; + erm3.chanelNo = "NIT";//项目代号 + erm3.itemValue = resulteArray[i + 8].Substring(resulteArray[i + 8].IndexOf("NIT") + 3, 6).Trim();//项目结果 + erm3.itemUnit = "Neg"; + ermList.Add(erm3); + + examResultMode erm4 = new examResultMode(); + erm4.machineCode = MachineCode; + erm4.machineID = MachineID; + erm4.sampleNo = sampleNo1; + erm4.testDate = testDate1; + erm4.chanelNo = "URO";//项目代号 + string[] sss = resulteArray[i + 9].Split(' '); + erm4.itemValue = resulteArray[i + 9].Substring(resulteArray[i + 9].IndexOf("URO") + 3, 6).Trim();//项目结果 + erm4.itemUnit = "Normal"; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "BIL";//项目代号 + erm5.itemValue = resulteArray[i + 10].Substring(resulteArray[i + 10].IndexOf("BIL") + 3, 6).Trim();//项目结果 + erm5.itemUnit = "umol/L"; + ermList.Add(erm5); + + + examResultMode erm6 = new examResultMode(); + erm6.machineCode = MachineCode; + erm6.machineID = MachineID; + erm6.sampleNo = sampleNo1; + erm6.testDate = testDate1; + erm6.chanelNo = "PRO";//项目代号 + erm6.itemValue = resulteArray[i + 11].Substring(resulteArray[i + 11].IndexOf("PRO") + 3, 6).Trim();//项目结果 + erm6.itemUnit = "g/L"; + ermList.Add(erm6); + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "GLU";//项目代号 + erm7.itemValue = resulteArray[i + 12].Substring(resulteArray[i + 12].IndexOf("GLU") + 3, 6).Trim();//项目结果 + erm7.itemUnit = "mmol/L"; + ermList.Add(erm7); + + examResultMode erm8 = new examResultMode(); + erm8.machineCode = MachineCode; + erm8.machineID = MachineID; + erm8.sampleNo = sampleNo1; + erm8.testDate = testDate1; + erm8.chanelNo = "SG";//项目代号 + erm8.itemValue = resulteArray[i + 13].Replace("SG", "").Trim();//项目结果 + erm8.itemUnit = ""; + ermList.Add(erm8); + + examResultMode erm9 = new examResultMode(); + erm9.machineCode = MachineCode; + erm9.machineID = MachineID; + erm9.sampleNo = sampleNo1; + erm9.testDate = testDate1; + erm9.chanelNo = "BLD";//项目代号 + erm9.itemValue = resulteArray[i + 14].Substring(resulteArray[i + 14].IndexOf("BLD") + 3, 6).Trim();//项目结果 + erm9.itemUnit = "CELL/uL"; + ermList.Add(erm9); + + examResultMode erm10 = new examResultMode(); + erm10.machineCode = MachineCode; + erm10.machineID = MachineID; + erm10.sampleNo = sampleNo1; + erm10.testDate = testDate1; + erm10.chanelNo = "pH";//项目代号 + erm10.itemValue = resulteArray[i + 15].Replace("pH", "").Trim();//项目结果 + erm10.itemUnit = ""; + ermList.Add(erm10); + } + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + } + if (apiOptions.CurrentDevice == "URIT-5180")//优利特血常规 5180 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[31] { "WBC", "LYM%", "MON%", "NEU%", "EOS%", "BASO%", "LYM#", "MON#", "NEU#", "EOS#", "BASO#", "ALY%", "ALY#", "LIC%", "LIC#", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW_CV", "RDW_SD", "PLT", "MPV", "PDW", "PCT", "P_LCR", "P_LCC", "NRBC%", "NRBC#" }; + //string[] resulteArray = deviceDataStr.Split('\n'); + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = itemArray[i] + "||"; + sampleNo1 = deviceDataStr.Substring(deviceDataStr.IndexOf("|URIT^URIT-5160|||") - 7, 7).TrimStart('0'); + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + erm1.itemValue = jiexiItemValue(itemStr, deviceDataStr);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + + ////把血常规的图也传上去 + //List eipmList = new List(); + //int[] array1 = strCount("^Base64^", deviceDataStr); + //int[] array2 = strCount("||||||F||||||", deviceDataStr); + //for (int i = 0; i < array2.Length; i++) + //{ + // string base64Str = deviceDataStr.Substring(array1[i] + 8, array2[i] - array1[i] - 8); + // examImageParaModel EIPM1 = new examImageParaModel(); + // EIPM1.machineCode = MachineCode; + // EIPM1.machineID = MachineID; + // EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + // EIPM1.sampleNo = sampleNo1; + // EIPM1.img = "data:image/jpeg;base64," + base64Str; + // eipmList.Add(EIPM1); + //} + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + //if (eipmList.Count > 0) + //{ + // baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + // //if (bmm2.code == 200) + // // dataOutPutShow("图像提交成功:" + jsonStr, null); + // //else + // // dataOutPutShow("图像提交失败:" + jsonStr, null); + //} + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "BS-430")//生化BS-430 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[10] { "Glu-G", "TG", "TC", "LDL-C", "HDL-C", "T-Bil-V", "ALT", "AST", "CREA-S", "UREA" }; + string[] itemArrayC = new string[10] { "葡萄糖(葡萄糖氧化酶法)", "甘油三酯", "总胆固醇", "低密度脂蛋白胆固醇", "高密度脂蛋白胆固醇", "总胆红素(钒酸盐氧化法)", "丙氨酸氨基转移酶", "天门冬氨酸氨基转移酶", "肌酐(肌氨酸氧化酶法)", "尿素" }; + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + //string[] valArray = deviceDataStr.Split(','); + string[] valArray = deviceDataStr.Split('|'); + string sampleNo1 = valArray[54];//样本号 + + for (int i = 0; i < itemArrayC.Length; i++) + { + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + // MessageBox.Show(deviceDataStr+"\r\n\r\n :"+ggg[5]); + string itemStr = itemArrayC[i] + "|"; + int index1 = deviceDataStr.IndexOf(itemStr); + string valueS = jiexiVal(index1, itemStr, deviceDataStr); + double roundedValue = Math.Round(double.Parse(valueS), 2); + erm1.itemValue = roundedValue.ToString();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "DF55-1")//帝迈血常规DF55-1 + { + + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[27] { "WBC", "NEU%", "LYM%", "MON%", "EOS%", "BAS%", "NEU#", "LYM#", "MON#", "EOS#", "BAS#", "*ALY%", "*LIC#", "*LIC%", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW-SD", "PLT", "MPV", "PDW", "PCT", "*ALY#", "RDW-CV" }; + + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = string.Empty; + if (itemArray[i] == "*LIC#" || itemArray[i] == "*LIC%" || itemArray[i] == "PCT") + itemStr = itemArray[i] + "^99MRC||"; + else + itemStr = itemArray[i] + "^LN||"; + string val1 = jiexiVal(deviceDataStr.IndexOf("OBR|1||"), "OBR|1||", deviceDataStr).ToString(); + sampleNo1 = val1; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i]; //项目代号 + erm1.itemValue = jiexiVal(deviceDataStr.IndexOf(itemStr), itemStr, deviceDataStr).ToString();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + string jsonStr12 = JsonConvert.SerializeObject(ermList); + //把血常规的图也传上去 + List eipmList = new List(); + int[] array1 = strCount("^Base64^", deviceDataStr); + string keyStr = "||||||F";//结束符 + List imgBase64StrList = jiexiBase64(array1, keyStr, deviceDataStr);//解析出数据中的图片base64 + //int[] array2 = strCount("||||||F||||||", deviceDataStr); + for (int i = 0; i < imgBase64StrList.Count; i++) + { + string base64Str = imgBase64StrList[i]; + examImageParaModel EIPM1 = new examImageParaModel(); + EIPM1.machineCode = MachineCode; + EIPM1.machineID = MachineID; + EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + EIPM1.sampleNo = sampleNo1; + EIPM1.img = "data:image/jpeg;base64," + base64Str; + eipmList.Add(EIPM1); + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (eipmList.Count > 0) + { + baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + //if (bmm2.code == 200) + // dataOutPutShow("图像提交成功:" + jsonStr, null); + //else + // dataOutPutShow("图像提交失败:" + jsonStr, null); + } + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "URIT-1600")//优利特URIT-1600 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[12] { "Vc", "WBC", "KET", "NIT", "URO", "BIL", "PRO", "GLU", "SG", "BLD", "pH", "Color" }; + // deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + //string[] valArray = deviceDataStr.Split(','); + string[] valArray = deviceDataStr.Split('\r'); + string sampleNo1 = string.Empty; + for (int A = 0; A < valArray.Length; A++) + { + if (valArray[A].Contains("OBR")) + { + string[] valStrArray = valArray[A].Split('|'); + sampleNo1 = valStrArray[3].TrimStart('0'); + } + for (int i = 0; i < itemArray.Length; i++) + { + if (valArray[A].Contains(itemArray[i])) + { + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + string[] reArray = valArray[A].Replace("||", "|").Split('|'); + erm1.itemValue = reArray[4].Split('^')[0];//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + } + } + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "DH56")//帝迈血常规DH56 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[29] { "WBC", "NEU%", "LYM%", "MON%", "EOS%", "BAS%", "NEU#", "LYM#", "MON#", "EOS#", "BAS#", "*ALY#", "*ALY%", "*LIC#", "*LIC%", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW-CV", "RDW-SD", "PLT", "MPV", "PDW", "PCT", "P-LCR", "P-LCC" }; + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = string.Empty; + if (itemArray[i] == "*LIC#" || itemArray[i] == "*LIC%" || itemArray[i] == "PCT") + itemStr = itemArray[i] + "^99MRC||"; + else + itemStr = itemArray[i] + "^LN||"; + string val1 = jiexiVal(deviceDataStr.IndexOf("OBR|1||"), "OBR|1||", deviceDataStr).ToString(); + sampleNo1 = val1; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i]; //项目代号 + erm1.itemValue = jiexiVal(deviceDataStr.IndexOf(itemStr), itemStr, deviceDataStr).ToString();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + // string jsonStr12 = JsonConvert.SerializeObject(ermList); + ////把血常规的图也传上去 + //List eipmList = new List(); + //int[] array1 = strCount("^Base64^", deviceDataStr); + //string keyStr = "||||||F";//结束符 + //List imgBase64StrList = jiexiBase64(array1, keyStr, deviceDataStr);//解析出数据中的图片base64 + ////int[] array2 = strCount("||||||F||||||", deviceDataStr); + //for (int i = 0; i < imgBase64StrList.Count; i++) + //{ + // string base64Str = imgBase64StrList[i]; + // examImageParaModel EIPM1 = new examImageParaModel(); + // EIPM1.machineCode = MachineCode; + // EIPM1.machineID = MachineID; + // EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + // EIPM1.sampleNo = sampleNo1; + // EIPM1.img = "data:image/jpeg;base64," + base64Str; + // eipmList.Add(EIPM1); + //} + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + //if (eipmList.Count > 0) + //{ + // baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + // //if (bmm2.code == 200) + // // dataOutPutShow("图像提交成功:" + jsonStr, null); + // //else + // // dataOutPutShow("图像提交失败:" + jsonStr, null); + //} + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "URIT-5380")//优利特血常规URIT-5380 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[25] { "WBC", "LYM%", "MON%", "NEU%", "EOS%", "BASO%", "LYM#", "MON#", "NEU#", "EOS#", "BASO#", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW_SD", "RDW_CV", "PLT", "MPV", "PDW", "PCT", "P_LCR", "P_LCC" }; + //string[] resulteArray = deviceDataStr.Split('\n'); + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = itemArray[i] + "||"; + //sampleNo1 = deviceDataStr.Substring(deviceDataStr.IndexOf("||Urit^UT5380||||") - 7, 7).TrimStart('0'); + sampleNo1 = jiexisampleNo(deviceDataStr.IndexOf("||Urit^UT5380||||"), deviceDataStr).ToString(); + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + erm1.itemValue = jiexiItemValue(itemStr, deviceDataStr);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + + //把血常规的图也传上去 + List eipmList = new List(); + int[] array1 = strCount("^Base64^", deviceDataStr); + int[] array2 = strCount("||||||F||||||", deviceDataStr); + for (int i = 0; i < array2.Length; i++) + { + string base64Str = deviceDataStr.Substring(array1[i] + 8, array2[i] - array1[i] - 8); + examImageParaModel EIPM1 = new examImageParaModel(); + EIPM1.machineCode = MachineCode; + EIPM1.machineID = MachineID; + EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + EIPM1.sampleNo = sampleNo1; + EIPM1.img = "data:image/jpeg;base64," + base64Str; + eipmList.Add(EIPM1); + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (eipmList.Count > 0) + { + baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + //if (bmm2.code == 200) + // dataOutPutShow("图像提交成功:" + jsonStr, null); + //else + // dataOutPutShow("图像提交失败:" + jsonStr, null); + } + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "U500")//尿常规U500 + { + 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 += 20) + { + //这里需要判断一下数据是否超过了 当前数据的长度 + ermList.Clear(); + if (i + 20 > resulteArray.Length) + break; + 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"); + 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 = "URO";//项目代号 + erm1.itemValue = resulteArray[i + 5].Substring(4,11).Trim();//项目结果 + erm1.itemUnit = "mg/dL"; + ermList.Add(erm1); + + examResultMode erm2 = new examResultMode(); + erm2.machineCode = MachineCode; + erm2.machineID = MachineID; + erm2.sampleNo = sampleNo1; + erm2.testDate = testDate1; + erm2.chanelNo = "ALB";//项目代号 + erm2.itemValue = resulteArray[i + 6].Substring(4, 13).Trim();//项目结果 + erm2.itemUnit = "mg/L"; + 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 = "BIL";//项目代号 + erm4.itemValue = resulteArray[i + 8].Substring(5,13).Trim();//项目结果 + erm4.itemUnit = ""; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "GLU";//项目代号 + 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 = "ASC";//项目代号 + erm6.itemValue = resulteArray[i + 10].Substring(5, 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 = "SG";//项目代号 + erm10.itemValue = resulteArray[i + 11].Replace("SG", "").Trim();//项目结果 + erm10.itemUnit = ""; + ermList.Add(erm10); + + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "KET";//项目代号 + 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 = "NIT";//项目代号 + 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 = "CRE";//项目代号 + erm9.itemValue = resulteArray[i + 14].Substring(4, 12).Trim();//项目结果 + erm9.itemUnit = "mmol/L"; + ermList.Add(erm9); + + examResultMode erm11 = new examResultMode(); + erm11.machineCode = MachineCode; + erm11.machineID = MachineID; + erm11.sampleNo = sampleNo1; + erm11.testDate = testDate1; + erm11.chanelNo = "PH";//项目代号 + erm11.itemValue = resulteArray[i + 15].Replace("PH", "").Trim();//项目结果 + erm11.itemUnit = "mmol/L"; + ermList.Add(erm11); + + + examResultMode erm12 = new examResultMode(); + erm12.machineCode = MachineCode; + erm12.machineID = MachineID; + erm12.sampleNo = sampleNo1; + erm12.testDate = testDate1; + erm12.chanelNo = "BLO";//项目代号 + erm12.itemValue = resulteArray[i + 16].Substring(4, 15).Trim();//项目结果 + erm12.itemUnit = "mmol/L"; + ermList.Add(erm12); + + examResultMode erm13 = new examResultMode(); + erm13.machineCode = MachineCode; + erm13.machineID = MachineID; + erm13.sampleNo = sampleNo1; + erm13.testDate = testDate1; + erm13.chanelNo = "CA";//项目代号 + erm13.itemValue = resulteArray[i + 17].Substring(4, 12).Trim();//项目结果 + erm13.itemUnit = "mmol/L"; + ermList.Add(erm13); + + + examResultMode erm14 = new examResultMode(); + erm14.machineCode = MachineCode; + erm14.machineID = MachineID; + erm14.sampleNo = sampleNo1; + erm14.testDate = testDate1; + erm14.chanelNo = "P:C";//项目代号 + erm14.itemValue = resulteArray[i + 18].Substring(4, 8).Trim();//项目结果 + erm14.itemUnit = "mmol/L"; + ermList.Add(erm14); + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据提交成功:" + jsonStr, null); + else + dataOutPutShow("数据提交失败:" + jsonStr, null); + } + + } + + if (apiOptions.CurrentDevice == "BC-5130")//BC-5130 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[26] { "WBC", "NEU%", "LYM%", "MON%", "EOS%", "BAS%", "NEU#", "LYM#", "MON#", "EOS#", "BAS#", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW-SD", "PLT", "MPV", "PDW", "PCT", "RDW-CV", "PLCC", "PLCR" , "Lymphocytosis" }; + //string[] resulteArray = deviceDataStr.Split('\n'); + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = string.Empty; + if (itemArray[i] == "*LIC#" || itemArray[i] == "*LIC%" || itemArray[i] == "PCT" || itemArray[i] == "PLCC" || itemArray[i] == "PLCR" || itemArray[i] == "Lymphocytosis") + itemStr = itemArray[i] + "^99MRC||"; + else + itemStr = itemArray[i] + "^LN||"; + string val1 = jiexiVal(deviceDataStr.IndexOf("PID|"), "PID|", deviceDataStr).ToString(); + sampleNo1 = val1; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i]; //项目代号 + if (itemArray[i] != "Lymphocytosis") + erm1.itemValue = jiexiVal(deviceDataStr.IndexOf(itemStr), itemStr, deviceDataStr).ToString();//项目结果 + else + erm1.itemValue = jiexiItemValue(itemStr, deviceDataStr); + erm1.itemUnit = ""; + ermList.Add(erm1); + } + string jsonStr12 = JsonConvert.SerializeObject(ermList); + //把血常规的图也传上去 + List eipmList = new List(); + int[] array1 = strCount("^Base64^", deviceDataStr); + string keyStr = "||||||F";//结束符 + List imgBase64StrList = jiexiBase64(array1, keyStr, deviceDataStr);//解析出数据中的图片base64 + //int[] array2 = strCount("||||||F||||||", deviceDataStr); + for (int i = 0; i < imgBase64StrList.Count; i++) + { + string base64Str = imgBase64StrList[i]; + examImageParaModel EIPM1 = new examImageParaModel(); + EIPM1.machineCode = MachineCode; + EIPM1.machineID = MachineID; + EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + EIPM1.sampleNo = sampleNo1; + EIPM1.img = "data:image/jpeg;base64," + base64Str; + eipmList.Add(EIPM1); + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (eipmList.Count > 0) + { + baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + //if (bmm2.code == 200) + // dataOutPutShow("图像提交成功:" + jsonStr, null); + //else + // dataOutPutShow("图像提交失败:" + jsonStr, null); + } + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "SD1")//斯玛特SD1 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + 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(); + + } + for (int i = 0; i < itemArray.Length; i++) + { + if (valArray[A].Contains(itemArray[i])) + { + string itemStr = itemArray[i]; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + erm1.itemValue = jiexiItemValueLast(itemStr, valArray[A]);//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + } + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + if (apiOptions.CurrentDevice == "DF55-2")//帝迈血常规DF55-2 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[27] { "WBC", "NEU%", "LYM%", "MON%", "EOS%", "BAS%", "NEU#", "LYM#", "MON#", "EOS#", "BAS#", "*ALY%", "*LIC#", "*LIC%", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW-SD", "PLT", "MPV", "PDW", "PCT", "*ALY#", "RDW-CV" }; + //string[] resulteArray = deviceDataStr.Split('\n'); + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + string sampleNo1 = string.Empty;//样本号 + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = string.Empty; + if (itemArray[i] == "*LIC#" || itemArray[i] == "*LIC%" || itemArray[i] == "PCT") + 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(); + + + + + //string val1 = jiexiVal(deviceDataStr.IndexOf("PID|"), "PID|", deviceDataStr).ToString(); + //sampleNo1 = val1; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i]; //项目代号 + erm1.itemValue = jiexiVal(deviceDataStr.IndexOf(itemStr), itemStr, deviceDataStr).ToString();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + } + string jsonStr12 = JsonConvert.SerializeObject(ermList); + //把血常规的图也传上去 + List eipmList = new List(); + int[] array1 = strCount("^Base64^", deviceDataStr); + string keyStr = "||||||F";//结束符 + List imgBase64StrList = jiexiBase64(array1, keyStr, deviceDataStr);//解析出数据中的图片base64 + //int[] array2 = strCount("||||||F||||||", deviceDataStr); + for (int i = 0; i < imgBase64StrList.Count; i++) + { + string base64Str = imgBase64StrList[i]; + examImageParaModel EIPM1 = new examImageParaModel(); + EIPM1.machineCode = MachineCode; + EIPM1.machineID = MachineID; + EIPM1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + EIPM1.sampleNo = sampleNo1; + EIPM1.img = "data:image/jpeg;base64," + base64Str; + eipmList.Add(EIPM1); + } + + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (eipmList.Count > 0) + { + baseMsgModel bmm2 = apiOptions.CreateInstance().uploadExamImage(eipmList);//传图像List + //if (bmm2.code == 200) + // dataOutPutShow("图像提交成功:" + jsonStr, null); + //else + // dataOutPutShow("图像提交失败:" + jsonStr, null); + } + + if (bmm1.code == 200) + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + + + if (apiOptions.CurrentDevice == "MA-4210")//华晟源尿常规型号:H-II + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] resulteArray = deviceDataStr.Split('\n'); + for (int i = 0; i < resulteArray.Length; i += 17) + { + //这里需要判断一下数据是否超过了 当前数据的长度 + ermList.Clear(); + if (i + 17 > resulteArray.Length) + break; + string[] spArray = resulteArray[i + 1].Trim().Split(' '); + string sampleNo1 = spArray[0].Replace("No.", "").TrimStart('0'); + 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 = "GLU";//项目代号 + erm.itemValue = resulteArray[i + 4].Substring(4,6).Trim();//项目结果 + erm.itemUnit = "cells/uL"; + ermList.Add(erm); + + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = "URO";//项目代号 + erm1.itemValue = resulteArray[i + 5].Substring(4, 6).Trim();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + + examResultMode erm2 = new examResultMode(); + erm2.machineCode = MachineCode; + erm2.machineID = MachineID; + erm2.sampleNo = sampleNo1; + erm2.testDate = testDate1; + erm2.chanelNo = "BIL";//项目代号 + erm2.itemValue = resulteArray[i + 6].Substring(4, 6).Trim();//项目结果 + erm2.itemUnit = ""; + ermList.Add(erm2); + + examResultMode erm3 = new examResultMode(); + erm3.machineCode = MachineCode; + erm3.machineID = MachineID; + erm3.sampleNo = sampleNo1; + erm3.testDate = testDate1; + erm3.chanelNo = "KET";//项目代号 + erm3.itemValue = resulteArray[i + 7].Substring(4, 6).Trim();//项目结果 + erm3.itemUnit = ""; + ermList.Add(erm3); + + examResultMode erm4 = new examResultMode(); + erm4.machineCode = MachineCode; + erm4.machineID = MachineID; + erm4.sampleNo = sampleNo1; + erm4.testDate = testDate1; + erm4.chanelNo = "SG";//项目代号 + erm4.itemValue = resulteArray[i + 8].Substring(3, 16).Trim();//项目结果 + erm4.itemUnit = ""; + ermList.Add(erm4); + + + examResultMode erm5 = new examResultMode(); + erm5.machineCode = MachineCode; + erm5.machineID = MachineID; + erm5.sampleNo = sampleNo1; + erm5.testDate = testDate1; + erm5.chanelNo = "BLD";//项目代号 + erm5.itemValue = resulteArray[i + 9].Substring(4, 6).Trim();//项目结果 + erm5.itemUnit = ""; + ermList.Add(erm5); + + + examResultMode erm6 = new examResultMode(); + erm6.machineCode = MachineCode; + erm6.machineID = MachineID; + erm6.sampleNo = sampleNo1; + erm6.testDate = testDate1; + erm6.chanelNo = "PH";//项目代号 + erm6.itemValue = resulteArray[i + 10].Substring(3, 16).Trim();//项目结果 + erm6.itemUnit = ""; + ermList.Add(erm6); + + examResultMode erm7 = new examResultMode(); + erm7.machineCode = MachineCode; + erm7.machineID = MachineID; + erm7.sampleNo = sampleNo1; + erm7.testDate = testDate1; + erm7.chanelNo = "PRO";//项目代号 + erm7.itemValue = resulteArray[i + 11].Substring(4, 6).Trim();//项目结果 + erm7.itemUnit = ""; + ermList.Add(erm7); + + examResultMode erm8 = new examResultMode(); + erm8.machineCode = MachineCode; + erm8.machineID = MachineID; + erm8.sampleNo = sampleNo1; + erm8.testDate = testDate1; + erm8.chanelNo = "NIT";//项目代号 + erm8.itemValue = resulteArray[i + 12].Substring(4, 6).Trim();//项目结果 + erm8.itemUnit = ""; + ermList.Add(erm8); + + examResultMode erm9 = new examResultMode(); + erm9.machineCode = MachineCode; + erm9.machineID = MachineID; + erm9.sampleNo = sampleNo1; + erm9.testDate = testDate1; + erm9.chanelNo = "LEU";//项目代号 + erm9.itemValue = resulteArray[i + 13].Substring(4, 6).Trim();//项目结果 + erm9.itemUnit = "mmol/L"; + ermList.Add(erm9); + + examResultMode erm10 = new examResultMode(); + erm10.machineCode = MachineCode; + erm10.machineID = MachineID; + erm10.sampleNo = sampleNo1; + erm10.testDate = testDate1; + erm10.chanelNo = "VC";//项目代号 + erm10.itemValue = resulteArray[i + 14].Substring(3, 6).Trim();//项目结果 + erm10.itemUnit = "mmol/L"; + ermList.Add(erm10); + + examResultMode erm11 = new examResultMode(); + erm11.machineCode = MachineCode; + erm11.machineID = MachineID; + erm11.sampleNo = sampleNo1; + erm11.testDate = testDate1; + erm11.chanelNo = "Color";//项目代号 + erm11.itemValue = resulteArray[i + 15].Replace("Color:","").Trim();//项目结果 + erm11.itemUnit = "mmol/L"; + ermList.Add(erm11); + //将结果提交到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; + } + + + + + + + ///

+ /// 从结果字符串中截取 结果 + /// + /// + /// + /// + string jiexiItemValue(string itemStr, string deviceDataStr) + { + string ItemValueStr = ""; + string Str1 = deviceDataStr.Substring(deviceDataStr.IndexOf(itemStr) + itemStr.Length, 30); + int firstIndex = Str1.IndexOf('|'); + ItemValueStr= Str1.Substring(0, firstIndex); + return ItemValueStr; + } + + + /// + /// 从结果字符串中截取 结果 + /// + /// + /// + /// + string jiexiItemValueLast(string itemStr, string deviceDataStr) + { + string ItemValueStr = ""; + string Str1 = deviceDataStr.Substring(deviceDataStr.LastIndexOf(itemStr) + itemStr.Length+1, 10); + int firstIndex = Str1.IndexOf('|'); + ItemValueStr = Str1.Substring(0, firstIndex); + return ItemValueStr; + } + + + /// + /// 从字符串中找到 样本编号 + /// + /// + /// + /// + int jiexisampleNo(int index1, string dataStr) + { + int val1 = -1; + for (int i = 1; i < 100; i++) + { + try + { + string str1 = dataStr.Substring(index1 - i, i); + val1 = int.Parse(str1); + } + catch { break; } + + } + return val1; + } + + /// + /// 从字符串中找到 样本编号 + /// + /// + /// + /// + int jiexisampleNo8(int index1, string dataStr) + { + int val1 = -1; + for (int i = 1; i < 100; i++) + { + try + { + string str1 = dataStr.Substring(index1, i); + val1 = int.Parse(str1); + } + catch { break; } + + } + return val1; + } + /// + /// 从字符串中 解析出数字 + /// + /// + /// + /// + string jiexiVal(int index1,string keyStr, string dataStr) + { + string val1 =""; + for (int i = 1; i < 100; i++) + { + try + { + string str1 = dataStr.Substring(index1+ keyStr.Length, i); + double valx = double.Parse(str1); + val1 = str1; + } + catch { break; } + + } + return val1; + } + + + /// + /// 从字符串中 解析出 jiexiBase64 图像 + /// + /// + /// + /// + List jiexiBase64(int[] array1, string keyStr, string dataStr) + { + List imageBase64List=new List(); + for (int i = 0; i < array1.Length; i++) + { + 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); + imageBase64List.Add(ImgBase64Str); + break; + } + } + } + return imageBase64List; + } + + 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'); + } + + + Socket listener; + //TcpListener listener = null; + /// + /// 开启数据接收 + /// + public void startDataReceive() + { + if (apiOptions.CurrentDevice == "HSYH-II")//华晟源尿常规型号:H-II + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "BT-200")//盛世东唐BT-200尿常规 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "URIT-5181")//优利特血常规5181 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "URIT-1500")//优利特尿常规URIT-1500 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "DF55")//帝迈血常规DF55 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "TCPTEST")//TCP接收测试数据 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "CS-480")//迪瑞全自动生化分析仪 CS-480 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "SL300C")//Senlo生化SL300C + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "BK600")//Senlo生化SL300C + { + _AccessResult.Change(10000, 10000);//开始循环从access数据库中读取数据,10秒频率 + } + if (apiOptions.CurrentDevice == "BA600")//尿常规 GeniusBA600 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "BA600MY")//煤窑中心卫生院的尿常规 GeniusBA600 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "MC-600")//血常规MAC-600 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "CS-1300B")//迪瑞全自动生化分析仪 CS-1300B + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "URIT-5180")//优利特血常规5180 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "BS-430")//生化BS-430 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "DF55-1")//帝迈血常规DF55 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "URIT-1600")//优利特1600 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "HTSH-4000")//HTSH-4000 全自动生化分析仪 + { + _AccessResult.Change(10000, 10000);//开始循环从access数据库中读取数据,10秒频率 + } + if (apiOptions.CurrentDevice == "DH56")//帝迈血常规DH56 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + if (apiOptions.CurrentDevice == "URIT-5380")//优利特血常规URIT-5380 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + + + if (apiOptions.CurrentDevice == "U500")//尿常规U500 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "BC-5130")//BC-5130 这个设备是需要主动TCP连接 血常规仪器 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + //// 创建一个监听Socket + //if (listener == null) + //{ + // listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + // listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + // listener.Listen(10000); + //} + + clientSocket = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + clientSocket.Connect(ipAddress, int.Parse(tcp_port)); + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + + + if (apiOptions.CurrentDevice == "SD1")//斯玛特SD1 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + + if (apiOptions.CurrentDevice == "DF55-2")//帝迈血常规DF55 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + + + + + if (apiOptions.CurrentDevice == "hhh5")//BC-5130 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + // 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } + + if (apiOptions.CurrentDevice == "MA-4210")//MA-4210 + { + SerialPortOption.CreateInstance().IniserialPortOption();//初始化串口 + SerialPortOption.CreateInstance().dataOutPutShow += new EventHandler(onReData); + SerialPortOption.CreateInstance().StartDataReadThread();//开启数据接收 + } + + } + + /// + /// 将接收到的数据进行处理并显示在软件界面上 + /// + /// + /// + void onReData(object o, EventArgs e) + { + tempData += o.ToString();//把串口数据积累起来 + dataOutPutShow(o, null);//把数据显示到屏幕上 + if (apiOptions.CurrentDevice == "HSYH-II")//华晟源尿常规型号:H-II + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "BT-200")//盛世东唐BT-200尿常规 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "URIT-5181")//优利特血常规5181 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "DF55")//帝迈血常规DF55 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + if (apiOptions.CurrentDevice == "TCPTEST")//tcp数据接收测试 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "CS-480") + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "SL300C")//Senlo生化SL300C + _tResult.Change(10000, 10000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "BA600")//尿常规 GeniusBA600 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "MC-600")//血常规MAC-600 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "CS-1300B")//迪瑞全自动生化分析仪 CS-1300B + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "BA600MY")//煤窑中心卫生院的尿常规 GeniusBA600 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "URIT-1500")//优利特尿常规URIT-1500 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "URIT-5180")//优利特血常规5180 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + if (apiOptions.CurrentDevice == "BS-430")//生化BS-430 + { + deviceAnalysisOption(tempData); + tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 + // _tResult.Change(10000, 10000);// 数据处理:延迟5秒开始 5秒计时 + } + if (apiOptions.CurrentDevice == "DF55-1")//帝迈血常规DF55 + { + deviceAnalysisOption(tempData); + tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 + //_tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + if (apiOptions.CurrentDevice == "URIT-1600")//优利特1600 + { + if (tempData.Contains("OBX|12|ST|"))//OBX|12|ST| 为结束符 说明字符串完整了 + { + deviceAnalysisOption(tempData); + tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 + } + + //_tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + if (apiOptions.CurrentDevice == "DH56")//帝迈血常规DH56 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + if (apiOptions.CurrentDevice == "URIT-5380")//优利特血常规URIT-5380 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + + if (apiOptions.CurrentDevice == "U500")//尿常规U500 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + + if (apiOptions.CurrentDevice == "BC-5130")//BC-5130 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + + + if (apiOptions.CurrentDevice == "SD1")//斯玛特SD1 + { + if (tempData.Contains("OBX|22|"))//OBX|22| 为结束符 说明字符串完整了 + { + deviceAnalysisOption(tempData); + tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 + } + + //_tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + + if (apiOptions.CurrentDevice == "DF55-2")//帝迈血常规DF55 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + + if (apiOptions.CurrentDevice == "hhh5")//BC-5130 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + if (apiOptions.CurrentDevice == "MA-4210")//MA-4210 + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } + + /// + /// 定时器 定时来处理接收到的累计临时数据 + /// + void TResultTick() + { + _tResult.Change(-1, 5000);//暂停计时 + deviceAnalysisOption(tempData); + tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 + } + + + + Socket clientSocket; + + int msgindex = 1; + /// + /// 定时器 定时来处理TCP接收到的累计临时数据 + /// + void tcpResultTick() + { + byte[] data = new byte[40048]; + if (apiOptions.CurrentDevice != "BC-5130")//如果设备是 apiOptions.CurrentDevice=== "BC-5130" 这个设备在 启动时就已经主动连上了 "BC-5130" 设备,这里就无需初始化连接 直接跳过 + { + if (clientSocket == null) + clientSocket = listener.Accept(); //一旦接受连接,创建一个客户端 + } + + int recv = clientSocket.Receive(data); + if (recv > 0) + { + string encodingStr = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[5]; + string stringData = Encoding.GetEncoding(encodingStr).GetString(data); + if (apiOptions.CurrentDevice == "SL300C")//Senlo生化SL300C 接收一条数据就需要应答一次 + { + string[] msgArray = stringData.Split('\n'); + for (int i = 0; i < msgArray.Length; i++) + { + 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 dateTimeNowStr = DateTime.Now.ToString("yyyyMMddHHmmss"); + string responseMsg = "MSH|^~\\&|1|1|11|1|"+ dateTimeNowStr + "||ACK^R01|"+ msgId + "|P|2.3.1||||0||UNICODE|||MSA|AA|"+ msgId + "||||0|"; + byte[] sendBytes = Encoding.Unicode.GetBytes(responseMsg); + clientSocket.Send(sendBytes); + onReData("应答消息:"+responseMsg, null);//数据处理 并将数据显示在软件界面上 + } + } + + } + onReData(stringData, null);//数据处理 并将数据显示在软件界面上 + } + } + + + void accessResultTick() + { + if (apiOptions.CurrentDevice == "BK600") + { + _AccessResult.Change(-1, 10000);//开始循环从access数据库中读取数据,10秒频率 + if (!File.Exists("uploadedRecord.txt")) + File.Create("uploadedRecord.txt"); + string accessDbPath = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + if (!accessDbPath.Contains(".mdb")) + 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(); + try + { + dt_2 = accessOptions.CreateInstance(accessDbPath).ExcuteSql(sql); + } + catch { dt_2 = null; } + if(dt_2==null) + return; + List ermList = new List(); + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + string uploadedRecordStr = File.ReadAllText("uploadedRecord.txt"); + for (int i = 0; i < dt_2.Rows.Count; i++) + { + if (!uploadedRecordStr.Contains(dt_2.Rows[i]["sampleProgramID"].ToString())) + { + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = dt_2.Rows[i]["SampleNo"].ToString(); + erm1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + erm1.chanelNo = dt_2.Rows[i]["ItemCode"].ToString();//项目代号 + erm1.itemValue = dt_2.Rows[i]["ItemValue"].ToString();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + uploadedRecordStr += (dt_2.Rows[i]["sampleProgramID"].ToString() + ","); + } + } + if (ermList.Count > 0) + { + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + { + //for (int i = 0; i < dt_2.Rows.Count; i++) + //{ + // string sql1 = "update sampleProgram set stateS=1 where sampleProgramID='" + dt_2.Rows[i]["sampleProgramID"].ToString() + "'"; + // bool flag1 = accessOptions.CreateInstance(accessDbPath).SqlUpdate(sql1); + //} + File.WriteAllText("uploadedRecord.txt", uploadedRecordStr);//记录写入本地 + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + } + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + _AccessResult.Change(10000, 10000);//开始循环从access数据库中读取数据,10秒频率 + } + + if (apiOptions.CurrentDevice == "HTSH-4000") + { + _AccessResult.Change(-1, 10000);//开始循环从access数据库中读取数据,10秒频率 + if (!File.Exists("uploadedRecord.txt")) + File.Create("uploadedRecord.txt"); + string accessDbPath = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + if (!accessDbPath.ToLower().Contains(".mdb")) + accessDbPath = DateTime.Now.ToString("yyyy-MM-dd") + ".mdb"; + string CHECKDATE = DateTime.Now.ToString("yyyy-MM-dd"); + // string CHECKDATE = DateTime.Now.ToString("2024-04-01"); + //string sql = "SELECT ITEM as ItemCode,cint(Right(str(id), 3)) as SampleNO, `RESULT` as ItemValue FROM `CHECK_RESULT202404` where mid(id,1,4) +'-' + mid(id,5,2) + '-' + mid(id,7,2)='"+ CHECKDATE + "'"; + string tableName = "CHECK_RESULT" + DateTime.Now.ToString("yyyyMM"); + //string sql = "SELECT ITEM as ItemCode,id,cint(Right(str(id), 3)) as SampleNO, `RESULT` as ItemValue FROM "+ tableName + " where mid(id,1,4) +'-' + mid(id,5,2) + '-' + mid(id,7,2)='"+ CHECKDATE + "'"; + string sql = "SELECT ITEM as ItemCode,id,cint(Right(str(id), 3)) as SampleNO, `RESULT` as ItemValue FROM " + tableName + ""; + DataTable dt_2 = accessOptions.CreateInstance(accessDbPath).ExcuteSql(sql); + List ermList = new List(); + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + string uploadedRecordStr = File.ReadAllText("uploadedRecord.txt"); + for (int i = 0; i < dt_2.Rows.Count; i++) + { + string uploadedRecordId = dt_2.Rows[i]["id"].ToString().Trim() + dt_2.Rows[i]["ItemCode"].ToString().Trim(); + if (!uploadedRecordStr.Contains(uploadedRecordId)) + { + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = dt_2.Rows[i]["SampleNo"].ToString().Trim(); + erm1.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + erm1.chanelNo = dt_2.Rows[i]["ItemCode"].ToString().Trim();//项目代号 + erm1.itemValue = dt_2.Rows[i]["ItemValue"].ToString().Trim();//项目结果 + erm1.itemUnit = ""; + ermList.Add(erm1); + uploadedRecordStr += (uploadedRecordId + ","); + } + } + if (ermList.Count > 0) + { + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + string jsonStr = JsonConvert.SerializeObject(ermList); + if (bmm1.code == 200) + { + //for (int i = 0; i < dt_2.Rows.Count; i++) + //{ + // string sql1 = "update sampleProgram set stateS=1 where sampleProgramID='" + dt_2.Rows[i]["sampleProgramID"].ToString() + "'"; + // bool flag1 = accessOptions.CreateInstance(accessDbPath).SqlUpdate(sql1); + //} + File.WriteAllText("uploadedRecord.txt", uploadedRecordStr);//记录写入本地 + dataOutPutShow("数据和图像提交成功:" + jsonStr, null); + } + else + dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + + } + _AccessResult.Change(10000, 10000);//开始循环从access数据库中读取数据,10秒频率 + } + } + /// + /// 停止数据接收 + /// + public void stopDataReceive() + { + if (apiOptions.CurrentDevice == "HSYH-II")//华晟源尿常规型号:H-II + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "BT-200")//盛世东唐BT-200尿常规 + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "URIT-5181")//优利特血常规 5181 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + if (apiOptions.CurrentDevice == "URIT-1500")//优利特尿常规URIT-1500 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + if (apiOptions.CurrentDevice == "DF55")//帝迈血常规DF55 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "TCPTEST")//tcp数据接收测试 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + if (apiOptions.CurrentDevice == "CS-480") + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + if (apiOptions.CurrentDevice == "SL300C")//Senlo生化SL300C + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "BA600")//尿常规 GeniusBA600 + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "BA600MY")//煤窑中心卫生院的尿常规 GeniusBA600 + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + if (apiOptions.CurrentDevice == "MC-600")//血常规MAC-600 + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + + if (apiOptions.CurrentDevice == "CS-1300B")//迪瑞全自动生化分析仪 CS-1300B + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "URIT-5180")//优利特血常规5180 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "BS-430")//生化BS-430 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "DF55-1")//帝迈血常规DF55 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "URIT-1600")//优利特1600 + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + + if (apiOptions.CurrentDevice == "BK600")// + { + _AccessResult.Change(-1, 10000);//停止从access数据库中读取数据,10秒频率 + } + + if (apiOptions.CurrentDevice == "HTSH-4000")//HTSH-4000 全自动生化分析仪 + { + _AccessResult.Change(-1, 10000);//停止从access数据库中读取数据,10秒频率 + } + + if (apiOptions.CurrentDevice == "DH56")//帝迈血常规DH56 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + if (apiOptions.CurrentDevice == "URIT-5380")//优利特血常规 URIT-5380 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "U500")//尿常规U500 + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + + if (apiOptions.CurrentDevice == "BC-5130")//BC-5130 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + if (apiOptions.CurrentDevice == "SD1")//斯玛特 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "DF55-2")//帝迈血常规DF55 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + if (apiOptions.CurrentDevice == "hhh5")//BC-5130 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } + + if (apiOptions.CurrentDevice == "MA-4210")//MA-4210 + { + SerialPortOption.CreateInstance().StopDataReadThread();//开启数据接收 + } + + + } + + ///// + ///// 开启tcp数据接收 + ///// + //public void tcpDataReceive() + //{ + // while (true) + // { + // byte[] data = new byte[1024];//对data清零 + // Socket clientSocket = listener.Accept(); //一旦接受连接,创建一个客户端 + // int recv = clientSocket.Receive(data); + // if (recv == 0) //如果收到的数据长度小于0,则退出 + // continue; + // string stringData = Encoding.Unicode.GetString(data); + // onReData(stringData, null);//将数据显示在软件界面上 + // } + //} + } +} diff --git a/deviceInfo.cs b/deviceInfo.cs new file mode 100644 index 0000000..f1b3443 --- /dev/null +++ b/deviceInfo.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.IO.Ports; +using System.Linq; +using System.Net.Mail; +using System.Runtime.InteropServices; +using System.Security.AccessControl; +using System.Text; + +namespace FlyDockTool +{ + public class deviceInfo + { + public string MachineCode { get; set; }// 设备型号 + public string MachineID { get; set; }// 设备后台编号 + public string MacAddress { get; set; }// 绑定的电脑标志信息 + public string MacConfigID { get; set; }// 后台设备接口配置编号 + public string InterFaceCode { get; set; }// 接口类型代码 + public string ChatSet { get; set; }// 字符集 + public string AckFlag { get; set; }// 应答ACK = 06H标志 + public string ResultPath { get; set; }// 结果存储路径 + public string DbCon { get; set; }// 数据库链接 + public string DbSql { get; set; }// 数据库Sql语句 + public string HL7TYPE { get; set; }//HL7协议类型标志 + public string ChatRoom { get; set; }// HL7协议方式(UDP/TCP) + public string HL7IP { get; set; }// HL7协议服务启动IP地址 + public string HL7Port { get; set; }// HL7协议服务监听端口 + public string PortName { get; set; }// 串口号 + public string BaudRate { get; set; }// 波特率 + public string DataBit { get; set; }//数据位 + public string Parity { get; set; }//校验位 + public string StopBits { get; set; }// 停止位 + public string HexFlag { get; set; }// 数据接收方式 + public string ImgPath { get; set; }//图像存储路径 + } +} diff --git a/examImageParaModel.cs b/examImageParaModel.cs new file mode 100644 index 0000000..9d6cf72 --- /dev/null +++ b/examImageParaModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FlyDockTool +{ + public class examImageParaModel + { + public string machineCode { get; set; }//设备型号 + public string machineID { get; set; }//设备id + public string testDate { get; set; }//检验时间 + public string sampleNo { get; set; }// 样本号 + public string img { get; set; }//图片文件 + } +} diff --git a/examResultMode.cs b/examResultMode.cs new file mode 100644 index 0000000..463bab2 --- /dev/null +++ b/examResultMode.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace FlyDockTool +{ + public class examResultMode + { + public string machineCode { get; set; }// 设备代码 varchar(50) + public string machineID { get; set; }// 设备后台编号 varchar(50) 不能为空 + public string testDate { get; set; }// 检验日期 Varchar(50) + public string sampleNo { get; set; }//样本号 Varchar(50) + public string barCode { get; set; }//条码号 Varchar(50) + public string itemName { get; set; }//项目名称 Varchar(50) + public string itemCode { get; set; }//项目代码 Varchar(50) + public string chanelNo { get; set; }//通道号 Varchar(50) + public string itemValue { get; set; }//项目结果 Varchar(50) + public string itemTips { get; set; }//项目提示 Varchar(50) + public string itemRange { get; set; }//参考范围 Varchar(200) + public string yangFlag { get; set; }//阳性标志 Tinyint default 0 + public string itemUnit { get; set; }//项目单位 Varchar(50) + public string lowValue { get; set; }//参考下限 Varchar(50) + public string highValue { get; set; }//参考上限 Varchar(50) + + } +} diff --git a/logo.ico b/logo.ico new file mode 100644 index 0000000..907795b Binary files /dev/null and b/logo.ico differ diff --git a/mainForm.Designer.cs b/mainForm.Designer.cs new file mode 100644 index 0000000..5513666 --- /dev/null +++ b/mainForm.Designer.cs @@ -0,0 +1,219 @@ +namespace FlyDockTool +{ + partial class mainForm + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(mainForm)); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.button1 = new System.Windows.Forms.Button(); + this.lb_currentDeviceInfo = new System.Windows.Forms.Label(); + this.lb_info = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.btn_start_or_stop = new System.Windows.Forms.Button(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.txt_msg = new System.Windows.Forms.TextBox(); + this.timer_dataShow = new System.Windows.Forms.Timer(this.components); + this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.contextMenuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.button1); + this.groupBox2.Controls.Add(this.lb_currentDeviceInfo); + this.groupBox2.Controls.Add(this.lb_info); + this.groupBox2.Controls.Add(this.label1); + this.groupBox2.Controls.Add(this.btn_start_or_stop); + this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top; + this.groupBox2.Location = new System.Drawing.Point(0, 0); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(1107, 144); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "操作"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(840, 82); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(198, 41); + this.button1.TabIndex = 2; + this.button1.Text = "获取设备编号"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // lb_currentDeviceInfo + // + this.lb_currentDeviceInfo.AutoSize = true; + this.lb_currentDeviceInfo.Location = new System.Drawing.Point(191, 39); + this.lb_currentDeviceInfo.Name = "lb_currentDeviceInfo"; + this.lb_currentDeviceInfo.Size = new System.Drawing.Size(17, 18); + this.lb_currentDeviceInfo.TabIndex = 1; + this.lb_currentDeviceInfo.Text = "-"; + // + // lb_info + // + this.lb_info.AutoSize = true; + this.lb_info.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lb_info.ForeColor = System.Drawing.Color.Blue; + this.lb_info.Location = new System.Drawing.Point(212, 82); + this.lb_info.Name = "lb_info"; + this.lb_info.Size = new System.Drawing.Size(18, 24); + this.lb_info.TabIndex = 1; + this.lb_info.Text = "-"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(78, 39); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(98, 18); + this.label1.TabIndex = 1; + this.label1.Text = "当前设备:"; + // + // btn_start_or_stop + // + this.btn_start_or_stop.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btn_start_or_stop.Location = new System.Drawing.Point(81, 76); + this.btn_start_or_stop.Name = "btn_start_or_stop"; + this.btn_start_or_stop.Size = new System.Drawing.Size(112, 47); + this.btn_start_or_stop.TabIndex = 0; + this.btn_start_or_stop.Text = "启动"; + this.btn_start_or_stop.UseVisualStyleBackColor = true; + this.btn_start_or_stop.Click += new System.EventHandler(this.btn_start_or_stop_Click); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.txt_msg); + this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox3.Location = new System.Drawing.Point(0, 144); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(1107, 593); + this.groupBox3.TabIndex = 2; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "数据接收"; + // + // txt_msg + // + this.txt_msg.BackColor = System.Drawing.Color.Black; + this.txt_msg.Dock = System.Windows.Forms.DockStyle.Fill; + this.txt_msg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txt_msg.ForeColor = System.Drawing.Color.GreenYellow; + this.txt_msg.Location = new System.Drawing.Point(3, 24); + this.txt_msg.Multiline = true; + this.txt_msg.Name = "txt_msg"; + this.txt_msg.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txt_msg.Size = new System.Drawing.Size(1101, 566); + this.txt_msg.TabIndex = 0; + // + // timer_dataShow + // + this.timer_dataShow.Enabled = true; + this.timer_dataShow.Interval = 1000; + // + // notifyIcon1 + // + this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1; + this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); + this.notifyIcon1.Text = "福乐云软硬件数据对接工具正在运行中......请勿关闭"; + this.notifyIcon1.Visible = true; + this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24); + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.显示ToolStripMenuItem, + this.退出ToolStripMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(133, 80); + // + // 显示ToolStripMenuItem + // + this.显示ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.显示ToolStripMenuItem.Name = "显示ToolStripMenuItem"; + this.显示ToolStripMenuItem.Size = new System.Drawing.Size(132, 38); + this.显示ToolStripMenuItem.Text = "显示"; + this.显示ToolStripMenuItem.Click += new System.EventHandler(this.显示ToolStripMenuItem_Click); + // + // 退出ToolStripMenuItem + // + this.退出ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; + this.退出ToolStripMenuItem.Size = new System.Drawing.Size(132, 38); + this.退出ToolStripMenuItem.Text = "退出"; + this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); + // + // mainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1107, 737); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "mainForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "福乐云软硬件数据对接工具V1.1(2024121101)"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mainForm_FormClosing); + this.Load += new System.EventHandler(this.Form1_Load); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.contextMenuStrip1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox txt_msg; + private System.Windows.Forms.Button btn_start_or_stop; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lb_currentDeviceInfo; + private System.Windows.Forms.Label lb_info; + private System.Windows.Forms.Timer timer_dataShow; + private System.Windows.Forms.NotifyIcon notifyIcon1; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem 显示ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem; + private System.Windows.Forms.Button button1; + } +} + diff --git a/mainForm.cs b/mainForm.cs new file mode 100644 index 0000000..fbf2c97 --- /dev/null +++ b/mainForm.cs @@ -0,0 +1,145 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Net.Mail; +using System.Text; +using System.Web; +using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip; + +namespace FlyDockTool +{ + public partial class mainForm : Form + { + public mainForm() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + string CurrentDevice= ConfigurationManager.AppSettings["CurrentDevice"]; + apiOptions.CurrentDevice = CurrentDevice; + apiOptions.MacAddress = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[0]; + apiOptions.MachineCode = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[1]; + apiOptions.MachineID = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[2]; + lb_currentDeviceInfo.Text = CurrentDevice; + btn_start_or_stop_Click(null,null);//启动数据接收 + + ////测试代码 测试完毕后注释调一下两行代码 + //string resultDataStr = File.ReadAllText(@"C:\Users\Administrator\Desktop\察哈尔右翼中旗\黄羊城\尿常规MA-4210\尿常规MA-4210.txt", Encoding.GetEncoding("GB18030")); + //deviceAnalysis.CreateInstance().deviceAnalysisOption(resultDataStr); + } + + private void btn_start_or_stop_Click(object sender, EventArgs e) + { + if (btn_start_or_stop.Text == "启动") + { + //if (MessageBox.Show("确定启动数据接收?","提示",MessageBoxButtons.OKCancel)==DialogResult.OK) + //{ + deviceAnalysis.CreateInstance().startDataReceive(); + deviceAnalysis.CreateInstance().dataOutPutShow += new EventHandler(onReData); + btn_start_or_stop.Text = "停止"; + timer_dataShow.Enabled = true; + //txt_msg.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+" | 设备:"+ apiOptions.MacAddress+ " 数据接收已启动...\r\n"); + DoData("设备:" + apiOptions.MacAddress + " 数据接收已启动...\r\n"); + lb_info.Text = "数据接收已启动..."; + //} + } + else if (btn_start_or_stop.Text == "停止") + { + if (MessageBox.Show("确定停止数据接收?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) + { + deviceAnalysis.CreateInstance().stopDataReceive(); + btn_start_or_stop.Text = "启动"; + timer_dataShow.Enabled = false; + // txt_msg.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " | "+ apiOptions.MacAddress+ " 数据接收已停止...\r\n"); + DoData("设备:" + apiOptions.MacAddress + " 数据接收已停止...\r\n"); + lb_info.Text = "数据接收已停止..."; + } + } + + } + + + private delegate void DoDataDelegate(object txtContent); + /// + /// 异步赋值 + /// + /// + private void DoData(object txtContent) + { + if (txt_msg.InvokeRequired) + { + DoDataDelegate d = DoData; + txt_msg.Invoke(d, txtContent); + } + else + { + txt_msg.AppendText("\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "接收到数据 : " + txtContent.ToString() + "\r\n"); + } + } + + /// + /// 显示串口或者TCP接收到的数据 + /// + /// + /// + void onReData(object o, EventArgs e) + { + //txt_msg.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "接收到数据 : " + o.ToString()+ "\r\n"); + DoData(o); + } + + bool isClose = false; + private void mainForm_FormClosing(object sender, FormClosingEventArgs e) + { + if (!isClose) + { + e.Cancel = true; + this.Hide(); + } + } + + private void notifyIcon1_DoubleClick(object sender, EventArgs e) + { + this.Show(); + } + + private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (MessageBox.Show("确定退出该软件?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) + { + isClose = true; + Application.Exit(); + } + } + + private void 显示ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Show(); + } + + private void button1_Click(object sender, EventArgs e) + { + baseMsgModel bmm = apiOptions.CreateInstance().getMacAddressInfo(); + if (bmm.code == 200) + { + List diList = JsonConvert.DeserializeObject>(bmm.data.ToString()); + string showStr= "计算机名称(MacAddress):" + diList[0].MacAddress+"\r\n"; + showStr += "设备型号(MachineCode):" + diList[0].MachineCode + "\r\n"; + showStr += "设备编号(MachineID):" + diList[0].MachineID + "\r\n"; + MessageBox.Show(showStr); + } + else + MessageBox.Show("未查到设备编号,请先在配置文件中配置MacAddress和MachineCode"); + + } + } +} diff --git a/mainForm.resx b/mainForm.resx new file mode 100644 index 0000000..cd3a560 --- /dev/null +++ b/mainForm.resx @@ -0,0 +1,704 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 248, 17 + + + 452, 17 + + + 611, 14 + + + + + AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAAMMOAADDDgAAAAAAAAAA + AACtra3///////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////7+ + //95dO//JR3m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ycf5v+alvP///////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////ra2t//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////x8X4/zUu5/8oIOb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8mHub/Xljs//f3/v////////////////////////////////////////////////////////////// + /////////////////////////////////////////////62trf////////////////////////////// + ///////////////////////////////////////////////////y8f3/r6z2/6ai9f+mo/X/pqP1/6aj + 9f+mo/X/pqP1/6aj9f+mo/X/paL0/7+89//7+/////////X1/v9ZU+z/Jh7m/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zUu5//Hxfn///////////////////////////////////////// + //////////////////////////////////////////////////////////////////+tra3///////// + ////////////////////////////////////////////////////////////////////////+fn+/3Jt + 7/8kHOX/Jx/m/ycf5v8nH+b/Jx/m/ycf5v8nH+b/Jx/m/yUd5v88Nej/3t37////////////o6D0/ysj + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8lHeb/fHfw//////////////////// + ///////////////////////////////////////////////////////////////////////////////+ + /P/88tz/ra2t//////////////////////////////////////////////////////////////////// + //////////////////+8uvf/KyPm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KiLm/6Sh + 9P///////////+Tj/P9BOun/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/0lC + 6v/k4/z///////////////////////////////////////////////////////////////////////// + ///////////////////++vL/77tE/62trf////////////////////////////////////////////// + ////////////////////////////////////////6+r9/1NN6/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/yYe5v9UTev/8O/9///////8+///fXjw/yce5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8oIOb/l5Pz//////////////////////////////////////////////////// + /////////////////////////////////////////vrx/+62OP+tra3///////////////////////n5 + /v+sqfX/kIzy/5GN8v+RjfL/kY3y/5GN8v+RjfL/kY3y/5GM8v+emvT/8/L+//////+bl/P/Jh7m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/NCzn/8fF+P///////////8rI+f8xKef/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx7m/01H6v/u7f3///////////////////////// + //////////////////////////////////////////////////////////////768f/utjj/ra2t//// + ////////////////////////nJjz/yYe5v8lHeb/JR3m/yUd5v8lHeb/JR3m/yUd5v8kHOX/LCXm/7m2 + 9///////0tD6/zs06P8oIOb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe5v9zbe//+/v///// + ///v7/3/WlTs/yYe5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8xKef/vbv3//// + //////////////////////////////////////////////////////////////////////////////// + ///++vH/7rY4/62trf///////////////////////////97c+/88NOj/KCDm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/yYe5v9lX+3/+fj+//39//94c+//JR3m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8nH+b/RT7p/+Lh/P///////////6qn9f8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jh3m/2pk7v/6+v7///////////////////////////////////////////////////////// + /////////////////////////vrx/+62OP+tra3////////////////////////////7+/7/eXTv/yce + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/Pjbo/9jX+v//////sa72/y0l5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v+Xk/P////////////a2fv/QDjp/ygg5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ycf5v9AOen/3Nr7//////////////////////////////////// + //////////////////////////////////////////////768f/utjj/ra2t//////////////////// + /////////////8PA+P8tJuf/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe5v+Ig/H///////Dw + /f9ZU+z/Jh7m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8mHub/Xljs//X0/v///////v7//4aC + 8f8mHub/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx7m/4yI8v////////////// + ///////////////////////////////////////////////////////////////////++vH/7rY4/62t + rf/////////////////////////////////t7f3/VlDr/ycf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8mHub/VE7r/+7t/f//////jYny/yYe5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/zAo + 5/+8uff///////////+9u/f/Lyjn/ygg5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe + 5v9YUuv/8PD9//////////////////////////////////////////////////////////////////// + /////////vrx/+62OP+tra3//////////////////////////////////////6Ke9P8nH+b/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ysk5v+sqfX//////9zb+/9BOun/KB/m/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8lHeb/fnnw//7+////////9fX+/2Vf7f8mHub/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/LSXm/7Gu9v////////////////////////////////////////////// + //////////////////////////////768f/utjj/ra2t//////////////////////////////////// + ///W1Pr/PTbo/ygf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8lHeb/cm3v//v7///7+///a2Xu/yYd + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/0I76f/b2fv///////////+5tvf/Libn/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yUd5v93cu///Pz///////////////////// + ///////////////////////////////////////////////////++vH/7rY4/62trf////////////// + /////////////////////////f3//4R/8f8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zkx + 6P/OzPn//////7279/8xKef/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/oJz0//// + ////////5eT8/0dB6v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/OzTo/9LQ + +v///////////////////////////////////////////////////////////////////////vrx/+62 + OP+tra3////////////////////////////////////////////S0Pr/Ni7o/ygg5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8mHub/k4/y///////v7/3/T0jq/yYe5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jh7m/11X7P/x8P3///////////+VkfP/KB/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/yYe5v+ZlfP///////////////////////////////////////////////////////// + //////////////768f/utjj/ra2t////////////////////////////////////////////8/L+/2Ba + 7P8mHub/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/1BK6//o6Pz//////5iU8/8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8tJuf/wb74////////////zsz5/zQs5/8oIOb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/VE3r/+vq/f////////////////////////////// + ///////////////////////////////////++vH/7rU4/62trf////////////////////////////// + //////////////////+ysPb/KyPm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8qIub/tbP2//// + ///a2fv/OTLo/ygg5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx7m/4B78P/9/f////////n5 + /v9wa+7/Jh7m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KCDm/ygg5v+3tPf///////// + /////////////////////////////////////////////////////////vv1//PMc/+tra3///////// + ////////////////////////////////////////4N/7/0Q96f8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jh7m/3Br7v/5+f7/+fn+/3Jt7/8mHub/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg + 5v88NOj/29n7////////////sa72/yoi5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/JR3m/y8o + 5/9jXe3/urf3//////////////////////////////////////////////////////////////////// + ////////ra2t//////////////////////////////////////////////////////+Pi/L/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v81Lef/09H6//////++vPf/LCXm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/6Og9P///////////+jo/P9RSuv/Jx/m/ykh5v8pIeb/KSHm/yce + 5v8oIOb/QDnp/4SA8f+8uvf/9PT+//////////////////////////////////////////////////// + /////////////////////v7/+ea6/62trf////////////////////////////////////////////// + ////////xsT4/zIq5/8oIOb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KCDm/5aS8///////6un9/1FK + 6/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/Jx/m/y8n5/99efD/9vb+////////////j4vy/yUd + 5v8oIOb/Jx/m/y8n5/9aVOz/p6T1/9rZ+//8/P////////////////////////////////////////// + ////////////////////////////////////////+unD/+uqGf+tra3///////////////////////// + //////////////////////////////j4/v9sZu7/Jh7m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe + 5v9EPen/4N/7//////+dmfT/Jx/m/ykh5v8pIeb/KCDm/yYe5v8sJOb/QTrp/4WA8f/Myvn/8fH9//// + /////////////87M+f83L+j/ODHo/3558P/Ixvn/8O/9//////////////////////////////////// + //////////////////////////////////////////////////////////////rqxv/rqBX/ra2t//// + ////////////////////////////////////////////////////////p6T1/ygg5v8pIeb/KSHm/ykh + 5v8pIeb/KB/m/yUd5v8xKef/UUvr/8vJ+f//////0c/6/zoy6P8mHub/Jh7m/zcw6P9bVOz/q6j1/+Tj + /P/8+//////////////////////////////6+v7/tbP2/87M+f/7+/////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ///+/Pj/99ye/62trf///////////////////////////////////////////////////////////+bl + /P9NRur/Jx/m/ykh5v8mHub/Jh7m/0E66f9taO7/vbv3//Dw/f/9/f////////z8//99ePD/SEHq/3x3 + 8P/Pzfn/9PT+//7+//////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////+tra3///////////////////////////////////////// + ////////////////////////hYHx/yIa5f8tJeb/W1Ts/5CM8v/d2/v//Pz///////////////////// + ////////4+L8/9jX+v/v7v3/9PT+//79//////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////ra2t//////////////////// + /////////////////////////////////////////////8zK+f9/evD/s7D2//Hx/f////////////// + ////////9PP+/9TT+v+cmPP/l5Pz/42J8v9TTev/SkPq/1VO6/+Pi/L/l5Pz/5+b9P/Y1/r/9vX+//// + //////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////62t + rf/////////////////////////////////////////////////////////////////7+///+vr+//// + //////////////7+///j4vz/mJXz/2Jc7f83MOj/Jx/m/yUd5v8lHeb/Jx7m/ycf5v8mHub/JR3m/yUd + 5v8oIOb/OTHo/2di7f+FgPH/y8n5//v6/v////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////+tra3///////////////////////////////////////////////////////// + /////////////////////////v7//+Ph/P+VkfP/R0Dp/ycf5v8mHub/KCDm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8mHub/JR3m/zYu6P95dO//5OP8//7+//////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////ra2t//////////////////////////////////// + /////////////////////////////////////////v7//7Ct9v9GP+n/KB/m/ycf5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/Jx/m/0xF + 6v+dmfT/8fD9//////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////62trf////////////// + ////////////////////////////////////////////////////////7Oz9/4qG8f83MOj/Jh7m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8nH+b/KCDm/3x38P/y8v7///////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //+tra3/////////////////////////////////////////////////////////////////7ez9/3Fr + 7v8mHub/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8mHub/JR3m/yUd5v8lHeb/JR3m/yUd + 5v8nHub/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/d3Lv/9rY+/////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////ra2t//////////////////////////////////////////////////// + ////////7Oz9/3Fs7v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/yYe5v82Luf/W1Xs/4eD + 8f+HgvH/h4Lx/4eC8f+GgvH/VlDr/zQs5/8mHub/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYd + 5v9TTOv/6un9//////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////62trf////////////////////////////// + ////////////////////////+fn+/3hz7/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/KSHm/1BJ + 6/+WkvP/zsz5//Hx/f///////////////////////////+/v/f/Jx/n/ko7y/0tE6v8oIOb/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KiLm/3x38P/y8v7///////////////////////////////////////// + //////////////////////////////////////////////////////////////////+tra3///////// + /////////////////////////////////////////v7//66r9v8yKuf/KCDm/ykh5v8pIeb/KSHm/ykh + 5v8mHub/NS7n/52a9P/q6f3//v7///////////////////////////////////////////////////7+ + ///m5fz/mpbz/0hB6v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8oH+b/jIjy//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////ra2t/////////////////////////////////////////////////8/O+f85Muj/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8oIOb/U03r/7Wy9v/9/f////////////////////////////////////////// + ///////////////////////////////////Y1vr/Ukzr/yYe5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zoz + 6P/Bv/j///////////////////////////////////////////////////////////////////////// + /////////////////////////////62trf////////////////////////////////////////////v7 + //96dvD/Jh7m/ykh5v8pIeb/KSHm/ykh5v8mHub/TEbq/9/e+/////////////////////////////// + /////////////////////////////////////////////////////////////9jW+v9STOv/Jh7m/ykh + 5v8pIeb/KSHm/ykh5v8lHeb/ZF7t//X1/v////////////////////////////////////////////// + //////////////////////////////////////////////////+tra3///////////////////////// + ///////////////////OzPn/ODHo/ygg5v8pIeb/KSHm/ykh5v8oIOb/NS7n/6+s9v////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////2Nb6/09J6v8nH+b/KSHm/ykh5v8pIeb/KCDm/y8o5/+7uPf///////////////////////// + ////////////////////////////////////////////////////////////////////////ra2t//// + ///////////////////////////////////7+///enXv/yYe5v8pIeb/KSHm/ykh5v8pIeb/KCDm/5SQ + 8v////////////////////////////////////////////b29//t7e3/7e3u/+3t7v/4+Pj///////// + //////////////////////////////////+tqvX/KyTm/ykh5v8pIeb/KSHm/ykh5v8mHub/aGLt//r5 + /v////////////////////////////////////////////////////////////////////////////// + /////////////62trf//////////////////////////////////////7+/9/0tE6v8nH+b/KSHm/ykh + 5v8pIeb/Jx/m/0hB6v/h4Pz/////////////////////////////////+Pj4/8TExv9ub3T/SElP/0lK + UP9JSU//c3N4/62usP/4+Pj/////////////////////////////////7+79/1hS7P8mHub/KSHm/ykh + 5v8pIeb/KB/m/z846f/a2fv///////////////////////////////////////////////////////// + //////////////////////////////////+tra3//////////////////////////////////////8jG + +f81Lef/KCDm/ykh5v8pIeb/KSHm/y4m5/+zsfb/////////////////////////////////9vb2/4qL + j/8zNDr/KCkw/ykqMf8pKjH/KSox/ycoL/8wMTf/dXV6/93e3/////////////////////////////// + //+sqfX/LCTm/ykh5v8pIeb/KSHm/ykh5v8pIeb/qqf1//////////////////////////////////// + ////////////////////////////////////////////////////////ra2t//////////////////// + //////////////////+SjvL/Jh7m/ykh5v8pIeb/KSHm/ygg5v84MOj/2Nf6//////////////////// + ////////9vb2/4mKjf8sLTT/Kisy/yssM/8rLDP/Kywz/yssM/8rLDP/Kisy/yYnLv9mZ2z/9PT1//// + ////////////////////////7u39/1FL6/8mHub/KSHm/ykh5v8pIeb/JR3m/29q7v/+/v////////// + /////////////////////////////////////////////////////////////////////////////62t + rf/////////////////////////////////6+v7/X1ns/yYe5v8pIeb/KSHm/ykh5v8mHeb/Y13t//j3 + /v///////////////////////////6usrv8tLjX/Kisy/yssM/8rLDP/Kywz/yssM/8rLDP/Kywz/yss + M/8rLDP/LzA3/52doP////////////////////////////////+HgvH/Jx/m/ykh5v8pIeb/KSHm/yUd + 5v9taO7//v7///////////////////////////////////////////////////////////////////// + //////////////////+tra3/////////////////////////////////+vr+/19Z7P8mHub/KSHm/ykh + 5v8pIeb/Jh7m/4B88P////////////////////////////n5+f9iYmj/KCkw/yssM/8rLDP/Kywz/yss + M/8rLDP/Kywz/yssM/8rLDP/Kywz/ygpMP9bXGH/8/Pz////////////////////////////sa72/ygg + 5v8pIeb/KSHm/ykh5v8nH+b/SkPq/+Xk/P////////////////////////////////////////////// + ////////////////////////////////////////ra2t//////////////////////////////////f3 + /v9cVuz/Jh7m/ykh5v8pIeb/KSHm/ysj5v+9u/f////////////////////////////T09X/OjtC/yor + Mv8rLDP/Kisy/ykqMf8rLDP/Kywz/yssM/8rLDP/Kywz/yssM/8rLDP/NTY9/9PT1f////////////// + /////////////7Gu9v8oIOb/KSHm/ykh5v8pIeb/KSDm/zIr5//U0/r///////////////////////// + /////////////////////////////////////////////////////////////62trf////////////// + ///////////////////Y1vr/PTbo/ygg5v8pIeb/KSHm/ykh5v8rI+b/wL34//////////////////// + ////////xMTG/y0uNf8rLDP/Kisy/zQ1PP9CQ0n/LS41/yssM/8rLDP/Kywz/yssM/8rLDP/Kywz/zM0 + O//S0tP///////////////////////////+xrvb/KCDm/ykh5v8pIeb/KSHm/ygg5v8zLOf/1dT6//// + //////////////////////////////////////////////////////////////////////////////// + //+tra3/////////////////////////////////9fT+/1pU7P8mHub/KSHm/ykh5v8pIeb/KyPm/7+8 + +P///////////////////////////8XGx/8vMDb/Kywz/ywtNP+io6b/1NTV/zs8Q/8qKzL/Kywz/yss + M/8rLDP/Kywz/yssM/8yMzr/0dHT////////////////////////////sa72/ygg5v8pIeb/KSHm/ykh + 5v8oIOb/Myzn/9XU+v////////////////////////////////////////////////////////////// + //////////////7//v/9/v3/ra2t//////////////////////////////////r6/v9fWez/Jh7m/ykh + 5v8pIeb/KSHm/ycf5v+GgfH////////////////////////////p6er/TU1T/ygpMf8rLDP/e3yA/6mp + rP83OD//Kisy/yssM/8rLDP/Kywz/yssM/8qKzL/REVL/+Dg4f///////////////////////////7Gu + 9v8oIOb/KSHm/ykh5v8pIeb/KCDm/zYv6P/X1vr///////////////////////////////////////// + ///////////////////////////////////V6MP/gblL/62trf////////////////////////////// + ///19P7/WlPs/yYe5v8pIeb/KSHm/ykh5v8lHeb/bGbu//7+/////////////////////////f39/4aH + i/8rLDP/Kywz/yorMv8sLTT/Kywz/yssM/8rLDP/Kywz/yssM/8rLDP/Jicu/3Jyd//+/v7///////// + //////////////////+NifL/Jx/m/ykh5v8pIeb/KSHm/yYe5v9iXO3/9vb+//////////////////// + ////////////////////////////////////////////////////////2erJ/1miGP+tra3///////// + ////////////////////////vrz3/zIq5/8pIeb/KSHm/ykh5v8pIeb/Jx/m/01G6v/n5vz///////// + ///////////////////q6uv/VFRa/ygpMP8rLDP/Kywz/yssM/8rLDP/Kywz/yssM/8rLDP/KCkw/1FS + WP/V1df////////////////////////////6+v7/Xljs/yYe5v8pIeb/KSHm/ykh5v8lHeb/bmju//7+ + //////////////////////////////////////////////////////////////////////////////v9 + +f/C3aj/ra2t/////////////////////////////////3hz7/8lHeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8uJuf/vbv3/////////////////////////////////8zMzv9JSlD/Jygv/yorMv8rLDP/Kywz/yss + M/8qKzL/Jicv/1FSWP/V1df/////////////////////////////////1dT6/z026P8oIOb/KSHm/ykh + 5v8pIeb/KSHm/6Wi9P////////////////////////////////////////////////////////////// + /////////////////////////////62trf///////////////////////////93c+/9EPen/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/Jh7m/2tl7v/39v7/////////////////////////////////z8/R/2ts + cf88PUP/Kisy/ygpMP8nKDD/Njc+/3JzeP/X19j//////////////////////////////////f3//4J9 + 8P8mHub/KSHm/ykh5v8pIeb/KSHm/y8n5//Fw/j///////////////////////////////////////// + //////////////////////////////////////////////////+tra3///////////////////////// + //+NifL/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8yKuf/wb/4//////////////////// + ///////////////////29vb/2trb/6Ojpv+cnaD/nJ2g/8fHyf/4+Pn///////////////////////// + /////////////9TS+v88Nej/KCDm/ykh5v8pIeb/KSHm/yYe5v9RSuv/8O/9//////////////////// + ////////////////////////////////////////////////////////////////////////ra2t//// + ///////////////////r6v3/SULq/ycf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jh7m/2Fb + 7f/n5vz///////////////////////////////////////////////////////////////////////// + //////////////////////////////Ly/v9kXu3/Jx/m/ykh5v8pIeb/KSHm/ykh5v8nH+b/jYny//// + //////////////////////////////////////////////////////////////////////////////// + /////////////62trf//////////////////////1tT6/0dA6v8mHub/Jh7m/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8mHub/eHLv//v7//////////////////////////////////////////////// + //////////////////////////////////////////////r6/v+Xk/P/LSXm/ygg5v8pIeb/KSHm/ykh + 5v8nH+b/Qjvp/9zb+/////////////////////////////////////////////////////////////// + //////////////////////////////////+tra3///////////////////////39///Z1/v/mpbz/1tV + 7P8sJeb/Jh7m/ygg5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zMs5/+IhPH/5+b8//////////////////// + //////////////////////////////////////////////////////////////r6/v+YlPP/Libn/ygg + 5v8pIeb/KSHm/ykh5v8pIeb/Libn/6mm9f/+/v////////////////////////////////////////// + ////////////////////////////////////////////////////////ra2t//////////////////// + ///////////////////v7v3/u7n3/3558P85Muj/Jx/m/ykh5v8pIeb/KSHm/ykh5v8oIOb/JR3m/2Vg + 7f/T0fr//Pz//////////////////////////////////////////////////////////////////9/d + +/92ce//Lyfn/ygg5v8pIeb/KSHm/ykh5v8pIeb/JR3m/11X7P/x8f3///////////////////////// + /////////////////////////////////////////////////////////////////////////////62t + rf/////////////////////////////////////////////////8/P//09H6/19Z7P8mHub/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8nH+b/OTLo/3148P/R0Pr/9fT+//////////////////////////////////// + ///5+f7/5eT8/52Z9P9KROr/Jh7m/ygg5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/0A56f/Dwfj///////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////+tra3///////////////////////////////////////////////////////// + ///Dwfj/OjPo/ycf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8mHub/OTHo/19Z7P+UkPL/u7j3/+Lg + /P/g3/v/4eD8/7Wy9v+Xk/P/dnHv/0M86f8pIeb/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jh7m/0A5 + 6f/Cv/j///////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////ra2t//////////////////////////////////// + /////////////////////////////7e09/85Muj/Jh3m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg + 5v8mHub/JR3m/zAo5/87NOj/OzTo/zs06P8uJuf/JR3m/yYe5v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jx/m/zkx6P+lovT///////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////62trf////////////// + ////////////////////////////////////////////////////////u7n3/1VP6/8nH+b/KCDm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/KCDm/ygg5v8oIOb/KSDm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/JR3m/0A46f/Cv/j//f3///////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //+tra3///////////////////////////////////////////////////////////////////////// + ///n5vz/bGbu/y4m5/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/KCDm/2Re7f/Ixvn///////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////ra2t//////////////////////////////////////////////////// + //////////////////////////////T0/v+lofT/RD3p/ycf5v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ycf5v8oIOb/SkPq/5qW8//s7P3///////// + //////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////62trf////////////////////////////// + /////////////////////////////////////////////////////////v7//+Hg/P+UkPL/R0Dq/zMr + 5/8pIOb/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/y8n5/9MRer/m5fz/+bl + /P/+/v////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////+tra3///////// + //////////////////////////////////////////////////////////////////////////////// + /////////////+Df+//Ixvn/hYDx/0U+6f8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/Mirn/29q + 7v+zsfb/5eT8//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + + + AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAAMMOAADDDgAAAAAAAAAA + AACtra3///////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////7+ + //95dO//JR3m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ycf5v+alvP///////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////ra2t//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////x8X4/zUu5/8oIOb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8mHub/Xljs//f3/v////////////////////////////////////////////////////////////// + /////////////////////////////////////////////62trf////////////////////////////// + ///////////////////////////////////////////////////y8f3/r6z2/6ai9f+mo/X/pqP1/6aj + 9f+mo/X/pqP1/6aj9f+mo/X/paL0/7+89//7+/////////X1/v9ZU+z/Jh7m/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zUu5//Hxfn///////////////////////////////////////// + //////////////////////////////////////////////////////////////////+tra3///////// + ////////////////////////////////////////////////////////////////////////+fn+/3Jt + 7/8kHOX/Jx/m/ycf5v8nH+b/Jx/m/ycf5v8nH+b/Jx/m/yUd5v88Nej/3t37////////////o6D0/ysj + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8lHeb/fHfw//////////////////// + ///////////////////////////////////////////////////////////////////////////////+ + /P/88tz/ra2t//////////////////////////////////////////////////////////////////// + //////////////////+8uvf/KyPm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KiLm/6Sh + 9P///////////+Tj/P9BOun/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/0lC + 6v/k4/z///////////////////////////////////////////////////////////////////////// + ///////////////////++vL/77tE/62trf////////////////////////////////////////////// + ////////////////////////////////////////6+r9/1NN6/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/yYe5v9UTev/8O/9///////8+///fXjw/yce5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8oIOb/l5Pz//////////////////////////////////////////////////// + /////////////////////////////////////////vrx/+62OP+tra3///////////////////////n5 + /v+sqfX/kIzy/5GN8v+RjfL/kY3y/5GN8v+RjfL/kY3y/5GM8v+emvT/8/L+//////+bl/P/Jh7m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/NCzn/8fF+P///////////8rI+f8xKef/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx7m/01H6v/u7f3///////////////////////// + //////////////////////////////////////////////////////////////768f/utjj/ra2t//// + ////////////////////////nJjz/yYe5v8lHeb/JR3m/yUd5v8lHeb/JR3m/yUd5v8kHOX/LCXm/7m2 + 9///////0tD6/zs06P8oIOb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe5v9zbe//+/v///// + ///v7/3/WlTs/yYe5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8xKef/vbv3//// + //////////////////////////////////////////////////////////////////////////////// + ///++vH/7rY4/62trf///////////////////////////97c+/88NOj/KCDm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/yYe5v9lX+3/+fj+//39//94c+//JR3m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8nH+b/RT7p/+Lh/P///////////6qn9f8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jh3m/2pk7v/6+v7///////////////////////////////////////////////////////// + /////////////////////////vrx/+62OP+tra3////////////////////////////7+/7/eXTv/yce + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/Pjbo/9jX+v//////sa72/y0l5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v+Xk/P////////////a2fv/QDjp/ygg5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ycf5v9AOen/3Nr7//////////////////////////////////// + //////////////////////////////////////////////768f/utjj/ra2t//////////////////// + /////////////8PA+P8tJuf/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe5v+Ig/H///////Dw + /f9ZU+z/Jh7m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8mHub/Xljs//X0/v///////v7//4aC + 8f8mHub/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx7m/4yI8v////////////// + ///////////////////////////////////////////////////////////////////++vH/7rY4/62t + rf/////////////////////////////////t7f3/VlDr/ycf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8mHub/VE7r/+7t/f//////jYny/yYe5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/zAo + 5/+8uff///////////+9u/f/Lyjn/ygg5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe + 5v9YUuv/8PD9//////////////////////////////////////////////////////////////////// + /////////vrx/+62OP+tra3//////////////////////////////////////6Ke9P8nH+b/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ysk5v+sqfX//////9zb+/9BOun/KB/m/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8lHeb/fnnw//7+////////9fX+/2Vf7f8mHub/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/LSXm/7Gu9v////////////////////////////////////////////// + //////////////////////////////768f/utjj/ra2t//////////////////////////////////// + ///W1Pr/PTbo/ygf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8lHeb/cm3v//v7///7+///a2Xu/yYd + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/0I76f/b2fv///////////+5tvf/Libn/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yUd5v93cu///Pz///////////////////// + ///////////////////////////////////////////////////++vH/7rY4/62trf////////////// + /////////////////////////f3//4R/8f8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zkx + 6P/OzPn//////7279/8xKef/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/oJz0//// + ////////5eT8/0dB6v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/OzTo/9LQ + +v///////////////////////////////////////////////////////////////////////vrx/+62 + OP+tra3////////////////////////////////////////////S0Pr/Ni7o/ygg5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8mHub/k4/y///////v7/3/T0jq/yYe5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jh7m/11X7P/x8P3///////////+VkfP/KB/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/yYe5v+ZlfP///////////////////////////////////////////////////////// + //////////////768f/utjj/ra2t////////////////////////////////////////////8/L+/2Ba + 7P8mHub/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/1BK6//o6Pz//////5iU8/8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8tJuf/wb74////////////zsz5/zQs5/8oIOb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/VE3r/+vq/f////////////////////////////// + ///////////////////////////////////++vH/7rU4/62trf////////////////////////////// + //////////////////+ysPb/KyPm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8qIub/tbP2//// + ///a2fv/OTLo/ygg5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx7m/4B78P/9/f////////n5 + /v9wa+7/Jh7m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KCDm/ygg5v+3tPf///////// + /////////////////////////////////////////////////////////vv1//PMc/+tra3///////// + ////////////////////////////////////////4N/7/0Q96f8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jh7m/3Br7v/5+f7/+fn+/3Jt7/8mHub/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg + 5v88NOj/29n7////////////sa72/yoi5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/JR3m/y8o + 5/9jXe3/urf3//////////////////////////////////////////////////////////////////// + ////////ra2t//////////////////////////////////////////////////////+Pi/L/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v81Lef/09H6//////++vPf/LCXm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/6Og9P///////////+jo/P9RSuv/Jx/m/ykh5v8pIeb/KSHm/yce + 5v8oIOb/QDnp/4SA8f+8uvf/9PT+//////////////////////////////////////////////////// + /////////////////////v7/+ea6/62trf////////////////////////////////////////////// + ////////xsT4/zIq5/8oIOb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KCDm/5aS8///////6un9/1FK + 6/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/Jx/m/y8n5/99efD/9vb+////////////j4vy/yUd + 5v8oIOb/Jx/m/y8n5/9aVOz/p6T1/9rZ+//8/P////////////////////////////////////////// + ////////////////////////////////////////+unD/+uqGf+tra3///////////////////////// + //////////////////////////////j4/v9sZu7/Jh7m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYe + 5v9EPen/4N/7//////+dmfT/Jx/m/ykh5v8pIeb/KCDm/yYe5v8sJOb/QTrp/4WA8f/Myvn/8fH9//// + /////////////87M+f83L+j/ODHo/3558P/Ixvn/8O/9//////////////////////////////////// + //////////////////////////////////////////////////////////////rqxv/rqBX/ra2t//// + ////////////////////////////////////////////////////////p6T1/ygg5v8pIeb/KSHm/ykh + 5v8pIeb/KB/m/yUd5v8xKef/UUvr/8vJ+f//////0c/6/zoy6P8mHub/Jh7m/zcw6P9bVOz/q6j1/+Tj + /P/8+//////////////////////////////6+v7/tbP2/87M+f/7+/////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ///+/Pj/99ye/62trf///////////////////////////////////////////////////////////+bl + /P9NRur/Jx/m/ykh5v8mHub/Jh7m/0E66f9taO7/vbv3//Dw/f/9/f////////z8//99ePD/SEHq/3x3 + 8P/Pzfn/9PT+//7+//////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////+tra3///////////////////////////////////////// + ////////////////////////hYHx/yIa5f8tJeb/W1Ts/5CM8v/d2/v//Pz///////////////////// + ////////4+L8/9jX+v/v7v3/9PT+//79//////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////ra2t//////////////////// + /////////////////////////////////////////////8zK+f9/evD/s7D2//Hx/f////////////// + ////////9PP+/9TT+v+cmPP/l5Pz/42J8v9TTev/SkPq/1VO6/+Pi/L/l5Pz/5+b9P/Y1/r/9vX+//// + //////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////62t + rf/////////////////////////////////////////////////////////////////7+///+vr+//// + //////////////7+///j4vz/mJXz/2Jc7f83MOj/Jx/m/yUd5v8lHeb/Jx7m/ycf5v8mHub/JR3m/yUd + 5v8oIOb/OTHo/2di7f+FgPH/y8n5//v6/v////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////+tra3///////////////////////////////////////////////////////// + /////////////////////////v7//+Ph/P+VkfP/R0Dp/ycf5v8mHub/KCDm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8mHub/JR3m/zYu6P95dO//5OP8//7+//////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////ra2t//////////////////////////////////// + /////////////////////////////////////////v7//7Ct9v9GP+n/KB/m/ycf5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/Jx/m/0xF + 6v+dmfT/8fD9//////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////62trf////////////// + ////////////////////////////////////////////////////////7Oz9/4qG8f83MOj/Jh7m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8nH+b/KCDm/3x38P/y8v7///////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //+tra3/////////////////////////////////////////////////////////////////7ez9/3Fr + 7v8mHub/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8mHub/JR3m/yUd5v8lHeb/JR3m/yUd + 5v8nHub/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/d3Lv/9rY+/////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////ra2t//////////////////////////////////////////////////// + ////////7Oz9/3Fs7v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/yYe5v82Luf/W1Xs/4eD + 8f+HgvH/h4Lx/4eC8f+GgvH/VlDr/zQs5/8mHub/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/yYd + 5v9TTOv/6un9//////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////62trf////////////////////////////// + ////////////////////////+fn+/3hz7/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/KSHm/1BJ + 6/+WkvP/zsz5//Hx/f///////////////////////////+/v/f/Jx/n/ko7y/0tE6v8oIOb/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KiLm/3x38P/y8v7///////////////////////////////////////// + //////////////////////////////////////////////////////////////////+tra3///////// + /////////////////////////////////////////v7//66r9v8yKuf/KCDm/ykh5v8pIeb/KSHm/ykh + 5v8mHub/NS7n/52a9P/q6f3//v7///////////////////////////////////////////////////7+ + ///m5fz/mpbz/0hB6v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8oH+b/jIjy//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////ra2t/////////////////////////////////////////////////8/O+f85Muj/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8oIOb/U03r/7Wy9v/9/f////////////////////////////////////////// + ///////////////////////////////////Y1vr/Ukzr/yYe5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zoz + 6P/Bv/j///////////////////////////////////////////////////////////////////////// + /////////////////////////////62trf////////////////////////////////////////////v7 + //96dvD/Jh7m/ykh5v8pIeb/KSHm/ykh5v8mHub/TEbq/9/e+/////////////////////////////// + /////////////////////////////////////////////////////////////9jW+v9STOv/Jh7m/ykh + 5v8pIeb/KSHm/ykh5v8lHeb/ZF7t//X1/v////////////////////////////////////////////// + //////////////////////////////////////////////////+tra3///////////////////////// + ///////////////////OzPn/ODHo/ygg5v8pIeb/KSHm/ykh5v8oIOb/NS7n/6+s9v////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////2Nb6/09J6v8nH+b/KSHm/ykh5v8pIeb/KCDm/y8o5/+7uPf///////////////////////// + ////////////////////////////////////////////////////////////////////////ra2t//// + ///////////////////////////////////7+///enXv/yYe5v8pIeb/KSHm/ykh5v8pIeb/KCDm/5SQ + 8v////////////////////////////////////////////b29//t7e3/7e3u/+3t7v/4+Pj///////// + //////////////////////////////////+tqvX/KyTm/ykh5v8pIeb/KSHm/ykh5v8mHub/aGLt//r5 + /v////////////////////////////////////////////////////////////////////////////// + /////////////62trf//////////////////////////////////////7+/9/0tE6v8nH+b/KSHm/ykh + 5v8pIeb/Jx/m/0hB6v/h4Pz/////////////////////////////////+Pj4/8TExv9ub3T/SElP/0lK + UP9JSU//c3N4/62usP/4+Pj/////////////////////////////////7+79/1hS7P8mHub/KSHm/ykh + 5v8pIeb/KB/m/z846f/a2fv///////////////////////////////////////////////////////// + //////////////////////////////////+tra3//////////////////////////////////////8jG + +f81Lef/KCDm/ykh5v8pIeb/KSHm/y4m5/+zsfb/////////////////////////////////9vb2/4qL + j/8zNDr/KCkw/ykqMf8pKjH/KSox/ycoL/8wMTf/dXV6/93e3/////////////////////////////// + //+sqfX/LCTm/ykh5v8pIeb/KSHm/ykh5v8pIeb/qqf1//////////////////////////////////// + ////////////////////////////////////////////////////////ra2t//////////////////// + //////////////////+SjvL/Jh7m/ykh5v8pIeb/KSHm/ygg5v84MOj/2Nf6//////////////////// + ////////9vb2/4mKjf8sLTT/Kisy/yssM/8rLDP/Kywz/yssM/8rLDP/Kisy/yYnLv9mZ2z/9PT1//// + ////////////////////////7u39/1FL6/8mHub/KSHm/ykh5v8pIeb/JR3m/29q7v/+/v////////// + /////////////////////////////////////////////////////////////////////////////62t + rf/////////////////////////////////6+v7/X1ns/yYe5v8pIeb/KSHm/ykh5v8mHeb/Y13t//j3 + /v///////////////////////////6usrv8tLjX/Kisy/yssM/8rLDP/Kywz/yssM/8rLDP/Kywz/yss + M/8rLDP/LzA3/52doP////////////////////////////////+HgvH/Jx/m/ykh5v8pIeb/KSHm/yUd + 5v9taO7//v7///////////////////////////////////////////////////////////////////// + //////////////////+tra3/////////////////////////////////+vr+/19Z7P8mHub/KSHm/ykh + 5v8pIeb/Jh7m/4B88P////////////////////////////n5+f9iYmj/KCkw/yssM/8rLDP/Kywz/yss + M/8rLDP/Kywz/yssM/8rLDP/Kywz/ygpMP9bXGH/8/Pz////////////////////////////sa72/ygg + 5v8pIeb/KSHm/ykh5v8nH+b/SkPq/+Xk/P////////////////////////////////////////////// + ////////////////////////////////////////ra2t//////////////////////////////////f3 + /v9cVuz/Jh7m/ykh5v8pIeb/KSHm/ysj5v+9u/f////////////////////////////T09X/OjtC/yor + Mv8rLDP/Kisy/ykqMf8rLDP/Kywz/yssM/8rLDP/Kywz/yssM/8rLDP/NTY9/9PT1f////////////// + /////////////7Gu9v8oIOb/KSHm/ykh5v8pIeb/KSDm/zIr5//U0/r///////////////////////// + /////////////////////////////////////////////////////////////62trf////////////// + ///////////////////Y1vr/PTbo/ygg5v8pIeb/KSHm/ykh5v8rI+b/wL34//////////////////// + ////////xMTG/y0uNf8rLDP/Kisy/zQ1PP9CQ0n/LS41/yssM/8rLDP/Kywz/yssM/8rLDP/Kywz/zM0 + O//S0tP///////////////////////////+xrvb/KCDm/ykh5v8pIeb/KSHm/ygg5v8zLOf/1dT6//// + //////////////////////////////////////////////////////////////////////////////// + //+tra3/////////////////////////////////9fT+/1pU7P8mHub/KSHm/ykh5v8pIeb/KyPm/7+8 + +P///////////////////////////8XGx/8vMDb/Kywz/ywtNP+io6b/1NTV/zs8Q/8qKzL/Kywz/yss + M/8rLDP/Kywz/yssM/8yMzr/0dHT////////////////////////////sa72/ygg5v8pIeb/KSHm/ykh + 5v8oIOb/Myzn/9XU+v////////////////////////////////////////////////////////////// + //////////////7//v/9/v3/ra2t//////////////////////////////////r6/v9fWez/Jh7m/ykh + 5v8pIeb/KSHm/ycf5v+GgfH////////////////////////////p6er/TU1T/ygpMf8rLDP/e3yA/6mp + rP83OD//Kisy/yssM/8rLDP/Kywz/yssM/8qKzL/REVL/+Dg4f///////////////////////////7Gu + 9v8oIOb/KSHm/ykh5v8pIeb/KCDm/zYv6P/X1vr///////////////////////////////////////// + ///////////////////////////////////V6MP/gblL/62trf////////////////////////////// + ///19P7/WlPs/yYe5v8pIeb/KSHm/ykh5v8lHeb/bGbu//7+/////////////////////////f39/4aH + i/8rLDP/Kywz/yorMv8sLTT/Kywz/yssM/8rLDP/Kywz/yssM/8rLDP/Jicu/3Jyd//+/v7///////// + //////////////////+NifL/Jx/m/ykh5v8pIeb/KSHm/yYe5v9iXO3/9vb+//////////////////// + ////////////////////////////////////////////////////////2erJ/1miGP+tra3///////// + ////////////////////////vrz3/zIq5/8pIeb/KSHm/ykh5v8pIeb/Jx/m/01G6v/n5vz///////// + ///////////////////q6uv/VFRa/ygpMP8rLDP/Kywz/yssM/8rLDP/Kywz/yssM/8rLDP/KCkw/1FS + WP/V1df////////////////////////////6+v7/Xljs/yYe5v8pIeb/KSHm/ykh5v8lHeb/bmju//7+ + //////////////////////////////////////////////////////////////////////////////v9 + +f/C3aj/ra2t/////////////////////////////////3hz7/8lHeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8uJuf/vbv3/////////////////////////////////8zMzv9JSlD/Jygv/yorMv8rLDP/Kywz/yss + M/8qKzL/Jicv/1FSWP/V1df/////////////////////////////////1dT6/z026P8oIOb/KSHm/ykh + 5v8pIeb/KSHm/6Wi9P////////////////////////////////////////////////////////////// + /////////////////////////////62trf///////////////////////////93c+/9EPen/Jx/m/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/Jh7m/2tl7v/39v7/////////////////////////////////z8/R/2ts + cf88PUP/Kisy/ygpMP8nKDD/Njc+/3JzeP/X19j//////////////////////////////////f3//4J9 + 8P8mHub/KSHm/ykh5v8pIeb/KSHm/y8n5//Fw/j///////////////////////////////////////// + //////////////////////////////////////////////////+tra3///////////////////////// + //+NifL/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8yKuf/wb/4//////////////////// + ///////////////////29vb/2trb/6Ojpv+cnaD/nJ2g/8fHyf/4+Pn///////////////////////// + /////////////9TS+v88Nej/KCDm/ykh5v8pIeb/KSHm/yYe5v9RSuv/8O/9//////////////////// + ////////////////////////////////////////////////////////////////////////ra2t//// + ///////////////////r6v3/SULq/ycf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jh7m/2Fb + 7f/n5vz///////////////////////////////////////////////////////////////////////// + //////////////////////////////Ly/v9kXu3/Jx/m/ykh5v8pIeb/KSHm/ykh5v8nH+b/jYny//// + //////////////////////////////////////////////////////////////////////////////// + /////////////62trf//////////////////////1tT6/0dA6v8mHub/Jh7m/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8mHub/eHLv//v7//////////////////////////////////////////////// + //////////////////////////////////////////////r6/v+Xk/P/LSXm/ygg5v8pIeb/KSHm/ykh + 5v8nH+b/Qjvp/9zb+/////////////////////////////////////////////////////////////// + //////////////////////////////////+tra3///////////////////////39///Z1/v/mpbz/1tV + 7P8sJeb/Jh7m/ygg5v8pIeb/KSHm/ykh5v8pIeb/KCDm/zMs5/+IhPH/5+b8//////////////////// + //////////////////////////////////////////////////////////////r6/v+YlPP/Libn/ygg + 5v8pIeb/KSHm/ykh5v8pIeb/Libn/6mm9f/+/v////////////////////////////////////////// + ////////////////////////////////////////////////////////ra2t//////////////////// + ///////////////////v7v3/u7n3/3558P85Muj/Jx/m/ykh5v8pIeb/KSHm/ykh5v8oIOb/JR3m/2Vg + 7f/T0fr//Pz//////////////////////////////////////////////////////////////////9/d + +/92ce//Lyfn/ygg5v8pIeb/KSHm/ykh5v8pIeb/JR3m/11X7P/x8f3///////////////////////// + /////////////////////////////////////////////////////////////////////////////62t + rf/////////////////////////////////////////////////8/P//09H6/19Z7P8mHub/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8nH+b/OTLo/3148P/R0Pr/9fT+//////////////////////////////////// + ///5+f7/5eT8/52Z9P9KROr/Jh7m/ygg5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/0A56f/Dwfj///////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////+tra3///////////////////////////////////////////////////////// + ///Dwfj/OjPo/ycf5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg5v8mHub/OTHo/19Z7P+UkPL/u7j3/+Lg + /P/g3/v/4eD8/7Wy9v+Xk/P/dnHv/0M86f8pIeb/Jx/m/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jh7m/0A5 + 6f/Cv/j///////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////ra2t//////////////////////////////////// + /////////////////////////////7e09/85Muj/Jh3m/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ygg + 5v8mHub/JR3m/zAo5/87NOj/OzTo/zs06P8uJuf/JR3m/yYe5v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/Jx/m/zkx6P+lovT///////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////62trf////////////// + ////////////////////////////////////////////////////////u7n3/1VP6/8nH+b/KCDm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/KCDm/ygg5v8oIOb/KSDm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/JR3m/0A46f/Cv/j//f3///////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //+tra3///////////////////////////////////////////////////////////////////////// + ///n5vz/bGbu/y4m5/8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8nH+b/KCDm/2Re7f/Ixvn///////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////ra2t//////////////////////////////////////////////////// + //////////////////////////////T0/v+lofT/RD3p/ycf5v8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh + 5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ycf5v8oIOb/SkPq/5qW8//s7P3///////// + //////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////62trf////////////////////////////// + /////////////////////////////////////////////////////////v7//+Hg/P+UkPL/R0Dq/zMr + 5/8pIOb/KCDm/ykh5v8pIeb/KSHm/ykh5v8pIeb/KSHm/ykh5v8pIeb/Jx/m/y8n5/9MRer/m5fz/+bl + /P/+/v////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////+tra3///////// + //////////////////////////////////////////////////////////////////////////////// + /////////////+Df+//Ixvn/hYDx/0U+6f8nH+b/KSHm/ykh5v8pIeb/KSHm/ykh5v8oIOb/Mirn/29q + 7v+zsfb/5eT8//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..e521d78 --- /dev/null +++ b/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/serialPortOption.cs b/serialPortOption.cs new file mode 100644 index 0000000..1054e3d --- /dev/null +++ b/serialPortOption.cs @@ -0,0 +1,156 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Globalization; +using System.IO; +using System.IO.Ports; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Windows.Forms; + +namespace FlyDockTool +{ + public class SerialPortOption + { + /// + /// 让此类创建一个串口操作的单例类 + /// + public static SerialPortOption Instance; //申明一个EcgDrawing对象,复制Null + public static int BufferBytesLength = 0; + private Thread _thSerialPortDataRead; //串口数据读取线程 + public SerialPort DataReadSerialPort; + public DateTime SerialTime; + private static readonly object LockHelper = new object(); + public EventHandler dataOutPutShow; + public static SerialPortOption CreateInstance() + { + if (Instance == null) + lock (LockHelper) + { + if (Instance == null) + Instance = new SerialPortOption(); + } + return Instance; + } + + /// + /// 初始化串口 + /// + public void IniserialPortOption() + { + //数据读取串口 初始化 + //CcgDataReadSerialPort = new SerialPort(ConfigHelper.EcgDataComPort, 1500000, Parity.None, 8, StopBits.One) + + // string CurrentDevice = ConfigurationManager.AppSettings["CurrentDevice"];//获取设备信息URL + string comName= ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + int baudRate= int.Parse(ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]); + string parity1= ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[5]; + Parity parity = Parity.None; + if (parity1.ToUpper()== "NONE") + parity= Parity.None; + if (parity1.ToUpper() == "EVEN") + parity = Parity.Even; + int databits= int.Parse(ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[6]); + StopBits SB = StopBits.One; + string sb1 = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[7]; + if (sb1== "1") + SB = StopBits.One; + if (sb1.ToUpper() == "NONE") + SB = StopBits.None; + if (sb1.ToUpper() == "2") + SB = StopBits.Two; + DataReadSerialPort = new SerialPort(comName, baudRate, parity, databits, SB) + { + RtsEnable = false, + ReadBufferSize = 4096000, + ReadTimeout = 3000, + ReceivedBytesThreshold = 1 + }; + SerialTime = DateTime.Now; + } + + /// + /// 下发AD启动指令 + /// + public void writeStartAD_Command() + { + byte[] EcgStart = { 0xBB, 0x44, 0xAA, 0x55, 0xCC, 0x01, 0x00, 0x00, 0xCB, 0x02 }; + if (!DataReadSerialPort.IsOpen) + DataReadSerialPort.Open(); + DataReadSerialPort.Write(EcgStart, 0, EcgStart.Length); + } + + /// + /// 下发AD停止命令 + /// + public void writeStopAD_Command() + { + byte[] EcgEnd = { 0xBB, 0x44, 0xAA, 0x55, 0x02, 0x00, 0x00, 0xCC, 0x02 }; + if (!DataReadSerialPort.IsOpen) + { + DataReadSerialPort.Open(); + } + DataReadSerialPort.Write(EcgEnd, 0, EcgEnd.Length); + } + + /// + /// 终止串口数据读取的线程 + /// + public void StopDataReadThread() + { + _thSerialPortDataRead.Abort(); + } + + /// + /// 开启串口数据读取的线程 + /// + public void StartDataReadThread() + { + _thSerialPortDataRead = new Thread(DataRead) + { + IsBackground = true, + Priority = ThreadPriority.Highest + }; + _thSerialPortDataRead.Start(); + } + + /// + /// 读取串口数据 + /// + private void DataRead() + { + while (true) + { + try + { + if (!DataReadSerialPort.IsOpen) + { + DataReadSerialPort.Open(); + } + BufferBytesLength = DataReadSerialPort.BytesToRead; + if (BufferBytesLength > 0) + { + var buffer = new byte[BufferBytesLength]; + DataReadSerialPort.Read(buffer, 0, BufferBytesLength); + string encodingStr = "UTF-8"; + try + { + encodingStr = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[8]; + } + catch { } + string ReDataStr = Encoding.GetEncoding(encodingStr).GetString(buffer); + dataOutPutShow(ReDataStr, null); + } + } + catch { } + Thread.Sleep(1000);//睡眠1秒 + } + } + + + + + } +} \ No newline at end of file