public void displayData(string[] patientData)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            Patient ptient = new Patient();

            ptient.Wing  = patientData[0];
            ptient.Floor = patientData[1];
            ptient.Bay   = patientData[2];
            ptient.Bed   = patientData[3];

            label15.Text = patientData[0];
            label16.Text = patientData[1];
            label17.Text = patientData[2];
            label18.Text = patientData[3];

            PatientHandler patHnd = new PatientHandler();

            string checkId     = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId");
            string checkName   = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientName");
            string checkAge    = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientAge");
            string checkGender = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientGender");

            label11.Text = checkId;
            label12.Text = checkName;
            label13.Text = checkAge;
            label14.Text = checkGender;

            latestValues();
        }
예제 #2
0
        public void getBasicPatientDetails()
        {
            if ((comboBox1.SelectedItem).ToString() != " - SELECT WING - " &&
                (comboBox2.SelectedItem).ToString() != " - SELECT FLOOR - " &&
                (comboBox3.SelectedItem).ToString() != " - SELECT BAY - " &&
                (comboBox4.SelectedItem).ToString() != " - SELECT BED - ")
            {
                DbConnector dbConn = new DbConnector();
                dbConn.connect();

                Patient ptient = new Patient();

                ptient.Wing  = (comboBox1.SelectedItem).ToString();
                ptient.Floor = (comboBox2.SelectedItem).ToString();
                ptient.Bay   = (comboBox3.SelectedItem).ToString();
                ptient.Bed   = (comboBox4.SelectedItem).ToString();

                PatientHandler patHnd = new PatientHandler();

                string checkId     = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId");
                string checkName   = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientName");
                string checkAge    = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientAge");
                string checkGender = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientGender");

                label1.Text = checkId;
                label2.Text = checkName;
                label3.Text = checkAge;
                label4.Text = checkGender;

                label34.Text = (comboBox1.SelectedItem).ToString() + " → " + (comboBox2.SelectedItem).ToString() + " → " +
                               (comboBox3.SelectedItem).ToString();
                label36.Text = (comboBox4.SelectedItem).ToString().Remove(0, 4);
            }
            else
            {
                label1.Text = "No record found";
                label2.Text = "No record found";
                label3.Text = "No record found";
                label4.Text = "No record found";

                label34.Text = "- Wing → Floor - → Bay - ";
                label36.Text = "-";
            }
        }
예제 #3
0
        public void patientDBtable(int num)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            Patient        ptient     = new Patient();
            PatientHandler patientHnd = new PatientHandler();

            if (num == 1)
            {
                ptient.Name = textBox13.Text;
            }
            else if (num == 2)
            {
                ptient.Wing  = "%";
                ptient.Floor = "%";
                ptient.Bay   = "%";
                ptient.Bed   = "%";
            }

            dataGridView1.DataSource = patientHnd.listPatient(dbConn.getConn(), ptient, num);

            dataGridView1.Columns[0].HeaderText = "ID";
            dataGridView1.Columns[1].HeaderText = "NAME";
            dataGridView1.Columns[2].HeaderText = "AGE";
            dataGridView1.Columns[3].HeaderText = "GENDER";
            dataGridView1.Columns[4].HeaderText = "BEDSIDE ID";
            dataGridView1.Columns[5].HeaderText = "WING";
            dataGridView1.Columns[6].HeaderText = "FLOOR";
            dataGridView1.Columns[7].HeaderText = "BAY";
            dataGridView1.Columns[8].HeaderText = "BED";
            dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Columns[0].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView1.Columns[1].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView1.Columns[2].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView1.Columns[3].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView1.Columns[4].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
        }
