Exemplo n.º 1
0
        /// <summary>
        /// 格式化SQL语句
        /// </summary>
        /// <param name="strSql"></param>
        /// <param name="pharmacyLimit"></param>
        /// <returns></returns>
        private string FormatPharcamyLimit(string strSql, Neusoft.HISFC.Models.Order.PharmacyLimit pharmacyLimit)
        {
            string mySql = "";

            try
            {
                System.Object[] s = { pharmacyLimit.ID,                                                                    //住院流水号
                                      Neusoft.FrameWork.Function.NConvert.ToInt32(pharmacyLimit.IsLeaderCheck).ToString(), //序列号
                                      Neusoft.FrameWork.Function.NConvert.ToInt32(pharmacyLimit.IsNeedRecipe).ToString(),  //科室代码
                                      Neusoft.FrameWork.Function.NConvert.ToInt32(pharmacyLimit.IsValid).ToString(),       //有效性
                                      pharmacyLimit.Remark,                                                                //备注
                                      pharmacyLimit.Oper.ID,                                                               //操作员
                                      pharmacyLimit.Oper.OperTime.ToString(),                                              //操作日期
                };
                string          myErr = "";
                if (Neusoft.FrameWork.Public.String.CheckObject(out myErr, s) == -1)
                {
                    this.Err = myErr;
                    this.WriteErr();
                    return(null);
                }
                mySql = string.Format(strSql, s);
            }
            catch (System.Exception ex)
            {
                this.Err = "付数值时候出错!" + ex.Message;
                this.WriteErr();
                return(null);
            }
            return(mySql);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <returns></returns>
        private int SaveData()
        {
            this.fpOrderDrugLimit.StopCellEditing();
            foreach (System.Data.DataRow row in dtOrderDrugLimit.Rows)
            {
                row.EndEdit();
            }

            DataTable dtSave = this.dtOrderDrugLimit.GetChanges();
            DataTable ss     = this.dtOrderDrugLimit.GetChanges(System.Data.DataRowState.Modified);

            if (dtSave != null)
            {
                Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
                //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(this.specialLimitManager.Connection);
                //t.BeginTransaction();
                this.specialLimitManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

                foreach (DataRow row in dtSave.Rows)
                {
                    Neusoft.HISFC.Models.Order.PharmacyLimit obj = new Neusoft.HISFC.Models.Order.PharmacyLimit();

                    obj.ID            = row["药品编码"].ToString().Trim();
                    obj.Name          = row["药品名称"].ToString().Trim();
                    obj.IsLeaderCheck = Neusoft.FrameWork.Function.NConvert.ToBoolean(row["是否需上级医生审核"]);
                    obj.IsNeedRecipe  = Neusoft.FrameWork.Function.NConvert.ToBoolean(row["是否需手工处方"]);
                    obj.IsValid       = Neusoft.FrameWork.Function.NConvert.ToBoolean(row["有效标记"]);
                    obj.Remark        = row["备注"].ToString().Trim();
                    obj.Oper.ID       = oper.ID;
                    obj.Oper.OperTime = this.specialLimitManager.GetDateTimeFromSysDateTime();

                    int iReturn = 0;
                    iReturn = this.specialLimitManager.UpdateSpecialLimit(obj);
                    if (iReturn == 0)
                    {
                        if (this.specialLimitManager.InsertSpecialLimit(obj) < 0)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("插入医嘱药品限制信息出错!") + this.specialLimitManager.Err);
                            return(-1);
                        }
                    }
                    else if (iReturn < 0)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("更新医嘱药品限制信息出错!") + this.specialLimitManager.Err);
                        return(-1);
                    }
                }
                Neusoft.FrameWork.Management.PublicTrans.Commit();
                this.dtOrderDrugLimit.AcceptChanges();
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存成功"));
            }

            return(0);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="strSql"></param>
        /// <returns></returns>
        private ArrayList myPharmacyLimitQuery(string strSql)
        {
            ArrayList al = new ArrayList();

            if (this.ExecQuery(strSql) == -1)
            {
                return(null);
            }

            try
            {
                while (this.Reader.Read())
                {
                    Neusoft.HISFC.Models.Order.PharmacyLimit obj = new Neusoft.HISFC.Models.Order.PharmacyLimit();
                    try
                    {
                        obj.ID            = this.Reader[0].ToString();
                        obj.IsLeaderCheck = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[1].ToString());
                        obj.IsNeedRecipe  = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[2].ToString());
                        obj.IsValid       = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[3].ToString());  //有效性
                        obj.Remark        = this.Reader[4].ToString();                                                 //备注
                        obj.Oper.ID       = this.Reader[5].ToString();                                                 //操作员
                        obj.Oper.OperTime = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[6].ToString()); //操作日期
                    }
                    catch (Exception ex)
                    {
                        this.Err = "获得医嘱药品限制信息出错!" + ex.Message;
                        this.WriteErr();
                        return(null);
                    }
                    al.Add(obj);
                }
            }
            catch (Exception ex)
            {
                this.Err = "获得医嘱药品限制信息出错!" + ex.Message;
                this.WriteErr();
                return(null);
            }
            finally
            {
                this.Reader.Close();
            }
            return(al);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="pharmacyLimit"></param>
        /// <returns></returns>
        public int UpdateSpecialLimit(Neusoft.HISFC.Models.Order.PharmacyLimit pharmacyLimit)
        {
            string strSql = "";

            if (this.Sql.GetSql("Order.SpecialLimit.Update.1", ref strSql) == -1)
            {
                this.Err = this.Sql.Err;
                return(-1);
            }
            strSql = this.FormatPharcamyLimit(strSql, pharmacyLimit);
            if (strSql == null)
            {
                this.Err = "格式化Sql语句时出错";
                this.WriteErr();
                return(-1);
            }
            return(this.ExecNoQuery(strSql));
        }