From 438a6ba84271a468b75185d3deba8d34b43ca5f3 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Mon, 10 Mar 2025 17:47:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=AF=BF=E9=A2=84=E7=BA=A6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdBookings/GetThirdBookingListDto.cs | 10 ++++++ .../ThirdBookings/ThirdBookingAppService.cs | 32 ++++++++++++++++--- src/Shentun.Peis.Domain/CacheService.cs | 27 +++++++++++++++- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs b/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs index b2cc3a7..81489fc 100644 --- a/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs @@ -87,5 +87,15 @@ namespace Shentun.Peis.ThirdBookings /// 单位ID /// public Guid? CustomerOrgId { get; set; } + + /// + /// 单位名称 + /// + public string CustomerOrgName { get; set; } + + /// + /// 单位分组名称 + /// + public string CustomerOrgGroupName { get; set; } } } diff --git a/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs b/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs index 3719543..4b37886 100644 --- a/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs +++ b/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs @@ -28,15 +28,17 @@ namespace Shentun.Peis.ThirdBookings private readonly IRepository _thirdBookingRepository; private readonly IRepository _thirdInterfaceRepository; private readonly IRepository _customerOrgRepository; - + private readonly CacheService _cacheService; public ThirdBookingAppService( IRepository thirdBookingRepository, IRepository thirdInterfaceRepository, - IRepository customerOrgRepository) + IRepository customerOrgRepository, + CacheService cacheService) { _thirdBookingRepository = thirdBookingRepository; _thirdInterfaceRepository = thirdInterfaceRepository; _customerOrgRepository = customerOrgRepository; + _cacheService = cacheService; } @@ -85,7 +87,10 @@ namespace Shentun.Peis.ThirdBookings if (!string.IsNullOrWhiteSpace(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) { @@ -108,9 +113,28 @@ namespace Shentun.Peis.ThirdBookings ChildCompanyName = s.ChildCompanyName, DepartmentName = s.DepartmentName, CustomerOrgId = GetCustomerOrgId(customerOrgList, customerOrgId, s.ChildCompanyName, s.DepartmentName), - CustomerOrgRegisterId = customerOrgRegisterId, + CustomerOrgRegisterId = customerOrgRegisterId }).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; } diff --git a/src/Shentun.Peis.Domain/CacheService.cs b/src/Shentun.Peis.Domain/CacheService.cs index 4e9ed13..f856e36 100644 --- a/src/Shentun.Peis.Domain/CacheService.cs +++ b/src/Shentun.Peis.Domain/CacheService.cs @@ -62,6 +62,9 @@ namespace Shentun.Peis private readonly IMemoryCache _userExtensionCache; + private readonly IRepository _customerOrgGroupRepository; + private readonly IDistributedCache _customerOrgGroupCache; + public CacheService( IDistributedCache userCache, IMemoryCache customerOrgCache, @@ -92,7 +95,9 @@ namespace Shentun.Peis IDistributedCache customerOrgDisplayModeCache, IDistributedCache diagnosisLevelCache, IRepository diagnosisLevelRepository, - IMemoryCache userExtensionCache) + IMemoryCache userExtensionCache, + IRepository customerOrgGroupRepository, + IDistributedCache customerOrgGroupCache) { _userCache = userCache; _userRepository = userRepository; @@ -134,6 +139,8 @@ namespace Shentun.Peis _diagnosisLevelCache = diagnosisLevelCache; _diagnosisLevelRepository = diagnosisLevelRepository; _userExtensionCache = userExtensionCache; + _customerOrgGroupRepository = customerOrgGroupRepository; + _customerOrgGroupCache = customerOrgGroupCache; } private async Task GetUserAsync(Guid id) @@ -728,5 +735,23 @@ namespace Shentun.Peis } + + /// + /// 获取单位分组 + /// + /// + /// + public async Task 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; + } + } }