public ActionResult AgregarExamenes(int id)
        {
            var laboratorio = _laboratorioBl.GetLaboratorioById(id);
            var examenes    = _laboratorioExamenBl.GetExamenesByLaboratorio(id);

            var model = new LaboratorioExamenViewModels
            {
                Laboratorio = laboratorio,
                Examenes    = examenes
            };

            return(View("LaboratorioExamen", model));
        }
Esempio n. 2
0
        /// <summary>
        /// Descripción: Convierte una entidad de tipo LaboratorioConverterRequest a Laboratorio
        /// Author: Terceros.
        /// Fecha Creacion: 01/01/2017
        /// Fecha Modificación: 02/02/2017.
        /// Modificación: Se agregaron comentarios.
        /// Actualizado por: Marcos Mejia
        /// Fecha: 19/01/2017
        /// Modificación: Se agrega dato del logo Regional.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public Laboratorio ConvertFrom(LaboratorioConverterRequest request)
        {
            var laboratorio = _laboratorioBl.GetLaboratorioById(request.Laboratorio.IdLaboratorio);

            //var logo = GetBytes(request.LaboratorioModel.Logo) ?? laboratorio.Logo;
            //var sello = GetBytes(request.LaboratorioModel.Sello) ?? laboratorio.Sello;
            //var logoRegional = GetBytes(request.LaboratorioModel.LogoRegional) ?? laboratorio.LogoRegional;
            var logo         = laboratorio.Logo;
            var sello        = laboratorio.Sello;
            var logoRegional = laboratorio.LogoRegional;

            return(new Laboratorio
            {
                IdLaboratorio = request.Laboratorio.IdLaboratorio,
                CodigoInstitucion = request.Laboratorio.CodigoInstitucion,
                CodigoUnico = request.Laboratorio.CodigoUnico,
                Nombre = request.Laboratorio.Nombre,
                clasificacion = request.Laboratorio.clasificacion,
                Ubigeo = request.Laboratorio.Ubigeo,
                Direccion = request.Laboratorio.Direccion,
                IdDisa = request.Laboratorio.IdDisa,
                IdRed = request.Laboratorio.IdRed,
                IdMicroRed = request.Laboratorio.IdMicroRed,
                IdCategoria = request.Laboratorio.IdCategoria,
                Latitud = request.Laboratorio.Latitud,
                Longitud = request.Laboratorio.Longitud,
                correoElectronico = request.Laboratorio.correoElectronico,
                LogoRegional = logoRegional,
                Logo = logo,
                Sello = sello,
                tipo = request.Laboratorio.tipo,
                Website = request.Laboratorio.Website,
                Estado = request.Laboratorio.Estado,
                IdUsuarioRegistro = request.IdUsuarioLogueado,
                IdUsuarioEdicion = request.IdUsuarioLogueado
            });
        }
Esempio n. 3
0
        /// <summary>
        /// Descripción: Controlador para realizar la busqueda de resultados procesdos y listos para imprimir.
        /// Author: Terceros.
        /// Fecha Creacion: 01/01/2017
        /// Fecha Modificación: 02/02/2017.
        /// Modificación: Se agregaron comentarios.
        /// </summary>
        /// <param name="idOrden"></param>
        /// <param name="idLaboratorio"></param>
        /// <param name="idexamen"></param>
        /// <returns></returns>
        public ActionResult ImprimirResultadosBusqueda(Guid idOrden, int idLaboratorio, string idexamen)
        {
            string lineacorte = string.Empty;

            try
            {
                var resultados = new[] { idexamen };

                var laboratorioUsuario = _laboratorioBl.GetLaboratorioById(idLaboratorio);
                lineacorte = string.Format(" - laboratorioUsuario is null: {0} - ", laboratorioUsuario == null);
                if (laboratorioUsuario == null)
                {
                    return(View("Error"));
                }

                var ordenResultado = _reporteResultadosBl.GetOrdenResultado(idOrden, idLaboratorio, resultados, Logueado.idUsuario);
                lineacorte = string.Format(" - ordenResultado is null: {0} - ", ordenResultado == null);
                if (ordenResultado == null)
                {
                    ordenResultado = new OrdenResultado();
                }

                var muestras = _reporteResultadosBl.GetMuestrasbyIdOrden(idOrden, idLaboratorio, resultados);
                lineacorte = string.Format(" - muestras is null: {0} - ", muestras == null);
                var examenes = _reporteResultadosBl.GetDetalleExamenes(idOrden, idLaboratorio, resultados);
                lineacorte = string.Format(" - examenes is null: {0} - ", examenes == null);
                //var interpretacion = _reporteResultadosBl.GetInterpretacionExamen(resultados);
                var cargoUsuarioEstablecimiento = _reporteResultadosBl.CargoUsuarioEstablecimiento(idLaboratorio, examenes.First().FechaHoraEmision);
                if (laboratorioUsuario.LogoRegional != null)
                {
                    lineacorte = " - antes de GetClientLogoReg - ";
                    GetClientLogoReg(laboratorioUsuario.IdLaboratorio);
                }
                if (laboratorioUsuario.Logo != null)
                {
                    lineacorte = " - antes de GetClientLogo - ";
                    GetClientLogo(laboratorioUsuario.IdLaboratorio);
                }
                if (laboratorioUsuario.Sello != null)
                {
                    lineacorte = " - antes de GetClientSello - ";
                    GetClientSello(laboratorioUsuario.IdLaboratorio);
                }

                string footer = Server.MapPath("~/Views/ReporteResultados/PrintFooter.html");
                lineacorte = string.Format(" - footer: {0} - ", footer);
                string customSwitches = string.Format("--print-media-type " +
                                                      "--header-spacing \"0\" " +
                                                      "--footer-html \"{0}\" " +
                                                      "--footer-spacing \"10\" " +
                                                      "--footer-line  " +
                                                      "--footer-font-size \"10\" ", footer);
                var model = new ReporteResultadoViewModels
                {
                    Orden       = ordenResultado,
                    Laboratorio = laboratorioUsuario,
                    Muestras    = muestras,
                    Examenes    = examenes,
                    CargoUsuarioEstablecimiento = cargoUsuarioEstablecimiento
                };

                //ViewBag.MensajeObservacion = ConfigurationManager.AppSettings["MensajeObservacionReporteKobos"];

                return(new ViewAsPdf("Index", model)
                {
                    FileName = "Reporte-" + model.Orden.codigoOrden + ".pdf",
                    PageSize = Size.A4,
                    PageOrientation = Orientation.Portrait,
                    PageMargins = new Margins(10, 10, 30, 10),
                    CustomSwitches = customSwitches
                });

                ///return View("Index", model);
                //return new ViewAsPdf("Index", model);}
            }
            catch (Exception ex)
            {
                lineacorte = string.Format("idorden: {0} - idLaboratorio: {1} - idexamen: {2} - idUsuario: {3} - corte: {4}", idOrden, idLaboratorio, idexamen, Logueado.idUsuario, lineacorte);
                new bsPage().LogError(ex, "LogNetLab", lineacorte, " ImprimirResultadosBusqueda - Post ");
                throw ex;
            }
        }