예제 #4
0
        public void pictureBox1_Click(object sender, EventArgs e)
        {
            string wingSelected  = (comboBox1.SelectedItem).ToString();
            string floorSelected = (comboBox2.SelectedItem).ToString();
            string baySelected   = (comboBox3.SelectedItem).ToString();
            string bedSelected   = (comboBox4.SelectedItem).ToString();

            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            Patient ptient = new Patient();

            ptient.Wing  = wingSelected;
            ptient.Floor = floorSelected;
            ptient.Bay   = baySelected;
            ptient.Bed   = bedSelected;

            PatientHandler patHnd = new PatientHandler();

            string checkId = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId");

            if (checkId != "No record found")
            {
                string[] patientData = new string[4] {
                    wingSelected, floorSelected, baySelected, bedSelected
                };

                PatientModuleReadingsConfiguration passPatientData = new PatientModuleReadingsConfiguration();
                passPatientData.Show();
                passPatientData.displayData(patientData);
            }
            else
            {
                MessageBox.Show("No patient found !");
            }
        }
예제 #5
0
        private void textBox22_TextChanged(object sender, EventArgs e)
        {
            if (textBox22.Text != "")
            {
                if (Int32.TryParse(textBox22.Text, out int theId) && Int32.Parse(textBox22.Text) >= 0)
                {
                    DbConnector dbConn = new DbConnector();
                    dbConn.connect();
                    PatientHandler patHnd = new PatientHandler();

                    label51.Text = patHnd.getPatientDetailsById(dbConn.getConn(), Int32.Parse(textBox22.Text), "patientName");
                    label52.Text = patHnd.getPatientDetailsById(dbConn.getConn(), Int32.Parse(textBox22.Text), "patientAge");
                    label53.Text = patHnd.getPatientDetailsById(dbConn.getConn(), Int32.Parse(textBox22.Text), "patientGender");

                    if (label51.Text == "No record found")
                    {
                        label47.Text      = "Invalid Patient ID";
                        label47.ForeColor = Color.Red;
                        label47.Visible   = true;

                        button11.Enabled = false;
                        button12.Enabled = false;
                        button13.Enabled = false;
                        button14.Enabled = false;
                    }
                    else
                    {
                        label47.Text      = "Valid Patient ID";
                        label47.ForeColor = Color.Green;
                        label47.Visible   = true;

                        button11.Enabled = true;
                        button12.Enabled = true;
                        button13.Enabled = true;
                        button14.Enabled = true;
                    }
                }
                else
                {
                    label47.Text      = "Invalid Patient ID";
                    label47.ForeColor = Color.Red;
                    label47.Visible   = true;

                    button11.Enabled = false;
                    button12.Enabled = false;
                    button13.Enabled = false;
                    button14.Enabled = false;
                }
            }
            else
            {
                label51.Text = "No record found";
                label52.Text = "No record found";
                label53.Text = "No record found";

                button11.Enabled = false;
                button12.Enabled = false;
                button13.Enabled = false;
                button14.Enabled = false;

                label47.Text      = "Validate Medical Staff ID";
                label47.ForeColor = Color.Black;
                label47.Visible   = false;
            }
        }
