Browse Source

预约

master
wxd 12 months ago
parent
commit
2056d3a684
  1. 24
      src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetCustomerOrgThreeListDto.cs
  2. 14
      src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetExcludeCustomerOrgListDto.cs
  3. 87
      src/Shentun.WebPeis.Application/AppointScheduleExcludeCustomerOrgs/AppointScheduleExcludeCustomerOrgAppService.cs
  4. 61
      src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
  5. 2
      src/Shentun.WebPeis.Application/Persons/PersonAppService.cs

24
src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetCustomerOrgThreeListDto.cs

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
{
public class GetCustomerOrgThreeListDto
{
//组织Id
public Guid CustomerOrgId { get; set; }
//组织名称
public string CustomerOrgName { get; set; }
//父节点Id
public Guid? ParentId { get; set; }
/// <summary>
/// 用来做递归的 新用法
/// </summary>
public string Code { get; set; }
public int DisplayOrder { get; set; }
public List<GetCustomerOrgThreeListDto> TreeChildren { get; set; }
}
}

14
src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetExcludeCustomerOrgListDto.cs

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
{
public class GetExcludeCustomerOrgListDto
{
/// <summary>
/// 单位Id
/// </summary>
public Guid CustomerOrgId { get; set; }
}
}

87
src/Shentun.WebPeis.Application/AppointScheduleExcludeCustomerOrgs/AppointScheduleExcludeCustomerOrgAppService.cs

