//工具栏

        #endregion

        #region 方法
        public void Query()
        {
            this.fpSpread1_Sheet1.RowCount = 0;
            int    index = 0;
            string temp  = "";

            temp = getSqlStr();
            DataSet ds = new DataSet();

            dbMgr.ExecQuery(temp, ref ds);
            if (ds != null)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    this.fpSpread1_Sheet1.Rows.Add(i, 1);
                    this.fpSpread1_Sheet1.Cells[i, 0].Text = ds.Tables[0].Rows[i][0].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 1].Text = ds.Tables[0].Rows[i][1].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 2].Text = ds.Tables[0].Rows[i][2].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 3].Text = ds.Tables[0].Rows[i][3].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 4].Text = ds.Tables[0].Rows[i][4].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 5].Text = ds.Tables[0].Rows[i][5].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 6].Text = ds.Tables[0].Rows[i][6].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 7].Text = ds.Tables[0].Rows[i][7].ToString();
                    this.fpSpread1_Sheet1.Cells[i, 8].Text = ds.Tables[0].Rows[i][8].ToString();
                }
            }
            else
            {
                this.fpSpread1_Sheet1.RowCount = 0;
            }
        }
        /// <summary>
        /// 检索程序中需要的列表
        /// </summary>
        /// <param name="sqlIndex">检索的SQL语句在XML中的索引数组 第一位为select索引 其他为where索引</param>
        /// <param name="filterField">用于对该列表进行检索的字段,由sql语句检索的数据内选择</param>
        /// <param name="formatStr">对sql语句进行格式化的数据</param>
        public void ShowInfoList(string[] sqlIndex, string[] filterField, params string[] formatStr)
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索数据 请稍候.....");
            Application.DoEvents();

            try
            {
                this.DataAutoCellType = false;
                this.DataAutoHeading  = false;
                this.DataAutoWidth    = false;

                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet dataSet = new DataSet();

                databaseManager.ExecQuery(sqlIndex, ref dataSet, formatStr);
                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }
                if (dataSet.Tables != null && dataSet.Tables.Count > 0)
                {
                    this.DataTable = dataSet.Tables[0];
                }
                this.FilterField = filterField;
            }
            catch (Exception ex)
            {
                MessageBox.Show("检索列表数据发生错误\n" + ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 把在线的表和历史表的对照信息载入到静态ArrayList表当中
        /// </summary>
        /// <returns>0 成功 -1失败</returns>
        private static int initTableList()
        {
            try
            {
                //定义一个新的ArrayList
                alTables = new ArrayList();
                //查找COM_TABLELIST
                Neusoft.FrameWork.Management.DataBaseManger manager = new Neusoft.FrameWork.Management.DataBaseManger();
                if (manager.ExecQuery("select tablename,historytablename,memo from com_tablelist where historytablename is not null") == -1)
                {
                    return(-1);
                }
                while (manager.Reader.Read())               //读数据
                {
                    Neusoft.FrameWork.Models.NeuObject obj = new Neusoft.FrameWork.Models.NeuObject();
                    obj.ID   = manager.Reader[0].ToString();
                    obj.Name = manager.Reader[1].ToString();
                    obj.Memo = manager.Reader[2].ToString();
                    alTables.Add(obj);
                }
                manager.Reader.Close();
            }
            catch            //无聊的错误
            {
                return(-1);
            }

            return(0);
        }
Esempio n. 4
0
        /// <summary>
        /// 检索程序中需要的列表
        /// </summary>
        /// <param name="sqlIndex">检索的SQL语句在XML中的索引数组 第一位为select索引 其他为where索引</param>
        /// <param name="filterField">用于对该列表进行检索的字段,由sql语句检索的数据内选择</param>
        /// <param name="formatStr">对sql语句进行格式化的数据</param>
        public void ShowInfoList(string[] sqlIndex, string[] filterField, params string[] formatStr)
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索数据 请稍候.....");
            Application.DoEvents();

            try
            {
                this.FarPointReset();
                this.DataAutoCellType = false;
                this.DataAutoHeading  = false;
                this.DataAutoWidth    = false;
                //{1DED4697-A590-47b3-B727-92A4AA05D2ED} 设置列表显示时数据锁定
                this.neuSpread1_Sheet1.DefaultStyle.Locked = true;

                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet dataSet = new DataSet();
                databaseManager.ExecQuery(sqlIndex, ref dataSet, formatStr);
                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }
                this.DataTable   = dataSet.Tables[0];
                this.FilterField = filterField;
            }
            catch (Exception ex)
            {
                MessageBox.Show("检索列表数据发生错误\n" + ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 医院名称获取
        /// </summary>
        /// <returns>成功返回医院名称 失败返回空字符串</returns>
        public static string GetHosName()
        {
            if (HosName == "-1")
            {
                Neusoft.FrameWork.Management.DataBaseManger dataBase = new Neusoft.FrameWork.Management.DataBaseManger();
                if (dataBase.ExecQuery(Function.hosNameSelect) == -1)
                {
                    return(HosCode);
                }

                try
                {
                    if (dataBase.Reader.Read())
                    {
                        HosName = dataBase.Reader[0].ToString();
                        HosCode = dataBase.Reader[1].ToString();
                        HosMemo = dataBase.Reader[2].ToString();
                    }
                }
                catch (Exception ex)
                {
                    return("");
                }
                finally
                {
                    if (!dataBase.Reader.IsClosed)
                    {
                        dataBase.Reader.Close();
                    }
                }
            }

            return(HosName);
        }
Esempio n. 6
0
        private void f_fillCombo(Object sender, string s)
        {
            string[] ss;
            bool     b = false;

            if (s.Length > 5)
            {
                if ((s.Trim().Substring(0, 6)).ToUpper() == "SELECT")
                {
                    b = true;
                }
            }

            ((ComboBox)sender).Text = "";
            short i;

            try
            {
                if (b)                 //select
                {
                    System.Data.DataSet ds = new System.Data.DataSet();
                    if (manager.ExecQuery(s, ref ds) == -1)
                    {
                        //
                        MessageBox.Show(manager.Err);
                        return;
                    }

                    foreach (System.Data.DataRow r in ds.Tables[0].Rows)
                    {
                        ((ComboBox)sender).Items.Add(r[0].ToString());
                    }
                }
                else
                {
                    ss = s.Split(',');
                    for (i = 0; i < ss.Length; i++)
                    {
                        ((ComboBox)sender).Items.Add(ss[i]);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 数据检索初始化
        /// </summary>
        /// <returns>成功返回1 失败返回-1</returns>
        public int Init()
        {
            this.neuSpread1_Sheet1.DataAutoSizeColumns = false;

            #region 获取数据

            Neusoft.FrameWork.Management.DataBaseManger dataBaseMgr = new Neusoft.FrameWork.Management.DataBaseManger();
            if (dsPhaData == null)
            {
                dsPhaData = new DataSet();
            }

            #region 获取查询Sql索引
            string[] strIndex;
            string[] strParam = null;
            if (drugDept == null || drugDept.ID == "")
            {
                if (drugType == "ALL")
                {
                    strIndex = new string[] { "Pharmacy.Item.Info" };
                    strParam = new string[] { };
                }
                else
                {
                    strIndex = new string[] { "Pharmacy.Item.Info", "Preparation.Item.GetList.QueryByType" };
                    strParam = new string[] { drugType };
                }
            }
            else
            {
                strIndex = new string[] { "Pharmacy.Item.Info", "Pharmacy.Item.GetAvailableList.Inpatient.ByDrugType" };
                strParam = new string[] { drugDept.ID, drugType };
            }
            #endregion

            if (dataBaseMgr.ExecQuery(strIndex, ref dsPhaData, strParam) == -1)
            {
                MessageBox.Show("读取药品信息时发生错误 \n" + dataBaseMgr.Err);
                return(-1);
            }

            if (dsPhaData.Tables.Count > 0)
            {
                this.dvPhaData = new DataView(this.dsPhaData.Tables[0]);
                this.neuSpread1_Sheet1.DataSource = dvPhaData;

                Neusoft.FrameWork.WinForms.Classes.CustomerFp.ReadColumnFormatProperty(this.neuSpread1_Sheet1, this.FilePath);
            }
            #endregion

            return(1);
        }
        /// <summary>
        /// 显示库存物品列表
        /// </summary>
        /// <param name="deptCode">库房编码</param>
        /// <param name="isDetail">是否查询明细</param>
        public virtual void ShowDeptStorage(string deptCode, bool isDetail)
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索库存物品信息...");
            Application.DoEvents();
            try
            {
                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet dataSet = new DataSet();
                string  sqlIndex;
                if (isDetail)
                {
                    sqlIndex = "Material.Item.GetStorageListByPrice";
                }
                else
                {
                    sqlIndex = "Material.Item.GetStorageListNoPrice";
                }

                databaseManager.ExecQuery(sqlIndex, ref dataSet, deptCode);
                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }
                this.filterField = new string[4] {
                    "SPELL_CODE", "WB_CODE", "CUSTOM_CODE", "ITEM_NAME"
                };
                if (dataSet.Tables != null && dataSet.Tables.Count > 0)
                {
                    this.DataTable = dataSet.Tables[0];
                }

                //使用控件默认的显示格式
                if (isDetail)
                {
                    this.SetFormatForStorageDetail();
                }
                else
                {
                    this.SetFormatForStorage();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Licence 判断
        /// </summary>
        /// <returns>成功进行返回1 失败返回-1</returns>
        private static int JudgeHISCryptoKeyFile(ref string strErr)
        {
            //去掉DATABASE_FLAG 字段
            string sql = "SELECT HOS_NAME,NUMBER_VALUE from com_departinfo";

            Neusoft.FrameWork.Management.DataBaseManger dataBase = new Neusoft.FrameWork.Management.DataBaseManger();
            if (dataBase.ExecQuery(sql) == -1)
            {
                MessageBox.Show(dataBase.Err);
                return(-1);
            }
            try
            {
                if (dataBase.Reader.Read())
                {
                    HosName             = dataBase.Reader[0].ToString();
                    maxLocalLogFileSize = Neusoft.FrameWork.Function.NConvert.ToInt32(dataBase.Reader[1]);
                    ////{5313B8E5-709F-4741-A6E3-2186702DAC6C} 2013.02.20 modified by xipeter
                    //IsTestDB = Neusoft.FrameWork.Function.NConvert.ToBoolean(dataBase.Reader[2].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(-1);
            }
            finally
            {
                dataBase.Reader.Close();
            }

            DateTime sysTime = dataBase.GetDateTimeFromSysDateTime();

            string displayHosName     = "";
            string licenceInformation = "";
            //int result = Neusoft.HisCrypto.Function.Licence(HosName, sysTime, out displayHosName, ref strErr);
            ////int result = Neusoft.HisCrypto.Function.Licence( HosName, sysTime, out displayHosName,out licenceInformation, ref strErr );

            //HosName = displayHosName;
            int result = 1;

            if (result == 1)
            {
                return(1);
            }

            return(-1);
        }
Esempio n. 10
0
        /// <summary>
        /// 获取树结点
        /// </summary>
        /// <param name="sqlIndex">sql索引</param>
        /// <param name="param">参数</param>
        /// <returns>树结点数组</returns>
        private List <TreeNode> getObject(string sqlIndex, params string[] param)
        {
            List <TreeNode> ls  = new List <TreeNode>();
            string          SQL = "";

            if (dbMgr.Sql.GetSql(sqlIndex, ref SQL) == -1)
            {
                this.ShowMessageBox("没有找到SQL:" + sqlIndex, "错误");
            }
            SQL = string.Format(SQL, param);
            if (dbMgr.ExecQuery(SQL) == -1)
            {
                this.ShowMessageBox("执行SQL发生错误:" + dbMgr.Err, "错误");
            }
            try
            {
                while (dbMgr.Reader.Read())
                {
                    Neusoft.FrameWork.Models.NeuObject obj = new Neusoft.FrameWork.Models.NeuObject();
                    TreeNode node = new TreeNode();
                    obj.ID     = dbMgr.Reader[0].ToString(); //试图名称
                    obj.Name   = dbMgr.Reader[1].ToString(); //自定义类型 试图说明
                    obj.Memo   = dbMgr.Reader[2].ToString(); //备注
                    obj.User01 = dbMgr.Reader[3].ToString(); //强制条件 SQL索引
                    obj.User02 = dbMgr.Reader[4].ToString(); //二级权限
                    //sql 如果是用户定义,则从界面获取
                    //如果是预定则为空
                    obj.User03 = dbMgr.Reader[5].ToString();

                    node.Tag  = obj;
                    node.Text = string.IsNullOrEmpty(obj.Memo) ? obj.Name : obj.Memo;
                    //node.ImageIndex = 3;
                    //node.SelectedImageIndex = 4;

                    ls.Add(node);
                }
                dbMgr.Reader.Close();
            }
            catch (Exception ex)
            {
                this.ShowMessageBox("执行SQL发生错误:" + ex.Message, "错误");
            }
            return(ls);
        }
        /// <summary>
        /// 显示物品列表{7019A2A6-ADCA-4984-944B-C4F1A312449A}
        /// </summary>
        public virtual void ShowMaterialList(string deptCode)
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索物品信息...");
            Application.DoEvents();
            try
            {
                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet  dataSet  = new DataSet();
                string[] sqlIndex = new string[2] {
                    "Material.MetItem.ValibInfo", "Material.MetItem.GetAvailableList.Where"
                };

                //{7019A2A6-ADCA-4984-944B-C4F1A312449A}
                databaseManager.ExecQuery(sqlIndex, ref dataSet, deptCode);
                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }
                this.filterField = new string[4] {
                    "SPELL_CODE", "WB_CODE", "CUSTOM_CODE", "ITEM_NAME"
                };
                if (dataSet.Tables.Count > 0)
                {
                    this.DataTable = dataSet.Tables[0];
                }

                this.SetpMaterialFormat();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 12
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("ÕýÔÚ¼ìË÷");
            Application.DoEvents();
            Neusoft.FrameWork.Management.Connection.Instance = new System.Data.OracleClient.OracleConnection(Neusoft.FrameWork.Management.Connection.Instance.ConnectionString);
            Neusoft.FrameWork.Management.Connection.Instance.Open();

            Neusoft.FrameWork.Management.DataBaseManger m = new Neusoft.FrameWork.Management.DataBaseManger();
            DataSet ds = new DataSet();

            if (m.ExecQuery("select id,name from com_sql", ref ds) == -1)
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                MessageBox.Show(m.Err);
                return;
            }
            //Neusoft.FrameWork.Management.Connection.Instance.Close();
            //Neusoft.FrameWork.Management.Connection.Instance = new Oracle.DataAccess.Client.OracleConnection(Neusoft.FrameWork.Management.Connection.Instance.ConnectionString);
            //Neusoft.FrameWork.Management.Connection.Instance.Open();

            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
            m.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();
            //m.SetTrans(t.Trans);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                string s = "update com_sql set name1 = :a where id='" + dr[0].ToString() + "'";
                System.Data.OracleClient.OracleCommand command = new System.Data.OracleClient.OracleCommand(s);
                command.Connection  = Neusoft.FrameWork.Management.Connection.Instance as System.Data.OracleClient.OracleConnection;
                command.CommandText = s;
                command.CommandType = System.Data.CommandType.Text;
                command.Transaction = Neusoft.FrameWork.Management.PublicTrans.Trans as System.Data.OracleClient.OracleTransaction;


                System.Data.OracleClient.OracleParameter param = command.Parameters.Add("a", System.Data.OracleClient.OracleType.Clob);
                param.Direction = System.Data.ParameterDirection.Input;

                // Assign Byte Array to Oracle Parameter
                param.Value = dr[1].ToString();
                // Step 5
                // Execute the Anonymous PL/SQL Block
                try
                {
                    if (command.ExecuteNonQuery() == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        MessageBox.Show(m.Err);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                    MessageBox.Show(ex.Message);
                    return;
                }


                //if (m.InputBlob(s, b)== -1)
                //{
                //    t.RollBack();
                //    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                //    MessageBox.Show(m.Err);
                //    return;
                //}
                Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm(dr[0].ToString() + "\n" + dr[1].ToString());
                Application.DoEvents();
            }
            Neusoft.FrameWork.Management.PublicTrans.Commit();

            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            MessageBox.Show("³É¹¦£¡");
        }
Esempio n. 13
0
        public new  void ShowPharmacyList()
        {
            //base.ShowPharmacyList();
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索药品信息...");
            Application.DoEvents();
            try
            {
                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet dataSet = new DataSet();

                base.ShowAdvanceFilter = true;

                //string[] sqlIndex = new string[2] { "Pharmacy.Item.ValibInfo", "Pharmacy.Item.GetAvailableList.Where" };
                string[] sqlIndex = new string[1] {
                    "Pharmacy.Item.ValibInfo.InPlan"
                };

                string itemType = "A";
                if (base.cmbItemType.Tag != null && base.cmbItemType.Text != "")
                {
                    itemType = base.cmbItemType.Tag.ToString();
                }

                //{E215BCFB-9D4B-418c-9C12-AC6E0242FB7F}修改传入SQL语句的参数,增加权限科室ID

                databaseManager.ExecQuery(sqlIndex, ref dataSet, itemType, deptCode);

                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }
                base.filterField = new string[] { "药品名称", "通用名", "拼音", "五笔", "自定义码", "通用名拼音", "别名", "别名拼音",
                                                  "通用名五笔", "学名", "学名拼音", "学名五笔", "别名五笔" };
                base.DataAutoHeading = true;
                base.DataAutoWidth   = false;
                int[]  widthCollect   = new int[] { 10, 120, 100, 60, 40, 40, 40, 40, 120 };
                bool[] visibleCollect = new bool[] { false, true, true, true, true, false, false, false, false, true, false, false, true, false, false, true, false, false, false };
                if (dataSet.Tables.Count > 0)
                {
                    base.DataTable = dataSet.Tables[0];
                }

                base.SetFormat(null, widthCollect, visibleCollect);
                //{3FF156FD-6AB7-4468-9BA6-69F2E143AF3C}
                for (int i = 0; i < base.neuSpread1_Sheet1.Columns.Count; i++)
                {
                    if (base.neuSpread1_Sheet1.Columns[i].CellType.GetType() == typeof(FarPoint.Win.Spread.CellType.NumberCellType))
                    {
                        FarPoint.Win.Spread.CellType.NumberCellType numCellType = new FarPoint.Win.Spread.CellType.NumberCellType();
                        numCellType.DecimalPlaces = 4;
                        base.neuSpread1_Sheet1.Columns[i].CellType = numCellType;

                        //{D0F050D1-5743-4c4a-B7A6-103F1AA0AD7D}库存量宽度显示不足
                        base.neuSpread1_Sheet1.Columns[i].Width = 100;
                    }
                }

                //this.SetpharmacyFormat();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 删除 不可以删除别人共享的查询,不删除com_sql中的sql
        /// </summary>
        /// <returns></returns>
        private int delete(ref string errInfo)
        {
            string text = this.tvCustomQuery.SelectedNode.Text;

            System.Windows.Forms.DialogResult dr = MessageBox.Show(this, "您确实要删除" + text + "吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
            if (dr == DialogResult.No)
            {
                return(1);
            }
            TreeNode node = this.tvCustomQuery.SelectedNode;

            string sql = "";

            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
            this.dbMgr.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            //业务根节点删除
            if (node.Parent == null)
            {
                if (node.Nodes.Count == 0)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    return(1);
                }
                sql = @"delete from com_customquery_defineinfo where view_name = '{0}' and owner = '{1}'";
                sql = string.Format(sql, this.myPreDefine.ID, dbMgr.Operator.ID);
                if (dbMgr.ExecQuery(sql) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    errInfo = dbMgr.Err;
                    return(-1);
                }
                Neusoft.FrameWork.Management.PublicTrans.Commit();

                node.Nodes.Clear();
                return(1);
            }

            //文件夹
            if (!string.IsNullOrEmpty(this.myPreDefine.ID))
            {
                //新建的文件夹直接删除,否则删除文件夹所有
                if (node.Nodes.Count > 0)
                {
                    sql = @"delete from com_customquery_defineinfo where view_name = '{0}' and owner = '{1}' and type = '{2}'";
                    sql = string.Format(sql, this.myPreDefine.ID, dbMgr.Operator.ID, this.myPreDefine.Name);
                    if (dbMgr.ExecQuery(sql) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        errInfo = dbMgr.Err;
                        return(-1);
                    }
                }
                node.Parent.Nodes.Remove(node);
            }
            else//单个查询
            {
                //没有保存的直接删除
                if (!string.IsNullOrEmpty(this.myPreDefine.User03))
                {
                    sql = @"delete from com_customquery_defineinfo where sql_id = '{0}' and owner = '{1}'";
                    sql = string.Format(sql, this.myPreDefine.User01, dbMgr.Operator.ID);
                    if (dbMgr.ExecQuery(sql) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        errInfo = dbMgr.Err;
                        return(-1);
                    }
                }
                node.Parent.Nodes.Remove(node);
            }
            Neusoft.FrameWork.Management.PublicTrans.Commit();
            return(1);
        }
Esempio n. 15
0
        /// <summary>
        /// 显示库存药品列表 根据参数决定是否显示库存中停用的药品
        /// {D06724D9-C415-4a6b-8E93-0FF175CB7A8A} 20091230
        /// </summary>
        /// <param name="deptCode">科室代码</param>
        /// <param name="isBatch">是否按批号显示</param>
        /// <param name="isStoreInvalid">是否过滤无效</param>
        public virtual void ShowDeptStorageAndDict(string deptCode, bool isBatch, bool isFilterStoreInvalid)
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索库存药品信息...");
            Application.DoEvents();
            try
            {
                this.FarPointReset();

                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet dataSet = new DataSet();
                string  sqlIndex;
                if (isBatch)
                {
                    if (isFilterStoreInvalid)
                    {
                        sqlIndex = "Pharmacy.Item.QueryDrugList.StoreAndDic.ByBatch";
                    }
                    else
                    {
                        sqlIndex = "Pharmacy.Item.QueryDrugList.StoreAndDic.ByBatch.AllState";
                    }
                }
                else
                {
                    if (isFilterStoreInvalid)
                    {
                        sqlIndex = "Pharmacy.Item.QueryDrugList.StoreAndDic.NotByBatch";
                    }
                    else
                    {
                        sqlIndex = "Pharmacy.Item.QueryDrugList.StoreAndDic.NotByBatch.AllState";
                    }
                }

                databaseManager.ExecQuery(sqlIndex, ref dataSet, deptCode, "ALL");
                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }

                this.filterField = new string[] { "药品名称", "商品名拼音码", "商品名五笔码", "通用名拼音码", "通用名五笔码" };

                this.DataAutoHeading  = false;
                this.DataAutoWidth    = false;
                this.DataAutoCellType = false;

                if (dataSet.Tables.Count > 0)
                {
                    this.DataTable = dataSet.Tables[0];
                }

                //使用控件默认的显示格式
                this.SetFormatForStorageAndDict(Neusoft.FrameWork.Function.NConvert.ToInt32(isBatch));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 显示库存药品列表  不显示药库停用的药品 无药房是否停用无关
        /// 处理特殊盘点信息{98F0BF7A-5F41-4de3-884F-B38E71B41A8C}
        /// </summary>
        /// <param name="deptCode">库房编码</param>
        /// <param name="isBatch">是否按批号管理</param>
        /// <param name="showStorageFlag">是否显示库存</param>
        public virtual void ShowDeptStorageWithSpecialCheck(string deptCode, bool isBatch, int showStorageFlag)
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索库存药品信息...");
            Application.DoEvents();
            try
            {
                this.FarPointReset();
                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet dataSet = new DataSet();
                string  sqlIndex;
                if (isBatch)
                {
                    sqlIndex = "Pharmacy.Item.GetStorageListByBatch";
                }
                else
                {
                    sqlIndex = "Pharmacy.Item.GetStorageListWithSpecialCheck";
                }

                databaseManager.ExecQuery(sqlIndex, ref dataSet, deptCode);
                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }

                if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Columns.Contains("custom_code"))
                {
                    this.filterField = new string[] { "SPELL_CODE", "WB_CODE", "TRADE_NAME", "REGULAR_SPELL",
                                                      "REGULAR_WB", "OTHER_SPELL", "OTHER_WB", "FORMAL_SPELL", "FORMAL_WB", "custom_code" };
                }
                else
                {
                    this.filterField = new string[] { "SPELL_CODE", "WB_CODE", "TRADE_NAME", "REGULAR_SPELL",
                                                      "REGULAR_WB", "OTHER_SPELL", "OTHER_WB", "FORMAL_SPELL", "FORMAL_WB" };
                }

                this.DataAutoWidth = false;

                if (dataSet.Tables.Count > 0)
                {
                    foreach (DataRow dr in dataSet.Tables[0].Rows)
                    {
                        if (Neusoft.FrameWork.Function.NConvert.ToDecimal(dr[14]) != 0)
                        {
                            dr[5] = Math.Round(Neusoft.FrameWork.Function.NConvert.ToDecimal(dr[5]) / Neusoft.FrameWork.Function.NConvert.ToDecimal(dr[14]), 2);
                        }
                    }
                    //{28017834-5C98-4d3c-A8CD-7BE2F95C6D74} 过滤不显示0库存药品
                    System.Data.DataView view = dataSet.Tables[0].DefaultView;
                    view.RowFilter = "STORE_SUM > 0";
                    this.DataTable = view.ToTable();
                }

                //使用控件默认的显示格式
                this.SetFormatForStorage(showStorageFlag);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 显示药品列表  不显示药库停用的药品 与药房是否停用无关
        /// </summary>
        public virtual void ShowPharmacyList()
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在检索药品信息...");
            Application.DoEvents();
            try
            {
                Neusoft.FrameWork.Management.DataBaseManger databaseManager = new Neusoft.FrameWork.Management.DataBaseManger();
                DataSet dataSet = new DataSet();

                this.ShowAdvanceFilter = true;

                //string[] sqlIndex = new string[2] { "Pharmacy.Item.ValibInfo", "Pharmacy.Item.GetAvailableList.Where" };
                string[] sqlIndex = new string[1] {
                    "Pharmacy.Item.ValibInfo"
                };

                string itemType = "A";
                if (this.cmbItemType.Tag != null && this.cmbItemType.Text != "")
                {
                    itemType = this.cmbItemType.Tag.ToString();
                }
                databaseManager.ExecQuery(sqlIndex, ref dataSet, itemType);

                if (dataSet == null)
                {
                    MessageBox.Show("检索列表数据发生错误\n" + databaseManager.Err);
                    return;
                }
                this.filterField = new string[13] {
                    "药品名称", "通用名", "拼音", "五笔", "自定义码", "通用名拼音", "别名", "别名拼音",
                    "通用名五笔", "学名", "学名拼音", "学名五笔", "别名五笔"
                };
                this.DataAutoHeading = true;
                this.DataAutoWidth   = false;
                int[] widthCollect = new int[6] {
                    10, 120, 100, 60, 40, 40
                };
                bool[] visibleCollect = new bool[19] {
                    false, true, true, true, true, false, false, false, false, true, false, false, true, false, false, true, false, false, false
                };
                if (dataSet.Tables.Count > 0)
                {
                    this.DataTable = dataSet.Tables[0];
                }

                this.SetFormat(null, widthCollect, visibleCollect);
                //{3FF156FD-6AB7-4468-9BA6-69F2E143AF3C}
                for (int i = 0; i < this.neuSpread1_Sheet1.Columns.Count; i++)
                {
                    if (this.neuSpread1_Sheet1.Columns[i].CellType.GetType() == typeof(FarPoint.Win.Spread.CellType.NumberCellType))
                    {
                        FarPoint.Win.Spread.CellType.NumberCellType numCellType = new FarPoint.Win.Spread.CellType.NumberCellType();
                        numCellType.DecimalPlaces = 4;
                        this.neuSpread1_Sheet1.Columns[i].CellType = numCellType;
                    }
                }

                //this.SetpharmacyFormat();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 获取床位日报信息
        /// </summary>
        /// <param name="deptCode">科室编码 </param>
        /// <returns></returns>
        protected int QueryDeptDayReport(string deptCode)
        {
            this.lbDate.Text = "日期:" + this.BeginDate.ToString("yyyy-MM-dd") + " 至 " + this.EndDate.ToString("yyyy-MM-dd");
            this.lbDept.Text = "统计范围:" + this.cmbDept.Text;

            #region 床位明细 转入、转出

            string execDetailSql = @"select t.stat_date,t.stat_type,t.extend,count(*)
--select *
from met_cas_dayreport_detail t
where t.stat_date >= to_date('{0}','yyyy-mm-dd')
and   t.stat_date <= to_date('{1}','yyyy-mm-dd')
and   t.dept_code = '{2}'
and   t.valid_state = '0'
group by t.stat_date,t.stat_type,t.extend
order by t.stat_date";

            execDetailSql = string.Format(execDetailSql, this.BeginDate.ToString("yyyy-MM-dd"), this.EndDate.ToString("yyyy-MM-dd"), deptCode);

            DataSet ds = new DataSet();
            Neusoft.FrameWork.Management.DataBaseManger dataManager = new Neusoft.FrameWork.Management.DataBaseManger();
            if (dataManager.ExecQuery(execDetailSql, ref ds) == -1)
            {
                MessageBox.Show("床位日报查询发生错误" + dataManager.Err);
                return(-1);
            }

            this.neuSpread1_Sheet2.Rows.Count = 0;

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                #region 床位日报信息处理
                string privDate = "";
                int    rowIndex = -1;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (privDate != NConvert.ToDateTime(dr[0]).ToString("yyyy-MM-dd"))
                    {
                        rowIndex++;

                        this.neuSpread1_Sheet2.Rows.Add(rowIndex, 1);
                        this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColDateStat].Text = NConvert.ToDateTime(dr[0]).ToString("yyyy-MM-dd");

                        privDate = NConvert.ToDateTime(dr[0]).ToString("yyyy-MM-dd");
                    }

                    switch (dr[1].ToString())
                    {
                    case "K":           //接诊
                    case "C":           //召回
                        decimal originalNum = NConvert.ToDecimal(this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColInNum].Text);
                        this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColInNum].Text = (originalNum + NConvert.ToDecimal(dr[3])).ToString();
                        break;

                    case "O":           //出院
                        switch (dr[2].ToString())
                        {
                        case "1":
                            this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColOut1].Text = NConvert.ToDecimal(dr[3]).ToString();
                            break;

                        case "2":
                            this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColOut2].Text = NConvert.ToDecimal(dr[3]).ToString();
                            break;

                        case "3":
                            this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColOut3].Text = NConvert.ToDecimal(dr[3]).ToString();
                            break;

                        case "4":
                            this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColOut4].Text = NConvert.ToDecimal(dr[3]).ToString();
                            break;
                        }

                        decimal totNum = NConvert.ToDecimal(this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColTot].Text);
                        this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColTot].Text = (totNum + NConvert.ToDecimal(dr[3])).ToString();

                        break;

                    case "RI":          //转入
                        this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColTransferIn].Text = NConvert.ToDecimal(dr[3]).ToString();
                        break;

                    case "RO":          //转出
                        this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColTransferOut].Text = NConvert.ToDecimal(dr[3]).ToString();
                        break;

                    case "OF":          //无费退院
                        decimal totOFNum = NConvert.ToDecimal(this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColTot].Text);
                        this.neuSpread1_Sheet2.Cells[rowIndex, (int)ColumnDetailEnum.ColTot].Text = (totOFNum + NConvert.ToDecimal(dr[3])).ToString();
                        break;
                    }
                }

                #endregion
            }

            #endregion

            #region 期初、期末人数

            string execTotSql = @"select s.date_stat,s.in_normal + s.in_return,s.out_normal + s.out_withdrawal,s.in_transfer,
       s.out_transfer,s.bed_stand,s.beginning_num,s.end_num
