Exemple #1
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            //SysValueManag
            if (data.Sql == null)
            {
                throw new Exception("Sql内容为空!");
            }
            else if (data.Sql.Equals("Del"))
            {
                int count = DaoTool.ExecuteScalar(dao, OptContent.get("InOutIsSy"), data).ToInt();
                if (count > 0)
                {
                    // throw new Exception("此入出类型已经被系统使用,不能删除!");
                    msg = "此入出类型已经被系统使用,不能删除!";
                    return("ok");
                }

                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelInOutInfo"), data) < 0)
                {
                    throw new Exception("删除此入出类型失败!");
                }
                msg = "此入出类型已删除!";
                return("ok");
            }
            else if (data.Sql.Equals("Add"))
            {
                Opt op = OptContent.get("SaveInOutInfo");
                data.Param["IOID"]    = DaoTool.Seq(dao, "LKWZ.SEQWZIO");;
                data.Param["RECDATE"] = DateTime.Now;
                if (data.Param["IFDEFAULT"] != null && data.Param["IFDEFAULT"].ToString() == "1")
                {
                    dao.ExecuteNonQuery("update LKWZ.DICTWZINOUT set IFDEFAULT=0 where CHOSCODE='" + data.Param["CHOSCODE"].ToString() + "' and IOFALG=" + data.Param["IOFLAG"].ToString() + " and OPFLAG=" + data.Param["OPFLAG"].ToString());
                }
                if (DaoTool.Save(dao, op, data) > -1)
                {
                    msg = "统计类别添加成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("统计类别添加失败!" + dao.ErrMsg);
                }
            }
            else if (data.Sql.Equals("Update"))
            {
                Opt op = OptContent.get("SaveInOutInfo");
                data.Param["RECDATE"] = DateTime.Now;
                if (data.Param["IFDEFAULT"] != null && data.Param["IFDEFAULT"].ToString() == "1")
                {
                    dao.ExecuteNonQuery("update LKWZ.DICTWZINOUT set IFDEFAULT=0 where CHOSCODE='" + data.Param["CHOSCODE"].ToString() + "'");
                }
                if (DaoTool.Update(dao, op, data) > -1)
                {
                    msg = "统计类别更新成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("统计类别更新失败!" + dao.ErrMsg);
                }
            }
            else if (data.Sql.Equals("TingYong"))
            {
                Opt op = OptContent.get("SetInOutUnUsed");
                if (DaoTool.ExecuteNonQuery(dao, op, data) != 1)
                {
                    throw new Exception("停用失败!" + dao.ErrMsg);
                }

                msg = "此入出类型停用成功!";
                return("ok");
            }
            else if (data.Sql.Equals("QiYong"))
            {
                Opt op = OptContent.get("SetInOutUsed");
                if (DaoTool.ExecuteNonQuery(dao, op, data) != 1)
                {
                    throw new Exception("启用失败!" + dao.ErrMsg);
                }

                msg = "此入出类型启用成功!";
                return("ok");
            }
            else if (data.Sql.Equals("Copy"))
            {
                int count = DaoTool.ExecuteScalar(dao, OptContent.get("CheckInOutIsNull"), data).ToInt();
                if (count == 0)
                {
                    DataTable dt = DaoTool.FindDT(dao, OptContent.get("FindInOutCcode0"), data);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow r in dt.Rows)
                        {
                            data.Param["IOID"]         = DaoTool.Seq(dao, "LKWZ.SEQWZIO");
                            data.Param["IONAME"]       = r["IONAME"];
                            data.Param["PYCODE"]       = r["PYCODE"];
                            data.Param["WBCODE"]       = r["WBCODE"];
                            data.Param["IFUSE"]        = r["IFUSE"];
                            data.Param["RECIPECODE"]   = r["RECIPECODE"];
                            data.Param["RECIPELENGTH"] = r["RECIPELENGTH"];
                            data.Param["RECIPEYEAR"]   = r["RECIPEYEAR"];
                            data.Param["RECIPEMONTH"]  = r["RECIPEMONTH"];
                            data.Param["MEMO"]         = r["MEMO"];
                            data.Param["IOFLAG"]       = r["IOFLAG"];
                            data.Param["USEST"]        = r["USEST"];
                            data.Param["USEND"]        = r["USEND"];
                            data.Param["USERD"]        = r["USERD"];
                            data.Param["OPFLAG"]       = r["OPFLAG"];
                            data.Param["IFDEFAULT"]    = r["IFDEFAULT"];
                            data.Param["RECDATE"]      = DateTime.Now;
                            if (DaoTool.Save(dao, OptContent.get("SaveInOutInfo"), data) != 1)
                            {
                                throw new Exception("复制失败,!" + dao.ErrMsg);
                            }
                        }
                    }

                    msg = "复制成功!";
                    return("ok");
                }
                else
                {
                    msg = "已存在本医疗结构的出入类型,复制失败!";
                    return("ok");
                }
            }
            else if (data.Sql.Equals("Find"))
            {
                msg = "查找成功!";
                return("ok");
            }
            msg = "成功!";
            return("ok");
        }
