Exemple #1
0
        static void Main(string[] args)
        {
            logger.Log("================================================================", EventType.Info);
            logger.Log("==                Bimet Circus Extractor v1.1                 ==", EventType.Info);
            logger.Log("================================================================", EventType.Info);
            Options options = new Options();

            Parser.Default.ParseArguments <Options>(args)
            .WithParsed <Options>(o =>
            {
                logger.Log($"Current Arguments:");
                logger.Log($"Verbose: -v {o.Verbose}");
                logger.Log($"Directory: -d {o.Directory}");
                logger.Log($"Excel: -x {o.Excel}");
                logger.Log($"Relationships: -r");
                options = o;
            });

            if (options.Relations)
            {
                logger.Log("================================================================");
                logger.Log("=========           MERIDIAN RELATIONSHIP             ==========");
                logger.Log("================================================================");
                MeridianHerarchy str = new MeridianHerarchy();
                for (int i = 1; i <= 12; i++)
                {
                    logger.Log($"Slave of {str.Meridians[i].Name} is " + str.SlaveOf(str.Meridians[i]).Name);
                }
                logger.Log("================================================================");
                for (int i = 1; i <= 12; i++)
                {
                    logger.Log($"Master of {str.Meridians[i].Name} is " + str.Meridians[i].Master.Name);
                }
                logger.Log("================================================================");
                for (int i = 1; i <= 12; i++)
                {
                    logger.Log($"Son of {str.Meridians[i].Name} is " + str.SonOf(str.Meridians[i]).Name);
                }
                logger.Log("================================================================");
                for (int i = 1; i <= 12; i++)
                {
                    logger.Log($"Mother of {str.Meridians[i].Name} is " + str.Meridians[i].Mother.Name);
                }
                logger.Log("================================================================");
                logger.Log("================================================================");
                logger.Log("");
                logger.Log("Press <ENTER> to Continue.");
                Console.ReadLine();
            }

            ExtractBimet bm = new ExtractBimet(options.Directory, options.Excel, logger);

            bm.Start();

            logger.Log("Press <ENTER> to Exit.");
            Console.ReadLine();
        }
