|
|
@ -266,33 +266,46 @@ namespace Shentun.WebPeis.AppointSchedules |
|
|
[HttpPost("api/app/AppointSchedule/GetAppointScheduleList")] |
|
|
[HttpPost("api/app/AppointSchedule/GetAppointScheduleList")] |
|
|
public async Task<List<AppointScheduleDto>> GetAppointScheduleListAsync(GetAppointScheduleListInputDto input) |
|
|
public async Task<List<AppointScheduleDto>> GetAppointScheduleListAsync(GetAppointScheduleListInputDto input) |
|
|
{ |
|
|
{ |
|
|
var entList = (await _appointScheduleRepository.GetQueryableAsync()).Where(m => m.MedicalCenterId == input.MedicalCenterId); |
|
|
|
|
|
|
|
|
//var entList = (await _appointScheduleRepository.GetQueryableAsync())
|
|
|
|
|
|
// .Where(m => m.MedicalCenterId == input.MedicalCenterId);
|
|
|
|
|
|
|
|
|
|
|
|
var entList = from appointSchedule in await _appointScheduleRepository.GetQueryableAsync() |
|
|
|
|
|
join appointScheduleTime in await _appointScheduleTimeRepository.GetQueryableAsync() |
|
|
|
|
|
on appointSchedule.AppointScheduleId equals appointScheduleTime.AppointScheduleId into appointScheduleTimeTemp |
|
|
|
|
|
from appointScheduleTimeHaveEmpty in appointScheduleTimeTemp.DefaultIfEmpty() |
|
|
|
|
|
where appointSchedule.MedicalCenterId == input.MedicalCenterId |
|
|
|
|
|
select new |
|
|
|
|
|
{ |
|
|
|
|
|
appointSchedule, |
|
|
|
|
|
NumberLimit = appointScheduleTimeHaveEmpty != null ? appointScheduleTimeHaveEmpty.NumberLimit : 0 |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.StartDate)) |
|
|
if (!string.IsNullOrWhiteSpace(input.StartDate)) |
|
|
{ |
|
|
{ |
|
|
if (!string.IsNullOrWhiteSpace(input.EndDate)) |
|
|
if (!string.IsNullOrWhiteSpace(input.EndDate)) |
|
|
{ |
|
|
{ |
|
|
entList = entList.Where(m => m.AppointDate.Date >= DateTime.Parse(input.StartDate) |
|
|
|
|
|
&& m.AppointDate.Date <= DateTime.Parse(input.EndDate)); |
|
|
|
|
|
|
|
|
entList = entList.Where(m => m.appointSchedule.AppointDate.Date >= DateTime.Parse(input.StartDate) |
|
|
|
|
|
&& m.appointSchedule.AppointDate.Date <= DateTime.Parse(input.EndDate)); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
entList = entList.Where(m => m.AppointDate.Date >= DateTime.Parse(input.StartDate)); |
|
|
|
|
|
|
|
|
entList = entList.Where(m => m.appointSchedule.AppointDate.Date >= DateTime.Parse(input.StartDate)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
var entListDto = entList.ToList().Select(s => new AppointScheduleDto |
|
|
|
|
|
|
|
|
var entListDto = entList.ToList().GroupBy(g => g.appointSchedule).Select(s => new AppointScheduleDto |
|
|
{ |
|
|
{ |
|
|
AppointDate = DataHelper.ConversionDateShortToString(s.AppointDate), |
|
|
|
|
|
AppointScheduleId = s.AppointScheduleId, |
|
|
|
|
|
CreationTime = s.CreationTime, |
|
|
|
|
|
CreatorId = s.CreatorId, |
|
|
|
|
|
LastModificationTime = s.LastModificationTime, |
|
|
|
|
|
LastModifierId = s.LastModifierId, |
|
|
|
|
|
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result, |
|
|
|
|
|
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result, |
|
|
|
|
|
SingleNumberLimit = s.SingleNumberLimit, |
|
|
|
|
|
IsWork = s.IsWork, |
|
|
|
|
|
MedicalCenterId = s.MedicalCenterId |
|
|
|
|
|
|
|
|
AppointDate = DataHelper.ConversionDateShortToString(s.Key.AppointDate), |
|
|
|
|
|
AppointScheduleId = s.Key.AppointScheduleId, |
|
|
|
|
|
CreationTime = s.Key.CreationTime, |
|
|
|
|
|
CreatorId = s.Key.CreatorId, |
|
|
|
|
|
LastModificationTime = s.Key.LastModificationTime, |
|
|
|
|
|
LastModifierId = s.Key.LastModifierId, |
|
|
|
|
|
CreatorName = _cacheService.GetSurnameAsync(s.Key.CreatorId).Result, |
|
|
|
|
|
LastModifierName = _cacheService.GetSurnameAsync(s.Key.LastModifierId).Result, |
|
|
|
|
|
SingleNumberLimit = s.Key.SingleNumberLimit, |
|
|
|
|
|
IsWork = s.Key.IsWork, |
|
|
|
|
|
MedicalCenterId = s.Key.MedicalCenterId, |
|
|
|
|
|
SumNumberLimit = s.Sum(m => m.NumberLimit) |
|
|
}).OrderBy(o => o.AppointDate).ToList(); |
|
|
}).OrderBy(o => o.AppointDate).ToList(); |
|
|
return entListDto; |
|
|
return entListDto; |
|
|
} |
|
|
} |
|
|
|