From 3a4cb5ebee6d76bd3a1aa3d9670dab728c1010b4 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 22 Aug 2024 17:50:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CriticalFollowValueTypeDto.cs | 29 +++++++ .../CriticalFollowValueTypeIdInputDto.cs | 11 +++ .../CriticalFollowValueTypeAppService.cs | 72 ++++++++++++++++++ .../BasicCustomerOrgGroupDto.cs | 18 +++++ .../CustomerOrgGroupAppService.cs | 75 +++++++++++++------ .../PatientRegisterAppService.cs | 13 ++-- .../CriticalFollowValueType.cs | 2 + 7 files changed, 191 insertions(+), 29 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeIdInputDto.cs create mode 100644 src/Shentun.Peis.Application/CriticalFollowValueTypes/CriticalFollowValueTypeAppService.cs create mode 100644 src/Shentun.Peis.Application/CustomerOrgGroups/BasicCustomerOrgGroupDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeDto.cs b/src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeDto.cs new file mode 100644 index 0000000..e12cd2b --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeDto.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Shentun.Peis.CriticalFollowValueTypes +{ + public class CriticalFollowValueTypeDto:AuditedEntityDtoName + { + /// + /// 名称 + /// + public string DisplayName { get; set; } + + /// + /// 父编号 + /// + public Guid ParentId { get; set; } + + /// + /// 路径编码 + /// + public string PathCode { get; set; } + + + public int DisplayOrder { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeIdInputDto.cs new file mode 100644 index 0000000..66e2878 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/CriticalFollowValueTypes/CriticalFollowValueTypeIdInputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.CriticalFollowValueTypes +{ + public class CriticalFollowValueTypeIdInputDto + { + public Guid CriticalFollowValueTypeId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/CriticalFollowValueTypes/CriticalFollowValueTypeAppService.cs b/src/Shentun.Peis.Application/CriticalFollowValueTypes/CriticalFollowValueTypeAppService.cs new file mode 100644 index 0000000..77f7497 --- /dev/null +++ b/src/Shentun.Peis.Application/CriticalFollowValueTypes/CriticalFollowValueTypeAppService.cs @@ -0,0 +1,72 @@ +using AutoMapper.Internal.Mappers; +using Microsoft.AspNetCore.Mvc; +using Shentun.Peis.ItemTypes; +using Shentun.Peis.Models; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; + +namespace Shentun.Peis.CriticalFollowValueTypes +{ + public class CriticalFollowValueTypeAppService : ApplicationService + { + private readonly IRepository _criticalFollowValueTypeRepository; + private readonly CacheService _cacheService; + + + public CriticalFollowValueTypeAppService( + IRepository criticalFollowValueTypeRepository, + CacheService cacheService) + { + _criticalFollowValueTypeRepository = criticalFollowValueTypeRepository; + _cacheService = cacheService; + } + + /// + /// 根据ID查询信息 + /// + /// + /// + [HttpPost("api/app/CriticalFollowValueType/Get")] + public async Task GetAsync(CriticalFollowValueTypeIdInputDto input) + { + var entity = await _criticalFollowValueTypeRepository.FindAsync(o => o.Id == input.CriticalFollowValueTypeId); + if (entity == null) + return null; + var entDto = ObjectMapper.Map(entity); + entDto.CreatorName = await _cacheService.GetSurnameAsync(entDto.CreatorId); + entDto.LastModifierName = await _cacheService.GetSurnameAsync(entDto.LastModifierId); + return entDto; + } + + ///// + ///// 更新 + ///// + ///// + ///// + //[HttpPost("api/app/CriticalFollowValueType/Update")] + //public override async Task UpdateAsync(UpdateCriticalFollowValueTypeDto input) + //{ + // var entity = await Repository.GetAsync(id); + // var sourceEntity = ObjectMapper.Map(input); + // await _manager.UpdateAsync(sourceEntity, entity); + // entity = await Repository.UpdateAsync(entity); + // _itemTypeCache.Set(entity.Id, entity); + // return ObjectMapper.Map(entity); + //} + ///// + ///// 删除 + ///// + ///// + ///// + //public override async Task DeleteAsync(Guid id) + //{ + // await _manager.CheckAndDeleteAsync(id); + //} + } +} diff --git a/src/Shentun.Peis.Application/CustomerOrgGroups/BasicCustomerOrgGroupDto.cs b/src/Shentun.Peis.Application/CustomerOrgGroups/BasicCustomerOrgGroupDto.cs new file mode 100644 index 0000000..d01f279 --- /dev/null +++ b/src/Shentun.Peis.Application/CustomerOrgGroups/BasicCustomerOrgGroupDto.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Shentun.Peis.CustomerOrgGroups +{ + public class BasicCustomerOrgGroupDto + { + public Guid Id { get; set; } + + /// + /// 分组名称 + /// + public string DisplayName { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs b/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs index 1fd0f49..a514609 100644 --- a/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs +++ b/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Shentun.Peis.Asbitems; using Shentun.Peis.CustomerOrgGroupDetails; using Shentun.Peis.CustomerOrgGroups; using Shentun.Peis.CustomerOrgRegisters; @@ -43,6 +44,8 @@ namespace Shentun.Peis.CustomerOrgGroups private readonly CustomerOrgGroupManager _manager; private readonly CacheService _cacheService; private readonly CustomerOrgGroupDetailManager _customerOrgGroupDetailManager; + private readonly IRepository _customerOrgRepository; + public CustomerOrgGroupAppService( IRepository repository, IRepository customerOrgRegisterRepository, @@ -50,7 +53,8 @@ namespace Shentun.Peis.CustomerOrgGroups IRepository userRepository, CustomerOrgGroupManager manager, CacheService cacheService, - CustomerOrgGroupDetailManager customerOrgGroupDetailManager) + CustomerOrgGroupDetailManager customerOrgGroupDetailManager, + IRepository customerOrgRepository) : base(repository) { this._customerOrgRegisterRepository = customerOrgRegisterRepository; @@ -59,6 +63,7 @@ namespace Shentun.Peis.CustomerOrgGroups _manager = manager; _cacheService = cacheService; _customerOrgGroupDetailManager = customerOrgGroupDetailManager; + _customerOrgRepository = customerOrgRepository; } /// /// 获取通过主键 @@ -158,43 +163,49 @@ namespace Shentun.Peis.CustomerOrgGroups [HttpPost("api/app/CustomerOrgGroup/GetListForPatentRegisterByFilter")] public async Task> GetListForPatentRegisterByFilterAsync(GetListDto input) { - - var oldlist = (await Repository.GetQueryableAsync()). - Include(x => x.CustomerOrgRegister). - Include(x => x.CustomerOrgRegister.CustomerOrg).AsEnumerable(); + var oldlist = from customerOrgGroup in await Repository.GetQueryableAsync() + join customerOrgRegister in await _customerOrgRegisterRepository.GetQueryableAsync() on customerOrgGroup.CustomerOrgRegisterId equals customerOrgRegister.Id + join customerOrg in await _customerOrgRepository.GetQueryableAsync() on customerOrgRegister.CustomerOrgId equals customerOrg.Id + select new + { + customerOrgGroup, + customerOrgRegister, + customerOrg + }; if (!string.IsNullOrEmpty(input.Filter)) - oldlist = oldlist.Where(m => m.DisplayName.Contains(input.Filter)); + oldlist = oldlist.Where(m => m.customerOrgGroup.DisplayName.Contains(input.Filter)); if (input.CustomerOrgId != null && input.CustomerOrgId != Guid.Empty) - oldlist = oldlist.Where(m => m.CustomerOrgRegister.CustomerOrg.Id == input.CustomerOrgId); + oldlist = oldlist.Where(m => m.customerOrgRegister.CustomerOrg.Id == input.CustomerOrgId); if (input.CustomerOrgRegisterId != null && input.CustomerOrgRegisterId != Guid.Empty) - oldlist = oldlist.Where(m => m.CustomerOrgRegisterId == input.CustomerOrgRegisterId); + oldlist = oldlist.Where(m => m.customerOrgGroup.CustomerOrgRegisterId == input.CustomerOrgRegisterId); if (input.MedicalTimes != null) - oldlist = oldlist.Where(m => m.CustomerOrgRegister.MedicalTimes == input.MedicalTimes); + oldlist = oldlist.Where(m => m.customerOrgRegister.MedicalTimes == input.MedicalTimes); - var entdto = oldlist.OrderBy(o => o.CustomerOrgRegister.CustomerOrg.DisplayOrder) - .ThenBy(o => o.CustomerOrgRegister.MedicalTimes) - .ThenBy(o => o.DisplayOrder) + + var entdto = oldlist.OrderBy(o => o.customerOrg.DisplayOrder) + .ThenBy(o => o.customerOrgRegister.MedicalTimes) + .ThenBy(o => o.customerOrgGroup.DisplayOrder) .Select(s => new CustomerOrgGroupForPatientRegisterDto { - Id = s.Id, - DisplayName = s.DisplayName, - DisplayOrder = s.DisplayOrder, - Price = s.Price, - ForSexId = s.ForSexId, - MaritalStatusId = s.MaritalStatusId, - JobTitle = s.JobTitle, - JobPost = s.JobPost, - AgeUpperLimit = s.AgeUpperLimit, - AgeLowerLimit = s.AgeLowerLimit, - CustomerOrgRegisterId = s.CustomerOrgRegisterId + Id = s.customerOrgGroup.Id, + DisplayName = s.customerOrgGroup.DisplayName, + DisplayOrder = s.customerOrgGroup.DisplayOrder, + Price = s.customerOrgGroup.Price, + ForSexId = s.customerOrgGroup.ForSexId, + MaritalStatusId = s.customerOrgGroup.MaritalStatusId, + JobTitle = s.customerOrgGroup.JobTitle, + JobPost = s.customerOrgGroup.JobPost, + AgeUpperLimit = s.customerOrgGroup.AgeUpperLimit, + AgeLowerLimit = s.customerOrgGroup.AgeLowerLimit, + CustomerOrgRegisterId = s.customerOrgGroup.CustomerOrgRegisterId }).OrderBy(m => m.DisplayOrder).ToList(); - + return entdto; @@ -518,5 +529,21 @@ namespace Shentun.Peis.CustomerOrgGroups throw new UserFriendlyException("上一次单位体检次数不存在"); } } + + /// + /// 获取所有单位分组列表 精简版 + /// + /// + [HttpPost("api/app/CustomerOrgGroup/GetBasicList")] + public async Task> GetBasicListAsync() + { + var query = await Repository.GetQueryableAsync(); + var entdto = query.OrderBy(o => o.DisplayOrder).Select(s => new BasicCustomerOrgGroupDto + { + DisplayName = s.DisplayName, + Id = s.Id + }).ToList(); + return entdto; + } } } diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index d706e00..a06a4f9 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -458,7 +458,7 @@ namespace Shentun.Peis.PatientRegisters [HttpPost("api/app/patientregister/getlistinfilter")] public async Task> GetListInFilterAsync(GetListInSearchDto input) { - var customerOrgList = await _customerOrgRepository.GetListAsync(); + //var customerOrgList = await _customerOrgRepository.GetListAsync(); @@ -624,14 +624,17 @@ namespace Shentun.Peis.PatientRegisters Remark3 = s.patientRegisterExterHaveEmpty != null ? s.patientRegisterExterHaveEmpty.Remark3 : null, Remark4 = s.patientRegisterExterHaveEmpty != null ? s.patientRegisterExterHaveEmpty.Remark4 : null, UploadQztlFlag = s.patientRegisterExterHaveEmpty != null ? s.patientRegisterExterHaveEmpty.UploadQztlFlag : null, - CustomerOrgName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, s.patientRegister.CustomerOrgId), - CustomerOrgParentId = EntityHelper.GetParentNoSql(customerOrgList, s.patientRegister.CustomerOrgId), - CustomerOrgParentName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, s.patientRegister.CustomerOrgId) + //CustomerOrgName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, s.patientRegister.CustomerOrgId), + //CustomerOrgParentId = EntityHelper.GetParentNoSql(customerOrgList, s.patientRegister.CustomerOrgId), + //CustomerOrgParentName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, s.patientRegister.CustomerOrgId) + CustomerOrgName = _cacheService.GetCustomerOrgNameAsync(s.patientRegister.CustomerOrgId).Result, + CustomerOrgParentId = _cacheService.GetTopCustomerOrgAsync(s.patientRegister.CustomerOrgId).Result.Id, + CustomerOrgParentName = _cacheService.GetTopCustomerOrgNameAsync(s.patientRegister.CustomerOrgId).Result }).ToList(); return new PagedResultDto(totalCount, entdto); - + } diff --git a/src/Shentun.Peis.Domain/CriticalFollowValueTypes/CriticalFollowValueType.cs b/src/Shentun.Peis.Domain/CriticalFollowValueTypes/CriticalFollowValueType.cs index cc78502..22ca5e7 100644 --- a/src/Shentun.Peis.Domain/CriticalFollowValueTypes/CriticalFollowValueType.cs +++ b/src/Shentun.Peis.Domain/CriticalFollowValueTypes/CriticalFollowValueType.cs @@ -39,6 +39,8 @@ namespace Shentun.Peis.Models [Column("path_code")] [StringLength(50)] public string PathCode { get; set; } = null!; + + [Column("display_order")] public int DisplayOrder { get; set; }