/// <summary> /// 完整性检查列表 /// </summary> /// <param name="DpetID">科室</param> /// <param name="Start">出院开始时间</param> /// <param name="Stop">出院结束时间</param> /// <param name="Zyh">病人ID或病案号(健康卡号)</param> /// <param name="Name">病人姓名</param> /// <param name="page">当前页</param> /// <param name="limit">每页几条</param> /// <returns></returns> public ActionResult MedicalRecordCheckList(string DpetID, string Start, string Stop, string Zyh, string Name, int page, int limit) { using (var db = new DataContext(AppEmr.DbConst.EmrDb)) { var param = new List <OracleParameter>(); param.Add(new OracleParameter { ParameterName = "DpetID", Value = DpetID }); param.Add(new OracleParameter { ParameterName = "LeaveTimeStart", Value = Start }); param.Add(new OracleParameter { ParameterName = "LeaveTimeStop", Value = Stop }); param.Add(new OracleParameter { ParameterName = "Zyh", Value = Zyh }); param.Add(new OracleParameter { ParameterName = "Name", Value = Name }); //如果page为0 输出所有的数据 if (page == 0 && limit == 0) { var list = FastMap.Query("Inpatient.MedicalRecordCheck.List", param.ToArray(), db); return(Json(new { code = 0, data = list, count = list.Count })); } //分页 var pageModel = new PageModel(); pageModel.PageId = page == 0 ? 1 : page; pageModel.PageSize = limit == 0 ? 10 : limit; var pageInfo = FastMap.QueryPage(pageModel, "Inpatient.MedicalRecordCheck.List", param.ToArray(), db); return(Json(new { code = 0, data = pageInfo.list, count = pageInfo.pModel.TotalRecord })); } }
/// <summary> /// 统计列表 /// </summary> /// <param name="DpetID">科室id</param> /// <param name="Start">开始时间</param> /// <param name="Stop">结束时间</param> /// <param name="page">当前页</param> /// <param name="limit">每页几条</param> /// <returns></returns> public ActionResult GetStatisticsList(string DpetID, string Start, string Stop, int page, int limit) { using (var db = new DataContext(AppEmr.DbConst.EmrDb)) { var param = new List <OracleParameter>(); param.Add(new OracleParameter { ParameterName = "DeptID", Value = DpetID }); param.Add(new OracleParameter { ParameterName = "Start", Value = Start }); param.Add(new OracleParameter { ParameterName = "Stop", Value = Stop }); //如果page为0 输出所有的数据 if (page == 0 && limit == 0) { var list = FastMap.Query("Dept.KeepWardLog.List", param.ToArray(), db); return(Json(new { code = 0, data = list, count = list.Count })); } //分页 var pageModel = new PageModel(); pageModel.PageId = page == 0 ? 1 : page; pageModel.PageSize = limit == 0 ? 10 : limit; var pageInfo = FastMap.QueryPage(pageModel, "Dept.KeepWardLog.List", param.ToArray(), db); return(Json(new { code = 0, data = pageInfo.list, count = pageInfo.pModel.TotalRecord })); } }
/// <summary> /// 更改用户默认显示的系统模块 /// </summary> /// <param name="userid"></param> /// <returns></returns> public ActionResult GetUserSysAppList(string userid) { var param = new List <OracleParameter>(); param.Add(new OracleParameter { ParameterName = "UserId", Value = userid }); var list = FastMap.Query("User.Sys.List", param.ToArray(), null, AppEmr.DbConst.EmrDb); return(Json(new { code = 0, data = list })); }
/// <summary> /// 获取用户相关的系统功能定义 /// </summary> /// <returns></returns> public ActionResult GetUserFunInfo(string UserId, string SysId, string FunLevel) { using (var db = new DataContext(AppEmr.DbConst.EmrDb)) { var param = new List <OracleParameter>(); param.Add(new OracleParameter { ParameterName = "UserId", Value = UserId }); param.Add(new OracleParameter { ParameterName = "SysId", Value = SysId }); param.Add(new OracleParameter { ParameterName = "FunLevel", Value = FunLevel }); var list = FastMap.Query("User.Fun.List", param.ToArray(), db); return(Json(new { code = 0, data = list })); } }
/// <summary> /// 检查总汇 /// </summary> /// <param name="start"></param> /// <param name="dpetidlist"></param> /// <returns></returns> public ActionResult GetSummaryRecoMedialList(string start, string dpetidlist) { using (var db = new DataContext(AppEmr.DbConst.EmrDb)) { var param = new List <OracleParameter>(); param.Add(new OracleParameter { ParameterName = "DpetIDList", Value = dpetidlist }); param.Add(new OracleParameter { ParameterName = "Entrytime", Value = start }); var list = FastMap.Query("Inpatient.SummaryRecoMedial.List", param.ToArray(), db); list.ForEach((f) => { f.Add("wwcnum", "22"); }); return(Json(new { code = 0, data = list, count = list.Count })); } }
void BeginRequest(object sender, EventArgs e) { var success = true; var dic = new Dictionary <string, object>(); var param = new List <DbParameter>(); var context = ((HttpApplication)sender); var key = context.Request.CurrentExecutionFilePath; key = string.IsNullOrEmpty(key) ? "" : key.Substring(1, key.Length - 1); if (FastMap.IsExists(key)) { context.Response.StatusCode = 200; context.Response.ContentType = "application/Json"; var data = new List <Dictionary <string, object> >(); var pageInfo = new PageResult(); var dbKey = FastMap.MapDb(key).ToStr(); var type = FastMap.MapType(key).ToStr(); var config = FastMap.DbConfig(dbKey); var url = context.Request.Form; if (url.Count == 0) { url = context.Request.QueryString; } var pageSize = url.GetValues("pageSize").ToStr().ToInt(10); var pageId = url.GetValues("pageId").ToStr().ToInt(1); foreach (var item in url) { var temp = DbProviderFactories.GetFactory(config.ProviderName).CreateParameter(); temp.ParameterName = item.ToStr(); temp.Value = url.Get(item.ToStr()); param.Add(temp); var existsKey = FastMap.MapExists(key, temp.ParameterName); var checkKey = FastMap.MapCheck(key, temp.ParameterName); //required if (!string.IsNullOrEmpty(FastMap.MapRequired(key, temp.ParameterName))) { dic.Add("success", false); dic.Add("error", string.Format("{0}不能为空", item)); param.Remove(temp); break; } //max length if (FastMap.MapMaxlength(key, temp.ParameterName).ToInt(0) != 0) { if (!(FastMap.MapMaxlength(key, temp.ParameterName).ToInt(0) >= temp.Value.ToStr().Length)) { dic.Add("success", false); dic.Add("error", string.Format("{0}:{1},最大长度{2}", item, temp.Value.ToStr(), FastMap.MapMaxlength(key, temp.ParameterName))); param.Remove(temp); break; } } //exists if (!string.IsNullOrEmpty(existsKey)) { var existsListParam = new List <DbParameter>(); var existsParam = DbProviderFactories.GetFactory(config.ProviderName).CreateParameter(); existsParam.ParameterName = temp.ParameterName; existsParam.Value = temp.Value; existsListParam.Add(existsParam); var checkData = FastMap.Query(existsKey, existsListParam.ToArray())?.First() ?? new Dictionary <string, object>(); if (checkData.GetValue("count").ToStr().ToInt(0) >= 1) { dic.Add("success", false); dic.Add("error", string.Format("{0}:{1}已存在", item, temp.Value)); param.Remove(temp); break; } } //check if (!string.IsNullOrEmpty(checkKey)) { var checkListParam = new List <DbParameter>(); var checkParam = DbProviderFactories.GetFactory(config.ProviderName).CreateParameter(); checkParam.ParameterName = temp.ParameterName; checkParam.Value = temp.Value; checkListParam.Add(checkParam); var checkData = FastMap.Query(existsKey, checkListParam.ToArray())?.First() ?? new Dictionary <string, object>(); if (checkData.GetValue("count").ToStr().ToInt(0) < 1) { dic.Add("success", false); dic.Add("error", string.Format("{0}:{1}不存在", item, temp.Value)); param.Remove(temp); break; } } //date if (string.Compare(FastMap.MapDate(key, temp.ParameterName).ToStr(), "true", true) == 0) { if (!BaseRegular.IsDate(temp.Value.ToStr())) { dic.Add("success", false); dic.Add("error", string.Format("{0}:{1},不是日期类型", item, temp.Value)); param.Remove(temp); break; } temp.Value = temp.Value.ToDate(); temp.DbType = System.Data.DbType.DateTime; } } if (dic.Count > 0) { context.Response.StatusCode = 200; context.Response.ContentType = "application/Json"; context.Response.Write(BaseJson.ModelToJson(dic)); context.Response.End(); } else { using (var db = new DataContext(dbKey)) { var tempParam = param.ToArray(); var sql = MapXml.GetMapSql(key, ref tempParam, db, dbKey); if (string.Compare(type, AppConfig.PageAll, true) == 0 || string.Compare(type, AppConfig.Page, true) == 0) { success = true; var page = new PageModel(); page.PageSize = pageSize == 0 ? 10 : pageSize; page.PageId = pageId == 0 ? 1 : pageId; pageInfo = db.GetPageSql(page, sql, tempParam).PageResult; dic.Add("data", pageInfo.list); dic.Add("page", pageInfo.pModel); } else if (string.Compare(type, AppConfig.All, true) == 0) { success = true; data = db.ExecuteSqlList(sql, tempParam, false).DicList; dic.Add("data", data); } else if (string.Compare(type, AppConfig.Write, true) == 0 && param.Count > 0) { var result = db.ExecuteSqlList(sql, tempParam, false).writeReturn; if (result.IsSuccess) { success = true; } else { success = false; dic.Add("error", result.Message); } } else { if (param.Count > 0) { success = true; data = db.ExecuteSqlList(sql, tempParam, false).DicList; dic.Add("data", data); } else { success = false; } } } } //if (FastMap.MapView(key).ToStr() != "") //{ // context.Response.ContentType = "text/html;charset=utf-8"; //} //else { dic.Add("success", success); context.Response.Write(BaseJson.ModelToJson(dic)); context.Response.End(); } } }