Esempio n. 1
0
        private void btnLoadHdr_To_hdr_columns_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtHDRExcelPath.Text))
            {
                MessageBox.Show("请选择hdr模型描述excel文件");
                return;
            }
            if (!File.Exists(this.txtHDRExcelPath.Text))
            {
                MessageBox.Show("hdr模型描述excel文件不存在");
                return;
            }

            //string filePath = Path.Combine(basePath, @"..\HDR库表集合_V1.0.5-201908.xlsx");
            string filePath = this.txtHDRExcelPath.Text;

            var inputfilename = Path.GetFileNameWithoutExtension(this.txtHDRExcelPath.Text);



            Workbook workbook = null;

            using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                workbook = new Workbook(fs);
            }
            var worksheets = workbook.Worksheets;
            HdrExcelProcesser  hdrExcelProcesser = new HdrExcelProcesser();
            List <ExcelColumn> cols = new List <ExcelColumn>();


            var result = hdrExcelProcesser.ProcessSchemaMdm(worksheets);

            cols.AddRange(result);


            var result1 = hdrExcelProcesser.ProcessSchemaPatient(worksheets);

            cols.AddRange(result1);


            var result2 = hdrExcelProcesser.ProcessSchemaVisit(worksheets);

            cols.AddRange(result2);



            var result3 = hdrExcelProcesser.ProcessSchemaOrders(worksheets);

            cols.AddRange(result3);



            var result4 = hdrExcelProcesser.ProcessSchemaFee(worksheets);

            cols.AddRange(result4);

            var result5 = hdrExcelProcesser.ProcessSchemaDiag(worksheets);

            cols.AddRange(result5);

            var result6 = hdrExcelProcesser.ProcessSchemaAllergy(worksheets);

            cols.AddRange(result6);

            var result7 = hdrExcelProcesser.ProcessSchemaChecks(worksheets);

            cols.AddRange(result7);

            var result8 = hdrExcelProcesser.ProcessSchemaLab(worksheets);

            cols.AddRange(result8);


            var result9 = hdrExcelProcesser.ProcessSchemaOperation(worksheets);

            cols.AddRange(result9);


            var result10 = hdrExcelProcesser.ProcessSchemaNurse(worksheets);

            cols.AddRange(result10);

            var result11 = hdrExcelProcesser.ProcessSchemaCases(worksheets);

            cols.AddRange(result11);


            var result12 = hdrExcelProcesser.ProcessSchemaEmr(worksheets);

            cols.AddRange(result12);


            var result13 = hdrExcelProcesser.ProcessSchemaTumour(worksheets);

            cols.AddRange(result13);


            var result14 = hdrExcelProcesser.ProcessSchemaOther(worksheets);

            cols.AddRange(result14);


            var result15 = hdrExcelProcesser.ProcessSchemaReportcard(worksheets);

            cols.AddRange(result15);


            var result16 = hdrExcelProcesser.ProcessSchemaPhyexam(worksheets);

            cols.AddRange(result16);


            var result17 = hdrExcelProcesser.ProcessSchemaBiobank(worksheets);

            cols.AddRange(result17);


            var result18 = hdrExcelProcesser.ProcessSchemaNlp(worksheets);

            cols.AddRange(result18);


            var result19 = hdrExcelProcesser.ProcessSchemaEventflow(worksheets);

            cols.AddRange(result19);


            var result20 = hdrExcelProcesser.ProcessSchemaEtl(worksheets);

            cols.AddRange(result20);

            var result21 = hdrExcelProcesser.ProcessSchemaPublic(worksheets);

            cols.AddRange(result21);


            var result22 = hdrExcelProcesser.ProcessSchemaCure(worksheets);

            cols.AddRange(result22);



            string outfilePath = Path.Combine(basePath, $"{inputfilename}_hdrcolumns_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");

            Workbook wb = new Workbook();

            wb.Worksheets.Clear();

            Worksheet sheet1 = wb.Worksheets.Add("hdr_columns");

            sheet1.Cells.ImportCustomObjects(cols as ICollection, 0, 0, new ImportTableOptions {
            });

            wb.Save(outfilePath, SaveFormat.Xlsx);

            using (var conn = new PostgresHelper(dbConnectionString))
            {
                var bulkinserthelper = conn.BulkinsertHdrColumns(cols, false);
            }

            Process.Start("Explorer", "/select," + outfilePath);
        }
