Exemplo n.º 1
0
        public ActionResult Edit(oftalmologia oftalmologia)
        {
            if (ModelState.IsValid)
            {
                db.Entry(oftalmologia).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            paciente paciente = db.paciente.Find(oftalmologia.oft_paciente);

            ViewBag.paciente = paciente.pac_nombres + " " + paciente.pac_apellidos;


            ViewBag.oft_con_od = get_agudeza(oftalmologia.oft_con_od);
            ViewBag.oft_con_oi = get_agudeza(oftalmologia.oft_con_oi);
            ViewBag.oft_sin_od = get_agudeza(oftalmologia.oft_sin_od);
            ViewBag.oft_sin_oi = get_agudeza(oftalmologia.oft_sin_oi);

            ViewBag.oft_biomiscroscopia = get_valor(oftalmologia.oft_biomiscroscopia);
            ViewBag.oft_fondo           = get_valor(oftalmologia.oft_fondo);
            ViewBag.oft_colores         = get_colores(oftalmologia.oft_colores);
            ViewBag.oft_diagnostico     = get_diagnostico(oftalmologia.oft_diagnostico);
            ViewBag.oft_indicaciones    = get_indicacion(oftalmologia.oft_indicaciones);
            return(View(oftalmologia));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Putpaciente(int id, paciente paciente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != paciente.idPaciente)
            {
                return(BadRequest());
            }

            db.Entry(paciente).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!pacienteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id = 0)
        {
            oftalmologia oftalmologia = db.oftalmologia.Find(id);

            if (oftalmologia == null)
            {
                return(HttpNotFound());
            }
            paciente paciente = db.paciente.Find(oftalmologia.oft_paciente);

            ViewBag.paciente = paciente.pac_nombres + " " + paciente.pac_apellidos;


            ViewBag.oft_con_od = get_agudeza(oftalmologia.oft_con_od);
            ViewBag.oft_con_oi = get_agudeza(oftalmologia.oft_con_oi);
            ViewBag.oft_sin_od = get_agudeza(oftalmologia.oft_sin_od);
            ViewBag.oft_sin_oi = get_agudeza(oftalmologia.oft_sin_oi);

            ViewBag.oft_biomiscroscopia = get_valor(oftalmologia.oft_biomiscroscopia);
            ViewBag.oft_fondo           = get_valor(oftalmologia.oft_fondo);
            ViewBag.oft_colores         = get_colores(oftalmologia.oft_colores);
            ViewBag.oft_diagnostico     = get_diagnostico(oftalmologia.oft_diagnostico);
            ViewBag.oft_indicaciones    = get_indicacion(oftalmologia.oft_indicaciones);
            return(View(oftalmologia));
        }
Exemplo n.º 4
0
        public EPaciente mostraDatos(int id)
        {
            try
            {
                using (dbodontogramaEntity cn = new dbodontogramaEntity())
                {
                    paciente item = new paciente();
                    item = cn.paciente.Find(id);
                    EPaciente Obj = new EPaciente();
                    Obj.pacienteID      = item.pacienteID;
                    Obj.nombre          = item.nombre;
                    Obj.apellido        = item.apellido;
                    Obj.telefono        = item.telefono;
                    Obj.ci              = item.ci;
                    Obj.fechaNacimiento = item.fechaNacimiento;
                    Obj.direccion       = item.direccion;
                    Obj.sexo            = item.sexo;
                    Obj.estado          = item.estado;


                    return(Obj);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 5
0
        public EPaciente mostraPacienteOdontograma(int ID)
        {
            try
            {
                using (dbodontogramaEntity cn = new dbodontogramaEntity())
                {
                    paciente item = new paciente();
                    item = (from p in cn.paciente join c in cn.atencion on p.pacienteID equals c.pacienteID
                            join ct in cn.atencion_detalle on c.atencionID equals ct.atencionID
                            join od in cn.odontograma_detalle on ct.odontogramaID equals od.odontogramaID
                            join o in cn.odontograma on od.odontogramaID equals o.odontogramaID
                            where p.estado == 1 && o.odontogramaID == ID
                            select p).First();
                    EPaciente Obj = new EPaciente();
                    Obj.pacienteID      = item.pacienteID;
                    Obj.nombre          = item.nombre;
                    Obj.apellido        = item.apellido;
                    Obj.telefono        = item.telefono;
                    Obj.ci              = item.ci;
                    Obj.fechaNacimiento = item.fechaNacimiento;
                    Obj.direccion       = item.direccion;
                    Obj.sexo            = item.sexo;
                    Obj.estado          = item.estado;


                    return(Obj);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 6
0
        public async Task <byte[]> getExame(paciente pac)
        {
            try
            {
                var jsonRequest = JsonConvert.SerializeObject(pac);
                var httpContent = new StringContent(jsonRequest, Encoding.UTF8, "application/json");
                var client      = new HttpClient();
                client.BaseAddress = new Uri("https://www.painelstudio.com/perboyre/");
                var url      = "api/Paciente/getImagem";
                var response = await client.PostAsync(url, httpContent);

                if (!response.IsSuccessStatusCode)
                {
                    return(null);
                }

                var result = await response.Content.ReadAsStringAsync();

                byte[] exames = JsonConvert.DeserializeObject <byte[]>(result);
                return(exames);
            }
            catch (Exception ex)
            {
                return(null);

                /*return new Response
                 * {
                 *  IsSuccess = false,
                 *  Message = ex.Message,
                 * };
                 * throw;*/
            }
        }
Exemplo n.º 7
0
        public async Task <paciente> PacienteAsync(string id)
        {
            //Se configura la petición.
            var            resp = new paciente();
            HttpWebRequest peticion;

            peticion             = WebRequest.Create($"{url}{id}") as HttpWebRequest;
            peticion.ContentType = "application/json; charset=utf-8";
            peticion.Method      = "GET";
            try
            {
                HttpWebResponse respuesta = peticion.GetResponse() as HttpWebResponse;
                if ((int)respuesta.StatusCode == 200)
                {
                    var    reader = new StreamReader(respuesta.GetResponseStream());
                    string s      = reader.ReadToEnd();
                    Paciente = new paciente();
                    await Task.Run(() => { resp = JsonConvert.DeserializeObject <paciente>(s); });

                    error = respuesta.StatusCode.ToString();
                }
                else
                {
                    error = $" Error {respuesta.StatusCode}";
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(resp);
        }
Exemplo n.º 8
0
        public ActionResult Informacion([Bind(Include = "pacienteid,nombres,apellidop,apellidom,fechanac,sexo,estadocivil,telefonos,correo,referente,calle,numext,numint,colonia,localidad,municipio,ciudad,ciudadorigen,estado,pais,nombrepadre,nombremadre,ultimaconsulta,peso,talla,nivelactividad")] paciente paciente)
        {
            if (ModelState.IsValid)
            {
                if (paciente.pacienteid > 0)
                {
                    db.Entry(paciente).State = EntityState.Modified;
                }
                else
                {
                    db.paciente.Add(paciente);

                    //Si es alta, se crea tambien el registro de historia
                    historias historia = new historias();
                    historia.pacienteid = paciente.pacienteid;
                    historia.historia   = "";

                    db.historias.Add(historia);
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(paciente));
        }
Exemplo n.º 9
0
        // GET: pacientes/Informacion
        public ActionResult Informacion(long?id)
        {
            //Se manda lista de actividades
            ViewBag.datasource = ActividadesLista.GetActividadLista();

            if (id == null)
            {
                //Se notifica que es alta
                ViewBag.Message = "alta";

                return(View());
            }

            paciente paciente = db.paciente.Find(id);

            if (paciente == null)
            {
                return(HttpNotFound());
            }

            //Se notifica que es modificacion
            ViewBag.Message = "modificacion";
            ViewBag.id      = id;

            return(View(paciente));
        }
Exemplo n.º 10
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            examenesModel.id_examenes = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);

            using (laboratorio_pEntities DB = new laboratorio_pEntities())
            {
                try
                {
                    examenesModel = DB.examenes.Where(x => x.id_examenes == examenesModel.id_examenes).FirstOrDefault();
                    MessageBox.Show("Seleccionado el examen con fecha: " + examenesModel.fecha.ToShortDateString(), "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    /* SELECCIONAR DATOS DE EXAMENES */
                    paciente getPaciente = new paciente();
                    dataGridView1.Rows.Clear();
                    var query   = DB.examenes.Where(m => m.id_paciente == pacienteModel.id_paciente);
                    var listado = query.ToList();
                    foreach (var reg in listado)
                    {
                        dataGridView1.Rows.Add(reg.id_examenes, reg.id_orina, reg.id_heces, reg.id_hemograma, reg.fecha.ToShortDateString());
                    }
                    /* FIN SELECCION DE EXAMENES */
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 11
0
 private void btnBuscarPaciente_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(txtID.Text))
     {
         MessageBox.Show("No ha puesto ninguna ID para buscar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     else
     {
         string mensaje = Program.gestion.buscarPacientoPorID(txtID.Text);
         if (String.IsNullOrWhiteSpace(mensaje))
         {
             paciente pacienteBuscado = Program.gestion.encontradoPacientoPorID(txtID.Text);
             txtID.Text                  = "";
             txtLocalidad.Text           = pacienteBuscado.localidad;
             txtNombre.Text              = pacienteBuscado.nombreCompleto;
             txtTelefono.Text            = pacienteBuscado.telefono;
             txtDireccion.Text           = pacienteBuscado.direccion;
             grpPacienteDatos.Visible    = true;
             grpBuscarPacienteID.Visible = false;
         }
         else
         {
             MessageBox.Show(mensaje, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 12
0
 public void Desativar(Paciente p, Fisioterapeuta f)
 {
     if (p != null && f == null)
     {
         paciente bdp = new paciente
         {
             id_pac = p.GetIdPessoa
         };
         Paciente_Negocios bp = new Paciente_Negocios();
         bp.Desativar(bdp);
     }
     else if (f != null && p == null)
     {
         fisioterapeuta bdf = new fisioterapeuta
         {
             id_fis    = f.GetIdPessoa,
             nome_fis  = f.nome,
             cel_fis   = f.telCelular,
             cpf_fis   = f.cpf,
             rg_fis    = f.rg,
             email_fis = f.email,
             nasc_fis  = f.dataDeAniversario
         };
         Fisioterapeuta_Negocios bf = new Fisioterapeuta_Negocios();
         bf.Desativar(bdf);
     }
 }
Exemplo n.º 13
0
 public string updatePaciente(paciente pacienteElegido)
 {
     if (pacienteElegido == null)
     {
         return("El paciente está vacio");
     }
     if (String.IsNullOrWhiteSpace(pacienteElegido.nombreCompleto) || String.IsNullOrWhiteSpace(pacienteElegido.direccion) || String.IsNullOrWhiteSpace(pacienteElegido.localidad) || String.IsNullOrWhiteSpace(pacienteElegido.telefono))
     {
         return("Te faltan datos");
     }
     try
     {
         int numero = contexto.SaveChanges();
         if (numero != 0)
         {
             return("");
         }
         else
         {
             return("Error al actualizar el paciente");
         }
     }
     catch (Exception exc)
     {
         return("Error al actualizar el paciente: " + exc.Message);
     }
 }
Exemplo n.º 14
0
        public ActionResult Index(int?id, int?paciente)
        {
            var espirometria = db.espirometria.Include(e => e.paciente);

            if (id != null)
            {
                espirometria = espirometria.Where(e => e.esp_paciente == id);
            }
            if (paciente != null)
            {
                espirometria = espirometria.Where(e => e.esp_paciente == paciente);
            }

            if (User.IsInRole("paciente"))
            {
                string   cedula    = Convert.ToString(User.Identity.Name);
                paciente paciente_ = db.paciente.Where(p => p.pac_cedula == cedula).First();
                espirometria = espirometria.Where(e => e.esp_paciente == paciente_.pac_id);
            }
            if (User.IsInRole("empresa"))
            {
                string  cedula  = Convert.ToString(User.Identity.Name);
                empresa empresa = db.empresa.Where(e => e.emp_cedula == cedula).First();
                espirometria = espirometria.Where(e => e.paciente.pac_empresa == empresa.emp_id);
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Index_historia", espirometria.ToList()));
            }
            return(View(espirometria.ToList()));
        }
        public async void Initialize(INavigationParameters parameters)
        {
            _paciente = (paciente)parameters["paciente"];
            titulo    = _paciente.nome;

            await GetExames();
        }
Exemplo n.º 16
0
        public ActionResult Index(int?id, int?paciente)
        {
            var audiometria = db.audiometria.Include(a => a.paciente);

            if (id != null)
            {
                audiometria = audiometria.Where(a => a.aud_paciente == id);
            }
            if (paciente != null)
            {
                audiometria = audiometria.Where(a => a.aud_paciente == paciente);
            }

            //if (!String.IsNullOrEmpty(fecha))
            //    audiometria = audiometria.Where(a => a.aud_fecha == fecha);
            if (User.IsInRole("paciente"))
            {
                string   cedula    = Convert.ToString(User.Identity.Name);
                paciente paciente_ = db.paciente.Where(p => p.pac_cedula == cedula).First();
                audiometria = audiometria.Where(a => a.aud_paciente == paciente_.pac_id);
            }
            if (User.IsInRole("empresa"))
            {
                string  cedula  = Convert.ToString(User.Identity.Name);
                empresa empresa = db.empresa.Where(e => e.emp_cedula == cedula).First();
                audiometria = audiometria.Where(a => a.paciente.pac_empresa == empresa.emp_id);
            }


            if (Request.IsAjaxRequest())
            {
                return(PartialView("Index_historia", audiometria.ToList()));
            }
            return(View(audiometria.ToList()));
        }
Exemplo n.º 17
0
 public ActionResult Edit(paciente paciente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(paciente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.pac_canton                 = new SelectList(db.canton, "can_id", "can_nombre", paciente.pac_canton);
     ViewBag.pac_empresa                = new SelectList(db.empresa, "emp_id", "emp_nombre", paciente.pac_empresa);
     ViewBag.pac_pais                   = new SelectList(db.pais, "pais_id", "pais_nombre", paciente.pac_pais);
     ViewBag.pac_profesion              = new SelectList(db.profesion, "pro_id", "pro_nombre", paciente.pac_profesion);
     ViewBag.pac_provincia              = new SelectList(db.provincia, "pro_id", "pro_nombre", paciente.pac_provincia);
     ViewBag.pac_genero                 = this.genero(paciente);
     ViewBag.pac_estadocivil            = this.estadocivil(paciente);
     ViewBag.pac_instruccion            = this.instruccion(paciente);
     ViewBag.pac_tipodiscapacidad       = this.tipodiscapacidad(paciente);
     ViewBag.pac_porcentajediscapacidad = this.porcentajediscapacidad(paciente);
     if (paciente.pac_fechanacimiento != null)
     {
         string[] fecha = paciente.pac_fechanacimiento.Split('/');
         ViewBag.dia  = dia(fecha[0]);
         ViewBag.mes  = mes(fecha[1]);
         ViewBag.anio = anio(fecha[2]);
     }
     else
     {
         ViewBag.dia  = dia("");
         ViewBag.mes  = mes("");
         ViewBag.anio = anio("");
     }
     return(View(paciente));
 }
Exemplo n.º 18
0
        /*Método de cadastro*/
        public paciente SalvarPaciente(paciente paciente)
        {
            try
            {
                /*Caso o id do paciente for igual a zero, adicione ele a tabela pacientes*/
                if (paciente.id_pac == 0)
                {
                    db.pacientes.Add(paciente);
                }
                else
                {
                    /*Senão, atualize ou sobreponha os registros alterados*/
                    db.pacientes.Attach(paciente);
                    db.Entry(pacientes).State = System.Data.Entity.EntityState.Modified;
                }
                /*Salvando as alterações*/
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }

            return(paciente);
        }
Exemplo n.º 19
0
 public void SalvarPaciente(paciente paciente)
 {
     if (paciente != null)
     {
         dp.SalvarPaciente(paciente);
     }
 }
        public ActionResult Edit(paciente paciente)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                using (var db = new testDataBaseEntities1())
                {
                    paciente pacienteEditar = db.paciente.Find(paciente.id);

                    pacienteEditar.altura   = new decimal(0.00);
                    pacienteEditar.peso     = new decimal(0.00);
                    pacienteEditar.nombre   = paciente.nombre;
                    pacienteEditar.apellido = paciente.apellido;

                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", "Ha ocurrido un error puntual: " + ex.Message);
                return(View());
            }
        }
        public ActionResult Create(paciente paciente)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                using (var db = new testDataBaseEntities1())
                {
                    int count = db.paciente.Count();
                    paciente.id     = count + 1;
                    paciente.altura = new Decimal(0.00);
                    paciente.peso   = new Decimal(0.00);
                    db.paciente.Add(paciente);
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", "Error al agregar Alumno: " + ex.Message);
                return(View());
            }
        }
Exemplo n.º 22
0
    // Use this for initialization
    void Start()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            dataPath = System.IO.Path.Combine(Application.persistentDataPath, "pacientes.xml");
            //dataPath = "../pacientes.xml";
            Debug.Log(dataPath);
        }
        else
        {
            //dataPath = System.IO.Path.Combine (Application.persistentDataPath, "Reources/pacientes.xml");
            dataPath = "pacientes.xml";

            //dataPath = System.IO.Path.Combine (Application.persistentDataPath, "/pacientes.xml");
            Debug.Log(dataPath);
        }

        paciente          p = new paciente();
        pacienteContainer e = new pacienteContainer();

        p.nome       = nome;
        p.moedas     = moedas;
        p.nascimento = nascimento;
        p.sexo       = sexo;
        p.info       = informacoes;

        e.pacientes.Add(p);

        SaveXML(dataPath, e);
    }
Exemplo n.º 23
0
 public paciente encontradoPacientoPorID(string id)
 {
     if (int.TryParse(id, out int numero))
     {
         try
         {
             var paciente = contexto.pacientes.ToList().Where(pac => pac.id == numero).ToList();
             if (paciente.Count() != 0)
             {
                 return(paciente[0]);
             }
             else
             {
                 paciente pacienteVacio = new paciente("Error no ha sido encontrado ningún paciente con esa id", "Error", "Error", "Error");
                 return(pacienteVacio);
             }
         }
         catch (Exception exc)
         {
             paciente pacienteVacio = new paciente("Error en la BD por favor contacte con un Administrador del Programa.", "Error", "Error", "Error");
             return(pacienteVacio);
         }
     }
     else
     {
         paciente pacienteVacio = new paciente("Error no pusiste un numero en la ID", "Error", "Error", "Error");
         return(pacienteVacio);
     }
 }
Exemplo n.º 24
0
        private void dgvPacientes_DoubleClick(object sender, EventArgs e)
        {
            pacienteModel.id_paciente = Convert.ToInt32(dgvPacientes.CurrentRow.Cells[0].Value);

            using (laboratorio_pEntities DB = new laboratorio_pEntities())
            {
                try
                {
                    pacienteModel = DB.paciente.Where(x => x.id_paciente == pacienteModel.id_paciente).FirstOrDefault();

                    txtNombre.Text        = pacienteModel.nombre;
                    dateTimePicker1.Value = Convert.ToDateTime(pacienteModel.fecha_nacimiento);
                    txtCodigo.Text        = pacienteModel.codigo;

                    cbbCampania.SelectedValue = pacienteModel.id_campaña;
                    if (pacienteModel.genero.Equals("Masculino	"))
                    {
                        cbbGenero.SelectedIndex = 0;
                    }
                    else if (pacienteModel.genero.Equals("Femenino"))
                    {
                        cbbGenero.SelectedIndex = 1;
                    }
                    btnGuardar.Text     = "Modificar";
                    btnGuardar.Image    = Properties.Resources.editar;
                    btnEliminar.Enabled = true;
                    btnCancelar.Enabled = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 25
0
        public ActionResult DeleteConfirmed(string id)
        {
            paciente paciente = db.paciente.Find(id);

            db.paciente.Remove(paciente);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 26
0
 public void Desativar(paciente paciente)
 {
     if (paciente == null)
     {
         throw new Exception("Paciente vazio");
     }
     dp.Desativar(paciente.id_pac);
 }
Exemplo n.º 27
0
 public ActionResult Edit([Bind(Include = "id_paciente,tip_doc,nom_paciente,dir_paciente,tel_paciente,cel_paciente,activo")] paciente paciente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(paciente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(paciente));
 }
Exemplo n.º 28
0
 public ActionResult Edit([Bind(Include = "cedula,nombre,apellido,fechaNacimiento,tipoSangre")] paciente paciente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(paciente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(paciente));
 }
Exemplo n.º 29
0
        //
        // GET: /Paciente/Delete/5

        public ActionResult Delete(int id = 0)
        {
            paciente paciente = db.paciente.Find(id);

            if (paciente == null)
            {
                return(HttpNotFound());
            }
            return(View(paciente));
        }
Exemplo n.º 30
0
 public ActionResult Edit([Bind(Include = "Id_Paciente,Cedula,Nombre,Apellido,Fecha_Nacimiento,Tipo_Sangre")] paciente paciente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(paciente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(paciente));
 }