Beispiel #1
0
    public static int AddOrder(String patientNum, String useNum, String doctorNum, String orderNum, int type, String use_time)
    {
        String  useName;
        Decimal price;

        if (type == 2)
        {
            price   = (Decimal)DatabaseTool.ExeclSqlReturnItem(String.Format(SELECT_OPERATION_PRICE_BYID, useNum), "single_price");
            useName = (String)DatabaseTool.ExeclSqlReturnItem(String.Format("select * from operation where o_num =\"{0}\"", useNum), "o_name");
        }
        else if (type == 3)
        {
            price   = (Decimal)DatabaseTool.ExeclSqlReturnItem(String.Format(SELECT_DEVICE_PRICE_BYID, useNum), "single_price");
            useName = (String)DatabaseTool.ExeclSqlReturnItem(String.Format("select * from device where d_num =\"{0}\"", useNum), "d_name");
        }
        else
        {
            return(-1);
        }
        if (DatabaseTool.ExecSql(String.Format(INSERT_ORDER_SQL, patientNum, useNum, 1, doctorNum, orderNum, type, System.DateTime.Now.ToString(), use_time, price, useName, 0)))
        {
            return(DatabaseTool.GetLastInsertId());
        }
        else
        {
            return(-1);
        }
    }
Beispiel #2
0
 //插入医嘱
 public static int InsertDoctorsAdvice(String doctorNum, String patientNum, String content, int type, String doctorName)
 {
     if (DatabaseTool.ExecSql(String.Format(INSERT_DOCTORSADVICE_SQL, doctorNum, patientNum, System.DateTime.Now.ToString(), content, type, doctorName)))
     {
         return(DatabaseTool.GetLastInsertId());
     }
     else
     {
         return(-1);
     }
 }
Beispiel #3
0
 //添加病房
 public static int AddRoom(String roomNum, String location, String departNum)
 {
     if (DatabaseTool.ExeclSqlReturnItem(string.Format(QUERY_ROOM_SQL, roomNum), "r_num").ToString().Equals("-1") == false)
     {
         return(-1);
     }
     if (DatabaseTool.ExecSql(String.Format(INSERT_ROOM_SQL, roomNum, location, departNum)))
     {
         return(DatabaseTool.GetLastInsertId());
     }
     else
     {
         return(-1);
     }
 }
Beispiel #4
0
 //添加设备
 public static int AddDevice(String deviceNum, String deviceName, String manufacter, Decimal single_price, String dep_num)
 {
     if (DatabaseTool.ExeclSqlReturnItem(string.Format(QUERY_DEVICE_SQL, deviceNum), "d_name").ToString().Equals("-1") == false)
     {
         return(-1);
     }
     if (DatabaseTool.ExecSql(String.Format(INSERT_DEVICE_SQL, deviceNum, deviceName, manufacter, single_price, dep_num)))
     {
         return(DatabaseTool.GetLastInsertId());
     }
     else
     {
         return(-1);
     }
 }
Beispiel #5
0
    //函数二用于插入药品订单
    //函数二需要传入 患者编号、药品编号、数量、医生的编号、订单编号、类型(用于区分三类操作:药品是1 手术是2 检查是3)
    public static int AddOrder(String patientNum, String useNum, int amount, String doctorNum, String orderNum, int type)
    {
        String  useName = (String)DatabaseTool.ExeclSqlReturnItem(String.Format("select * from medicine where m_num =\"{0}\"", useNum), "m_name");
        Decimal price   = (Decimal)DatabaseTool.ExeclSqlReturnItem(String.Format(SELECT_MEDICINE_PRICE_BYID, useNum), "price");

        price *= amount;
        if (DatabaseTool.ExecSql(String.Format(INSERT_ORDER_SQL, patientNum, useNum, amount, doctorNum, orderNum, type, System.DateTime.Now.ToString(), "", price, useName, 0)))
        {
            return(DatabaseTool.GetLastInsertId());
        }
        else
        {
            return(-1);
        }
    }
