diff --git a/app.config b/app.config index 91524b3..b505e2c 100644 --- a/app.config +++ b/app.config @@ -83,7 +83,9 @@ - + + + diff --git a/deviceAnalysis.cs b/deviceAnalysis.cs index 93aac82..8e74430 100644 --- a/deviceAnalysis.cs +++ b/deviceAnalysis.cs @@ -2479,6 +2479,46 @@ namespace FlyDockTool dataOutPutShow("数据提交失败:" + jsonStr, null); } + } + if (apiOptions.CurrentDevice == "Z3 CRP")//Z3 血常规 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + List ermList = new List(); + string[] itemArray = new string[21] { "WBC", "LYM#", "MID#", "GRAN#", "LYM%", "MID%", "GRAN%", "RBC", "HGB", "HCT", "MCV", "MCH", "MCHC", "RDW-CV", "RDW-SD", "PLT", "MPV", "PDW", "PCT", "P-LCC", "P-LCR" }; + //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("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); + } + + + //将结果提交到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; } @@ -3071,6 +3111,23 @@ namespace FlyDockTool } _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 } + + if (apiOptions.CurrentDevice == "Z3 CRP")//血常规 Z3 + { + // 设置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毫秒频率 + } } /// @@ -3233,6 +3290,17 @@ namespace FlyDockTool tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 } + + if (apiOptions.CurrentDevice == "Z3 CRP")//血常规Z3 + { + if (tempData.Contains("OBX|26|"))//OBX|25| 为结束符 说明字符串完整了 + { + deviceAnalysisOption(tempData); + tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 + } + + //_tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } } /// @@ -3585,6 +3653,12 @@ namespace FlyDockTool _tcpResult.Change(-1, 10);//停止tcp数据接收 clientSocket.Close(); } + + if (apiOptions.CurrentDevice == "Z3 CRP")//帝迈血常规DH56 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } } ///// diff --git a/mainForm.Designer.cs b/mainForm.Designer.cs index 0bc32b9..85a623d 100644 --- a/mainForm.Designer.cs +++ b/mainForm.Designer.cs @@ -57,8 +57,10 @@ 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.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(1107, 144); + this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox2.Size = new System.Drawing.Size(738, 96); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "操作"; @@ -66,9 +68,10 @@ // // button1 // - this.button1.Location = new System.Drawing.Point(840, 82); + this.button1.Location = new System.Drawing.Point(560, 55); + this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(198, 41); + this.button1.Size = new System.Drawing.Size(132, 27); this.button1.TabIndex = 2; this.button1.Text = "获取设备编号"; this.button1.UseVisualStyleBackColor = true; @@ -77,9 +80,10 @@ // lb_currentDeviceInfo // this.lb_currentDeviceInfo.AutoSize = true; - this.lb_currentDeviceInfo.Location = new System.Drawing.Point(191, 39); + this.lb_currentDeviceInfo.Location = new System.Drawing.Point(127, 26); + this.lb_currentDeviceInfo.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lb_currentDeviceInfo.Name = "lb_currentDeviceInfo"; - this.lb_currentDeviceInfo.Size = new System.Drawing.Size(17, 18); + this.lb_currentDeviceInfo.Size = new System.Drawing.Size(11, 12); this.lb_currentDeviceInfo.TabIndex = 1; this.lb_currentDeviceInfo.Text = "-"; // @@ -88,27 +92,30 @@ 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.Location = new System.Drawing.Point(141, 55); + this.lb_info.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lb_info.Name = "lb_info"; - this.lb_info.Size = new System.Drawing.Size(18, 24); + this.lb_info.Size = new System.Drawing.Size(13, 17); 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.Location = new System.Drawing.Point(52, 26); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(98, 18); + this.label1.Size = new System.Drawing.Size(65, 12); 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.Location = new System.Drawing.Point(54, 51); + this.btn_start_or_stop.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 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.Size = new System.Drawing.Size(75, 31); this.btn_start_or_stop.TabIndex = 0; this.btn_start_or_stop.Text = "启动"; this.btn_start_or_stop.UseVisualStyleBackColor = true; @@ -118,9 +125,11 @@ // 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.Location = new System.Drawing.Point(0, 96); + this.groupBox3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(1107, 593); + this.groupBox3.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox3.Size = new System.Drawing.Size(738, 395); this.groupBox3.TabIndex = 2; this.groupBox3.TabStop = false; this.groupBox3.Text = "数据接收"; @@ -131,11 +140,12 @@ 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.Location = new System.Drawing.Point(2, 16); + this.txt_msg.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 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.Size = new System.Drawing.Size(734, 377); this.txt_msg.TabIndex = 0; // // timer_dataShow @@ -158,13 +168,13 @@ this.显示ToolStripMenuItem, this.退出ToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(133, 80); + this.contextMenuStrip1.Size = new System.Drawing.Size(111, 56); // // 显示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.Size = new System.Drawing.Size(110, 26); this.显示ToolStripMenuItem.Text = "显示"; this.显示ToolStripMenuItem.Click += new System.EventHandler(this.显示ToolStripMenuItem_Click); // @@ -172,24 +182,25 @@ // 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.Size = new System.Drawing.Size(110, 26); this.退出ToolStripMenuItem.Text = "退出"; this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); // // mainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1107, 737); + this.ClientSize = new System.Drawing.Size(738, 491); 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.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "mainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "福乐云软硬件数据对接工具V1.1(2024121301)"; + this.Text = "福乐云软硬件数据对接工具V1.1(2025010801)"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mainForm_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); this.groupBox2.ResumeLayout(false); diff --git a/mainForm.cs b/mainForm.cs index c0dcf1d..10787b5 100644 --- a/mainForm.cs +++ b/mainForm.cs @@ -33,7 +33,7 @@ namespace FlyDockTool apiOptions.MachineID = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[2]; lb_currentDeviceInfo.Text = CurrentDevice; //////测试代码 测试完毕后注释调一下两行代码 - //string resultDataStr = File.ReadAllText(@"D:\工作\接受数据工具 list\BA600.txt", Encoding.GetEncoding("GB18030")); + //string resultDataStr = File.ReadAllText(@"D:\工作\接受数据工具 list\血常规Z3CRP.txt", Encoding.GetEncoding("GB18030")); //deviceAnalysis.CreateInstance().deviceAnalysisOption(resultDataStr); btn_start_or_stop_Click(null,null);//启动数据接收