public ActionResult Create(concepto concepto) { historia historia = db.historia.Find(concepto.con_id); if (ModelState.IsValid && validar_resultado(historia.his_tipo, concepto.con_valor)) { db.concepto.Add(concepto); db.SaveChanges(); //return RedirectToAction("Message", "Home", new {mensaje="Proceso Finalizado" }); return(RedirectToAction("Firma", "Historia", new { id = concepto.con_id })); } if (historia.his_tipo == 2 || historia.his_tipo == 3) { ViewBag.con_resultado = res_periodica(concepto.con_resultado); ViewBag.con_valor = val_periodica(concepto.con_valor); } else if (historia.his_tipo == 4) { ViewBag.con_resultado = res_retiro(concepto.con_resultado); ViewBag.con_valor = val_retiro(concepto.con_valor); } ViewBag.con_id = concepto.con_id; ViewBag.con_seguimiento = opcion(concepto.con_seguimiento); return(PartialView(concepto)); }
public ActionResult Reposo(int id) { try { reposo reposo = db.reposo.Find(id); if (reposo == null) { return(RedirectToAction("Message", "Home", new { mensaje = "La historia no tiene certificado de reposo" })); } dsReposo dsReposo = new dsReposo(); string conn = ConfigurationManager.AppSettings["conexion"]; SqlConnection sqlcon = new SqlConnection(conn); historia historia = db.historia.Find(id); string strReposo = "Select top 1 * from view_reposo where his_id=" + id; SqlDataAdapter daReposo = new SqlDataAdapter(strReposo, sqlcon); daReposo.Fill(dsReposo, "view_reposo"); RptReposo rp = new RptReposo(); string reportPath = Server.MapPath("~/Reports/RptReposo.rpt"); rp.Load(reportPath); rp.SetDataSource(dsReposo); rp.SetParameterValue("fecha", get_fecha(historia.his_fecha)); Stream stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "Certificado.pdf")); } catch (Exception ex) { return(RedirectToAction("Message", "Home", new { mensaje = ex.Message + ex.InnerException })); } }
public ActionResult Create01(historia historia) { DateTime dd = DateTime.Now; historia.his_fecha = dd.Date.ToString("d"); historia.his_numero = numero_historia(historia); historia.his_medico = get_user(); if (historia.his_medico == 0) { return(RedirectToAction("Message", "Home", new { mensaje = "Su perfil de usuario no permite realizar esta acción" })); } if (ModelState.IsValid) { db.historia.Add(historia); db.SaveChanges(); if (historia.his_tipo == 2) { change_tipo(historia.his_paciente); } Session["his_id"] = historia.his_id; Session["his_tipo"] = historia.his_tipo; return(RedirectToAction("Create", "Ocupacional", new { id = historia.his_paciente })); } ViewBag.his_tipo = his_tipo(historia.his_tipo); return(PartialView(historia)); }
public ActionResult Create(int id) { concepto concepto = db.concepto.Find(id); if (concepto != null) { return(RedirectToAction("Edit", new { id = id })); } historia historia = db.historia.Find(id); if (historia.his_tipo == 2 || historia.his_tipo == 3) { ViewBag.con_resultado = res_periodica(); ViewBag.con_valor = val_periodica(); } else if (historia.his_tipo == 4) { ViewBag.con_resultado = res_retiro(); ViewBag.con_valor = val_retiro(); } else { ViewBag.con_resultado = res_periodica(); ViewBag.con_valor = val_periodica(); } ViewBag.con_id = id; ViewBag.con_seguimiento = opcion(); return(PartialView()); }
public ActionResult DeleteConfirmed(int id) { historia historia = db.historia.Find(id); db.historia.Remove(historia); db.SaveChanges(); return(RedirectToAction("Index", new { tipo = historia.his_tipo })); }
private int numero_historia(historia historia) { int num = 0; num = db.historia.Where(h => h.his_tipo == historia.his_tipo && h.his_paciente == historia.his_paciente).Count(); num++; return(num); }
public ActionResult Problema(historia historia) { if (ModelState.IsValid) { db.Entry(historia).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Edit", "Revision", new { id = historia.his_id })); } return(PartialView(historia)); }
public ActionResult Details(int id = 0) { historia historia = db.historia.Find(id); if (historia == null) { return(HttpNotFound()); } return(View(historia)); }
public ActionResult Firma(int id) { historia historia = db.historia.Find(id); if (historia == null) { return(HttpNotFound()); } return(PartialView(historia)); }
public ActionResult Delete(int id = 0) { historia historia = db.historia.Find(id); if (historia == null) { return(HttpNotFound()); } ViewBag.tipo = historia.his_tipo; return(View(historia)); }
public ActionResult Edit(int id = 0) { plan plan = db.plan.Find(id); historia historia = db.historia.Find(id); if (plan == null) { return(RedirectToAction("Create", new { id = id })); } ViewBag.pla_id = plan.pla_id; ViewBag.pac_id = historia.his_paciente; return(PartialView(plan)); }
public ActionResult Edit(historia historia) { if (ModelState.IsValid) { db.Entry(historia).State = EntityState.Modified; db.SaveChanges(); Session["his_id"] = historia.his_id; Session["his_tipo"] = historia.his_tipo; return(RedirectToAction("Edit", "Personal", new { id = historia.his_paciente })); } return(PartialView(historia)); }
public ActionResult Edit(int id = 0) { fisico fisico = db.fisico.Find(id); if (fisico == null) { return(RedirectToAction("Create", new { id = id })); } historia historia = db.historia.Find(id); ViewBag.fis_id = id; ViewBag.pac_id = historia.his_paciente; return(PartialView(fisico)); }
public ActionResult Create(int id) { plan plan = db.plan.Find(id); if (plan != null) { return(RedirectToAction("Edit", new { id = id })); } historia historia = db.historia.Find(id); ViewBag.pla_id = id; ViewBag.pac_id = historia.his_paciente; return(PartialView()); }
public ActionResult Problema(int id) { historia historia = db.historia.Find(id); if (historia == null) { return(HttpNotFound()); } int tipo = Convert.ToInt32(Session["his_tipo"]); //if (tipo != 1) // return RedirectToAction("Edit", "Familiar", new { id = historia.his_paciente }); return(PartialView(historia)); }
public ActionResult RepHisGen(int id) { //string pathRpt = Path.Combine(Server.MapPath("~/Reports"), "RptHistoria.rpt"); try { dsHistoria dshistoria = new dsHistoria(); string conn = ConfigurationManager.AppSettings["conexion"]; SqlConnection sqlcon = new SqlConnection(conn); historia historia = db.historia.Find(id); string strHistoria = "Select * from view_historia where his_id=" + id; SqlDataAdapter daHistoria = new SqlDataAdapter(strHistoria, sqlcon); daHistoria.Fill(dshistoria, "view_historia"); RptHisGen rp = new RptHisGen(); string reportPath = Server.MapPath("~/Reports/RptHisGen.rpt"); rp.Load(reportPath); rp.SetDataSource(dshistoria); //Subreportes ////diagnostico dsDiagnostico dsdiagnostico = new dsDiagnostico(); string strDiagnostico = "Select * from view_diagnostico where dia_historia=" + historia.his_id; SqlDataAdapter daDiagnostico = new SqlDataAdapter(strDiagnostico, sqlcon); daDiagnostico.Fill(dsdiagnostico, "view_diagnostico"); ////inmunizacion dsInmunizacion dsinmunizacion = new dsInmunizacion(); string strInmunizacion = "Select * from view_inmunizacion where inm_paciente=" + historia.his_paciente; SqlDataAdapter daInmunizacion = new SqlDataAdapter(strInmunizacion, sqlcon); daInmunizacion.Fill(dsinmunizacion, "view_inmunizacion"); rp.Subreports["RptDiagnostico.rpt"].SetDataSource(dsdiagnostico); rp.Subreports["RptInmunizacion.rpt"].SetDataSource(dsinmunizacion); //rp.Subreports["RptConcepto.rpt"].SetDataSource(dsconcepto); Stream stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "Reporte.pdf")); } catch (Exception ex) { return(RedirectToAction("Message", "Home", new { mensaje = ex.Message + ex.InnerException })); } }
public ActionResult Firma(historia historia) { if (Request.Files.Count > 0) { var file = Request.Files[0]; string fileName = Path.GetFileName(file.FileName); string ext = Path.GetExtension(fileName); string[] formatos = new string[] { ".jpg", ".jpeg", ".bmp", ".png", ".gif", ".JPG", ".JPEG", ".BMP", ".PNG", ".GIF" }; if (!String.IsNullOrEmpty(fileName) && (Array.IndexOf(formatos, ext) > 0)) { Firma objfirma = new Firma(); //paciente.pac_firma = fileName; string path = Path.Combine(Server.MapPath("~/Content/firmas_"), fileName); string path01 = Path.Combine(Server.MapPath("~/Content/firmas"), fileName); file.SaveAs(path); objfirma.ResizeImage(path, path01, 200, 120); historia.his_firma = ConvertBytes(path01); return(RedirectToAction("Message", "Home", new { mensaje = "Proceso Finalizado" })); } else { if (!String.IsNullOrEmpty(ext)) { if (Array.IndexOf(formatos, ext) <= 0) { ModelState.AddModelError("ext", "Extensión no Válida"); } } //else if (String.IsNullOrEmpty(fileName)) // ModelState.AddModelError("ext", "Debe Seleccionar un archivo"); return(RedirectToAction("Message", "Home", new { mensaje = "Proceso Finalizado" })); } } if (ModelState.IsValid) { db.Entry(historia).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Message", "Home", new { mensaje = "Proceso Finalizado" })); } return(RedirectToAction("Message", "Home", new { mensaje = "Proceso Finalizado" })); }
public IHttpActionResult Add() { using (HIST_CLINEntities bd = new HIST_CLINEntities()) { var objhistoria = new historia(); objhistoria.id_doctor = 1; objhistoria.id_especialidad = 2; objhistoria.id_tipo = 1; objhistoria.peso = "87"; objhistoria.talla = "175"; objhistoria.nombre = "Juan"; objhistoria.apellido = "Perez"; objhistoria.edad = 38; objhistoria.motivo_consulta = "prueba"; objhistoria.alergias = "prueba_alergias"; objhistoria.fecha = Convert.ToDateTime(25092019); bd.historia.Add(objhistoria); bd.SaveChanges(); } return(Ok("Nuevo registro exitoso")); }
public ActionResult Edit02(int id = 0) { int user_current = get_user(); historia historia = db.historia.Find(id); if (historia.his_medico == user_current && User.IsInRole("medico")) { ViewBag.his_tipo = his_tipo(historia.his_tipo); ViewBag.tipo = historia.his_tipo; if (historia == null) { return(HttpNotFound()); } if (Request.IsAjaxRequest()) { return(PartialView(historia)); } return(View("Edit03", historia)); } return(RedirectToAction("Message", "Home", new { mensaje = "Usted no tiene permiso para editar esta historia" })); }
protected void Page_Load(object sender, EventArgs e) { if (this.reportDocument != null) { this.reportDocument.Close(); this.reportDocument.Dispose(); } int id = Convert.ToInt32(Session["his_id"]); dsHistoria dshistoria = new dsHistoria(); //dsHistorico dshistorico = new dsHistorico(); string conn = ConfigurationManager.AppSettings["conexion"]; SqlConnection sqlcon = new SqlConnection(conn); historia historia = db.historia.Find(id); string strHistoria = "Select * from view_historia where his_id=" + id; SqlDataAdapter daHistoria = new SqlDataAdapter(strHistoria, sqlcon); daHistoria.Fill(dshistoria, "view_historia"); reportDocument = new ReportDocument(); //Report path string reportPath = Server.MapPath("~/Reports/RptHistoria.rpt"); reportDocument.Load(reportPath); reportDocument.SetDataSource(dshistoria); crViewer.ReportSource = reportDocument; crViewer.DataBind(); }
public ActionResult Reporte(int id) { //string pathRpt = Path.Combine(Server.MapPath("~/Reports"), "RptHistoria.rpt"); try { dsHistoria dshistoria = new dsHistoria(); string conn = ConfigurationManager.AppSettings["conexion"]; SqlConnection sqlcon = new SqlConnection(conn); historia historia = db.historia.Find(id); string strHistoria = "Select * from view_historia where his_id=" + id; SqlDataAdapter daHistoria = new SqlDataAdapter(strHistoria, sqlcon); daHistoria.Fill(dshistoria, "view_historia"); RptHistoria rp = new RptHistoria(); string reportPath = Server.MapPath("~/Reports/RptHistoria.rpt"); rp.Load(reportPath); rp.SetDataSource(dshistoria); //Subreportes //TRABAJOS ANTERIORES dsHistorico dshistorico = new dsHistorico(); string strHistorico = "Select * from ocupacional where ocu_tipo='histórico' and ocu_paciente=" + historia.his_paciente; SqlDataAdapter daHistorico = new SqlDataAdapter(strHistorico, sqlcon); daHistorico.Fill(dshistorico, "ocupacional"); //INFORMACIÓN OCUPACIONAL dsHistorico dsocupacional = new dsHistorico(); string strOcupacional = "Select top 1 * from ocupacional where ocu_tipo='actual' and ocu_paciente=" + historia.his_paciente; SqlDataAdapter daOcupacional = new SqlDataAdapter(strOcupacional, sqlcon); daOcupacional.Fill(dsocupacional, "ocupacional"); //riesgos laborales dsRiesgos dsriesgos = new dsRiesgos(); string strRiesgos = "Select * from view_riesgo where ocu_paciente=" + historia.his_paciente; SqlDataAdapter daRiesgos = new SqlDataAdapter(strRiesgos, sqlcon); daRiesgos.Fill(dsriesgos, "view_riesgo"); ////diagnostico dsDiagnostico dsdiagnostico = new dsDiagnostico(); string strDiagnostico = "Select * from view_diagnostico where dia_historia=" + historia.his_id; SqlDataAdapter daDiagnostico = new SqlDataAdapter(strDiagnostico, sqlcon); daDiagnostico.Fill(dsdiagnostico, "view_diagnostico"); ////inmunizacion dsInmunizacion dsinmunizacion = new dsInmunizacion(); string strInmunizacion = "Select * from view_inmunizacion where inm_paciente=" + historia.his_paciente; SqlDataAdapter daInmunizacion = new SqlDataAdapter(strInmunizacion, sqlcon); daInmunizacion.Fill(dsinmunizacion, "view_inmunizacion"); //concepto dsConcepto dsconcepto = new dsConcepto(); string strConcepto = "Select * from concepto where con_id=" + historia.his_id; SqlDataAdapter daConcepto = new SqlDataAdapter(strConcepto, sqlcon); daConcepto.Fill(dsconcepto, "concepto"); rp.Subreports["RptHistorico.rpt"].SetDataSource(dshistorico); rp.Subreports["RptOcupacional.rpt"].SetDataSource(dsocupacional); rp.Subreports["RptRiesgos.rpt"].SetDataSource(dsriesgos); rp.Subreports["RptDiagnostico.rpt"].SetDataSource(dsdiagnostico); rp.Subreports["RptInmunizacion.rpt"].SetDataSource(dsinmunizacion); rp.Subreports["RptConcepto.rpt"].SetDataSource(dsconcepto); Stream stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "Reporte.pdf")); } catch (Exception ex) { return(RedirectToAction("Message", "Home", new { mensaje = ex.Message + ex.InnerException })); } }
public ActionResult Certificado(int id, int pac_id) { try { dsCertificado dsCertificado = new dsCertificado(); paciente paciente = db.paciente.Find(pac_id); historia historia = db.historia.Find(id); concepto concepto = db.concepto.Find(id); medico medico = db.medico.Find(historia.his_medico); if (concepto == null) { return(RedirectToAction("Message", "Home", new { mensaje = "La historia no tiene información completa. Por llene toda la información y genere el certificado correspondiente" })); } var consulta = db.ocupacional.Where(o => o.ocu_paciente == pac_id && o.ocu_tipo == "actual" && o.ocu_estado == true); ocupacional ocupacional = new ocupacional(); //string fileName = medico.med_firma; //if (String.IsNullOrEmpty(fileName)) // fileName = "firma.png"; if (consulta.Any()) { ocupacional = consulta.First(); } string conn = ConfigurationManager.AppSettings["conexion"]; string strHistoria = "Select * from historia where his_id=" + id; string strPaciente = "Select * from paciente where pac_id=" + pac_id; string strConcepto = "Select * from concepto where con_id=" + id; string strEmpresa = "Select * from empresa where emp_id=" + paciente.pac_empresa; string strMedico = "Select * from medico where med_id=" + historia.his_medico; string strOcupacional = String.Empty; if (ocupacional.ocu_id != null) { strOcupacional = "Select * from ocupacional where ocu_id=" + ocupacional.ocu_id; } else { strOcupacional = "Select top 1 * from ocupacional"; } SqlConnection sqlcon = new SqlConnection(conn); SqlDataAdapter daHistoria = new SqlDataAdapter(strHistoria, sqlcon); SqlDataAdapter daPaciente = new SqlDataAdapter(strPaciente, sqlcon); SqlDataAdapter daConcepto = new SqlDataAdapter(strConcepto, sqlcon); SqlDataAdapter daEmpresa = new SqlDataAdapter(strEmpresa, sqlcon); SqlDataAdapter daMedico = new SqlDataAdapter(strMedico, sqlcon); SqlDataAdapter daOcupacional = new SqlDataAdapter(strOcupacional, sqlcon); daHistoria.Fill(dsCertificado, "historia"); daPaciente.Fill(dsCertificado, "paciente"); daConcepto.Fill(dsCertificado, "concepto"); daEmpresa.Fill(dsCertificado, "empresa"); daMedico.Fill(dsCertificado, "medico"); daOcupacional.Fill(dsCertificado, "ocupacional"); Stream stream = MemoryStream.Null; if (concepto.con_resultado == "APTO") { RptCerApto rp = new RptCerApto(); rp.Load(Path.Combine(Server.MapPath("~/Reports"), "RptCerApto.rpt")); rp.SetDataSource(dsCertificado); rp.SetParameterValue("fecha", get_fecha(historia.his_fecha)); stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); rp.Close(); rp.Dispose(); } else if (concepto.con_resultado == "APTO CON RESTRICCIONES PERSONALES" || concepto.con_resultado == "APTO CON RESTRICCIONES LABORALES") { RptCerAptoRes rp = new RptCerAptoRes(); rp.Load(Path.Combine(Server.MapPath("~/Reports"), "RptCerAptoRes.rpt")); rp.SetDataSource(dsCertificado); rp.SetParameterValue("fecha", get_fecha(historia.his_fecha)); stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); rp.Close(); rp.Dispose(); } else if (concepto.con_resultado == "NO APTO") { RptCerNoApto rp = new RptCerNoApto(); rp.Load(Path.Combine(Server.MapPath("~/Reports"), "RptCerNoApto.rpt")); rp.SetDataSource(dsCertificado); rp.SetParameterValue("fecha", get_fecha(historia.his_fecha)); stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); rp.Close(); rp.Dispose(); } else if (concepto.con_resultado == "SATISFACTORIA" || concepto.con_resultado == "NO SATISFACTORIA") { RptCerRetiro rp = new RptCerRetiro(); rp.Load(Path.Combine(Server.MapPath("~/Reports"), "RptCerRetiro.rpt")); rp.SetDataSource(dsCertificado); string nexo = String.Empty; if (concepto.con_valor == "NO") { nexo = "NINGUNA"; } else { nexo = "UNA"; } rp.SetParameterValue("nexo", nexo); rp.SetParameterValue("fecha", get_fecha(historia.his_fecha)); stream = rp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); rp.Close(); rp.Dispose(); } Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "Certificado.pdf")); } catch (Exception ex) { return(RedirectToAction("Message", "Home", new { mensaje = ex.Message })); } }