public static void Cargar_Historia(string Identificacion_Paciente) { Historia_Paciente.Clear(); //Instanciamos la clase que carga los datos del paciente var _Medico = new Cls_Colecciones_Datos(); Oper_Paciente oper_Paciente = new Oper_Paciente(); var _Paciente = oper_Paciente.Buscar_Paciente_(Identificacion_Paciente); Cls_AtencionAgregada.CargarAtenciones_Atendidas(Identificacion_Paciente); var Atenciones_Atendidas = Cls_AtencionAgregada.Atencion_Cargadas_Atendidas; foreach (Cls_Atencion item in Atenciones_Atendidas) { Historia_Paciente.Add(item); } }
void text_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (DgvPendientes.CurrentCell.ColumnIndex == DgvPendientesColDocumento.Index) { Oper_Paciente _Paciente = new Oper_Paciente(); var _pacienteD = new Cls_Paciente(); _pacienteD = _Paciente.Buscar_Paciente_(Cls_Convertir.Convertir_Null_String(DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesColDocumento"])); if (_pacienteD.Pac_Identificacion != null) { DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesNombrecompleto"].Value = _pacienteD.Pac_Nombre_Completo; DgvPendientes.CurrentCell = DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesMotivo"]; } else { MessageBox.Show("Sin resultados"); DgvPendientes.CurrentCell = DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesColDocumento"]; } } } }
public async void BuscarPaciente_(string Documento_) { Oper_Paciente oper_Paciente = new Oper_Paciente(); var _paciente = oper_Paciente.Buscar_Paciente_(TxtDocumento.Text); if (_paciente.Pac_TipoIdentificacion == null) { documentoPaciente = TxtDocumento.Text; Accion = "guardar"; Guardar_o_Modificar = true; IndicadorOcupado.Visible = false; ModoEdicion.Visible = false; Limpiar(); MessageBox.Show("No se ha encontrado paciente"); return; } documentoPaciente = TxtDocumento.Text; Accion = "modificar"; ModoEdicion.Visible = true; IdPacienteTra = TxtDocumento.Text; Guardar_o_Modificar = false; CboTipoDocumento.SelectedValue = _paciente.Pac_TipoIdentificacion.TipoIde_Codigo; Cbo_Departamento.SelectedValue = _paciente.Pac_CodDepto.Dept_Codigo; //CARGAR COMBO DE CIUDADES IndicadorOcupado.Visible = true; //MessageBox.Show(Cbo_Departamento.SelectedValue.ToString()); var _Ciudad = await colecciones_Datos.Cargar_Ciudad(Cbo_Departamento.SelectedValue.ToString()); Cbo_Municipio.DataSource = _Ciudad; Cbo_Municipio.DisplayMember = "Ciud_Nombre"; Cbo_Municipio.ValueMember = "Ciud_Codigo"; IndicadorOcupado.Visible = false; Cbo_Municipio.SelectedValue = _paciente.Pac_CodCiudad.Ciud_Codigo; Cbo_NiverEducativo.SelectedValue = _paciente.Pac_CodNivelEducativo.NivEdu_Codigo; Cbo_Profesion.SelectedValue = _paciente.Pac_CodProfesion.Prof_Codigo; CboEPS.SelectedValue = _paciente.Pac_CodEPS.Eps_Codigo; CboARL.SelectedValue = _paciente.Pac_CodARL.Arl_Codigo; numeroDocumentoPaciete = Documento_; TxtNombre1.Text = _paciente.Pac_Nombre1; TxtNombre2.Text = _paciente.Pac_Nombre2; TxtApellido1.Text = _paciente.Pac_Apellido1; TxtApellido2.Text = _paciente.Pac_Apellido2; DtFechaNacimiento.Text = _paciente.Pac_FechaNacimiento.ToString(); TxtEdad.Text = CalcularEdad(Convert.ToDateTime(DtFechaNacimiento.Text)).ToString(); CboGenero.SelectedValue = _paciente.Pac_CodGenero.Gen_Codigo; TxtDireccion.Text = _paciente.Pac_Direccion; CboTipoSangre.SelectedValue = _paciente.Pac_TipoSangre.TipSan_Codigo; CboEstadoCivil.SelectedValue = _paciente.Pac_EstadoCivil.EstCivil_Codigo; TxtTelefono.Text = _paciente.Pac_Telefono; CboDominancia.SelectedValue = _paciente.Pac_Dominancia_Codigo.Dom_Codigo; // El campo productImage primero se almacena en un buffer if (_paciente.Pac_Foto != null) { // Se utiliza el MemoryStream para extraer la imagen this.PctFoto.Image = Image.FromStream(_paciente.Pac_Foto); } if (_paciente.Pac_Huella != null) { // Se utiliza el MemoryStream para extraer la imagen this.PctHuella.Image = Image.FromStream(_paciente.Pac_Huella); } if (_paciente.Pac_Firma != null) { // Se utiliza el MemoryStream para extraer la imagen this.Pt_Firma.Image = Image.FromStream(_paciente.Pac_Firma); } }
private void BtnGuardar_Click(object sender, EventArgs e) { //IndicadorOcupado.Visible = true; if (TxtDocumento.Text.Trim() == "") { TxtDocumento.Focus(); MessageBox.Show("Ingrese un numero de documento"); return; } if (TxtNombre1.Text.Trim() == "") { TxtNombre1.Focus(); MessageBox.Show("Ingrese el primer nombre del paciente"); return; } if (TxtApellido1.Text.Trim() == "") { TxtApellido1.Focus(); MessageBox.Show("Ingrese el primer apellido del paciente"); return; } if (Cbo_Municipio.SelectedValue == null) { Cbo_Municipio.Focus(); MessageBox.Show("Seleccionar un municipio"); return; } if (MessageBox.Show("¿Desea " + Accion + " el paciente?", "Continuar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } //se comiensa a guardar los datos del paciente que sera agregado var _Paciente = new Cls_Paciente(); _Paciente.Pac_TipoIdentificacion = new Cls_TipoDocumento { TipoIde_Codigo = CboTipoDocumento.SelectedValue.ToString(), TipoIde_Descripcion = CboTipoDocumento.Text }; _Paciente.Pac_Identificacion = TxtDocumento.Text; _Paciente.Pac_Nombre1 = TxtNombre1.Text; _Paciente.Pac_Nombre2 = TxtNombre2.Text; _Paciente.Pac_Apellido1 = TxtApellido1.Text; _Paciente.Pac_Apellido2 = TxtApellido2.Text; _Paciente.Pac_FechaNacimiento = Convert.ToDateTime(DtFechaNacimiento.Value.ToShortDateString()); _Paciente.Pac_Fecha = Convert.ToDateTime(DtFechaNacimiento.Value.ToShortDateString()); _Paciente.Pac_CodGenero = new Cls_Genero { Gen_Codigo = CboGenero.SelectedValue.ToString(), Gen_Descripcion = CboGenero.Text }; _Paciente.Pac_CodDepto = new Cls_Departamento { Dept_Codigo = Cbo_Departamento.SelectedValue.ToString(), Dept_Nombre = Cbo_Departamento.Text }; _Paciente.Pac_CodCiudad = new Cls_Ciudad { Ciud_Codigo = Cbo_Municipio.SelectedValue.ToString(), Ciud_Nombre = Cbo_Municipio.Text }; _Paciente.Pac_Direccion = TxtDireccion.Text; _Paciente.Pac_CodNivelEducativo = new Cls_NivelEducativo { NivEdu_Codigo = int.Parse(Cbo_NiverEducativo.SelectedValue.ToString()), NivEdu_Descripcion = Cbo_NiverEducativo.Text }; _Paciente.Pac_CodProfesion = new Cls_Profesion { Prof_Codigo = int.Parse(Cbo_Profesion.SelectedValue.ToString()), Prof_Descripcion = Cbo_Profesion.Text }; _Paciente.Pac_TipoSangre = new Cls_TipoSangre { TipSan_Codigo = int.Parse(CboTipoSangre.SelectedValue.ToString()), TipSan_Descripcion = CboTipoSangre.Text }; _Paciente.Pac_EstadoCivil = new Cls_EstadoCivil { EstCivil_Codigo = Convert.ToInt32(CboEstadoCivil.SelectedValue), EstCivil_Descripcion = CboEstadoCivil.Text }; _Paciente.Pac_Telefono = TxtTelefono.Text; _Paciente.Pac_Dominancia_Codigo = new Cls_Dominancia { Dom_Codigo = Convert.ToInt32(CboDominancia.SelectedValue), Dom_Descripcion = CboDominancia.Text }; _Paciente.Pac_CodEPS = new Cls_Eps { Eps_Codigo = Convert.ToInt32(CboEPS.SelectedValue), Eps_Descripcion = CboEPS.Text }; _Paciente.Pac_CodARL = new Cls_Arl { Arl_Codigo = Convert.ToInt32(CboARL.SelectedValue), Arl_Descripcion = CboARL.Text }; string[] fecha = DateTime.Now.ToString().Split(' '); _Paciente.Pac_Fecha = DateTime.Now; if (PctHuella.Image != null) { System.IO.MemoryStream ms1 = new System.IO.MemoryStream(); PctHuella.Image.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg); _Paciente.Pac_Huella = ms1; } else { _Paciente.Pac_Huella = null; } if (PctFoto.Image != null) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); PctFoto.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); _Paciente.Pac_Foto = ms; } else { _Paciente.Pac_Foto = null; } if (Pt_Firma.Image != null) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); Pt_Firma.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); _Paciente.Pac_Firma = ms; } else { _Paciente.Pac_Firma = null; } //Fin //Se crea el objeto que contiene los metodos de agregar, actualizar y cargar Oper_Paciente oper_Paciente = new Oper_Paciente(); //Guardar_o_Modificar indica que operacion se va a realizar... True agrega y False actualiza if (Guardar_o_Modificar == true) { //Se agrega el paciente oper_Paciente.Insertar_Paciente(_Paciente); //Confirmamos que la operacion finalizada correctamente para almacenar el paciente en la lista if (oper_Paciente.error == "Datos guardados") { //Se agrega el paciente a la lista Cls_PacienteAgregado.cls_PacienteNuevos.Add(_Paciente); } else { //Si no se finaliza correctamente retornamos al metodo return; } } else { //Actualiza los datos del paciente si es el caso oper_Paciente.Actualizar_Paciente(_Paciente, documentoPaciente); } //Mostramos el mensaje que nos devuelve la clase MessageBox.Show(oper_Paciente.error); //Limpiamos los campos Limpiar(); //Se activa el focus de control del documento TxtDocumento.Focus(); }
public static void CargarAtenciones_Atendidas(string Identiicacion) { Atencion_Cargadas_Atendidas.Clear(); string sql = "SELECT dbo.Atencion_Historia.Entr_Numero," + "dbo.Atencion_Historia.Entr_IdPaciente, " + "dbo.Atencion_Historia.Entr_FechaEntrada, " + "dbo.Atencion_Historia.Entr_Hora, " + "dbo.Atencion_Historia.Ent_Estado, " + "dbo.Atencion_Historia.Ent_MotivoConsulta, " + "dbo.Atencion_Historia.Ent_CodMedico, " + "dbo.Paciente.Pac_Nombre1, " + "dbo.Paciente.Pac_Nombre2, " + "dbo.Paciente.Pac_Apellido1, " + "dbo.Paciente.Pac_Apellido2 " + "FROM dbo.Atencion_Historia INNER JOIN " + "dbo.Paciente ON dbo.Atencion_Historia.Entr_IdPaciente " + "= dbo.Paciente.Pac_Identificacion WHERE Pac_Identificacion='" + Identiicacion + "'";// and Ent_Estado<>" + Cls_Estados_Atencion.Pendiente; DataTable tablaAtencion = new DataTable(); tablaAtencion = ClsSqlServer.LlenarTabla(sql); Oper_Paciente oper_Paciente = new Oper_Paciente(); var _Paciente = oper_Paciente.Buscar_Paciente_(Identiicacion); var _Atencion_Detalle = new Cls_Detalle_Atencion(); if (tablaAtencion.Rows.Count > 0) { foreach (DataRow item in tablaAtencion.Rows) { Atencion_Cargadas_Atendidas.Add(new Cls_Atencion { Entr_Numero = Convert.ToInt32(item["Entr_Numero"]), Entr_IdPaciente = _Paciente, Entr_FechaEntrada = Convert.ToDateTime(item["Entr_FechaEntrada"].ToString()), Entr_Hora = Convert.ToDateTime(item["Entr_Hora"].ToString()), Ent_MotivoConsulta = item["Ent_MotivoConsulta"].ToString(), Ent_Estado = new Cls_Estados_Atencion2 { EstAten_Codigo = Convert.ToInt32(item["Ent_Estado"].ToString()) }, Ent_CodMedico = new Cls_Medico { Medic_Identificacion = item["Ent_CodMedico"].ToString(), Medic_Nombre1 = "Falta asignar el nombre" }, Ent_Habito_Detalle = _Atencion_Detalle._HabitoDetalle(Convert.ToInt32(item["Entr_Numero"])), Ent_AntecedenteFamiliar_Detalle = _Atencion_Detalle._AntecedenteFamiliar_Detalle(Convert.ToInt32(item["Entr_Numero"])), Ent_Antecedentepersonales_Detalle = _Atencion_Detalle._AntecedentePersonales_Detalle(Convert.ToInt32(item["Entr_Numero"])), Ent_HistoriaPeso_Detalle = _Atencion_Detalle._HistorialPeso_Detalle(Convert.ToInt32(item["Entr_Numero"])), Ent_Antropometria_Detalle = _Atencion_Detalle._Antropometria_Detalle(Convert.ToInt32(item["Entr_Numero"])), Ent_Recordatorio_Detalle = _Atencion_Detalle._Recordatorio_Detalle(Convert.ToInt32(item["Entr_Numero"])), Ent_FrecuenciaConsumo_Detalle = _Atencion_Detalle._FrecuenciaConsumo_Detalle(Convert.ToInt32(item["Entr_Numero"])) }); } } else { Atencion_Cargadas_Atendidas.Add(new Cls_Atencion { Entr_IdPaciente = _Paciente }); } }