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
    protected void fetch_Click1(object sender, EventArgs e)
    {
        List <FetchRecords> fetchRecords = new List <FetchRecords>();

        for (int i = 0; i < this.notFetchOrders.Rows.Count; i++)
        {
            if (((CheckBox)notFetchOrders.Rows[i].FindControl("select")).Checked)
            {
                FetchRecords f = new FetchRecords();
                f.PatientNum  = notFetchOrders.Rows[i].Cells[1].Text.ToString();
                f.FetchTime   = System.DateTime.Now.ToString();
                f.Person      = fetchPerson.Text;
                f.medName     = notFetchOrders.Rows[i].Cells[5].Text.ToString();
                f.Amount      = Convert.ToInt32(notFetchOrders.Rows[i].Cells[4].Text);
                f.PatientName = DatabaseTool.ExeclSqlReturnItem(String.Format("select * from patient where p_number =\"{0}\" ", f.PatientNum), "p_name").ToString();
                f.MedcineNum  = notFetchOrders.Rows[i].Cells[6].Text.ToString();
                f.OrderNum    = notFetchOrders.Rows[i].Cells[7].Text.ToString();
                fetchRecords.Add(f);
            }
        }
        if (FetchRecordService.AddFetchRecords(fetchRecords) > 0)
        {
            Response.Write("<script language=javascript>window.alert('取药成功!');</script>");
            notFetchOrders.DataSource = DatabaseTool.ExecSqlReturnDataSet(String.Format("select* from orders where patient_num=\"{0}\" and isfetch=0 and type=1", patientNum.Text));
            notFetchOrders.DataBind();
        }
        else
        {
            Response.Write("<script language=javascript>window.alert('存在取药数量大于库存量失败的取药记录!');</script>");
            notFetchOrders.DataSource = DatabaseTool.ExecSqlReturnDataSet(String.Format("select* from orders where patient_num=\"{0}\" and isfetch=0 and type=1", patientNum.Text));
            notFetchOrders.DataBind();
        }
    }
Beispiel #3
0
        public MainWindow()
        {
            InitializeComponent();

            // 设置当前线程的名称
            Thread.CurrentThread.Name = "MainWindow";

            this.DataContext = this;

            // 初始化数据库连接
            dbTool = new DatabaseTool("monitor", "sa", "sa", "localhost");

            nowTextBlock.Text = DateTime.Now.ToShortDateString();
            nowText = nowTextBlock.Text;

            // 初始化节点树
            initTree();

            // 异步接收
            e = new IPEndPoint(IPAddress.Any, 5999);
            u = new UdpClient(e);

            s = new UdpState();
            s.e = e;
            s.u = u;
        }
Beispiel #4
0
        public MainWindow()
        {
            InitializeComponent();

            // 设置当前线程的名称
            Thread.CurrentThread.Name = "MainWindow";



            this.DataContext = this;


            // 初始化数据库连接
            dbTool = new DatabaseTool("monitor", "sa", "sa", "localhost");

            nowTextBlock.Text = DateTime.Now.ToShortDateString();
            nowText           = nowTextBlock.Text;

            // 初始化节点树
            initTree();

            // 异步接收
            e = new IPEndPoint(IPAddress.Any, 5999);
            u = new UdpClient(e);

            s   = new UdpState();
            s.e = e;
            s.u = u;
        }
