21
十二月

Ex2: CD Reader for COPD 3

   Posted by: admin   in 104(上)

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
 
namespace Ex3
{
    class Program
    {
        static void Main(string[] args)
        {
            HashSet<string> setID = new HashSet<string>();
            HashSet<string> setDepress = 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);
                string ICD9_F1 = ICD9_1.Substring(0, 4);
                string ICD9_F2 = ICD9_2.Substring(0, 4);
                string ICD9_F3 = ICD9_3.Substring(0, 4);
                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")
                {
                    count++;
                    Console.WriteLine(line);
                    if (!setID.Contains(ID))
                        setID.Add(ID);
                }
                if (setID.Contains(ID))
                {
                    if (ICD9_F1 == "2962" || ICD9_F2 == "2962" || ICD9_F3 == "2962" ||
                        ICD9_F1 == "2963" || ICD9_F2 == "2963" || ICD9_F3 == "2963" ||
                        ICD9_F1 == "3004" || ICD9_F2 == "3004" || ICD9_F3 == "3004" ||
                        ICD9_T1 == "311" || ICD9_T1 == "311" || ICD9_T1 == "311")
                    {
                        if (!setDepress.Contains(ID))
                            setDepress.Add(ID); 
                    } 
                }
                line = sr.ReadLine();
            }
            //Console.WriteLine("Number=" + count );
            Console.WriteLine("Number=" + count + " COPD =" + setID.Count + " Depression =" + setDepress.Count);
        }
    }
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , , ,

14
十二月

Ex2: CD Reader for COPD 2

   Posted by: admin   in 104(上)

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);
        }
    }
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , , ,

7
十二月

Ex1: CD Reader for COPD

   Posted by: admin   in 104(上)

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            string filename = args[0];
            StreamReader sr = new StreamReader(filename);
 
            string line = sr.ReadLine();
            while (line != null && line.Length > 10)
            {
                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")
                {
                    Console.WriteLine("ID="+ ID+ "ICD(1)=" + ICD9_1 + ",ICD(2)=" + ICD9_2 + ",ICD(3)=" + ICD9_3);
                    count++;
                }
                line = sr.ReadLine();
            }
            Console.WriteLine("Number=" + count);
        }
    }
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , , ,

6
十二月

Read a file

   Posted by: admin   in 104(上)

string filename = args[0];
StreamReader sr = new StreamReader(filename);
string line = sr.ReadLine();
while (line != null && line.Length > 10)
{
    string ACODE_ICD9_1 = line.Substring(130, 3);
    Console.WriteLine(line);
     line = sr.ReadLine();
}
sr.Close();

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , , ,

6
十二月

NHIRD_DD

   Posted by: admin   in 104(上)

public class NHIRD_DD
    {
        public string FEE_YM;
        public string APPL_TYPE;
        public string HOSP_ID;
        public string APPL_DATE;
        public string CASE_TYPE;
        public string SEQ_NO;
        public string ID     ;
        public string ID_BIRTHDAY;
        public string GAVE_KIND;
        public string TRAC_EVEN;
        public string CARD_SEQ_NO;
        public string FUNC_TYPE;
        public string IN_DATE;
        public string OUT_DATE;
        public string APPL_BEG_DATE;
        public string APPL_END_DATE;
        public string E_BED_DAY;
        public string S_BED_DAY;
        public string PRSN_ID;
        public string DRG_CODE;
        public string EXT_CODE_1;
        public string EXT_CODE_2;
        public string TRAN_CODE;
        public string ICD9CM_CODE;
        public string ICD9CM_CODE_1;
        public string ICD9CM_CODE_2;
        public string ICD9CM_CODE_3;
        public string ICD9CM_CODE_4;
        public string ICD_OP_CODE;
        public string ICD_OP_CODE_1;
        public string ICD_OP_CODE_2;
        public string ICD_OP_CODE_3;
        public string ICD_OP_CODE_4;
        public string DIAG_AMT;
        public string ROOM_AMT;
        public string MEAL_AMT;
        public string AMIN_AMT;
        public string RADO_AMT;
        public string THRP_AMT;
        public string SGRY_AMT;
        public string PHSC_AMT;
        public string BLOD_AMT;
        public string HD_AMT;
        public string ANE_AMT;
        public string METR_AMT;
        public string DRUG_AMT;
        public string DSVC_AMT;
        public string NRTP_AMT;
        public string INJT_AMT;
        public string BABY_AMT;
        public string CHARG_AMT;
        public string MED_AMT;
        public string PART_AMT;
        public string APPL_AMT;
        public string EB_APPL30_AMT;
        public string EB_PART30_AMT;
        public string EB_APPL60_AMT;
        public string EB_PART60_AMT;
        public string EB_APPL61_AMT;
        public string EB_PART61_AMT;
        public string SB_APPL30_AMT;
        public string SB_PART30_AMT;
        public string SB_APPL90_AMT;
        public string SB_PART90_AMT;
        public string SB_APPL180_AMT;
        public string SB_PART180_AMT;
        public string SB_APPL181_AMT;
        public string SB_PART181_AMT;
        public string PART_MARK;
        public string ID_SEX;
 
    }

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , , ,