using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { HashSet<string> setID = new HashSet<string>(); int count = 0; string filename = args[0];//檔案名稱 StreamReader sr = new StreamReader(filename); string line = sr.ReadLine(); while (line != null && line.Length > 1) { string ID = line.Substring(91, 32); string ICD9_1 = line.Substring(131, 5); string ICD9_2 = line.Substring(136, 5); string ICD9_3 = line.Substring(141, 5); string ICD9_T1 = ICD9_1.Substring(0, 3); string ICD9_T2 = ICD9_2.Substring(0, 3); string ICD9_T3 = ICD9_3.Substring(0, 3); if (ICD9_T1 == "491" || ICD9_T1 == "492" || ICD9_T1 == "496" || ICD9_T2 == "491" || ICD9_T2 == "492" || ICD9_T2 == "496" || ICD9_T3 == "491" || ICD9_T3 == "492" || ICD9_T3 == "496") { if (!setID.Contains(ID)) setID.Add(ID); Console.WriteLine("ID=" + ID + "ICD(1)=" + ICD9_1 + ",ICD(2)=" + ICD9_2 + ",ICD(3)=" + ICD9_3); count++; } //Console.WriteLine(line); line = sr.ReadLine(); } Console.WriteLine("Number=" + count + "Persons=" +setID.Count); } } }
This entry was posted
on 星期一, 十二月 14th, 2015 at 03:38:05 and is filed under 104(上).
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Leave a reply