Beispiel #5
0
    protected void user_department_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.id = this.user_department.SelectedValue;
        this.user_department.DataSource     = DatabaseTool.ExecSqlReturnTable("select * from department where d_number= " + id);
        this.user_department.DataTextField  = "d_name";
        this.user_department.DataValueField = "d_number";

        user_department.DataBind();
    }
    protected void NativeProvinceList_SelectedIndexChanged(object sender, EventArgs e)
    {
        // Response.Write("<script>alert('我响应了!')</script>");
        String proID = this.NativeProvinceList.SelectedValue;

        this.NativeCityList.DataSource     = DatabaseTool.ExecSqlReturnTable("select * from city where province_num= " + proID);
        this.NativeCityList.DataTextField  = "city_name";
        this.NativeCityList.DataValueField = "number";
        NativeCityList.DataBind();
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["number"] == null)
        {
            Response.Write("<script language=javascript>window.alert('请先登录!');window.location.href=('login.aspx');</script>");
        }
        session.Text = Session["number"].ToString();
        DataTable dt = DatabaseTool.ExecSqlReturnTable("select * from device");

        examination_num1.DataSource     = dt;
        examination_num1.DataTextField  = "d_num";
        examination_num1.DataValueField = "d_num";


        examination_num1.DataBind();
        examination_num2.DataSource    = dt;
        examination_num2.DataTextField = "d_num";
        examination_num2.DataBind();
        examination_num3.DataSource    = dt;
        examination_num3.DataTextField = "d_num";
        examination_num3.DataBind();
        examination_num4.DataSource    = dt;
        examination_num4.DataTextField = "d_num";
        examination_num4.DataBind();
        examination_num5.DataSource    = dt;
        examination_num5.DataTextField = "d_num";
        examination_num5.DataBind();
        examination_num6.DataSource    = dt;
        examination_num6.DataTextField = "d_num";
        examination_num6.DataBind();
        examination_num7.DataSource    = dt;
        examination_num7.DataTextField = "d_num";
        examination_num7.DataBind();
        examination_num8.DataSource    = dt;
        examination_num8.DataTextField = "d_num";
        examination_num8.DataBind();
        examination_num9.DataSource    = dt;
        examination_num9.DataTextField = "d_num";
        examination_num9.DataBind();
        examination_num10.DataSource    = dt;
        examination_num10.DataTextField = "d_num";
        examination_num10.DataBind();
        //不可编辑的医生编号从session中获取,即当前用户的编号
        doctor1.Text  = Session["doctorNum"].ToString();
        doctor2.Text  = Session["doctorNum"].ToString();
        doctor3.Text  = Session["doctorNum"].ToString();
        doctor4.Text  = Session["doctorNum"].ToString();
        doctor5.Text  = Session["doctorNum"].ToString();
        doctor6.Text  = Session["doctorNum"].ToString();
        doctor7.Text  = Session["doctorNum"].ToString();
        doctor8.Text  = Session["doctorNum"].ToString();
        doctor9.Text  = Session["doctorNum"].ToString();
        doctor10.Text = Session["doctorNum"].ToString();
    }
Beispiel #8
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 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["number"] == null)
        {
            Response.Write("<script language=javascript>window.alert('请先登录!');window.location.href=('login.aspx');</script>");
        }
        System.Diagnostics.Debug.Write(Session["number"]);
        session.Text = Session["number"].ToString();
        DataTable dt = DatabaseTool.ExecSqlReturnTable("select * from department");

        room_department.DataSource    = dt;
        room_department.DataTextField = "d_name";
        room_department.DataBind();
    }
Beispiel #10
0
    public static int indentifyUser(String username, String password)
    {
        Object selectType = DatabaseTool.ExeclSqlReturnItem(String.Format(QUERY_USER_SQL, username, password), "type");
        String type       = selectType.ToString();

        if (type.Equals("-1"))
        {
            return(-1);
        }
        else
        {
            return(int.Parse(type));
        }
    }
Beispiel #11
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 #12
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 #13
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 #14
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 #15
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 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["number"] == null)
        {
            Response.Write("<script language=javascript>window.alert('请先登录!');window.location.href=('login.aspx');</script>");
        }
        session.Text     = Session["number"].ToString();
        doctor_num.Text  = Session["doctorNum"].ToString();
        doctor_name.Text = Session["number"].ToString();
        DataTable dt = DatabaseTool.ExecSqlReturnTable("select * from patient where attending_physican_num=" + Session["doctorNum"].ToString());

        patient_num.DataSource     = dt;
        patient_num.DataTextField  = "p_name";
        patient_num.DataValueField = "p_number";
        patient_num.DataBind();
    }