예제 #6
0
        //Add new patient button
        private void button5_Click(object sender, EventArgs e)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            Patient        ptient  = new Patient();
            ModuleReadings mConfig = new ModuleReadings();

            if (textBox1.Text != "" && textBox2.Text != "" && (comboBox1.SelectedItem).ToString() != "- SELECT -" &&
                (comboBox2.SelectedItem).ToString() != "- SELECT -" && (comboBox3.SelectedItem).ToString() != "- SELECT -" &&
                (comboBox4.SelectedItem).ToString() != "- SELECT -" && (comboBox5.SelectedItem).ToString() != "- SELECT -" &&
                textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" &&
                textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "" && textBox10.Text != "" &&
                textBox11.Text != "" && textBox12.Text != "")
            {
                if (int.TryParse(textBox2.Text, out int theAge) && Int32.Parse(textBox2.Text) < 150)
                {
                    ptient.Name   = textBox1.Text;
                    ptient.Age    = Int32.Parse(textBox2.Text);
                    ptient.Gender = (comboBox1.SelectedItem).ToString();
                    ptient.Wing   = (comboBox2.SelectedItem).ToString();
                    ptient.Floor  = (comboBox3.SelectedItem).ToString();
                    ptient.Bay    = (comboBox4.SelectedItem).ToString();
                    ptient.Bed    = (comboBox5.SelectedItem).ToString();

                    mConfig.MinPulse     = Int32.Parse(textBox3.Text);
                    mConfig.MaxPulse     = Int32.Parse(textBox4.Text);
                    mConfig.MinBreath    = Int32.Parse(textBox6.Text);
                    mConfig.MaxBreath    = Int32.Parse(textBox5.Text);
                    mConfig.MinSystolic  = Int32.Parse(textBox8.Text);
                    mConfig.MaxSystolic  = Int32.Parse(textBox7.Text);
                    mConfig.MinDiastolic = Int32.Parse(textBox9.Text);
                    mConfig.MaxDiastolic = Int32.Parse(textBox10.Text);
                    mConfig.MinTemp      = float.Parse(textBox11.Text);
                    mConfig.MaxTemp      = float.Parse(textBox12.Text);

                    mConfig.PulseIntTime    = Int32.Parse(textBox23.Text);
                    mConfig.BreathIntTime   = Int32.Parse(textBox24.Text);
                    mConfig.PressureIntTime = Int32.Parse(textBox25.Text);
                    mConfig.TempIntTime     = Int32.Parse(textBox26.Text);

                    mConfig.PRModifiedTime   = DateTime.Now.ToString();
                    mConfig.BRModifiedTime   = DateTime.Now.ToString();
                    mConfig.BPModifiedTime   = DateTime.Now.ToString();
                    mConfig.TempModifiedTime = DateTime.Now.ToString();

                    PatientHandler patHnd    = new PatientHandler();
                    int            recordCnt = patHnd.addNewPatient(dbConn.getConn(), ptient);
                    patHnd.updatePatientBedsideIdAndReadings(dbConn.getConn(), ptient, mConfig);

                    MessageBox.Show(recordCnt + " Patient Registered Successfully !");

                    textBox1.Text  = "";
                    textBox2.Text  = "";
                    textBox3.Text  = "60";
                    textBox4.Text  = "100";
                    textBox5.Text  = "20";
                    textBox6.Text  = "12";
                    textBox7.Text  = "120";
                    textBox8.Text  = "80";
                    textBox9.Text  = "60";
                    textBox10.Text = "80";
                    textBox11.Text = "35.2";
                    textBox12.Text = "36.9";

                    textBox23.Text = "1";
                    textBox24.Text = "2";
                    textBox25.Text = "3";
                    textBox26.Text = "5";

                    comboBox1.SelectedIndex = 0;
                    comboBox2.SelectedIndex = 0;
                    comboBox3.SelectedIndex = 0;
                    comboBox4.SelectedIndex = 0;
                    comboBox5.SelectedIndex = 0;

                    patientDBtable(1);
                }
                else
                {
                    MessageBox.Show("Invalid format for Age !");
                }
            }
            else
            {
                MessageBox.Show("Please fill up all fields to register.");
            }
        }