Exemple #2
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            if (data.Sql != null && data.Sql.Equals("Del"))
            {
                int ifuse = DaoTool.ExecuteScalar(dao, OptContent.get("EQUnitIsUse2"), data).ToInt();
                if (ifuse > 0)
                {
                    //throw new Exception("物资单位已经被系统使用,不能删除!");
                    msg = "设备单位已经被系统使用,不能删除!";
                    return("ok");
                }
                int rw = DaoTool.ExecuteNonQuery(dao, OptContent.get("DelEQUnitInfo"), data);

                if (rw < 0)
                {
                    throw new Exception("删除设备单位信息失败!");
                }
                msg = "设备单位已删除!";
                return("ok");
            }
            if (data.Sql != null && data.Sql.Equals("Save"))
            {
                Opt op = OptContent.get("SaveEQUnitInfo");
                if (data.Param.ContainsValue(op.Key))
                {
                    int repeat = DaoTool.ExecuteScalar(dao, OptContent.get("ModifyEQUnitIsRepeat"), data).ToInt();
                    if (repeat > 0)
                    {
                        //throw new Exception("已经存在该物资价格体系信息,不能修改成该名称!" + dao.ErrMsg);
                        msg = "已经存在该设备项目信息,不能修改成该名称!";
                        return("ok");
                    }


                    int tr = DaoTool.ExecuteScalar(dao, OptContent.get("DefaultEQUnit"), data).ToInt();

                    if ((data.Param["DEFVALUE"].ToString() == "1") && tr > 0)
                    {
                        data.Params = new object[] { data.Param["DICGRPID"], data.Param["DICID"] };
                        dao.ExecuteNonQuery(OptContent.get("SetDefaultEQUnit").Sql, data.Params);
                    }

                    if (DaoTool.Update(dao, op, data) > -1)
                    {
                        msg = "保存设备单位信息成功!";
                        return("ok");
                    }
                    else
                    {
                        throw new Exception("保存设备单位信息失败!" + dao.ErrMsg);
                    }
                }
                else
                {
                    int repeat = DaoTool.ExecuteScalar(dao, OptContent.get("AddEQUnitIsRepeat"), data).ToInt();
                    if (repeat > 0)
                    {
                        //throw new Exception("已经存在该物资价格体系信息!" + dao.ErrMsg);
                        msg = "已经存在该设备项目信息!";
                        return("ok");
                    }
                    int dicid_int = DaoTool.ExecuteScalar(dao, OptContent.get("SaveEQUnitInfo_seq"), data).ToInt() + 1;

                    //if (dicid_int >= 0 && dicid_int < 10)
                    //{
                    //    data.Param["DICID"] = "0" + dicid_int.ToString();
                    //}
                    //else
                    //{
                    //    data.Param["DICID"] = dicid_int.ToString();
                    //}
                    //int tr = DaoTool.ExecuteScalar(dao, OptContent.get("DefaultWZUnit"), data).ToInt();
                    data.Param["DICID"] = dicid_int.ToString();
                    if ((data.Param["DEFVALUE"].ToString() == "1") && DaoTool.ExecuteScalar(dao, OptContent.get("DefaultEQUnit"), data).ToInt() > 0)
                    {
                        data.Params = new object[] { data.Param["DICGRPID"], data.Param["DICID"] };
                        dao.ExecuteNonQuery(OptContent.get("SetDefaultEQUnit").Sql, data.Params);
                    }

                    if (DaoTool.Save(dao, op, data) > -1)
                    {
                        msg = "添加成功!";
                        return("ok");
                    }
                    else
                    {
                        throw new Exception("添加设备单位信息失败!" + dao.ErrMsg);
                    }
                }
            }
            else
            {
                throw new Exception("保存设备单位信息失败!" + dao.ErrMsg);
            }
        }
Exemple #3
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");
        }
Exemple #4
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");
        }