from   met_cas_inpatientdayreport s 
where  s.date_stat >= to_date('{0}','yyyy-mm-dd')
and    s.date_stat <= to_date('{1}','yyyy-mm-dd')
and    s.dept_code = '{2}'
order by s.date_stat";

            execTotSql = string.Format(execTotSql, this.BeginDate.ToString("yyyy-MM-dd"), this.EndDate.ToString("yyyy-MM-dd"), deptCode);

            DataSet dsTot = new DataSet();
            if (dataManager.ExecQuery(execTotSql, ref dsTot) == -1)
            {
                MessageBox.Show("床位日报查询发生错误" + dataManager.Err);
                return(-1);
            }

            if (dsTot != null && dsTot.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in dsTot.Tables[0].Rows)
                {
                    for (int i = 0; i < this.neuSpread1_Sheet2.Rows.Count; i++)
                    {
                        if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColDateStat].Text == NConvert.ToDateTime(dr[0]).ToString("yyyy-MM-dd"))
                        {
                            //入院人数
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColInNum].Text = NConvert.ToDecimal(dr[1]).ToString();
                            //出院人数
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColTot].Text = NConvert.ToDecimal(dr[2]).ToString();
                            //转入人数
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColTransferIn].Text = NConvert.ToDecimal(dr[3]).ToString();
                            //转出人数
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColTransferOut].Text = NConvert.ToDecimal(dr[4]).ToString();
                            //实开床位
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColStandardNum].Text = NConvert.ToDecimal(dr[5]).ToString();
                            //期初人数
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColBeginNum].Text = NConvert.ToDecimal(dr[6]).ToString();
                            //期末人数
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColEndNum].Text = NConvert.ToDecimal(dr[7]).ToString();


                            if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColInNum].Text == "0")
                            {
                                this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColInNum].Text = "";
                            }
                            if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColTot].Text == "0")
                            {
                                this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColTot].Text = "";
                            }
                            if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColTransferIn].Text == "0")
                            {
                                this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColTransferIn].Text = "";
                            }
                            if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColTransferOut].Text == "0")
                            {
                                this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColTransferOut].Text = "";
                            }
                            if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColStandardNum].Text == "0")
                            {
                                this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColStandardNum].Text = "";
                            }
                            if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColBeginNum].Text == "0")
                            {
                                this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColBeginNum].Text = "";
                            }
                            if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColEndNum].Text == "0")
                            {
                                this.neuSpread1_Sheet2.Cells[i, (int)ColumnEnum.ColEndNum].Text = "";
                            }
                        }
                    }
                }
            }

            #endregion

            #region 出院总床日数


            string execOutStatSql = @"select  t.stat_date,sum(trunc(decode(s.IN_STATE,'N',s.oper_date,s.out_date)) - trunc(s.in_date))
