private void trackAlarmTimer_Tick(object sender, EventArgs e)
        {
            DBConnector dBc = new DBConnector();

            dBc.connect();
            BedsideHandler bedsideHandler   = new BedsideHandler();
            int            alarmStatus8     = bedsideHandler.SelectAlarmStatusBedside(dBc.getConn(), BedsideLoginScreen.bedsideIDPass);
            int            alarmZeroStatus8 = bedsideHandler.SelectAlarmZeroStatusBedside(dBc.getConn(), BedsideLoginScreen.bedsideIDPass);

            if ((alarmStatus8 == 1) || (alarmZeroStatus8 == 1))
            {
                if (alarmZeroStatus8 == 1)
                {
                    if (!backgroundWorkerAlarmZero.IsBusy)
                    {
                        backgroundWorkerAlarmZero.RunWorkerAsync();
                        backgroundWorkerBeep.CancelAsync();
                        backgroundWorkerAlarmReading.CancelAsync();
                    }
                }
                else
                {
                    if (!backgroundWorkerAlarmReading.IsBusy)
                    {
                        backgroundWorkerAlarmReading.RunWorkerAsync();
                        backgroundWorkerBeep.CancelAsync();
                    }
                }
            }
            else
            {
                backgroundWorkerAlarmZero.CancelAsync();
                backgroundWorkerAlarmReading.CancelAsync();
            }
        }
Beispiel #2
0
        //go to the bedside main screen when bedside id currently is assigned to the patient
        private void continueExistingBtn_Click(object sender, EventArgs e)
        {
            if (bedsideIdExistingComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Please select valid bedsideId");
                return;
            }
            BedsideHandler bedsideHandler = new BedsideHandler();
            DBConnector    dbC            = new DBConnector();

            dbC.connect();
            int  bedsideId = int.Parse(bedsideIdExistingComboBox.SelectedItem.ToString());
            int  patientId = int.Parse(patientIdTextBox.Text);
            bool status    = bedsideHandler.continueBedside(dbC.getConn(), bedsideId, patientId);

            if (status)
            {
                bedside_patient_id = patientId;
                bedsideIDPass      = bedsideId;
                BedsideMainScreen bedsideMainScreen = new BedsideMainScreen();
                bedsideMainScreen.Show();

                Close();
            }
        }
        public void setAssignPatientId()
        {
            assignPatientIdcomboBox.Visible = true;
            assignBedsideIdBtn.Visible      = true;
            BedsideHandler bedsideHandler = new BedsideHandler();

            bedsideHandler.FetchBedsidePatientId(assignPatientIdcomboBox);
        }
Beispiel #4
0
        //change the patientIdtextbox when bedsideIdExistingComboBox_SelectedIndex is Changed
        private void bedsideIdExistingComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            BedsideHandler bedsideHandler = new BedsideHandler();
            DBConnector    dbC            = new DBConnector();

            dbC.connect();
            if (bedsideIdExistingComboBox.SelectedIndex != 0)
            {
                Patient existPatient = bedsideHandler.getSpecificPatientInBedside(dbC.getConn(), int.Parse(bedsideIdExistingComboBox.SelectedItem.ToString()));
                patientIdTextBox.Text = existPatient.Id.ToString();
            }
        }
Beispiel #5
0
        //show assign panel
        private void assignBtn_Click(object sender, EventArgs e)
        {
            existingPanel.Hide();
            showMenuPanel.Hide();
            assignPanel.Show();

            //create object bedside handler
            BedsideHandler bedsideHandler = new BedsideHandler();
            bool           status         = false;

            //get all bedside id currently not assigned to patient
            bedsideHandler.FetchBedsideId(bedsideIdAssignComboBox, status);
            bedsideHandler.FetchBedsidePatientId(patientIDAssignComboBox);
        }
