From 7a1cc3e29fda6a0a49a75cc572da7e61184c5cb5 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Thu, 7 Apr 2022 12:01:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=B9=E9=87=8F=E6=8F=92?= =?UTF-8?q?=E5=85=A5=E7=A8=BD=E6=9F=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/FrontAuditConfigService.cs | 2 +- .../Service/Inspection/InspectionService.cs | 34 +++++++++++++++++-- .../Interface/IInspectionService.cs | 7 ++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index edcfaabae..c3a4565ab 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.Service { var list =await (from data in _repository.GetQueryable().Where(x => x.Identification == item.Identification) join childrenType in _repository.GetQueryable() on data.Id equals childrenType.ParentId - select childrenType).ToListAsync(); + select childrenType).OrderBy(x=>x.Sort).ToListAsync(); return list; } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 3c9570433..28ec2bed0 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -18,9 +18,11 @@ namespace IRaCIS.Core.Application.Service.Inspection [NonDynamicWebApi] public class InspectionService : BaseService, IInspectionService { - public InspectionService() - { - + private readonly IRepository _dataInspectionRepository; + + public InspectionService(IRepository dataInspectionRepository) + { + this._dataInspectionRepository = dataInspectionRepository; } public async Task> GetInspectionData(GetDataInspectionDto dto) { @@ -278,6 +280,32 @@ namespace IRaCIS.Core.Application.Service.Inspection } + + /// + /// 批量添加稽查记录 + /// + /// + /// + public async Task AddListInspectionRecordAsync(List datas) + { + //var trialIds= datas.Select(x=>x.TrialId).Distinct().ToList(); + //var subjectVisitIds= datas.Select(x=>x.SubjectVisitId).Distinct().ToList(); + //var subjectIds = datas.Select(x => x.SubjectId).Distinct().ToList(); + //var siteIds = datas.Select(x => x.SiteId).Distinct().ToList(); + //var childrenTypes= datas.Select(x => x.ChildrenType).Distinct().ToList(); + //var objectTypes = datas.Select(x => x.ObjectType).Distinct().ToList(); + + foreach (var add in datas) + { + add.ParentId = (await _repository.GetQueryable().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.ChildrenType == add.ChildrenType && x.ObjectType == add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; + add.CreateUserId = _userInfo.Id; + add.IP = _userInfo.IP; + } + + await _dataInspectionRepository.AddRangeAsync(datas); + + } + /// /// 处理枚举 /// diff --git a/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs index 65aabd9f1..8e7d304c3 100644 --- a/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs @@ -25,5 +25,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface Task AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null, object? Statusdata = null); + + /// + /// 批量添加稽查记录 + /// + /// + /// + Task AddListInspectionRecordAsync(List datas); } }