C#检验仪器接口开发

1. Interface principle (what the interface does) : Parse the data sent by the instrument and save it to our His database.
Lis instruments on the market generally carry out information interaction in three forms. The first is TCP. Second: port. Third: Parse the file
The purpose of these three is to send data to different tools. For example, I can send data to you through QQ, and I can also use wechat.
Just in a different form)
TCP : supports one-to-many transmission. Data can be sent anywhere through network cables. That’s what it means
The interface program can be installed on any computer, provided it can be pinged. Main Parameters (Host IP address, TCP port number)
Port : one-to-one, the port is connected to the instrument with a line, only that line of the computer can receive the instrument sent
Data main parameters (serial port, baud rate, data bit, stop bit)
Parse file : Instrument software can send data to a file. Our interface program reads the number of that file directly
According to it.
Once you know that, the rest is easy.
2.Interface Data Instance:接口实例
3.Above is the instrument to send data, this is the standard hml7, OBR | | 1, the sample is corresponding to the number 1. OBX|7||NM|
In this row, LYM# is the return number, and then **** is the result. These are the main numbers.
4.If connected to his Medical system, it is obvious that the specimen number corresponds to the serial number of his instrument matching, and the corresponding maintenance single channel code can be displayed on his medical system
5.The point of all this is to give you an idea of how it works, and if you’re good at coding, you can usually write a fun interface yourself
6.Next I did not say about the code principle, I hope to help you:.NET listening, can directly listen to the instrument TCP, sent data, we directly process the data sent, saved to the database. The serial port is similar
7.
The client
(1) Connect to the server
Code:
TcpClient tcp = new TcpClient();
tcp.Connect(IP,Port); //根据服务器的IP地址和侦听的端口连接
if (tcp.Connected)
{
//连接成功的消息机制
MessageBox.Show( “成功连接上了服务器”);
}
(2) Establish the data flow connecting to the server
Code:
NetworkStream streamToServer = tcp.GetStream();
(3) Receiving and sending data
Code:
//发送字符串
byte [] buffer = Encoding.Unicode.GetBytes(msg); //msg为发送的字符串
try
{
lock (streamToServer)
{
streamToServer.Write(buffer, 0, buffer.Length); // 发往服务器
}
//接收字符串
buffer = new byte [BufferSize];
lock (streamToServer)
{
bytesRead = streamToServer.Read(buffer, 0, BufferSize);
}
}

The service side:
You can take the server as a test instrument. In fact, you can write a server, a client and two software to conduct a data interaction, similar to our QQ and wechat, so that you can fully understand the TCP, the serial port is actually the same.
8.Procedure for connecting to his Medical system:

  1. Items prescribed by His, such as test items issued by outpatient doctors, test items issued by inpatient medical orders, or Lis registration in other hospitals.
  2. Outpatient doctors go to Lis specimen registration and select outpatient drop-down list, or fill in the consultation number. Hospitalization corresponds to hospitalization, and the patient is transferred to the post point
    Clicking Save will generate a test bar code. The other hospital can directly open the project and click Save.
  3. Specimen collection is usually only done in hospital. If you do not want it, you can skip it directly.
  4. Specimen reception: Select the corresponding patient to receive.
  5. The testing doctor prescribes corresponding items on the Lis instrument for testing. Get the result and the serial number.
  6. Match the serial number of the instrument. Select the corresponding instrument and match the serial number of the instrument.
  7. The instrument sends the results.
  8. The instrument interface receives the results sent by the instrument and saves them to our His database.
    10.His queries the database and obtains the results, which are displayed on the His system.
    9.Instrument screenshots
    在这里插入图片描述
    在这里插入图片描述
您好!对于C# Web API接口开发,有以下一些常见的步骤和注意事项: 1. 创建一个新的C# Web API项目:使用Visual Studio或其他适合的IDE,创建一个新的C# Web API项目。 2. 定义和设计接口:根据您的需求,确定接口的功能和数据结构。设计良好的接口能够提高代码的可读性和可维护性。 3. 实现控制器:在项目中创建控制器类,控制器类负责处理HTTP请求并返回响应。您可以使用ASP.NET Core框架中的[ApiController]特性来简化一些操作。 4. 定义路由:使用ASP.NET Core框架中的路由特性(如[HttpGet]、[HttpPost]等)来定义API的路由地址和请求方法。 5. 实现业务逻辑:在控制器中实现具体的业务逻辑,可以调用其他服务、数据库或外部API来完成相关操作。 6. 处理数据验证和错误处理:在API接口中进行输入数据的验证,并合理处理可能发生的错误,返回合适的HTTP状态码和错误信息。 7. 编写单元测试:编写单元测试来验证API接口的正确性和稳定性,可以使用xUnit、NUnit等测试框架进行单元测试。 8. 部署和发布:将API应用程序部署到适当的环境中,可以是本地IIS、云服务(如Azure、AWS)等。 需要注意的是,C# Web API开发中应该考虑安全性、性能和可扩展性等方面的需求,同时也要遵循良好的编码规范和最佳实践来提高代码质量。 希望以上信息对您有所帮助!如果您还有其他问题,请继续提问。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值