资源简介

C#通过TCP实现 HL7医疗系统传输的协议,并使用MLLP协议接收HL7消息并解析,网上有很多解析类用不了,要不就一堆DLL文件没说明,我这个纯代码,有示列demo,文件中还包括socket服务端和客户端相关示列代码,有需要的可以下载,开发环境为VS2010,详细请看网址https://blog.csdn.net/bdb1018/article/details/106237819

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HLSevenLib.base;

namespace HL7Test
{
    public partial class analydataform : Form
    {
        public analydataform()
        {
            InitializeComponent();
        }

        private void analydataform_Load(object sender EventArgs e)
        {

        }

        private void btnanlytoTab_Click(object sender EventArgs e)
        {
             HLSevenLib.base.Message msg = null;
            msg=new HLSevenLib.base.Message(txtvalue.Text);
            if (msg != null)
            {
                ShowGrid(dtgRev msg.Segments 2);
            }

        }
           private void ShowGrid(DataGridView dtg List segments int mode)
        {
            dtg.Rows.Clear();
            int count = 0;
            for (int i = 0; i < segments.Count; i++)
            {
                Segment seg = segments[i];
                if (seg.Name == “PID“)
                {
                   //
                }

                count = dtg.RowCount;
                dtg.Rows.Add(1);
                dtg[0 count].Value = seg.Name;
                dtg[1 count].Value = seg.Usage.ToString();
                dtg.Rows[count].ReadOnly = true;
                if (seg.Usage == Usage.NotUsed)
                {
                    dtg.Rows[count].DefaultCellstyle.BackColor = Color.Red;
                }
                else if (seg.Usage == Usage.Optional)
                {
                    dtg.Rows[count].DefaultCellstyle.BackColor = Color.Pink;
                }
                else
                {
                    dtg.Rows[count].DefaultCellstyle.BackColor = Color.SkyBlue;
                }

                for (int j = 1; j < seg.Fields.Count; j++)
                {
                    Listse.Component> com = seg.Fields[j].Components;
                    string pre = ““;
                    if (com.Count > 1)
                    {
                        count = dtg.RowCount;
                        dtg.Rows.Add(1);

                        if (seg.Fields[j].LocalName != ““)
                        {
                            dtg[0 count].Value = “+“ + seg.Fields[j].LocalName;
                        }
                        else
                        {
                            dtg[0 count].Value = “+“ + seg.Fields[j].EnglishName;
                        }

                        dtg[1 count].Value = “ ------“;


                        dtg[0 count].style.BackColor = Color.Yellow;
                        dtg.Rows[count].ReadOnly = true;

                        pre = “ - “;
                    }

                    bool haveValue = false;
                    for (int k = 0; k < com.Count; k++)
                    {
                 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-05-12 17:42  HL7Test\
     目录           0  2020-05-12 09:10  HL7Test\HL7Test\
     文件        5488  2020-05-04 22:39  HL7Test\HL7Test\HL7Test.csproj
     文件         496  2020-05-04 22:38  HL7Test\HL7Test\Program.cs
     目录           0  2020-05-12 09:10  HL7Test\HL7Test\Properties\
     文件        1346  2020-05-04 21:46  HL7Test\HL7Test\Properties\AssemblyInfo.cs
     文件        6847  2020-05-04 22:39  HL7Test\HL7Test\analyData.Designer.cs
     文件        7822  2020-05-12 15:58  HL7Test\HL7Test\analyData.cs
     文件        6629  2020-05-04 22:39  HL7Test\HL7Test\analyData.resx
     目录           0  2020-05-12 09:10  HL7Test\HL7Test\bin\
     目录           0  2020-05-12 09:10  HL7Test\HL7Test\bin\Debug\
     文件       11776  2020-05-12 18:29  HL7Test\HL7Test\bin\Debug\HL7Test.exe
     文件       26112  2020-05-12 18:29  HL7Test\HL7Test\bin\Debug\HL7Test.pdb
     文件       11600  2020-05-12 18:06  HL7Test\HL7Test\bin\Debug\HL7Test.vshost.exe
     文件         490  2018-04-12 07:35  HL7Test\HL7Test\bin\Debug\HL7Test.vshost.exe.manifest
     文件      781312  2020-05-12 18:29  HL7Test\HL7Test\bin\Debug\HLSevenLib.dll
     文件     1605120  2020-05-12 18:29  HL7Test\HL7Test\bin\Debug\HLSevenLib.pdb
     目录           0  2020-05-20 16:51  HL7Test\HL7Test\bin\Release\
     目录           0  2020-05-12 09:10  HL7Test\HL7Test\bin\x86\
     目录           0  2020-05-12 09:16  HL7Test\HL7Test\bin\x86\Debug\
     文件       11776  2020-05-12 18:29  HL7Test\HL7Test\bin\x86\Debug\HL7Test.exe
     文件       26112  2020-05-12 18:29  HL7Test\HL7Test\bin\x86\Debug\HL7Test.pdb
     文件       11600  2020-05-12 18:06  HL7Test\HL7Test\bin\x86\Debug\HL7Test.vshost.exe
     文件         490  2018-04-12 07:35  HL7Test\HL7Test\bin\x86\Debug\HL7Test.vshost.exe.manifest
     文件      781312  2020-05-12 18:29  HL7Test\HL7Test\bin\x86\Debug\HLSevenLib.dll
     文件     1605120  2020-05-12 18:29  HL7Test\HL7Test\bin\x86\Debug\HLSevenLib.pdb
     目录           0  2020-05-12 09:10  HL7Test\HL7Test\obj\
     目录           0  2020-05-12 09:10  HL7Test\HL7Test\obj\Debug\
     文件         863  2020-05-04 21:47  HL7Test\HL7Test\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        5939  2020-05-04 22:17  HL7Test\HL7Test\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         180  2020-05-04 22:17  HL7Test\HL7Test\obj\Debug\HL7Test.Form1.resources
............此处省略311个文件信息

评论

共有 条评论