Beispiel #1
0
        public bool Is_likely(MYSQL mYSQL, string city, string area, string st, string et) //看是否有与确诊病例接触的可能
        {
            string    sql   = string.Format("SELECT Pname, City, Area, StartTime, EndTime, SickTime FROM Patient_Record WHERE City = '{0}' AND Area = '{1}' AND StartTime <= '{2}' AND EndTime > '{3}';", city, area, st, st);
            DataTable table = mYSQL.GetMessage(sql);

            if (table.Rows.Count > 0)
            {
                Stable.DataSource = table;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public bool Is_fever(MYSQL mYSQL, string id)
        {
            string    sql   = string.Format("SELECT * FROM Fever WHERE Pid = '{0}';", id);
            DataTable table = mYSQL.GetMessage(sql);

            if (table.Rows.Count > 0)
            {
                Stable.DataSource = table;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
 private void LikelyInfection_Click(object sender, EventArgs e)
 {
     if (state)
     {
         AdminIndexTable.Enabled = true;
         AdminIndexTable.Visible = true;
         MYSQL     mYSQL     = new MYSQL();
         string    sql       = "SELECT Pname, HealthStatus, SickTime FROM Person WHERE HealthStatus = 'Fever' LIMIT 0, 10;";
         DataTable dataTable = mYSQL.GetMessage(sql);
         AdminIndexTable.DataSource = dataTable;
     }
     else
     {
         AdminIndexTable.Enabled = false;
         AdminIndexTable.Visible = false;
     }
     state = !state;
 }
Beispiel #4
0
        private void HighRiskArea_Click(object sender, EventArgs e)
        {
            if (state)
            {
                AdminIndexTable.Enabled = true;
                AdminIndexTable.Visible = true;
                MYSQL     mYSQL     = new MYSQL();
                string    sql       = "SELECT City, Area, RiskLevel FROM Situation WHERE RiskLevel = 'L1';";
                DataTable dataTable = mYSQL.GetMessage(sql);
                AdminIndexTable.DataSource = dataTable;
            }
            else
            {
                AdminIndexTable.Enabled = false;
                AdminIndexTable.Visible = false;
            }

            state = !state;
        }
Beispiel #5
0
        private void AdminCounts_Click(object sender, EventArgs e)
        {
            if (state)
            {
                AdminIndexTable.Enabled = true;
                AdminIndexTable.Visible = true;
                MYSQL  mYSQL = new MYSQL();
                string sql   = "SELECT Account, Name FROM Login WHERE Type = 'Admin';";

                DataTable dataTable = mYSQL.GetMessage(sql);
                AdminIndexTable.DataSource = dataTable;
            }
            else
            {
                AdminIndexTable.Enabled = false;
                AdminIndexTable.Visible = false;
            }
            state = !state;
        }
Beispiel #6
0
        private void Delete_Click(object sender, EventArgs e)
        {
            string id   = actID.Text;
            string city = actCity.Text;
            string area = actArea.Text;
            string st   = Ast.Text;
            string et   = Aet.Text;

            string sql = string.Format("DELETE FROM Record WHERE Pid = '{0}' AND City = '{1}' AND Area = '{2}' AND StartTime >= '{3}' AND EndTime <= '{4}';", id, city, area, st, et);

            Exec_SQL(sql);

            sql = string.Format("SELECT * FROM Record WHERE Pid = '{0}' AND City = '{1}' AND Area = '{2}' AND StartTime >= '{3}' AND EndTime <= '{4}'; ", id, city, area, st, et);
            MYSQL     mYSQL = new MYSQL();
            DataTable table = mYSQL.GetMessage(sql);

            ActRecordTable.DataSource = table;

            MessageBox.Show("Delete Done!");
        }
Beispiel #7
0
        private void modify_Click(object sender, EventArgs e)
        {
            //怎么实现全码的更改?
            string id   = actID.Text;
            string city = actCity.Text;
            string area = actArea.Text;
            string st   = Ast.Text;
            string et   = Aet.Text;

            //string sql = string.Format("UPDATE Record WHERE Pid = '{0}' AND City = '{1}' AND Area = '{2}' AND StartTime = '{3}' AND EndTime = '{4}';", id, city, area, st, et);
            string sql = string.Format("INSERT INTO Record VALUES('{0}', '{1}', '{2}', '{3}', '{4}');", id, city, area, st, et);

            Exec_SQL(sql);

            sql = string.Format("SELECT * FROM Record WHERE Pid = '{0}' AND City = '{1}' AND Area = '{2}' AND StartTime >= '{3}' AND EndTime <= '{4}'; ", id, city, area, st, et);
            MYSQL     mYSQL = new MYSQL();
            DataTable table = mYSQL.GetMessage(sql);

            ActRecordTable.DataSource = table;

            MessageBox.Show("Update Done!");
        }
Beispiel #8
0
        private void confirm_Click(object sender, EventArgs e)
        {
            string id, name;
            //string fevertime, sicktime;
            string sqlR, sqlC, sqlP;
            MYSQL  mYSQL = new MYSQL();

            if (searchType1.Text == "身份证号")
            {
                id = searchCondition.Text;

                if (searchType2.Text == "发热")
                {
                    sqlR = string.Format("SELECT City, Area, StartTime, EndTime FROM Fever_Record " +
                                         "WHERE Pid = '{0}' AND EndTime < SickTime ORDER BY(StartTime);", id);

                    sqlC = string.Format("SELECT Pname, HealthStatus, Fever_Patient_Record.City, Fever_Patient_Record.Area, Fever_Patient_Record.StartTime, Fever_Patient_Record.EndTime " +
                                         "FROM Fever_Patient_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Fever_Record " +
                                         "WHERE Pid = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Fever_Patient_Record.Pid <> R1.Pid AND (Fever_Patient_Record.StartTime <= R1.StartTime AND Fever_Patient_Record.EndTime >= R1.EndTime) " +
                                         "AND (Fever_Patient_Record.City = R1.City AND Fever_Patient_Record.Area = R1.Area) AND SickTime < R1.EndTime;", id);

                    sqlP = string.Format("SELECT Pname, HealthStatus, Health_Record.City, Health_Record.Area, Health_Record.StartTime, Health_Record.EndTime " +
                                         "FROM Health_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Fever_Record " +
                                         "WHERE Pid = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Health_Record.Pid <> R1.Pid AND (Health_Record.StartTime >= R1.StartTime AND Health_Record.EndTime <= R1.EndTime) " +
                                         "AND (Health_Record.City = R1.City AND Health_Record.Area = R1.Area);", id);

                    rTable = mYSQL.GetMessage(sqlR);
                    cTable = mYSQL.GetMessage(sqlC);
                    ptable = mYSQL.GetMessage(sqlP);
                }
                else if (searchType2.Text == "已确诊")
                {
                    sqlR = string.Format("SELECT City, Area, StartTime, EndTime FROM Patient_Record " +
                                         "WHERE Pid = '{0}' AND EndTime < SickTime ORDER BY(StartTime);", id);

                    sqlC = string.Format("SELECT Pname, HealthStatus, Fever_Patient_Record.City, Fever_Patient_Record.Area, Fever_Patient_Record.StartTime, Fever_Patient_Record.EndTime " +
                                         "FROM Fever_Patient_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Patient_Record " +
                                         "WHERE Pid = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Fever_Patient_Record.Pid <> R1.Pid AND (Fever_Patient_Record.StartTime <= R1.StartTime AND Fever_Patient_Record.EndTime >= R1.EndTime) " +
                                         "AND (Fever_Patient_Record.City = R1.City AND Fever_Patient_Record.Area = R1.Area) AND SickTime < R1.EndTime;", id);

                    sqlP = string.Format("SELECT Pname, HealthStatus, Health_Record.City, Health_Record.Area, Health_Record.StartTime, Health_Record.EndTime " +
                                         "FROM Health_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Patient_Record " +
                                         "WHERE Pid = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Health_Record.Pid <> R1.Pid AND (Health_Record.StartTime >= R1.StartTime AND Health_Record.EndTime <= R1.EndTime) " +
                                         "AND (Health_Record.City = R1.City AND Health_Record.Area = R1.Area);", id);

                    rTable = mYSQL.GetMessage(sqlR);
                    cTable = mYSQL.GetMessage(sqlC);
                    ptable = mYSQL.GetMessage(sqlP);
                }
                else
                {
                    MessageBox.Show("请选择查询关键字!");
                }
            }
            else if (searchType1.Text == "姓名")
            {
                name = searchCondition.Text;

                if (searchType2.Text == "发热")
                {
                    sqlR = string.Format("SELECT City, Area, StartTime, EndTime FROM Fever_Record " +
                                         "WHERE Pname = '{0}' AND EndTime < SickTime ORDER BY(StartTime);", name);

                    sqlC = string.Format("SELECT Pname, HealthStatus, Fever_Patient_Record.City, Fever_Patient_Record.Area, Fever_Patient_Record.StartTime, Fever_Patient_Record.EndTime " +
                                         "FROM Fever_Patient_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Fever_Record " +
                                         "WHERE Pname = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Fever_Patient_Record.Pid <> R1.Pid AND (Fever_Patient_Record.StartTime <= R1.StartTime AND Fever_Patient_Record.EndTime >= R1.EndTime) " +
                                         "AND (Fever_Patient_Record.City = R1.City AND Fever_Patient_Record.Area = R1.Area) AND SickTime < R1.EndTime;", name);

                    sqlP = string.Format("SELECT Pname, HealthStatus, Health_Record.City, Health_Record.Area, Health_Record.StartTime, Health_Record.EndTime " +
                                         "FROM Health_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Fever_Record " +
                                         "WHERE Pname = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Health_Record.Pid <> R1.Pid AND (Health_Record.StartTime >= R1.StartTime AND Health_Record.EndTime <= R1.EndTime) " +
                                         "AND (Health_Record.City = R1.City AND Health_Record.Area = R1.Area);", name);

                    rTable = mYSQL.GetMessage(sqlR);
                    cTable = mYSQL.GetMessage(sqlC);
                    ptable = mYSQL.GetMessage(sqlP);
                }
                else if (searchType2.Text == "已确诊")
                {
                    sqlR = string.Format("SELECT City, Area, StartTime, EndTime FROM Patient_Record " +
                                         "WHERE Pname = '{0}' AND EndTime < SickTime ORDER BY(StartTime);", name);

                    sqlC = string.Format("SELECT Pname, HealthStatus, Fever_Patient_Record.City, Fever_Patient_Record.Area, Fever_Patient_Record.StartTime, Fever_Patient_Record.EndTime " +
                                         "FROM Fever_Patient_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Patient_Record " +
                                         "WHERE Pname = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Fever_Patient_Record.Pid <> R1.Pid AND (Fever_Patient_Record.StartTime <= R1.StartTime AND Fever_Patient_Record.EndTime >= R1.EndTime) " +
                                         "AND (Fever_Patient_Record.City = R1.City AND Fever_Patient_Record.Area = R1.Area) AND SickTime < R1.EndTime;", name);

                    sqlP = string.Format("SELECT Pname, HealthStatus, Health_Record.City, Health_Record.Area, Health_Record.StartTime, Health_Record.EndTime " +
                                         "FROM Health_Record, " +
                                         "(SELECT Pid, City, Area, StartTime, EndTime " +
                                         "FROM Patient_Record " +
                                         "WHERE Pname = '{0}' AND EndTime < SickTime" +
                                         ")AS R1 " +
                                         "WHERE Health_Record.Pid <> R1.Pid AND (Health_Record.StartTime >= R1.StartTime AND Health_Record.EndTime <= R1.EndTime) " +
                                         "AND (Health_Record.City = R1.City AND Health_Record.Area = R1.Area);", name);

                    rTable = mYSQL.GetMessage(sqlR);
                    cTable = mYSQL.GetMessage(sqlC);
                    ptable = mYSQL.GetMessage(sqlP);
                }
                else
                {
                    MessageBox.Show("请选择查询关键字!");
                }
            }
            else
            {
                MessageBox.Show("请选择查询关键字!");
            }
        }