コード例 #1
0
ファイル: Util.cs プロジェクト: jcatcoe/ictus
        public static List <umeDataTMP> FilterByHelicoptero(List <umeDataTMP> inputList)
        {
            List <umeDataTMP> result = null;

            try
            {
                umeDataTMP helicoFound = inputList.Where(x => x.dim_recurso_nombreUSVB.Contains("HELICO")).FirstOrDefault();

                if (helicoFound == null) //No HELICO inside the input list
                {
                    result = inputList;
                }
                else
                {
                    result = new List <umeDataTMP>()
                    {
                        helicoFound
                    };
                }
            }
            catch (Exception exp)
            {
                ncLog.Exception("FilterByHelicoptero::" + exp.Message);
            }

            return(result);
        }
コード例 #2
0
ファイル: Util.cs プロジェクト: jcatcoe/ictus
        public static void InfoDifferentCIE()
        {
            Dictionary <long, List <umeDataTMP> > result = new Dictionary <long, List <umeDataTMP> >();

            try
            {
                List <umeDataTMP> umeDataTMPList = IctusDBManager.GetAllUmeDataTMP();

                if (umeDataTMPList == null || umeDataTMPList.Count() == 0)
                {
                    ncLog.Error("InfoDifferentCIE::Null or empty umeDataTMPList!!");
                    return;
                }

                string msg = "ID,CIE1,Responsable1,CIE2, Responsable2";

                Dictionary <long, List <umeDataTMP> > umeDataTMPMap = umeDataTMPList.GroupBy(x => x.inc_id).ToDictionary(y => y.Key, y => y.ToList());

                if (umeDataTMPMap != null && umeDataTMPMap.Count() != 0)
                {
                    foreach (KeyValuePair <long, List <umeDataTMP> > iter in umeDataTMPMap)
                    {
                        long pacienteID = iter.Key;

                        List <string> cieGroup = iter.Value.Select(x => x.cie_codigo).Distinct().ToList();

                        if (cieGroup != null && cieGroup.Count() > 1)
                        {
                            msg += "\r\n" + pacienteID;

                            int size    = cieGroup.Count;
                            int counter = 1;

                            foreach (string iterCie in cieGroup)
                            {
                                if (size == 3)
                                {
                                    if (counter == 2)
                                    {
                                        ++counter;
                                        continue;
                                    }
                                }

                                umeDataTMP dataFound = iter.Value.Where(x => x.cie_codigo == iterCie).FirstOrDefault();

                                msg += "," + iterCie + "," + dataFound.dim_responsable_nombre;

                                ++counter;
                            }

                            msg += "," + iter.Value.FirstOrDefault().inc_sello_temporal.Year;
                        }
                    }
                }

                ncLog.Message(msg);
            }
            catch (Exception exp)
            {
                ncLog.Exception("InfoDifferentCIE::" + exp.Message);
            }
        }