from    met_cas_dayreport_detail t,fin_ipr_inmaininfo s
where   t.stat_date >= to_date('{0}','yyyy-mm-dd')
and     t.stat_date <= to_date('{1}','yyyy-mm-dd')
and     t.dept_code = '{2}'
and     t.valid_state = '0'
and     t.stat_type in ('O','OF')
and     t.inpatient_no = s.inpatient_no
group by t.stat_date";

            execOutStatSql = string.Format(execOutStatSql, this.BeginDate.ToString("yyyy-MM-dd"), this.EndDate.ToString("yyyy-MM-dd"), deptCode);

            DataSet dsOutStat = new DataSet();
            if (dataManager.ExecQuery(execOutStatSql, ref dsOutStat) == -1)
            {
                MessageBox.Show("床位日报查询发生错误" + dataManager.Err);
                return(-1);
            }

            if (dsOutStat != null && dsOutStat.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in dsOutStat.Tables[0].Rows)
                {
                    for (int i = 0; i < this.neuSpread1_Sheet2.Rows.Count; i++)
                    {
                        if (this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColDateStat].Text == NConvert.ToDateTime(dr[0]).ToString("yyyy-MM-dd"))
                        {
                            this.neuSpread1_Sheet2.Cells[i, (int)ColumnDetailEnum.ColOutStat].Text = NConvert.ToDecimal(dr[1]).ToString();
                        }
                    }
                }
            }

            #endregion

            #region 合计统计

            this.SetSum((int)ColumnDetailEnum.ColDateStat, (int)ColumnDetailEnum.ColStandardNum, (int)ColumnDetailEnum.ColBeginNum, (int)ColumnDetailEnum.ColInNum,
                        (int)ColumnDetailEnum.ColTransferIn, (int)ColumnDetailEnum.ColTransferOut, (int)ColumnDetailEnum.ColTot, (int)ColumnDetailEnum.ColOutTot,
                        (int)ColumnDetailEnum.ColOut1, (int)ColumnDetailEnum.ColOut2, (int)ColumnDetailEnum.ColOut3, (int)ColumnDetailEnum.ColOut4,
                        (int)ColumnDetailEnum.ColEndNum, (int)ColumnDetailEnum.ColOutStat);

            #endregion

            return(1);
        }