Exemple #5
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            string ac = data.Sql;

            msg = "";
            if ("setRole".Equals(ac))
            {
                string dataRole = data.Param["roles"].ToString();
                string userid   = data.Param["userid"].ToString();
                if (userid == null || userid.Trim().Length == 0)
                {
                    throw new Exception("无效用户ID!");
                }
                int i = 0;
                if (data.Param["have"].ToString().Equals("1"))
                {
                    i = dao.ExecuteNonQuery("DELETE FROM T_HIS_RELUSERRIGHT WHERE userid=" + userid);
                }
                if (i >= 0)
                {
                    if (dataRole != null && dataRole.Length > 0)
                    {
                        string[] rs = dataRole.Split(',');
                        foreach (string r in rs)
                        {
                            if (dao.ExecuteNonQuery("INSERT INTO T_HIS_RELUSERRIGHT (userid,roleid) VALUES (" + userid + "," + r + ")") == -1)
                            {
                                throw new Exception("保存用户角色信息失败!");
                            }
                        }
                    }
                    msg = "成功保存用户角色!";
                }
                else
                {
                    throw new Exception("删除原用户角色信息失败!");
                }
            }
            else if ("setOpKF".Equals(ac))
            {
                string dataKF   = data.Param["kfID"].ToString();
                string userid   = data.Param["userid"].ToString();
                string choscode = data.Param["choscode"].ToString();
                if (userid == null || userid.Trim().Length == 0)
                {
                    throw new Exception("无效用户ID!");
                }
                int i = 0;
                if (data.Param["have"].ToString().Equals("1"))
                {
                    i = dao.ExecuteNonQuery("DELETE FROM 可操作库房 WHERE userid=" + userid + " and choscode='" + choscode + "'");
                }

                if (i >= 0)
                {
                    if (dataKF != null && dataKF.Length > 0)
                    {
                        string[] rs = dataKF.Split(',');
                        foreach (string r in rs)
                        {
                            if (dao.ExecuteNonQuery("INSERT INTO 可操作库房 (userid,kfid,choscode) VALUES (" + userid + "," + r + ",'" + choscode + "')") == -1)
                            {
                                throw new Exception("保存可操作库房信息失败!");
                            }
                        }
                    }
                    msg = "成功保存可操作库房!";
                }
                else
                {
                    throw new Exception("删除原可操作库房信息失败!");
                }
            }
            return("ok");
        }
Exemple #6
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            msg = "系统参数更改";
            if (data.Sql == null)
            {
                throw new Exception("Sql内容为空!");
            }
            else if (data.Sql.Equals("Add"))
            {
                //if (dao.ExecuteNonQuery(OptContent.get("InsertSysValue").Sql, data.Params) == 5)
                String[] s   = OptContent.get("EQInsertSysValue").Sql.Split('?');
                String   sql = "";
                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (data.Params[i].GetType().ToString().ToUpper() == "SYSTEM.INT32")
                    {
                        sql += s[i] + data.Params[i].ToString();
                    }
                    else
                    {
                        sql += s[i] + "'" + data.Params[i].ToString() + "'";
                    }
                }
                sql += s[s.Length - 1];
                s    = sql.Split(';');
                for (int i = 0; i < s.Length; i++)
                {
                    if (dao.ExecuteNonQuery(s[i]) != 1)
                    {
                        throw new Exception("修改失败,在系统参数表中插入失败!" + dao.ErrMsg);
                    }
                }
                msg = "修改成功!";
                return("ok");
            }
            else if (data.Sql.Equals("Update"))
            {
                String[] s   = OptContent.get("EQUpdateSysValue").Sql.Split('?');
                String   sql = "";
                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (data.Params[i].GetType().ToString().ToUpper() == "SYSTEM.INT32")
                    {
                        sql += s[i] + data.Params[i].ToString();
                    }
                    else
                    {
                        sql += s[i] + "'" + data.Params[i].ToString() + "'";
                    }
                }
                sql += s[s.Length - 1];
                s    = sql.Split(';');
                for (int i = 0; i < s.Length; i++)
                {
                    if (dao.ExecuteNonQuery(s[i]) != 1)
                    {
                        throw new Exception("修改失败,在系统参数表中修改失败!" + dao.ErrMsg);
                    }
                }
                msg = "修改成功!";
            }
            else if (data.Sql.Equals("Find"))
            {
                //FindSysValue
                msg = "查找成功!";
                return("ok");
            }

            return("ok");
        }
