/// <summary>
        /// Permite insertar el paciente prioritario
        /// </summary>
        /// <param name="row">Fila del archivo procesada</param>
        #region Add Data

        private tbl_paciente_prioritario insertPriorityPatient(IXLTableRow row)
        {
            try
            {
                tbl_paciente_prioritario currentPatient;
                int rownumber   = row.RowNumber();
                var tempKeyPair = wrapper.GetValue(rownumber);
                if (tempKeyPair == null)
                {
                    currentPatient = new tbl_paciente_prioritario
                    {
                        id          = Guid.NewGuid(),
                        apellidos   = $"{row.Field("Primer_Apellido").Value.ToString()} {row.Field("Segundo_Apellido").Value.ToString()}",
                        cedula      = $"{row.Field("Tipo_Identificacion").Value.ToString()} {row.Field("Numero_Identificacion").Value.ToString()}",
                        nombres     = $"{row.Field("Primer_Nombre").Value.ToString()} {row.Field("Segundo_Nombre").Value.ToString()}",
                        numContacto = $"{row.Field("Numero_Telefonico").Value.ToString()}",
                        idArchivo   = Guid.Parse(idArchivo)
                    };
                }
                else
                {
                    currentPatient = tempKeyPair;
                }
                wrapper.Add(row.RowNumber(), currentPatient);
                return(currentPatient);
            }
            catch (Exception ex)
            {
                IOUtilities.WriteExceptionLog(ex, Configuration.GetClassName <PriorityPatient>());
            }
            return(null);
        }
        private void insertVariablePriorityPatient(string variableName, string variableValue, string umbralValue, IXLTableRow row)
        {
            try
            {
                int rownumber = row.RowNumber();
                tbl_paciente_prioritario currentPatient = insertPriorityPatient(row);

                tbl_variable_prioritaria variable = new tbl_variable_prioritaria()
                {
                    Id             = Guid.NewGuid(),
                    nombreVariable = variableName,
                    valorVariable  = variableValue,
                    valorUmbral    = umbralValue,
                    tbl_paciente_prioritario_id = currentPatient.id
                };

                variable.tbl_paciente_prioritario = currentPatient;
                currentPatient.tbl_variable_prioritaria.Add(variable);
                wrapper.Add(rownumber, currentPatient);

                variable_prioritaria.Add(variable);
            }
            catch (Exception ex)
            {
                IOUtilities.WriteExceptionLog(ex, Configuration.GetClassName <PriorityPatient>());
            }
        }
        /// <summary>
        /// Inserta la variable prioritaria que no cumple alguna de las reglas
        /// </summary>
        /// <param name="variableName">Nombre de las variables</param>
        /// <param name="variableValue">Valor de la variable</param>
        /// <param name="motnhOutdated">Meses que la variable esta desactualizada</param>
        /// <param name="row">Fila procesada</param>
        private void insertOutdated(string variableName, string variableValue, string motnhOutdated, IXLTableRow row)
        {
            try
            {
                int rownumber = row.RowNumber();
                tbl_paciente_prioritario currentPatient = insertPriorityPatient(row);

                tbl_variable_desactualizada variable = new tbl_variable_desactualizada()
                {
                    Id                          = Guid.NewGuid(),
                    nombreVariable              = variableName,
                    valorVariable               = variableValue,
                    mesesDesactualizado         = motnhOutdated.ToString(),
                    tbl_paciente_prioritario_id = currentPatient.id
                };
                variable.tbl_paciente_prioritario = currentPatient;

                currentPatient.tbl_variable_desactualizada.Add(variable);
                wrapper.Add(rownumber, currentPatient);

                desactualizado.Add(variable);
            }
            catch (Exception ex)
            {
                IOUtilities.WriteExceptionLog(ex, Configuration.GetClassName <PriorityPatient>());
            }
        }
Пример #4
0
 public static void SaveLog(string content = null, string worksheetname = null, int rowid = 0, IXLRangeRow row = null)
 {
     if (content != null && worksheetname == null && rowid == 0 && row == null)
     {
         analisis1.Add($"caso1{content}");
     }
     else if (content == null && worksheetname != null && rowid > 0 && row != null)
     {
         List <string> rowarray = new List <string>();
         row.CellsUsed().ForEach(m => rowarray.Add(TypeConverter.TryConvert(m.Value.ToString()).ToString()));
         analisis1.Add($"caso2@{rowid}@{worksheetname}@{Guid.NewGuid()}", rowarray.ToArray());
     }
     else if (content == "true" && worksheetname != null && rowid > 0 && row != null)
     {
         //string concat = "";
         ////row.CellsUsed().ForEach(m => concat = $"{concat},{TypeConverter.TryConvert(m.Value.ToString()).ToString()}");
         //concat = row.CellsUsed().Count() > 0 ? $"{TypeConverter.TryConvert(row.CellsUsed().ToList()[0].Value.ToString()).ToString()}" : "null";
         //analisis2.Add($"caso3@{rowid}@{worksheetname}@{concat}");
     }
 }