示例#1
0
        public void getCMMatchesTest()
        {
            DbMethods.getInstance().clearTables();
            int p1ID = 0;
            DbMethods.getInstance().InsertPatient();

            DateTime now = DateTime.Now;

            DbMethods.getInstance().InsertVisit(p1ID, 1, 1, now);
            DbMethods.getInstance().InsertVisit(p1ID, 1, 1, now);
            DbMethods.getInstance().InsertVisit(p1ID, 1, 2, now);

            Patient p = new Patient(p1ID);
            p.Visits = DbMethods.getInstance().getPatientVisits(p1ID);

            ACV acv1 = new ACV(new List<Visit>(){
                p.Visits[0],
                p.Visits[1]
            });

            ACV acv2 = new ACV(new List<Visit>()
            {
                p.Visits[0],
                new Visit(1, 1, 3, now)
            });

            List<ACV> matches = p.GetCMMatches(acv1);
            Assert.True(matches.Count == 1);

            matches = p.GetCMMatches(acv2);
            Assert.True(matches.Count == 0);
        }
示例#2
0
        private void RenderCMMatches(int patientID)
        {
            int cmSize = 0;
            ACV CM = new ACV(new List<Visit>());
            Patient p = new Patient(patientID);

            do
            {
                Console.WriteLine("Choose the size of the CM : ");
                cmSize = int.Parse(Console.ReadLine());
            } while (cmSize <= 0);

            for (int i = 0; i < cmSize; i++)
            {
                int year;
                int month;
                int day;
                int rational;

                do
                {
                    Console.WriteLine("CM no : " + (i + 1));
                    Console.WriteLine("Month : ");
                    month = int.Parse(Console.ReadLine());
                } while (month <= 0);

                do
                {
                    Console.WriteLine("Day : ");
                    day = int.Parse(Console.ReadLine());
                } while (day <= 0);

                do
                {
                    Console.WriteLine("Year : ");
                    year = int.Parse(Console.ReadLine());
                } while (year <= 0);

                do
                {
                    Console.WriteLine("Rational : ");
                    Console.WriteLine("1. New");
                    Console.WriteLine("2. Checkup");
                    Console.WriteLine("3. Follow-up");
                    Console.WriteLine("4. Referral");
                    Console.WriteLine("5. Emergency");
                    rational = int.Parse(Console.ReadLine());
                } while (rational < 1 && rational > 5);

                CM.Add(new Visit(-1, -1, rational, new DateTime(year, month, day)));
            }

            //this._controller.matchCM(patientID, CM, false);
            List<ACV> matches = p.GetCMMatches(CM);
            int matchCounter = 1;

            foreach (ACV acv in matches)
            {
                Console.WriteLine();
                Console.WriteLine("Match : " + matchCounter++);
                Console.WriteLine(acv.ToString());
            }
            Console.WriteLine();
            Console.WriteLine("Combination to match : ");
            Console.WriteLine(CM.ToString());
            Console.WriteLine("Number of matches : " + matches.Count);
            Console.WriteLine();
        }
示例#3
0
        private void RenderCMMatches(ACV cm)
        {
            int patientID = this.AskForPatientID();
            Patient p = new Patient(patientID);

            List<ACV> matches = p.GetCMMatches(cm);
            int matchCounter = 1;

            foreach (ACV acv in matches)
            {
                Console.WriteLine("Match : " + matchCounter++);
                Console.WriteLine(acv.ToString());
            }
            Console.WriteLine();
            Console.WriteLine("Combination to match : ");
            Console.WriteLine(cm.ToString());
            Console.WriteLine("Number of matches : " + matches.Count);
            Console.WriteLine();
        }