Exemple #7
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            string A = data.Sql;

            if ("Del".Equals(A))
            {
                object p = dao.ExecuteScalar("select count(*) num from 票据领用表 where 领用序号 = " +
                                             data.Param["serialno"].ToString() + " and 领用张数>剩余张数");
                if (p != null && int.Parse(p.ToString()) > 0)
                {
                    throw new Exception("当前领用的票据已经被使用,不能再删除!");
                }

                if (dao.ExecuteNonQuery("delete 票据领用表 where 领用序号=" + data.Param["serialno"].ToString()) < 0)
                {
                    throw new Exception("领用票据删除失败!");
                }
            }
            else if ("PDinvoice".Equals(A))
            {
                object p = dao.ExecuteScalar("select 领用序号 from 票据领用表 where choscode ='" +
                                             data.Param["choscode"].ToString() + "' and 剩余张数>=1 and 票据类型=" +
                                             data.Param["kind"].ToString() + " and length(开始票号)=" + data.Param["fpcode"].ToString().Length +
                                             " and '" + data.Param["fpcode"].ToString() + "' between 开始票号 and 结束票号 and " +
                                             "((使用模式=1) or (使用模式=0 and 领用人员=" + data.Param["userid"].ToString() + "))");
                if (p == null || p.ToString().Equals(""))
                {
                    throw new Exception(data.Param["fpcode"].ToString() + "票据号未领用过,不能被使用!");
                }

                object x = dao.ExecuteScalar("select count(*) cn from 票据使用表 where choscode ='" +
                                             data.Param["choscode"].ToString() + "' and 票据类型=" +
                                             data.Param["kind"].ToString() + " and 票号='" + data.Param["fpcode"].ToString() + "'");
                if (x != null && int.Parse(x.ToString()) > 0)
                {
                    throw new Exception(data.Param["fpcode"].ToString() + "票据号已经被使用过,不能重复使用!");
                }

                msg = "ok";
                return(p.ToString());
            }
            else if ("SaveNewFP".Equals(A))
            {
                if (data.Param["kind"].ToString().Equals("1")) //门诊
                {
                    if (dao.ExecuteNonQuery("update 门诊处方表 set 发票号=? where choscode=? and 处方号=?"
                                            , new object[] { data.Param["newfp"], data.Param["choscode"], data.Param["code"] }) < 0)
                    {
                        throw new Exception("改写门诊处方发票号错误!");
                    }
                }
                else if (data.Param["kind"].ToString().Equals("2"))//住院
                {
                    if (dao.ExecuteNonQuery("update 住院登记表 set 发票号=? where choscode=? and 住院号=?"
                                            , new object[] { data.Param["newfp"], data.Param["choscode"], data.Param["code"] }) < 0)
                    {
                        throw new Exception("改写住院发票号错误!");
                    }
                }
                else //预交款票据
                {
                    if (dao.ExecuteNonQuery("update 押金表 set 发票号=? where choscode=? and 住院号=? and 发票号=?"
                                            , new object[] { data.Param["newfp"], data.Param["choscode"], data.Param["code"],
                                                             data.Param["oldfp"].ToString() }) < 0)
                    {
                        throw new Exception("改写预交款票号错误!");
                    }
                }

                if (dao.ExecuteNonQuery("insert into 票据使用表(领用序号,票据类型,票号,操作员,choscode,code) values(" +
                                        data.Param["sno"].ToString() + "," + data.Param["kind"].ToString() + ",'" +
                                        data.Param["newfp"].ToString() + "'," + data.Param["userid"].ToString() + ",'" +
                                        data.Param["choscode"].ToString() + "','" + data.Param["code"].ToString() + "')") < 0)
                {
                    throw new Exception("补打发票时票据使用表写入错误!");
                }

                if (dao.ExecuteNonQuery("update 票据使用表 set 票据状态=1 where 领用序号=" +
                                        data.Param["sno"].ToString() + " and choscode='" + data.Param["choscode"].ToString() +
                                        "' and 票号='" + data.Param["oldfp"].ToString() + "'") < 0)
                {
                    throw new Exception("补打发票时更改票据使用表状态错误!");
                }

                if (dao.ExecuteNonQuery("insert into 作废票据表(票号,票据类型,更换新票号,操作员,choscode) values('" +
                                        data.Param["oldfp"].ToString() + "'," + data.Param["kind"].ToString() + ",'" +
                                        data.Param["newfp"].ToString() + "'," + data.Param["userid"].ToString() + ",'" +
                                        data.Param["choscode"].ToString() + "')") < 0)
                {
                    throw new Exception("作废票据写入错误!");
                }
            }

            msg = "ok";
            return("ok");
        }