From de7bda0999d10af4c22b5bdd0ed0322204fe07e5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Tue, 7 May 2024 21:30:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E8=AF=8A=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LisResultImportPlugInsDbBase.cs | 12 ++++++- .../RegisterChecks/UpdateCheckResultDto.cs | 2 ++ .../ImportLisResultAppService.cs | 2 ++ .../RegisterChecks/RegisterCheckAppService.cs | 10 ++++-- .../RegisterChecks/RegisterCheckManager.cs | 33 +++++++++++++++++-- 5 files changed, 54 insertions(+), 5 deletions(-) diff --git a/src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsDbBase.cs b/src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsDbBase.cs index 43d553f..3fb98e7 100644 --- a/src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsDbBase.cs +++ b/src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsDbBase.cs @@ -33,6 +33,15 @@ namespace Shentun.Peis.PlugIns throw new Exception("没有设置项目编码对照"); } var result = new LisResultImportPlugInsOut(); + var execOrganizationUnitIdStr = InterfaceConfig.GetSection("Interface").GetSection("ExecOrganizationUnitId").Value; + if(string.IsNullOrWhiteSpace(execOrganizationUnitIdStr)) + { + throw new Exception("执行科室配置不能为空"); + } + if(!Guid.TryParse(execOrganizationUnitIdStr, out Guid execOrganizationUnitId)) + { + throw new Exception("执行科室配置不是有效的GUID值"); + } var lisRequests = await GetLisRequestForResultImportPlugInssAsync(input.PatientRegisterId); using (DbConnection conn = CreateInterfaceDbConnect()) { @@ -60,7 +69,7 @@ namespace Shentun.Peis.PlugIns { throw new Exception($"{lisResult.ItemName}对照的编码无效"); } - + var createImportLisResultDto = new CreateImportLisResultDto() { LisRequestNo = lisResult.LisRequestNo, @@ -74,6 +83,7 @@ namespace Shentun.Peis.PlugIns ReportPrompt = lisResult.ReportPrompt, CheckDoctorName = lisResult.CheckDoctorName, CheckDate = lisResult.CheckDate, + ExecOrganizationUnitId = execOrganizationUnitId }; createImportLisResultDtos.Add(createImportLisResultDto); } diff --git a/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs b/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs index ec75cc2..293d7c8 100644 --- a/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs +++ b/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs @@ -21,6 +21,8 @@ namespace Shentun.Peis.RegisterChecks /// 检查日期(格式:2023-07-18) 空值跟null取当前日期 /// public DateTime? CheckDate { get; set; } + + public Guid? ExecOrganizationUnitId { get; set; } public List RegisterCheckItems { get; set; } public List Summarys { get; set; } = new List(); public List Suggestions { get; set; } = new List(); diff --git a/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs b/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs index 9600642..302a255 100644 --- a/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs +++ b/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs @@ -165,6 +165,7 @@ namespace Shentun.Peis.ImportLisResults { lisRequestItem.registerCheck.CheckDoctorId = inputItem.CheckDoctorName; lisRequestItem.registerCheck.CheckDate = inputItem.CheckDate; + lisRequestItem.registerCheck.ExecOrganizationUnitId = inputItem.ExecOrganizationUnitId; registerChecks.Add(lisRequestItem.registerCheck); } @@ -212,6 +213,7 @@ namespace Shentun.Peis.ImportLisResults RegisterCheckId = registerCheck.Id, CheckDoctorId = registerCheck.CheckDoctorId, CheckDate = registerCheck.CheckDate, + ExecOrganizationUnitId = registerCheck.ExecOrganizationUnitId, RegisterCheckItems = list.Where(o => o.registerCheck.Id == registerCheck.Id) .Select(o => new UpdateRegisterCheckItemDetail() { diff --git a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs index 3fd48af..751d5f1 100644 --- a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs +++ b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs @@ -217,7 +217,9 @@ namespace Shentun.Peis.RegisterChecks var entlist = (await _registerCheckRepository.GetQueryableAsync()) .Include(x => x.RegisterCheckAsbitems) .ThenInclude(x => x.Asbitem).ThenInclude(x => x.ItemType) - .Where(m => m.RegisterCheckAsbitems.Select(s => s.PatientRegisterId).Contains(input.PatientRegisterId)); + .Where(m => m.RegisterCheckAsbitems.Select(s => s.PatientRegisterId) + .Contains(input.PatientRegisterId) + && m.RegisterCheckAsbitems.Select(s=>s.Asbitem.IsCheck).Contains('Y')); #region 增加项目类别权限 @@ -279,7 +281,11 @@ namespace Shentun.Peis.RegisterChecks var registerCheck = await _registerCheckRepository.GetAsync(input.RegisterCheckId); var patientRegister = await _patientRegisterRepository.GetAsync(registerCheck.PatientRegisterId); //修改医生和检查日期 - _registerCheckManager.UpdateCheckDoctorAndDateAsync(patientRegister, registerCheck, input.CheckDoctorId, input.CheckDate); + if(string.IsNullOrWhiteSpace(input.CheckDoctorId)) + { + input.CheckDoctorId = CurrentUser.Id.ToString(); + } + _registerCheckManager.UpdateCheckDoctorAndDateAsync(patientRegister, registerCheck, input.CheckDoctorId, input.CheckDate,input.ExecOrganizationUnitId); //更新人员登记信息完成标志 patientRegister.CompleteFlag = PatientRegisterCompleteFlag.PartCheck; await _patientRegisterRepository.UpdateAsync(patientRegister); diff --git a/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs b/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs index 09938ee..563c01b 100644 --- a/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs +++ b/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; +using Volo.Abp.Identity; using Volo.Abp.Users; namespace Shentun.Peis.RegisterChecks @@ -25,6 +26,8 @@ namespace Shentun.Peis.RegisterChecks private readonly IRepository _sysParmValueRepository; private readonly IRepository _customerOrgRepository; private readonly IRepository _primarykeyBuilderRepository; + private readonly IRepository _usersRepository; + private readonly IRepository _identityUserOrganizationUnitRepository; private readonly RegisterCheckSummaryManager _registerCheckSummaryManager; private readonly RegisterCheckSuggestionManager _registerCheckSuggestionManager; private readonly CurrentUser _currentUser; @@ -37,7 +40,9 @@ namespace Shentun.Peis.RegisterChecks IRepository registerCheckItemRepository, RegisterCheckSummaryManager registerCheckSummaryManager, RegisterCheckSuggestionManager registerCheckSuggestionManager, - IRepository patientRegisterRepository) + IRepository patientRegisterRepository, + IRepository usersRepository, + IRepository identityUserOrganizationUnitRepository) { this._registerCheckRepository = registerCheckRepository; this._sysParmValueRepository = sysParmValueRepository; @@ -48,6 +53,8 @@ namespace Shentun.Peis.RegisterChecks this._registerCheckSummaryManager = registerCheckSummaryManager; this._registerCheckSuggestionManager = registerCheckSuggestionManager; _patientRegisterRepository = patientRegisterRepository; + _usersRepository = usersRepository; + _identityUserOrganizationUnitRepository = identityUserOrganizationUnitRepository; } /// @@ -152,6 +159,11 @@ namespace Shentun.Peis.RegisterChecks entity.CheckDate = DateTime.Now; else entity.CheckDate = entitydto.CheckDate; + + if (string.IsNullOrWhiteSpace(entitydto.CheckDoctorId)) + { + entitydto.CheckDoctorId = _currentUser.Id.ToString(); + } entity.CheckDoctorId = entitydto.CheckDoctorId; entity.CompleteFlag = RegisterCheckCompleteFlag.Checked; @@ -161,7 +173,8 @@ namespace Shentun.Peis.RegisterChecks PatientRegister patientRegister, RegisterCheck entity, string checkDoctorId, - DateTime? checkDate + DateTime? checkDate, + Guid? execOrganizationUnitId ) { if (entity == null) @@ -185,8 +198,24 @@ namespace Shentun.Peis.RegisterChecks else entity.CheckDate = checkDate; + if (string.IsNullOrWhiteSpace(checkDoctorId)) + { + checkDoctorId = _currentUser.Id.ToString(); + } entity.CheckDoctorId = checkDoctorId; entity.CompleteFlag = RegisterCheckCompleteFlag.Checked; + if(execOrganizationUnitId != null && execOrganizationUnitId != Guid.Empty) + { + entity.ExecOrganizationUnitId = execOrganizationUnitId; + } + else + { + if(Guid.TryParse(entity.CheckDoctorId,out var checkDoctorIdGuid)) + { + var identityUserOrganizationUnit = _identityUserOrganizationUnitRepository.GetAsync(o => o.UserId == checkDoctorIdGuid).Result; + entity.ExecOrganizationUnitId = identityUserOrganizationUnit.OrganizationUnitId; + } + } } /// /// 更改危警值内容