Beispiel #17
0
 public static DataTable ExecSqlReturnTable(String sql)  //通过sql语句查询数据库中的数据,并将结果保存到DataSet数据集中,最终将该数据集中的查找结果的数据表返回
 {
     try
     {
         MySqlConnection  mySqlConnection  = DatabaseTool.GetSqlConnection();
         MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(sql, mySqlConnection);
         DataSet          ds = new DataSet();
         mySqlDataAdapter.Fill(ds);
         mySqlConnection.Close();
         return(ds.Tables[0]);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["number"] == null)
     {
         Response.Write("<script language=javascript>window.alert('请先登录!');window.location.href=('login.aspx');</script>");
     }
     session.Text = Session["number"].ToString();
     if (!IsPostBack)
     {
         DataTable dt = DatabaseTool.ExecSqlReturnTable("select * from department");
         user_department.DataSource     = dt;
         user_department.DataTextField  = "d_name";
         user_department.DataValueField = "d_number";
         user_department.DataBind();
     }
 }
        /// <summary>
        /// Get Unit's Details
        /// </summary>
        private void GetDetails()
        {
            BusinessServices.Unit objUnit;
            DataTable             dtbUnit;
            int intOrganisationID;

            //1. Get Unit details
            objUnit             = new BusinessServices.Unit();
            dtbUnit             = objUnit.GetUnit(this.m_intUnitID);
            this.txtName.Text   = dtbUnit.Rows[0]["Name"].ToString();
            this.txtUnitID.Text = this.m_intUnitID.ToString();
            if (dtbUnit.Rows[0]["Active"].ToString() == "True")
            {
                this.cboStatus.SelectedIndex = 0;
            }
            else
            {
                this.cboStatus.SelectedIndex = 1;
            }

            this.lblPathway.Text = dtbUnit.Rows[0]["Organisation"].ToString() + " > " + dtbUnit.Rows[0]["Pathway"].ToString();


            DateTime dteOriginalDateUpdated = (DateTime)dtbUnit.Rows[0]["DateUpdated"];

            this.OriginalDateUpdated = DatabaseTool.ToLongDateTimeString(dteOriginalDateUpdated);

            intOrganisationID = (int)dtbUnit.Rows[0]["OrganisationID"];

            //2. Get Sub-Units tree
            DataSet dstUnits = objUnit.GetUnitsByOrganisation(intOrganisationID, "", "", "", this.m_intUnitID);

            string strUnits = UnitTreeConvert.ConvertXml(dstUnits);

            if (strUnits == "")
            {
                this.trvSubUnits.Visible   = false;
                this.lblNoSubUnits.Visible = true;
            }
            else
            {
                this.trvSubUnits.Visible   = true;
                this.lblNoSubUnits.Visible = false;
                this.trvSubUnits.LoadXml(strUnits);
            }
        }
Beispiel #20
0
    //根据用户号查找用户
    public static List <Users> QueryUsersByNum(String UserNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_USERS_SQL, UserNum));
        List <Users> users = new List <Users>();

        if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象
        {
            return(users);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list
            {
                users.Add(Users.CreateUsers(dic));
            }
        }
        return(users);
    }
Beispiel #21
0
    public static List <Medicine> QueryMedicineByNum(String medicineNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_MEDICINE_SQL, medicineNum));
        List <Medicine> medicine = new List <Medicine>();

        if (sqlResult == null || sqlResult.Count < 1)     //如果结果为空,返回空对象
        {
            return(medicine);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult)    //遍历结果集,每一条都加入list
            {
                medicine.Add(Medicine.createMedicine(dic));
            }
        }
        return(medicine);
    }
Beispiel #22
0
    public static List <Room> QueryRoomByNum(String roomNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_ROOM_SQL, roomNum));
        List <Room> room = new List <Room>();

        if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象
        {
            return(room);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list
            {
                room.Add(Room.CreateRoom(dic));
            }
        }
        return(room);
    }
