From 15ea9ce4641f911bc5c622cc3b4b73824411f19e Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Tue, 23 Jul 2024 15:27:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E4=BF=AE=E6=94=B9=E5=8C=BB?= =?UTF-8?q?=E7=94=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Asbitems/SimpleAsbitemDto.cs | 19 ++++ .../PatientRegisterIdsInputDto.cs | 14 +++ .../UpdateBatchCheckDoctorInputDto.cs | 32 +++++++ .../RegisterChecks/RegisterCheckAppService.cs | 92 +++++++++++++------ 4 files changed, 131 insertions(+), 26 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/Asbitems/SimpleAsbitemDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdsInputDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateBatchCheckDoctorInputDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/Asbitems/SimpleAsbitemDto.cs b/src/Shentun.Peis.Application.Contracts/Asbitems/SimpleAsbitemDto.cs new file mode 100644 index 0000000..fc577a2 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/Asbitems/SimpleAsbitemDto.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.Asbitems +{ + public class SimpleAsbitemDto + { + /// + /// 组合项目ID + /// + public Guid AsbitemId { get; set; } + + /// + /// 组合项目名称 + /// + public string AsbitemName { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdsInputDto.cs b/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdsInputDto.cs new file mode 100644 index 0000000..19bbbe1 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdsInputDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.PatientRegisters +{ + public class PatientRegisterIdsInputDto + { + /// + /// 人员ID集合 + /// + public List PatientRegisterIds { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateBatchCheckDoctorInputDto.cs b/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateBatchCheckDoctorInputDto.cs new file mode 100644 index 0000000..a54259c --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateBatchCheckDoctorInputDto.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.RegisterChecks +{ + public class UpdateBatchCheckDoctorInputDto + { + /// + /// 人员id集合 + /// + public List PatientRegisterIds { get; set; } + + /// + /// 检查医生 不需要修改的信息都不用传过来 + /// + public List CheckDoctorDetail { get; set; } + } + + public class UpdateBatchCheckDoctorInputDetailDto + { + /// + /// 组合项目ID + /// + public Guid AsbitemId { get; set; } + + /// + /// 检查医生 也可以传字符串 + /// + public string CheckDoctorId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs index 4fc7d66..d360db5 100644 --- a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs +++ b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; +using Shentun.Peis.Asbitems; using Shentun.Peis.Enums; using Shentun.Peis.MenuInfos; using Shentun.Peis.Models; @@ -23,6 +24,7 @@ using Volo.Abp.Guids; using Volo.Abp.Identity; using Volo.Abp.ObjectMapping; using Volo.Abp.Users; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace Shentun.Peis.RegisterChecks { @@ -500,32 +502,70 @@ namespace Shentun.Peis.RegisterChecks } - ///// - ///// 查询检查项目组合项目记录跟检查结果 根据体检登记ID - ///// - ///// 体检登记ID - ///// - //public async Task> GetListInPatientRegisterIdAsync(Guid PatientRegisterId) - //{ - // var registerCheckList = (await _registerCheckRepository.GetDbSetAsync()).Include(s => s.RegisterAsbitem).Include(s => s.RegisterAsbitem.Asbitem) - // .Where(m => m.RegisterAsbitem.PatientRegisterId == PatientRegisterId).ToList(); - - - // var entListDto = registerCheckList.Select(s => new RegisterCheckOrRegisterAsbitemDto - // { - // AsbitemName = s.RegisterAsbitem.Asbitem.DisplayName, - // CompleteFlag = s.CompleteFlag, - // CreationTime = s.CreationTime, - // CreatorId = s.CreatorId, - // Id = s.Id, - // LastModificationTime = s.LastModificationTime, - // LastModifierId = s.LastModifierId, - // CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId), - // LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId) - // }).ToList(); - - // return entListDto; - //} + + + /// + /// 根据人员ID集合获取所有项目 + /// + /// + /// + [HttpPost("api/app/RegisterCheck/GetRegisterCheckAsbitemsByPatientRegisterIds")] + public async Task> GetRegisterCheckAsbitemsByPatientRegisterIdsAsync(PatientRegisterIdsInputDto input) + { + if (!input.PatientRegisterIds.Any()) + throw new UserFriendlyException("人员ID不能为空"); + var entListDto = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId + join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId + join asbitem in await _asbitemRepository.GetQueryableAsync() on registerCheckAsbitem.AsbitemId equals asbitem.Id + where input.PatientRegisterIds.Contains(patientRegister.Id) && asbitem.IsCheck == 'Y' + select new SimpleAsbitemDto + { + AsbitemId = registerCheckAsbitem.AsbitemId, + AsbitemName = asbitem.DisplayName + }).Distinct().ToList(); + + return entListDto; + } + + + /// + /// 批量修改医生 根据人员ID集合 + /// + /// + /// + [HttpPost("api/app/RegisterCheck/UpdateBatchCheckDoctor")] + public async Task UpdateBatchCheckDoctorAsync(UpdateBatchCheckDoctorInputDto input) + { + if (!input.PatientRegisterIds.Any()) + throw new UserFriendlyException("人员ID不能为空"); + + if (!input.CheckDoctorDetail.Any()) + throw new UserFriendlyException("需要修改的信息不能为空"); + + var registerCheckAsbitemList = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId + join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId + where input.PatientRegisterIds.Contains(patientRegister.Id) + select registerCheckAsbitem).ToList(); + + if (registerCheckAsbitemList.Any()) + { + foreach (var registerCheckAsbitem in registerCheckAsbitemList) + { + var checkDoctorEnt = input.CheckDoctorDetail.FirstOrDefault(f => f.AsbitemId == registerCheckAsbitem.AsbitemId); + if (checkDoctorEnt != null) + { + var registerCheckEnt = await _registerCheckRepository.FirstOrDefaultAsync(f => f.Id == registerCheckAsbitem.RegisterCheckId); + if (registerCheckEnt != null) + { + registerCheckEnt.CheckDoctorId = checkDoctorEnt.CheckDoctorId; + await _registerCheckRepository.UpdateAsync(registerCheckEnt); + } + } + } + } + } }