Beispiel #6
0
        //show existing panel
        private void existingBtn_Click(object sender, EventArgs e)
        {
            existingPanel.Show();
            showMenuPanel.Hide();
            assignPanel.Hide();

            //create object bedside handler
            BedsideHandler bedsideHandler = new BedsideHandler();
            bool           status         = true;

            //get all bedside id currently assigned to patient
            bedsideHandler.FetchBedsideId(bedsideIdExistingComboBox, status);
            patientIdTextBox.Text = "";
        }
        private void muteAlarmBtn_Click(object sender, EventArgs e)
        {
            smsTrigger = 1;
            DBConnector dBConn = new DBConnector();

            dBConn.connect();
            AlarmHandler alarmHandler = new AlarmHandler();
            int          id           = alarmHandler.getLastId(dBConn.getConn(), BedsideLoginScreen.bedside_patient_id);
            int          result       = alarmHandler.updateDateTimeMuted(dBConn.getConn(), BedsideLoginScreen.bedside_patient_id, id);

            if (id > 0)
            {
                if (result == 1)
                {
                    BedsideHandler bedsideHandler = new BedsideHandler();
                    int            alarmResult    = bedsideHandler.updateAlarmStatus(dBConn.getConn(), BedsideLoginScreen.bedsideIDPass, 0);
                    if (alarmResult == 1)
                    {
                        int alarmResultZero = bedsideHandler.updateAlarmZeroStatus(dBConn.getConn(), BedsideLoginScreen.bedsideIDPass, 0);

                        if (alarmResultZero == 1)
                        {
                            MessageBox.Show("Muted Alarm", "Muted Alarm", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            alarmReadingStatus = false;
                            alarmZeroStatus    = false;

                            if (backgroundWorkerAlarmReading.IsBusy)
                            {
                                backgroundWorkerAlarmReading.CancelAsync();
                            }

                            if (backgroundWorkerAlarmZero.IsBusy)
                            {
                                backgroundWorkerAlarmZero.CancelAsync();
                            }

                            backgroundWorkerBeep.RunWorkerAsync();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Alarm cannot be muted", "Muted Alarm", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #8
0
        //assign bedside id to a patient
        private void proceedAssignBtn_Click(object sender, EventArgs e)
        {
            //if bedsideIdAssignComboBox selected index = 0, show warning message
            if (bedsideIdAssignComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Please select valid bedside id", "Bedside ID", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //patientIDAssignComboBox selected index = 0, show warning message
            if (patientIDAssignComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Please select valid patient id", "Patient ID", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //connect database
            DBConnector dbC = new DBConnector();

            dbC.connect();

            //get current bedside id when user selected the combo box items
            int bedsideId = int.Parse(bedsideIdAssignComboBox.SelectedItem.ToString());

            //get current patient id when user selected the combo box items
            int patientId = int.Parse(patientIDAssignComboBox.SelectedItem.ToString());

            //create new object bedside handler
            BedsideHandler bedsideHandler = new BedsideHandler();

            //assign a bedside id to a patient
            int assignResult = bedsideHandler.assignBedside(dbC.getConn(), bedsideId, patientId);

            //if assignresult return value = 1
            if (assignResult == 1)
            {
                //assign bedside id to patient
                int statusResult = bedsideHandler.updateStatus(dbC.getConn(), bedsideId);

                if (statusResult == 1)
                {
                    //static int field get value from patientId
                    bedside_patient_id = patientId;
                    bedsideIDPass      = bedsideId;
                    //create new object bedside main screen
                    BedsideMainScreen ms = new BedsideMainScreen();

                    //show bedside main screen
                    ms.Show();

                    //close login screen
                    Close();
                }
                else
                {
                    //show error message if failed to access
                    MessageBox.Show("Failed to access", "Failed to access", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                //show error message  if failed to access
                MessageBox.Show("Failed to access", "Failed to access", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void centralbedsideIdcomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (centralbedsideIdcomboBox.SelectedIndex > 0)
            {
                int index = centralbedsideIdcomboBox.SelectedIndex;


                if (listBedside[index].Status)
                {
                    DBConnector dBConn = new DBConnector();
                    dBConn.connect();
                    centralBedsideStatus.Text      = "ONLINE";
                    centralBedsideStatus.ForeColor = Color.Green;
                    BedsideHandler bedsideHandler = new BedsideHandler();
                    bool           status         = bedsideHandler.checkExistBedside(dBConn.getConn(), listBedside[index].Id);

                    if (status)
                    {
                        assignPatientIdcomboBox.Visible = false;
                        assignBedsideIdBtn.Visible      = false;
                        readingPanel.Show();
                        Patient patient = bedsideHandler.getSpecificPatientInBedside(dBConn.getConn(), listBedside[index].Id);
                        patientIdStatic                 = patient.Id;
                        centralPatientIdLabel.Text      = patient.Id.ToString();
                        centralPatientIdLabel.ForeColor = Color.Black;
                        centralPatientNameLabel.Text    = patient.FullName;
                        ReadingHandler readingHandler = new ReadingHandler();
                        bool           statusReading  = readingHandler.checkExistsReading(dBConn.getConn(), patient.Id);

                        if (statusReading)
                        {
                            Reading reading = readingHandler.getReading(dBConn.getConn(), patient.Id);
                            minBP.Text          = reading.MinBloodPressure.ToString();
                            maxBP.Text          = reading.MaxBloodPressure.ToString();
                            minBR.Text          = reading.MinBreathing.ToString();
                            maxBR.Text          = reading.MaxBreathing.ToString();
                            minPR.Text          = reading.MinPulse.ToString();
                            maxPR.Text          = reading.MaxPulse.ToString();
                            minTemp.Text        = reading.MinTemperature.ToString();
                            maxTemp.Text        = reading.MaxTemperature.ToString();
                            minBPtextBox.Text   = reading.MinBloodPressure.ToString();
                            maxBPtextBox.Text   = reading.MaxBloodPressure.ToString();
                            minBRtextBox.Text   = reading.MinBreathing.ToString();
                            maxBRtextBox.Text   = reading.MaxBreathing.ToString();
                            minPRtextBox.Text   = reading.MinPulse.ToString();
                            maxPRtextBox.Text   = reading.MaxPulse.ToString();
                            minTemptextBox.Text = reading.MinTemperature.ToString();
                            maxTemptextBox.Text = reading.MaxTemperature.ToString();
                        }
                    }
                }
                else
                {
                    readingPanel.Hide();
                    centralBedsideStatus.Text       = "OFFLINE";
                    centralBedsideStatus.ForeColor  = Color.Red;
                    centralPatientIdLabel.Text      = "No Assigned Patient ID";
                    centralPatientIdLabel.ForeColor = Color.Red;
                    centralPatientNameLabel.Text    = "--";
                    minBP.Text          = "--";
                    maxBP.Text          = "--";
                    minBR.Text          = "--";
                    maxBR.Text          = "--";
                    minPR.Text          = "--";
                    maxPR.Text          = "--";
                    minTemp.Text        = "--";
                    maxTemp.Text        = "--";
                    minBPtextBox.Text   = "";
                    maxBPtextBox.Text   = "";
                    minBRtextBox.Text   = "";
                    maxBRtextBox.Text   = "";
                    minPRtextBox.Text   = "";
                    maxPRtextBox.Text   = "";
                    minTemptextBox.Text = "";
                    maxTemptextBox.Text = "";
                }

                //if (centralPatientIdLabel.Text == "No Assigned Patient ID")
                //{
                //    assignPatientIdcomboBox.Items.Clear();
                //    setAssignPatientId();
                //}
            }
        }
        private async void readTemperatureData()
        {
            kayChart dataChart = new kayChart(temperatureLineGraph, 60);

            dataChart.serieName = "Temperature";
            string path = "../../../Patient-Monitoring-System/data files/temperatureCSV.csv";
            string line;

            try
            {
                StreamReader sr = new StreamReader(path);
                line = sr.ReadLine();
                while (line != null)
                {
                    string[] columns = line.Split(',');
                    foreach (string column in columns)
                    {
                        if (run)
                        {
                            double value = double.Parse(column);
                            //add each value to database *DONT Delete*
                            DateTime    currentDate = DateTime.Now;
                            DateTime    currentTime = DateTime.Now;
                            DBConnector dBConn      = new DBConnector();
                            dBConn.connect();
                            Temperature newTemperature = new Temperature();
                            newTemperature.TemperatureValue = value;
                            newTemperature.TemperatureDate  = currentDate;
                            newTemperature.TemperatureTime  = currentTime;
                            TemperatureHandler temperatureHandler = new TemperatureHandler();
                            ReadingHandler     readingHandler     = new ReadingHandler();
                            int result = temperatureHandler.addNewTemperature(dBConn.getConn(), newTemperature, BedsideLoginScreen.bedside_patient_id);

                            if (result != 1)
                            {
                                MessageBox.Show("Insert Data failed");
                            }

                            await Task.Delay(1500);

                            await Task.Factory.StartNew(() =>
                            {
                                dataChart.TriggeredUpdate(value);
                            });

                            if (value == 0)
                            {
                                if (smsTrigger == 1)
                                {
                                    if (!backgroundWorkerSendSMS.IsBusy)
                                    {
                                        backgroundWorkerSendSMS.RunWorkerAsync();
                                    }
                                }
                                temperatureLineGraph.Series["Temperature"].Color = Color.Red;
                                temperatureCurrentValue.ForeColor = Color.Red;
                                BedsideHandler bedsideHandler = new BedsideHandler();
                                int            alarmResult    = bedsideHandler.updateAlarmZeroStatus(dBConn.getConn(), BedsideLoginScreen.bedsideIDPass, 1);

                                alarmZeroStatus = true;
                                AlarmHandler alarmHandler = new AlarmHandler();
                                int          specificId   = alarmHandler.getSpecificId(dBConn.getConn(), value, "temperature");

                                if (specificId > 0)
                                {
                                    bool triggerStatus = alarmHandler.triggerAlarm(dBConn.getConn(), value, BedsideLoginScreen.bedside_patient_id, 0, specificId, "Temperature");
                                    if (triggerStatus)
                                    {
                                        listTemperature.Add(newTemperature);
                                    }
                                }
                            }
                            else
                            if (value >= double.Parse(maxTemperatureLabel.Text) || value <= double.Parse(minTemperatureLabel.Text))
                            {
                                if (smsTrigger == 1)
                                {
                                    if (!backgroundWorkerSendSMS.IsBusy)
                                    {
                                        backgroundWorkerSendSMS.RunWorkerAsync();
                                    }
                                }
                                temperatureLineGraph.Series["Temperature"].Color = Color.Yellow;
                                temperatureCurrentValue.ForeColor = Color.Yellow;

                                BedsideHandler bedsideHandler = new BedsideHandler();
                                int            alarmResult    = bedsideHandler.updateAlarmStatus(dBConn.getConn(), BedsideLoginScreen.bedsideIDPass, 1);

                                alarmReadingStatus = true;
                                int id = readingHandler.getIdAlarmTrigger(dBConn.getConn(), value);

                                if (id > 0)
                                {
                                    AlarmHandler alarmHandler  = new AlarmHandler();
                                    bool         triggerStatus = alarmHandler.triggerAlarm(dBConn.getConn(), value, BedsideLoginScreen.bedside_patient_id, id, 0, "Temperature");
                                    if (triggerStatus)
                                    {
                                        listTemperature.Add(newTemperature);
                                    }
                                }
                            }
                            else
                            {
                                temperatureLineGraph.Series["Temperature"].Color = Color.Green;
                                temperatureCurrentValue.ForeColor = Color.Green;
                            }
                            temperatureCurrentValue.Text = value.ToString() + "°C";
                        }
                        else
                        {
                            break;
                        }
                    }

                    line = sr.ReadLine();
                }
            }
            catch (FileNotFoundException e)
            {
                MessageBox.Show(e.ToString());
                Console.WriteLine(e.ToString());
            }
        }