Esempio n. 19
0
        public int Query(string sql)
        {
            this.isQuerying = true;

            this.fpSpread1_Sheet1.RowCount = 0;

            if (sql == null || sql == "")
            {
                return(-1);
            }

            if (DB.ExecQuery(sql) == -1)
            {
                MessageBox.Show(DB.Err);
                return(-1);
            }
            if (this.isSQLChanged)
            {
                this.Reset();
                this.InitSpreadData();
                this.isSQLChanged = false;
            }

            //新增代码,给DB2用,什么东西啊
            if (Neusoft.FrameWork.Management.Connection.DBType == Neusoft.FrameWork.Management.Connection.EnumDBType.DB2)
            {
                if (DB.Reader != null)
                {
                    if (DB.Reader.IsClosed)
                    {
                        if (DB.ExecQuery(sql) == -1)
                        {
                            MessageBox.Show(DB.Err);
                            return(-1);
                        }
                    }
                }
            }

            while (DB.Reader.Read())
            {
                this.fpSpread1_Sheet1.RowCount += 1;
                this.fpSpread1_Sheet1.Rows[this.fpSpread1_Sheet1.RowCount - 1].Tag = RecordState.Normal;

                for (int i = 0; i < DB.Reader.FieldCount; i++)
                {
                    if (this.dictCombos.ContainsKey(this.fpSpread1_Sheet1.Columns[i].Tag.ToString()))
                    {
                        Dictionary <string, string> dict = this.dictCombos[this.fpSpread1_Sheet1.Columns[i].Tag.ToString()];
                        if (dict.ContainsKey(DB.Reader[i].ToString()))
                        {
                            this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, i].Text = dict[DB.Reader[i].ToString()];
                        }
                        else
                        {
                            MessageBox.Show(string.Format("选择项 {0} 未设置 {1} ,请与系统管理员联系!", DB.Reader.GetName(i), DB.Reader[i].ToString()));
                        }
                    }
                    else
                    {
                        this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, i].Text = DB.Reader[i].ToString();
                    }
                }
            }
            DB.Reader.Dispose();
            //this.dataSet.Clear();
            //DB.FillDataSet(this.dataSet);
            //this.fpSpread1_Sheet1.DataSource = this.dataSet;
            this.isQuerying = false;
            return(0);
        }
