示例#1
0
        public ActionResult CrearDxGralDeSalud(EDDxSalud dxSalud)
        {
            var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            if (usuarioActual == null)
            {
                ViewBag.Mensaje = "El usuario no ha iniciado sesión el sistema";
                return(RedirectToAction("Login", "Home"));
            }

            dxSalud.EDInfoAuditoria.IdentificacionUsuario = usuarioActual.Documento;
            dxSalud.EDInfoAuditoria.NombreUsuario         = usuarioActual.NombreUsuario;
            dxSalud.EDInfoAuditoria.NitEmpresa            = usuarioActual.NitEmpresa;
            dxSalud.EDInfoAuditoria.NombreEmpresa         = usuarioActual.RazonSocialEmpresa;
            ServiceClient.EliminarParametros();
            var result = ServiceClient.RealizarPeticionesPostJsonRestFul <EDDxSalud>(urlPlanificacion, CapacidadCrearDiagnostico, dxSalud);

            if (result.IdDxCondicionesDeSalud > 0)
            {
                return(RedirectToAction("HistoricoDxSedesPorAnio", new { idDxSalud = result.IdDxCondicionesDeSalud }));
            }
            List <Proceso> procesos = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);

            ViewBag.Procesos           = new SelectList(procesos, "Pk_Id_Proceso", "Descripcion_Proceso");
            ViewBag.Pk_Id_Sede         = new SelectList(sedeServicio.SedesPorEmpresa(usuarioActual.IdEmpresa), "Pk_Id_Sede", "Nombre_Sede");
            ViewBag.FK_Tipo_De_Peligro = new SelectList(db.Tbl_Tipo_De_Peligro, "PK_Tipo_De_Peligro", "Descripcion_Del_Peligro");
            ViewBag.vigencia           = new SelectList(recursosServicios.ObtenerPeriodosAnios(anioIncial, anioFinal), "Text", "Value", DateTime.Now.Year);
            return(View());
        }
示例#2
0
        public HttpResponseMessage GrabarDiagnostico(EDDxSalud Diagnostico)
        {
            try
            {
                var logica    = new LNDxGralCondicionesDeSalud();
                var resultado = logica.GuardarDxSalud(Diagnostico);
                if (resultado != null)
                {
                    var response = Request.CreateResponse <EDDxSalud>(HttpStatusCode.Created, resultado);

                    return(response);
                }
                else
                {
                    var response = Request.CreateResponse(HttpStatusCode.ExpectationFailed);
                    return(response);
                }
            }
            catch (Exception ex)
            {
                var response = Request.CreateResponse(HttpStatusCode.InternalServerError);
                return(response);
            }
        }
        public EDDxSalud GuardarDxSalud(EDDxSalud Diagnostico)
        {
            using (SG_SSTContext context = new SG_SSTContext())
            {
                using (var transaction = context.Database.BeginTransaction())
                {
                    RegistraLog registraLog = new RegistraLog();
                    try
                    {
                        DxCondicionesDeSalud dxGeneral = new DxCondicionesDeSalud
                        {
                            Fecha_Dx                = Diagnostico.FechaCreacionDiagnostico,
                            Lugar                   = Diagnostico.ZonaLugar,
                            Trabajadores_Lugar      = Diagnostico.NumeroTrabajadoresLugar,
                            Fecha_Inicial_Dx        = Diagnostico.Fecha_Inicial_Dx,
                            Fecha_Final_Dx          = Diagnostico.Fecha_Final_Dx,
                            Responsable_informacion = Diagnostico.Responsable_informacion,
                            Profesion_Responsable   = Diagnostico.Profesion_Responsable,
                            Tarjeta_Profesional     = Diagnostico.Tarjeta_Profesional,
                            FK_Sede                 = Diagnostico.Pk_Id_Sede,
                            FK_Proceso              = Diagnostico.Procesos,
                            vigencia                = Diagnostico.vigencia,
                            SintomatologiaDx        = Diagnostico.EDSintomatologiaDx.Select(sintomatologia => new SintomatologiaDx
                            {
                                Sintomatologia = sintomatologia.Sintomatologia,
                                Trabajadores_Sintomatologia = sintomatologia.Trabajadores_Sintomatologia,
                            }).ToList(),
                            PruebasClinicasDx = Diagnostico.EDPruebasClinicasDx.Select(pruebas => new PruebasClinicasDx
                            {
                                Prueba_Clinica          = pruebas.Prueba_Clinica,
                                Trabajadores_Con_Prueba = pruebas.Trabajadores_Con_Prueba
                            }).ToList(),
                            PruebasPClinicasDx = Diagnostico.EDPruebasPClinicasDx.Select(pruebas => new PruebasPClinicasDx
                            {
                                Prueba_P_Clinica          = pruebas.Prueba_P_Clinica,
                                Trabajadores_Con_Prueba_P = pruebas.Trabajadores_Con_Prueba_P
                            }).ToList(),
                            DiagnosticoCie10Dx = Diagnostico.EDDiagnosticoCie10Dx.Select(dxcie10 => new DiagnosticoCie10Dx
                            {
                                Trabajadores_Con_Diagnostico = dxcie10.NumeroTrabajadoresConDiagnostico,
                                FK_Diagnostico = dxcie10.IdDiagnostico
                            }).ToList(),
                            ClasificacionPeligroDx = Diagnostico.EDClasificacionPeligroDx.Select(clasDX => new ClasificacionPeligroDx
                            {
                                FK_Clasificacion_De_Peligro = clasDX.idClasifiacionPeligro
                            }).ToList(),
                        };

                        context.Tbl_Dx_Condiciones_De_Salud.Add(dxGeneral);
                        context.SaveChanges();
                        if (context.Tbl_ActivaAuditoriaSistema.ToList().FirstOrDefault().EsActivaPlanificacion)
                        {
                            context.Tbl_AuditoriaPlanificacionSistema.Add(auditoriaSistema.ObtenerAuditoriaPlanificacion(Diagnostico.EDInfoAuditoria,
                                                                                                                         Enumeraciones.EnumAuditoriaSistema.Acciones.CREACION,
                                                                                                                         Enumeraciones.EnumAuditoriaSistema.Modulos.Planificacion,
                                                                                                                         Enumeraciones.EnumAuditoriaSistema.SubModulos.Dx_Gral_condiciones_de_salud,
                                                                                                                         Enumeraciones.EnumAuditoriaSistema.Opciones.Crear_Dx_General_de_Condiciones_de_salud,
                                                                                                                         dxGeneral.ToString()));
                            context.SaveChanges();
                        }

                        transaction.Commit();
                        Diagnostico.IdDxCondicionesDeSalud = dxGeneral.Pk_DxCondicionesDeSalud;
                        return(Diagnostico);
                    }
                    catch (Exception ex)
                    {
                        registraLog.RegistrarError(typeof(DxGralCondicionesDeSaludManager), string.Format("Error al guardar  el  dx en la base de datos  {0}: {1}", DateTime.Now, ex.StackTrace), ex);
                        transaction.Rollback();
                        return(Diagnostico);
                    }
                }
            }
        }
