コード例 #1
0
        public AppointmentEditor(Scheduling s, Demographics d, Appointment a, Billing b, DateTime da, int ts, UpdateDisplay upd, bool ud = false)
        {
            Logging.Log("AppointmentScheduler is initiated");

            InitializeComponent();
            billing       = b;
            isUpdate      = ud;
            updateDisplay = upd;
            timeSlot      = ts;
            selectedDate  = da;
            scheduling    = s;
            demographics  = d;
            appointment   = a;

            foreach (BillingRecord br in billing.allBillingCodes.Values)
            {
                cbBillingCodes.Items.Add(br);
            }

            tbPrimaryPatient.Text = demographics.GetPatientByID(appointment.PatientID).GetName();
            btnPrimaryAdd.Click  += BtnPrimaryAdd_Click;

            foreach (ApptBillRecord br in billing.GetApptBillRecords(appointment.AppointmentID))
            {
                Chip c = new Chip();
                c.Margin  = new Thickness(4);
                c.Content = br.BillingCode;

                if (Int32.Parse(br.PatientID) == appointment.PatientID)
                {
                    wpBillingCodesPrimary.Children.Add(c);
                }
                else
                {
                    wpBillingCodesSecondary.Children.Add(c);
                }
            }

            if (a.DependantID == -1)
            {
                btnSecondaryAdd.Visibility = Visibility.Hidden;
            }
            else
            {
                tbDependantPatient.Text = demographics.GetPatientByID(appointment.DependantID).GetName();
                btnSecondaryAdd.Click  += BtnSecondaryAdd_Click;;
            }
        }