コード例 #3
0
ファイル: Util.cs プロジェクト: jcatcoe/ictus
        public static string GetCIECcode(List <umeDataTMP> list)
        {
            string result = string.Empty;

            try
            {
                umeDataTMP tempResult = null;

                //HELICO
                tempResult = list.Where(x => x.dim_responsable_nombre.Contains("MEDICO HELICO")).FirstOrDefault();

                if (tempResult != null)
                {
                    result = tempResult.cie_codigo;
                    return(result);
                }

                //UME
                tempResult = list.Where(x => x.dim_responsable_nombre.Contains("MEDICO UME")).FirstOrDefault();

                if (tempResult != null)
                {
                    result = tempResult.cie_codigo;
                    return(result);
                }

                //UVI
                tempResult = list.Where(x => x.dim_responsable_nombre.Contains("MEDICO UVI")).FirstOrDefault();

                if (tempResult != null)
                {
                    result = tempResult.cie_codigo;
                    return(result);
                }

                //AE
                tempResult = list.Where(x => x.dim_responsable_nombre.Contains("MEDICO AE")).FirstOrDefault();

                if (tempResult != null)
                {
                    result = tempResult.cie_codigo;
                    return(result);
                }

                //ap/privado/residencia
                List <String> filterAP = new List <string>()
                {
                    "MEDICO AP", " MEDICO PRIVADO", "MEDICO RESIDENCIA"
                };
                tempResult = list.Where(x => filterAP.Contains(x.dim_responsable_nombre)).FirstOrDefault();

                if (tempResult != null)
                {
                    result = tempResult.cie_codigo;
                    return(result);
                }

                //REGULADOR
                tempResult = list.Where(x => x.dim_responsable_nombre.Contains("REGULADOR")).FirstOrDefault();

                if (tempResult != null)
                {
                    result = tempResult.cie_codigo;
                    return(result);
                }

                //DEFAULT
                result = list.FirstOrDefault().cie_codigo;
            }
            catch (Exception exp)
            {
                ncLog.Exception("GetCIECcode::" + exp.Message);
            }

            return(result);
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: jcatcoe/ictus
        //private void btLoadDatosUME_Click(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        if(!Util.LoadDataMasterList())
        //        {
        //            ncLog.Error("LoadDatosUME::Unable to load data master in memory. We can NOT continue!!!");
        //            return;
        //        }


        //        using (OpenFileDialog openFileDialog = new OpenFileDialog())
        //        {
        //            //openFileDialog.InitialDirectory = "c:\\";
        //            openFileDialog.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*";
        //            openFileDialog.FilterIndex = 2;
        //            openFileDialog.RestoreDirectory = true;

        //            if (openFileDialog.ShowDialog() == DialogResult.OK)
        //            {
        //                //Get the path of specified file
        //                string filePath = openFileDialog.FileName;
        //                txtDatosUME.Text = filePath;

        //                ncLog.Message("ExcelPath:" + filePath);

        //                Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();

        //                Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Open(filePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
        //                        Type.Missing, Type.Missing, Type.Missing, Type.Missing,
        //                        Type.Missing, Type.Missing, Type.Missing, Type.Missing,
        //                        Type.Missing, Type.Missing);


        //                int sheetsNumber = wb.Sheets.Count; //11 => from 11 to 1

        //                //From sheetsNumber to 1 => From 2008 to 2018
        //                for (int iter = sheetsNumber; iter >= 1; --iter)
        //                {
        //                    Worksheet sheet = (Worksheet)wb.Sheets[iter];

        //                    Range excelRange = sheet.UsedRange;

        //                    int nRows = excelRange.Rows.Count;

        //                    ncLog.Message("Sheet:[" + sheet.Name + "] - Nº Rows:" + nRows);

        //                    foreach (Microsoft.Office.Interop.Excel.Range row in excelRange.Rows)
        //                    {
        //                        int rowNumber = row.Row;

        //                        if (rowNumber != 1) //Headers
        //                        {

        //                            string[] arrayAO = GetRange("A" + rowNumber + ":O" + rowNumber + "", sheet);

        //                            umeData newUmeData = new umeData(arrayAO);

        //                            if (!newUmeData.IsOk())
        //                            {
        //                                ncLog.Error("LoadUMEData::Unable to create USVB object row number:" + rowNumber);
        //                                continue;
        //                            }

        //                            if (IctusDBManager.NewUmeData(newUmeData))
        //                            {
        //                                ncLog.Message("LoadUMEData::Inserted row number:" + rowNumber);
        //                            }
        //                            else
        //                            {
        //                                ncLog.Message("LoadUMEData::Unable to insert row number:" + rowNumber);
        //                            }
        //                        }

        //                    }

        //                }

        //            }
        //        }
        //    }
        //    catch (Exception exp)
        //    {
        //        ncLog.Exception("LoadHospitales::" + exp.Message);
        //    }
        //}

        private void btLoadDatosUME_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Util.LoadDataMasterList())
                {
                    ncLog.Error("LoadDatosUME::Unable to load data master in memory. We can NOT continue!!!");
                    return;
                }


                using (OpenFileDialog openFileDialog = new OpenFileDialog())
                {
                    //openFileDialog.InitialDirectory = "c:\\";
                    openFileDialog.Filter           = "Excel files (*.xls)|*.xls|All files (*.*)|*.*";
                    openFileDialog.FilterIndex      = 2;
                    openFileDialog.RestoreDirectory = true;

                    if (openFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        //Get the path of specified file
                        string filePath = openFileDialog.FileName;
                        txtDatosUME.Text = filePath;

                        ncLog.Message("ExcelPath:" + filePath);

                        Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();

                        Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Open(filePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                                                                                        Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                                                                                        Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                                                                                        Type.Missing, Type.Missing);


                        int sheetsNumber = wb.Sheets.Count; //11 => from 11 to 1

                        sheetsNumber = sheetsNumber - 2;    //Because 2008 and 2009 are inserted yet

                        //From sheetsNumber to 1 => From 2008 to 2018
                        for (int iter = sheetsNumber; iter >= 1; --iter)
                        {
                            Worksheet sheet = (Worksheet)wb.Sheets[iter];

                            Range excelRange = sheet.UsedRange;

                            int nRows = excelRange.Rows.Count;

                            ncLog.Message("Sheet:[" + sheet.Name + "] - Nº Rows:" + nRows);

                            foreach (Microsoft.Office.Interop.Excel.Range row in excelRange.Rows)
                            {
                                int rowNumber = row.Row;

                                if (rowNumber != 1) //Headers
                                {
                                    string[] arrayAO = Util.GetRange("A" + rowNumber + ":O" + rowNumber + "", sheet);

                                    umeDataTMP newUmeData = new umeDataTMP(arrayAO);

                                    if (newUmeData.inc_id == Int64.MinValue)
                                    {
                                        ncLog.Error("LoadUMEDataTMP::Unable to create umeDataTMP document for id:" + arrayAO[0]);
                                        continue;
                                    }

                                    if (IctusDBManager.NewUmeDataTMP(newUmeData))
                                    {
                                        ncLog.Message("LoadUMEDataTMP::Inserted row number:" + rowNumber);
                                    }
                                    else
                                    {
                                        ncLog.Message("LoadUMEDataTMP::Unable to insert row number:" + rowNumber);
                                    }
                                }
                            }

                            //iter = 1; //For only year 2008
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                ncLog.Exception("LoadHospitales::" + exp.Message);
            }
        }