Exemple #1
0
        /// <summary>
        /// 根据已确认报警记录输入分页获取已确认报警记录实体列表
        /// </summary>
        /// <param name="input">已确认报警记录输入</param>
        /// <returns>报警记录实体列表</returns>
        public async Task <List <Alarm> > GetConfirmedAlarmList(ConfirmedAlarmListInput input)
        {
            var today    = DateTime.Today;
            var toDate   = today.AddDays(1);
            var fromDate = input.TimeRangType == (int)TimeRangTypeEnum.OneWeek ? today.AddDays(-7) : (input.TimeRangType == (int)TimeRangTypeEnum.OneMonth ? today.AddMonths(-1) : (input.TimeRangType == (int)TimeRangTypeEnum.ThreeMonths ? today.AddMonths(-3) : today));

            var query = _context.Alarm.Include(i => i.Patient.Doctor).Where(i => (input.DoctorId != 0 /*0代表全部护士*/ ? i.Patient.DoctorId == input.DoctorId : true) && i.AddTime >= fromDate && i.AddTime < toDate && i.IsConfirmed && i.Patient.HospitalId == input.HospitalId && Math.Abs(i.WeightOverflow / i.PostDialysisWeight) >= 0.03m);

            if (input.StartId.HasValue)
            {
                var alarm = await _context.Alarm.FindAsync(input.StartId.Value);

                switch (input.RefreshMode)
                {
                case (int)RefreshModeEnum.History:
                    query = query.Where(t => t.AddTime < alarm.AddTime).OrderByDescending(i => i.AddTime).Take(input.PageSize);
                    break;

                case (int)RefreshModeEnum.New:
                    query = query.Where(t => t.AddTime > alarm.AddTime).OrderBy(i => i.AddTime).Take(input.PageSize).OrderByDescending(i => i.AddTime);
                    break;

                default:
                    break;
                }
            }
            else
            {
                query = query.OrderByDescending(t => t.AddTime).Take(input.PageSize);
            }

            var alarmList = await query.ToListAsync();

            return(alarmList);
        }
        /// <summary>
        /// 根据已确认报警记录输入获取已确认报警记录列表
        /// </summary>
        /// <param name="input">已确认报警记录输入</param>
        /// <returns>已确认报警记录列表</returns>
        public async Task <WebApiOutput <List <AlarmDto> > > GetConfirmedAlarmList(ConfirmedAlarmListInput input)
        {
            var alarmList = await _repository.GetConfirmedAlarmList(input);

            return(WebApiOutput <List <AlarmDto> > .Success(Mapper.Map <List <Alarm>, List <AlarmDto> >(alarmList)));
        }
Exemple #3
0
 public async Task <WebApiOutput <List <AlarmDto> > > GetConfirmedAlarmList(ConfirmedAlarmListInput input)
 {
     return(await _service.GetConfirmedAlarmList(input));
 }