Esempio n. 20
0
        /// <summary>
        /// 获得字段信息
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <returns>字段信息</returns>
        public static Dictionary <string, FieldInfo> GetFieldInfo(string tableName)
        {
            //{1863A8E8-9CCA-4b58-B129-38C1C35DADE3} 添加DB2支持
            //string sql = "select a.column_name, b.comments, a.nullable, a.data_type, a.data_length, a.data_default   from USER_TAB_COLUMNS a, USER_COL_COMMENTS b where a.table_name = '{0}' and a.column_name = b.column_name and a.table_name = b.table_name";

            string sql = "";

            if (Neusoft.FrameWork.Management.Connection.DBType == Neusoft.FrameWork.Management.Connection.EnumDBType.ORACLE)
            {
                sql = "select a.column_name, b.comments, a.nullable, a.data_type, a.data_length, a.data_default   from USER_TAB_COLUMNS a, USER_COL_COMMENTS b where a.table_name = '{0}' and a.column_name = b.column_name and a.table_name = b.table_name";
            }
            else if (Neusoft.FrameWork.Management.Connection.DBType == Neusoft.FrameWork.Management.Connection.EnumDBType.DB2)
            {
                sql = "select distinct S.COLNAME,S.REMARKS,S.NULLS,S.TYPENAME,S.LENGTH,S.DEFAULT from SYSCAT.COLUMNS S where S.TABNAME='{0}'";
            }
            else
            {
                sql = "select a.column_name, b.comments, a.nullable, a.data_type, a.data_length, a.data_default   from USER_TAB_COLUMNS a, USER_COL_COMMENTS b where a.table_name = '{0}' and a.column_name = b.column_name and a.table_name = b.table_name";
            }
            //if (Neusoft.FrameWork.Management.Connection.Instance.GetType().ToString() == "System.Data.OracleClient.OracleConnection")
            //{
            //    sql = "select a.column_name, b.comments, a.nullable, a.data_type, a.data_length, a.data_default   from USER_TAB_COLUMNS a, USER_COL_COMMENTS b where a.table_name = '{0}' and a.column_name = b.column_name and a.table_name = b.table_name";
            //}
            //else if (Neusoft.FrameWork.Management.Connection.Instance.GetType().ToString() == "IBM.Data.DB2.DB2Connection")
            //{
            //    sql = "select distinct S.COLNAME,S.REMARKS,S.NULLS,S.TYPENAME,S.LENGTH,S.DEFAULT from SYSCAT.COLUMNS S where S.TABNAME='{0}'";
            //}
            //else
            //{
            //    sql = "select a.column_name, b.comments, a.nullable, a.data_type, a.data_length, a.data_default   from USER_TAB_COLUMNS a, USER_COL_COMMENTS b where a.table_name = '{0}' and a.column_name = b.column_name and a.table_name = b.table_name";
            //}

            sql = string.Format(sql, tableName.ToUpper());

            Dictionary <string, FieldInfo> ret = new Dictionary <string, FieldInfo>();

            DB.ExecQuery(sql);
            while (DB.Reader.Read())
            {
                FieldInfo fieldInfo = new FieldInfo();
                fieldInfo.ID   = DB.Reader[0].ToString();
                fieldInfo.Name = DB.Reader[1].ToString();

                if (DB.Reader[2].ToString() == "Y")
                {
                    fieldInfo.Nullable = true;
                }
                else
                {
                    fieldInfo.Nullable = false;
                }
                //string dateType = DB.Reader[3].ToString();
                if (Neusoft.FrameWork.Management.Connection.DBType == Neusoft.FrameWork.Management.Connection.EnumDBType.DB2)
                {
                    fieldInfo.DataType = (FieldType)Enum.Parse(typeof(DB2FieldType), DB.Reader[3].ToString(), true);
                }
                else
                {
                    fieldInfo.DataType = (FieldType)Enum.Parse(typeof(FieldType), DB.Reader[3].ToString(), true);
                }
                fieldInfo.Length  = short.Parse(DB.Reader[4].ToString());
                fieldInfo.Default = DB.Reader[5].ToString();

                ret.Add(fieldInfo.ID, fieldInfo);
            }

            DB.Reader.Dispose();
            //{1863A8E8-9CCA-4b58-B129-38C1C35DADE3} 添加DB2支持
            //sql="select column_name from user_cons_columns a, user_constraints b where a.table_name = b.table_name and a.constraint_name = b.constraint_name and b.constraint_type =  'P' and a.table_name = '{0}'";
            if (Neusoft.FrameWork.Management.Connection.DBType == Neusoft.FrameWork.Management.Connection.EnumDBType.ORACLE)
            {
                sql = "select column_name from user_cons_columns a, user_constraints b where a.table_name = b.table_name and a.constraint_name = b.constraint_name and b.constraint_type =  'P' and a.table_name = '{0}'";
            }
            else if (Neusoft.FrameWork.Management.Connection.DBType == Neusoft.FrameWork.Management.Connection.EnumDBType.DB2)
            {
                sql = "SELECT I.COLNAMES FROM SYSCAT.INDEXES I WHERE I.TABNAME='{0}' and I.UNIQUERULE='P' GROUP BY I.COLNAMES";
            }
            else
            {
                sql = "select column_name from user_cons_columns a, user_constraints b where a.table_name = b.table_name and a.constraint_name = b.constraint_name and b.constraint_type =  'P' and a.table_name = '{0}'";
            }
            //if (Neusoft.FrameWork.Management.Connection.Instance.GetType().ToString() == "System.Data.OracleClient.OracleConnection")
            //{
            //    sql = "select column_name from user_cons_columns a, user_constraints b where a.table_name = b.table_name and a.constraint_name = b.constraint_name and b.constraint_type =  'P' and a.table_name = '{0}'";
            //}
            //else if (Neusoft.FrameWork.Management.Connection.Instance.GetType().ToString() == "IBM.Data.DB2.DB2Connection")
            //{
            //    sql = "SELECT I.COLNAMES FROM SYSCAT.INDEXES I WHERE I.TABNAME='{0}' and I.UNIQUERULE='P' GROUP BY I.COLNAMES";
            //}
            //else
            //{
            //    sql = "select column_name from user_cons_columns a, user_constraints b where a.table_name = b.table_name and a.constraint_name = b.constraint_name and b.constraint_type =  'P' and a.table_name = '{0}'";
            //}

            sql = string.Format(sql, tableName.ToUpper());
            DB.ExecQuery(sql);

            while (DB.Reader.Read())
            {
                string fieldID = DB.Reader[0].ToString();
                //ret[fieldID].IsPrimaryKey = true;
                if (Neusoft.FrameWork.Management.Connection.DBType == Neusoft.FrameWork.Management.Connection.EnumDBType.DB2)
                {
                    string[] keys = fieldID.Split(new char[] { '+' });
                    foreach (string s in keys)
                    {
                        if (s == null || s == string.Empty)
                        {
                            continue;
                        }
                        ret[s].IsPrimaryKey = true;
                    }
                }
                else
                {
                    ret[fieldID].IsPrimaryKey = true;
                }
            }

            DB.Reader.Dispose();

            return(ret);
        }