@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Shentun.WebPeis.AppointSchedules;
using Shentun.WebPeis.Enums;
using Shentun.WebPeis.Models;
using System;
using System.Collections.Generic;
@ -20,11 +22,13 @@ namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
public class AppointScheduleExcludeCustomerOrgAppService : ApplicationService
{
private readonly IRepository<AppointScheduleExcludeCustomerOrg> _appointScheduleExcludeCustomerOrgRepository;
private readonly IRepository<CustomerOrg> _customerOrgRepository;
public AppointScheduleExcludeCustomerOrgAppService(
IRepository<AppointScheduleExcludeCustomerOrg> appointScheduleExcludeCustomerOrgRepository
)
IRepository<AppointScheduleExcludeCustomerOrg> appointScheduleExcludeCustomerOrgRepository,
IRepository<CustomerOrg> customerOrgRepository)
{
_appointScheduleExcludeCustomerOrgRepository = appointScheduleExcludeCustomerOrgRepository;
_customerOrgRepository = customerOrgRepository;
}
/// <summary>
@ -62,5 +66,84 @@ namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
await _appointScheduleExcludeCustomerOrgRepository.InsertManyAsync(appointScheduleExcludeCustomerOrgs);
}
}
/// <summary>
/// 查询预约计划对应的禁止单位
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/AppointScheduleExcludeCustomerOrg/GetExcludeCustomerOrgList")]
public async Task<List<GetExcludeCustomerOrgListDto>> GetExcludeCustomerOrgListAsync(AppointScheduleIdInputDto input)
{
if (input.AppointScheduleId == Guid.Empty)
{
throw new UserFriendlyException("预约计划ID不能为空");
}
//删除
var entListDto = (await _appointScheduleExcludeCustomerOrgRepository.GetListAsync(d => d.AppointScheduleId == input.AppointScheduleId))
.Select(s => new GetExcludeCustomerOrgListDto
{
CustomerOrgId = s.CustomerOrgId
}).ToList();
return entListDto;
}
/// <summary>
/// 获取单位树型结构
/// </summary>
/// <returns></returns>
[HttpPost("api/app/AppointScheduleExcludeCustomerOrg/GetCustomerOrgThreeList")]
public async Task<List<GetCustomerOrgThreeListDto>> GetCustomerOrgThreeListAsync()
{
List<GetCustomerOrgThreeListDto> result = new List<GetCustomerOrgThreeListDto>();
var customerOrgList = await _customerOrgRepository.GetListAsync(m => m.CustomerOrgId != GuidFlag.PersonCustomerOrgId);
var items = from p in customerOrgList.OrderByDescending(o => o.DisplayOrder).AsParallel()
select new GetCustomerOrgThreeListDto()
{
CustomerOrgId = p.CustomerOrgId,
ParentId = p.ParentId,
Code = p.PathCode,
CustomerOrgName = p.CustomerOrgName,
DisplayOrder = p.DisplayOrder,
TreeChildren = new List<GetCustomerOrgThreeListDto>()
};
var customerOrgTreeChildList = GetTree(items.ToList(), null);
result.AddRange(customerOrgTreeChildList);
return result;
}
/// <summary>
/// 使用parentId进行递归
/// </summary>
/// <param name="items"></param>
/// <param name="parentId"></param>
/// <returns></returns>
private List<GetCustomerOrgThreeListDto> GetTree(List<GetCustomerOrgThreeListDto> items, Guid? parentId)
{
return (from p in items.AsParallel()
where p.ParentId == parentId
let subs = GetTree(items, p.CustomerOrgId)
select new GetCustomerOrgThreeListDto()
{
CustomerOrgId = p.CustomerOrgId,
ParentId = p.ParentId,
Code = p.Code,
CustomerOrgName = p.CustomerOrgName,
DisplayOrder = p.DisplayOrder,
TreeChildren = subs.ToList()
}
).ToList();
}
}
}

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

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Nito.AsyncEx.Synchronous;
using Shentun.WebPeis.AppointScheduleTimes;
using Shentun.WebPeis.CustomerOrgs;
using Shentun.WebPeis.Models;
using Shentun.WebPeis.OrganizationUnits;
using Shentun.WebPeis.SysParmValues;
@ -31,7 +32,7 @@ namespace Shentun.WebPeis.AppointSchedules
private readonly SysParmValueManager _sysParmValueManager;
private readonly WebPeisOrganizationUnitManager _webPeisOrganizationUnitManager;
private readonly IRepository<AppointScheduleExcludeCustomerOrg> _appointScheduleExcludeCustomerOrgRepository;
private readonly IRepository<CustomerOrg> _customerOrgRepository;
public AppointScheduleAppService(IRepository<AppointSchedule> appointScheduleRepository,
CacheService cacheService,
AppointScheduleManager appointScheduleManager,
@ -41,7 +42,8 @@ namespace Shentun.WebPeis.AppointSchedules
SysParmValueManager sysParmValueManager,
WebPeisOrganizationUnitManager webPeisOrganizationUnitManager,
IRepository<AppointScheduleTemplateTime> appointScheduleTemplateTimeRepository,
IRepository<AppointScheduleExcludeCustomerOrg> appointScheduleExcludeCustomerOrgRepository)
IRepository<AppointScheduleExcludeCustomerOrg> appointScheduleExcludeCustomerOrgRepository,
IRepository<CustomerOrg> customerOrgRepository)
{
_appointScheduleRepository = appointScheduleRepository;
_cacheService = cacheService;
@ -53,6 +55,7 @@ namespace Shentun.WebPeis.AppointSchedules
_webPeisOrganizationUnitManager = webPeisOrganizationUnitManager;
_appointScheduleTemplateTimeRepository = appointScheduleTemplateTimeRepository;
_appointScheduleExcludeCustomerOrgRepository = appointScheduleExcludeCustomerOrgRepository;
_customerOrgRepository = customerOrgRepository;
}
/// <summary>
@ -120,8 +123,18 @@ namespace Shentun.WebPeis.AppointSchedules
bool isAdd = false;
if (input != null && input.CustomerOrgId != null)
{
if (appointScheduleExcludeCustomerOrgIds.FirstOrDefault(f => f.appointScheduleId == item.Key.AppointScheduleId
&& f.customerOrgId == input.CustomerOrgId) == null)
List<Guid?> customerOrgIds = new List<Guid?>();
var customerOrgIdList = appointScheduleExcludeCustomerOrgIds.Where(m => m.appointScheduleId == item.Key.AppointScheduleId);
if (customerOrgIdList.Any())
{
foreach (var customerOrgId in customerOrgIdList)
{
var customerOrgIdsTemp = await GetCustomerOrgChildrenId(input.CustomerOrgId.Value);
customerOrgIds.AddRange(customerOrgIdsTemp);
}
}
if (!customerOrgIds.Any() || !customerOrgIds.Contains(input.CustomerOrgId))
{
isAdd = true;
}
@ -147,14 +160,6 @@ namespace Shentun.WebPeis.AppointSchedules
//var list = appointSchedules.GroupBy(o => o.appointSchedule)
// .Select(x => new AppointScheduleDateDto()
// {
// AppointScheduleId = x.Key.AppointScheduleId,
// AppointDate = x.Key.AppointDate,
// IsWork = x.Key.IsWork,
// IsFull = x.Key.AppointScheduleTimes.Sum(m => m.NumberLimit) <= x.Key.AppointScheduleTimes.Sum(m => m.AppointNumber) ? 'Y' : 'N'
// }).ToList();
return entListDto;
}
@ -381,5 +386,37 @@ namespace Shentun.WebPeis.AppointSchedules
}
}
/// <summary>
/// 获取包含子级的ID
/// </summary>
/// <param name="CustomerOrgId"></param>
/// <returns></returns>
private async Task<List<Guid?>> GetCustomerOrgChildrenId(Guid CustomerOrgId)
{
var customerOrg = await _customerOrgRepository.GetAsync(g => g.CustomerOrgId == CustomerOrgId);
var customerOrgEntList = await _customerOrgRepository.GetListAsync(o => o.PathCode.StartsWith(customerOrg.PathCode));
List<Guid?> CustomerOrgIds = new List<Guid?>();
GetChildren(customerOrgEntList, CustomerOrgId, CustomerOrgIds);
return CustomerOrgIds;
}
private void GetChildren(List<CustomerOrg> customerOrgEntList, Guid CustomerOrgId, List<Guid?> CustomerOrgIds)
{
CustomerOrgIds.Add(CustomerOrgId);
var entlist = customerOrgEntList.Where(m => m.ParentId == CustomerOrgId).ToList();
if (entlist.Count > 0)
{
foreach (var ent in entlist)
{
GetChildren(customerOrgEntList, ent.CustomerOrgId, CustomerOrgIds);
}
}
}
}
}

2
src/Shentun.WebPeis.Application/Persons/PersonAppService.cs

@ -447,7 +447,6 @@ namespace Shentun.WebPeis.Persons
[HttpPost("api/app/Person/GetMedicalTimesListByPersonId")]
public async Task<List<PersonMedicalTimesDto>> GetMedicalTimesListByPersonIdAsync(PersonIdInputDto input)
{
var entityList = (from user in await _identityUserRepository.GetQueryableAsync()
join person in await _repository.GetQueryableAsync()
on user.Id equals person.PersonId
@ -483,6 +482,7 @@ namespace Shentun.WebPeis.Persons
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.RegisterCheckId equals registerCheckAsbitem.RegisterCheckId
join asbitem in await _asbitemRepository.GetQueryableAsync() on registerCheckAsbitem.AsbitemId equals asbitem.AsbitemId
where patientRegister.PatientRegisterId == input.PatientRegisterId
&& registerCheck.IsPacsCheck == 'Y'
select new
{
registerCheck.CheckRequestNo,

Loading…
Cancel
Save