Пример #1
0
        static public List <string> getListSicknessName()
        {
            List <string> listSickName = new List <string>();
            DataTable     dt           = Active.select("select name from sickness where is_delete = " + 0);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string s = "";
                s = dt.Rows[i]["name"].ToString();
                listSickName.Add(s);
            }
            return(listSickName);
        }
Пример #2
0
        static public List <UnitMedicine> getAllUnit()
        {
            DataTable           dt       = Active.select("select * from unit_medicine where is_delete = " + 0);
            List <UnitMedicine> listUnit = new List <UnitMedicine>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                UnitMedicine unit = new UnitMedicine();
                unit.id   = Convert.ToInt32(dt.Rows[i]["id"]);
                unit.name = dt.Rows[i]["name"].ToString();
                listUnit.Add(unit);
            }
            return(listUnit);
        }
Пример #3
0
        //Quan ly cach dung
        static public List <UserMedicine> getAllUseMedicine()
        {
            DataTable           dt = Active.select("select * from use_medicine where is_delete = " + 0);
            List <UserMedicine> listUseMedicine = new List <UserMedicine>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                UserMedicine use = new UserMedicine();
                use.id     = Convert.ToInt32(dt.Rows[i]["id"]);
                use.name   = dt.Rows[i]["name"].ToString();
                use.detail = dt.Rows[i]["detail"].ToString();
                listUseMedicine.Add(use);
            }
            return(listUseMedicine);
        }
Пример #4
0
        static public List <Sickness> getAllSickness()
        {
            DataTable       dt           = Active.select("select * from sickness where is_delete = " + 0);
            List <Sickness> listSickness = new List <Sickness>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Sickness sick = new Sickness();
                sick.id    = Convert.ToInt32(dt.Rows[i]["id"]);
                sick.name  = dt.Rows[i]["name"].ToString();
                sick.noted = dt.Rows[i]["noted"].ToString();
                listSickness.Add(sick);
            }
            return(listSickness);
        }
Пример #5
0
        //lay thong tin user theo user_id
        static public User getUserWithID(int id)
        {
            User      u  = new User();
            DataTable dt = Active.select("SELECT * FROM user WHERE id = " + id + " and is_delete = " + 0);

            if (dt.Rows.Count != 0)
            {
                u.id        = id;
                u.name      = dt.Rows[0]["user"].ToString();
                u.full_name = dt.Rows[0]["name"].ToString();
                u.email     = dt.Rows[0]["email"].ToString();
                return(u);
            }
            u.id = -1;
            return(u);
        }
Пример #6
0
        static public List <Patient> getListPatient()
        {
            List <Patient> listPatient = new List <Patient>();
            DataTable      dt          = Active.select("select p.* from patient p, medical_exam m where p.is_delete = " + 0 + " and m.patient_id = p.id and m.fee_exam = 0 and m.date_exam = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Patient p = new Patient();
                p.id            = Convert.ToInt32(dt.Rows[i]["id"]);
                p.full_name     = dt.Rows[i]["name"].ToString();
                p.sex           = Convert.ToInt32(dt.Rows[i]["sex"]) == 1 ? "Nam" : "Nữ";
                p.year_of_birth = Convert.ToInt32(dt.Rows[i]["yob"]);
                p.address       = dt.Rows[i]["address"].ToString();
                listPatient.Add(p);
            }
            return(listPatient);
        }
Пример #7
0
        static public Patient getPatientWithID(int id)
        {
            Patient   p  = new Patient();
            DataTable dt = Active.select("SELECT * FROM patient WHERE id = " + id + " and is_delete = " + 0);

            if (dt.Rows.Count != 0)
            {
                p.id            = id;
                p.full_name     = dt.Rows[0]["name"].ToString();
                p.sex           = Convert.ToInt32(dt.Rows[0]["sex"]) == 1 ? "Nam" : "Nữ";
                p.address       = dt.Rows[0]["address"].ToString();
                p.year_of_birth = Convert.ToInt32(dt.Rows[0]["yob"]);
                return(p);
            }
            p.id = -1;
            return(p);
        }
