public void SetBedside(Bedside bedside)
        {
            //Fill up patient object with data from the database
            currentBedside = bedside;

            nameLabel.Text         = $"First Name: {currentBedside.patient.FirstName}";
            surnameLabel.Text      = $"Last Name: {currentBedside.patient.Surname}";
            dobLabel.Text          = $"Date of Birth: {currentBedside.patient.DOB}";
            intakeReasonLabel.Text = $"Intake Reason: {currentBedside.patient.IntakeReason}";



            var moduleTypeSource = Module.ModuleTypes(); // Different module functionality

            module1ModuleType.Items.AddRange(moduleTypeSource);
            module2ModuleType.Items.AddRange(moduleTypeSource);
            module3ModuleType.Items.AddRange(moduleTypeSource);
            module4ModuleType.Items.AddRange(moduleTypeSource);
            DisplayModuleData();

            Text = currentBedside.patient.FullName;

            InitalizeControl();
            saveButton.Visible = false;
            LockInputControls(true);
        }
Beispiel #2
0
        //retrieve all bedside
        public List <Bedside> getAllBedside(MySqlConnection conn)
        {
            List <Bedside> listBedside = new List <Bedside>();
            string         sql         = "SELECT * FROM bedsidemonitor";
            MySqlCommand   sqlComm     = new MySqlCommand(sql, conn);

            try
            {
                MySqlDataReader myReader;
                myReader = sqlComm.ExecuteReader();
                while (myReader.Read())
                {
                    Bedside bedside = new Bedside();
                    bedside.Id = (int)myReader.GetValue(0);
                    bedside.CentralStationId = (int)myReader.GetValue(1);
                    bedside.Status           = (bool)myReader.GetValue(2);

                    listBedside.Add(bedside);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                Console.WriteLine(e.ToString());
            }

            return(listBedside);
        }
        //retrieve patient value from beside
        public double getMaxValue(MySqlConnection conn, Bedside bedside)
        {
            int    id                 = 0;
            int    lastId             = 0;
            double bloodpressurevalue = 0.0;

            string       sql     = "SELECT patient.id FROM patient WHERE bedsideId='" + bedside.Id + "'";
            MySqlCommand sqlComm = new MySqlCommand(sql, conn);
            var          qrId    = sqlComm.ExecuteScalar();

            if (qrId != null)
            {
                id = Convert.ToInt32(qrId);
                if (id > 0)
                {
                    string       sqlmaxId = "SELECT MAX(ID) FROM bloodpressure WHERE patient_id='" + id + "'";
                    MySqlCommand sqlComm2 = new MySqlCommand(sqlmaxId, conn);

                    var maxId = sqlComm2.ExecuteScalar();
                    if (maxId != null)
                    {
                        lastId = Convert.ToInt32(maxId);
                        string       sqlMaxBP = "SELECT bloodPressureValue FROM bloodpressure WHERE patient_id='" + id + "' AND id='" + lastId + "'";
                        MySqlCommand sqlComm3 = new MySqlCommand(sqlMaxBP, conn);

                        var lastBloodPressureValue = sqlComm3.ExecuteScalar();

                        if (lastBloodPressureValue != null)
                        {
                            bloodpressurevalue = Convert.ToDouble(lastBloodPressureValue);
                        }
                    }
                    else
                    {
                        bloodpressurevalue = 0.0;
                    }
                }
            }

            return(bloodpressurevalue);
        }
        //list all beside id
        public List <Bedside> getAllBedsideMonitor(MySqlConnection conn, string bayN)
        {
            int id = 0;

            List <Bedside> listBedside = new List <Bedside>();
            string         sql         = "SELECT id FROM centralstation WHERE centralStationName='" + bayN + "'";
            MySqlCommand   sqlComm     = new MySqlCommand(sql, conn);

            var qrId = sqlComm.ExecuteScalar();

            if (qrId != null)
            {
                id = Convert.ToInt32(qrId);
            }

            string       getAllBedsideSql = "Select * FROM bedsidemonitor WHERE centralStation_id='" + id + "'";
            MySqlCommand comm             = new MySqlCommand(getAllBedsideSql, conn);

            try
            {
                MySqlDataReader myReader;
                myReader = comm.ExecuteReader();
                while (myReader.Read())
                {
                    Bedside bedside = new Bedside();
                    bedside.Id     = (int)myReader.GetValue(0);
                    bedside.Status = (bool)myReader.GetValue(2);
                    listBedside.Add(bedside);
                }
                myReader.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

            return(listBedside);
        }