示例#1
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            string    ccode = data.Param["cHosCode"].ToString();
            DataTable dt    = new DataTable();

            dt.Columns.Add(new DataColumn("名称"));
            dt.Columns.Add(new DataColumn("值"));

            /*string supcode = "" ;
             * if (ccode.Trim().Length > 7)
             * {
             *  supcode = ccode.Substring(0, ccode.Length - 2);
             * }
             * else {
             *  supcode = ccode;
             * }
             * //获取农合前缀
             * DataRow  r =  dt.NewRow();
             * object qz = dao.ExecuteScalar("select nhperfix from SYSDICTHOSPITAL where cHosCode=?", new object[] { supcode });
             * if (qz == null)
             * {
             *  r["名称"] = "NHPREFIX";
             *  r["值"] = "";
             * }
             * else {
             *  r["名称"] = "NHPREFIX";
             *  r["值"] = qz.ToString();
             * }
             * dt.Rows.Add(r);
             *
             * object NHHOSCODE = dao.ExecuteScalar("select nhhospcode from SYSDICTHOSPITAL where cHosCode=?", new object[] { ccode });
             * DataRow rd = dt.NewRow();
             * if (NHHOSCODE == null)
             * {
             *  rd["名称"] = "NHHOSCODE";
             *  rd["值"] = "";
             * }
             * else
             * {
             *  rd["名称"] = "NHHOSCODE";
             *  rd["值"] = NHHOSCODE.ToString();
             * }
             * dt.Rows.Add(rd);
             *
             * object areacode = dao.ExecuteScalar("select areacode from SYSDICTHOSPITAL where cHosCode=?", new object[] { ccode });
             * DataRow rd1 = dt.NewRow();
             * if (areacode == null)
             * {
             *  rd1["名称"] = "AREACODE";
             *  rd1["值"] = "";
             * }
             * else
             * {
             *  rd1["名称"] = "AREACODE";
             *  rd1["值"] = areacode.ToString();
             * }
             * dt.Rows.Add(rd1);   */

            msg = "OK";

            DataTable hisYBParam = dao.find("select t.* from 医保设置表 t where t.choscode=?", new object[] { ccode });

            string    sql     = OptContent.get("Get_SuperCode").Sql;
            DataTable sup     = dao.find(sql, new object[] { ccode });
            string    wsjcode = sup.Rows[0][0].ToString();

            DataTable hisPa = dao.find("select ID,sysvalue from 系统参数 t where (choscode is null or choscode=? or choscode=?) and not exists" +
                                       "(select * from 系统参数 where (choscode=? or choscode=?) and t.id=id and length(nvl(t.choscode,' '))<length(choscode) )",
                                       new object[] { ccode, wsjcode, ccode, wsjcode });   //优先取医院设置的系统参数,再到卫生局设置的系统参数,再取全省系统参数

            DataRow rdwsj      = dt.NewRow();
            DataRow usnode     = dt.NewRow();
            DataRow rdnhperfix = dt.NewRow();

            rdwsj["名称"]      = "WSJCODE";
            usnode["名称"]     = "USEZBY";
            rdnhperfix["名称"] = "NHPERFIX";
            if (sup != null)
            {
                rdwsj["值"]      = sup.Rows[0][0].ToString();
                rdnhperfix["值"] = sup.Rows[0][2].ToString();
                if (sup.Rows[0][1] != null && sup.Rows[0][1].ToString().Length > 0)
                {
                    usnode["值"] = sup.Rows[0][1].ToString();
                }
                else
                {
                    usnode["值"] = "0";
                }
            }
            else
            {
                rdwsj["值"]      = "";
                usnode["值"]     = "0";
                rdnhperfix["值"] = "";
            }
            dt.Rows.Add(rdwsj);
            dt.Rows.Add(usnode);
            dt.Rows.Add(rdnhperfix);
            return(new object[] { dt, hisPa, sup, hisYBParam });
        }
