资源简介
从外部读入一个Hl7.txt的文件,程序的功能如下:
可以把HL7消息的每个区段进行分离
可以清空界面的文字,然后在输入框输入相关内容,最后按【生成Hl7消息】按钮,生成相关的HL7消息
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
openFileDialog1.Filter = “文本文件|*.txt“;
if(openFileDialog1.ShowDialog()==DialogResult.OK)
{
textBox6.Text = ““;
string fname =openFileDialog1.FileName;
StreamReader sr = File.OpenText(fname);
string str;
while ((str = sr.ReadLine()) != null)
{
textBox6.Text += str;
}
}
}
private void button2_Click(object sender EventArgs e)
{
string str = textBox6.Text.ToString();
if (textBox6.Text.Contains(“MSH“))
{
textBox1.Text = “MSH“;
string str1 = str;
int j=0;
str1 = str1.Replace(“MSH“ ““);
str1=str1.Remove(str1.IndexOf(““));
string[] temp = str1.Split(‘|‘);
DataTable table = new DataTable(“table“);
table.Columns.Add(new DataColumn(“#“ typeof(int)));
table.Columns.Add(new DataColumn(“value“ typeof(string)));
for (int i = 0; i < temp.Length; i++)
{
if (temp[i].Equals(““))
{
}
else
{
j = j+1;
DataRow row = table.NewRow();
row[“#“] = j;
row[“value“] = temp[i];
table.Rows.Add(row);
}
}
dataGridView1.DataSource = table;
}
if (textBox6.Text.Contains(“EVN“))
{
textBox2.Text = “EVN“;
string str1 = str;
int j=0;
str1 = str1.Substring(str.IndexOf(“EVN“));
str1 = str1.Replace(“EVN“ ““);
str1 = str1.Remove(str1.IndexOf(““));
string[] temp = str1.Split(‘|‘);
DataTable table = new DataTable(“table“);
table.Columns.Add(new DataColumn(“#“ typeof(int)));
table.Columns.Add(new DataColumn(“value“ typeof(string)));
for (int i = 0; i < temp.Length; i++)
{
if (temp[i].Equals(““))
{
}
else
{
j=j+1;
DataRow row = table.NewRow();
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4547 2009-12-04 18:48 HL7信息提取\WindowsApplication1\UpgradeLog.xm
文件 16896 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.exe
文件 34304 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.pdb
文件 14328 2009-12-12 17:14 HL7信息提取\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe
文件 490 2007-07-21 01:33 HL7信息提取\WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe.manifest
文件 10554 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\Form1.cs
文件 15434 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\Form1.Designer.cs
文件 6216 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\Form1.resx
文件 4608 2009-12-04 18:48 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 1338 2009-12-12 17:14 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.csproj.FileListAbsolute.txt
文件 847 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.csproj.GenerateResource.Cache
文件 16896 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.exe
文件 180 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Form1.resources
文件 34304 2009-12-07 20:22 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.pdb
文件 180 2009-12-04 18:48 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\WindowsApplication1.Properties.Resources.resources
文件 478 2009-11-24 14:42 HL7信息提取\WindowsApplication1\WindowsApplication1\Program.cs
文件 1198 2009-11-24 14:42 HL7信息提取\WindowsApplication1\WindowsApplication1\Properties\AssemblyInfo.cs
文件 2862 2009-12-04 18:48 HL7信息提取\WindowsApplication1\WindowsApplication1\Properties\Resources.Designer.cs
文件 5612 2009-11-24 14:42 HL7信息提取\WindowsApplication1\WindowsApplication1\Properties\Resources.resx
文件 1117 2009-12-04 18:48 HL7信息提取\WindowsApplication1\WindowsApplication1\Properties\Settings.Designer.cs
文件 249 2009-11-24 14:42 HL7信息提取\WindowsApplication1\WindowsApplication1\Properties\Settings.settings
文件 3453 2009-12-04 18:48 HL7信息提取\WindowsApplication1\WindowsApplication1\WindowsApplication1.csproj
文件 947 2009-12-04 18:48 HL7信息提取\WindowsApplication1\WindowsApplication1.sln
..A..H. 15360 2009-12-12 17:16 HL7信息提取\WindowsApplication1\WindowsApplication1.suo
文件 3348 2009-12-04 18:48 HL7信息提取\WindowsApplication1\_UpgradeReport_Files\UpgradeReport.css
文件 12505 2008-01-11 01:25 HL7信息提取\WindowsApplication1\_UpgradeReport_Files\UpgradeReport.xslt
文件 69 2009-12-04 18:48 HL7信息提取\WindowsApplication1\_UpgradeReport_Files\UpgradeReport_Minus.gif
文件 71 2009-12-04 18:48 HL7信息提取\WindowsApplication1\_UpgradeReport_Files\UpgradeReport_Plus.gif
目录 0 2009-12-12 17:24 HL7信息提取\WindowsApplication1\WindowsApplication1\obj\Debug\TempPE
目录 0 2009-12-12 17:24 HL7信息提取\WindowsApplication1\WindowsApplication1\bin\Debug
............此处省略13个文件信息
评论
共有 条评论