Пример #8
0
        static public List <ChangeRegulation> getAllRegulation()
        {
            DataTable dt = Active.select(" select * from change_reg ");
            List <ChangeRegulation> listRegulation = new List <ChangeRegulation>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ChangeRegulation reg = new ChangeRegulation();
                reg.id_function   = Convert.ToInt32(dt.Rows[i]["id_function"]);
                reg.name_function = dt.Rows[i]["name_function"].ToString();
                reg.value_old     = Convert.ToInt32(dt.Rows[i]["value_old"]);
                reg.date_apply    = Convert.ToDateTime(dt.Rows[i]["date_apply"]);
                reg.value_apply   = Convert.ToInt32(dt.Rows[i]["value_new"]);
                listRegulation.Add(reg);
            }
            return(listRegulation);
        }
Пример #9
0
        static public List <User> getAllUser()
        {
            DataTable   dt       = Active.select("select * from user where is_delete = " + 0);
            List <User> listUser = new List <User>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                User u = new User();
                u.id        = Convert.ToInt32(dt.Rows[i]["id"]);
                u.name      = dt.Rows[i]["user"].ToString();
                u.full_name = dt.Rows[i]["name"].ToString();
                u.password  = dt.Rows[i]["pw"].ToString();
                u.email     = dt.Rows[i]["email"].ToString();
                u.role_id   = Convert.ToInt32(dt.Rows[i]["role_id"]);
                listUser.Add(u);
            }
            return(listUser);
        }
Пример #10
0
        //Quan ly thuoc
        static public List <FullMedicine> getAllMedicine()
        {
            DataTable           dt = Active.select("select medicine.id, medicine.`name`, medicine.another_name, unit_price_medicine.unit_id, unit_medicine.`name` as unit, unit_price_medicine.unit_price, unit_price_medicine.num_smallest_unit from medicine, unit_price_medicine, unit_medicine where medicine.id = unit_price_medicine.medicine_id and unit_price_medicine.unit_id = unit_medicine.id and medicine.is_delete = " + 0);
            List <FullMedicine> listFullMedicine = new List <FullMedicine>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                FullMedicine medicine = new FullMedicine();
                medicine.id                = Convert.ToInt32(dt.Rows[i]["id"]);
                medicine.name              = dt.Rows[i]["name"].ToString();
                medicine.another_name      = dt.Rows[i]["another_name"].ToString();
                medicine.unit_id           = Convert.ToInt32(dt.Rows[i]["unit_id"]);
                medicine.unit_name         = dt.Rows[i]["unit"].ToString();
                medicine.unit_price        = Convert.ToInt64(dt.Rows[i]["unit_price"]);
                medicine.num_smallest_unit = Convert.ToInt32(dt.Rows[i]["num_smallest_unit"]);
                listFullMedicine.Add(medicine);
            }
            return(listFullMedicine);
        }
Пример #11
0
        static public int getLastPatientID()
        {
            DataTable dt = Active.select("select MAX(id) id from patient where is_delete = 0");

            return(Convert.ToInt32(dt.Rows[0]["id"]));
        }
Пример #12
0
        static public int countAllPatient()
        {
            DataTable dt = Active.select("SELECT COUNT(DISTINCT p.id) totalPatient FROM patient p, medical_exam me WHERE p.id = me.patient_id and MONTH(me.`date_exam`) = MONTH(CURRENT_DATE()) ");

            return(Convert.ToInt32(dt.Rows[0]["totalPatient"]));
        }
Пример #13
0
        static public int deletePatient(int pid)
        {
            int id = Active.update("UPDATE patient SET is_delete = " + 1 + " where id = " + pid);

            return(id);
        }
Пример #14
0
        static public int countAllUser()
        {
            DataTable dt = Active.select("SELECT * FROM user");

            return(dt.Rows.Count);
        }
Пример #15
0
        static public int updateMedicalExamStatus(string code, int status)
        {
            int num = Active.update("UPDATE medical_exam SET status = " + status + " WHERE code = '" + code + "'");

            return(num);
        }
Пример #16
0
        static public int updateMedicalExam(string code, int sickID, string prognostic, int status)
        {
            int num = Active.update("UPDATE medical_exam SET sick_id = " + sickID + ", prognostic = N'" + prognostic + "', status = " + status + " where code = '" + code + "'");

            return(num);
        }
