Browse Source

预约

master
wxd 2 years ago
parent
commit
1592f212fa
  1. 5
      src/Shentun.WebPeis.Application.Contracts/AppointSchedules/AppointScheduleDto.cs
  2. 45
      src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
  3. 34
      src/Shentun.WebPeis.Application/DiseaseRiskLevels/DiseaseRiskLevelAppService.cs

5
src/Shentun.WebPeis.Application.Contracts/AppointSchedules/AppointScheduleDto.cs

@ -18,6 +18,11 @@ namespace Shentun.WebPeis.AppointSchedules
public int SingleNumberLimit { get; set; } public int SingleNumberLimit { get; set; }
/// <summary>
/// 当天总限制数量
/// </summary>
public int SumNumberLimit { get; set; }
/// <summary> /// <summary>
/// 体检中心ID /// 体检中心ID
/// </summary> /// </summary>

45
src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs

@ -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;
} }

34
src/Shentun.WebPeis.Application/DiseaseRiskLevels/DiseaseRiskLevelAppService.cs

@ -1,6 +1,7 @@
using AutoMapper.Internal.Mappers; using AutoMapper.Internal.Mappers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Shentun.WebPeis.DiseaseRisks;
using Shentun.WebPeis.Models; using Shentun.WebPeis.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -78,6 +79,39 @@ namespace Shentun.WebPeis.DiseaseRiskLevels
return entdto; return entdto;
}
/// <summary>
/// 获取列表 根据疾病风险ID
/// </summary>
/// <returns></returns>
[HttpPost("api/app/DiseaseRiskLevel/GetDiseaseRiskLevelByDiseaseRiskId")]
public async Task<List<DiseaseRiskLevelDto>> GetDiseaseRiskLevelByDiseaseRiskIdAsync(DiseaseRiskIdInputDto input)
{
var entlist = (await _diseaseRiskLevelRepository.GetQueryableAsync()).Where(m => m.DiseaseRiskId == input.DiseaseRiskId);
var entdto = entlist.Select(s => new DiseaseRiskLevelDto
{
CreationTime = s.CreationTime,
CreatorId = s.CreatorId,
DisplayOrder = s.DisplayOrder,
LastModificationTime = s.LastModificationTime,
LastModifierId = s.LastModifierId,
SimpleCode = s.SimpleCode,
DiagnosisFunction = s.DiagnosisFunction,
DiseaseRiskId = s.DiseaseRiskId,
DiseaseRiskLevelId = s.DiseaseRiskLevelId,
DiseaseRiskLevelName = s.DiseaseRiskLevelName,
Explain = s.Explain,
Suggestion = s.Suggestion,
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result,
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result
}).OrderBy(o => o.DisplayOrder).ToList();
return entdto;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save