Browse Source

预约计划

master
wxd 1 year ago
parent
commit
f4b3769226
  1. 5
      src/Shentun.WebPeis.Application.Contracts/AppointSchedules/CreateAppointScheduleWithDetailInputDto.cs
  2. 14
      src/Shentun.WebPeis.Application.Contracts/AppointSchedules/GetAppointScheduleListInputDto.cs
  3. 14
      src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
  4. 2
      src/Shentun.WebPeis.Domain/AppointScheduleTemplates/AppointScheduleTemplateManager.cs
  5. 8
      src/Shentun.WebPeis.Domain/Models/AppointSchedule.cs
  6. 5
      src/Shentun.WebPeis.Domain/Models/AppointScheduleTemplate.cs
  7. 4
      src/Shentun.WebPeis.Domain/Models/AppointScheduleTime.cs

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

@ -6,6 +6,11 @@ namespace Shentun.WebPeis.AppointSchedules
{ {
public class CreateAppointScheduleWithDetailInputDto public class CreateAppointScheduleWithDetailInputDto
{ {
/// <summary>
/// 体检中心ID
/// </summary>
public Guid MedicalCenterId { get; set; }
/// <summary> /// <summary>
/// 开始日期 /// 开始日期
/// </summary> /// </summary>

14
src/Shentun.WebPeis.Application.Contracts/AppointSchedules/GetAppointScheduleListInputDto.cs

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.WebPeis.AppointSchedules
{
public class GetAppointScheduleListInputDto
{
/// <summary>
/// 体检中心ID
/// </summary>
public Guid MedicalCenterId { get; set; }
}
}

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

@ -56,13 +56,13 @@ namespace Shentun.WebPeis.AppointSchedules
[HttpPost("api/app/AppointSchedule/GetAppointScheduleDateList")] [HttpPost("api/app/AppointSchedule/GetAppointScheduleDateList")]
public async Task<List<AppointScheduleDateDto>> GetAppointScheduleDateListAsync(MedicalCenterIdInputDto input) public async Task<List<AppointScheduleDateDto>> GetAppointScheduleDateListAsync(MedicalCenterIdInputDto input)
{ {
Guid medicalCenterId ;
if (input == null || input.MedicalCenterId == Guid.Empty || input.MedicalCenterId == null)
Guid medicalCenterId;
if (input == null || input.MedicalCenterId == Guid.Empty || input.MedicalCenterId == null)
{ {
var webPeisOrganizationUnit = await _webPeisOrganizationUnitManager.GetMedicalCenterListAsync(); var webPeisOrganizationUnit = await _webPeisOrganizationUnitManager.GetMedicalCenterListAsync();
if (webPeisOrganizationUnit.Count > 1 || webPeisOrganizationUnit.Count == 0) if (webPeisOrganizationUnit.Count > 1 || webPeisOrganizationUnit.Count == 0)
{ {
throw new UserFriendlyException("体检中心参数不能为空");
throw new UserFriendlyException("体检中心参数不能为空");
} }
medicalCenterId = webPeisOrganizationUnit.First().Id; medicalCenterId = webPeisOrganizationUnit.First().Id;
} }
@ -122,7 +122,7 @@ namespace Shentun.WebPeis.AppointSchedules
} }
/// <summary> /// <summary>
@ -139,7 +139,7 @@ namespace Shentun.WebPeis.AppointSchedules
//所有日期 //所有日期
List<DateTime> dateTimes = DataHelper.GetAllDatesWithinRange(startDate, endDate); List<DateTime> dateTimes = DataHelper.GetAllDatesWithinRange(startDate, endDate);
var appointScheduleTemplateList = await _appointScheduleTemplateRepository.GetListAsync();
var appointScheduleTemplateList = await _appointScheduleTemplateRepository.GetListAsync(m => m.MedicalCenterId == input.MedicalCenterId);
foreach (var dateTime in dateTimes) foreach (var dateTime in dateTimes)
{ {
@ -403,9 +403,9 @@ namespace Shentun.WebPeis.AppointSchedules
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost("api/app/AppointSchedule/GetAppointScheduleNumberLimitList")] [HttpPost("api/app/AppointSchedule/GetAppointScheduleNumberLimitList")]
public async Task<List<AppointScheduleDto>> GetAppointScheduleListAsync()
public async Task<List<AppointScheduleDto>> GetAppointScheduleListAsync(GetAppointScheduleListInputDto input)
{ {
var entList = await _appointScheduleRepository.GetQueryableAsync();
var entList = (await _appointScheduleRepository.GetQueryableAsync()).Where(m => m.MedicalCenterId == input.MedicalCenterId);
var entListDto = entList.Select(s => new AppointScheduleDto var entListDto = entList.Select(s => new AppointScheduleDto
{ {
AmNumberLimit = s.AmNumberLimit, AmNumberLimit = s.AmNumberLimit,

2
src/Shentun.WebPeis.Domain/AppointScheduleTemplates/AppointScheduleTemplateManager.cs

@ -38,7 +38,7 @@ namespace Shentun.WebPeis.AppointScheduleTemplates
{ {
DataHelper.CheckEntityIsNull(entity); DataHelper.CheckEntityIsNull(entity);
var isWeekId = await _appointScheduleTemplateRepository.FirstOrDefaultAsync(f => f.WeekId == entity.WeekId);
var isWeekId = await _appointScheduleTemplateRepository.FirstOrDefaultAsync(f => f.WeekId == entity.WeekId && f.MedicalCenterId == entity.MedicalCenterId);
if (isWeekId != null) if (isWeekId != null)
throw new UserFriendlyException($"WeekId数据已存在,不能重复"); throw new UserFriendlyException($"WeekId数据已存在,不能重复");
return new AppointScheduleTemplate return new AppointScheduleTemplate

8
src/Shentun.WebPeis.Domain/Models/AppointSchedule.cs

@ -23,24 +23,26 @@ public partial class AppointSchedule : AuditedEntity, IHasConcurrencyStamp
/// 下午数量限制 /// 下午数量限制
/// </summary> /// </summary>
public int PmNumberLimit { get; set; } public int PmNumberLimit { get; set; }
/// <summary> /// <summary>
/// 个人体检数量限制 /// 个人体检数量限制
/// </summary> /// </summary>
public int SingleNumberLimit { get; set; } public int SingleNumberLimit { get; set; }
public string ConcurrencyStamp { get; set; } public string ConcurrencyStamp { get; set; }
/// <summary> /// <summary>
/// 主键 /// 主键
/// </summary> /// </summary>
public Guid AppointScheduleId { get; set; } public Guid AppointScheduleId { get; set; }
/// <summary>
/// 体检中心ID
/// </summary>
public Guid MedicalCenterId { get; set; } public Guid MedicalCenterId { get; set; }
public virtual ICollection<AppointScheduleTime> AppointScheduleTimes { get; set; } = new List<AppointScheduleTime>(); public virtual ICollection<AppointScheduleTime> AppointScheduleTimes { get; set; } = new List<AppointScheduleTime>();
public override object?[] GetKeys()
public override object[] GetKeys()
{ {
return [AppointScheduleId]; return [AppointScheduleId];
} }

5
src/Shentun.WebPeis.Domain/Models/AppointScheduleTemplate.cs

@ -57,11 +57,14 @@ public class AppointScheduleTemplate : AuditedEntity, IHasConcurrencyStamp, ID
public int DisplayOrder { get; set; } public int DisplayOrder { get; set; }
/// <summary>
/// 体检中心ID
/// </summary>
public Guid MedicalCenterId { get; set; } public Guid MedicalCenterId { get; set; }
public string? ConcurrencyStamp { get; set; } public string? ConcurrencyStamp { get; set; }
public override object?[] GetKeys()
public override object[] GetKeys()
{ {
return [AppointScheduleTemplateId]; return [AppointScheduleTemplateId];
} }

4
src/Shentun.WebPeis.Domain/Models/AppointScheduleTime.cs

@ -41,9 +41,9 @@ public partial class AppointScheduleTime : AuditedEntity, IHasConcurrencyStamp
public Guid AppointScheduleId { get; set; } public Guid AppointScheduleId { get; set; }
public virtual AppointSchedule? AppointSchedule { get; set; }
public virtual AppointSchedule AppointSchedule { get; set; }
public override object?[] GetKeys()
public override object[] GetKeys()
{ {
return [AppointScheduleTimeId]; return [AppointScheduleTimeId];
} }

Loading…
Cancel
Save