public ActionResult GetGridJson(Pagination pagination, string keyword, int dataType) { var data = new { rows = deviceApp.GetList((eOrderDataType)System.Enum.ToObject(typeof(eOrderDataType), dataType)), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public ActionResult GetGridJson(Pagination pagination, string keyword) { var data = new { rows = orderApp.GetList(pagination, keyword), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public ResultClass <List <OrderEntity> > GetList() { ResultClass <List <OrderEntity> > _ret = new ResultClass <List <OrderEntity> >(); OrderApp bll = new OrderApp(); try { _ret.ResultData = bll.GetList(); _ret.Result = true; } catch (Exception ex) { _ret.ErrorMessage = ex.Message; } finally { bll.Dispose(); } return(_ret); }
// [ValidateAntiForgeryToken] public ActionResult GetDoctorInfo(GetDoctorInfoRequest request) { ResponseBase <GetDoctorInfoResponse> response = new ResponseBase <GetDoctorInfoResponse>(); response.IsSuccess = false; response.Reason = "系统出错,请联系管理员"; #region 验证 if (request == null) { response.IsSuccess = false; response.Reason = "参数不能为空"; return(Content(response.ToJson())); } if (request.DoctorId < 1) { response.IsSuccess = false; response.Reason = "医生ID输入不正确"; return(Content(response.ToJson())); } #endregion try { var doctor = doctorApp.GetList(item => item.DoctorId == request.DoctorId).FirstOrDefault(); GetDoctorInfoResponse getDoctorInfoResponse = new GetDoctorInfoResponse(); if (doctor != null) { getDoctorInfoResponse.DoctorId = doctor.DoctorId; getDoctorInfoResponse.DoctorName = doctor.DoctorName; getDoctorInfoResponse.GootAt = doctor.GootAt; getDoctorInfoResponse.Avatar = doctor.Avatar; getDoctorInfoResponse.Title = doctor.Title; getDoctorInfoResponse.Introduction = doctor.Introduction; getDoctorInfoResponse.Gender = doctor.Gender == true ? 1 : 2; int orderCycle = 0; ////配置文件读取 int.TryParse(Configs.GetValue("OrderCycle"), out orderCycle); getDoctorInfoResponse.OrderCycle = orderCycle; //获取预约周期信息 List <OrderCycle> orderCycleList = new List <OrderCycle>(); var visitList = visitApp.GetList(item => item.DoctorId == request.DoctorId).OrderBy(item => item.Week); //预约周期内预约信息 List <OrderDateTimeInfo> orderDateTimeInfoList = new List <OrderDateTimeInfo>(); //预约时间列表 for (int i = 0; i < orderCycle; i++) { OrderDateTimeInfo orderDateTimeInfo = new OrderDateTimeInfo(); var orderDateTime = DateTime.Now.AddDays(i); orderDateTimeInfo.OrderDateTime = orderDateTime; //查询停诊表信息 int week = (int)orderDateTime.DayOfWeek; if (week == 0) { week = 7; } orderDateTimeInfo.Week = week; orderDateTimeInfoList.Add(orderDateTimeInfo); } //出诊列表 if (visitList != null && visitList.Any()) { foreach (var visit in visitList) { //预约时间列表 var orderDateTimeList = orderDateTimeInfoList.Where(item => item.Week == visit.Week); foreach (var info in orderDateTimeList) { OrderCycle orderCycleInfo = new OrderCycle(); orderCycleInfo.Week = visit.Week; orderCycleInfo.OrderDateTime = info.OrderDateTime; var beginTime = Convert.ToDateTime(orderCycleInfo.OrderDateTime.ToString("yyyy-MM-dd 00:00:00")); var endTime = Convert.ToDateTime(orderCycleInfo.OrderDateTime.ToString("yyyy-MM-dd 23:59:59")); var orderList = orderApp.GetList(item => item.OrderDoctorId == request.DoctorId && item.OrderDate >= beginTime && item.OrderDate <= endTime).ToList(); #region 午出诊 //上午出诊 if (visit.Morning) { //验证是否上午停诊 var isStopOrder = stopApp.GetList(item => item.DoctorId == request.DoctorId && item.CloseDate >= beginTime && item.CloseDate <= beginTime && item.OrderTimeType == 1).Count() > 0; if (!isStopOrder) { #region 午 //预约时间是今天 if (beginTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")) { //现在时间大于上午 if (DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyy-MM-dd 12:00:00"))) { //查询预约人数,上午 var orderUserCount = 0; var temporderList = orderList.Where(item => item.OrderType == 1); if (temporderList != null && temporderList.Any()) { orderUserCount = temporderList.Count(); } if (orderUserCount < visit.MorningCount) { //预约状态,可预约 orderCycleInfo.MorningOrderType = 1; } if (visit.MorningCount == orderUserCount) { //预约状态,预约已满 orderCycleInfo.MorningOrderType = 2; } } } else { //预约时间是今天 if (beginTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")) { //现在时间大于上午 if (DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyy-MM-dd 18:00:00"))) { //查询预约人数,上午 var orderUserCount = 0; var temporderList = orderList.Where(item => item.OrderType == 1); if (temporderList != null && temporderList.Any()) { orderUserCount = temporderList.Count(); } if (orderUserCount < visit.MorningCount) { //预约状态,可预约 orderCycleInfo.MorningOrderType = 1; } if (visit.MorningCount == orderUserCount) { //预约状态,预约已满 orderCycleInfo.MorningOrderType = 2; } } } else { //查询预约人数,上午 var orderUserCount = 0; var temporderList = orderList.Where(item => item.OrderType == 1); if (temporderList != null && temporderList.Any()) { orderUserCount = temporderList.Count(); } if (orderUserCount < visit.MorningCount) { //预约状态,可预约 orderCycleInfo.MorningOrderType = 1; } if (visit.MorningCount == orderUserCount) { //预约状态,预约已满 orderCycleInfo.MorningOrderType = 2; } } } #endregion } else { //预约状态,停诊 orderCycleInfo.MorningOrderType = 3; } } #endregion #region 午出诊 //下午出诊 if (visit.Afternoon) { //验证是否下午停诊 var isStopOrder = stopApp.GetList(item => item.DoctorId == request.DoctorId && item.CloseDate >= beginTime && item.CloseDate <= beginTime && item.OrderTimeType == 2).Count() > 0; if (!isStopOrder) { #region 午 //预约时间是今天 if (beginTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")) { //现在时间大于上午 if (DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyy-MM-dd 18:00:00"))) { //查询预约人数,下午 var orderUserCount = 0; var temporderList = orderList.Where(item => item.OrderType == 2); if (temporderList != null && temporderList.Any()) { orderUserCount = temporderList.Count(); } if (orderUserCount < visit.AfternoonCount) { //预约状态,可预约 orderCycleInfo.AfterNoonOrderType = 1; } if (visit.MorningCount == orderUserCount) { //预约状态,预约已满 orderCycleInfo.AfterNoonOrderType = 2; } } } else { //查询预约人数,下午 var orderUserCount = 0; var temporderList = orderList.Where(item => item.OrderType == 2); if (temporderList != null && temporderList.Any()) { orderUserCount = temporderList.Count(); } if (orderUserCount < visit.AfternoonCount) { //预约状态,可预约 orderCycleInfo.AfterNoonOrderType = 1; } if (visit.AfternoonCount == orderUserCount) { //预约状态,预约已满 orderCycleInfo.AfterNoonOrderType = 2; } } #endregion } else { //预约状态,停诊 orderCycleInfo.AfterNoonOrderType = 3; } } #endregion #region 晚上出诊 //晚上出诊 if (visit.Night) { //验证是否下午停诊 var isStopOrder = stopApp.GetList(item => item.DoctorId == request.DoctorId && item.CloseDate >= beginTime && item.CloseDate <= beginTime && item.OrderTimeType == 3).Count() > 0; if (!isStopOrder) { //预约时间是今天 if (beginTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")) { //现在时间大于晚上 if (DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyy-MM-dd 22:00:00"))) { //查询预约人数,晚上 var orderUserCount = 0; var temporderList = orderList.Where(item => item.OrderType == 3); if (temporderList != null && temporderList.Any()) { orderUserCount = temporderList.Count(); } if (orderUserCount < visit.NightCount) { //预约状态,可预约 orderCycleInfo.NightOrderType = 1; } if (visit.NightCount == orderUserCount) { //预约状态,预约已满 orderCycleInfo.NightOrderType = 2; } } } else { #region 晚上 //查询预约人数,晚上 var orderUserCount = 0; var temporderList = orderList.Where(item => item.OrderType == 3); if (temporderList != null && temporderList.Any()) { orderUserCount = temporderList.Count(); } if (orderUserCount < visit.NightCount) { //预约状态,可预约 orderCycleInfo.NightOrderType = 1; } if (visit.NightCount == orderUserCount) { //预约状态,预约已满 orderCycleInfo.NightOrderType = 2; } #endregion } } else { //预约状态,停诊 orderCycleInfo.NightOrderType = 3; } } #endregion orderCycleList.Add(orderCycleInfo); } } } orderCycleList = orderCycleList.OrderBy(item => item.OrderDateTime).ToList(); //出诊周期列表 getDoctorInfoResponse.OrderCycleList = orderCycleList; response.Result = getDoctorInfoResponse; response.IsSuccess = true; response.Reason = ""; } } catch (Exception ex) { } return(Content(response.ToJson())); }