Exemplo n.º 1
0
        public bool ExistReference(StrObjectDict sod)
        {
            var id     = sod.GetString("ID");
            var nCount = DB.Count <NursingPlanDetails>(new { QuestionID = id });

            return(nCount > 0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据删除人员信息
        /// </summary>
        /// <returns></returns>
        public override ActionResult Delete()
        {
            StrObjectDict dict = GetParams();
            string        id   = dict.GetString("ID");

            #region 入参正确性校验


            if (string.IsNullOrEmpty(id))
            {
                return(this.MyJson(0, "参数为空:ID"));
            }
            #endregion

            int isOk = UserManager.Instance.Delete <PubUser>(id);

            if (isOk > 0)
            {
                return(this.MyJson(1, "保存成功"));
            }
            else
            {
                return(this.MyJson(0, "操作失败"));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取完整的主菜单和菜单操作
        /// </summary>
        /// <returns>树形结构</returns>
        public ActionResult ListMenu()
        {
            StrObjectDict reqParam   = GetParams();
            string        moduleCode = reqParam.GetString("ModuleCode");

            IList <StrObjectDict> result = crudManager.List2 <Role>(new { ModuleCode = moduleCode }.toStrObjDict(), null);

            Tree tree = new Tree();

            tree.datasList = result;
            tree.TransformTree("SuperID");

            result = tree.data;
            //获取完整菜单
            //Tree tree = TreeManager.Instance.GetTree("2ad0e672-aba8-432e-83d4-7a30a999", "SuperID", new { ModuleCode = moduleCode }.toStrObjDict());
            ////获取所有菜单操作
            //IList<MenuOption> menuOptions = crudManager.List2<MenuOption>(new StrObjectDict());

            //foreach (var levelOne in tree.data)
            //{
            //    if (levelOne.ContainsKey("Children"))
            //    {
            //        List<StrObjectDict> levelTwos = (List<StrObjectDict>)levelOne.GetObject("Children");
            //        foreach (var levelTwo in levelTwos)
            //        {
            //            levelTwo.Add("MenuOptions",
            //                from el in menuOptions
            //                where el.MenuID.ToString() == levelTwo.GetString("ID")
            //                select el);
            //        }
            //    }
            //}

            return(this.MyJson(1, tree.data));
        }
Exemplo n.º 4
0
        public IList <StrObjectDict> DoService(StrObjectDict obj)
        {
            IList <object> list = new List <object>();

            list.Add(new
            {
                ID          = 13,
                ExtendValue = "13被修改了"
            });

            list.Add(new
            {
                ID          = 14,
                ExtendValue = "新增了14"
            });
            list.Add(new
            {
                ID          = 11,
                ExtendValue = "11被修改了"
            });

            DB.Execute(new DBState
            {
                Name  = "BatchExtendExecuteNoneQuery2",
                Param = list,
                Type  = ESqlType.UPDATE
            });


            return(null);
        }
Exemplo n.º 5
0
        public ActionResult Save()
        {
            StrObjectDict sod  = GetParams();
            int           isOk = 0;

            if (sod.GetInt("Type") == 4 && sod.GetInt("IsLocalStorage") == 1 && sod.GetInt("IsRef") == 1)
            {
                if (!sod.ContainsKey("Reference") || sod["Reference"] == null)
                {
                    return(this.MyJson(0, "该方式必须输入列对照"));
                }
                //使用数据源服务方式,需要保存列对照
                isOk = DataServiceManager.Instance.SaveThirdServiceSqlType(sod);
            }
            else
            {
                sod["IsLocalStorage"] = 0;
                sod["IsRef"]          = 0;
                sod["RefObject"]      = null;
                isOk = DataServiceManager.Instance.InsertOrUpdate <DataService>(sod);
            }

            if (isOk > 0)
            {
                return(this.MyJson(1, "保存成功"));
            }

            return(this.MyJson(0, "操作失败"));
        }
Exemplo n.º 6
0
        public bool SaveBacklogDetails(StrObjectDict sod)
        {
            var backlogIds = sod.GetObject("BacklogIds") as object[];

            if (backlogIds == null)
            {
                return(false);
            }

            var batchStates = backlogIds.Select(id =>
            {
                var dic = id as Dictionary <string, object>;
                if (dic == null)
                {
                    return(null);
                }
                return(new DBState()
                {
                    Name = "INSERT_BacklogDetails",
                    Param = new
                    {
                        ID = Utils.getGUID(),
                        FormID = sod.GetString("FormID"),
                        ObjectID = sod.GetString("ObjectID"),
                        BacklogID = dic["eventId"],
                        TargetID = dic["id"],
                        Hander = sod.GetString("Hander")
                    }.toStrObjDict(),
                    Type = ESqlType.INSERT
                });
            }).ToList();

            return(batchStates.Count != 0 && DB.Execute(batchStates) > 0);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 插入或者更新表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dict"></param>
        /// <returns></returns>
        public virtual int InsertOrUpdate <T>(StrObjectDict dict) where T : BaseModel, new()
        {
            DBState state = null;
            T       t     = System.Activator.CreateInstance <T>();

            if (!dict.ContainsKey("ID") || dict["ID"] == null)
            {
                dict["ID"] = Utils.getGUID();
                state      = new DBState
                {
                    Name  = t.MAP_INSERT,
                    Param = dict,
                    Type  = ESqlType.INSERT
                };
            }
            else
            {
                state = new DBState
                {
                    Name  = t.MAP_UPDATE,
                    Param = dict,
                    Type  = ESqlType.UPDATE
                };
            }
            return(DB.Execute(state));
        }
Exemplo n.º 8
0
        public ActionResult GetEvaluateFile()
        {
            StrObjectDict dict = GetParams();

            string patientID    = dict.GetString("PatientID");
            string type         = dict.GetString("Type");
            string departmentID = dict.GetString("DepartmentID");

            if (string.IsNullOrEmpty(patientID))
            {
                return(this.MyJson(0, "参数不能为空:PatientID"));
            }
            if (string.IsNullOrEmpty(type))
            {
                return(this.MyJson(0, "参数不能为空:Type"));
            }
            if (string.IsNullOrEmpty(departmentID))
            {
                return(this.MyJson(0, "参数不能为空:DepartmentID"));
            }

            IList <StrObjectDict> list = NursingAssessmentManager.Instance.GetEvaluateFile(dict);

            return(this.MyJson(1, list));
        }
Exemplo n.º 9
0
        public ActionResult Client_GetForm()
        {
            StrObjectDict dict = GetParams();

            dict["FormID"] = dict["ID"];
            IList <StrObjectDict> result = FormManager.Instance.CheckVerCode(dict);

            try
            {
                if (string.IsNullOrEmpty(result[0]["VersionCode"].ToString()))
                {
                    return(this.MyJson(0, "接口错误:请求最新版本号失败"));
                }
            }
            catch
            {
                return(this.MyJson(0, "接口错误:请求最新版本号失败"));
            }
            string versionCode = result[0]["VersionCode"].ToString();
            string id          = dict.GetString("ID");

            IList <StrObjectDict> dicts = FormManager.Instance.Hns_GetForm(new
            {
                VersionCode = versionCode,
                FormID      = id
            }.toStrObjDict(false));

            dicts.Last().Add("Last", 1);
            return(this.MyJson(1, dicts));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public PageData <StrObjectDict> PagesCommCodeDetail(StrObjectDict obj, Page p)
        {
            object listcount = DB.Scalar("COUNT_CommonCodeDetail", obj);
            IList <StrObjectDict> listData = DB.ListSod("LISTSOD_CommonCodeDetail", obj, p.PageNumber, p.PageSize);

            return(new PageData <StrObjectDict>(listData, p.PageNumber, int.Parse(listcount.ToString())));
        }
Exemplo n.º 11
0
        public static IThirdService CreateSoaService(string id, StrObjectDict obj)
        {
            string type = obj["Type"].ToString();

            //1:ws,2:socket,3:存储过程.4:sql数据源
            if (type == "1")
            {
                return(CreateProxy <SOAWS>(id, obj));
            }
            else if (type == "2")
            {
                return(CreateProxy <SOASocket>(id, obj));
            }
            else if (type == "3")
            {
                return(CreateProxy <SOAProc>(id, obj));
            }
            else if (type == "4")
            {
                return(null);
                //return CreateProxy<SOASql>(id, obj);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 12
0
        public ActionResult DeleteMsg()
        {
            StrObjectDict dict = GetParams();

            #region 检查入参有效性
            string id = dict.GetString("ID");

            if (string.IsNullOrEmpty(id))
            {
                return(this.MyJson(0, "参数错误:ID"));
            }

            #endregion

            //删除

            int isOk = MsgManager.Instance.Delete <MessageLog>(id);
            if (isOk > 0)
            {
                return(this.MyJson(1, "删除成功"));
            }
            else
            {
                return(this.MyJson(0, "操作失败"));
            }
        }
Exemplo n.º 13
0
        public bool TargetDelete(StrObjectDict obj)
        {
            var id = obj.GetString("ID");

            var batchStates = new DBState[]
            {
                new DBState()
                {
                    Name  = new NursingPlanTarget().MAP_DELETE,
                    Param = new{ ID = id },
                    Type  = ESqlType.DELETE
                },
                new DBState()
                {
                    Name  = new NursingPlanDetails().MAP_DELETE,
                    Param = new{ PlanTargetID = id },
                    Type  = ESqlType.DELETE
                },
                new DBState()
                {
                    Name  = new QuestionRelation().MAP_DELETE,
                    Param = new{ FunID = id },
                    Type  = ESqlType.DELETE
                }
            };

            return(DB.ExecuteWithTransaction(batchStates) > 0);
        }
Exemplo n.º 14
0
        public bool ExistsFourElement(StrObjectDict sod)
        {
            var questionIds = sod.GetString("QuestionIds").Split(',');
            var lst         = DB.ListSod("GetElementCount",
                                         new { QuestionIds = questionIds }.toStrObjDict());

            //结果集包含4种元素,结果集长度最小为4
            if (lst == null || lst.Count < 4)
            {
                return(false);
            }

            var grouping = lst.GroupBy(a => a.GetString("ID"));

            //通过ID分组后,如果与入参个数不一致,表示有护理问题下面没有包含元素
            if (questionIds.Length != grouping.Count())
            {
                return(false);
            }

            foreach (var item in grouping)
            {
                var cGrouping = item.GroupBy(a => a.GetString("Code"));
                if (cGrouping.Count() != 4)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 15
0
        public List <StrObjectDict> GetBacklogs(StrObjectDict sod)
        {
            //PatientID
            var lstByDetails = DB.ListSod("GetBacklogsByDetails", sod);

            var marks      = DB.ListSod("GetTriggerResult", sod);
            var backlogIds = new List <string>();

            foreach (var str in marks.Select(mark => mark.GetString("BacklogIds")))
            {
                if (str.Contains(','))
                {
                    var ids = str.Split(',');
                    backlogIds.AddRange(ids);
                }
                else
                {
                    backlogIds.Add(str);
                }
            }

            var lstByMark = DB.ListSod("", sod);

            return(null);
        }
Exemplo n.º 16
0
        public ActionResult SetMobileStyle()
        {
            StrObjectDict dict = GetParams();

            string MobileStyle = dict.GetString("MobileStyle");
            string VersionCode = dict.GetString("VersionCode");
            string Id          = dict.GetString("ID");

            if (string.IsNullOrEmpty(MobileStyle))
            {
                return(this.MyJson(0, "参数不能为空:MobileStyle"));
            }
            if (string.IsNullOrEmpty(VersionCode))
            {
                return(this.MyJson(0, "参数不能为空:VersionCode"));
            }
            if (string.IsNullOrEmpty(Id))
            {
                return(this.MyJson(0, "参数不能为空:ID"));
            }

            int result = FormManager.Instance.SetMobileStyle(dict);

            if (result > 0)
            {
                return(this.MyJson(1, "设置成功"));
            }
            else
            {
                return(this.MyJson(0, "设置失败"));
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 逻辑删除待办事项
        /// </summary>
        /// <param name="sod"></param>
        /// <returns></returns>
        public bool RemoveBacklog(StrObjectDict sod)
        {
            var id = sod.GetString("ID");

            //var batchStates = new DBState[]
            //{
            //    new DBState(){
            //        Name =  "DELETE_Backlog",
            //        Param = new {ID =id},
            //        Type = ESqlType.DELETE
            //    },
            //    new DBState(){
            //        Name =  "DELETE_BacklogDetails",
            //        Param = new {BacklogID =id},
            //        Type = ESqlType.DELETE
            //    }
            //};

            //return DB.ExecuteWithTransaction(batchStates) > 0;

            return(DB.Execute(new DBState
            {
                Name = "UPDATE_Backlog",
                Param = sod,
                Type = ESqlType.UPDATE
            }) > 0);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 列表信息(分页)
        /// </summary>
        /// <returns></returns>
        public virtual ActionResult Page()
        {
            //获取参数
            StrObjectDict reqParam = GetParams();
            StrObjectDict reqPage  = GetPageInfo();

            //获取实体类
            Type t = this.getType();

            if (t == null)
            {
                return(this.MyJson(0, this.NULL_MODEL_ERROR));
            }

            //分页
            Page page     = new Page();
            int  pageNum  = 0;
            int  pageSize = 0;

            if (int.TryParse(reqPage.GetString("PageNum"), out pageNum) && int.TryParse(reqPage.GetString("PageSize"), out pageSize))
            {
                page.PageNumber = pageNum;
                page.PageSize   = pageSize;
                if (page.PageSize > 0 && page.PageNumber > 0)
                {
                    object[] args   = new object[] { reqParam, page };
                    var      result = crudManager.GetType().GetMethod("List", new Type[] { typeof(IDictionary <string, object>), typeof(Page) }).MakeGenericMethod(t).Invoke(crudManager, args);
                    return(this.MyJson(1, result.GetType().GetProperty("DataList").GetValue(result, null), result.GetType().GetProperty("PageInfo").GetValue(result, null)));
                }
            }

            return(this.MyJson(0, "参数错误!"));
        }
Exemplo n.º 19
0
Arquivo: SOASql.cs Projeto: LuckyN/hip
        public IList <StrObjectDict> DoService(StrObjectDict obj)
        {
            if (OtherProperties != null)
            {
                object isAsync = OtherProperties["IsAsync"];
                if ("1".Equals(isAsync.ToString()))
                {
                    //异步访问
                }
                else
                {
                    //同步访问
                    string serverUrl      = OtherProperties["ServiceUrl"].ToString();
                    string inputTemplate  = OtherProperties["InputTemplate"].ToString();
                    string outputTemplate = OtherProperties["OutputTemplate"].ToString();

                    //通过入参对象生成实际入参内容
                    //加载模板
                    Template template = Template.Parse(inputTemplate);             //用模板内容做为参数解析得到Template对象
                    string   result   = template.Render(Hash.FromDictionary(obj)); //用模板所需的元素做为参数呈现处理后的结果
                }


                return(null);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 20
0
        public ActionResult Analysis()
        {
            StrObjectDict dict = GetParams();

            string sql        = dict.GetString("SQL");
            string datasource = dict.GetString("DataSource");

            if (string.IsNullOrEmpty(sql))
            {
                return(this.MyJson(0, "参数不能为空:SQL"));
            }

            sql = sql.ToUpper();
            //string Table = sql.Substring(sql.LastIndexOf("FROM") + 4);
            //Table = Table.Trim();

            if (sql.Contains("SELECT") && !sql.Contains("UPDATE") && !sql.Contains("INSERT") && !sql.Contains("DELETE") && !sql.Contains("DROP"))
            {
                IList <string> list = new List <string>();
                try
                {
                    list = ReportFormManager.Instance.SqlAnalysis(datasource, sql);
                }
                catch (Exception msg)
                {
                    return(this.MyJson(0, msg.Message));
                }
                return(this.MyJson(1, list));
            }
            else
            {
                return(this.MyJson(0, "仅限执行SELECT语句"));
            }
        }
Exemplo n.º 21
0
        public PageData <StrObjectDict> ListSod(StrObjectDict obj, Page p)
        {
            object listcount = DB.Scalar("", obj);
            IList <StrObjectDict> listData = DB.ListSod("", obj, p.PageNumber, p.PageSize);

            return(new PageData <StrObjectDict>(listData, p.PageNumber, int.Parse(listcount.ToString())));
        }
Exemplo n.º 22
0
        public ActionResult SourcesSave()
        {
            StrObjectDict dict = GetParams();
            string        Name = dict.GetString("Name");

            if (string.IsNullOrEmpty(Name))
            {
                return(this.MyJson(0, "参数不能为空:Name"));
            }

            if (dict.ContainsKey("ID"))
            {
                dict["UpdateUser"] = LoginSession.Current.NAME;
                dict["ModifyTime"] = DateTime.Now;
            }

            string result = ReportFormManager.Instance.SourcesInsertOrUpdate(dict);

            if (result != "Error")
            {
                StrObjectDict succeed = new StrObjectDict();
                succeed["ID"] = result;
                return(this.MyJson(1, succeed));
            }
            else
            {
                return(this.MyJson(0, "保存失败"));
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 请求报表文件(分页)
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public PageData <StrObjectDict> FilePage(StrObjectDict obj, Page p)
        {
            object listcount = DB.Scalar("COUNT_ReportFormFile", obj);
            IList <StrObjectDict> listData = DB.ListSod("Info_ReportFormFile", obj, p.PageNumber, p.PageSize);

            return(new PageData <StrObjectDict>(listData, p.PageNumber, int.Parse(listcount.ToString())));
        }
Exemplo n.º 24
0
        public ActionResult SqlExcute()
        {
            StrObjectDict dict = GetParams();

            string sql        = dict.GetString("SQL");
            string datasource = dict.GetString("DataSource");

            if (string.IsNullOrEmpty(sql))
            {
                return(this.MyJson(0, "参数不能为空:SQL"));
            }

            var check = sql.ToUpper();

            if (check.Contains("SELECT") && !check.Contains("UPDATE") && !check.Contains("INSERT") && !check.Contains("DELETE") && !check.Contains("DROP"))
            {
                IList <StrObjectDict> list = new List <StrObjectDict>();
                try
                {
                    list = ReportFormManager.Instance.SqlExcute(datasource, sql);
                }
                catch
                {
                    return(this.MyJson(0, "查询失败"));
                }
                return(this.MyJson(1, list));
            }
            else
            {
                return(this.MyJson(0, "仅限执行SELECT语句"));
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public PageData <Function> Pages(StrObjectDict obj, Page p)
        {
            object           listcount = DB.Scalar("COUNT_Function", obj);
            IList <Function> listData  = DB.List <Function>(obj, p.PageNumber, p.PageSize);

            return(new PageData <Function>(listData, p.PageNumber, int.Parse(listcount.ToString())));
        }
Exemplo n.º 26
0
        public ActionResult SetFormState()
        {
            StrObjectDict dict      = GetParams();
            string        isInvalid = dict.GetString("IsInvalid");
            string        state;
            DateTime      invalidTime = DateTime.Now;

            if (!string.IsNullOrEmpty(isInvalid))
            {
                state = "0";
            }
            else
            {
                state = "1";
            }

            IList <StrObjectDict> dicts = NursingFormManager.Instance.Hns_SetFormState(new
            {
                State       = state,
                IsInvalid   = isInvalid,
                InvalidTime = invalidTime
            }.toStrObjDict(false));

            return(this.MyJson(1, dicts));
        }
Exemplo n.º 27
0
        /// <summary>
        /// 获取用户列表(分页)
        /// </summary>
        public override ActionResult Page()
        {
            StrObjectDict reqParam = GetParams();
            StrObjectDict reqPage  = GetPageInfo();;



            //分页
            Page page     = new Page();
            int  pageNum  = 0;
            int  pageSize = 0;

            if (int.TryParse(reqPage.GetString("PageNum"), out pageNum) && int.TryParse(reqPage.GetString("PageSize"), out pageSize))
            {
                page.PageNumber = pageNum;
                page.PageSize   = pageSize;
                if (page.PageSize > 0 && page.PageNumber > 0)
                {
                    PageData <StrObjectDict> pd = UserManager.Instance.ListSod(reqParam, page);
                    return(this.MyJson(1, pd));
                }
            }

            return(this.MyJson(0, "参数不正确"));
        }
Exemplo n.º 28
0
 public bool CreateEvaluat(StrObjectDict sod, string user)
 {
     sod["Evaluator"]   = user;
     sod["EvaluatTime"] = DateTime.Now;
     sod["IsInvalid"]   = 0;
     return(this.InsertOrUpdate <NursingEvaluat>(sod) > 0);
 }
Exemplo n.º 29
0
        public ActionResult DelPower()
        {
            StrObjectDict dict   = GetParams();
            string        roleID = dict.GetString("RoleGroupID");

            #region 参数有效性检查

            if (string.IsNullOrEmpty(roleID))
            {
                return(this.MyJson(0, "参数错误:RoleGroupID"));
            }
            #endregion


            var delete = RoleManager.Instance.DeletePowers(dict);

            if (delete > 0)
            {
                return(this.MyJson(1, "删除成功."));
            }
            else
            {
                return(this.MyJson(0, "删除失败."));
            }
        }
Exemplo n.º 30
0
        //public ActionResult NameValue()
        //{
        //    StrObjectDict sod = GetParams();
        //    IList<StrObjectDict> list = DataSourceManager.Instance.NameValue<DataSource>(sod);
        //    return this.MyJson(1, list);
        //}

        public override ActionResult Index()
        {
            StrObjectDict      sod  = GetParams();
            IList <DataSource> list = DataSourceManager.Instance.List <DataSource>(sod);

            return(this.MyJson(1, list));
        }