public JsonResult GetExamenesByIdEnfermedadAgrupado(int idEnfermedad) { var _examenBl = new ExamenBl(); var examen = _examenBl.GetExamenesByIdEnfermedadAgrupado(idEnfermedad); return(Json(examen, JsonRequestBehavior.AllowGet)); }
public ActionResult AgregarExamen(string idExamen) { IExamenBl examenBl = new ExamenBl(); Examen examen = examenBl.GetExamenById(Guid.Parse(idExamen)); ITipoMuestraBl tipoMuestraBl = new TipoMuestraBl(); //examen.tipoMuestraList = tipoMuestraBl.GetTiposMuestraByIdExamen(Guid.Parse(idExamen)); List <ExamenVd> examenVdList = new List <ExamenVd>(); if (this.Session["examenVdList"] != null) { examenVdList = (List <ExamenVd>) this.Session["examenVdList"]; } ExamenVd examenVd = new ExamenVd(); examenVd.idTiposMuestraSeleccionados = new String[1]; examenVd.tipoMuestraList = tipoMuestraBl.GetTiposMuestraByIdExamen(Guid.Parse(idExamen)); examenVd.examen = examen; examenVd.idBtnEliminarExamen = "btnEliminarExamen" + examen.idExamen; examenVdList.Add(examenVd); this.Session["examenVdList"] = examenVdList; var model = examenVdList; return(PartialView("_AgregarExamenTabla", model)); }
/// <summary> /// Descripción: Obtiene la lista de enfermedades por el texto ingresado. /// Author: Terceros. /// Fecha Creacion: 01/01/2017. /// Fecha Modificación: 02/02/2017. /// Modificación: Se agregaron comentarios, funcion no utilizada. /// </summary> /// <param name="idEnfermedad"></param> /// <returns></returns> public ActionResult GetExamenes(int idEnfermedad) { IExamenBl examenBl = new ExamenBl(); List <Examen> examenList = examenBl.GetExamenesByIdEnfermedad(idEnfermedad, 1, ""); //TODO: CAMBIAR List <Examen> examenListTmp = new List <Examen>(); examenListTmp.Add(new Examen { nombre = "" }); foreach (Examen examen in examenList) { examenListTmp.Add(examen); } examenList = examenListTmp; /*Se limpian las variables de Session de objetos seleccionados*/ this.Session["examenesSeleccionados"] = new String[0]; this.Session["tiposMuestraSeleccionados"] = new String[0]; this.Session["materialesSeleccionados"] = new String[0]; /*Se limpian las variables de Session de listas*/ this.Session["tipoMuestraList"] = new List <TipoMuestra>(); this.Session["materialList"] = new List <MaterialVd>(); /*Se agrega la nueva lista de examenes de la enfermedad seleccionada*/ this.Session["examenList"] = examenList; var model = examenList; return(PartialView("_AgregarCmbExamen", model)); }
private List <SelectListItem> ObtenerExamenesListItem(string idEnfermedad, string seleccionados = "") { var examenBl = new ExamenBl(); List <Examen> examenList = new List <Examen>(); if (!string.IsNullOrWhiteSpace(idEnfermedad)) { examenList = examenBl.GetExamenesByIdEnfermedad(int.Parse(idEnfermedad), 0, string.Empty); } List <Guid> examenIds = new List <Guid>(); if (!string.IsNullOrWhiteSpace(seleccionados) && seleccionados != "mostrartodos") { seleccionados.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach(x => examenIds.Add(Guid.Parse(x))); } var examenlist = examenList.Select(x => new SelectListItem { Value = x.idExamen.ToString(), Text = x.nombre, Selected = examenIds.Any(s => s == x.idExamen) }).ToList(); return(examenlist); }
public Orden GenerarOrden(string TipoDocumento, string nroDocumento, string EstablecimientoOrigen, string EstablecimientoEnvio, string FechaObtencion, string solicitante, string fechaIngresoINS, string nroOficio, string idOrdenPadreExportado) { var codigoOrdenGenerado = string.Empty; using (var ordenBl = new OrdenBl()) { //Generar Codigo de Orden codigoOrdenGenerado = ordenBl.GenerarCodigoOrden(int.Parse(EstablecimientoOrigen)); } var datoPaciente = ""; var idEstablecimientoDestino = EstablecimientoEnvio; var idEstablecimientoOrigen = EstablecimientoOrigen; var fechaIngresoRom = fechaIngresoINS; var oOrden = new OrdenBl(); var oTempOrden = new TempOrdenBl(); var orden = new Orden(); var pacienteBl = new PacienteBl(); var examenBl = new ExamenBl(); var establecimientoBl = new EstablecimientoBl(); // Variables produccion int idEnfermedad = int.Parse(GetSetting <string>("EnfVirusRespiratorio")); //1005680; Guid idExamen = Guid.Parse(GetSetting <string>("Covid19")); var idTipoMuestra = int.Parse(GetSetting <string>("idTipoMuestra")); orden.nroOficio = nroOficio; orden.codigoOrden = codigoOrdenGenerado; { datoPaciente = nroDocumento; List <Paciente> pacienteList = pacienteBl.getPacientes2(1, 10, int.Parse(TipoDocumento), datoPaciente); if (pacienteList.Any()) { bool continuar = true; var paciente = pacienteList.First(); var enfermedadListAgregados = new List <Enfermedad>(); var ordenExamenListAgregados = new List <OrdenExamen>(); var ordenMaterialListAgregados = new List <OrdenMaterial>(); var ordenMuestraListAgregados = new List <OrdenMuestra>(); var Establecimientobl = new EstablecimientoBl(); var oEstablecimiento = new Establecimiento(); if (string.IsNullOrEmpty(idEstablecimientoOrigen)) { idEstablecimientoOrigen = "991"; } oEstablecimiento = Establecimientobl.GetEstablecimientosById(int.Parse(idEstablecimientoOrigen)); orden.idEstablecimiento = oEstablecimiento.IdEstablecimiento; orden.EstablecimientoCodigoUnico = oEstablecimiento.CodigoUnico; orden.idEstablecimientoEnvio = int.Parse(EstablecimientoEnvio); orden.IdUsuarioRegistro = Logueado.idUsuario; orden.IdLaboratorioDestino = 995; orden.Paciente = new PacienteBl().getPacienteById(paciente.IdPaciente); orden.solicitante = solicitante; orden.fechaIngresoINS = DateTime.Parse(fechaIngresoRom); var laboratorio = new Laboratorio() { IdLaboratorio = 991, CodigoUnico = "10000R16" }; orden.estatus = 1; orden.IdUsuarioRegistro = Logueado.idUsuario; orden.fechaSolicitud = DateTime.Parse(DateTime.Now.ToShortDateString()); var idOrdenPadreExportado2 = Guid.NewGuid(); string nuevoCodigoVerificador = string.Empty; if (string.IsNullOrWhiteSpace(idOrdenPadreExportado) || idOrdenPadreExportado == Guid.Empty.ToString()) { nuevoCodigoVerificador = string.Format("{0}---{1}", Logueado.idUsuario, idOrdenPadreExportado2.ToString()); ViewBag.idOrdenPadreExportado = nuevoCodigoVerificador; orden.observacion = nuevoCodigoVerificador; } else { var arr = idOrdenPadreExportado.Split(new string[] { "---" }, StringSplitOptions.RemoveEmptyEntries); if (arr[0] == Logueado.idUsuario.ToString()) { ViewBag.idOrdenPadreExportado = idOrdenPadreExportado; orden.observacion = idOrdenPadreExportado; } else { nuevoCodigoVerificador = string.Format("{0}---{1}", Logueado.idUsuario, Guid.NewGuid().ToString()); ViewBag.idOrdenPadreExportado = nuevoCodigoVerificador; orden.observacion = nuevoCodigoVerificador; } } orden.Proyecto = new Proyecto { IdProyecto = 1 }; if (continuar) { var examenList = new Examen(); //var tipoMuestraList = new List<TipoMuestra>(); var materialList = new List <Material>(); // materialList = new MaterialBl().GetMaterialesByIdTipoMuestra(idTipoMuestra).ToList(); var LstoExamen = new List <OrdenExamen>(); orden.ordenMuestraList = new List <OrdenMuestra>(); orden.ordenMuestraList.Add(new OrdenMuestra { idTipoMuestra = idTipoMuestra, TipoMuestra = new TipoMuestra { idTipoMuestra = idTipoMuestra }, fechaColeccion = DateTime.Parse(FechaObtencion),// horaColeccion = DateTime.Now, idProyecto = 1, MuestraCodificacion = new MuestraCodificacion() }); var ordexmen = new OrdenExamen { idEnfermedad = idEnfermedad, Enfermedad = new Enfermedad { idEnfermedad = idEnfermedad }, idExamen = idExamen, Examen = new Examen { idExamen = idExamen }, IdTipoMuestra = idTipoMuestra, ordenMuestraList = orden.ordenMuestraList }; LstoExamen.Add(ordexmen); orden.ordenExamenList = LstoExamen; orden.ordenMaterialList = new List <OrdenMaterial>(); //ORDENMATERIAL var materiales = new MaterialBl().GetMaterialesByIdTipoMuestra(idTipoMuestra); var material = materiales.FirstOrDefault(); if (material != null) { orden.ordenMaterialList.Add(new OrdenMaterial { cantidad = 1, idMaterial = material.idMaterial, Material = new Material { idMaterial = material.idMaterial, TipoMuestra = new TipoMuestra { idTipoMuestra = idTipoMuestra } }, fechaEnvio = DateTime.Today, horaEnvio = DateTime.Now, volumenMuestraColectada = material != null ? material.volumen : 1, OrdenExamen = ordexmen, Laboratorio = laboratorio }); } List <OrdenDatoClinico> ordenDatoClinicoList = new List <OrdenDatoClinico>(); var datoClinicoBl = new DatoClinicoBl(); var categoriaDatoList = datoClinicoBl.GetCategoriaByEnfermedad(idEnfermedad, 1, idExamen.ToString()); var oEnfermedad = new Enfermedad(); oEnfermedad.idEnfermedad = idEnfermedad; oEnfermedad.categoriaDatoList = categoriaDatoList; enfermedadListAgregados.Add(oEnfermedad); { var datosClinicos = enfermedadListAgregados.SelectMany(e => e.categoriaDatoList) .SelectMany(c => c.OrdenDatoClinicoList); foreach (var ordenDatoClinico in datosClinicos) { var id = ordenDatoClinico.Enfermedad.idEnfermedad.ToString() + ordenDatoClinico.Dato.IdDato.ToString(); OrdenDatoClinico ordenDatoClinicoFormulario = ordenDatoClinicoList.FirstOrDefault(x => x.Dato.IdDato == ordenDatoClinico.Dato.IdDato); //Si el dato clinico existe previamente en el formulario entonces se copia los valores del existente if (ordenDatoClinicoFormulario != null) { ordenDatoClinico.noPrecisa = ordenDatoClinicoFormulario.noPrecisa; ordenDatoClinico.ValorString = ordenDatoClinicoFormulario.ValorString; } else { //Si el dato clinico no existe se crea con los valores obtenidos ordenDatoClinicoFormulario = new OrdenDatoClinico(); Dato datoClinico = new Dato(); datoClinico.IdDato = ordenDatoClinico.Dato.IdDato; ordenDatoClinicoFormulario.Dato = datoClinico; ordenDatoClinicoList.Add(ordenDatoClinicoFormulario); var formValue = Request.Form["valueDato" + id]; string checknoprecisa = Request.Form["checkNoPrecisa" + id]; var checkNoPrecisaBoolean = !string.IsNullOrEmpty(checknoprecisa) && (checknoprecisa.ToLower() == "on" || checknoprecisa.ToLower() == "true"); if ((int)Enums.TipoCampo.CHECKBOX == ordenDatoClinico.Dato.IdTipo || (int)Enums.TipoCampo.COMBO == ordenDatoClinico.Dato.IdTipo) { ordenDatoClinico.noPrecisa = formValue == null || formValue.Equals("0"); ordenDatoClinico.ValorString = formValue == null || formValue.Equals("0") ? "" : formValue; } else { ordenDatoClinico.noPrecisa = checkNoPrecisaBoolean; ordenDatoClinico.ValorString = !checkNoPrecisaBoolean ? formValue : string.Empty; } ordenDatoClinicoFormulario.noPrecisa = ordenDatoClinico.noPrecisa; ordenDatoClinicoFormulario.ValorString = ordenDatoClinico.ValorString; } } } orden.enfermedadList = enfermedadListAgregados; oOrden.InsertOrdenCovid(orden, Enums.TipoRegistroOrden.ORDEN_RECEPCION); } } } return(orden); }
public ActionResult AddVariables(string idOrden) { int idEnfermedad = int.Parse(GetSetting <string>("EnfVirusRespiratorio")); //1005680; string idExamen = GetSetting <string>("Covid19"); //Guid.Parse("1B2BEC28-772C-49DF-BCC2-85E0C5CCA667"); string idExamenAgrupado = GetSetting <string>("idExamenAgrupado"); string idTipoMuestra = GetSetting <string>("idTipoMuestra"); //cambioj OrdenBl ordenBl = new OrdenBl(); Orden orden = ordenBl.GetOrdenById(Guid.Parse(idOrden)); var enfermedad = new Enfermedad(); if (!(orden.enfermedadList != null && orden.enfermedadList.Any())) { var datoClinicoBl = new DatoClinicoBl(); var categoriaDatoList = datoClinicoBl.GetCategoriaByEnfermedad(idEnfermedad, 1, idExamen); if (enfermedad != null) { enfermedad.categoriaDatoList = categoriaDatoList; } } else { enfermedad = orden.enfermedadList.FirstOrDefault(); } var Examenbl = new ExamenBl(); var TipoMuestraList = new List <SelectListItem>(); foreach (var itemDetalle in Examenbl.GetExamenAgrupado(int.Parse(idExamenAgrupado))) { TipoMuestraList.Add(new SelectListItem { Text = itemDetalle.descripcion, Value = itemDetalle.idTipoMuestra.ToString() }); } ViewBag.TipoMuestra = TipoMuestraList; int val = 0; if (orden.ordenMuestraList != null) { if (orden.ordenMuestraList.Count() > 0) { ViewBag.tipoMuestraSel = orden.ordenMuestraList.First().TipoMuestra.idTipoMuestra.ToString(); ViewBag.FechaObtencion = orden.ordenMuestraList.First().fechaColeccion.ToShortDateString(); val = 1; } } if (val == 0) { ViewBag.tipoMuestraSel = idTipoMuestra; ViewBag.FechaObtencion = ""; } var paciente = new PacienteBl().GetPacienteByDocumento(orden.Paciente.NroDocumento); ViewBag.Paciente = paciente.ApellidoPaterno + " " + paciente.ApellidoMaterno + ", " + paciente.Nombres; ViewBag.idPaciente = paciente.IdPaciente.ToString(); ViewBag.nroCelularPaciente = paciente.Celular1; ViewBag.idOrden = idOrden; if (orden.establecimiento != null) { ViewBag.idEstablecimientoOrigenEdit = orden.establecimiento.IdEstablecimiento == 0 ? "" : orden.establecimiento.IdEstablecimiento.ToString(); ViewBag.nombreEstablecimientoOrigenEdit = string.IsNullOrEmpty(orden.establecimiento.Nombre) ? "" : orden.establecimiento.Nombre; } return(PartialView("_AddVariables", enfermedad)); }