Browse Source

人寿预约增加字段

master
wxd 8 months ago
parent
commit
438a6ba842
  1. 10
      src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs
  2. 32
      src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs
  3. 27
      src/Shentun.Peis.Domain/CacheService.cs

10
src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs

@ -87,5 +87,15 @@ namespace Shentun.Peis.ThirdBookings
/// 单位ID /// 单位ID
/// </summary> /// </summary>
public Guid? CustomerOrgId { get; set; } public Guid? CustomerOrgId { get; set; }
/// <summary>
/// 单位名称
/// </summary>
public string CustomerOrgName { get; set; }
/// <summary>
/// 单位分组名称
/// </summary>
public string CustomerOrgGroupName { get; set; }
} }
} }

32
src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs

@ -28,15 +28,17 @@ namespace Shentun.Peis.ThirdBookings
private readonly IRepository<ThirdBooking, Guid> _thirdBookingRepository; private readonly IRepository<ThirdBooking, Guid> _thirdBookingRepository;
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository;
private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository; private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository;
private readonly CacheService _cacheService;
public ThirdBookingAppService( public ThirdBookingAppService(
IRepository<ThirdBooking, Guid> thirdBookingRepository, IRepository<ThirdBooking, Guid> thirdBookingRepository,
IRepository<ThirdInterface, Guid> thirdInterfaceRepository, IRepository<ThirdInterface, Guid> thirdInterfaceRepository,
IRepository<CustomerOrg, Guid> customerOrgRepository)
IRepository<CustomerOrg, Guid> customerOrgRepository,
CacheService cacheService)
{ {
_thirdBookingRepository = thirdBookingRepository; _thirdBookingRepository = thirdBookingRepository;
_thirdInterfaceRepository = thirdInterfaceRepository; _thirdInterfaceRepository = thirdInterfaceRepository;
_customerOrgRepository = customerOrgRepository; _customerOrgRepository = customerOrgRepository;
_cacheService = cacheService;
} }
@ -85,7 +87,10 @@ namespace Shentun.Peis.ThirdBookings
if (!string.IsNullOrWhiteSpace(input.KeyWord)) if (!string.IsNullOrWhiteSpace(input.KeyWord))
{ {
query = query.Where(m => m.PatientName == input.KeyWord query = query.Where(m => m.PatientName == input.KeyWord
|| m.IdNo == input.KeyWord || m.Phone == input.KeyWord);
|| m.IdNo == input.KeyWord
|| m.Phone == input.KeyWord
|| m.ChildCompanyName == input.KeyWord
|| m.DepartmentName == input.KeyWord);
} }
if (input.MedicalStatus != null) if (input.MedicalStatus != null)
{ {
@ -108,9 +113,28 @@ namespace Shentun.Peis.ThirdBookings
ChildCompanyName = s.ChildCompanyName, ChildCompanyName = s.ChildCompanyName,
DepartmentName = s.DepartmentName, DepartmentName = s.DepartmentName,
CustomerOrgId = GetCustomerOrgId(customerOrgList, customerOrgId, s.ChildCompanyName, s.DepartmentName), CustomerOrgId = GetCustomerOrgId(customerOrgList, customerOrgId, s.ChildCompanyName, s.DepartmentName),
CustomerOrgRegisterId = customerOrgRegisterId,
CustomerOrgRegisterId = customerOrgRegisterId
}).ToList(); }).ToList();
foreach (var item in entListDto)
{
Guid customerOrgGroupId;
if (!Guid.TryParse(item.CustomerOrgGroupId, out customerOrgGroupId))
{
customerOrgGroupId = Guid.Empty;
}
if (customerOrgGroupId != Guid.Empty)
{
item.CustomerOrgGroupName = _cacheService.GetCustomerOrgGroupAsync(customerOrgGroupId).GetAwaiter().GetResult().DisplayName;
}
if (item.CustomerOrgId != null && item.CustomerOrgId != Guid.Empty)
{
item.CustomerOrgName = _cacheService.GetCustomerOrgAsync(item.CustomerOrgId.Value).GetAwaiter().GetResult().DisplayName;
}
}
return entListDto; return entListDto;
} }

27
src/Shentun.Peis.Domain/CacheService.cs

@ -62,6 +62,9 @@ namespace Shentun.Peis
private readonly IMemoryCache _userExtensionCache; private readonly IMemoryCache _userExtensionCache;
private readonly IRepository<CustomerOrgGroup, Guid> _customerOrgGroupRepository;
private readonly IDistributedCache<CustomerOrgGroup, Guid> _customerOrgGroupCache;
public CacheService( public CacheService(
IDistributedCache<IdentityUser, Guid> userCache, IDistributedCache<IdentityUser, Guid> userCache,
IMemoryCache customerOrgCache, IMemoryCache customerOrgCache,
@ -92,7 +95,9 @@ namespace Shentun.Peis
IDistributedCache<string, string> customerOrgDisplayModeCache, IDistributedCache<string, string> customerOrgDisplayModeCache,
IDistributedCache<DiagnosisLevel, short> diagnosisLevelCache, IDistributedCache<DiagnosisLevel, short> diagnosisLevelCache,
IRepository<DiagnosisLevel, short> diagnosisLevelRepository, IRepository<DiagnosisLevel, short> diagnosisLevelRepository,
IMemoryCache userExtensionCache)
IMemoryCache userExtensionCache,
IRepository<CustomerOrgGroup, Guid> customerOrgGroupRepository,
IDistributedCache<CustomerOrgGroup, Guid> customerOrgGroupCache)
{ {
_userCache = userCache; _userCache = userCache;
_userRepository = userRepository; _userRepository = userRepository;
@ -134,6 +139,8 @@ namespace Shentun.Peis
_diagnosisLevelCache = diagnosisLevelCache; _diagnosisLevelCache = diagnosisLevelCache;
_diagnosisLevelRepository = diagnosisLevelRepository; _diagnosisLevelRepository = diagnosisLevelRepository;
_userExtensionCache = userExtensionCache; _userExtensionCache = userExtensionCache;
_customerOrgGroupRepository = customerOrgGroupRepository;
_customerOrgGroupCache = customerOrgGroupCache;
} }
private async Task<IdentityUser> GetUserAsync(Guid id) private async Task<IdentityUser> GetUserAsync(Guid id)
@ -728,5 +735,23 @@ namespace Shentun.Peis
} }
/// <summary>
/// 获取单位分组
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<CustomerOrgGroup> GetCustomerOrgGroupAsync(Guid id)
{
var entity = (CustomerOrgGroup)_customerOrgGroupCache.Get(id);
if (entity == null)
{
entity = await _customerOrgGroupRepository.GetAsync(o => o.Id == id);
_customerOrgGroupCache.Set(id, entity);
}
return entity;
}
} }
} }
Loading…
Cancel
Save