コード例 #2
0
        public void Functional_GetPatientbyID()
        {
            try
            {
                Demographics d = new Demographics();

                Patient p = new Patient(d);
                p.FirstName   = "alex";
                p.LastName    = "koxak";
                p.HCN         = "0987654321GF";
                p.MInitial    = "A";
                p.DateOfBirth = "12111997";
                p.Sex         = "M";
                p.HeadOfHouse = "1234567890AB";

                d.AddNewPatient(p);
                int     count = d.GetPatientIDByHCN(p.HCN);
                Patient dp    = d.GetPatientByID(count);

                if (dp != null)
                {
                    if (!(dp.HCN == p.HCN))
                    {
                        Assert.Fail();
                    }
                }
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
コード例 #3
0
        /**
         * \brief <b>Brief Description</b> - Execute <b><i>class method</i></b> - An overload of the entry point into the scheduling of a recall menu
         * \details <b>Details</b>
         *
         * This takes in the existing patient information, if it should return a patient and the demographics library
         *
         * \return <b>void</b>
         */
        public void Execute(Scheduling scheduling, Demographics demographics, Billing billing)
        {
            // get a list of all appointments that are flagged for recall
            List <Appointment>            appointments = scheduling.GetFlaggedAppointments();
            List <Pair <string, string> > content      = new List <Pair <string, string> >();

            // if there are any appointments flagged
            if (appointments.Count > 0)
            {
                // give menu to browse through those records and select an appointment
                Appointment selectedAppt = BrowseRecords(appointments, MenuCodes.SCHEDULING, "Scheduling", 1);

                // check if the user didnt cancel during record browse
                if (selectedAppt != null)
                {
                    // get the date of when the recall is allowed to start being scheduled
                    DateTime date = scheduling.GetDateByAppointmentID(selectedAppt.AppointmentID).AddDays(selectedAppt.RecallFlag * 7);

                    // display the content
                    Container.DisplayContent(content, 1, 1, MenuCodes.SCHEDULING, "Scheduling", Description);

                    // get a new selected appointment for the recall
                    Pair <Day, int> selectedRecallDate = SelectAppointmentSlot.Get(scheduling, demographics, date, 1, MenuCodes.SCHEDULING, Description);
                    Day             selectedDay        = selectedRecallDate.First;
                    int             slot = selectedRecallDate.Second;

                    // check if the user didnt cancel during recall appointment scheduling
                    if (selectedDay != null)
                    {
                        // get the appointment slot based on the selected day
                        Appointment SelectedAppointment = selectedDay.GetAppointments()[slot];
                        DateTime    selectedDate        = scheduling.GetDateFromDay(selectedDay);

                        // check if appointment is not already taken
                        if (SelectedAppointment.AppointmentID == -1)
                        {
                            // get the patient from the selected appointment
                            Patient searchResult = demographics.GetPatientByID(selectedAppt.PatientID);

                            // check if patient was found
                            if (searchResult != null)
                            {
                                // schedule appointment and check if successful
                                if (scheduling.ScheduleAppointment(new Appointment(searchResult.PatientID, -1, 0), selectedDate, slot))
                                {
                                    // update the appointment information
                                    scheduling.UpdateAppointmentInfo(selectedAppt.AppointmentID, 0);

                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Appointment scheduled successfully!", "") }
                                    },
                                                             1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }
                                else
                                {
                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("An error was encountered while scheduling appointment.", "") }
                                    },
                                                             1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }
                            }
                        }
                        // the appointment is already taken
                        else
                        {
                            Container.DisplayContent(new List <Pair <string, string> >()
                            {
                                { new Pair <string, string>("Appointment slot is already taken.", "") }
                            },
                                                     1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                        }
                    }
                }
            }
            else
            {
                Container.DisplayContent(new List <Pair <string, string> >()
                {
                    { new Pair <string, string>("No appointments flagged for recall.", "") }
                },
                                         1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
            }
            Console.ReadKey();
        }
コード例 #4
0
        /**
         * \brief <b>Brief Description</b> - Execute <b><i>class method</i></b> - An overload of the entry point into the appointment scheduling menu
         * \details <b>Details</b>
         *
         * This takes in the existing patient information, if it should return a patient and the demographics library
         *
         * \return <b>void</b>
         */
        public void Execute(Scheduling scheduling, Demographics demographics, Billing billing)
        {
            while (true)
            {
                // let the user select an appointment
                Pair <Day, int> kvp         = SelectAppointmentSlot.Get(scheduling, demographics);
                Day             selectedDay = kvp.First;
                int             slot        = kvp.Second;

                // check if the selected day is valid
                if (selectedDay != null)
                {
                    // get appointment
                    Appointment SelectedAppointment = selectedDay.GetAppointments()[slot];

                    // get a date for the appointment
                    DateTime selectedDate = scheduling.GetDateFromDay(selectedDay);

                    // check if there is no patient scheduled for that slot
                    if (SelectedAppointment.AppointmentID == -1)
                    {
                        while (true)
                        {
                            // let user select a patient to book for the appointment slot
                            Patient searchResult = GetPatient.Get(MenuCodes.SCHEDULING, "Scheduling", 0);

                            // check if user did not cancel during patient selection
                            if (searchResult != null)
                            {
                                // check if appoint could be scheduled successfully
                                if (scheduling.ScheduleAppointment(new Appointment(searchResult.PatientID, -1, 0), selectedDate, slot))
                                {
                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Appointment scheduled successfully!", "") }
                                    },
                                                             0, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }
                                else
                                {
                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("An error was encountered while scheduling appointment.", "") }
                                    },
                                                             0, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }

                                Console.ReadKey();
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    // appointment slot is taken
                    else
                    {
                        const int BUTTONCOUNT = 6;
                        int       selectedButton = 0;
                        Patient   scheduledPatient, scheduledDependant;

                        while (selectedButton != -1)
                        {
                            // get the patient scheduled for that appointment slot and its dependant
                            scheduledPatient   = demographics.GetPatientByID(SelectedAppointment.PatientID);
                            scheduledDependant = demographics.GetPatientByID(SelectedAppointment.DependantID);

                            List <KeyValuePair <string, string> > content = new List <KeyValuePair <string, string> >
                            {
                                // add patient info
                                new KeyValuePair <string, string>("", ""),
                                new KeyValuePair <string, string>("Patient: ", scheduledPatient.ToString())
                            };

                            // check if patient has dependant
                            if (scheduledDependant != null)
                            {
                                // append dependant info to patient info
                                content.Add(new KeyValuePair <string, string>("Dependant: ", scheduledDependant.ToString()));
                            }

                            // add some space
                            content.Add(new KeyValuePair <string, string>("", ""));

                            int initialButtonIndex = content.Count + 1;

                            // add the buttons for the scheduled appointment
                            content.Add(new KeyValuePair <string, string>(" >> ADD BILLING CODE << ", ""));
                            content.Add(new KeyValuePair <string, string>(" >> FLAG FOR RECALL << ", ""));
                            content.Add(new KeyValuePair <string, string>((scheduledDependant != null) ? " >> CHANGE DEPENDANT << " : " >> ADD DEPENDANT << ", ""));
                            content.Add(new KeyValuePair <string, string>(" >> REMOVE DEPEDANT << ", ""));
                            content.Add(new KeyValuePair <string, string>(" >> CHANGE DATE << ", ""));
                            content.Add(new KeyValuePair <string, string>(" >> CANCEL APPOINTMENT << ", ""));

                            selectedButton = initialButtonIndex;

                            // display the content of the content with the buttons
                            Container.DisplayContent(content, 0, initialButtonIndex, MenuCodes.SCHEDULING, "Scheduling", Description);
                            selectedButton = ScheduledPatientMenu(content, BUTTONCOUNT, initialButtonIndex);

                            switch ((ApptMenuOptions)(selectedButton - initialButtonIndex))
                            {
                            // ADD BILLING CODES
                            case ApptMenuOptions.ADDBILLINGCODE:
                                int returnStatus = 0;

                                Patient patientToBill = scheduledPatient;

                                // check if patient has dependant to bill
                                if (SelectedAppointment.DependantID != -1)
                                {
                                    // show depandat as option to bill
                                    patientToBill = GetPatient.BrowseRecords(new List <Patient>()
                                    {
                                        demographics.GetPatientByID(SelectedAppointment.PatientID), demographics.GetPatientByID(SelectedAppointment.DependantID)
                                    }, MenuCodes.SCHEDULING, Description, 0);
                                }

                                // if patient/dependant exists
                                if (patientToBill != null)
                                {
                                    // add billing codes until an invalid one is entered
                                    while ((returnStatus = AddBillingCode(SelectedAppointment.AppointmentID.ToString(), patientToBill.PatientID.ToString(), billing)) != -1)
                                    {
                                        if (returnStatus == 1)
                                        {
                                            Container.DisplayContent(new List <Pair <string, string> >()
                                            {
                                                { new Pair <string, string>("Billing code were entered successfuly!", "") }
                                            },
                                                                     0, selectedButton, MenuCodes.SCHEDULING, "Scheduling", Description);
                                        }
                                        else if (returnStatus == 0)
                                        {
                                            Container.DisplayContent(new List <Pair <string, string> >()
                                            {
                                                { new Pair <string, string>("Invalid billing code.", "") }
                                            },
                                                                     0, selectedButton, MenuCodes.SCHEDULING, "Scheduling", Description);
                                        }

                                        Console.ReadKey();
                                    }
                                }

                                break;

                            // FLAG FOR RECALL
                            case ApptMenuOptions.FLAGRECALL:
                                Container.DisplayContent(new List <Pair <string, string> >()
                                {
                                    { new Pair <string, string>("Enter the new recall flag:", "") }
                                },
                                                         0, selectedButton, MenuCodes.SCHEDULING, "Scheduling", Description);

                                Console.CursorTop  = 6;
                                Console.CursorLeft = 55;

                                // get the recall flag
                                Pair <InputRetCode, string> inputReturn = Input.GetInput(SelectedAppointment.RecallFlag.ToString(), 2, InputType.Ints);

                                // if the user saved their flag instead of exiting
                                if ((inputReturn.First & InputRetCode.SAVE) != 0)
                                {
                                    // print status update on whether the flag was changed
                                    if (scheduling.UpdateAppointmentInfo(SelectedAppointment.AppointmentID, int.Parse(inputReturn.Second)))
                                    {
                                        Container.DisplayContent(new List <Pair <string, string> >()
                                        {
                                            { new Pair <string, string>("Recall flag updated!", "") }
                                        },
                                                                 0, selectedButton, MenuCodes.SCHEDULING, "Scheduling", Description);
                                    }
                                    else
                                    {
                                        Container.DisplayContent(new List <Pair <string, string> >()
                                        {
                                            { new Pair <string, string>("Recall flag could not be updated.", "") }
                                        },
                                                                 0, selectedButton, MenuCodes.SCHEDULING, "Scheduling", Description);
                                    }

                                    Console.ReadKey();
                                }

                                break;

                            // ADD DEPENDANT
                            case ApptMenuOptions.ADDDEPENDANT:
                                // get the patient to add dependant to
                                Patient dependant = GetPatient.Get(MenuCodes.SCHEDULING, "Scheduling", 0, SelectedAppointment.PatientID);

                                // check if user did not exit during patient search
                                if (dependant != null)
                                {
                                    // add dependant to patient
                                    SelectedAppointment.DependantID = dependant.PatientID;
                                    scheduling.UpdateAppointmentInfo(SelectedAppointment.AppointmentID, SelectedAppointment.PatientID,
                                                                     SelectedAppointment.DependantID, SelectedAppointment.RecallFlag);

                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Dependant successfully added!", "") }
                                    },
                                                             0, selectedButton, MenuCodes.SCHEDULING, "Scheduling", Description);
                                    Console.ReadKey();
                                }
                                break;

                            // REMOVE DEPENDANT
                            case ApptMenuOptions.REMOVEDEPENDANT:
                                // check if appointment has dependant associated
                                if (SelectedAppointment.DependantID == -1)
                                {
                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Appointment has no dependant associated.", "") }
                                    },
                                                             0, -1, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }
                                else
                                {
                                    // remove dependant
                                    SelectedAppointment.DependantID = -1;
                                    scheduling.UpdateAppointmentInfo(SelectedAppointment.AppointmentID, SelectedAppointment.PatientID,
                                                                     SelectedAppointment.DependantID, SelectedAppointment.RecallFlag);

                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Dependant successfully removed!", "") }
                                    },
                                                             0, -1, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }

                                Console.ReadKey();
                                break;

                            // CHANGE APPT DATE
                            case ApptMenuOptions.CHANGEDATE:
                                // get the new appointment slot
                                Pair <Day, int> newAppointmentSlot = SelectAppointmentSlot.Get(scheduling, demographics);

                                // check if user did not cancel during appointment selection
                                if (newAppointmentSlot.First != null)
                                {
                                    Appointment newSelectedAppointment = selectedDay.GetAppointments()[newAppointmentSlot.Second];
                                    DateTime    newSelectedDate        = scheduling.GetDateFromDay(newAppointmentSlot.First);

                                    // check if appointent could be scheduled to new date
                                    if (scheduling.UpdateAppointmentDate(newSelectedDate, newAppointmentSlot.Second, SelectedAppointment.AppointmentID))
                                    {
                                        Container.DisplayContent(new List <Pair <string, string> >()
                                        {
                                            { new Pair <string, string>("Appointment date successfully changed!", "") }
                                        },
                                                                 0, -1, MenuCodes.SCHEDULING, "Scheduling", Description);
                                    }
                                    else
                                    {
                                        Container.DisplayContent(new List <Pair <string, string> >()
                                        {
                                            { new Pair <string, string>("Appointment date could not be changed.", "") }
                                        },
                                                                 0, -1, MenuCodes.SCHEDULING, "Scheduling", Description);
                                    }

                                    Console.ReadKey();
                                }
                                break;

                            // CANCEL APPT
                            case ApptMenuOptions.CANCELAPPT:
                                // attempt to cancel appointment
                                if (scheduling.CancelAppointment(SelectedAppointment.AppointmentID))
                                {
                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Appointment successfully canceled!", "") }
                                    },
                                                             0, -1, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }
                                else
                                {
                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Appointment could not be canceled.", "") }
                                    },
                                                             0, -1, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }

                                Console.ReadKey();

                                break;
                            }
                        }
                    }
                }
                else
                {
                    break;
                }
            }
        }