Beispiel #23
0
    //返回患者部分信息用于确认
    public static List <PatientPart> SearchPartInformation(String ID)
    {
        List <Dictionary <String, object> > partInformation = DatabaseTool.ExecSqlReturn(String.Format(SELECT_PART_INFORMATION, ID));
        List <PatientPart> patientParts = new List <PatientPart>();

        if (partInformation == null || partInformation.Count < 1)
        {
            return(patientParts);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in partInformation) //遍历结果集,每一条都加入list
            {
                patientParts.Add(PatientPart.CreatePatientPart(dic));
            }
            return(patientParts);
        }
    }
Beispiel #24
0
    public static List <Device> QueryDeviceByNum(String deviceNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_DEVICE_SQL, deviceNum));
        List <Device> device = new List <Device>();

        if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象
        {
            return(device);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list
            {
                device.Add(Device.CreateDevice(dic));
            }
        }
        return(device);
    }
Beispiel #25
0
    private const String SELECT_DEVICE_PRICE_BYID    = "select single_price from device where d_num=\"{0}\" ";   //在设备表查价格

    //重载函数
    //函数一用于插入检查订单或者手术订单
    //函数一需要传入 患者编号、手术或者检查的编号、医生的编号、订单编号、类型(用于区分三类操作:药品是1 手术是2 检查是3)、使用的时间
    public static List <Order> QueryOrderByNum(String orderNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(SELECT_ORDER_SQL, orderNum));
        List <Order> order = new List <Order>();

        if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象
        {
            return(order);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list
            {
                order.Add(Order.CreateOrder(dic));
            }
        }
        return(order);
    }
Beispiel #26
0
    //查询取药记录
    public static List <FetchRecords> QueryFetchByNum(String patientNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_FETCHRECORDS_SQL, patientNum));
        List <FetchRecords> fetchRecords = new List <FetchRecords>();

        if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象
        {
            return(fetchRecords);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list
            {
                fetchRecords.Add(FetchRecords.CreateFetchRecords(dic));
            }
        }
        return(fetchRecords);
    }
Beispiel #27
0
    public static List <Department> QueryDepartmentByNum(String departmentNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_DEPARTMENT_SQL, departmentNum));
        List <Department> department = new List <Department>();

        if (sqlResult == null || sqlResult.Count < 1)     //如果结果为空,返回空对象
        {
            return(department);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult)    //遍历结果集,每一条都加入list
            {
                department.Add(Department.CreateDepartment(dic));
            }
        }
        return(department);
    }
Beispiel #28
0
    //出院时查询医嘱
    public List <DoctorsAdvice> QueryAdvicesByNum(String patientNum)
    {
        List <Dictionary <String, Object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(QUERY_DOCTORSADVICE_SQL, patientNum));
        List <DoctorsAdvice> advices = new List <DoctorsAdvice>();

        if (sqlResult == null || sqlResult.Count < 1) //如果结果为空,返回空对象
        {
            return(advices);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult) //遍历结果集,每一条都加入list
            {
                advices.Add(DoctorsAdvice.CreateDoctorsAdvice(dic));
            }
        }
        return(advices);
    }
