From b404e035fe98a1f2c24517f8cf0b0283afa6105f Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 16 May 2024 18:50:11 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=AF=BC=E5=9B=BE=E3=80=81=E5=88=A0?= =?UTF-8?q?=E5=9B=BE=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyUser/OrganizationUnitIdIuputDto.cs | 11 ++++ .../MyUser/MyUserAppService.cs | 36 ++++++++----- .../RegisterCheckPictureAppService.cs | 51 +++++++++++++++---- 3 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/MyUser/OrganizationUnitIdIuputDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/MyUser/OrganizationUnitIdIuputDto.cs b/src/Shentun.Peis.Application.Contracts/MyUser/OrganizationUnitIdIuputDto.cs new file mode 100644 index 0000000..4c1d5c0 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/MyUser/OrganizationUnitIdIuputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.MyUser +{ + public class OrganizationUnitIdIuputDto + { + public Guid? OrganizationUnitId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs index 99be9c7..6c3a2d9 100644 --- a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs +++ b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs @@ -59,7 +59,7 @@ namespace Shentun.Peis.MyUser private readonly IHttpClientFactory _httpClientFactory; private readonly IConfiguration _configuration; private readonly IRepository _organizationUnitRepository; - //private readonly IRepository _identityUserOrganizationUnitRepository; + private readonly IRepository _identityUserOrganizationUnitRepository; private readonly CurrentUser _currentUser; private readonly IDistributedCache _userCache; @@ -75,7 +75,7 @@ namespace Shentun.Peis.MyUser PeisOrganizationUnitManager peisOrganizationUnitManager, IHttpClientFactory httpClientFactory, IConfiguration configuration, - //IRepository identityUserOrganizationUnitRepository, + IRepository identityUserOrganizationUnitRepository, CurrentUser currentUser, IDistributedCache userCache) : base(userManager, @@ -93,7 +93,7 @@ namespace Shentun.Peis.MyUser this._httpClientFactory = httpClientFactory; this._configuration = configuration; this._organizationUnitRepository = organizationUnitRepository; - // this._identityUserOrganizationUnitRepository = identityUserOrganizationUnitRepository; + this._identityUserOrganizationUnitRepository = identityUserOrganizationUnitRepository; this._currentUser = currentUser; _userCache = userCache; } @@ -261,21 +261,29 @@ namespace Shentun.Peis.MyUser return base.GetListAsync(input); } /// - /// 获取列表 根据科室查询 - /// - /// 科室ID + /// 获取列表 根据科室查询 不传科室查所有 + /// + /// /// [Authorize(PeisPermissions.Users.Default)] - [HttpGet("api/identity/users/getlistinorganizationunit")] - public async Task> GetListInOrganizationUnitAsync(Guid OrganizationUnitId) + [HttpPost("api/identity/users/getlistinorganizationunit")] + public async Task> GetListInOrganizationUnitAsync(OrganizationUnitIdIuputDto input) { - if (OrganizationUnitId == Guid.Empty) + + List userList = new List(); + + var identityUserOrganizationUnitList = await _identityUserOrganizationUnitRepository.GetListAsync(); + + if (input.OrganizationUnitId != null && input.OrganizationUnitId != Guid.Empty) + { + List organizationUnitIds = await _peisOrganizationUnitManager.GetOrganizationUnitChildIds(input.OrganizationUnitId.Value); + userList = await _userRepository.GetUsersInOrganizationsListAsync(organizationUnitIds); + } + else { - throw new UserFriendlyException("参数有误"); + userList = await _identityUserRepository.GetListAsync(m => m.IsDeleted == false); } - List organizationUnitIds = await _peisOrganizationUnitManager.GetOrganizationUnitChildIds(OrganizationUnitId); - var entlist = await _userRepository.GetUsersInOrganizationsListAsync(organizationUnitIds); - var entlistdto = entlist.Select(s => new IdentityUserWithExtensionDto + var entlistdto = userList.Select(s => new IdentityUserWithExtensionDto { UserSign = s.GetProperty("user_sign"), UserPhoto = s.GetProperty("user_photo"), @@ -300,7 +308,7 @@ namespace Shentun.Peis.MyUser Surname = s.Surname, TenantId = s.TenantId, UserName = s.UserName, - OrganizationUnitId = OrganizationUnitId, + OrganizationUnitId = identityUserOrganizationUnitList.FirstOrDefault(m => m.UserId == s.Id).OrganizationUnitId, SimpleCode = LanguageConverter.GetPYSimpleCode(s.Surname) }).ToList(); diff --git a/src/Shentun.Peis.Application/RegisterCheckPictures/RegisterCheckPictureAppService.cs b/src/Shentun.Peis.Application/RegisterCheckPictures/RegisterCheckPictureAppService.cs index 1740d79..479731d 100644 --- a/src/Shentun.Peis.Application/RegisterCheckPictures/RegisterCheckPictureAppService.cs +++ b/src/Shentun.Peis.Application/RegisterCheckPictures/RegisterCheckPictureAppService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; +using Shentun.Peis.Enums; using Shentun.Peis.GuideTypes; using Shentun.Peis.Models; using System; @@ -26,6 +27,8 @@ namespace Shentun.Peis.RegisterCheckPictures private readonly IRepository _userRepository; private readonly IRepository _registerCheckPictureRepository; private readonly IRepository _registerAsbitemRepository; + private readonly IRepository _registerCheckRepository; + private readonly IRepository _patientRegisterRepository; private readonly RegisterCheckPictureManager _registerCheckPictureManager; private readonly IConfiguration _configuration; @@ -34,13 +37,17 @@ namespace Shentun.Peis.RegisterCheckPictures RegisterCheckPictureManager registerCheckPictureManager, IRepository userRepository, IRepository registerAsbitemRepository, - IConfiguration configuration) + IConfiguration configuration, + IRepository registerCheckRepository, + IRepository patientRegisterRepository) { _registerCheckPictureRepository = registerCheckPictureRepository; _registerCheckPictureManager = registerCheckPictureManager; _userRepository = userRepository; _registerAsbitemRepository = registerAsbitemRepository; _configuration = configuration; + _registerCheckRepository = registerCheckRepository; + _patientRegisterRepository = patientRegisterRepository; } /// @@ -148,15 +155,21 @@ namespace Shentun.Peis.RegisterCheckPictures string PatientRegisterId = ""; - var registerAsbitemEntity = await _registerAsbitemRepository.FirstOrDefaultAsync(m => m.RegisterCheckId == input.RegisterCheckId); - if (registerAsbitemEntity != null) - { - PatientRegisterId = registerAsbitemEntity.PatientRegisterId.ToString(); - } - else - { + var patientRegisterCompleteFlag = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId + where registerCheck.Id == input.RegisterCheckId + select new + { + CompleteFlag = patientRegister.CompleteFlag + }).ToList(); + + if (patientRegisterCompleteFlag.Count == 0) throw new UserFriendlyException("体检人员不存在"); - } + + if (patientRegisterCompleteFlag.FirstOrDefault().CompleteFlag == PatientRegisterCompleteFlag.PreRegistration) + throw new UserFriendlyException("预登记人员不能导入图片"); + if (patientRegisterCompleteFlag.FirstOrDefault().CompleteFlag == PatientRegisterCompleteFlag.SumCheck) + throw new UserFriendlyException("已总检人员不能导入图片"); List entlist_insert = new List(); @@ -297,6 +310,26 @@ namespace Shentun.Peis.RegisterCheckPictures { if (ids.Any()) { + var patientRegisterCompleteFlag = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join registerCheck in await _registerCheckRepository.GetQueryableAsync() + on patientRegister.Id equals registerCheck.PatientRegisterId + join registerCheckPicture in await _registerCheckPictureRepository.GetQueryableAsync() + on registerCheck.Id equals registerCheckPicture.RegisterCheckId + where ids.Contains(registerCheckPicture.Id) + select new + { + CompleteFlag = patientRegister.CompleteFlag + }).ToList(); + + if (patientRegisterCompleteFlag.Count == 0) + throw new UserFriendlyException("Id不存在"); + + if (patientRegisterCompleteFlag.FirstOrDefault().CompleteFlag == PatientRegisterCompleteFlag.SumCheck) + { + throw new UserFriendlyException("已总检人员不能删除图片"); + } + + await _registerCheckPictureRepository.DeleteAsync(m => ids.Contains(m.Id)); } else From 6b4fff5e89af2c1b59fe613ce149d939f8cb65fe Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 16 May 2024 21:15:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysParmValues/SysParmValueInputDto.cs | 19 ++++++++++++ .../SysParmValues/SysParmValueAppService.cs | 29 +++++++++---------- 2 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs b/src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs new file mode 100644 index 0000000..b22860f --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.SysParmValues +{ + public class SysParmValueInputDto + { + /// + /// 系统参数ID + /// + public string SysParmId { get; set; } + + /// + /// 体检中心ID + /// + public Guid MedicalCenterId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs b/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs index d03e5d3..ea3f930 100644 --- a/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs +++ b/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs @@ -43,18 +43,17 @@ namespace Shentun.Peis.SysParmValues this._manager = manager; } - ///// - ///// 查询值内容 根据系统参数ID 跟组织ID - ///// - ///// - ///// - ///// - //[RemoteService(false)] - //public async Task GetAsync(string SysParmId, Guid OrganizationUnitId) - //{ - // var entity = await _repository.GetAsync(m => m.SysParmId == SysParmId && m.OrganizationUnitId == OrganizationUnitId); - // return ObjectMapper.Map(entity); - //} + /// + /// 查询系统参数值 根据参数ID 跟体检中心 + /// + /// + /// + [HttpPost("api/app/SysParmValue/GetSysParmValueBySysParmId")] + public async Task GetSysParmValueBySysParmIdAsync(SysParmValueInputDto input) + { + string sysParmValue = await _manager.GetSysParmValueAsync(input.MedicalCenterId, input.SysParmId); + return sysParmValue; + } ///// @@ -223,14 +222,14 @@ namespace Shentun.Peis.SysParmValues // await _repository.DeleteAsync(d => sysParmTypeList.Select(s => s.Id).Contains(d.SysParmId)); //} var sysParmValueList = (await _repository.GetQueryableAsync()). - Where(o => sysParmTypeList.Select(s => s.Id).Contains(o.SysParmId)).ToList() ; + Where(o => sysParmTypeList.Select(s => s.Id).Contains(o.SysParmId)).ToList(); var addSysParmValues = new List(); var updateSysParmValues = new List(); foreach (var item in input.Details) { - var sysParmValue = sysParmValueList.Find(o=>o.SysParmId == item.SysParmId && o.MedicalCenterId == item.MedicalCenterId); - if(sysParmValue == null) + var sysParmValue = sysParmValueList.Find(o => o.SysParmId == item.SysParmId && o.MedicalCenterId == item.MedicalCenterId); + if (sysParmValue == null) { sysParmValue = new SysParmValue { From 244e4ba7f8c0d85d5611f484e0d0f455345246f1 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 16 May 2024 21:31:23 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysParmValues/SysParmValueInputDto.cs | 4 ---- .../MyUser/MyUserAppService.cs | 4 ++-- .../SysParmValues/SysParmValueAppService.cs | 14 ++++++++++++-- .../PeisOrganizationUnitManager.cs | 3 +-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs b/src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs index b22860f..106cb3e 100644 --- a/src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs +++ b/src/Shentun.Peis.Application.Contracts/SysParmValues/SysParmValueInputDto.cs @@ -11,9 +11,5 @@ namespace Shentun.Peis.SysParmValues /// public string SysParmId { get; set; } - /// - /// 体检中心ID - /// - public Guid MedicalCenterId { get; set; } } } diff --git a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs index 6c3a2d9..ff9da5b 100644 --- a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs +++ b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs @@ -589,8 +589,8 @@ namespace Shentun.Peis.MyUser var verifyResult = await _userManager.CheckPasswordAsync(user, input.PassWord); if (verifyResult) { - var organizationUnitList = await _organizationUnitRepository.GetListAsync(); - var PeisId = await _peisOrganizationUnitManager.GetPeisIdAsync(organizationUnitList, user.Id); + + var PeisId = await _peisOrganizationUnitManager.GetPeisIdAsync(user.Id); if (user.IsActive == false) { diff --git a/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs b/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs index ea3f930..878ab7a 100644 --- a/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs +++ b/src/Shentun.Peis.Application/SysParmValues/SysParmValueAppService.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Shentun.Peis.Items; using Shentun.Peis.Models; +using Shentun.Peis.OrganizationUnits; using Shentun.Peis.SysParmTypes; using Shentun.Peis.Units; using System; @@ -30,17 +31,23 @@ namespace Shentun.Peis.SysParmValues private readonly IRepository _sysParmRepository; private readonly IRepository _userRepository; private readonly SysParmValueManager _manager; + private readonly ICurrentUser _currentUser; + private readonly PeisOrganizationUnitManager _peisOrganizationUnitManager; public SysParmValueAppService( IRepository repository, IRepository sysParmRepository, IRepository userRepository, - SysParmValueManager manager) + SysParmValueManager manager, + ICurrentUser currentUser, + PeisOrganizationUnitManager peisOrganizationUnitManager) { this._repository = repository; this._sysParmRepository = sysParmRepository; this._userRepository = userRepository; this._manager = manager; + _currentUser = currentUser; + _peisOrganizationUnitManager = peisOrganizationUnitManager; } /// @@ -51,7 +58,10 @@ namespace Shentun.Peis.SysParmValues [HttpPost("api/app/SysParmValue/GetSysParmValueBySysParmId")] public async Task GetSysParmValueBySysParmIdAsync(SysParmValueInputDto input) { - string sysParmValue = await _manager.GetSysParmValueAsync(input.MedicalCenterId, input.SysParmId); + var userId = _currentUser.Id.Value; + var medicalCenterId = await _peisOrganizationUnitManager.GetPeisIdAsync(userId); + + string sysParmValue = await _manager.GetSysParmValueAsync(medicalCenterId != null ? medicalCenterId.Value : Guid.Empty, input.SysParmId); return sysParmValue; } diff --git a/src/Shentun.Peis.Domain/OrganizationUnits/PeisOrganizationUnitManager.cs b/src/Shentun.Peis.Domain/OrganizationUnits/PeisOrganizationUnitManager.cs index df0bc44..efdc851 100644 --- a/src/Shentun.Peis.Domain/OrganizationUnits/PeisOrganizationUnitManager.cs +++ b/src/Shentun.Peis.Domain/OrganizationUnits/PeisOrganizationUnitManager.cs @@ -44,10 +44,9 @@ namespace Shentun.Peis.OrganizationUnits /// /// 获取当前用户的体检中心ID /// - /// /// /// - public async Task GetPeisIdAsync(List organizationUnitList, Guid UserId) + public async Task GetPeisIdAsync(Guid UserId) { //当前用户的部门ID var userOrganizationUnit = (await _identityUserOrganizationUnitRepository.GetListAsync(m => m.UserId == UserId)).FirstOrDefault(); From bcca711d65c6b58acbcf90df5e4988908a9a41af Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 16 May 2024 22:08:51 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BD=93=E6=A3=80=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PublicPatientRegisterNoInputDto.cs | 2 +- .../PatientRegisterAppService.cs | 3 +- .../PeisReports/PeisReportAppService.cs | 94 +++++++++++++------ .../ThirdPartyPublicInterfaceAppService.cs | 6 +- 4 files changed, 74 insertions(+), 31 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs b/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs index 2d11bd7..d1a5836 100644 --- a/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs @@ -9,6 +9,6 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces /// /// 体检人员条码号 /// - public string PatientRegisterNo { get; set; } + public List PatientRegisterNos { get; set; } } } diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index 68cb89f..e5fbe1a 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -1751,8 +1751,7 @@ namespace Shentun.Peis.PatientRegisters if (input.CompleteFlag != null - && input.CompleteFlag != PatientRegisterCompleteFlag.ItemCheckUnSumCheck - && input.CompleteFlag != PatientRegisterCompleteFlag.PartCheck) + && input.CompleteFlag != PatientRegisterCompleteFlag.ItemCheckUnSumCheck) { sumquery = sumquery.Where(m => m.a.CompleteFlag == input.CompleteFlag); } diff --git a/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs b/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs index 3eda614..6014d49 100644 --- a/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs +++ b/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; using Shentun.Peis.CustomerOrgs; using Shentun.Peis.Enums; using Shentun.Peis.Models; +using Shentun.Peis.PatientRegisters; using Shentun.Peis.SampleTypes; using System; using System.Collections.Generic; @@ -78,6 +79,9 @@ namespace Shentun.Peis.PeisReports var query = from a in await _patientRegisterRepository.GetQueryableAsync() join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb from ab in bb.DefaultIfEmpty() + join registerCheck in await _registerCheckRepository.GetQueryableAsync() on a.Id equals registerCheck.PatientRegisterId + join registerAsbitem in await _registerAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerAsbitem.RegisterCheckId + join asbitem in await _asbitemRepository.GetQueryableAsync() on registerAsbitem.AsbitemId equals asbitem.Id join c in await _customerOrgGroupRepository.GetQueryableAsync() on a.CustomerOrgGroupId equals c.Id into cc from ac in cc.DefaultIfEmpty() join d in await _medicalPackageRepository.GetQueryableAsync() on a.MedicalPackageId equals d.Id into dd @@ -111,6 +115,8 @@ namespace Shentun.Peis.PeisReports a.PersonnelTypeId, a.IsUpload }, + RegisterCheckCompleteFlag = registerCheck.CompleteFlag, + IsCheck = asbitem.IsCheck, ab = new { ab.IdNo, ab.Address, ab.PatientNo, ab.MobileTelephone, ab.Telephone, ab.Email, ab.DisplayName }, ac = new { ac.DisplayName }, ad = new { ad.DisplayName }, @@ -225,7 +231,7 @@ namespace Shentun.Peis.PeisReports sumquery = sumquery.Where(m => m.ab.MobileTelephone == input.phone || m.ab.Telephone == input.phone); } - if (input.CompleteFlag != null) + if (input.CompleteFlag != null && input.CompleteFlag != PatientRegisterCompleteFlag.ItemCheckUnSumCheck) { sumquery = sumquery.Where(m => m.a.CompleteFlag == input.CompleteFlag); } @@ -272,36 +278,70 @@ namespace Shentun.Peis.PeisReports } - int totalCount = sumquery.Count(); + var sumqueryGroup = sumquery.ToList().GroupBy(g => g.a.Id); + - var entlist = sumquery.Select(s => new GetPatientRegisterReportDto + List entlist = new List(); + + foreach (var s in sumqueryGroup.OrderBy(o => o.Key)) { - Address = s.ab.Address, - PatientName = s.a.PatientName, - Age = s.a.Age, - BirthDate = DataHelper.ConversionDateToString(s.a.BirthDate), - CompleteFlag = s.a.CompleteFlag, - CustomerOrgGroupName = s.ac.DisplayName, - //CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).Result.DisplayName, - CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(s.a.CustomerOrgId).Result, - DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.a.CustomerOrgId).Result, - Email = s.ab.Email, - IdNo = s.ab.IdNo, - IsAudit = s.a.IsAudit, - IsReportPrint = s.a.ReportPrintTimes > 0 ? 'Y' : 'N', - MedicalPackageName = s.ad.DisplayName, - MedicalTypeName = s.ae.DisplayName, - MobileTelephone = s.ab.MobileTelephone, - PatientNo = s.ab.PatientNo, - PatientRegisterNo = s.a.PatientRegisterNo, - PersonnelTypeName = s.af.DisplayName, - SexName = s.ag.DisplayName, - Telephone = s.ab.Telephone, - PatientRegisterId = s.a.Id - }).Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList(); - return new PagedResultDto(totalCount, entlist); ; + bool IsDisplay = false; + + if (input.CompleteFlag == PatientRegisterCompleteFlag.ItemCheckUnSumCheck) + { + if (s.Where(m => m.RegisterCheckCompleteFlag != RegisterCheckCompleteFlag.Checked && m.IsCheck == 'Y').Count() == 0 + && s.FirstOrDefault().a.CompleteFlag != PatientRegisterCompleteFlag.SumCheck) + { + IsDisplay = true; + } + else + { + IsDisplay = false; + } + } + else + { + IsDisplay = true; + } + + if (IsDisplay) + { + entlist.Add(new GetPatientRegisterReportDto + { + Address = s.FirstOrDefault().ab.Address, + PatientName = s.FirstOrDefault().a.PatientName, + Age = s.FirstOrDefault().a.Age, + BirthDate = DataHelper.ConversionDateToString(s.FirstOrDefault().a.BirthDate), + CompleteFlag = s.FirstOrDefault().a.CompleteFlag, + CustomerOrgGroupName = s.FirstOrDefault().ac.DisplayName, + //CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).Result.DisplayName, + CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(s.FirstOrDefault().a.CustomerOrgId).Result, + DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.FirstOrDefault().a.CustomerOrgId).Result, + Email = s.FirstOrDefault().ab.Email, + IdNo = s.FirstOrDefault().ab.IdNo, + IsAudit = s.FirstOrDefault().a.IsAudit, + IsReportPrint = s.FirstOrDefault().a.ReportPrintTimes > 0 ? 'Y' : 'N', + MedicalPackageName = s.FirstOrDefault().ad.DisplayName, + MedicalTypeName = s.FirstOrDefault().ae.DisplayName, + MobileTelephone = s.FirstOrDefault().ab.MobileTelephone, + PatientNo = s.FirstOrDefault().ab.PatientNo, + PatientRegisterNo = s.FirstOrDefault().a.PatientRegisterNo, + PersonnelTypeName = s.FirstOrDefault().af.DisplayName, + SexName = s.FirstOrDefault().ag.DisplayName, + Telephone = s.FirstOrDefault().ab.Telephone, + PatientRegisterId = s.FirstOrDefault().a.Id + }); + } + + } + + int totalCount = entlist.Count; + + entlist = entlist.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList(); + + return new PagedResultDto(totalCount, entlist); } diff --git a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs index ccecf4d..2daa6f1 100644 --- a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs +++ b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs @@ -81,9 +81,13 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces throw new UserFriendlyException($"请求参数错误"); } + if(!input.PatientRegisterNos.Any()) + throw new UserFriendlyException($"体检编号不能为空"); var result = new BasicInformationOfMedicalExaminationPersonnelDto(); - var patientRegisterEnt = (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient).FirstOrDefault(m => m.PatientRegisterNo == input.PatientRegisterNo); + var patientRegisterEnt = (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient) + .FirstOrDefault(m => input.PatientRegisterNos.Contains(m.PatientRegisterNo) + && m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck); if (patientRegisterEnt != null) { //基础信息 From 93202108a70d73571e5a65a6a12c6b61f00ca712 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 16 May 2024 22:40:51 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=81=A5=E5=BA=B7=E8=AF=84=E4=BC=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PublicPatientRegisterNoInputDto.cs | 2 +- .../ThirdPartyPublicInterfaceAppService.cs | 201 +++++++++--------- 2 files changed, 104 insertions(+), 99 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs b/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs index d1a5836..6c75df5 100644 --- a/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs @@ -7,7 +7,7 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces public class PublicPatientRegisterNoInputDto { /// - /// 体检人员条码号 + /// 体检编号 /// public List PatientRegisterNos { get; set; } } diff --git a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs index 2daa6f1..06ea58c 100644 --- a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs +++ b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs @@ -74,126 +74,131 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces /// [Authorize(PeisPermissions.Third.Default)] [HttpPost("api/Third/ThirdPartyPublicInterface/GetBasicInformationOfMedicalExaminationPersonnel")] - public async Task GetBasicInformationOfMedicalExaminationPersonnelAsync(PublicPatientRegisterNoInputDto input) + public async Task> GetBasicInformationOfMedicalExaminationPersonnelAsync(PublicPatientRegisterNoInputDto input) { if (input == null) { throw new UserFriendlyException($"请求参数错误"); } - if(!input.PatientRegisterNos.Any()) + if (!input.PatientRegisterNos.Any()) throw new UserFriendlyException($"体检编号不能为空"); - var result = new BasicInformationOfMedicalExaminationPersonnelDto(); + var listDto = new List(); - var patientRegisterEnt = (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient) - .FirstOrDefault(m => input.PatientRegisterNos.Contains(m.PatientRegisterNo) - && m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck); - if (patientRegisterEnt != null) + var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient) + .Where(m => input.PatientRegisterNos.Contains(m.PatientRegisterNo) + && m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck).ToList(); + if (patientRegisterList.Any()) { - //基础信息 - result = new BasicInformationOfMedicalExaminationPersonnelDto + foreach (var patientRegisterEnt in patientRegisterList) { - BirthDate = patientRegisterEnt.BirthDate != null ? patientRegisterEnt.BirthDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", - PatientRegisterNo = patientRegisterEnt.PatientRegisterNo, - CompleteFlag = patientRegisterEnt.CompleteFlag, - IsMedicalStart = patientRegisterEnt.IsMedicalStart, - MedicalStartDate = patientRegisterEnt.MedicalStartDate != null ? patientRegisterEnt.MedicalStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", - PatientName = patientRegisterEnt.PatientName, - SexName = _cacheService.GetSexNameAsync(patientRegisterEnt.SexId).Result, - SummaryDoctorName = _cacheService.GetSurnameAsync(patientRegisterEnt.SummaryDoctorId).Result, - SummaryDate = patientRegisterEnt.SummaryDate != null ? patientRegisterEnt.SummaryDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", - CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(patientRegisterEnt.CustomerOrgId).Result, - IdNo = patientRegisterEnt.Patient.IdNo, - MobileTelephone = patientRegisterEnt.Patient.MobileTelephone - }; - - - var registerCheckItemList = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() - join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId - join registerCheckItem in await _registerCheckItemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckItem.RegisterCheckId - join item in await _itemRepository.GetQueryableAsync() on registerCheckItem.ItemId equals item.Id - join itemType in await _itemTypeRepository.GetQueryableAsync() on item.ItemTypeId equals itemType.Id into itemTypeTemp - from itemTypeHaveEmpty in itemTypeTemp.DefaultIfEmpty() - where patientRegister.Id == patientRegisterEnt.Id - select new - { - registerCheckItem, - ItemName = item.DisplayName, - DepartmentName = itemTypeHaveEmpty != null ? itemTypeHaveEmpty.DisplayName : "" - }; - - - - //明细项目 - result.Items = registerCheckItemList.Select(s => new BasicInformationOfMedicalExaminationPersonnelItemDto - { - DepartmentName = s.DepartmentName, - ItemName = s.ItemName, - ReferenceRangeValue = s.registerCheckItem.ReferenceRangeValue, - Result = s.registerCheckItem.Result, - Unit = s.registerCheckItem.Unit - }).ToList(); - - //总检综述 - - var sumSummaryList = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() - join sumSummaryHeader in await _sumSummaryHeaderRepository.GetQueryableAsync() on patientRegister.Id equals sumSummaryHeader.PatientRegisterId - join sumSummaryContent in await _sumSummaryContentRepository.GetQueryableAsync() on sumSummaryHeader.Id equals sumSummaryContent.SumSummaryHeaderId - where patientRegister.Id == patientRegisterEnt.Id - orderby sumSummaryHeader.DisplayOrder, sumSummaryContent.DisplayOrder - select new - { - SummaryTitle = sumSummaryHeader.SummaryTitle, - SummaryContent = sumSummaryContent.SummaryContent - }; - - result.SumSummarys = sumSummaryList.Select(s => new BasicInformationOfMedicalExaminationPersonnelSumSummaryDto - { - SumSummaryTitle = s.SummaryTitle, - SumSummaryContent = s.SummaryContent - }).ToList(); - //总检建议 - - var sumSuggestionsList = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() - join sumSuggestionHeader in await _sumSuggestionHeaderRepository.GetQueryableAsync() on patientRegister.Id equals sumSuggestionHeader.PatientRegisterId - join sumSuggestionContent in await _sumSuggestionContentRepository.GetQueryableAsync() on sumSuggestionHeader.Id equals sumSuggestionContent.SumSuggestionHeaderId + //基础信息 + var result = new BasicInformationOfMedicalExaminationPersonnelDto + { + BirthDate = patientRegisterEnt.BirthDate != null ? patientRegisterEnt.BirthDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", + PatientRegisterNo = patientRegisterEnt.PatientRegisterNo, + CompleteFlag = patientRegisterEnt.CompleteFlag, + IsMedicalStart = patientRegisterEnt.IsMedicalStart, + MedicalStartDate = patientRegisterEnt.MedicalStartDate != null ? patientRegisterEnt.MedicalStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", + PatientName = patientRegisterEnt.PatientName, + SexName = _cacheService.GetSexNameAsync(patientRegisterEnt.SexId).Result, + SummaryDoctorName = _cacheService.GetSurnameAsync(patientRegisterEnt.SummaryDoctorId).Result, + SummaryDate = patientRegisterEnt.SummaryDate != null ? patientRegisterEnt.SummaryDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", + CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(patientRegisterEnt.CustomerOrgId).Result, + IdNo = patientRegisterEnt.Patient.IdNo, + MobileTelephone = patientRegisterEnt.Patient.MobileTelephone + }; + + + var registerCheckItemList = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId + join registerCheckItem in await _registerCheckItemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckItem.RegisterCheckId + join item in await _itemRepository.GetQueryableAsync() on registerCheckItem.ItemId equals item.Id + join itemType in await _itemTypeRepository.GetQueryableAsync() on item.ItemTypeId equals itemType.Id into itemTypeTemp + from itemTypeHaveEmpty in itemTypeTemp.DefaultIfEmpty() + where patientRegister.Id == patientRegisterEnt.Id + select new + { + registerCheckItem, + ItemName = item.DisplayName, + DepartmentName = itemTypeHaveEmpty != null ? itemTypeHaveEmpty.DisplayName : "" + }; + + + + //明细项目 + result.Items = registerCheckItemList.Select(s => new BasicInformationOfMedicalExaminationPersonnelItemDto + { + DepartmentName = s.DepartmentName, + ItemName = s.ItemName, + ReferenceRangeValue = s.registerCheckItem.ReferenceRangeValue, + Result = s.registerCheckItem.Result, + Unit = s.registerCheckItem.Unit + }).ToList(); + + //总检综述 + + var sumSummaryList = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join sumSummaryHeader in await _sumSummaryHeaderRepository.GetQueryableAsync() on patientRegister.Id equals sumSummaryHeader.PatientRegisterId + join sumSummaryContent in await _sumSummaryContentRepository.GetQueryableAsync() on sumSummaryHeader.Id equals sumSummaryContent.SumSummaryHeaderId where patientRegister.Id == patientRegisterEnt.Id - orderby sumSuggestionHeader.DisplayOrder, sumSuggestionContent.DisplayOrder + orderby sumSummaryHeader.DisplayOrder, sumSummaryContent.DisplayOrder select new { - SuggestionTitle = sumSuggestionHeader.SuggestionTitle, - SuggestionFlag = sumSuggestionHeader.SuggestionFlag, - SuggestionContent = sumSuggestionContent.SuggestionContent + SummaryTitle = sumSummaryHeader.SummaryTitle, + SummaryContent = sumSummaryContent.SummaryContent }; - result.SumSuggestions = sumSuggestionsList.Select(s => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDto - { - DiagnosisName = s.SuggestionTitle, - CommonReasons = sumSuggestionsList.Where(m => m.SuggestionFlag == SuggestionTypeFlag.CommonReasons) - .Select(ss => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDetailDto - { - SumSuggestionContent = ss.SuggestionContent - }).ToList(), - HealthGuidances = sumSuggestionsList.Where(m => m.SuggestionFlag == SuggestionTypeFlag.HealthGuidance) - .Select(ss => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDetailDto - { - SumSuggestionContent = ss.SuggestionContent - }).ToList(), - MedicalInterpretations = sumSuggestionsList.Where(m => m.SuggestionFlag == SuggestionTypeFlag.MedicalInterpretation) - .Select(ss => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDetailDto - { - SumSuggestionContent = ss.SuggestionContent - }).ToList() - }).ToList(); + result.SumSummarys = sumSummaryList.Select(s => new BasicInformationOfMedicalExaminationPersonnelSumSummaryDto + { + SumSummaryTitle = s.SummaryTitle, + SumSummaryContent = s.SummaryContent + }).ToList(); + + //总检建议 + + var sumSuggestionsList = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join sumSuggestionHeader in await _sumSuggestionHeaderRepository.GetQueryableAsync() on patientRegister.Id equals sumSuggestionHeader.PatientRegisterId + join sumSuggestionContent in await _sumSuggestionContentRepository.GetQueryableAsync() on sumSuggestionHeader.Id equals sumSuggestionContent.SumSuggestionHeaderId + where patientRegister.Id == patientRegisterEnt.Id + orderby sumSuggestionHeader.DisplayOrder, sumSuggestionContent.DisplayOrder + select new + { + SuggestionTitle = sumSuggestionHeader.SuggestionTitle, + SuggestionFlag = sumSuggestionHeader.SuggestionFlag, + SuggestionContent = sumSuggestionContent.SuggestionContent + }; + + result.SumSuggestions = sumSuggestionsList.Select(s => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDto + { + DiagnosisName = s.SuggestionTitle, + CommonReasons = sumSuggestionsList.Where(m => m.SuggestionFlag == SuggestionTypeFlag.CommonReasons) + .Select(ss => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDetailDto + { + SumSuggestionContent = ss.SuggestionContent + }).ToList(), + HealthGuidances = sumSuggestionsList.Where(m => m.SuggestionFlag == SuggestionTypeFlag.HealthGuidance) + .Select(ss => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDetailDto + { + SumSuggestionContent = ss.SuggestionContent + }).ToList(), + MedicalInterpretations = sumSuggestionsList.Where(m => m.SuggestionFlag == SuggestionTypeFlag.MedicalInterpretation) + .Select(ss => new BasicInformationOfMedicalExaminationPersonnelSumSuggestionDetailDto + { + SumSuggestionContent = ss.SuggestionContent + }).ToList() + }).ToList(); + listDto.Add(result); + } } else { - throw new UserFriendlyException($"条码号不正确"); + throw new UserFriendlyException($"体检编号不正确"); } - return result; + return listDto; }