Archive for the ‘102(上)醫學資訊管理’ Category

1217mim

使用Webmatrix產生插入資料到資料庫的程式

使用Webmatrix產生插入資料到資料庫的程式

健保資料原始檔轉Access資料庫

健保資料原始檔轉Access資料庫

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

private void button3_Click(object sender, EventArgs e)
        {
 
            StreamReader sr = new StreamReader(textBox1.Text);//開啟原始資料的檔案
            string line = sr.ReadLine();//從原始資料檔讀入一行
            int linecount = 0;
            while (line != null && line.Length > 0)
            {
                NHIRD_CD cd = ParseCDLine(line);//把原始資料切成不同欄位
                DBEntry_CD dbe_cd = new DBEntry_CD(cd);//轉換成資料庫的欄位
                InsertCDRecord(dbe_cd);//插入資料庫
                linecount++;
                line = sr.ReadLine();
            }
            label2.Text = "lines=" + linecount.ToString();
        }
        public int InsertCDRecord(DBEntry_CD cd)
        {
            string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=\\\\172.16.5.19\\desktop_dat\\htchu\\桌面\\NHIRD-Student.mdb";
            System.Data.IDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(connectionString);
 
            string queryString = @"INSERT INTO [CD] ([FEE_YM], [APPL_TYPE], [HOSP_ID], [APPL_DATE], [CASE_TYPE], [SEQ_NO], [CURE_ITEM_NO1], [CURE_ITEM_NO2], [CURE_ITEM_NO3], [CURE_ITEM_NO4], [FUNC_TYPE], [FUNC_DATE], [TREAT_END_DATE], [ID_BIRTHDAY], [ID], [CARD_SEQ_NO], [GAVE_KIND], [PART_NO], [ACODE_ICD9_1], [ACODE_ICD9_2], [ACODE_ICD9_3], [ICD_OP_CODE], [DRUG_DAY], [MED_TYPE], [PRSN_ID], [PHAR_ID], [DRUG_AMT], [TREAT_AMT], [TREAT_CODE], [DIAG_AMT], [DSVC_NO], [DSVC_AMT], [BY_PASS_CODE], [T_AMT], [PART_AMT], [T_APPL_AMT], [ID_SEX]) VALUES (@FEE_YM, @APPL_TYPE, @HOSP_ID, @APPL_DATE, @CASE_TYPE, @SEQ_NO, @CURE_ITEM_NO1, @CURE_ITEM_NO2, @CURE_ITEM_NO3, @CURE_ITEM_NO4, @FUNC_TYPE, @FUNC_DATE, @TREAT_END_DATE, @ID_BIRTHDAY, @ID, @CARD_SEQ_NO, @GAVE_KIND, @PART_NO, @ACODE_ICD9_1, @ACODE_ICD9_2, @ACODE_ICD9_3, @ICD_OP_CODE, @DRUG_DAY, @MED_TYPE, @PRSN_ID, @PHAR_ID, @DRUG_AMT, @TREAT_AMT, @TREAT_CODE, @DIAG_AMT, @DSVC_NO, @DSVC_AMT, @BY_PASS_CODE, @T_AMT, @PART_AMT, @T_APPL_AMT, @ID_SEX)";
            System.Data.IDbCommand dbCommand = new System.Data.OleDb.OleDbCommand();
            dbCommand.CommandText = queryString;
            dbCommand.Connection = dbConnection;
 
            System.Data.IDataParameter dbParam_fEE_YM = new System.Data.OleDb.OleDbParameter();
            dbParam_fEE_YM.ParameterName = "@FEE_YM";
            dbParam_fEE_YM.Value = cd.FEE_YM;
            dbParam_fEE_YM.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_fEE_YM);
 
            System.Data.IDataParameter dbParam_aPPL_TYPE = new System.Data.OleDb.OleDbParameter();
            dbParam_aPPL_TYPE.ParameterName = "@APPL_TYPE";
            dbParam_aPPL_TYPE.Value = cd.APPL_TYPE;
            dbParam_aPPL_TYPE.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_aPPL_TYPE);
 
            System.Data.IDataParameter dbParam_hOSP_ID = new System.Data.OleDb.OleDbParameter();
            dbParam_hOSP_ID.ParameterName = "@HOSP_ID";
            dbParam_hOSP_ID.Value = cd.HOSP_ID;
            dbParam_hOSP_ID.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_hOSP_ID);
 
            System.Data.IDataParameter dbParam_aPPL_DATE = new System.Data.OleDb.OleDbParameter();
            dbParam_aPPL_DATE.ParameterName = "@APPL_DATE";
            dbParam_aPPL_DATE.Value = cd.APPL_DATE;
            dbParam_aPPL_DATE.DbType = System.Data.DbType.DateTime;
            dbCommand.Parameters.Add(dbParam_aPPL_DATE);
 
            System.Data.IDataParameter dbParam_cASE_TYPE = new System.Data.OleDb.OleDbParameter();
            dbParam_cASE_TYPE.ParameterName = "@CASE_TYPE";
            dbParam_cASE_TYPE.Value = cd.CASE_TYPE;
            dbParam_cASE_TYPE.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_cASE_TYPE);
 
            System.Data.IDataParameter dbParam_sEQ_NO = new System.Data.OleDb.OleDbParameter();
            dbParam_sEQ_NO.ParameterName = "@SEQ_NO";
            dbParam_sEQ_NO.Value = cd.SEQ_NO;
            dbParam_sEQ_NO.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_sEQ_NO);
 
            System.Data.IDataParameter dbParam_cURE_ITEM_NO1 = new System.Data.OleDb.OleDbParameter();
            dbParam_cURE_ITEM_NO1.ParameterName = "@CURE_ITEM_NO1";
            dbParam_cURE_ITEM_NO1.Value = cd.CURE_ITEM_NO1;
            dbParam_cURE_ITEM_NO1.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_cURE_ITEM_NO1);
 
            System.Data.IDataParameter dbParam_cURE_ITEM_NO2 = new System.Data.OleDb.OleDbParameter();
            dbParam_cURE_ITEM_NO2.ParameterName = "@CURE_ITEM_NO2";
            dbParam_cURE_ITEM_NO2.Value = cd.CURE_ITEM_NO2;
            dbParam_cURE_ITEM_NO2.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_cURE_ITEM_NO2);
 
            System.Data.IDataParameter dbParam_cURE_ITEM_NO3 = new System.Data.OleDb.OleDbParameter();
            dbParam_cURE_ITEM_NO3.ParameterName = "@CURE_ITEM_NO3";
            dbParam_cURE_ITEM_NO3.Value = cd.CURE_ITEM_NO3;
            dbParam_cURE_ITEM_NO3.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_cURE_ITEM_NO3);
 
            System.Data.IDataParameter dbParam_cURE_ITEM_NO4 = new System.Data.OleDb.OleDbParameter();
            dbParam_cURE_ITEM_NO4.ParameterName = "@CURE_ITEM_NO4";
            dbParam_cURE_ITEM_NO4.Value = cd.CURE_ITEM_NO4;
            dbParam_cURE_ITEM_NO4.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_cURE_ITEM_NO4);
 
            System.Data.IDataParameter dbParam_fUNC_TYPE = new System.Data.OleDb.OleDbParameter();
            dbParam_fUNC_TYPE.ParameterName = "@FUNC_TYPE";
            dbParam_fUNC_TYPE.Value = cd.FUNC_TYPE;
            dbParam_fUNC_TYPE.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_fUNC_TYPE);
 
            System.Data.IDataParameter dbParam_fUNC_DATE = new System.Data.OleDb.OleDbParameter();
            dbParam_fUNC_DATE.ParameterName = "@FUNC_DATE";
            dbParam_fUNC_DATE.Value = cd.FUNC_DATE;
            dbParam_fUNC_DATE.DbType = System.Data.DbType.DateTime;
            dbCommand.Parameters.Add(dbParam_fUNC_DATE);
 
            System.Data.IDataParameter dbParam_tREAT_END_DATE = new System.Data.OleDb.OleDbParameter();
            dbParam_tREAT_END_DATE.ParameterName = "@TREAT_END_DATE";
            dbParam_tREAT_END_DATE.Value = cd.TREAT_END_DATE;
            dbParam_tREAT_END_DATE.DbType = System.Data.DbType.DateTime;
            dbCommand.Parameters.Add(dbParam_tREAT_END_DATE);
 
            System.Data.IDataParameter dbParam_iD_BIRTHDAY = new System.Data.OleDb.OleDbParameter();
            dbParam_iD_BIRTHDAY.ParameterName = "@ID_BIRTHDAY";
            dbParam_iD_BIRTHDAY.Value = cd.ID_BIRTHDAY;
            dbParam_iD_BIRTHDAY.DbType = System.Data.DbType.DateTime;
            dbCommand.Parameters.Add(dbParam_iD_BIRTHDAY);
 
            System.Data.IDataParameter dbParam_iD = new System.Data.OleDb.OleDbParameter();
            dbParam_iD.ParameterName = "@ID";
            dbParam_iD.Value = cd.ID;
            dbParam_iD.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_iD);
 
            System.Data.IDataParameter dbParam_cARD_SEQ_NO = new System.Data.OleDb.OleDbParameter();
            dbParam_cARD_SEQ_NO.ParameterName = "@CARD_SEQ_NO";
            dbParam_cARD_SEQ_NO.Value = cd.CARD_SEQ_NO;
            dbParam_cARD_SEQ_NO.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_cARD_SEQ_NO);
 
            System.Data.IDataParameter dbParam_gAVE_KIND = new System.Data.OleDb.OleDbParameter();
            dbParam_gAVE_KIND.ParameterName = "@GAVE_KIND";
            dbParam_gAVE_KIND.Value = cd.GAVE_KIND;
            dbParam_gAVE_KIND.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_gAVE_KIND);
 
            System.Data.IDataParameter dbParam_pART_NO = new System.Data.OleDb.OleDbParameter();
            dbParam_pART_NO.ParameterName = "@PART_NO";
            dbParam_pART_NO.Value = cd.PART_NO;
            dbParam_pART_NO.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_pART_NO);
 
            System.Data.IDataParameter dbParam_aCODE_ICD9_1 = new System.Data.OleDb.OleDbParameter();
            dbParam_aCODE_ICD9_1.ParameterName = "@ACODE_ICD9_1";
            dbParam_aCODE_ICD9_1.Value = cd.ACODE_ICD9_1;
            dbParam_aCODE_ICD9_1.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_aCODE_ICD9_1);
 
            System.Data.IDataParameter dbParam_aCODE_ICD9_2 = new System.Data.OleDb.OleDbParameter();
            dbParam_aCODE_ICD9_2.ParameterName = "@ACODE_ICD9_2";
            dbParam_aCODE_ICD9_2.Value = cd.ACODE_ICD9_2;
            dbParam_aCODE_ICD9_2.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_aCODE_ICD9_2);
 
            System.Data.IDataParameter dbParam_aCODE_ICD9_3 = new System.Data.OleDb.OleDbParameter();
            dbParam_aCODE_ICD9_3.ParameterName = "@ACODE_ICD9_3";
            dbParam_aCODE_ICD9_3.Value = cd.ACODE_ICD9_3;
            dbParam_aCODE_ICD9_3.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_aCODE_ICD9_3);
 
            System.Data.IDataParameter dbParam_iCD_OP_CODE = new System.Data.OleDb.OleDbParameter();
            dbParam_iCD_OP_CODE.ParameterName = "@ICD_OP_CODE";
            dbParam_iCD_OP_CODE.Value = cd.ICD_OP_CODE;
            dbParam_iCD_OP_CODE.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_iCD_OP_CODE);
 
            System.Data.IDataParameter dbParam_dRUG_DAY = new System.Data.OleDb.OleDbParameter();
            dbParam_dRUG_DAY.ParameterName = "@DRUG_DAY";
            dbParam_dRUG_DAY.Value = cd.DRUG_DAY;
            dbParam_dRUG_DAY.DbType = System.Data.DbType.DateTime;
            dbCommand.Parameters.Add(dbParam_dRUG_DAY);
 
            System.Data.IDataParameter dbParam_mED_TYPE = new System.Data.OleDb.OleDbParameter();
            dbParam_mED_TYPE.ParameterName = "@MED_TYPE";
            dbParam_mED_TYPE.Value = cd.MED_TYPE;
            dbParam_mED_TYPE.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_mED_TYPE);
 
            System.Data.IDataParameter dbParam_pRSN_ID = new System.Data.OleDb.OleDbParameter();
            dbParam_pRSN_ID.ParameterName = "@PRSN_ID";
            dbParam_pRSN_ID.Value = cd.PRSN_ID;
            dbParam_pRSN_ID.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_pRSN_ID);
 
            System.Data.IDataParameter dbParam_pHAR_ID = new System.Data.OleDb.OleDbParameter();
            dbParam_pHAR_ID.ParameterName = "@PHAR_ID";
            dbParam_pHAR_ID.Value = cd.PHAR_ID;
            dbParam_pHAR_ID.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_pHAR_ID);
 
            System.Data.IDataParameter dbParam_dRUG_AMT = new System.Data.OleDb.OleDbParameter();
            dbParam_dRUG_AMT.ParameterName = "@DRUG_AMT";
            dbParam_dRUG_AMT.Value = cd.DRUG_AMT;
            dbParam_dRUG_AMT.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_dRUG_AMT);
 
            System.Data.IDataParameter dbParam_tREAT_AMT = new System.Data.OleDb.OleDbParameter();
            dbParam_tREAT_AMT.ParameterName = "@TREAT_AMT";
            dbParam_tREAT_AMT.Value = cd.TREAT_AMT;
            dbParam_tREAT_AMT.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_tREAT_AMT);
 
            System.Data.IDataParameter dbParam_tREAT_CODE = new System.Data.OleDb.OleDbParameter();
            dbParam_tREAT_CODE.ParameterName = "@TREAT_CODE";
            dbParam_tREAT_CODE.Value = cd.TREAT_CODE;
            dbParam_tREAT_CODE.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_tREAT_CODE);
 
            System.Data.IDataParameter dbParam_dIAG_AMT = new System.Data.OleDb.OleDbParameter();
            dbParam_dIAG_AMT.ParameterName = "@DIAG_AMT";
            dbParam_dIAG_AMT.Value = cd.DIAG_AMT;
            dbParam_dIAG_AMT.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_dIAG_AMT);
 
            System.Data.IDataParameter dbParam_dSVC_NO = new System.Data.OleDb.OleDbParameter();
            dbParam_dSVC_NO.ParameterName = "@DSVC_NO";
            dbParam_dSVC_NO.Value = cd.DSVC_NO;
            dbParam_dSVC_NO.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_dSVC_NO);
 
            System.Data.IDataParameter dbParam_dSVC_AMT = new System.Data.OleDb.OleDbParameter();
            dbParam_dSVC_AMT.ParameterName = "@DSVC_AMT";
            dbParam_dSVC_AMT.Value = cd.DSVC_AMT;
            dbParam_dSVC_AMT.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_dSVC_AMT);
 
            System.Data.IDataParameter dbParam_bY_PASS_CODE = new System.Data.OleDb.OleDbParameter();
            dbParam_bY_PASS_CODE.ParameterName = "@BY_PASS_CODE";
            dbParam_bY_PASS_CODE.Value = cd.BY_PASS_CODE;
            dbParam_bY_PASS_CODE.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_bY_PASS_CODE);
 
            System.Data.IDataParameter dbParam_t_AMT = new System.Data.OleDb.OleDbParameter();
            dbParam_t_AMT.ParameterName = "@T_AMT";
            dbParam_t_AMT.Value = cd.T_AMT;
            dbParam_t_AMT.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_t_AMT);
 
            System.Data.IDataParameter dbParam_pART_AMT = new System.Data.OleDb.OleDbParameter();
            dbParam_pART_AMT.ParameterName = "@PART_AMT";
            dbParam_pART_AMT.Value = cd.PART_AMT;
            dbParam_pART_AMT.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_pART_AMT);
 
            System.Data.IDataParameter dbParam_t_APPL_AMT = new System.Data.OleDb.OleDbParameter();
            dbParam_t_APPL_AMT.ParameterName = "@T_APPL_AMT";
            dbParam_t_APPL_AMT.Value = cd.T_APPL_AMT;
            dbParam_t_APPL_AMT.DbType = System.Data.DbType.Int32;
            dbCommand.Parameters.Add(dbParam_t_APPL_AMT);
 
            System.Data.IDataParameter dbParam_iD_SEX = new System.Data.OleDb.OleDbParameter();
            dbParam_iD_SEX.ParameterName = "@ID_SEX";
            dbParam_iD_SEX.Value = cd.ID_SEX;
            dbParam_iD_SEX.DbType = System.Data.DbType.String;
            dbCommand.Parameters.Add(dbParam_iD_SEX);
 
            int rowsAffected = 0;
            dbConnection.Open();
            try
            {
                rowsAffected = dbCommand.ExecuteNonQuery();
            }
            finally
            {
                dbConnection.Close();
            }
 
            return rowsAffected;
 
        }

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