Esempio n. 21
0
        /// <summary>
        /// 判断程序版本是否为最新版本
        /// </summary>
        /// <returns>新版本返回1 旧版本返回-1</returns>
        public static int JudgeVersionNumber()
        {
            Neusoft.FrameWork.Xml.XML xmlManager = new Neusoft.FrameWork.Xml.XML();
            System.Xml.XmlDocument    doc        = new System.Xml.XmlDocument();
            System.Xml.XmlNode        root;

            #region 获取本地配置文件内HIS系统版本

            string hosVersionNumber = "";
            //string hosFilePath = Application.StartupPath + "\\HIS.config";
            //if (System.IO.File.Exists(hosFilePath))			//存在配置文件
            //{
            //doc.Load(hosFilePath);
            //root = doc.SelectSingleNode("//VersionNumber");
            hosVersionNumber = System.Configuration.ConfigurationManager.AppSettings["VersionNumber"];

            if (string.IsNullOrEmpty(hosVersionNumber))
            {
                MessageBox.Show("读取本地XML配置文件时 未找到版本号结点");
                return(-1);
            }
            //hosVersionNumber = obj.ToString(); //root.Attributes[0].Value.ToString();
            //}
            //else
            //{
            //    #region 自动建立

            //    System.Xml.XmlDocument newDoc = new System.Xml.XmlDocument();
            //    System.Xml.XmlDeclaration declarationNode = newDoc.CreateXmlDeclaration("1.0", "GB2312", null);
            //    newDoc.AppendChild(declarationNode);

            //    System.Xml.XmlElement configNode = newDoc.CreateElement("Config");
            //    configNode.SetAttribute("Version", "4.5");
            //    newDoc.AppendChild(configNode);

            //    System.Xml.XmlElement versionNumNode = newDoc.CreateElement("VersionNumber");
            //    versionNumNode.SetAttribute("Number", "20070101");
            //    configNode.AppendChild(versionNumNode);

            //    newDoc.Save(Application.StartupPath + "\\HIS.config");

            //    #endregion

            //    return 1;
            //}
            Function.VersionNumber = hosVersionNumber;
            #endregion

            //读取控制参数 如果未找到对应控制参数或参数为0 不进行版本校验
            Neusoft.HISFC.BizLogic.Manager.Controler controlerManagment = new Neusoft.HISFC.BizLogic.Manager.Controler();
            string control = controlerManagment.QueryControlerInfo(Neusoft.HISFC.BizProcess.Integrate.SysConst.Use_Judge_VersionNum);
            if (control == null || control == "0" || control == "-1")
            {
                return(1);
            }

            #region 获取服务器版本号

            string serverVersionNumber = "";
            Neusoft.FrameWork.Management.DataBaseManger dataBase = new Neusoft.FrameWork.Management.DataBaseManger();
            dataBase.ExecQuery(Function.versionSelect);
            try
            {
                if (dataBase.Reader.Read())
                {
                    serverVersionNumber = dataBase.Reader[0].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                dataBase.Reader.Close();
            }
            #endregion

            if (hosVersionNumber != serverVersionNumber)
            {
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("您当前所用的信息管理系统非最新版本 请重启系统进行升级或与信息科联系"));
                return(-1);
            }

            return(1);
        }