Beispiel #29
0
    // 将患者出院未出院字段改为已经出院,返回病人信息和费用
    public static LeaveInformation LeaveHospital(String ID)
    {
        DatabaseTool.ExecSql(String.Format(UPDATE_PATIENT_CONDITION, ID));                              //更新患者状态为已出院
        DatabaseTool.ExecSql(String.Format(UPDATE_DISCHARGE_TIME, System.DateTime.Now.ToString(), ID)); //插入病人出院时间
        //全部订单存放至orders
        List <Dictionary <String, Object> > sqlResult1 = DatabaseTool.ExecSqlReturn(String.Format(SELECT_ALL_ORDERS_BY_ID, ID));
        List <Order> orders = new List <Order>();

        foreach (Dictionary <String, Object> dic in sqlResult1)    //遍历结果集,每一条都加入list
        {
            orders.Add(Order.CreateOrder(dic));
        }
        //获取入院时间与出院时间,计算时间差
        DateTime admissionTime = Convert.ToDateTime(DatabaseTool.ExeclSqlReturnItem(String.Format(SELECT_PATIENT_BY_ID, ID), "admission_time"));

        DateTime dischargeTime = Convert.ToDateTime(DatabaseTool.ExeclSqlReturnItem(String.Format(SELECT_PATIENT_BY_ID, ID), "discharge_time"));
        TimeSpan ts            = dischargeTime.Subtract(admissionTime).Duration();
        String   dateDiff      = ts.Days.ToString() + "天";
        //获取全部医嘱存放至advices
        List <DoctorsAdvice> advices = new List <DoctorsAdvice>();
        List <Dictionary <String, Object> > sqlResult2 = DatabaseTool.ExecSqlReturn(String.Format(SELECT_ALL_ADVICES_BY_ID, ID));

        foreach (Dictionary <String, Object> dic in sqlResult2)  //遍历结果集,每一条都加入list
        {
            advices.Add(DoctorsAdvice.CreateDoctorsAdvice(dic));
        }
        //计算最终费用存放至totalPrice
        Decimal totalPrice = DatabaseTool.ExeclSqlDecimal(String.Format(SELECT_ALL_PRICE, ID));

        //获取用户部分信息
        PatientPartInformation partInformation         = new PatientPartInformation();
        List <Dictionary <String, Object> > sqlResult3 = DatabaseTool.ExecSqlReturn(String.Format(SELECT_PATIENT_BY_ID, ID));

        foreach (Dictionary <String, Object> dic in sqlResult3) //遍历结果集,每一条都加入list
        {
            partInformation = PatientPartInformation.CreatePatientInformation(dic);
        }


        //新建信息对象,返回
        LeaveInformation information = LeaveInformation.CreateLeavelInformation(advices, dateDiff, orders, totalPrice, partInformation);

        return(information);
    }
Beispiel #30
0
    //按病人ID查找病人的操作
    public static List <Patient> GetPatientsById(String ID)
    {
        //查询返回的是一个结果集,每一个结果集是一个主键为ID的多组对应关系
        List <Dictionary <String, object> > sqlResult = DatabaseTool.ExecSqlReturn(String.Format(SELECT_PATIENT_BY_ID, ID));
        List <Patient> patient = new List <Patient>();

        if (sqlResult == null || sqlResult.Count < 1)    //如果结果为空,返回空对象
        {
            return(patient);
        }
        else
        {
            foreach (Dictionary <String, Object> dic in sqlResult)   //遍历结果集,每一条都加入list
            {
                patient.Add(Patient.CreatePatient(dic));
            }
        }
        return(patient);
    }
Beispiel #31
0
 //插入取药记录
 public static int AddFetchRecords(List <FetchRecords> fetchRecords)
 {
     for (int i = 0; i < fetchRecords.Count; i++)
     {
         int nowAmout = Convert.ToInt32(DatabaseTool.ExeclSqlReturnItem(String.Format("select * from medicine", fetchRecords[i].MedcineNum), "amount"));
         nowAmout = nowAmout - fetchRecords[i].Amount;
         if (nowAmout < 0)
         {
             return(-1);
         }
         else
         {
             DatabaseTool.ExecSql(String.Format(INSERT_FETCHRECORDS_SQL, fetchRecords[i].Person, fetchRecords[i].medName, fetchRecords[i].PatientName, fetchRecords[i].Amount, fetchRecords[i].PatientNum, fetchRecords[i].FetchTime));
             DatabaseTool.ExecSql(String.Format(UPDATE_MEDICINE_AMOUNT_SQL, nowAmout, fetchRecords[i].MedcineNum));
             DatabaseTool.ExecSql(String.Format("update orders set isfetch=1 where order_num =\"{0}\" ", fetchRecords[i].OrderNum));
         }
     }
     return(1);
 }