コード例 #5
0
        public AppointmentCard(Appointment a, Demographics d, Scheduling s, Billing b, DialogHost dh, int slot, DateTime dt, UpdateDisplay upd)
        {
            InitializeComponent();
            updateDisplay = upd;
            dialogHost    = dh;
            appointment   = a;
            scheduling    = s;
            billing       = b;
            demographics  = d;
            timeSlot      = slot;
            selectedDate  = dt;

            if (appointment.AppointmentID == -1)
            {
                tbTitle.Text = "Unscheduled Appointment";
                chipPrimaryPatient.Visibility   = Visibility.Hidden;
                chipSecondaryPatient.Visibility = Visibility.Hidden;

                btnCancelAppointment.Content = "Schedule Appointment";
                btnCancelAppointment.Click  += ScheduleAppointment;

                btnCheckIn.Visibility         = Visibility.Hidden;
                btnEditAppointment.Visibility = Visibility.Hidden;

                if (DateTime.Compare(selectedDate.Date, DateTime.Now.Date) < 0)
                {
                    cardBackground.Background       = Brushes.LightGray;
                    btnCancelAppointment.Visibility = Visibility.Hidden;
                    btnEditAppointment.Visibility   = Visibility.Hidden;
                }
            }
            else
            {
                czState.Mode = ColorZoneMode.PrimaryLight;
                primary      = d.GetPatientByID(a.PatientID);
                dependant    = d.GetPatientByID(a.DependantID);

                tbTitle.Text = string.Format("Slot {0}", slot);

                chipPrimaryPatient.Content = string.Format("{0} {1}", primary.FirstName, primary.LastName);
                chipPrimaryPatient.Icon    = primary.FirstName[0];

                if (dependant != null)
                {
                    chipSecondaryPatient.Content = string.Format("{0} {1}", dependant.FirstName, dependant.LastName);
                    chipSecondaryPatient.Icon    = dependant.FirstName[0];
                }
                else
                {
                    chipSecondaryPatient.Visibility = Visibility.Hidden;
                }

                if (DateTime.Compare(selectedDate.Date, DateTime.Now.Date) < 0 || appointment.IsCheckedIn == 1)
                {
                    btnCheckIn.Content        = "Flag For Recall";
                    btnCheckIn.Click         += btnFlagForRecall_Click;
                    tbDays.Visibility         = Visibility.Visible;
                    cardBackground.Background = Brushes.LightGray;
                    czState.Mode = ColorZoneMode.PrimaryDark;
                    btnEditAppointment.Visibility = Visibility.Hidden;
                    btnCancelAppointment.Content  = "Add Codes / Notes";
                    btnCancelAppointment.Click   += AddCodesAndNotes;
                }
                else
                {
                    btnEditAppointment.Click   += EditAppointment;
                    btnCancelAppointment.Click += CancelAppointment;
                }
            }
        }
