Ejemplo n.º 1
0
        private MemoryStream Sisq_ueh(int idMes, string mes, int año)
        {
            var bdEnti = bdBuilder.GetEntiCorporativa();
            RPT_SISQ_UEH_Result             resumen = bdEnti.RPT_SISQ_UEH(idMes, año).FirstOrDefault();
            List <RPT_SISQ_UEH_base_Result> datos   = bdEnti.RPT_SISQ_UEH_base(idMes, año).ToList();
            DataTable dt = CabeceraComges(BuildDataTable <RPT_SISQ_UEH_base_Result>(datos));

            dt.TableName = "b) Datos B.4_1.2";
            return(Sisq_uehDataSetToExcelXlsx(resumen, dt, mes));
        }
Ejemplo n.º 2
0
        private MemoryStream Sisq_uehDataSetToExcelXlsx(RPT_SISQ_UEH_Result resumen, DataTable dt, string mes)
        {
            System.Drawing.Color azulOscuro = System.Drawing.Color.FromArgb(34, 43, 53);
            System.Drawing.Color azulMedio  = System.Drawing.Color.FromArgb(68, 84, 106);
            System.Drawing.Color azulClaro  = System.Drawing.Color.FromArgb(217, 225, 242);

            MemoryStream   result = new MemoryStream();
            ExcelPackage   pack   = new ExcelPackage();
            ExcelWorksheet ws;

            ws = pack.Workbook.Worksheets.Add("a) B.4_1.2");

            ws.View.ShowGridLines = false;

            double correccion = 0.71;

            ws.Column(1).Width = 10.71 + correccion;
            ws.Column(2).Width = 36 + correccion;
            ws.Column(3).Width = 22 + correccion;

            ws.Row(4).Height = 33.75;
            ws.Row(5).Height = 45;

            using (ExcelRange rango = ws.Cells["B4:C4"])
            {
                rango.Merge = true;
                rango.Style.Fill.PatternType = ExcelFillStyle.Solid;
                rango.Value = "Porcentaje de Pacientes Atendidos dentro del estándar en Unidades de Emergencia Hospitalaria (B.4_1.2)";
                rango.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                rango.Style.Fill.BackgroundColor.SetColor(azulOscuro);
                rango.Style.Font.Color.SetColor(Color.White);
                rango.Style.WrapText  = true;
                rango.Style.Font.Bold = true;
            }

            ws.Cells["B5"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
            ws.Cells["B5"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["B5"].Style.Fill.BackgroundColor.SetColor(azulMedio);
            ws.Cells["B5"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["B5"].Style.WrapText  = true;
            ws.Cells["B5"].Style.Font.Bold = true;

            ws.Cells["C5"].Value = "Adulto + Pediátrico (no incluye gineco-obstetra y dental)";
            ws.Cells["C5"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
            ws.Cells["C5"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["C5"].Style.Fill.BackgroundColor.SetColor(azulMedio);
            ws.Cells["C5"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["C5"].Style.WrapText  = true;
            ws.Cells["C5"].Style.Font.Bold = true;

            ws.Cells["B6"].Value = "Pacientes con estadía <= 6 horas en UEH";
            ws.Cells["B6"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
            ws.Cells["B6"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["B6"].Style.Fill.BackgroundColor.SetColor(azulOscuro);
            ws.Cells["B6"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["B6"].Style.WrapText  = true;
            ws.Cells["B6"].Style.Font.Bold = true;

            ws.Cells["B7"].Value = "Total de atenciones";
            ws.Cells["B7"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
            ws.Cells["B7"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["B7"].Style.Fill.BackgroundColor.SetColor(azulOscuro);
            ws.Cells["B7"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["B7"].Style.WrapText  = true;
            ws.Cells["B7"].Style.Font.Bold = true;

            ws.Cells["B8"].Value = "% de cumplimiento";
            ws.Cells["B8"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
            ws.Cells["B8"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["B8"].Style.Fill.BackgroundColor.SetColor(azulOscuro);
            ws.Cells["B8"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["B8"].Style.WrapText  = true;
            ws.Cells["B8"].Style.Font.Bold = true;


            ws.Cells["C5"].Value = "Adulto + Pediátrico (no incluye gineco-obstetra y dental)";
            ws.Cells["C5"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
            ws.Cells["C5"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["C5"].Style.Fill.BackgroundColor.SetColor(azulMedio);
            ws.Cells["C5"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["C5"].Style.WrapText  = true;
            ws.Cells["C5"].Style.Font.Bold = true;

            ws.Cells["C6"].Value = resumen.menor_a_6H;
            ws.Cells["C6"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Right;
            ws.Cells["C6"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["C6"].Style.Fill.BackgroundColor.SetColor(Color.White);
            ws.Cells["C6"].Style.Font.Color.SetColor(Color.Black);
            ws.Cells["C6"].Style.WrapText = true;
            //ws.Cells["C6"].Style.Font.Bold = true;
            ws.Cells["C6"].Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C6"].Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C6"].Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C6"].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;

            ws.Cells["C7"].Value = resumen.total;
            ws.Cells["C7"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Right;
            ws.Cells["C7"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["C7"].Style.Fill.BackgroundColor.SetColor(Color.White);
            ws.Cells["C7"].Style.Font.Color.SetColor(Color.Black);
            ws.Cells["C7"].Style.WrapText = true;
            //ws.Cells["C7"].Style.Font.Bold = true;
            ws.Cells["C7"].Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C7"].Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C7"].Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C7"].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;

            ws.Cells["C8"].Value = resumen.Porcentaje;
            ws.Cells["C8"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Right;
            ws.Cells["C8"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["C8"].Style.Fill.BackgroundColor.SetColor(azulClaro);
            ws.Cells["C8"].Style.Font.Color.SetColor(Color.Black);
            ws.Cells["C8"].Style.Numberformat.Format = "#0\\.00%";
            ws.Cells["C8"].Style.WrapText            = true;
            ws.Cells["C8"].Style.Font.Bold           = true;
            ws.Cells["C8"].Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C8"].Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C8"].Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells["C8"].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;


            ws = pack.Workbook.Worksheets.Add(dt.TableName);
            ws.View.ShowGridLines = false;
            ws.Cells["A1"].LoadFromDataTable(dt, true);

            ws.Cells[ws.Dimension.Address].Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells[ws.Dimension.Address].Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells[ws.Dimension.Address].Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells[ws.Dimension.Address].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            ws.Cells[ws.Dimension.Address].AutoFitColumns();
            ws.Cells[ws.Dimension.Address].AutoFilter = true;

            ws.Row(1).Height = 46.25;


            ws.Cells["A1:G1"].Style.Fill.PatternType    = ExcelFillStyle.Solid;
            ws.Cells["A1:G1"].Style.Font.Bold           = true;
            ws.Cells["A1:G1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
            ws.Cells["A1:G1"].Style.Fill.BackgroundColor.SetColor(azulOscuro);
            ws.Cells["A1:G1"].Style.Font.Color.SetColor(Color.White);

            pack.SaveAs(result);
            return(result);
        }