Exemple #2
0
        /// <summary>
        /// Madre y Master extraction
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="patientCode"></param>
        /// <param name="row"></param>
        public void Step3(ExcelWorksheet sheet, string patientCode, int row)
        {
            BimetOneReader bor         = new BimetOneReader(Path.Combine(Dir, $"{patientCode}ener.1"), BimetOneReader.FileFormat.NumeratedSessions);
            int            lastSession = bor.Sessions[bor.Sessions.Length - 1];

            foreach (var org in str.Meridians)
            {
                org.Value.G_as_Mother = Convert.ToDecimal(bor[lastSession, org.Key - 1]);
                org.Value.G_as_Master = Convert.ToDecimal(bor[lastSession, org.Key + 11]) * -1;
            }

            BimetOneReader col = new BimetOneReader(Path.Combine(Dir, $"{patientCode}.1"), BimetOneReader.FileFormat.UnnumeratedSessions);

            lastSession = col.Sessions[col.Sessions.Length - 1];
            foreach (var org in str.Meridians)
            {
                org.Value.I_Bioene = Convert.ToDecimal(col[lastSession, org.Key - 1]);
            }

            decimal maxLimit = 0.3M;

            sheet.Cells[$"S{row}"].Value  = str.Meridians[6].G_as_Mother;
            sheet.Cells[$"T{row}"].Value  = str.Meridians[6].G_as_Master;
            sheet.Cells[$"X{row}"].Value  = str.Meridians[3].G_as_Mother;
            sheet.Cells[$"Y{row}"].Value  = str.Meridians[3].G_as_Master;
            sheet.Cells[$"AC{row}"].Value = str.Meridians[2].G_as_Mother;
            sheet.Cells[$"AD{row}"].Value = str.Meridians[2].G_as_Master;
            sheet.Cells[$"AH{row}"].Value = str.Meridians[5].G_as_Mother;
            sheet.Cells[$"AI{row}"].Value = str.Meridians[5].G_as_Master;
            sheet.Cells[$"AM{row}"].Value = str.Meridians[8].G_as_Mother;
            sheet.Cells[$"AN{row}"].Value = str.Meridians[8].G_as_Master;
            sheet.Cells[$"AR{row}"].Value = str.Meridians[12].G_as_Mother;
            sheet.Cells[$"AS{row}"].Value = str.Meridians[12].G_as_Master;
            sheet.Cells[$"AW{row}"].Value = str.Meridians[4].G_as_Mother;
            sheet.Cells[$"AX{row}"].Value = str.Meridians[4].G_as_Master;
            sheet.Cells[$"BB{row}"].Value = str.Meridians[1].G_as_Mother;
            sheet.Cells[$"BC{row}"].Value = str.Meridians[1].G_as_Master;
            sheet.Cells[$"BG{row}"].Value = str.Meridians[7].G_as_Mother;
            sheet.Cells[$"BH{row}"].Value = str.Meridians[7].G_as_Master;
            sheet.Cells[$"BL{row}"].Value = str.Meridians[11].G_as_Mother;
            sheet.Cells[$"BM{row}"].Value = str.Meridians[11].G_as_Master;
            sheet.Cells[$"BQ{row}"].Value = str.Meridians[9].G_as_Mother;
            sheet.Cells[$"BR{row}"].Value = str.Meridians[9].G_as_Master;
            sheet.Cells[$"BV{row}"].Value = str.Meridians[10].G_as_Mother;
            sheet.Cells[$"BW{row}"].Value = str.Meridians[10].G_as_Master;


            // Set all Gray

            sheet.Cells[$"S{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"T{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"X{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"Y{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AC{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AD{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AH{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AI{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AM{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AN{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AR{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AS{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AW{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"AX{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BB{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BC{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BG{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BH{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BL{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BM{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BQ{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BR{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BV{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);
            sheet.Cells[$"BW{row}"].Style.Font.Color.SetColor(1, 180, 180, 180);


            // Set for Corazon
            if (str.Meridians[6].G_as_Mother > maxLimit)
            {
                if (str.Meridians[6].I_Bioene < str.SonOf(str.Meridians[6]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"S{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"S{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[6].G_as_Master > maxLimit)
            {
                if (str.Meridians[6].I_Bioene < str.SlaveOf(str.Meridians[6]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"T{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"T{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Intestino Delgado
            if (str.Meridians[3].G_as_Mother > maxLimit)
            {
                if (str.Meridians[3].I_Bioene < str.SlaveOf(str.Meridians[3]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"X{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"X{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[3].G_as_Master > maxLimit)
            {
                if (str.Meridians[3].I_Bioene < str.SlaveOf(str.Meridians[3]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"Y{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"Y{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Triple R
            if (str.Meridians[2].G_as_Mother > maxLimit)
            {
                if (str.Meridians[2].I_Bioene < str.SonOf(str.Meridians[2]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AC{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AC{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[2].G_as_Master > maxLimit)
            {
                if (str.Meridians[2].I_Bioene < str.SlaveOf(str.Meridians[2]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AD{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AD{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Pericardio
            if (str.Meridians[5].G_as_Mother > maxLimit)
            {
                if (str.Meridians[5].I_Bioene < str.SonOf(str.Meridians[5]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AH{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AH{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[5].G_as_Master > maxLimit)
            {
                if (str.Meridians[5].I_Bioene < str.SlaveOf(str.Meridians[5]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AI{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AI{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Bazo
            if (str.Meridians[8].G_as_Mother > maxLimit)
            {
                if (str.Meridians[8].I_Bioene < str.SonOf(str.Meridians[8]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AM{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AM{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[8].G_as_Master > maxLimit)
            {
                if (str.Meridians[8].I_Bioene < str.SlaveOf(str.Meridians[8]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AN{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AN{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Estomago
            if (str.Meridians[12].G_as_Mother > maxLimit)
            {
                if (str.Meridians[12].I_Bioene < str.SonOf(str.Meridians[12]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AR{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AR{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[12].G_as_Master > maxLimit)
            {
                if (str.Meridians[12].I_Bioene < str.SlaveOf(str.Meridians[12]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AS{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AS{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Pulmon
            if (str.Meridians[4].G_as_Mother > maxLimit)
            {
                if (str.Meridians[4].I_Bioene < str.SonOf(str.Meridians[4]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AW{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AW{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[4].G_as_Master > maxLimit)
            {
                if (str.Meridians[4].I_Bioene < str.SlaveOf(str.Meridians[4]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"AX{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"AX{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Intestion Grueso
            if (str.Meridians[1].G_as_Mother > maxLimit)
            {
                if (str.Meridians[1].I_Bioene < str.SonOf(str.Meridians[1]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BB{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BB{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[1].G_as_Master > maxLimit)
            {
                if (str.Meridians[1].I_Bioene < str.SlaveOf(str.Meridians[1]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BC{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BC{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Rinon
            if (str.Meridians[7].G_as_Mother > maxLimit)
            {
                if (str.Meridians[7].I_Bioene < str.SonOf(str.Meridians[7]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BG{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BG{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[7].G_as_Master > maxLimit)
            {
                if (str.Meridians[7].I_Bioene < str.SlaveOf(str.Meridians[7]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BH{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BH{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Vejiga
            if (str.Meridians[11].G_as_Mother > maxLimit)
            {
                if (str.Meridians[11].I_Bioene < str.SonOf(str.Meridians[11]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BL{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BL{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[11].G_as_Master > maxLimit)
            {
                if (str.Meridians[11].I_Bioene < str.SlaveOf(str.Meridians[11]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BM{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BM{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Higado
            if (str.Meridians[9].G_as_Mother > maxLimit)
            {
                if (str.Meridians[9].I_Bioene < str.SonOf(str.Meridians[9]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BQ{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BQ{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[9].G_as_Master > maxLimit)
            {
                if (str.Meridians[9].I_Bioene < str.SlaveOf(str.Meridians[9]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BR{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BR{row}"], CategoryColor.Dominancia);
                }
            }
            // Set for Vesicula Biliar
            if (str.Meridians[10].G_as_Mother > maxLimit)
            {
                if (str.Meridians[10].I_Bioene < str.SonOf(str.Meridians[10]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BV{row}"], CategoryColor.Contracorriente);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BV{row}"], CategoryColor.Bloqueo);
                }
            }
            if (str.Meridians[10].G_as_Master > maxLimit)
            {
                if (str.Meridians[10].I_Bioene < str.SlaveOf(str.Meridians[10]).I_Bioene)
                {
                    SetCategoryColor(sheet.Cells[$"BW{row}"], CategoryColor.Contradominancia);
                }
                else
                {
                    SetCategoryColor(sheet.Cells[$"BW{row}"], CategoryColor.Dominancia);
                }
            }
        }