Esempio n. 2
0
        private void btnLoadHdr_v105_Click(object sender, EventArgs e)
        {
            string filePath = Path.Combine(basePath, @"..\HDR库表集合_V1.0.5-201908.xlsx");

            if (!File.Exists(filePath))
            {
                MessageBox.Show("文件不存在!");
                return;
            }
            Workbook workbook = null;

            using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                workbook = new Workbook(fs);
            }
            var worksheets = workbook.Worksheets;
            HdrExcelProcesser  hdrExcelProcesser = new HdrExcelProcesser();
            List <ExcelColumn> cols = new List <ExcelColumn>();


            var result = hdrExcelProcesser.ProcessSchemaMdm(worksheets);

            cols.AddRange(result);


            var result1 = hdrExcelProcesser.ProcessSchemaPatient(worksheets);

            cols.AddRange(result1);


            var result2 = hdrExcelProcesser.ProcessSchemaVisit(worksheets);

            cols.AddRange(result2);



            var result3 = hdrExcelProcesser.ProcessSchemaOrders(worksheets);

            cols.AddRange(result3);



            var result4 = hdrExcelProcesser.ProcessSchemaFee(worksheets);

            cols.AddRange(result4);



            var result5 = hdrExcelProcesser.ProcessSchemaDiag(worksheets);

            cols.AddRange(result5);


            var result6 = hdrExcelProcesser.ProcessSchemaAllergy(worksheets);

            cols.AddRange(result6);



            var result7 = hdrExcelProcesser.ProcessSchemaChecks(worksheets);

            cols.AddRange(result7);


            var result8 = hdrExcelProcesser.ProcessSchemaLab(worksheets);

            cols.AddRange(result8);


            var result9 = hdrExcelProcesser.ProcessSchemaOperation(worksheets);

            cols.AddRange(result9);


            var result10 = hdrExcelProcesser.ProcessSchemaNurse(worksheets);

            cols.AddRange(result10);

            var result11 = hdrExcelProcesser.ProcessSchemaCases(worksheets);

            cols.AddRange(result11);


            var result12 = hdrExcelProcesser.ProcessSchemaEmr(worksheets);

            cols.AddRange(result12);


            var result13 = hdrExcelProcesser.ProcessSchemaTumour(worksheets);

            cols.AddRange(result13);


            var result14 = hdrExcelProcesser.ProcessSchemaOther(worksheets);

            cols.AddRange(result14);


            var result15 = hdrExcelProcesser.ProcessSchemaReportcard(worksheets);

            cols.AddRange(result15);


            var result16 = hdrExcelProcesser.ProcessSchemaPhyexam(worksheets);

            cols.AddRange(result16);


            var result17 = hdrExcelProcesser.ProcessSchemaBiobank(worksheets);

            cols.AddRange(result17);


            var result18 = hdrExcelProcesser.ProcessSchemaNlp(worksheets);

            cols.AddRange(result18);


            var result19 = hdrExcelProcesser.ProcessSchemaEventflow(worksheets);

            cols.AddRange(result19);


            var result20 = hdrExcelProcesser.ProcessSchemaEtl(worksheets);

            cols.AddRange(result20);


            string outfilePath = Path.Combine(basePath, $"hdr_v105_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");

            Workbook wb = new Workbook();

            wb.Worksheets.Clear();

            Worksheet sheet1 = wb.Worksheets.Add("hdr_columns");

            sheet1.Cells.ImportCustomObjects(cols as ICollection, 0, 0, new ImportTableOptions {
            });

            wb.Save(outfilePath, SaveFormat.Xlsx);
        }