Esempio n. 22
0
        /// <summary>
        ///
        /// </summary>
        private void QueryMessages()
        {
            string strTempSql = "";

            Neusoft.FrameWork.Management.DataBaseManger dbMgr = new Neusoft.FrameWork.Management.DataBaseManger();
            if (this.radioButton1.Checked)
            {
                if (this.dateTimePicker1.Value > this.dateTimePicker2.Value)
                {
                    MessageBox.Show("起始时间不能大于结束时间!");
                    return;
                }

                if (this.comboBox1.Text == "")
                {
                    strTempSql = "select oper_datetime,oper_name,text,recive_person_name,recive_person_deptname,state,patientno,patinetname,patienteprname,eprid from emr_message m where m.oper_datetime  between to_date(' " + this.dateTimePicker1.Text + " ','yyyy-mm-dd hh24:mi:ss')" +
                                 " and to_date('" + this.dateTimePicker2.Text + "','yyyy-mm-dd hh24:mi:ss')";
                }
                else
                {
                    strTempSql = "select oper_datetime,oper_name,text,recive_person_name,recive_person_deptname,state,patientno,patinetname,patienteprname,eprid from emr_message m where m.oper_datetime  between to_date(' " + this.dateTimePicker1.Text + " ','yyyy-mm-dd hh24:mi:ss')" +
                                 " and to_date('" + this.dateTimePicker2.Text + "','yyyy-mm-dd hh24:mi:ss') and m.recive_person_deptname='" + this.comboBox1.Text + "'";
                }
            }
            else
            {
                strTempSql = "select oper_datetime,oper_name,text,recive_person_name,recive_person_deptname,state,patientno,patinetname,patienteprname,eprid from emr_message m where m.oper_code ='" + Neusoft.FrameWork.Management.Connection.Operator.ID + "'";
            }

            DataSet ds = new DataSet();

            dbMgr.ExecQuery(strTempSql, ref ds);

            this.fpSpread1_Sheet1.RowCount = 0;
            int rowIndex = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                this.fpSpread1_Sheet1.Rows.Add(rowIndex, 1);
                if (dr[9].ToString() == "0")
                {
                    this.fpSpread1_Sheet1.Rows[rowIndex].BackColor = Color.Pink;
                }

                this.fpSpread1_Sheet1.Cells[rowIndex, 0].Text = dr[0].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 1].Text = dr[1].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 2].Text = dr[2].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 3].Text = dr[3].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 4].Text = dr[4].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 5].Text = dr[5].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 6].Text = dr[6].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 7].Text = dr[7].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 8].Text = dr[8].ToString();
                this.fpSpread1_Sheet1.Cells[rowIndex, 9].Text = dr[9].ToString();
                //this.fpSpread1_Sheet1.Cells[rowIndex,10].Text=dr[10].ToString();
                //this.fpSpread1_Sheet1.Cells[rowIndex,11].Text=dr[11].ToString();
                //this.fpSpread1_Sheet1.Cells[rowIndex,12].Text=dr[12].ToString();
                //this.fpSpread1_Sheet1.Cells[rowIndex,13].Text=dr[13].ToString();
                //this.fpSpread1_Sheet1.Cells[rowIndex,14].Text=dr[14].ToString();
                //this.fpSpread1_Sheet1.Cells[rowIndex,15].Text=dr[15].ToString();
                //this.fpSpread1_Sheet1.Cells[rowIndex,16].Text=dr[16].ToString();

                rowIndex++;
            }
        }