コード例 #1
0
ファイル: BhcDischarge.cs プロジェクト: ericraider33/pnyx.net
        private static void ccmNames()
        {
            using (Pnyx p = new Pnyx())
            {
                p.read("C:/dev/asclepius/prod_import/ccm_names.csv");
                p.parseCsv(hasHeader: true);
                p.rowTransformerFunc(row =>
                {
                    String lastName = row[1];
                    Tuple <String, String> lastNameSuffix = NameUtil.parseSuffix(lastName);

                    if (lastNameSuffix.Item2 == null)
                    {
                        return(null);
                    }

                    // Expands name into 2 columns
                    row = RowUtil.replaceColumn(row, 2, lastNameSuffix.Item1, lastNameSuffix.Item2);
                    return(row);
                });
                p.rowTransformerFunc(row =>
                {
                    for (int i = 0; i < row.Count; i++)
                    {
                        row[i] = TextUtil.encodeSqlValue(row[i]);
                    }
                    return(row);
                });
                p.print("update bhc_patient_ccm set lastname=$2, suffix=$3 where patientid=$1;");
                p.write("C:/dev/asclepius/prod_import/ccm_names_update.sql");
                p.process();
            }
        }