Пример #17
0
        static public int insertMedicalExam(string code, int patientID, int doctorID)
        {
            int num = Active.insert("INSERT INTO medical_exam(code, patient_id, physician_id, date_exam, status, fee_exam, fee_medicine) VALUES ('" + code + "', " + patientID + ", " + doctorID + ", '" + DateTime.Now.ToString("yyyy-MM-dd") + "', 1, 0, 0)");

            return(num);
        }
Пример #18
0
        static public int getMedicalExamStatus(int patientID)
        {
            DataTable dt = Active.select("select status from medical_exam where patient_id = " + patientID + " and date_exam = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'");

            return(Convert.ToInt32(dt.Rows[0]["status"]));
        }
Пример #19
0
        static public int insertSickness(Sickness sick, int user_update)
        {
            int id = Active.insert("INSERT INTO sickness(name, noted, user_change) VALUES (N'" + sick.name + "',N'" + sick.noted + "','" + user_update + "')");

            return(id);
        }
Пример #20
0
        static public int updateSickness(Sickness sick, int user_change)
        {
            int id = Active.update("UPDATE sickness SET name = N'" + sick.name + "', noted = N'" + sick.noted + "', user_change = '" + user_change + "' where id = " + sick.id + "");

            return(id);
        }
Пример #21
0
        static public int updateUnitMedicine(UnitMedicine unit, int user_change)
        {
            int id = Active.update("UPDATE unit_medicine SET name = N'" + unit.name + "', user_change = '" + user_change + "' where id = " + unit.id + "");

            return(id);
        }
Пример #22
0
        static public int insertUnitMedicine(UnitMedicine unit, int user_update)
        {
            int id = Active.insert("INSERT INTO unit_medicine(name, user_change) VALUES (N'" + unit.name + "','" + user_update + "')");

            return(id);
        }
Пример #23
0
        static public int deleteSickness(int sick_id, int user_change)
        {
            int id = Active.update("UPDATE sickness SET is_delete = N'" + 1 + "', user_change = N'" + user_change + "' where id = " + sick_id + "");

            return(id);
        }
Пример #24
0
        static public int updateMedicalExam(string code, long feeExam, int feeMedicine)
        {
            int num = Active.update("UPDATE medical_exam SET fee_exam = " + feeExam + ", fee_medicine = " + feeMedicine + " where code = '" + code + "'");

            return(num);
        }
Пример #25
0
        //update user (khong thay doi password)
        static public int updateUserNoPass(User u)
        {
            int id = Active.update("UPDATE user SET user = '******', name = N'" + u.full_name + "', email = '" + u.email + "', role_id = '" + u.role_id + "' where id = " + u.id + "");

            return(id);
        }
Пример #26
0
        static public int updateUseMedicine(UserMedicine use, int user_change)
        {
            int id = Active.update("UPDATE use_medicine SET name = N'" + use.name + "', detail = '" + use.detail + "', user_change = '" + user_change + "' where id = " + use.id + "");

            return(id);
        }
Пример #27
0
        static public int insertUser(User u)
        {
            int id = Active.insert("INSERT INTO user(user, name, pw, email, role_id) VALUES ('" + u.name + "',N'" + u.full_name + "','" + u.password + "','" + u.email + "','" + u.role_id + "')");

            return(id);
        }
Пример #28
0
        static public int deleteUseMedicine(int use_id, int user_change)
        {
            int id = Active.update("UPDATE use_medicine SET is_delete = N'" + 1 + "', user_change = N'" + user_change + "' where id = " + use_id + "");

            return(id);
        }
Пример #29
0
        static public int insertUseMedicine(UserMedicine use, int user_update)
        {
            int id = Active.insert("INSERT INTO use_medicine(name, detail, user_change) VALUES (N'" + use.name + "',N'" + use.detail + "','" + user_update + "')");

            return(id);
        }
Пример #30
0
        static public int insertPrescription(Prescription p, string code)
        {
            int num = Active.insert("INSERT INTO prescription(code, medicine_id, unit_id, amount, use_id) VALUES ('" + code + "', " + p.medicine_id + ", " + p.unit_id + ", " + p.amount + ", " + p.use_id + ")");

            return(num);
        }