11
十二月

醫學資訊管理上課 12/10 健保資料庫

   Posted by: admin Tags: , ,

1210mim

NHIRD原始資料讀取

NHIRD原始資料讀取

 

資料結構NHIRD_CD/DBEntry_CD

資料結構NHIRD_CD/DBEntry_CD

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;
 
            label1.Text = openFileDialog1.FileName;
 
            StreamReader sr = new StreamReader(openFileDialog1.FileName);
            int linecount = 0;
            string line = sr.ReadLine();
            while (line != null && line.Length > 0)
            {
                NHIRD_CD cd = ParseCDLine(line);
                DBEntry_CD dbe_cd = new DBEntry_CD(cd);
 
                linecount++;
                line = sr.ReadLine();
            }
            sr.Close();
            label2.Text = "lines=" + linecount.ToString();
        }
        NHIRD_CD ParseCDLine(string line)
        {
            NHIRD_CD cd = new NHIRD_CD();
            if (line.Length == 299)
            {
                cd.FEE_YM = line.Substring(0, 6);
                cd.APPL_TYPE = line.Substring(6, 1);
                cd.HOSP_ID = line.Substring(7, 34);
                cd.APPL_DATE = line.Substring(41, 8);
                cd.CASE_TYPE = line.Substring(49, 2);
                cd.SEQ_NO = line.Substring(51, 6);
 
                cd.CURE_ITEM_NO1 = line.Substring(57, 2);
                cd.CURE_ITEM_NO2 = line.Substring(59, 2);
                cd.CURE_ITEM_NO3 = line.Substring(61, 2);
                cd.CURE_ITEM_NO4 = line.Substring(63, 2);
 
                cd.FUNC_TYPE = line.Substring(65, 2);
                cd.FUNC_DATE = line.Substring(67, 8);
                cd.TREAT_END_DATE = line.Substring(75, 8);
                cd.ID_BIRTHDAY = line.Substring(83, 8);
                cd.ID = line.Substring(91, 32);
 
                cd.CARD_SEQ_NO = line.Substring(123, 2);
                cd.GAVE_KIND = line.Substring(126, 1);
                cd.PART_NO = line.Substring(127, 3);
 
                cd.ACODE_ICD9_1 = line.Substring(130, 5).Trim();
                cd.ACODE_ICD9_2 = line.Substring(135, 5).Trim();
                cd.ACODE_ICD9_3 = line.Substring(140, 5).Trim();
 
                cd.ICD_OP_CODE = line.Substring(145, 4);
                cd.DRUG_DAY = line.Substring(149, 2);
 
                cd.MED_TYPE = line.Substring(151, 1);
                cd.PRSN_ID = line.Substring(152, 32);
                cd.PHAR_ID = line.Substring(184, 32);
 
                cd.DRUG_AMT = line.Substring(216, 8);
                cd.TREAT_AMT = line.Substring(224, 8);
                cd.TREAT_CODE = line.Substring(232, 12);
                cd.DIAG_AMT = line.Substring(244, 8);
 
                cd.DSVC_NO = line.Substring(252, 12).Trim();
                cd.DSVC_AMT = line.Substring(264, 8).Trim();
                cd.BY_PASS_CODE = line.Substring(272, 2).Trim();
                cd.T_AMT = line.Substring(274, 8).Trim();
                cd.PART_AMT = line.Substring(282, 8).Trim();
                cd.T_APPL_AMT = line.Substring(290, 8).Trim();
                cd.ID_SEX = line.Substring(298, 1);
            }
            else if (line.Length == 300)
            {
                int x = 1;
                cd.FEE_YM = line.Substring(0, 6);
                cd.APPL_TYPE = line.Substring(6, 1);
                cd.HOSP_ID = line.Substring(7, 34);
                cd.APPL_DATE = line.Substring(41, 8);
                cd.CASE_TYPE = line.Substring(49, 2);
                cd.SEQ_NO = line.Substring(51, 6);
 
                cd.CURE_ITEM_NO1 = line.Substring(57, 2);
                cd.CURE_ITEM_NO2 = line.Substring(59, 2);
                cd.CURE_ITEM_NO3 = line.Substring(61, 2);
                cd.CURE_ITEM_NO4 = line.Substring(63, 2);
 
                cd.FUNC_TYPE = line.Substring(65, 2);
                cd.FUNC_DATE = line.Substring(67, 8);
                cd.TREAT_END_DATE = line.Substring(75, 8);
                cd.ID_BIRTHDAY = line.Substring(83, 8);
                cd.ID = line.Substring(91, 32);
 
                cd.CARD_SEQ_NO = line.Substring(123, 4);//2->4
                cd.GAVE_KIND = line.Substring(126 + x, 1);
                cd.PART_NO = line.Substring(127 + x, 3);
 
                cd.ACODE_ICD9_1 = line.Substring(130 + x, 5).Trim();
                cd.ACODE_ICD9_2 = line.Substring(135 + x, 5).Trim();
                cd.ACODE_ICD9_3 = line.Substring(140 + x, 5).Trim();
 
                cd.ICD_OP_CODE = line.Substring(145 + x, 4);
                cd.DRUG_DAY = line.Substring(149 + x, 2);
 
                cd.MED_TYPE = line.Substring(151 + x, 1);
                cd.PRSN_ID = line.Substring(152 + x, 32);
                cd.PHAR_ID = line.Substring(184 + x, 32);
 
                cd.DRUG_AMT = line.Substring(216 + x, 8);
                cd.TREAT_AMT = line.Substring(224 + x, 8);
                cd.TREAT_CODE = line.Substring(232 + x, 12);
                cd.DIAG_AMT = line.Substring(244 + x, 8);
 
                cd.DSVC_NO = line.Substring(252 + x, 12).Trim();
                cd.DSVC_AMT = line.Substring(264 + x, 8).Trim();
                cd.BY_PASS_CODE = line.Substring(272 + x, 2).Trim();
                cd.T_AMT = line.Substring(274 + x, 8).Trim();
                cd.PART_AMT = line.Substring(282 + x, 8).Trim();
                cd.T_APPL_AMT = line.Substring(290 + x, 8).Trim();
                cd.ID_SEX = line.Substring(298 + x, 1);
            }
            return cd;
        }
