From 1cc1166e95651ef5e75a32a8d8d75426c1238403 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Tue, 15 Oct 2024 10:14:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E6=98=BE=E7=A4=BA=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E8=AF=8D=E6=9D=A1=E5=8A=A0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=B1=BB=E5=88=AB=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BigtextResultTypeListInputDto.cs | 14 +++++ ...rCheckItemOrItemOrItemResultTemplateDto.cs | 5 ++ .../BigtextResultTypeAppService.cs | 10 +++- .../PatientRegisterAppService.cs | 20 +++---- .../RegisterCheckItemAppService.cs | 3 +- src/Shentun.Peis.Domain/CacheService.cs | 60 +++++++++++++++++-- 6 files changed, 94 insertions(+), 18 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/BigtextResultTypes/BigtextResultTypeListInputDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/BigtextResultTypes/BigtextResultTypeListInputDto.cs b/src/Shentun.Peis.Application.Contracts/BigtextResultTypes/BigtextResultTypeListInputDto.cs new file mode 100644 index 0000000..c4b39dd --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/BigtextResultTypes/BigtextResultTypeListInputDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.BigtextResultTypes +{ + public class BigtextResultTypeListInputDto + { + /// + /// 项目类别ID + /// + public string ItemTypeId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/RegisterCheckItems/RegisterCheckItemOrItemOrItemResultTemplateDto.cs b/src/Shentun.Peis.Application.Contracts/RegisterCheckItems/RegisterCheckItemOrItemOrItemResultTemplateDto.cs index e519d0f..1aa5b4b 100644 --- a/src/Shentun.Peis.Application.Contracts/RegisterCheckItems/RegisterCheckItemOrItemOrItemResultTemplateDto.cs +++ b/src/Shentun.Peis.Application.Contracts/RegisterCheckItems/RegisterCheckItemOrItemOrItemResultTemplateDto.cs @@ -153,5 +153,10 @@ namespace Shentun.Peis.RegisterCheckItems /// 输入结果校验公式 /// public string InputCheck { get; set; } + + /// + /// 项目类别ID + /// + public Guid ItemTypeId { get; set; } } } diff --git a/src/Shentun.Peis.Application/BigtextResultTypes/BigtextResultTypeAppService.cs b/src/Shentun.Peis.Application/BigtextResultTypes/BigtextResultTypeAppService.cs index 8b1cad8..9fad6f4 100644 --- a/src/Shentun.Peis.Application/BigtextResultTypes/BigtextResultTypeAppService.cs +++ b/src/Shentun.Peis.Application/BigtextResultTypes/BigtextResultTypeAppService.cs @@ -56,16 +56,20 @@ namespace Shentun.Peis.BigtextResultTypes return entityDto; } - /// /// 获取列表 /// + /// 可根据项目类别ID筛选 /// [HttpPost("api/app/BigtextResultType/GetList")] - public async Task> GetListAsync() + public async Task> GetListAsync(BigtextResultTypeListInputDto input) { - var query = await _bigtextResultTypeRepository.GetListAsync(); + var query = await _bigtextResultTypeRepository.GetQueryableAsync(); + if (!string.IsNullOrWhiteSpace(input.ItemTypeId)) + { + query = query.Where(m => m.ItemTypeId == Guid.Parse(input.ItemTypeId)); + } var entListDto = query.Select(s => new BigtextResultTypeDto { diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index a495d73..12d805c 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -829,27 +829,27 @@ namespace Shentun.Peis.PatientRegisters JobPost = ent.JobPost, JobTitle = ent.JobTitle, MaritalStatusId = ent.MaritalStatusId, - MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(ent.MaritalStatusId).Result, + MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(ent.MaritalStatusId).GetAwaiter().GetResult(), MedicalCardNo = ent.MedicalCardNo, MedicalConclusionId = ent.MedicalConclusionId, MedicalPackageId = ent.MedicalPackageId, MedicalStartDate = DataHelper.ConversionDateToString(ent.MedicalStartDate), MedicalTimes = ent.MedicalTimes, MedicalTypeId = ent.MedicalTypeId, - MedicalTypeName = _cacheService.GetMedicalTypeNameAsync(ent.MedicalTypeId).Result, + MedicalTypeName = _cacheService.GetMedicalTypeNameAsync(ent.MedicalTypeId).GetAwaiter().GetResult(), MedicalCenterId = ent.MedicalCenterId, PatientId = ent.PatientId, PatientName = ent.PatientName, PatientRegisterNo = ent.PatientRegisterNo, PersonnelTypeId = ent.PersonnelTypeId, - PersonnelTypeName = _cacheService.GetPersonnelTypeNameAsync(ent.PersonnelTypeId).Result, + PersonnelTypeName = _cacheService.GetPersonnelTypeNameAsync(ent.PersonnelTypeId).GetAwaiter().GetResult(), Remark = ent.Remark, ReportPrintTimes = ent.ReportPrintTimes, Salesman = ent.Salesman, SexHormoneTermId = ent.SexHormoneTermId, Photo = ent.Photo, - CreatorName = _cacheService.GetSurnameAsync(ent.CreatorId).Result, - LastModifierName = _cacheService.GetSurnameAsync(ent.LastModifierId).Result, + CreatorName = _cacheService.GetSurnameAsync(ent.CreatorId).GetAwaiter().GetResult(), + LastModifierName = _cacheService.GetSurnameAsync(ent.LastModifierId).GetAwaiter().GetResult(), Address = ent.Patient.Address, //档案表信息 BirthPlaceId = ent.Patient.BirthPlaceId, DisplayName = ent.Patient.DisplayName, @@ -857,14 +857,14 @@ namespace Shentun.Peis.PatientRegisters IdNo = ent.Patient.IdNo, MobileTelephone = ent.Patient.MobileTelephone, NationId = ent.Patient.NationId, - NationName = _cacheService.GetNationNameAsync(ent.Patient.NationId).Result, + NationName = _cacheService.GetNationNameAsync(ent.Patient.NationId).GetAwaiter().GetResult(), PatientNo = ent.Patient.PatientNo, PostalCode = ent.Patient.PostalCode, Telephone = ent.Patient.Telephone, - CustomerOrgName = _cacheService.GetCustomerOrgNameAsync(ent.CustomerOrgId).Result, - CustomerOrgParentId = _cacheService.GetTopCustomerOrgAsync(ent.CustomerOrgId).Result.Id, - CustomerOrgParentName = _cacheService.GetTopCustomerOrgAsync(ent.CustomerOrgId).Result.DisplayName, - IsPatientOccupationalDisease = _patientOccupationalDiseaseManager.GetPatientRegisterIsOccupationalDisease(ent.Id).Result + CustomerOrgName = _cacheService.GetCustomerOrgNameAsync(ent.CustomerOrgId).GetAwaiter().GetResult(), + CustomerOrgParentId = _cacheService.GetTopCustomerOrgAsync(ent.CustomerOrgId).GetAwaiter().GetResult().Id, + CustomerOrgParentName = _cacheService.GetTopCustomerOrgAsync(ent.CustomerOrgId).GetAwaiter().GetResult().DisplayName, + IsPatientOccupationalDisease = _patientOccupationalDiseaseManager.GetPatientRegisterIsOccupationalDisease(ent.Id).GetAwaiter().GetResult() }; return entdto; } diff --git a/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs b/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs index 9e0c306..2bcdfe5 100644 --- a/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs +++ b/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs @@ -187,7 +187,8 @@ namespace Shentun.Peis.RegisterCheckItems IsCriticalValueAudit = s.IsCriticalValueAudit, IsCriticalValuePhoneComplete = s.IsCriticalValuePhoneComplete, IsCriticalValueSmsComplete = s.IsCriticalValueSmsComplete, - IsReview = s.IsReview + IsReview = s.IsReview, + ItemTypeId = s.Item.ItemTypeId }).ToList(); return entdto; diff --git a/src/Shentun.Peis.Domain/CacheService.cs b/src/Shentun.Peis.Domain/CacheService.cs index ee1a98f..d7f358a 100644 --- a/src/Shentun.Peis.Domain/CacheService.cs +++ b/src/Shentun.Peis.Domain/CacheService.cs @@ -51,6 +51,9 @@ namespace Shentun.Peis private readonly SysParmValueManager _sysParmValueManager; + + private readonly IDistributedCache _customerOrgDisplayModeCache; + public CacheService( IDistributedCache userCache, IMemoryCache customerOrgCache, @@ -77,7 +80,8 @@ namespace Shentun.Peis IDistributedCache customerOrgTopNameCache, IDistributedCache sampleTypeCache, IRepository sampleTypeRepository, - SysParmValueManager sysParmValueManager) + SysParmValueManager sysParmValueManager, + IDistributedCache customerOrgDisplayModeCache) { _userCache = userCache; _userRepository = userRepository; @@ -115,6 +119,7 @@ namespace Shentun.Peis _sampleTypeCache = sampleTypeCache; _sampleTypeRepository = sampleTypeRepository; _sysParmValueManager = sysParmValueManager; + _customerOrgDisplayModeCache = customerOrgDisplayModeCache; } private async Task GetUserAsync(Guid id) @@ -353,9 +358,23 @@ namespace Shentun.Peis /// 获取一级单位 /// /// + /// 单位显示模式 0-显示一级单位 1-显示上一级单位 /// public async Task GetTopCustomerOrgAsync(Guid id) { + #region 获取单位显示模式 存缓存 + string customerOrgDisplayMode = _customerOrgDisplayModeCache.Get("customer_org_display_mode"); + if (string.IsNullOrWhiteSpace(customerOrgDisplayMode)) + { + customerOrgDisplayMode = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, "customer_org_display_mode"); + if (string.IsNullOrWhiteSpace(customerOrgDisplayMode)) + { + customerOrgDisplayMode = "0"; + } + _customerOrgDisplayModeCache.Set("customer_org_display_mode", customerOrgDisplayMode); + } + #endregion + var entity = (CustomerOrg)_customerOrgCache.Get(id); if (entity == null) { @@ -365,7 +384,21 @@ namespace Shentun.Peis if (entity.ParentId != null && entity.ParentId != Guid.Empty) { - entity = await GetTopCustomerOrgAsync((Guid)entity.ParentId); + Guid parentId = (Guid)entity.ParentId; + + if (customerOrgDisplayMode == "0") + { + entity = await GetTopCustomerOrgAsync(parentId); + } + else + { + entity = (CustomerOrg)_customerOrgCache.Get(parentId); + if (entity == null) + { + entity = await _customerOrgRepository.GetAsync(o => o.Id == parentId); + _customerOrgCache.Set(parentId, entity); + } + } } return entity; } @@ -478,6 +511,19 @@ namespace Shentun.Peis /// private async Task GetTopCustomerOrgNameInCustomerOrgIdAsync(Guid id) { + #region 获取单位显示模式 存缓存 + string customerOrgDisplayMode = _customerOrgDisplayModeCache.Get("customer_org_display_mode"); + if (string.IsNullOrWhiteSpace(customerOrgDisplayMode)) + { + customerOrgDisplayMode = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, "customer_org_display_mode"); + if (string.IsNullOrWhiteSpace(customerOrgDisplayMode)) + { + customerOrgDisplayMode = "0"; + } + _customerOrgDisplayModeCache.Set("customer_org_display_mode", customerOrgDisplayMode); + } + #endregion + var entity = (CustomerOrg)_customerOrgCache.Get(id); if (entity == null) { @@ -495,8 +541,14 @@ namespace Shentun.Peis return entity.DisplayName; } - entity = await _customerOrgRepository.GetAsync(o => o.PathCode == entity.PathCode.Substring(0, 5)); - + if (customerOrgDisplayMode == "0") + { + entity = await _customerOrgRepository.GetAsync(o => o.PathCode == entity.PathCode.Substring(0, 5)); + } + else + { + entity = await _customerOrgRepository.GetAsync(o => o.Id == entity.ParentId); + } return entity.DisplayName; }