From c9ee766b28de82590e1c3fa7339768c4657c8daa Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Mon, 25 Nov 2024 21:07:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SetLisRequestSamplerStatusInputDto.cs | 22 ++++++ .../PrintReports/MedicalReportDto.cs | 10 +++ .../LisRequests/LisRequestAppService.cs | 75 ++++++++++++++++++- .../PrintReports/PrintReportAppService.cs | 29 ++++++- .../PeisHttpApiHostModule.cs | 7 +- 5 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/LisRequests/SetLisRequestSamplerStatusInputDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/LisRequests/SetLisRequestSamplerStatusInputDto.cs b/src/Shentun.Peis.Application.Contracts/LisRequests/SetLisRequestSamplerStatusInputDto.cs new file mode 100644 index 0000000..f843c36 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/LisRequests/SetLisRequestSamplerStatusInputDto.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.LisRequests +{ + /// + /// + /// + public class SetLisRequestSamplerStatusInputDto + { + /// + /// 检验条码 + /// + public List LisRequestNos { get; set; }=new List(); + + /// + /// 标本类型id集合 本地做配置 不配置就不传 用人员条码时使用 + /// + public List SampleTypeIds=new List(); + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PrintReports/MedicalReportDto.cs b/src/Shentun.Peis.Application.Contracts/PrintReports/MedicalReportDto.cs index 8681234..98a53a2 100644 --- a/src/Shentun.Peis.Application.Contracts/PrintReports/MedicalReportDto.cs +++ b/src/Shentun.Peis.Application.Contracts/PrintReports/MedicalReportDto.cs @@ -302,6 +302,16 @@ namespace Shentun.Peis.PrintReports /// public string LisSampleNo { get; set; } + + /// + /// 采样人姓名 + /// + public string SamplerName { get; set; } + /// + /// 采样时间 + /// + public string SamplingTime { get; set; } + /// /// 项目类别下的组合项目列表 /// diff --git a/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs b/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs index b7f1a8a..3a36fe0 100644 --- a/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs +++ b/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs @@ -52,6 +52,7 @@ namespace Shentun.Peis.LisRequests private readonly IRepository _lisRequestRepository; private readonly SysParmValueManager _sysParmValueManager; private readonly IUnitOfWorkManager _unitOfWorkManager; + private readonly ICurrentUser _currentUser; public LisRequestAppService( IRepository userRepository, IRepository patientRegisterRepository, @@ -71,7 +72,8 @@ namespace Shentun.Peis.LisRequests IRepository itemTypeRepository, IRepository lisRequestRepository, SysParmValueManager sysParmValueManager, - IUnitOfWorkManager unitOfWorkManager) + IUnitOfWorkManager unitOfWorkManager, + ICurrentUser currentUser) { this._userRepository = userRepository; this._patientRegisterRepository = patientRegisterRepository; @@ -92,6 +94,7 @@ namespace Shentun.Peis.LisRequests _lisRequestRepository = lisRequestRepository; _sysParmValueManager = sysParmValueManager; _unitOfWorkManager = unitOfWorkManager; + _currentUser = currentUser; } [HttpPost("api/app/LisRequest/GetListInFilter")] @@ -749,7 +752,75 @@ namespace Shentun.Peis.LisRequests } } - + + } + + + /// + /// 设置人员的检验项目的采样信息 + /// + /// + [HttpPost("api/app/LisRequest/SetLisRequestSamplerStatus")] + public async Task SetLisRequestSamplerStatusAsync(SetLisRequestSamplerStatusInputDto input) + { + var lisRequestNoPrintMode = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, "lis_request_no_print_mode"); + if (string.IsNullOrWhiteSpace(lisRequestNoPrintMode)) + lisRequestNoPrintMode = "0"; + + if (lisRequestNoPrintMode == "0") + { + if (input.LisRequestNos.Any()) + { + //检验条码 + var lisRequestList = await _lisRequestRepository.GetListAsync(m => input.LisRequestNos.Contains(m.LisRequestNo)); + lisRequestList.ForEach(lisRequest => + { + if (_currentUser.Id != null) + lisRequest.SamplerId = _currentUser.Id; + lisRequest.SamplingTime = DateTime.Now; + + }); + + await _lisRequestRepository.UpdateManyAsync(lisRequestList); + } + } + else + { + //人员条码 + if (input.LisRequestNos.Any()) + { + var patientRegisterNo = input.LisRequestNos.First(); + + var query = 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 lisRequest in await _lisRequestRepository.GetQueryableAsync() on registerCheckAsbitem.LisRequestId equals lisRequest.Id + where patientRegister.PatientRegisterNo == patientRegisterNo + select new + { + lisRequest + }; + + if (input.SampleTypeIds.Any()) + { + query = query.Where(m => input.SampleTypeIds.Contains(m.lisRequest.SampleTypeId)); + } + + var lisRequestList = query.Select(s => s.lisRequest).ToList(); + + if (lisRequestList.Any()) + { + foreach (var lisRequest in lisRequestList) + { + if (_currentUser.Id != null) + lisRequest.SamplerId = _currentUser.Id; + lisRequest.SamplingTime = DateTime.Now; + } + + await _lisRequestRepository.UpdateManyAsync(lisRequestList); + } + } + } } } } diff --git a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs index b1968c0..de0ff8e 100644 --- a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs +++ b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs @@ -1185,6 +1185,22 @@ namespace Shentun.Peis.PrintReports .ToList(); var registerCheckIds = registerChecklist.Select(o => o.registerCheck.Id).Distinct().ToList(); + + #region 获取采样时间 + + var samplerList = (from registerCheck in await _registerCheckRepository.GetQueryableAsync() + join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId + join lisRequest in await _lisRequestRepository.GetQueryableAsync() on registerCheckAsbitem.LisRequestId equals lisRequest.Id + where registerCheckIds.Contains(registerCheck.Id) + select new + { + registerCheckId = registerCheck.Id, + samplerId = lisRequest.SamplerId, + samplingTime = lisRequest.SamplingTime + }).ToList(); + + #endregion + foreach (var registerCheckId in registerCheckIds) { var registerCheckRows = registerChecklist.Where(o => o.registerCheck.Id == registerCheckId).ToList(); @@ -1207,6 +1223,17 @@ namespace Shentun.Peis.PrintReports ), CheckDate = (DateTime)registerCheckRow.registerCheck.CheckDate, }; + + #region 采样信息 + + var sampler = samplerList.FirstOrDefault(f => f.registerCheckId == registerCheckId); + if (sampler != null) + { + medicalReportRegisterCheckDto.SamplerName = _cacheService.GetSurnameAsync(sampler.samplerId).Result; + medicalReportRegisterCheckDto.SamplingTime = DataHelper.ConversionDateShortToString(sampler.samplingTime); + } + #endregion + //检查医生 var checkDoctorId = registerCheckRow.registerCheck.CheckDoctorId; if (!string.IsNullOrWhiteSpace(checkDoctorId)) @@ -1225,7 +1252,7 @@ namespace Shentun.Peis.PrintReports //lis审核医生+标本号 medicalReportRegisterCheckDto.LisSampleNo = registerCheckRow.registerCheck.LisSampleNo; - // medicalReportRegisterCheckDto.LisAuditorDoctorName = registerCheckRow.registerCheck.LisAuditorDoctorName; + // medicalReportRegisterCheckDto.LisAuditorDoctorName = registerCheckRow.registerCheck.LisAuditorDoctorName; //lis审核医生 var lisAuditorDoctorId = registerCheckRow.registerCheck.LisAuditorDoctorName; diff --git a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs b/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs index f5fcaed..dbd4b9f 100644 --- a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs +++ b/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs @@ -85,7 +85,8 @@ namespace Shentun.Peis; typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule), typeof(AbpAccountWebOpenIddictModule), typeof(AbpAspNetCoreSerilogModule), - typeof(AbpSwashbuckleModule) + typeof(AbpSwashbuckleModule), + typeof(AbpBackgroundWorkersHangfireModule) )] public class PeisHttpApiHostModule : AbpModule { @@ -250,7 +251,7 @@ public class PeisHttpApiHostModule : AbpModule */ //后台计划任务 - // ConfigureHangfire(context, configuration); + ConfigureHangfire(context, configuration); } /// @@ -497,7 +498,7 @@ public class PeisHttpApiHostModule : AbpModule config.UsePostgreSqlStorage(configuration.GetConnectionString("Default")); }); - + } public override async void OnApplicationInitialization(ApplicationInitializationContext context) {