コード例 #6
0
        /**
         * \brief <b>Brief Description</b> - Get <b><i>class method</i></b> - main method used by outside methods to get the appointment
         * \details <b>Details</b>
         *
         * This takes in the scheduling and demographics libraries
         *
         * \return <b>Pair<Day, int></b> - the appointment slot
         */
        public static Pair <Day, int> Get(Scheduling scheduling, Demographics demographics)
        {
            Console.CursorVisible = true;
            Container.DisplayContent(new List <KeyValuePair <string, string> >(), 0, -1, MenuCodes.SCHEDULING, "Scheduling", Description);
            DateTime date = DateTime.Today;

            while (true)
            {
                // get the month from the user
                date = DatePicker.GetDate(scheduling, date, false);

                // check if the user didnt cancel the date selection
                if (date != new DateTime(0))
                {
                    do
                    {
                        // get the day from the user
                        DateTime selectedDate = DatePicker.GetDate(scheduling, date, true);

                        // check if the user canceled the date selection
                        if (selectedDate == new DateTime(0))
                        {
                            break;
                        }

                        // get the selected day
                        Day selectedDay = scheduling.GetScheduleByDay(selectedDate);

                        // get a list of appointments on that day
                        List <Appointment> apptList = selectedDay.GetAppointments();

                        List <Pair <string, string> > apptContent = new List <Pair <string, string> >();

                        // loop through all appointments on that day
                        foreach (Appointment appointment in apptList)
                        {
                            string line = "";

                            // if the appointment slot is not taken, sets it to be displayed as (EMPTY)
                            if (appointment.AppointmentID == -1 && appointment.PatientID == -1)
                            {
                                line = "(EMPTY)";
                            }
                            else
                            {
                                // get information about the main patient
                                Patient mainPatient = demographics.GetPatientByID(appointment.PatientID);

                                // get information about the dependant of the main patient
                                Patient dependantPatient = demographics.GetPatientByID(appointment.DependantID);

                                // format the main patient information
                                line = string.Format("{0}, {1} - {2}", mainPatient.LastName, mainPatient.FirstName, mainPatient.HCN);

                                // if the patient has a dependant, adds it to the patient information line
                                if (dependantPatient != null)
                                {
                                    line += string.Format(" > {0}, {1} - {2}", dependantPatient.LastName, dependantPatient.FirstName, dependantPatient.HCN);
                                }
                            }

                            // adds the patient line to the appointment content that will be displayed
                            apptContent.Add(new Pair <string, string>(line, ""));
                        }

                        int selectedIndex = 1;

                        // display all appointments
                        Container.DisplayContent(apptContent, 0, selectedIndex, MenuCodes.SCHEDULING, "Scheduling", Description);
                        ConsoleKey keyPressed = new ConsoleKey();
                        Console.CursorVisible = false;

                        // loop until user cancels
                        do
                        {
                            keyPressed = Console.ReadKey(true).Key;
                            switch (keyPressed)
                            {
                            // down arrow pressed therefore go to appt below
                            case ConsoleKey.DownArrow:
                                if (selectedIndex < apptContent.Count)
                                {
                                    selectedIndex++;
                                }
                                break;

                            // up arrow pressed therefore go to appt above
                            case ConsoleKey.UpArrow:
                                if (selectedIndex > 1)
                                {
                                    selectedIndex--;
                                }
                                break;

                            // enter pressed therefore return the selected appointment
                            case ConsoleKey.Enter:
                                return(new Pair <Day, int>(selectedDay, selectedIndex - 1));
                            }

                            // re-display the appointment selection
                            Container.DisplayContent(apptContent, 0, selectedIndex, MenuCodes.SCHEDULING, "Scheduling", Description);
                        } while (keyPressed != ConsoleKey.Escape);
                    } while (true);
                }
                // exit because user canceled date selection
                else
                {
                    break;
                }
            }

            // user canceled therefore return a blank selection
            return(new Pair <Day, int>(null, -1));
        }