示例#2
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            string ac = data.Sql;

            msg = "";
            if ("EditPwd".Equals(ac))
            {
                DataTable dt = dao.find("select a.userpassword from 用户表 a where   a.userid=? and a.choscode=? "
                                        , new object[] { data.Param["UserId"], data.Param["cHosCode"] }
                                        );
                if (dt == null || dt.Rows.Count == 0)
                {
                    throw new Exception("用户无效!");
                }
                string pd = "";
                if (dt.Rows[0][0] != null)
                {
                    pd = dt.Rows[0][0].ToString();
                }

                if (!data.Param["oldPwd"].ToString().Equals(pd))
                {
                    throw new Exception("原密码错误!");
                }
                if (data.Param.ContainsKey("sjh"))
                {
                    object obj1 = dao.ExecuteScalar("select count(*) from 用户表 a where a.mobilephone=?"
                                                    , new object[] { data.Param["sjh"] }
                                                    );
                    if (int.Parse(obj1.ToString()) > 0)
                    {
                        throw new Exception("您输入的手机号已被其他用户绑定,请重新输入!");
                    }
                    int i = dao.ExecuteNonQuery("update  用户表 set mobilephone=? where  userid=? and choscode=?"
                                                , new object[] { data.Param["sjh"], data.Param["UserId"], data.Param["cHosCode"] }
                                                );
                    if (i < 0)
                    {
                        throw new Exception("帮定手机号失败!");
                    }
                }
                int b = dao.ExecuteNonQuery("update  用户表 set userpassword=? where  userid=? and choscode=?"
                                            , new object[] { data.Param["Pwd"], data.Param["UserId"], data.Param["cHosCode"] }
                                            );
                if (b < 0)
                {
                    throw new Exception("修改用户密码失败!");
                }
                msg = "修改密码成功!";
            }
            else if ("RegCardSet".Equals(ac))
            {
                if (!data.Param.ContainsKey("密码"))
                {
                    throw new Exception("输入的密码无效请重新输入!");
                }
                string pwd = data.Param["密码"].ToString();
                object p   = dao.ExecuteScalar("select passwd from 密码 where id=4");
                if (p != null)
                {
                    if (!p.ToString().Equals(pwd))
                    {
                        throw new Exception("输入的密码无效请重新输入!");
                    }
                }
                else
                {
                    throw new Exception("输入的密码无效请重新输入!");
                }

                DataTable dt = dao.find("select 1 from 就诊卡范围表 where (开始号 between ? and ? or 结束号 between ? and ?) and length(开始号)=?"
                                        , new object[] { data.Param["开始号"], data.Param["结束号"], data.Param["开始号"], data.Param["结束号"], data.Param["长度"] }
                                        );
                if (dt != null && dt.Rows.Count > 0)
                {
                    throw new Exception("输入的就诊卡号已被领用过,请重新录入号码");
                }

                Opt op = OptContent.get("sys_SaveRegCard");
                if (DaoTool.Save(dao, op, data) > -1)
                {
                    msg = "保存就诊卡数据成功!";
                }
                else
                {
                    throw new Exception("就诊卡领用失败");
                }
            }
            else if ("SaveOpLog".Equals(ac))
            {
                if (dao.ExecuteNonQuery("insert into 特殊操作日志(choscode,chosname,操作功能,操作员,操作机器,辅助说明) values('" +
                                        data.Param["choscode"].ToString() + "','" + data.Param["chosname"].ToString() + "'," +
                                        data.Param["funID"].ToString() + ",'" + data.Param["username"].ToString() + "','" +
                                        data.Param["hostinfo"].ToString() + "','" + data.Param["说明"].ToString() + "')") < 0)
                {
                    throw new Exception("保存操作日志错误." + dao.ErrMsg);
                }
                else
                {
                    msg = "ok";
                }
            }


            return("ok");
        }
示例#3
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            msg = "ok";
            string A        = data.Sql;
            string choscode = data.Param["cHosCode"].ToString();

            if ("Find".Equals(A))
            {
                object[] objs = new object[1];
                objs[0] = dao.find("select ID,sysvalue,choscode,sysexplain from 系统参数 t where (choscode is null or choscode=?) and not exists" +
                                   "(select * from 系统参数 where choscode=? and t.id=id and t.choscode is null)",
                                   new object[] { choscode, choscode });
                return(objs);
            }
            else if ("Save".Equals(A))
            {
                if (data.Param.ContainsKey("密码"))
                {
                    string pwd = data.Param["密码"].ToString();
                    object p   = dao.ExecuteScalar("select passwd from 密码 where id=3");
                    if (p != null)
                    {
                        if (!p.ToString().Equals(pwd))
                        {
                            throw new Exception("输入的密码无效请重新输入!");
                        }
                    }
                    else
                    {
                        throw new Exception("输入的密码无效请重新输入!");
                    }
                }

                string sql = "", edsql = "", insql = "";
                int    num = int.Parse(data.Param["num"].ToString());
                for (int i = 1; i <= num; i++)
                {
                    if (data.Param.ContainsKey("ID" + i.ToString()))
                    {
                        if (data.Param.ContainsKey("note" + i.ToString()))
                        {
                            insql = "'" + data.Param["note" + i.ToString()].ToString() + "'";
                            edsql = ",sysexplain=" + insql;
                        }
                        else
                        {
                            edsql = "";
                            insql = "''";
                        }

                        if (!data.Param.ContainsKey("TYPE" + i.ToString()))
                        {
                            if (!choscode.Equals(""))
                            {
                                sql = "UPDATE 系统参数 SET sysvalue='" + data.Param["ID" + i.ToString()].ToString() + "'" + edsql + " WHERE ID=" + i.ToString() + " and choscode='" + choscode + "'";
                            }
                            else
                            {
                                sql = "UPDATE 系统参数 SET sysvalue='" + data.Param["ID" + i.ToString()].ToString() + "' WHERE ID=" + i.ToString() + " and choscode is null ";
                            }
                        }
                        else
                        {
                            sql = "insert into 系统参数 values(" + i.ToString() + ",'" + data.Param["TYPE" + i.ToString()].ToString() + "','" +
                                  data.Param["ID" + i.ToString()].ToString() + "'," + insql + ",'" + choscode + "')";
                        }

                        if (dao.ExecuteNonQuery(sql, new object[] {}) < 0)
                        {
                            throw new Exception("更新系统参数失败!");
                        }
                    }
                }
            }
            return("ok");
        }