示例#4
0
        public byte[] DescargarHistoricoSedeAnio(int idDxSalud)
        {
            ExcelPackage excel = new ExcelPackage();

            excel.Workbook.Worksheets.Add("Diagnostico");
            ExcelWorksheet hoja1 = excel.Workbook.Worksheets[1];

            hoja1.Cells["A1"].Value = "Nit de La empresa";
            hoja1.Cells["B1"].Value = "Razón Social";
            hoja1.Cells["C1"].Value = "Fecha inicial del período de Evaluación Médica Ocupacional/Autoreporte CS/PVE";
            hoja1.Cells["D1"].Value = "Fecha final del período de Evaluación Médica Ocupacional/Autoreporte CS/PVE";
            hoja1.Cells["E1"].Value = "Vigencia del Diagnóstico";
            hoja1.Cells["F1"].Value = "Sede";
            hoja1.Cells["G1"].Value = "Municipio de la sede";
            hoja1.Cells["H1"].Value = "Departamento de la sede";
            hoja1.Cells["I1"].Value = "Zona o Lugar";
            hoja1.Cells["J1"].Value = "Proceso";
            hoja1.Cells["K1"].Value = "Total de Trabajadores de la zona o lugar";

            hoja1.Cells["L1"].Value = "Clasificación del Peligro";
            hoja1.Cells["M1"].Value = "Descripción del Peligro";

            hoja1.Cells["N1"].Value = "Sintomatología";
            hoja1.Cells["O1"].Value = "Nº Trabajadores con la sintomatología";
            hoja1.Cells["P1"].Value = "% Anormalidad";

            hoja1.Cells["Q1"].Value = "Prueba Clínica";
            hoja1.Cells["R1"].Value = "Nº Trabajadores con prueba clínica anormal";
            hoja1.Cells["S1"].Value = "% Anormalidad";

            hoja1.Cells["T1"].Value = "Prueba P_Clínica";
            hoja1.Cells["U1"].Value = "Nº Trabajadores con prueba P_clínica anormal";
            hoja1.Cells["V1"].Value = "% Anormalidad";

            hoja1.Cells["W1"].Value = "Diagnóstico CIE10";
            hoja1.Cells["X1"].Value = "Nº Trabajadores con prueba clínica anormal";
            hoja1.Cells["Y1"].Value = "% Anormalidad";

            hoja1.Cells["Z1"].Value  = "Responsable de la Información";
            hoja1.Cells["AA1"].Value = "Profesión del responsable de la información";
            hoja1.Cells["AB1"].Value = "Tarjeta profesional del responsable de la Información";


            int col = 1;

            foreach (var cel in hoja1.Cells["A1:AB1"])
            {
                cel.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
                cel.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
                cel.Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                cel.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                cel.Style.Font.Bold           = true;
                cel.Style.WrapText            = true;
                hoja1.Column(col).Width       = 25;
                col++;
            }
            List <EDDxSalud> historicosSedeAnio = DxGralCondicionesDeSalud.ObtenerHistoricoDxDeSedePorAnio(idDxSalud);
            EDDxSalud        eddxsalud          = historicosSedeAnio.FirstOrDefault();

            hoja1.Cells[string.Format("A{0}", 2)].Value = eddxsalud.nitEmpresa;
            hoja1.Cells[string.Format("B{0}", 2)].Value = eddxsalud.nombreEmpresa;
            hoja1.Cells[string.Format("C{0}", 2)].Value = eddxsalud.Fecha_Inicial_Dx.ToString(("dd-MM-yyyy"));
            hoja1.Cells[string.Format("D{0}", 2)].Value = eddxsalud.Fecha_Final_Dx.ToString(("dd-MM-yyyy"));
            hoja1.Cells[string.Format("E{0}", 2)].Value = eddxsalud.vigencia;
            hoja1.Cells[string.Format("F{0}", 2)].Value = eddxsalud.NombreSede;
            hoja1.Cells[string.Format("G{0}", 2)].Value = eddxsalud.NombreMunicipio;
            hoja1.Cells[string.Format("H{0}", 2)].Value = eddxsalud.NombreDepartamento;
            hoja1.Cells[string.Format("I{0}", 2)].Value = eddxsalud.ZonaLugar;
            hoja1.Cells[string.Format("J{0}", 2)].Value = eddxsalud.nombreProceso;
            hoja1.Cells[string.Format("K{0}", 2)].Value = eddxsalud.NumeroTrabajadoresLugar;

            hoja1.Cells[string.Format("Z{0}", 2)].Value  = eddxsalud.Responsable_informacion;
            hoja1.Cells[string.Format("AA{0}", 2)].Value = eddxsalud.Profesion_Responsable;
            hoja1.Cells[string.Format("AB{0}", 2)].Value = eddxsalud.Tarjeta_Profesional;

            int nunInicial = 2;

            foreach (var dx in eddxsalud.EDClasificacionPeligroDx)
            {
                hoja1.Cells[string.Format("L{0}", nunInicial)].Value = dx.nombreTipoPeligro;
                hoja1.Cells[string.Format("M{0}", nunInicial)].Value = dx.nombreDescripcion;
                nunInicial++;
            }
            nunInicial = 2;
            foreach (var dx in eddxsalud.EDSintomatologiaDx)
            {
                hoja1.Cells[string.Format("N{0}", nunInicial)].Value = dx.Sintomatologia;
                hoja1.Cells[string.Format("O{0}", nunInicial)].Value = dx.Trabajadores_Sintomatologia;
                hoja1.Cells[string.Format("P{0}", nunInicial)].Value = dx.porcentajeSintomatologia;
                nunInicial++;
            }
            nunInicial = 2;
            foreach (var dx in eddxsalud.EDPruebasClinicasDx)
            {
                hoja1.Cells[string.Format("Q{0}", nunInicial)].Value = dx.Prueba_Clinica;
                hoja1.Cells[string.Format("R{0}", nunInicial)].Value = dx.Trabajadores_Con_Prueba;
                hoja1.Cells[string.Format("S{0}", nunInicial)].Value = dx.porcentajePrueba;
                nunInicial++;
            }
            nunInicial = 2;
            foreach (var dx in eddxsalud.EDPruebasPClinicasDx)
            {
                hoja1.Cells[string.Format("T{0}", nunInicial)].Value = dx.Prueba_P_Clinica;
                hoja1.Cells[string.Format("U{0}", nunInicial)].Value = dx.Trabajadores_Con_Prueba_P;
                hoja1.Cells[string.Format("V{0}", nunInicial)].Value = dx.porcentajePruebaP;
                nunInicial++;
            }
            nunInicial = 2;
            foreach (var dx in eddxsalud.EDDiagnosticoCie10Dx)
            {
                hoja1.Cells[string.Format("W{0}", nunInicial)].Value = dx.NombreDiagnosticoCIE10;
                hoja1.Cells[string.Format("X{0}", nunInicial)].Value = dx.NumeroTrabajadoresConDiagnostico;
                hoja1.Cells[string.Format("Y{0}", nunInicial)].Value = dx.porcentajeDiagnostico;
                nunInicial++;
            }
            return(excel.GetAsByteArray());
        }