==================================================
public class NHIRD_CD
    {
        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 CURE_ITEM_NO1;
        public string CURE_ITEM_NO2;
        public string CURE_ITEM_NO3;
        public string CURE_ITEM_NO4;
 
        public string FUNC_TYPE;
        public string FUNC_DATE;
        public string TREAT_END_DATE;
 
        public string ID_BIRTHDAY;
        public string ID;
 
        public string CARD_SEQ_NO;
        public string GAVE_KIND;
        public string PART_NO;
 
        public string ACODE_ICD9_1;
        public string ACODE_ICD9_2;
        public string ACODE_ICD9_3;
 
        public string ICD_OP_CODE;
        public string DRUG_DAY;
        public string MED_TYPE;
 
        public string PRSN_ID;
        public string PHAR_ID;
 
        public string DRUG_AMT;
        public string TREAT_AMT;
        public string TREAT_CODE;
        public string DIAG_AMT;
        public string DSVC_NO;
        public string DSVC_AMT;
        public string BY_PASS_CODE;
        public string T_AMT;
        public string PART_AMT;
        public string T_APPL_AMT;
        public string ID_SEX;
    }
    public class DBEntry_CD
    {
        public string FEE_YM;
        public string APPL_TYPE;
        public string HOSP_ID;
        public DateTime APPL_DATE;
        public string CASE_TYPE;
        public int SEQ_NO;
 
        public string CURE_ITEM_NO1;
        public string CURE_ITEM_NO2;
        public string CURE_ITEM_NO3;
        public string CURE_ITEM_NO4;
 
        public string FUNC_TYPE;
        public DateTime FUNC_DATE;
        public DateTime TREAT_END_DATE;
 
        public DateTime ID_BIRTHDAY;
        public string ID;
 
        public string CARD_SEQ_NO;
        public string GAVE_KIND;
        public string PART_NO;
 
        public string ACODE_ICD9_1;
        public string ACODE_ICD9_2;
        public string ACODE_ICD9_3;
 
        public string ICD_OP_CODE;
        public DateTime DRUG_DAY;
        public string MED_TYPE;
 
        public string PRSN_ID;
        public string PHAR_ID;
 
        public int DRUG_AMT;
        public int TREAT_AMT;
        public string TREAT_CODE;
        public int DIAG_AMT;
        public string DSVC_NO;
        public int DSVC_AMT;
        public string BY_PASS_CODE;
        public int T_AMT;
        public int PART_AMT;
        public int T_APPL_AMT;
        public string ID_SEX;
 
        public DBEntry_CD(NHIRD_CD rawCD)
        {
            FEE_YM = rawCD.FEE_YM;
            APPL_TYPE = rawCD.APPL_TYPE;
            HOSP_ID = rawCD.HOSP_ID;
            APPL_DATE = StrToDateTime(rawCD.APPL_DATE);
            CASE_TYPE = rawCD.CASE_TYPE;
            SEQ_NO = StrToInteger(rawCD.SEQ_NO);
 
            CURE_ITEM_NO1 = rawCD.CURE_ITEM_NO1;
            CURE_ITEM_NO2 = rawCD.CURE_ITEM_NO2;
            CURE_ITEM_NO3 = rawCD.CURE_ITEM_NO3;
            CURE_ITEM_NO4 = rawCD.CURE_ITEM_NO4;
 
            FUNC_TYPE = rawCD.FUNC_TYPE;
            FUNC_DATE = StrToDateTime(rawCD.FUNC_DATE);
            TREAT_END_DATE = StrToDateTime(rawCD.TREAT_END_DATE);
            ID_BIRTHDAY = StrToDateTime(rawCD.ID_BIRTHDAY);
            ID = rawCD.ID;
 
 
            CARD_SEQ_NO = rawCD.CARD_SEQ_NO;
            GAVE_KIND = rawCD.GAVE_KIND;
            PART_NO = rawCD.PART_NO;
            ACODE_ICD9_1 = rawCD.ACODE_ICD9_1;
            ACODE_ICD9_2 = rawCD.ACODE_ICD9_2;
            ACODE_ICD9_3 = rawCD.ACODE_ICD9_3;
            ICD_OP_CODE = rawCD.ICD_OP_CODE;
 
            DRUG_DAY = StrToDateTime(rawCD.DRUG_DAY);
 
            MED_TYPE = rawCD.MED_TYPE;
 
            PRSN_ID = rawCD.PRSN_ID;
            PHAR_ID = rawCD.PHAR_ID;
 
            DRUG_AMT = StrToInteger(rawCD.DRUG_AMT);
            TREAT_AMT = StrToInteger(rawCD.TREAT_AMT);
            TREAT_CODE = rawCD.TREAT_CODE;
 
            DIAG_AMT = StrToInteger(rawCD.DIAG_AMT);
            DSVC_NO = rawCD.DSVC_NO;
 
            DSVC_AMT = StrToInteger(rawCD.DSVC_AMT);
            BY_PASS_CODE = rawCD.BY_PASS_CODE;
 
            T_AMT = StrToInteger(rawCD.T_AMT);
            PART_AMT = StrToInteger(rawCD.PART_AMT);
            T_APPL_AMT = StrToInteger(rawCD.T_APPL_AMT);
            ID_SEX = rawCD.ID_SEX;
        }
        private DateTime StrToDateTime(string ss)
        {//YYYYMMDD
            DateTime dt = new DateTime(1911, 1, 1);
            if (ss.Length != 8)
                return dt;
 
            for (int i = 0; i < 8; i++)
            {
                if (!char.IsDigit(ss[i]))
                    return dt;
            }
 
            string yearStr = ss.Substring(0, 4);
 
            string monthStr = ss.Substring(4, 2);
            string dayStr = ss.Substring(6, 2);
            int year = int.Parse(yearStr);
            int month = int.Parse(monthStr);
            int day = int.Parse(dayStr);
            if (month > 12 || day > 31)
                return dt;
            return new DateTime(year, month, day);
        }
        private int StrToInteger(string ss)
        {
            return int.Parse(ss.Trim());
        }
    }

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

5
十一月

醫學資訊管理上課 10/29 門診醫令

   Posted by: admin Tags: , ,

1029mim

醫學資訊管理師考試時程

醫學資訊管理師考試時程

COPE醫令系統

COPE醫令系統

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark