private void CargarPlantilla() { try { var diccionario = new Dictionary <string, string>(); diccionario.Add("<<encabezado1>>", encabezado1); diccionario.Add("<<encabezado2>>", encabezado2); diccionario.Add("<<encabezado3>>", "Atención de Interno"); diccionario.Add("<<expediente>>", string.Format("{0}/{1}", SelectedAtencionCita.ID_ANIO, selectedAtencionCita.ID_IMPUTADO)); var imputado = SelectedAtencionCita.INGRESO.IMPUTADO; diccionario.Add("<<nombre>>", string.Format("{0} {1} {2}", imputado.NOMBRE.Trim(), !string.IsNullOrEmpty(imputado.PATERNO) ? imputado.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(imputado.MATERNO) ? imputado.MATERNO.Trim() : string.Empty)); var documento = new cImputadoTipoDocumento().Obtener((short)enumTipoDocumentoImputado.ATENCION_INTERNO); if (documento == null) { new Dialogos().ConfirmacionDialogo("Validación", "No se encontro la plantilla del documento"); return; } var d = new cWord().FillFieldsDocx(documento.DOCUMENTO, diccionario); //var ib = selectedAtencionCita.INGRESO.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO).FirstOrDefault(); //var d = new cWord().FillFields(Parametro.PLANTILLA_ATENCION_INTERNO, diccionario);//.FillFields(Parametro.PLANTILLA_ATENCION_INTERNO, diccionario, logo1, logo2, ib.BIOMETRICO); Editor.Load(d, BinaryStreamType.WordprocessingML); } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar reporte de atención recibida", ex); } }
private void ImprimirCitatorioInterno() { try { if (SelectIncidentesCumplimentar == null) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar una sanción"); return; } var documento = new cImputadoTipoDocumento().Obtener((short)enumTipoDocumentoImputado.CITATORIO_INTERNO); if (documento == null) { new Dialogos().ConfirmacionDialogo("Validación", "No se encontro la plantilla del documento"); return; } if (documento.DOCUMENTO == null) { new Dialogos().ConfirmacionDialogo("Validación", "No se encontro la plantilla del documento"); return; } var diccionario = new Dictionary <string, string>(); diccionario.Add("<<encabezado1>>", Parametro.ENCABEZADO1); diccionario.Add("<<encabezado2>>", Parametro.ENCABEZADO2); var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault(); diccionario.Add("<<centro>>", centro.DESCR.Trim()); var hoy = Fechas.GetFechaDateServer; diccionario.Add("<<horas>>", hoy.ToString("hh:mm")); diccionario.Add("<<dia>>", hoy.Day.ToString()); CultureInfo cultura = new CultureInfo("es-MX"); diccionario.Add("<<mes>>", cultura.DateTimeFormat.GetMonthName(hoy.Month)); diccionario.Add("<<anio>>", hoy.Year.ToString()); diccionario.Add("<<interno>>", string.Format("{0} {1} {2}", SelectIncidentesCumplimentar.Nombre.Trim(), !string.IsNullOrEmpty(SelectIncidentesCumplimentar.Paterno) ? SelectIncidentesCumplimentar.Paterno.Trim() : string.Empty, !string.IsNullOrEmpty(SelectIncidentesCumplimentar.Materno) ? SelectIncidentesCumplimentar.Materno.Trim() : string.Empty)); diccionario.Add("<<motivo>>", SelectIncidentesCumplimentar.Motivo.Trim()); diccionario.Add("<<fracciones>>", " "); diccionario.Add("<<firma_policia>>", " "); diccionario.Add("<<signado>>", " "); var docto = new cWord().FillFieldsDocx(documento.DOCUMENTO, diccionario); var tc = new TextControlView(); PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); tc.editor.Loaded += (s, e) => { try { switch (documento.ID_FORMATO) { case 1: //DOCX tc.editor.Load(docto, TXTextControl.BinaryStreamType.WordprocessingML); break; case 3: //PDF tc.editor.Load(docto, TXTextControl.BinaryStreamType.AdobePDF); break; case 4: //DOCX tc.editor.Load(docto, TXTextControl.BinaryStreamType.WordprocessingML); break; default: new Dialogos().ConfirmacionDialogo("Notificación!", "Formato de archivo no válido"); break; } } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al mostrar el documento", ex); } }; tc.Owner = PopUpsViewModels.MainWindow; tc.Closed += (s, e) => { PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); }; PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); tc.Show(); } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar datos", ex); } }
private void ImprimirActa() { try { if (SelectIncidentesCumplimentar == null) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar una sanción"); return; } var documento = new cImputadoTipoDocumento().Obtener((short)enumTipoDocumentoImputado.ACTA_CONSEJO_TECNICO_INTERDICIPLINARIO); if (documento == null) { new Dialogos().ConfirmacionDialogo("Validación", "No se encontro la plantilla del documento"); return; } using (var ms = new MemoryStream()) { ms.Write(documento.DOCUMENTO, 0, documento.DOCUMENTO.Length); using (DocX doc = DocX.Load(ms)) { var fecha = SelectIncidentesCumplimentar.Autorizacion_Fecha; doc.ReplaceText("{hora}", fecha.Value.Hour + ":" + fecha.Value.Minute); doc.ReplaceText("{dia}", fecha.Value.Day.ToString()); CultureInfo cultura = new CultureInfo("es-MX"); doc.ReplaceText("{mes}", cultura.DateTimeFormat.GetMonthName(fecha.Value.Month)); doc.ReplaceText("{anio}", fecha.Value.Year.ToString()); var incidente = new cIncidente().ObtenerTodas( SelectIncidentesCumplimentar.Id_Centro, SelectIncidentesCumplimentar.Id_Anio, SelectIncidentesCumplimentar.Id_Imputado, SelectIncidentesCumplimentar.Id_Ingreso, SelectIncidentesCumplimentar.Id_Incidente ).FirstOrDefault(); if (incidente != null) { var interno = incidente.INGRESO.IMPUTADO; doc.ReplaceText("{interno}", string.Format("{0} {1} {2}", interno.NOMBRE.Trim(), !string.IsNullOrEmpty(interno.PATERNO) ? interno.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(interno.MATERNO) ? interno.MATERNO.Trim() : string.Empty)); if (incidente.SANCION != null) { var fmenor = incidente.SANCION.OrderBy(w => w.INICIA_FEC).FirstOrDefault(); var fmayor = incidente.SANCION.OrderByDescending(w => w.TERMINA_FEC).FirstOrDefault(); if (fmenor != null && fmayor != null) { doc.ReplaceText("{fecha_inicio}", string.Format("{0:dd/MM/yyyy}", fmenor.INICIA_FEC)); doc.ReplaceText("{fecha_fin}", string.Format("{0:dd/MM/yyyy}", fmayor.TERMINA_FEC)); var t = (fmayor.TERMINA_FEC.Value.Date - fmenor.INICIA_FEC.Value.Date).TotalDays; doc.ReplaceText("{días_sancion}", t.ToString()); } foreach (var s in incidente.SANCION) { switch (s.ID_SANCION) { case 2: doc.ReplaceText("{1}", "X"); doc.ReplaceText("{2}", "X"); break; case 3: doc.ReplaceText("{3}", "X"); break; case 4: doc.ReplaceText("{4}", "X"); break; case 5: doc.ReplaceText("{5}", "X"); break; case 9: doc.ReplaceText("{7}", "X"); break; case 10: doc.ReplaceText("{8}", "X"); break; case 11: doc.ReplaceText("{9}", "X"); break; case 12: doc.ReplaceText("{10}", "X"); doc.ReplaceText("{11}", "X"); break; } } } } doc.ReplaceText("{1}", " "); doc.ReplaceText("{2}", " "); doc.ReplaceText("{3}", " "); doc.ReplaceText("{4}", " "); doc.ReplaceText("{5}", " "); doc.ReplaceText("{6}", " "); doc.ReplaceText("{7}", " "); doc.ReplaceText("{8}", " "); doc.ReplaceText("{9}", " "); doc.ReplaceText("{10}", " "); doc.ReplaceText("{11}", " "); doc.ReplaceText("{12}", " "); doc.ReplaceText("{días_sancion}", " "); doc.ReplaceText("{fecha_inicio}", " "); doc.ReplaceText("{fecha_fin}", " "); doc.Save(); } var tc = new TextControlView(); PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); tc.editor.Loaded += (s, e) => { try { tc.editor.Load(ms.ToArray(), TXTextControl.BinaryStreamType.WordprocessingML); } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al mostrar el documento", ex); } }; tc.Owner = PopUpsViewModels.MainWindow; tc.Closed += (s, e) => { PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); }; PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); tc.Show(); } } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar datos", ex); } }
private void VerDocumento() { //if (SelectedImputadoDocumento != null) if (SelectIngreso == null) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de guardar antes de imprimir"); return; } else { if (SelectIngreso.ID_ANIO == 0 && SelectIngreso.ID_IMPUTADO == 0 && SelectIngreso.ID_INGRESO == 0) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de guardar antes de imprimir"); return; } } if (SelectIngreso != null) { //SelectIngreso = new cIngreso().Obtener(SelectIngreso.ID_CENTRO, SelectIngreso.ID_ANIO, SelectIngreso.ID_IMPUTADO, SelectIngreso.ID_INGRESO); var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault(); //CARGAMOS DE NUEVO PARA MOSTRAR LA INFORMACION ACTUALIZADA SelectedImputadoDocumento = (new cImputadoDocumento()).Obtener(SelectIngreso.ID_CENTRO, SelectIngreso.ID_ANIO, SelectIngreso.ID_IMPUTADO, SelectIngreso.ID_INGRESO, (short)enumTipoDocumentoImputado.SALA_CABOS); if (SelectedImputadoDocumento == null) { #region Reporte ReporteIngreso reporte = new ReporteIngreso(); reporte.Nombre = string.Format("{0} {1} {2}", SelectIngreso.IMPUTADO.NOMBRE.Trim(), !string.IsNullOrEmpty(SelectIngreso.IMPUTADO.PATERNO) ? SelectIngreso.IMPUTADO.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(SelectIngreso.IMPUTADO.MATERNO) ? SelectIngreso.IMPUTADO.MATERNO.Trim() : string.Empty); reporte.Alias = " "; if (SelectIngreso.IMPUTADO.ALIAS != null) { string alias = string.Empty; foreach (var a in SelectIngreso.IMPUTADO.ALIAS) { if (!string.IsNullOrEmpty(alias)) { alias = string.Format("{0},", alias); } alias = alias + string.Format("{0} {1} {2}", a.NOMBRE.Trim(), !string.IsNullOrEmpty(a.PATERNO) ? a.PATERNO.Trim() : string.Empty, !string.IsNullOrEmpty(a.MATERNO) ? a.MATERNO.Trim() : string.Empty); } } reporte.Apodo = " "; if (SelectIngreso.IMPUTADO.APODO != null) { string apodos = string.Empty; foreach (var a in SelectIngreso.IMPUTADO.APODO) { if (!string.IsNullOrEmpty(apodos)) { apodos = string.Format("{0},", apodos); } apodos = apodos + a.APODO1.Trim(); } } //reporte.EstadoCivil = Imputado.ESTADO_CIVIL != null ? Imputado.ESTADO_CIVIL.DESCR : " "; reporte.EstadoCivil = SelectIngreso.ESTADO_CIVIL != null ? SelectIngreso.ESTADO_CIVIL.DESCR : " "; reporte.Conyugue = " "; reporte.Originario = " "; reporte.FecNacimiento = " "; //reporte.Escolaridad = Imputado.ESCOLARIDAD != null ? Imputado.ESCOLARIDAD.DESCR : " "; reporte.Escolaridad = SelectIngreso.ESCOLARIDAD != null ? SelectIngreso.ESCOLARIDAD.DESCR : " "; reporte.DomicilioActual = " ";//string.Format("{0} {1},{2},{3},{4}", Imputado.DOMICILIO_CALLE, Imputado.DOMICILIO_NUM_EXT, Imputado.COLONIA.DESCR, Imputado.COLONIA.MUNICIPIO.MUNICIPIO1, Imputado.COLONIA.MUNICIPIO.ENTIDAD.DESCR); var fechas = new Fechas(); reporte.Edad = " "; if (Imputado.NACIMIENTO_FECHA != null) { reporte.Edad = string.Format("{0} AÑOS", fechas.CalculaEdad(SelectIngreso.IMPUTADO.NACIMIENTO_FECHA)); } //reporte.TiempoBC = (Imputado.RESIDENCIA_ANIOS != null ? string.Format("{0} AÑOS",Imputado.RESIDENCIA_ANIOS) : string.Empty) + (Imputado.RESIDENCIA_MESES != null ? string.Format(" {0} MESES",Imputado.RESIDENCIA_MESES) : string.Empty); reporte.TiempoBC = (SelectIngreso.RESIDENCIA_ANIOS != null ? string.Format("{0} AÑOS", SelectIngreso.RESIDENCIA_ANIOS) : string.Empty) + (SelectIngreso.RESIDENCIAS_MESES != null ? string.Format(" {0} MESES", SelectIngreso.RESIDENCIAS_MESES) : string.Empty); //reporte.Telefono = Imputado.TELEFONO != null ? Imputado.TELEFONO.ToString() : " "; reporte.Telefono = SelectIngreso.TELEFONO != null?SelectIngreso.TELEFONO.ToString() : " "; //reporte.Ocupacion = Imputado.OCUPACION != null ? Imputado.OCUPACION.DESCR : " "; reporte.Ocupacion = SelectIngreso.OCUPACION != null ? SelectIngreso.OCUPACION.DESCR : " "; //reporte.NombreMadre = string.Format("{0} {1} {2} {3}", Imputado.NOMBRE_MADRE, Imputado.PATERNO_MADRE, Imputado.MATERNO_MADRE, Imputado.MADRE_FINADO.Equals("S") ? "FINADO" : string.Empty); //reporte.NombrePadre = string.Format("{0} {1} {2} {3}", Imputado.NOMBRE_PADRE, Imputado.PATERNO_PADRE, Imputado.MATERNO_PADRE, Imputado.PADRE_FINADO.Equals("S") ? "FINADO" : string.Empty); reporte.NombreMadre = string.Format("{0} {1} {2} {3}", Imputado.NOMBRE_MADRE.Trim(), !string.IsNullOrEmpty(Imputado.PATERNO_MADRE) ? Imputado.PATERNO_MADRE.Trim() : string.Empty, !string.IsNullOrEmpty(Imputado.MATERNO_MADRE) ? Imputado.MATERNO_MADRE.Trim() : string.Empty, SelectIngreso.MADRE_FINADO.Equals("S") ? "FINADO" : string.Empty); reporte.NombrePadre = string.Format("{0} {1} {2} {3}", Imputado.NOMBRE_PADRE.Trim(), !string.IsNullOrEmpty(Imputado.PATERNO_PADRE) ? Imputado.PATERNO_PADRE.Trim() : string.Empty, !string.IsNullOrEmpty(Imputado.MATERNO_PADRE) ? Imputado.MATERNO_PADRE.Trim() : string.Empty, SelectIngreso.PADRE_FINADO.Equals("S") ? "FINADO" : string.Empty); reporte.DomicilioPadres = " "; var diccionario = new Dictionary <string, string>(); diccionario.Add("<<nombre>>", reporte.Nombre); diccionario.Add("<<alias>>", reporte.Alias); diccionario.Add("<<apodo>>", reporte.Apodo); diccionario.Add("<<estadoCivil>>", reporte.EstadoCivil); diccionario.Add("<<edad>>", reporte.Edad); diccionario.Add("<<conyugue>>", reporte.Conyugue); diccionario.Add("<<originario>>", reporte.Originario); diccionario.Add("<<fecNacimiento>>", reporte.FecNacimiento); diccionario.Add("<<escolaridad>>", reporte.Escolaridad); diccionario.Add("<<domicilioActual>>", reporte.DomicilioActual); diccionario.Add("<<tiempoRadicacion>>", reporte.TiempoBC); diccionario.Add("<<telefono>>", reporte.Telefono); diccionario.Add("<<ocupacion>>", reporte.Ocupacion); diccionario.Add("<<nombreMadre>>", reporte.NombreMadre); diccionario.Add("<<nombrePadre>>", reporte.NombrePadre); diccionario.Add("<<domicilioPadres>>", reporte.DomicilioPadres); diccionario.Add("<<centro>>", centro.DESCR.Trim()); var documento = new cImputadoTipoDocumento().Obtener((short)enumTipoDocumentoImputado.SALA_CABOS); var contenido = new cWord().FillFieldsDocx(documento.DOCUMENTO, diccionario); #endregion GuardarDocumento(contenido); SelectedImputadoDocumento = (new cImputadoDocumento()).Obtener(SelectIngreso.ID_CENTRO, SelectIngreso.ID_ANIO, SelectIngreso.ID_IMPUTADO, SelectIngreso.ID_INGRESO, (short)enumTipoDocumentoImputado.SALA_CABOS); } #region comentado //if (docto != null) // if (docto.Count > 0) // SelectedImputadoDocumento = docto[0]; //if (reporte != null) //{ //Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application(); //Document wordDoc = new Document(); //var tmpFile = Path.GetTempFileName(); //var tmpFileStream = File.OpenWrite(tmpFile); //tmpFileStream.Write(SelectedImputadoDocumento.DOCUMENTO, 0, SelectedImputadoDocumento.DOCUMENTO.Length); //tmpFileStream.Close(); //wordDoc = wordApp.Documents.Add(tmpFile); //foreach (Field myMergeField in wordDoc.Fields) //{ // Range rngFieldCode = myMergeField.Code; // String fieldText = rngFieldCode.Text; // // ONLY GETTING THE MAILMERGE FIELDS // if (fieldText.StartsWith(" MERGEFIELD")) // { // Int32 endMerge = fieldText.IndexOf("\\"); // Int32 fieldNameLength = fieldText.Length - endMerge; // String fieldName = fieldText.Substring(11, endMerge - 11); // fieldName = fieldName.Trim(); // switch (fieldName) // { // case "nombre": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Nombre); // break; // case "alias": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Alias); // break; // case "apodo": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Apodo); // break; // case "estadoCivil": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.EstadoCivil); // break; // case "edad": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Edad); // break; // case "conyugue": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Conyugue); // break; // case "originario": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Originario); // break; // case "fecNacimiento": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.FecNacimiento); // break; // case "escolaridad": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Escolaridad); // break; // case "domicilioActual": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.DomicilioActual); // break; // case "tiempoRadicacion": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.TiempoBC); // break; // case "telefono": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Telefono); // break; // case "ocupacion": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.Ocupacion); // break; // case "nombreMadre": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.NombreMadre); // break; // case "nombrePadre": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.NombrePadre); // break; // case "domicilioPadres": // myMergeField.Select(); // wordApp.Selection.TypeText(reporte.DomicilioPadres); // break; // case "centro": // myMergeField.Select(); // wordApp.Selection.TypeText(centro.DESCR.Trim()); // break; // } // } //} //wordDoc.SaveAs(tmpFile, WdSaveFormat.wdFormatDocument97); //wordDoc.Close(); //byte[] bytes = System.IO.File.ReadAllBytes(tmpFile); #endregion var v = new EditorView(SelectedImputadoDocumento, SelectedImputadoDocumento.DOCUMENTO); PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); v.Owner = PopUpsViewModels.MainWindow; v.Closed += (s, e) => { PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.OSCURECER_FONDO); }; v.Show(); //} } }
private async Task CargarReporte() { await StaticSourcesViewModel.CargarDatosMetodoAsync(() => { var _reporte = new cHojaReferenciaMedica(); StringBuilder _str_builder = new StringBuilder(); if (selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.Any()) { foreach (var item in Enum.GetValues(typeof(eFamiliares)).Cast <eFamiliares>()) { var _familiar = new cTipoReferencia().Obtener((short)item).FirstOrDefault(); if (_familiar != null) { if (_str_builder.Length != 0) { _str_builder.Append(", "); } _str_builder.Append(new cTipoReferencia().Obtener((short)item).FirstOrDefault().DESCR.Trim()); _str_builder.Append(":"); if (selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().HISTORIA_CLINICA_FAMILIAR.Any(a => a.ID_TIPO_REFERENCIA == _familiar.ID_TIPO_REFERENCIA)) { var _antecedente_heredo_fam = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().HISTORIA_CLINICA_FAMILIAR.First(a => a.ID_TIPO_REFERENCIA == _familiar.ID_TIPO_REFERENCIA); if ((!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_ALERGIAS) && _antecedente_heredo_fam.AHF_ALERGIAS != "N") || (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_CA) && _antecedente_heredo_fam.AHF_CA != "N") || (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_CARDIACOS) && _antecedente_heredo_fam.AHF_CARDIACOS != "N") || (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_DIABETES) && _antecedente_heredo_fam.AHF_DIABETES != "N") || (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_HIPERTENSIVO) && _antecedente_heredo_fam.AHF_HIPERTENSIVO != "N") || (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_MENTALES) && _antecedente_heredo_fam.AHF_MENTALES != "N") || (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_TB) && _antecedente_heredo_fam.AHF_TB != "N") || (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_EPILEPSIA) && _antecedente_heredo_fam.AHF_EPILEPSIA != "N")) { var _subsecuente = false; if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_ALERGIAS) && _antecedente_heredo_fam.AHF_ALERGIAS != "N") { _str_builder.Append("ALERGIAS"); _subsecuente = true; } if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_CA) && _antecedente_heredo_fam.AHF_CA != "N") { if (_subsecuente) { _str_builder.Append(", "); } _str_builder.Append("CA"); _subsecuente = true; } if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_CARDIACOS) && _antecedente_heredo_fam.AHF_CARDIACOS != "N") { if (_subsecuente) { _str_builder.Append(", "); } _str_builder.Append("CARDIACOS"); _subsecuente = true; } if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_DIABETES) && _antecedente_heredo_fam.AHF_DIABETES != "N") { if (_subsecuente) { _str_builder.Append(", "); } _str_builder.Append("DIABETES"); _subsecuente = true; } if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_HIPERTENSIVO) && _antecedente_heredo_fam.AHF_HIPERTENSIVO != "N") { if (_subsecuente) { _str_builder.Append(", "); } _str_builder.Append("HIPERTENSIVO"); _subsecuente = true; } if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_MENTALES) && _antecedente_heredo_fam.AHF_MENTALES != "N") { if (_subsecuente) { _str_builder.Append(", "); } _str_builder.Append("MENTALES"); _subsecuente = true; } if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_TB) && _antecedente_heredo_fam.AHF_TB != "N") { if (_subsecuente) { _str_builder.Append(", "); } _str_builder.Append("T.B."); _subsecuente = true; } if (!string.IsNullOrWhiteSpace(_antecedente_heredo_fam.AHF_EPILEPSIA) && _antecedente_heredo_fam.AHF_EPILEPSIA != "N") { if (_subsecuente) { _str_builder.Append(", "); } _str_builder.Append("EPILEPSIA"); _subsecuente = true; } } else { _str_builder.Append("NINGUNO"); } } else { _str_builder.Append("NINGUNO"); } } } _reporte.ANT_HEREDO_FAMILIARES = _str_builder.ToString(); _str_builder.Clear(); if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_NACIMIENTO) || !string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALIMENTACION) || !string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_HABITACION) || (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TABAQUISMO) && selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TABAQUISMO == "S") || (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALCOHOLISMO) && selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALCOHOLISMO == "S") || (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TOXICOMANIAS) && selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TOXICOMANIAS == "S")) { if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_NACIMIENTO)) { _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_NACIMIENTO); } if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALIMENTACION)) { if (_str_builder.Length != 0) { _str_builder.Append(", "); } _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALIMENTACION); } if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_HABITACION)) { if (_str_builder.Length != 0) { _str_builder.Append(", "); } _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_HABITACION); } if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TABAQUISMO) && selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TABAQUISMO == "S") { if (_str_builder.Length != 0) { _str_builder.Append(", "); } _str_builder.Append("TABAQUISMO: SÍ"); if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TABAQUISMO_OBSERV)) { _str_builder.Append(", "); _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TABAQUISMO_OBSERV); } } if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALCOHOLISMO) && selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALCOHOLISMO == "S") { if (_str_builder.Length != 0) { _str_builder.Append(", "); } _str_builder.Append("ALCOHOLISMO: SÍ"); if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALCOHOLISMO_OBSERV)) { _str_builder.Append(", "); _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_ALCOHOLISMO_OBSERV); } } if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TOXICOMANIAS) && selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TOXICOMANIAS == "S") { if (_str_builder.Length != 0) { _str_builder.Append(", "); } _str_builder.Append("TOXICOMANÍAS: SÍ"); if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TOXICOMANIAS)) { _str_builder.Append(", "); _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().APNP_TOXICOMANIAS); } } } else { _str_builder.Append("NINGUNO"); } _reporte.ANT_PERSONALES_NO_PAT = _str_builder.ToString(); _str_builder.Clear(); if (selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().HISTORIA_CLINICA_PATOLOGICOS.Any()) { foreach (var item in selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.HISTORIA_CLINICA.First().HISTORIA_CLINICA_PATOLOGICOS) { if (_str_builder.Length > 0) { _str_builder.Append(", "); } _str_builder.Append(item.PATOLOGICO_CAT.DESCR); if (!string.IsNullOrWhiteSpace(item.OBSERVACIONES)) { _str_builder.Append(", "); _str_builder.Append(item.OBSERVACIONES); } } } else { _str_builder.Append("NINGUNO"); } _reporte.ANT_PERSONALES_PAT = _str_builder.ToString(); } else { _reporte.ANT_HEREDO_FAMILIARES = "DESCONOCIDOS"; _reporte.ANT_PERSONALES_NO_PAT = "DESCONOCIDOS"; _reporte.ANT_PERSONALES_PAT = "DESCONOCIDOS"; } if (selectedInterconsultaBusqueda.ID_ESPECIALIDAD != null) { _reporte.CAUSA_SOLICITUD = selectedInterconsultaBusqueda.ESPECIALIDAD.DESCR; } else { _str_builder.Clear(); if (selectedInterconsultaBusqueda.SERVICIO_AUX_INTERCONSULTA.Any()) { foreach (var item in selectedInterconsultaBusqueda.SERVICIO_AUX_INTERCONSULTA) { if (_str_builder.Length > 0) { _str_builder.Append(", "); } _str_builder.Append(item.SERVICIO_AUX_DIAG_TRAT.DESCR); } } _reporte.CAUSA_SOLICITUD = _str_builder.ToString(); } _reporte.CIUDAD = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.CENTRO.DESCR.Trim(); _reporte.DESTINO = selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA != null ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.Any() ? !string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.First().HOSPITAL_OTRO) ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.First().HOSPITAL_OTRO.Trim() : selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.First().HOSPITAL.DESCR.Trim() : "" : ""; _reporte.EDAD = new Fechas().CalculaEdad(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.NACIMIENTO_FECHA); _reporte.ESTADO = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.CENTRO.MUNICIPIO.ENTIDAD.DESCR; _reporte.FECHA_NAC = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.NACIMIENTO_FECHA.Value.ToString("dd/MM/yyyy"); _reporte.FECHA_REGISTRO_LETRA = Fechas.fechaLetra(selectedInterconsultaBusqueda.REGISTRO_FEC, false); _reporte.FOLIO = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.ID_ANIO.ToString() + "/" + selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.ID_IMPUTADO.ToString(); _reporte.FREC_CARDIACA = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.NOTA_SIGNOS_VITALES.FRECUENCIA_CARDIAC; _reporte.FREC_RESPIRATORIA = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.NOTA_SIGNOS_VITALES.FRECUENCIA_RESPIRA; _reporte.IMPRESION_DIAGNOSTICA = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.PRONOSTICO.DESCR; _str_builder.Clear(); _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.NOMBRE.Trim()); if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.PATERNO)) { _str_builder.Append(" "); _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.PATERNO.Trim()); } if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.MATERNO)) { _str_builder.Append(" "); _str_builder.Append(selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.MATERNO.Trim()); } _reporte.NOMBRE = _str_builder.ToString(); _reporte.OBSERVACIONES = selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA != null ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.Any() ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.First().OBSERV : string.Empty : string.Empty; _reporte.PESO = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.NOTA_SIGNOS_VITALES.PESO; _reporte.PRIMERA = selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA != null ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.Any() ?selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.First().ID_TIPO_CITA == (short)enumCita_Tipo.PRIMERA ? "X" : "" : "" : ""; _reporte.SUBSECUENTE = selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA != null ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.Any() ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.First().ID_TIPO_CITA == (short)enumCita_Tipo.SUBSECUENTE ? "X" : "" : "" : ""; if (selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.NOTA_MEDICA_ENFERMEDAD.Any()) { _str_builder.Clear(); foreach (var item in selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.NOTA_MEDICA_ENFERMEDAD) { if (_str_builder.Length > 0) { _str_builder.Append(", "); } _str_builder.Append(item.ENFERMEDAD.NOMBRE.Trim()); } _reporte.RESUMEN_CLINICO = _str_builder.ToString(); } _reporte.SEXO = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.IMPUTADO.SEXO == "M" ? "MASCULINO" : "FEMENINO"; _reporte.TENSION_ARTERIAL = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.NOTA_SIGNOS_VITALES.TENSION_ARTERIAL.Trim(); _reporte.TIPO_ATENCION = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.ATENCION_SERVICIO.ATENCION_TIPO.DESCR; _reporte.CENTRO = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.INGRESO.CENTRO.DESCR.Trim(); _reporte.EXP_HGT = selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA != null ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.Any() ? selectedInterconsultaBusqueda.HOJA_REFERENCIA_MEDICA.First().EXP_HGT : "" : ""; _reporte.TALLA = selectedInterconsultaBusqueda.CANALIZACION.NOTA_MEDICA.ATENCION_MEDICA.NOTA_SIGNOS_VITALES.TALLA; _str_builder.Clear(); _str_builder.Append(selectedInterconsultaBusqueda.USUARIO.EMPLEADO.PERSONA.NOMBRE.Trim()); if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.USUARIO.EMPLEADO.PERSONA.PATERNO.Trim())) { _str_builder.Append(" "); _str_builder.Append(selectedInterconsultaBusqueda.USUARIO.EMPLEADO.PERSONA.PATERNO.Trim()); } if (!string.IsNullOrWhiteSpace(selectedInterconsultaBusqueda.USUARIO.EMPLEADO.PERSONA.MATERNO.Trim())) { _str_builder.Append(" "); _str_builder.Append(selectedInterconsultaBusqueda.USUARIO.EMPLEADO.PERSONA.MATERNO.Trim()); } _reporte.NOMBRE_MEDICO = _str_builder.ToString(); diccionario_reporte = new Dictionary <string, string>(); diccionario_reporte.Add("<<CENTRO>>", _reporte.CENTRO); diccionario_reporte.Add("<<NOMBRE>>", _reporte.NOMBRE); diccionario_reporte.Add("<<EDAD>>", _reporte.EDAD.ToString()); diccionario_reporte.Add("<<FOLIO>>", _reporte.FOLIO); diccionario_reporte.Add("<<SEXO>>", _reporte.SEXO); diccionario_reporte.Add("<<FECHA_NAC>>", _reporte.FECHA_NAC); diccionario_reporte.Add("<<DESTINO>>", _reporte.DESTINO); diccionario_reporte.Add("<<TIPO_ATENCION>>", _reporte.TIPO_ATENCION); diccionario_reporte.Add("<<EXP_HGT>>", _reporte.EXP_HGT); diccionario_reporte.Add("<<CAUSA_SOLICITUD>>", _reporte.CAUSA_SOLICITUD); diccionario_reporte.Add("<<ANT_HEREDO_FAMILIARES>>", _reporte.ANT_HEREDO_FAMILIARES); diccionario_reporte.Add("<<ANT_PERSONALES_NO_PAT>>", _reporte.ANT_PERSONALES_NO_PAT); diccionario_reporte.Add("<<ANT_PERSONALES_PAT>>", _reporte.ANT_PERSONALES_PAT); diccionario_reporte.Add("<<PRIMERA>>", _reporte.PRIMERA); diccionario_reporte.Add("<<SUBSECUENTE>>", _reporte.SUBSECUENTE); diccionario_reporte.Add("<<TA>>", _reporte.TENSION_ARTERIAL); diccionario_reporte.Add("<<FC>>", _reporte.FREC_CARDIACA); diccionario_reporte.Add("<<FR>>", _reporte.FREC_RESPIRATORIA); diccionario_reporte.Add("<<PESO>>", _reporte.PESO); diccionario_reporte.Add("<<TALLA>>", _reporte.TALLA); diccionario_reporte.Add("<<RESUMEN_CLINICO>>", _reporte.RESUMEN_CLINICO); diccionario_reporte.Add("<<IMPRESION_DIAGNOSTICA>>", _reporte.IMPRESION_DIAGNOSTICA); diccionario_reporte.Add("<<OBSERVACIONES>>", _reporte.OBSERVACIONES); diccionario_reporte.Add("<<CIUDAD>>", _reporte.CIUDAD); diccionario_reporte.Add("<<ESTADO>>", _reporte.ESTADO); diccionario_reporte.Add("<<FECHA_REGISTRO_LETRA>>", _reporte.FECHA_REGISTRO_LETRA); diccionario_reporte.Add("<<NOMBRE_MEDICO>>", _reporte.NOMBRE_MEDICO); documento = new cImputadoTipoDocumento().Obtener((short)enumTipoDocumentoImputado.HOJA_REFERENCIA_MEDICA); }); }