Beispiel #6
0
 //添加药品
 public static int AddMedicine(String medNum, String medName, String manufactor, Decimal price, Int32 amount, String type)
 {
     if (DatabaseTool.ExeclSqlReturnItem(string.Format(QUERY_MEDICINE_SQL, medNum), "m_name").ToString().Equals("-1") == false)
     {
         return(-1);
     }
     if (DatabaseTool.ExecSql(String.Format(INSERT_MEDICINE_SQL, medNum, medName, manufactor, price, amount, type)))
     {
         return(DatabaseTool.GetLastInsertId());
     }
     else
     {
         return(-1);
     }
 }
Beispiel #7
0
 //添加用户
 public static int AddUsers(String UserNum, String UserName, int type, String password, String sex, int age, String tel, String departNum)
 {
     if (DatabaseTool.ExeclSqlReturnItem(string.Format(QUERY_USERS_SQL, UserNum), "u_name").ToString().Equals("-1") == false)
     {
         return(-1);
     }
     if (DatabaseTool.ExecSql(String.Format(INSERT_USERS_SQL, UserNum, UserName, type, password, sex, age, tel, departNum)))
     {
         return(DatabaseTool.GetLastInsertId());
     }
     else
     {
         return(-1);
     }
 }
Beispiel #8
0
    public static int AddDepartment(String departNum, String departName, String departManager)
    {
        //先检查插入的科室编号是否重复,如果重复返回失败-1
        String result = DatabaseTool.ExeclSqlReturnItem(string.Format(QUERY_DEPARTMENT_SQL, departNum), "d_name").ToString();

        if (result.Equals("-1") == false)
        {
            return(-1);
        }
        else
        {
            if (DatabaseTool.ExecSql(String.Format(INSERT_DEPARTMENT_SQL, departNum, departName, departManager)))
            {
                return(DatabaseTool.GetLastInsertId());
            }
            else
            {
                return(-1);
            }
        }
    }
Beispiel #9
0
 //执行插入操作
 public static int AddPatient(Patient patient)
 {
     //根据病人id查找病人名字,如果找到病人名字,说明有对应id的记录(因为名字不能为空),说明输入的病人id无效
     if (DatabaseTool.ExeclSqlReturnItem(string.Format(SELECT_PATIENT_BY_ID, patient.Id), "p_name").ToString().Equals("-1") == false)
     {
         return(-1);
     }
     else
     {
         System.Diagnostics.Debug.Write(String.Format(INSERT_PATIENT_SQL, patient.Id, patient.Name, patient.Sex, patient.Age, patient.Tel, patient.Department, patient.DrugAllergy, patient.MedicalHistory, patient.RoomNum, patient.BedNum, patient.PhysicanNum, patient.AdmissionTime, "", patient.IDNum, patient.BirthDate, patient.Nation, patient.Country, patient.Marriage, patient.Occupation, patient.NativePlace, patient.BirthPlace, patient.Address, patient.WorkingPlace, patient.WorkingTel, patient.Diagonse, 1));
         if (DatabaseTool.ExecSql(String.Format(INSERT_PATIENT_SQL, patient.Id, patient.Name, patient.Sex, patient.Age, patient.Tel, patient.Department, patient.DrugAllergy, patient.MedicalHistory, patient.RoomNum, patient.BedNum, patient.PhysicanNum, patient.AdmissionTime, "", patient.IDNum, patient.BirthDate, patient.Nation, patient.Country, patient.Marriage, patient.Occupation, patient.NativePlace, patient.BirthPlace, patient.Address, patient.WorkingPlace, patient.WorkingTel, patient.Diagonse, 1)))
         {
             DatabaseTool.ExecSql(String.Format(UPDATE_BED_CONDITION, patient.BedNum));
             return(DatabaseTool.GetLastInsertId());
         }
         else
         {
             return(-1);
         }
     }
 }