diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index f53e64a05..1e65277f1 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -59,6 +59,17 @@ namespace IRaCIS.Core.Application.ViewModel public string ByTrialConfig { get; set; } = string.Empty; + /// + /// 是否向前站位 + /// + public bool? IsForwardPosition { get; set; } + + /// + /// 标识 + /// + public string Identification { get; set; } + + } @@ -134,6 +145,17 @@ namespace IRaCIS.Core.Application.ViewModel public string ByTrialConfig { get; set; } = string.Empty; + /// + /// 是否向前站位 + /// + public bool? IsForwardPosition { get; set; } + + /// + /// 标识 + /// + public string Identification { get; set; } = string.Empty; + + } diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index 6e79e44f9..139b4c85c 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -132,7 +132,9 @@ namespace IRaCIS.Core.Application.Service ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN, IsShowByTrialConfig =data.IsShowByTrialConfig, ByTrialConfig=data.ByTrialConfig, - }; + IsForwardPosition=data.IsForwardPosition, + Identification=data.Identification, + }; query = query .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value) @@ -160,7 +162,18 @@ namespace IRaCIS.Core.Application.Service //CreateMap(); // CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap(); - + + if (await _frontAuditConfigRepository.AnyAsync(x => x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id&&x.ConfigType=="M")) + { + return ResponseOutput.NotOk("标识重复"); + } + + + if (await _frontAuditConfigRepository.AnyAsync(x => x.Description == addOrEditFrontAuditConfig.Description && x.Id != addOrEditFrontAuditConfig.Id && x.ConfigType == "M")) + { + return ResponseOutput.NotOk("名称重复"); + } + addOrEditFrontAuditConfig.CreateTime= DateTime.Now; addOrEditFrontAuditConfig.UpdateTime= DateTime.Now; addOrEditFrontAuditConfig.CreateUserId = _userInfo.Id; diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index 9a0d5ffe2..d319b59f4 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -86,6 +86,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO /// public string ObjectType { get; set; } = string.Empty; + /// + /// 标识 + /// + public string Identification { get; set; } = string.Empty; + + ////需要单独处理 //public string IP { get; set; } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 319c2332c..e96020609 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -46,35 +46,29 @@ namespace IRaCIS.Core.Application.Service.Inspection join moduleTypec in _repository.GetQueryable() on new { ParentId = moduleTyped.Id, ModuleType = data.ModuleType } equals new { ParentId = moduleTypec.ParentId.Value, ModuleType = moduleTypec.Value } into moduleTypectemp from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty() - join childrenTyped in _repository.GetQueryable().Where(x => x.Code == "ChildrenType") on 1 equals 1 - join childrenTypec in _repository.GetQueryable() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp - from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty() + //join childrenTyped in _repository.GetQueryable().Where(x => x.Code == "ChildrenType") on 1 equals 1 + //join childrenTypec in _repository.GetQueryable() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp + //from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty() - join ObjectTyped in _repository.GetQueryable().Where(x => x.Code == "ObjectType") on 1 equals 1 - join ObjectTypec in _repository.GetQueryable() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp - from leftObjectType in objectTypetemp.DefaultIfEmpty() + //join ObjectTyped in _repository.GetQueryable().Where(x => x.Code == "ObjectType") on 1 equals 1 + //join ObjectTypec in _repository.GetQueryable() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp + //from leftObjectType in objectTypetemp.DefaultIfEmpty() - join OptTyped in _repository.GetQueryable().Where(x => x.Code == "OptType") on 1 equals 1 - join OptTypec in _repository.GetQueryable() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp - from leftOptType in optTypetemp.DefaultIfEmpty() + //join OptTyped in _repository.GetQueryable().Where(x => x.Code == "OptType") on 1 equals 1 + //join OptTypec in _repository.GetQueryable() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp + //from leftOptType in optTypetemp.DefaultIfEmpty() join trialSign in _repository.GetQueryable() on data.SignId equals trialSign.Id into trialSigntemp from lefttrialSign in trialSigntemp.DefaultIfEmpty() - join frontAuditConfig in _repository.GetQueryable().Where(x=>x.ConfigType=="M") on new + join frontAuditConfig in _repository.GetQueryable().Where(x=>x.ConfigType=="M"&&!x.Identification.IsNullOrEmpty()) on new { - ModuleTypeId = leftmoduleTypec.Id.ToString(), - ChildrenTypeId = leftchildrenTypec.Id.ToString(), - ObjectTypeId = leftObjectType.Id.ToString(), - OptTypeId = leftOptType.Id.ToString(), + data.Identification } equals new { - frontAuditConfig.ModuleTypeId, - frontAuditConfig.ChildrenTypeId, - frontAuditConfig.ObjectTypeId, - frontAuditConfig.OptTypeId, + frontAuditConfig.Identification, } into frontAuditConfigtemp from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty() @@ -254,12 +248,12 @@ namespace IRaCIS.Core.Application.Service.Inspection /// 签名Id /// 初始化状态对象 /// - public async Task AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null) + public async Task AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId=null, object? Statusdata = null) { await SetEnum(addDto); var add = _mapper.Map(addDto); Guid? parentId = null; - parentId = (await _repository.GetQueryable().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ModuleType==add.ModuleType&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; + 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.ParentId = parentId; add.CreateTime = DateTime.Now; add.CreateUserId = _userInfo.Id; @@ -269,8 +263,6 @@ namespace IRaCIS.Core.Application.Service.Inspection await _repository.AddAsync(add); if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null) { - - DataInspection ststus=JsonConvert.DeserializeObject(JsonConvert.SerializeObject(add))??new DataInspection(); ststus.CreateTime = add.CreateTime.AddSeconds(1); ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata); @@ -309,7 +301,7 @@ namespace IRaCIS.Core.Application.Service.Inspection { guids.Add(Guid.Parse(x.ToString())); }); - JsonData[item.Key] = string.Join(',', await _repository.GetQueryable().Where(x => guids.Contains(x.Id)).Select(x => x.Value).ToListAsync()); + JsonData[item.Key] = string.Join(',', await _repository.GetQueryable().Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync()); } else { @@ -325,7 +317,7 @@ namespace IRaCIS.Core.Application.Service.Inspection parent = b }).SelectMany(a => a.parent, (m, n) => new { - value = n.Value + value = n.ValueCN }).Select(x => x.value).ToListAsync() ); } @@ -335,13 +327,13 @@ namespace IRaCIS.Core.Application.Service.Inspection if (item.Type.ToLower() == "id".ToLower()) { Guid guid = Guid.Parse(value.ToString()); - JsonData[item.Key] = await _repository.GetQueryable().Where(x => guid == x.Id).Select(x => x.Value).FirstOrDefaultAsync(); + JsonData[item.Key] = await _repository.GetQueryable().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync(); } else { JsonData[item.Key] = await _repository.GetQueryable().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new { - value=b.Value + value=b.ValueCN }).Select(x=>x.value).FirstOrDefaultAsync(); } diff --git a/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs index fd2acd785..65aabd9f1 100644 --- a/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/Interface/IInspectionService.cs @@ -21,8 +21,9 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface Task Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response = null, object? Statusdata = null); - Task AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null); - Task SetEnum(DataInspectionAddDTO Data); + + + Task AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null, object? Statusdata = null); } } diff --git a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 865932753..a625583b9 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -116,6 +116,16 @@ namespace IRaCIS.Core.Domain.Models public string ByTrialConfig { get; set; } + /// + /// 是否向前站位 + /// + public bool? IsForwardPosition { get; set; } + + /// + /// 标识 + /// + public string Identification { get; set; } + } diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index 567e835ce..f5025dbb8 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -144,6 +144,11 @@ namespace IRaCIS.Core.Domain.Models /// public string ObjectType { get; set; } + /// + /// 标识 + /// + public string Identification { get; set; } + }