//public override ActionResult Delete() //{ // StrObjectDict dict = GetParams(); // StrObjectDict option = GetData("Option"); // #region 入参检查 // string id = dict.GetString("ID"); // if (string.IsNullOrEmpty(id)) // { // return this.MyJson(0, "参数不能为空:ID"); // } // #endregion // int result = FunctionManager.Instance.Delete(dict,option); // if (result > 0) // { // return this.MyJson(1, "删除成功"); // } // else // { // return this.MyJson(0, "删除失败"); // } //} public override ActionResult Page() { StrObjectDict reqParam = GetParams(); StrObjectDict reqPage = GetPageInfo(); string ModifyUser = reqParam.GetString("ModifyUser"); string StartDate = reqParam.GetString("StartDate"); string EndDate = reqParam.GetString("EndDate"); if (string.IsNullOrEmpty(ModifyUser)) { reqParam.Remove("ModifyUser"); } if (string.IsNullOrEmpty(StartDate)) { reqParam.Remove("StartDate"); } if (string.IsNullOrEmpty(EndDate)) { reqParam.Remove("EndDate"); } //分页 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 <Function> pd = FunctionManager.Instance.Pages(reqParam, page); return(this.MyJson(1, pd.DataList, pd.PageInfo)); } } return(this.MyJson(0, "参数不正确")); }
/// <summary> /// 保存人员信息 /// </summary> /// <returns></returns> public override ActionResult InsertOrUpdate() { StrObjectDict reqParam = GetParams(); var pwd = reqParam.GetString("Password"); reqParam.Remove("Password"); reqParam["Password"] = MD5Encode.Encode(pwd); int result = UserManager.Instance.InsertOrUpdate <PubUser>(reqParam); if (result > 0) { return(this.MyJson(1, result)); } return(this.MyJson(0, "保存失败")); }
public ActionResult GetEvaluateStyle() { StrObjectDict dict = GetParams(); if (!dict.ContainsKey("FormID")) { dict["Type"] = "2"; var dicts = FormManager.Instance.HNS_GetEvaluateStyle(dict); return(this.MyJson(1, dicts)); } dict["ID"] = dict["FormID"]; dict.Remove("FormID"); var list = FormManager.Instance.HNS_GetEvaluateStyleByID(dict); return(this.MyJson(1, list)); }
public ActionResult GetTypeElements() { StrObjectDict dict = GetParams(); if (dict.GetString("Type") != "0") { if (string.IsNullOrEmpty(dict.GetString("TypeID"))) { return(this.MyJson(0, "参数不能为空:TypeID")); } } if (string.IsNullOrEmpty(dict.GetString("FastCode"))) { dict.Remove("FastCode"); } IList <StrObjectDict> dicts = FormManager.Instance.Hns_GetTypeElements(dict); return(this.MyJson(1, dicts)); }
public ActionResult GetDepartmentPersonnel() { StrObjectDict dict = GetParams(); string typeID = dict.GetString("TypeID"); if (string.IsNullOrEmpty(typeID)) { return(this.MyJson(0, "参数不能为空:TypeID")); } if (typeID == "0") { dict.Remove("TypeID"); } IList <StrObjectDict> dicts = FormManager.Instance.HNS_GetDepartmentPersonnel(dict); return(this.MyJson(1, dicts)); }
public ActionResult GetForm() { StrObjectDict dict = GetParams(); string versionCode = dict.GetString("VersionCode"); string id = dict.GetString("ID"); string client = dict.GetString("Client"); if (string.IsNullOrEmpty(id)) { return(this.MyJson(0, "参数不能为空:ID")); } dict["FormID"] = dict["ID"]; dict.Remove("ID"); if (!string.IsNullOrEmpty(versionCode)) { IList <StrObjectDict> info = FormManager.Instance.StyleInfo(dict); if (client == "PC") { dict["Agent"] = info[0]["DS"].ToString(); } if (client == "Mobile") { dict["Agent"] = info[0]["MS"].ToString(); } if (string.IsNullOrEmpty(client)) { dict["Agent"] = "N/A"; } else { dict["Agent"] = client; } } IList <StrObjectDict> dicts = FormManager.Instance.Hns_GetForm(dict); dicts.Last().Add("Last", 1); return(this.MyJson(1, dicts)); }
/// <summary> /// 获取客户(病人)列表,根据组织机构ID和自定义查询条件 /// </summary> /// <returns></returns> public override ActionResult Index() { StrObjectDict dict = GetParams(); string orgID = dict.GetString("OrgID"); string inputCode = dict.GetString("InputCode"); string filter = dict.GetString("Filter"); #region 入参有效性验证 if (string.IsNullOrEmpty(orgID)) { return(this.MyJson(0, "参数错误:OrgID")); } if (string.IsNullOrEmpty(inputCode)) { if (dict.ContainsKey("InputCode")) { dict.Remove("InputCode"); } } else { var temp = inputCode.ToUpper(); dict["InputCode"] = temp; } if (string.IsNullOrEmpty(filter)) { //return this.MyJson(0, "参数错误:Filter"); filter = "1"; } #endregion dict["Name"] = LoginSession.Current.NAME; IList <StrObjectDict> list = CustomerManager.Instance.Search(dict); return(this.MyJson(1, list)); }
public int InsertData(StrObjectDict list, StrObjectDict dict) { var name = "type"; List <Object> result = ((Object[])list.GetObject("SyncRoot")).ToList(); IList <DBState> dblist = new List <DBState>(); foreach (var item in result) { StrObjectDict temp = item.toStrObjDict(); //string superID = temp.GetString("id"); if (temp.ContainsKey("options")) { List <Object> temp1 = ((Object[])temp.GetObject("options")).ToList(); temp.Remove("options"); var id = temp.GetString("id"); var ywhy = temp.GetString("YWHY"); var type = temp.GetString("type"); var text = temp.GetString("text"); var no = temp.GetString("NO"); var style = 1; switch (type) { case "input": style = 1; break; case "radio": style = 2; break; case "checkbox": style = 2; break; case "grade": style = 1; break; case "label": style = 1; break; } //foreach (var value in temp) //{ dblist.Add(new DBState { Name = "INSERT_FormStructure", Param = new { ID = id, FormID = dict["FormID"], VersionCode = dict["VersionCode"], ElementName = text, ElementAttribute = type, Implication = ywhy, FormOfExpression = style, NO = no }.toStrObjDict(), Type = ESqlType.INSERT }); //} foreach (var lls in temp1) { StrObjectDict sod = lls.toStrObjDict(); var ids = sod.GetString("id"); var ywhys = sod.GetString("YWHY"); var types = sod.GetString("type"); var texts = sod.GetString("text"); var nos = sod.GetString("NO"); var styles = 1; switch (types) { case "input": style = 1; break; case "radio": style = 2; break; case "checkbox": style = 2; break; case "grade": style = 1; break; case "label": style = 1; break; } dblist.Add(new DBState { Name = "INSERT_FormStructure", Param = new { ID = ids, FormID = dict["FormID"], VersionCode = dict["VersionCode"], ElementName = texts, ElementAttribute = types, Implication = ywhys, FormOfExpression = styles, SuperID = id, NO = nos }.toStrObjDict(), Type = ESqlType.INSERT }); } } else { var id = temp.GetString("id"); var ywhy = temp.GetString("YWHY"); var type = temp.GetString("type"); var text = temp.GetString("text"); var no = temp.GetString("NO"); var style = 1; switch (type) { case "input": style = 1; break; case "radio": style = 2; break; case "checkbox": style = 2; break; case "grade": style = 1; break; case "label": style = 1; break; } dblist.Add(new DBState { Name = "INSERT_FormStructure", Param = new { ID = id, FormID = dict["FormID"], VersionCode = dict["VersionCode"], ElementName = text, ElementAttribute = type, Implication = ywhy, FormOfExpression = style, NO = no }.toStrObjDict(), Type = ESqlType.INSERT }); } } return(DB.Execute(dblist)); }
public override ActionResult InsertOrUpdate() { StrObjectDict dict = GetParams(); string Struct = dict.GetString("FormStruct"); string formstyle = dict.GetString("FormStyle"); if (!dict.ContainsKey("VersionCode")) { dict["VersionCode"] = "1.0"; } //if (string.IsNullOrEmpty(dict["Pages"].ToString())) //{ // return this.MyJson(0, "参数不能为空:Pages"); //} dict["ModifyTime"] = DateTime.Now; dict["ModifyUser"] = LoginSession.Current.NAME; dict["InvalidTime"] = DateTime.Now; dict["UpdateUser"] = LoginSession.Current.NAME; dict["PageNo"] = "1"; #region NursingForm string name = dict.GetString("Name"); string fastCode = dict.GetString("FastCode"); string formType = dict.GetString("FormType"); string markCode = dict.GetString("MarkCode"); string modifyUser = LoginSession.Current.NAME; DateTime modifyTime = DateTime.Now; string deptRange = dict.GetString("DeptRange"); string formAgainst = dict.GetString("FormAgainst"); string newVersionCode = dict.GetString("NewVersionCode"); string designVersion = dict.GetString("DesignVersion"); string resolution = dict.GetString("Resolution"); DateTime invalidTime = DateTime.Now; string isInvalid = dict.GetString("IsInvalid"); string ID = dict.GetString("ID"); #endregion #region NursingFormVersion string updateUser = LoginSession.Current.NAME; string version = dict.GetString("VersionCode"); string updateRemark = dict.GetString("UpdateRemark"); string issuer = dict.GetString("Issuer"); DateTime issueDateTime = DateTime.Now; string issueRemark = dict.GetString("IssueRemark"); #endregion #region NursingFormFile string pageNumber = dict.GetString("PageNumber"); string pageNo = dict.GetString("PageNo"); string pageContent = dict.GetString("PageContent"); string docment = dict.GetString("Docment"); string versionCode = dict.GetString("VersionCode"); string formStruct = dict.GetString("FormStruct"); #endregion if (formType != "2") { if (string.IsNullOrEmpty(formstyle)) { return(this.MyJson(0, "参数不能为空:FormStyle")); } } else { dict["FormStyle"] = "N/A"; } if (string.IsNullOrEmpty(formType)) { return(this.MyJson(0, "参数不能为空:FormType")); } if (string.IsNullOrEmpty(ID)) { string id = Utils.getGUID(); dict["ID"] = id; dict["FormID"] = id; switch (dict["FormStyle"].ToString()) { //样式A case "4f31eca8-ff29-404f-99f7-8cc8afe395a5": dict["FormStructA"] = dict["FormStruct"]; dict["PageContentA"] = dict["PageContent"]; dict.Remove("FormStruct"); dict.Remove("PageContent"); break; //样式B case "c4bbc193-9f77-408c-909c-4073a9da2d01": dict["FormStructB"] = dict["FormStruct"]; dict["PageContentB"] = dict["PageContent"]; dict.Remove("FormStruct"); dict.Remove("PageContent"); break; //样式C case "7f9b2933-fe36-45b0-9442-d3fb7384d90e": dict["FormStructC"] = dict["FormStruct"]; dict["PageContentC"] = dict["PageContent"]; dict.Remove("FormStruct"); dict.Remove("PageContent"); break; //自适应 default: break; } try { var result = FormManager.Instance.FormInsert(dict); } catch { //执行失败删除插入内容 var del = FormManager.Instance.NursingFormInsertDelete(id); return(this.MyJson(-1, "调用失败:请检查入参是否符合规范或缺失必要入参或表单名称是否重复。")); } if (dict["FormType"].ToString().Trim() != "2") { try { StrObjectDict list = JsonAdapter.FromJsonAsDictionary(Struct).toStrObjDict(); var data = FormManager.Instance.InsertData(list, dict); } catch { //执行失败删除插入内容 var del = FormManager.Instance.NursingFormInsertDelete(id); return(this.MyJson(-1, "InsertOrUpdate接口的错误信息:检测到[报表统计数据]ID存在重复,违反唯一约束条件。数据进行回滚操作。")); } } return(this.MyJson(1, "保存成功!")); } else { switch (dict["FormStyle"].ToString()) { //样式A case "4f31eca8-ff29-404f-99f7-8cc8afe395a5": dict["FormStructA"] = dict["FormStruct"]; dict["PageContentA"] = dict["PageContent"]; dict.Remove("FormStruct"); dict.Remove("PageContent"); break; //样式B case "c4bbc193-9f77-408c-909c-4073a9da2d01": dict["FormStructB"] = dict["FormStruct"]; dict["PageContentB"] = dict["PageContent"]; dict.Remove("FormStruct"); dict.Remove("PageContent"); break; //样式C case "7f9b2933-fe36-45b0-9442-d3fb7384d90e": dict["FormStructC"] = dict["FormStruct"]; dict["PageContentC"] = dict["PageContent"]; dict.Remove("FormStruct"); dict.Remove("PageContent"); break; //自适应 default: break; } try { var result = FormManager.Instance.FormUpdate(dict); } catch { return(this.MyJson(-1, "调用失败:请检查入参是否符合规范或缺失必要入参或表单名称是否重复。")); } if (dict["FormType"].ToString().Trim() != "2") { try { StrObjectDict list = JsonAdapter.FromJsonAsDictionary(Struct).toStrObjDict(); //清除键值对备份数据 var del = FormManager.Instance.DelData(dict); //保存键值对备份数据 var data = FormManager.Instance.InsertData(list, dict); } catch (Exception msg) { return(this.MyJson(-1, msg.Message)); } } return(this.MyJson(1, "保存成功!")); } }