示例#5
0
 public EDDxSalud GuardarDxSalud(EDDxSalud Diagnostico)
 {
     return(DxGralCondicionesDeSalud.GuardarDxSalud(Diagnostico));
 }
示例#6
0
        private EDCarguePerfil ProcesarCargue(ExcelWorksheet sheet, EDCarguePerfil cargue)
        {
            EDCarguePerfil   edCargue               = new EDCarguePerfil();
            List <EDDxSalud> diagnosticos           = new List <EDDxSalud>();
            bool             resu                   = false;
            bool             esValidoDx             = true;
            bool             noBlancos              = true;
            string           nFilaBla               = "";
            string           nFilaS                 = "";
            string           nfilaP                 = "";
            string           nfilaT                 = "";
            string           nFilaPV                = "";
            string           nfilaRPel              = "";
            string           nfilaV                 = "";
            string           nFilaFr                = "";
            string           nFilaNit               = "";
            string           nFilaRango             = "";
            string           nFilaCodDiag           = "";
            string           mensajePlantillaVacia  = "La plantilla ingresada no tiene datos";
            string           mensajeTamano          = "El número de trabajadores no puede ser superior al total de trabajadores de la zona o lugar, revisar la(s) fila(s):";
            string           mensajeRangoFecha      = "La fecha final no puede ser menor que la fecha inicial, revisar la(s) fila(s):";
            string           mensajeNitEmpresa      = "El Nit ingresado no es válido, revisar la(s) fila(s):";
            string           mensajesFechas         = "Las fechas final e inicial no pueden ser mayores a la fecha actual, revisar la(s) fila(s):";
            string           mensajeVigencia        = "La vigencia seleccionada no puede ser superior al año actual, revisar la(s) fila(s):";
            string           mensajeSede            = "Revisar la  Columna  E(Código de la Sede) ya que la sede no pertenece a la empresa, revisar la(s) fila(s):";
            string           mensajeEspBlancos      = "Existen campos en blanco, es obligatorio diligenciar  por lo menos un registro de cada grupo, los otros campos son obligatorios exceptuado G (Código del Proceso) , revisar la(s) fila(s):";
            string           mensajeProceso         = "Revisar la  Columna  G (Código del Proceso) ya que el proceso no pertenece a la empresa, revisar la(s) fila(s):";
            string           mensajeCodDiagnostico  = "El código de diagnóstico ingresado no es válido, revisar la(s) fila(s):";
            string           mensajeDescPeligros    = "Revisar las descripciones de peligro, ya que se ha  ingresado una descripción no valida, revisar la(s) fila(s)";
            bool             esValidoDescripcionPel = true;
            bool             esValidoTrabajadores   = true;
            string           mensaje                = "";


            try
            {
                var dt     = new DataTable();
                var rowCnt = 0;

                rowCnt = sheet.Dimension.End.Row;



                //Verificamos los nombres de las columnas
                // Loop through Columns
                List <EDProceso> procesos = per.ObtenerProcesoEmpresa(cargue.NitEmpresa);
                List <EDSede>    sedes    = em.ObtenernerSedesPorEmpresa(cargue.NitEmpresa);
                for (var fila = 2; fila <= rowCnt; fila++)
                {
                    esValidoTrabajadores   = true;
                    esValidoDescripcionPel = true;
                    List <EDClasificacionPeligroDx> peligros            = new List <EDClasificacionPeligroDx>();
                    List <EDSintomatologiaDx>       sintomologias       = new List <EDSintomatologiaDx>();
                    List <EDPruebasClinicasDx>      pruebasClinicas     = new List <EDPruebasClinicasDx>();
                    List <EDPruebasPClinicasDx>     pruebasParaClinicas = new List <EDPruebasPClinicasDx>();
                    List <EDDiagnosticoCie10Dx>     diagnosticosCie     = new List <EDDiagnosticoCie10Dx>();

                    EDDxSalud diagnostico = new EDDxSalud();

                    //g string NumeroIdentificacion = sheet.Cells[fila, 1].Value.ToString();
                    if (sheet.Cells[fila, 1].Value != null)
                    {
                        if (sheet.Cells[fila, 1].Value == null || sheet.Cells[fila, 2].Value == null || sheet.Cells[fila, 3].Value == null ||
                            sheet.Cells[fila, 4].Value == null || sheet.Cells[fila, 5].Value == null || sheet.Cells[fila, 6].Value == null ||
                            sheet.Cells[fila, 8].Value == null || sheet.Cells[fila, 9].Value == null ||
                            sheet.Cells[fila, 10].Value == null

                            || sheet.Cells[fila, 19].Value == null || sheet.Cells[fila, 20].Value == null ||
                            sheet.Cells[fila, 29].Value == null || sheet.Cells[fila, 30].Value == null ||
                            sheet.Cells[fila, 39].Value == null || sheet.Cells[fila, 40].Value == null ||
                            sheet.Cells[fila, 49].Value == null || sheet.Cells[fila, 50].Value == null || sheet.Cells[fila, 51].Value == null ||
                            sheet.Cells[fila, 64].Value == null || sheet.Cells[fila, 65].Value == null || sheet.Cells[fila, 66].Value == null

                            )
                        {
                            nFilaBla  += " " + fila;
                            esValidoDx = false;
                            noBlancos  = false;
                        }

                        if (noBlancos)
                        {
                            int?codProceso = null;

                            //   DateTime Fecha_Inicial_Dx = Convert.ToDateTime(sheet.Cells[fila, 2].Value.ToString());

                            // DateTime Fecha_Final_Dx = Convert.ToDateTime(sheet.Cells[fila, 3].Value.ToString());

                            DateTime Fecha_Inicial_Dx = DateTime.FromOADate(double.Parse(sheet.Cells[fila, 196].Value.ToString()));
                            DateTime Fecha_Final_Dx   = DateTime.FromOADate(double.Parse(sheet.Cells[fila, 197].Value.ToString()));



                            DateTime FechaDx    = DateTime.Now;
                            var      vigencia   = int.Parse(sheet.Cells[fila, 4].Value.ToString());
                            var      anyoActual = DateTime.Now.Year;
                            var      vigencia2  = 0;
                            if (vigencia <= anyoActual)
                            {
                                vigencia2 = int.Parse(sheet.Cells[fila, 4].Value.ToString());
                            }
                            else
                            {
                                nfilaV    += " " + fila;
                                esValidoDx = false;
                            }

                            if (Fecha_Inicial_Dx > DateTime.Now || Fecha_Final_Dx > DateTime.Now)
                            {
                                nFilaFr   += " " + fila;
                                esValidoDx = false;
                            }


                            if (Fecha_Inicial_Dx > Fecha_Final_Dx)
                            {
                                nFilaRango += " " + fila;
                                esValidoDx  = false;
                            }

                            var sede = int.Parse(sheet.Cells[fila, 5].Value.ToString());
                            var zona = sheet.Cells[fila, 6].Value.ToString();

                            var totalTraZonaLugar      = int.Parse(sheet.Cells[fila, 8].Value.ToString());
                            var responsableInformacion = sheet.Cells[fila, 64].Value.ToString();
                            var Profesion_Responsable  = sheet.Cells[fila, 65].Value.ToString();
                            var Tarjeta_Profesional    = sheet.Cells[fila, 66].Value.ToString();
                            var nitEmpresa             = sheet.Cells[fila, 1].Value.ToString();

                            if (sheet.Cells[fila, 7].Value != null)
                            {
                                codProceso = int.Parse(sheet.Cells[fila, 7].Value.ToString());
                            }

                            if (!nitEmpresa.Equals(cargue.NitEmpresa))
                            {
                                nFilaNit  += " " + fila;
                                esValidoDx = false;
                            }

                            EDClasificacionPeligroDx clasificacinPeligroA = new EDClasificacionPeligroDx();

                            if (sheet.Cells[fila, 9].Value != null && sheet.Cells[fila, 10].Value != null)
                            {
                                if (sheet.Cells[fila, 186].Value != "")
                                {
                                    clasificacinPeligroA.idClasifiacionPeligro = int.Parse(sheet.Cells[fila, 186].Value.ToString());
                                    peligros.Add(clasificacinPeligroA);
                                }
                                else
                                {
                                    // nfilaRPel += " " + fila;
                                    esValidoDescripcionPel = false;
                                    esValidoDx             = false;
                                }
                            }

                            EDClasificacionPeligroDx clasificacinPeligroB = new EDClasificacionPeligroDx();

                            if (sheet.Cells[fila, 11].Value != null && sheet.Cells[fila, 12].Value != null)
                            {
                                if (sheet.Cells[fila, 187].Value != "")
                                {
                                    clasificacinPeligroB.idClasifiacionPeligro = int.Parse(sheet.Cells[fila, 187].Value.ToString());
                                    peligros.Add(clasificacinPeligroB);
                                }
                                else
                                {
                                    //  nfilaRPel += " " + fila;
                                    esValidoDescripcionPel = false;
                                    esValidoDx             = false;
                                }
                            }

                            EDClasificacionPeligroDx clasificacinPeligroC = new EDClasificacionPeligroDx();

                            if (sheet.Cells[fila, 13].Value != null && sheet.Cells[fila, 14].Value != null)
                            {
                                if (sheet.Cells[fila, 188].Value != "")
                                {
                                    clasificacinPeligroC.idClasifiacionPeligro = int.Parse(sheet.Cells[fila, 188].Value.ToString());
                                    peligros.Add(clasificacinPeligroC);
                                }
                                else
                                {
                                    // nfilaRPel += " " + fila;
                                    esValidoDescripcionPel = false;
                                    esValidoDx             = false;
                                }
                            }



                            EDClasificacionPeligroDx clasificacinPeligroD = new EDClasificacionPeligroDx();

                            if (sheet.Cells[fila, 15].Value != null && sheet.Cells[fila, 16].Value != null)
                            {
                                if (sheet.Cells[fila, 189].Value != "")
                                {
                                    clasificacinPeligroD.idClasifiacionPeligro = int.Parse(sheet.Cells[fila, 189].Value.ToString());
                                    peligros.Add(clasificacinPeligroD);
                                }
                                else
                                {
                                    // nfilaRPel += " " + fila;
                                    esValidoDescripcionPel = false;
                                    esValidoDx             = false;
                                }
                            }

                            EDClasificacionPeligroDx clasificacinPeligroE = new EDClasificacionPeligroDx();

                            if (sheet.Cells[fila, 17].Value != null && sheet.Cells[fila, 18].Value != null)
                            {
                                if (sheet.Cells[fila, 190].Value != "")
                                {
                                    clasificacinPeligroE.idClasifiacionPeligro = int.Parse(sheet.Cells[fila, 190].Value.ToString());
                                    peligros.Add(clasificacinPeligroE);
                                }
                                else
                                {
                                    //  nfilaRPel += " " + fila;
                                    esValidoDescripcionPel = false;
                                    esValidoDx             = false;
                                }
                            }

                            EDSintomatologiaDx sintomologiaA = new EDSintomatologiaDx();

                            if (sheet.Cells[fila, 19].Value != null && sheet.Cells[fila, 20].Value != null)
                            {
                                sintomologiaA.Trabajadores_Sintomatologia = int.Parse(sheet.Cells[fila, 20].Value.ToString());
                                sintomologiaA.Sintomatologia = sheet.Cells[fila, 19].Value.ToString();
                                if (sintomologiaA.Trabajadores_Sintomatologia <= totalTraZonaLugar)
                                {
                                    sintomologias.Add(sintomologiaA);
                                }
                                else
                                {
                                    // nfilaT += " " + fila;
                                    esValidoTrabajadores = false;
                                    esValidoDx           = false;
                                }
                            }

                            EDSintomatologiaDx sintomologiaB = new EDSintomatologiaDx();

                            if (sheet.Cells[fila, 21].Value != null && sheet.Cells[fila, 22].Value != null)
                            {
                                sintomologiaB.Sintomatologia = sheet.Cells[fila, 21].Value.ToString();
                                sintomologiaB.Trabajadores_Sintomatologia = int.Parse(sheet.Cells[fila, 22].Value.ToString());

                                if (sintomologiaB.Trabajadores_Sintomatologia <= totalTraZonaLugar)
                                {
                                    sintomologias.Add(sintomologiaB);
                                }
                                else
                                {
                                    //   nfilaT += " " + fila;

                                    esValidoTrabajadores = false;
                                    esValidoDx           = false;
                                }
                            }

                            EDSintomatologiaDx sintomologiaC = new EDSintomatologiaDx();

                            if (sheet.Cells[fila, 23].Value != null && sheet.Cells[fila, 24].Value != null)
                            {
                                sintomologiaC.Sintomatologia = sheet.Cells[fila, 23].Value.ToString();
                                sintomologiaC.Trabajadores_Sintomatologia = int.Parse(sheet.Cells[fila, 24].Value.ToString());


                                if (sintomologiaC.Trabajadores_Sintomatologia <= totalTraZonaLugar)
                                {
                                    sintomologias.Add(sintomologiaC);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }


                            EDSintomatologiaDx sintomologiaD = new EDSintomatologiaDx();

                            if (sheet.Cells[fila, 25].Value != null && sheet.Cells[fila, 26].Value != null)
                            {
                                sintomologiaD.Sintomatologia = sheet.Cells[fila, 25].Value.ToString();
                                sintomologiaD.Trabajadores_Sintomatologia = int.Parse(sheet.Cells[fila, 26].Value.ToString());
                                if (sintomologiaD.Trabajadores_Sintomatologia <= totalTraZonaLugar)
                                {
                                    sintomologias.Add(sintomologiaD);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    //  nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDSintomatologiaDx sintomologiaE = new EDSintomatologiaDx();

                            if (sheet.Cells[fila, 27].Value != null && sheet.Cells[fila, 28].Value != null)
                            {
                                sintomologiaE.Sintomatologia = sheet.Cells[fila, 27].Value.ToString();
                                sintomologiaE.Trabajadores_Sintomatologia = int.Parse(sheet.Cells[fila, 28].Value.ToString());
                                if (sintomologiaE.Trabajadores_Sintomatologia <= totalTraZonaLugar)
                                {
                                    sintomologias.Add(sintomologiaE);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    //nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }


                            EDPruebasClinicasDx pruebaClinicaA = new EDPruebasClinicasDx();
                            if (sheet.Cells[fila, 29].Value != null && sheet.Cells[fila, 30].Value != null)
                            {
                                pruebaClinicaA.Prueba_Clinica          = sheet.Cells[fila, 29].Value.ToString();
                                pruebaClinicaA.Trabajadores_Con_Prueba = int.Parse(sheet.Cells[fila, 30].Value.ToString());
                                if (pruebaClinicaA.Trabajadores_Con_Prueba <= totalTraZonaLugar)
                                {
                                    pruebasClinicas.Add(pruebaClinicaA);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }


                            EDPruebasClinicasDx pruebaClinicaB = new EDPruebasClinicasDx();
                            if (sheet.Cells[fila, 31].Value != null && sheet.Cells[fila, 32].Value != null)
                            {
                                pruebaClinicaB.Prueba_Clinica          = sheet.Cells[fila, 31].Value.ToString();
                                pruebaClinicaB.Trabajadores_Con_Prueba = int.Parse(sheet.Cells[fila, 32].Value.ToString());


                                if (pruebaClinicaB.Trabajadores_Con_Prueba <= totalTraZonaLugar)
                                {
                                    pruebasClinicas.Add(pruebaClinicaB);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDPruebasClinicasDx pruebaClinicaC = new EDPruebasClinicasDx();
                            if (sheet.Cells[fila, 33].Value != null && sheet.Cells[fila, 34].Value != null)
                            {
                                pruebaClinicaC.Prueba_Clinica          = sheet.Cells[fila, 33].Value.ToString();
                                pruebaClinicaC.Trabajadores_Con_Prueba = int.Parse(sheet.Cells[fila, 34].Value.ToString());
                                if (pruebaClinicaC.Trabajadores_Con_Prueba <= totalTraZonaLugar)
                                {
                                    pruebasClinicas.Add(pruebaClinicaC);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    //  nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDPruebasClinicasDx pruebaClinicaD = new EDPruebasClinicasDx();
                            if (sheet.Cells[fila, 35].Value != null && sheet.Cells[fila, 36].Value != null)
                            {
                                pruebaClinicaD.Prueba_Clinica          = sheet.Cells[fila, 35].Value.ToString();
                                pruebaClinicaD.Trabajadores_Con_Prueba = int.Parse(sheet.Cells[fila, 36].Value.ToString());
                                if (pruebaClinicaD.Trabajadores_Con_Prueba <= totalTraZonaLugar)
                                {
                                    pruebasClinicas.Add(pruebaClinicaD);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDPruebasClinicasDx pruebaClinicaE = new EDPruebasClinicasDx();
                            if (sheet.Cells[fila, 37].Value != null && sheet.Cells[fila, 38].Value != null)
                            {
                                pruebaClinicaE.Prueba_Clinica          = sheet.Cells[fila, 37].Value.ToString();
                                pruebaClinicaE.Trabajadores_Con_Prueba = int.Parse(sheet.Cells[fila, 38].Value.ToString());
                                if (pruebaClinicaE.Trabajadores_Con_Prueba <= totalTraZonaLugar)
                                {
                                    pruebasClinicas.Add(pruebaClinicaE);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }



                            EDPruebasPClinicasDx pruebaParaClinicaA = new EDPruebasPClinicasDx();

                            if (sheet.Cells[fila, 39].Value != null && sheet.Cells[fila, 40].Value != null)
                            {
                                pruebaParaClinicaA.Prueba_P_Clinica          = sheet.Cells[fila, 39].Value.ToString();
                                pruebaParaClinicaA.Trabajadores_Con_Prueba_P = int.Parse(sheet.Cells[fila, 40].Value.ToString());
                                if (pruebaParaClinicaA.Trabajadores_Con_Prueba_P <= totalTraZonaLugar)
                                {
                                    pruebasParaClinicas.Add(pruebaParaClinicaA);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDPruebasPClinicasDx pruebaParaClinicaB = new EDPruebasPClinicasDx();

                            if (sheet.Cells[fila, 41].Value != null && sheet.Cells[fila, 42].Value != null)
                            {
                                pruebaParaClinicaB.Prueba_P_Clinica          = sheet.Cells[fila, 41].Value.ToString();
                                pruebaParaClinicaB.Trabajadores_Con_Prueba_P = int.Parse(sheet.Cells[fila, 42].Value.ToString());
                                if (pruebaParaClinicaB.Trabajadores_Con_Prueba_P <= totalTraZonaLugar)
                                {
                                    pruebasParaClinicas.Add(pruebaParaClinicaB);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDPruebasPClinicasDx pruebaParaClinicaC = new EDPruebasPClinicasDx();

                            if (sheet.Cells[fila, 43].Value != null && sheet.Cells[fila, 44].Value != null)
                            {
                                pruebaParaClinicaC.Prueba_P_Clinica          = sheet.Cells[fila, 43].Value.ToString();
                                pruebaParaClinicaC.Trabajadores_Con_Prueba_P = int.Parse(sheet.Cells[fila, 44].Value.ToString());
                                if (pruebaParaClinicaC.Trabajadores_Con_Prueba_P <= totalTraZonaLugar)
                                {
                                    pruebasParaClinicas.Add(pruebaParaClinicaC);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    //  nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }


                            EDPruebasPClinicasDx pruebaParaClinicaD = new EDPruebasPClinicasDx();

                            if (sheet.Cells[fila, 45].Value != null && sheet.Cells[fila, 46].Value != null)
                            {
                                pruebaParaClinicaD.Prueba_P_Clinica          = sheet.Cells[fila, 45].Value.ToString();
                                pruebaParaClinicaD.Trabajadores_Con_Prueba_P = int.Parse(sheet.Cells[fila, 46].Value.ToString());
                                if (pruebaParaClinicaD.Trabajadores_Con_Prueba_P <= totalTraZonaLugar)
                                {
                                    pruebasParaClinicas.Add(pruebaParaClinicaD);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDPruebasPClinicasDx pruebaParaClinicaE = new EDPruebasPClinicasDx();

                            if (sheet.Cells[fila, 47].Value != null && sheet.Cells[fila, 48].Value != null)
                            {
                                pruebaParaClinicaE.Prueba_P_Clinica          = sheet.Cells[fila, 47].Value.ToString();
                                pruebaParaClinicaE.Trabajadores_Con_Prueba_P = int.Parse(sheet.Cells[fila, 48].Value.ToString());
                                pruebaParaClinicaD.Trabajadores_Con_Prueba_P = int.Parse(sheet.Cells[fila, 46].Value.ToString());
                                if (pruebaParaClinicaE.Trabajadores_Con_Prueba_P <= totalTraZonaLugar)
                                {
                                    pruebasParaClinicas.Add(pruebaParaClinicaE);
                                }
                                else
                                {
                                    esValidoTrabajadores = false;
                                    // nfilaT += " " + fila;
                                    esValidoDx = false;
                                }
                            }

                            EDDiagnosticoCie10Dx diagnosticoCIE100A = new EDDiagnosticoCie10Dx();

                            if (sheet.Cells[fila, 49].Value != null && sheet.Cells[fila, 51].Value != null)
                            {
                                var valDiagnostic = sheet.Cells[fila, 50].Value.ToString();
                                if (!valDiagnostic.Equals("NO ES VÁLIDO"))
                                {
                                    diagnosticoCIE100A.IdDiagnostico = int.Parse(sheet.Cells[fila, 191].Value.ToString());
                                    diagnosticoCIE100A.NumeroTrabajadoresConDiagnostico = int.Parse(sheet.Cells[fila, 51].Value.ToString());
                                    if (diagnosticoCIE100A.NumeroTrabajadoresConDiagnostico <= totalTraZonaLugar)
                                    {
                                        diagnosticosCie.Add(diagnosticoCIE100A);
                                    }
                                    else
                                    {
                                        esValidoTrabajadores = false;
                                        // nfilaT += " " + fila;
                                        esValidoDx = false;
                                    }
                                }
                                else
                                {
                                    nFilaCodDiag += " " + fila;
                                    esValidoDx    = false;
                                }
                            }

                            EDDiagnosticoCie10Dx diagnosticoCIE100B = new EDDiagnosticoCie10Dx();

                            if (sheet.Cells[fila, 52].Value != null && sheet.Cells[fila, 54].Value != null)
                            {
                                var valDiagnostic = sheet.Cells[fila, 53].Value.ToString();
                                if (!valDiagnostic.Equals("NO ES VÁLIDO"))
                                {
                                    diagnosticoCIE100B.IdDiagnostico = int.Parse(sheet.Cells[fila, 192].Value.ToString());
                                    diagnosticoCIE100B.NumeroTrabajadoresConDiagnostico = int.Parse(sheet.Cells[fila, 54].Value.ToString());

                                    if (diagnosticoCIE100B.NumeroTrabajadoresConDiagnostico <= totalTraZonaLugar)
                                    {
                                        diagnosticosCie.Add(diagnosticoCIE100B);
                                    }
                                    else
                                    {
                                        esValidoTrabajadores = false;
                                        // nfilaT += " " + fila;
                                        esValidoDx = false;
                                    }
                                }
                                else
                                {
                                    nFilaCodDiag += " " + fila;
                                    esValidoDx    = false;
                                }
                            }


                            EDDiagnosticoCie10Dx diagnosticoCIE100C = new EDDiagnosticoCie10Dx();

                            if (sheet.Cells[fila, 55].Value != null && sheet.Cells[fila, 57].Value != null)
                            {
                                var valDiagnostic = sheet.Cells[fila, 56].Value.ToString();
                                if (!valDiagnostic.Equals("NO ES VÁLIDO"))
                                {
                                    diagnosticoCIE100C.IdDiagnostico = int.Parse(sheet.Cells[fila, 193].Value.ToString());
                                    diagnosticoCIE100C.NumeroTrabajadoresConDiagnostico = int.Parse(sheet.Cells[fila, 57].Value.ToString());

                                    if (diagnosticoCIE100C.NumeroTrabajadoresConDiagnostico <= totalTraZonaLugar)
                                    {
                                        diagnosticosCie.Add(diagnosticoCIE100C);
                                    }
                                    else
                                    {
                                        //  nfilaT += " " + fila;
                                        esValidoTrabajadores = false;
                                        esValidoDx           = false;
                                    }
                                }
                                else
                                {
                                    nFilaCodDiag += " " + fila;
                                    esValidoDx    = false;
                                }
                            }

                            EDDiagnosticoCie10Dx diagnosticoCIE100D = new EDDiagnosticoCie10Dx();

                            if (sheet.Cells[fila, 58].Value != null && sheet.Cells[fila, 60].Value != null)
                            {
                                var valDiagnostic = sheet.Cells[fila, 59].Value.ToString();
                                if (!valDiagnostic.Equals("NO ES VÁLIDO"))
                                {
                                    diagnosticoCIE100D.IdDiagnostico = int.Parse(sheet.Cells[fila, 194].Value.ToString());
                                    diagnosticoCIE100D.NumeroTrabajadoresConDiagnostico = int.Parse(sheet.Cells[fila, 60].Value.ToString());
                                    if (diagnosticoCIE100D.NumeroTrabajadoresConDiagnostico <= totalTraZonaLugar)
                                    {
                                        diagnosticosCie.Add(diagnosticoCIE100D);
                                    }
                                    else
                                    {
                                        esValidoTrabajadores = false;
                                        // nfilaT += " " + fila;
                                        esValidoDx = false;
                                    }
                                }
                                else
                                {
                                    nFilaCodDiag += " " + fila;
                                    esValidoDx    = false;
                                }
                            }

                            EDDiagnosticoCie10Dx diagnosticoCIE100E = new EDDiagnosticoCie10Dx();

                            if (sheet.Cells[fila, 61].Value != null && sheet.Cells[fila, 63].Value != null)
                            {
                                var valDiagnostic = sheet.Cells[fila, 62].Value.ToString();
                                if (!valDiagnostic.Equals("NO ES VÁLIDO"))
                                {
                                    diagnosticoCIE100E.IdDiagnostico = int.Parse(sheet.Cells[fila, 195].Value.ToString());
                                    diagnosticoCIE100E.NumeroTrabajadoresConDiagnostico = int.Parse(sheet.Cells[fila, 63].Value.ToString());

                                    if (diagnosticoCIE100E.NumeroTrabajadoresConDiagnostico <= totalTraZonaLugar)
                                    {
                                        diagnosticosCie.Add(diagnosticoCIE100E);
                                    }
                                    else
                                    {
                                        esValidoTrabajadores = false;
                                        //  nfilaT += " " + fila;
                                        esValidoDx = false;
                                    }
                                }
                                else
                                {
                                    nFilaCodDiag += " " + fila;
                                    esValidoDx    = false;
                                }
                            }


                            if (!sedes.Exists(s => s.IdSede == sede))
                            {
                                nFilaS += " " + fila;

                                esValidoDx = false;
                            }


                            if (codProceso > 0)
                            {
                                if (!procesos.Exists(p => p.Id_Proceso == codProceso))
                                {
                                    nfilaP += " " + fila;

                                    esValidoDx = false;
                                }
                            }

                            if (esValidoTrabajadores == false)
                            {
                                nfilaT += " " + fila;
                            }

                            if (esValidoDescripcionPel == false)
                            {
                                nfilaRPel += " " + fila;
                            }

                            if (esValidoDx)
                            {
                                diagnostico.nitEmpresa               = nitEmpresa;
                                diagnostico.ZonaLugar                = zona;
                                diagnostico.Fecha_Inicial_Dx         = Fecha_Inicial_Dx;
                                diagnostico.Fecha_Final_Dx           = Fecha_Final_Dx;
                                diagnostico.vigencia                 = vigencia2;
                                diagnostico.Pk_Id_Sede               = sede;
                                diagnostico.Procesos                 = codProceso;
                                diagnostico.NumeroTrabajadoresLugar  = totalTraZonaLugar;
                                diagnostico.Responsable_informacion  = responsableInformacion;
                                diagnostico.Profesion_Responsable    = Profesion_Responsable;
                                diagnostico.Tarjeta_Profesional      = Tarjeta_Profesional;
                                diagnostico.EDClasificacionPeligroDx = peligros;
                                diagnostico.EDSintomatologiaDx       = sintomologias;
                                diagnostico.EDPruebasClinicasDx      = pruebasClinicas;
                                diagnostico.EDPruebasPClinicasDx     = pruebasParaClinicas;
                                diagnostico.EDDiagnosticoCie10Dx     = diagnosticosCie;
                                diagnostico.FechaCreacionDiagnostico = FechaDx;
                                diagnostico.EDInfoAuditoria          = cargue.EDInfoAuditoria;
                                diagnosticos.Add(diagnostico);
                            }
                        }
                    }
                    else
                    {
                        if (fila == 2)
                        {
                            nFilaPV   += "" + fila;
                            esValidoDx = false;
                        }
                        break;
                    }
                }


                //Listo aca va mensajes y resto


                if (nFilaPV.Equals(""))
                {
                    mensajePlantillaVacia = "";
                }
                else
                {
                    mensajePlantillaVacia += "\n";
                }


                if (nFilaBla.Equals(""))
                {
                    mensajeEspBlancos = "";
                }
                else
                {
                    mensajeEspBlancos += nFilaBla + "\n";
                }



                if (nFilaS.Equals(""))
                {
                    mensajeSede = "";
                }
                else
                {
                    mensajeSede += nFilaS + "\n";
                }

                if (nfilaP.Equals(""))
                {
                    mensajeProceso = "";
                }
                else
                {
                    mensajeProceso += nfilaP + "\n";
                }

                if (nfilaV.Equals(""))
                {
                    mensajeVigencia = "";
                }
                else
                {
                    mensajeVigencia += nfilaV + "\n";
                }


                if (nfilaT.Equals(""))
                {
                    mensajeTamano = "";
                }
                else
                {
                    mensajeTamano += nfilaT + "\n";
                }



                if (nFilaRango.Equals(""))
                {
                    mensajeRangoFecha = "";
                }
                else
                {
                    mensajeRangoFecha += nFilaRango + "\n";
                }

                if (nFilaFr.Equals(""))
                {
                    mensajesFechas = "";
                }
                else
                {
                    mensajesFechas += nFilaFr + "\n";
                }

                if (nFilaNit.Equals(""))
                {
                    mensajeNitEmpresa = "";
                }
                else
                {
                    mensajeNitEmpresa += nFilaNit + "\n";
                }

                if (nFilaCodDiag.Equals(""))
                {
                    mensajeCodDiagnostico = "";
                }
                else
                {
                    mensajeCodDiagnostico += nFilaCodDiag + "\n";
                }


                if (nfilaRPel.Equals(""))
                {
                    mensajeDescPeligros = "";
                }
                else
                {
                    mensajeDescPeligros += nfilaRPel + "\n";
                }


                mensaje = mensajePlantillaVacia + " " + mensajeEspBlancos + " " + mensajeSede + mensajeProceso + " " + mensajeVigencia + " " + mensajeTamano + " " + mensajeRangoFecha + " " + mensajesFechas + " " + mensajeNitEmpresa + " " + mensajeCodDiagnostico + " " + mensajeDescPeligros + " ";


                if (esValidoDx == false)
                {
                    edCargue.Message = mensaje;
                    return(edCargue);
                }


                if (esValidoDx == true)
                {
                    resu = dia.InsertarCargueMasivoDx(diagnosticos);
                }
                else
                {
                    edCargue.Message = "No se puede realizar la carga,revise e intente de nuevo";
                    return(edCargue);
                }

                if (resu)
                {
                    if (esValidoDx)
                    {
                        edCargue.Message = "OK";
                    }
                    else
                    {
                        edCargue.Message = mensaje;
                    }
                }
                else
                {
                    edCargue.Message = "El proceso de cargue falló";
                }
            }

            catch (Exception ex)
            {
                RegistraLog registraLog = new RegistraLog();
                registraLog.RegistrarError(typeof(LNCarguePerfilSocioDemografico), string.Format("Error en el método WorksheetToDataTable {0}: {1}", DateTime.Now, ex.StackTrace), ex);
                edCargue.Message = "El proceso falló: revise la información y por favor intentelo de nuevo.";
                return(edCargue);
            }

            return(edCargue);
        }