예제 #7
0
        public void runMonitor(object sender, EventArgs e)
        {
            var pulseRate     = checkBox1.Checked;
            var breathingRate = checkBox2.Checked;
            var bloodPressure = checkBox3.Checked;
            var temperature   = checkBox4.Checked;

            var criticalColor = Color.FromArgb(255, 8, 8);
            var inRiskColor   = Color.FromArgb(255, 214, 8);
            var normalColor   = Color.FromArgb(8, 255, 86);

            line = sr.ReadLine();

            if (line == null)
            {
                sr   = new StreamReader("CSV/ModuleReadingsA.csv");
                line = sr.ReadLine();
            }

            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            Patient        ptient = new Patient();
            PatientHandler patHnd = new PatientHandler();

            ptient.Wing  = (comboBox1.SelectedItem).ToString();
            ptient.Floor = (comboBox2.SelectedItem).ToString();
            ptient.Bay   = (comboBox3.SelectedItem).ToString();
            ptient.Bed   = (comboBox4.SelectedItem).ToString();

            string getPatientId = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId");

            int   minPulse     = 60;
            int   maxPulse     = 100;
            int   minBreath    = 12;
            int   maxBreath    = 20;
            int   minSystolic  = 80;
            int   maxSystolic  = 120;
            int   minDiastolic = 60;
            int   maxDiastolic = 80;
            float minTemp      = 35.2F;
            float maxTemp      = 36.1F;

            int pulseIntervalTime         = 1;
            int breathIntervalTime        = 1;
            int bloodPressureIntervalTime = 1;
            int temperatureIntervalTime   = 1;

            if (getPatientId != "No record found")
            {
                ModuleReadingsHandler mRHand = new ModuleReadingsHandler();
                minPulse          = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", getPatientId));
                maxPulse          = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", getPatientId));
                pulseIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", getPatientId));

                minBreath          = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMin", getPatientId));
                maxBreath          = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", getPatientId));
                breathIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", getPatientId));

                minSystolic  = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMin", getPatientId));
                maxSystolic  = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", getPatientId));
                minDiastolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", getPatientId));
                maxDiastolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", getPatientId));
                bloodPressureIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", getPatientId));

                minTemp = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMin", getPatientId));
                maxTemp = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", getPatientId));
                temperatureIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", getPatientId));
            }

            PatientReadings        pRead    = new PatientReadings();
            PatientReadingsHandler pReadHnd = new PatientReadingsHandler();

            try
            {
                string[] data = line.Split(',');

                readingsList.Add(Int32.Parse(data[0]));

                //Pulse Rate Readings
                if (counter == pulseRateCounter && pulseRate != false)
                {
                    label10.Text = data[0];
                    label14.Text = (maxPulse).ToString();
                    label15.Text = (minPulse).ToString();

                    if (Int32.Parse(data[0]) == 0)
                    {
                        labelBorder(10, "Critical");
                        label14.ForeColor = criticalColor;
                        label15.ForeColor = criticalColor;
                    }
                    else if (Int32.Parse(data[0]) > maxPulse || Int32.Parse(data[0]) < minPulse)
                    {
                        labelBorder(10, "Risky");

                        if (Int32.Parse(data[0]) > maxPulse)
                        {
                            label14.ForeColor = inRiskColor;
                            label15.ForeColor = normalColor;
                        }
                        else
                        {
                            label14.ForeColor = normalColor;
                            label15.ForeColor = inRiskColor;
                        }
                    }
                    else if (Int32.Parse(data[0]) >= minPulse && Int32.Parse(data[0]) <= maxPulse)
                    {
                        labelBorder(10, "Normal");
                        label14.ForeColor = normalColor;
                        label15.ForeColor = normalColor;
                    }

                    pulseRateCounter = pulseRateCounter + pulseIntervalTime;
                }

                //Breathing Rate Readings
                if (counter == breathingRateCounter && breathingRate != false)
                {
                    label11.Text = data[1];
                    label16.Text = (maxBreath).ToString();
                    label17.Text = (minBreath).ToString();

                    if (Int32.Parse(data[1]) == 0)
                    {
                        labelBorder(11, "Critical");
                        label16.ForeColor = criticalColor;
                        label17.ForeColor = criticalColor;
                    }
                    else if ((Int32.Parse(data[1]) > maxBreath || Int32.Parse(data[1]) < minBreath))
                    {
                        labelBorder(11, "Risky");

                        if (Int32.Parse(data[1]) > maxBreath)
                        {
                            label16.ForeColor = inRiskColor;
                            label17.ForeColor = normalColor;
                        }
                        else
                        {
                            label16.ForeColor = normalColor;
                            label17.ForeColor = inRiskColor;
                        }
                    }
                    else if (Int32.Parse(data[1]) >= minBreath && Int32.Parse(data[1]) <= maxBreath)
                    {
                        labelBorder(11, "Normal");
                        label16.ForeColor = normalColor;
                        label17.ForeColor = normalColor;
                    }

                    breathingRateCounter = breathingRateCounter + breathIntervalTime;
                }

                //Blood Pressure  Readings
                if (counter == bloodPressureCounter && bloodPressure != false)
                {
                    label12.Text = data[2] + "/" + data[3];
                    label18.Text = (maxSystolic).ToString();
                    label19.Text = (minSystolic).ToString();
                    label20.Text = (maxDiastolic).ToString();
                    label21.Text = (minDiastolic).ToString();

                    if (Int32.Parse(data[2]) == 0 || (Int32.Parse(data[3]) == 0))
                    {
                        labelBorder(12, "Critical");
                        label18.ForeColor = criticalColor;
                        label19.ForeColor = criticalColor;
                        label20.ForeColor = criticalColor;
                        label21.ForeColor = criticalColor;
                    }
                    else if ((Int32.Parse(data[2]) > maxSystolic || Int32.Parse(data[2]) < minSystolic) || (Int32.Parse(data[3]) > maxDiastolic || Int32.Parse(data[3]) < minDiastolic))
                    {
                        labelBorder(12, "Risky");

                        if (Int32.Parse(data[2]) > maxSystolic)
                        {
                            label18.ForeColor = inRiskColor;
                            label19.ForeColor = normalColor;
                        }
                        else if (Int32.Parse(data[2]) < minSystolic)
                        {
                            label18.ForeColor = normalColor;
                            label19.ForeColor = inRiskColor;
                        }

                        if (Int32.Parse(data[3]) > maxDiastolic)
                        {
                            label20.ForeColor = inRiskColor;
                            label21.ForeColor = normalColor;
                        }
                        else if (Int32.Parse(data[3]) < minDiastolic)
                        {
                            label20.ForeColor = normalColor;
                            label21.ForeColor = inRiskColor;
                        }
                    }
                    else if (Int32.Parse(data[2]) >= minSystolic && Int32.Parse(data[2]) <= maxSystolic && Int32.Parse(data[3]) >= minSystolic && Int32.Parse(data[3]) <= maxSystolic)
                    {
                        labelBorder(12, "Normal");
                        label18.ForeColor = normalColor;
                        label19.ForeColor = normalColor;
                        label20.ForeColor = normalColor;
                        label21.ForeColor = normalColor;
                    }

                    bloodPressureCounter = bloodPressureCounter + bloodPressureIntervalTime;
                }

                //Temperature Readings
                if (counter == temperatureCounter && temperature != false)
                {
                    label13.Text = data[4] + "°C";
                    label22.Text = (maxTemp).ToString();
                    label23.Text = (minTemp).ToString();

                    if (float.Parse(data[4]) == 0)
                    {
                        labelBorder(13, "Critical");
                        label22.ForeColor = criticalColor;
                        label23.ForeColor = criticalColor;
                    }
                    else if (float.Parse(data[4]) > maxTemp || float.Parse(data[4]) < minTemp)
                    {
                        labelBorder(13, "Risky");

                        if (float.Parse(data[4]) > maxTemp)
                        {
                            label22.ForeColor = inRiskColor;
                            label23.ForeColor = normalColor;
                        }
                        else
                        {
                            label22.ForeColor = normalColor;
                            label23.ForeColor = inRiskColor;
                        }
                    }
                    else if (float.Parse(data[4]) >= minTemp && float.Parse(data[4]) <= maxTemp)
                    {
                        labelBorder(13, "Normal");
                        label22.ForeColor = normalColor;
                        label23.ForeColor = normalColor;
                    }

                    temperatureCounter = temperatureCounter + temperatureIntervalTime;
                }

                if (getPatientId != "No record found")
                {
                    pRead.PatientId     = Int32.Parse(getPatientId);
                    pRead.PulseRate     = Int32.Parse(data[0]);
                    pRead.BreathingRate = Int32.Parse(data[1]);
                    pRead.Systolic      = Int32.Parse(data[2]);
                    pRead.Diastolic     = Int32.Parse(data[3]);
                    pRead.Temperature   = float.Parse(data[4]);
                    pRead.DateTime      = DateTime.Now.ToString();

                    pReadHnd.addPatientReading(dbConn.getConn(), pRead);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("DID NOT RECEIVE ANY DETECTION OF THE READING : " + ex);
                run_Monitor.Stop();
            }

            if (counter == 5)
            {
                counter              = 0;
                pulseRateCounter     = 0;
                bloodPressureCounter = 0;
                breathingRateCounter = 0;
                temperatureCounter   = 0;
            }
            else
            {
                counter++;
            }

            realCounter++;
        }