diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index e40faf00d..465c6776f 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -169,6 +169,10 @@ namespace IRaCIS.Core.Application.Service DictionaryCode = lst.Max(x => x.DictionaryCode), DictionaryType = lst.Max(x => x.DictionaryType), DateType = lst.Select(x => x.DateType).FirstOrDefault(), + ForeignKeyValue = lst.Select(x => x.ForeignKeyValue).FirstOrDefault(), + ForeignKeyText = lst.Select(x => x.ForeignKeyText).FirstOrDefault(), + ForeignKeyTable = lst.Select(x => x.ForeignKeyTable).FirstOrDefault(), + DataType = lst.Select(x => x.DataType).FirstOrDefault(), Id =NewId.NextGuid()//新id, }).ToList(); @@ -189,10 +193,18 @@ namespace IRaCIS.Core.Application.Service var item = alllist.FirstOrDefault(y => y.ValueCN == x.ValueCN); if (item != null) { - x.Code=x.Code.IsNullOrEmpty()?item.Code:x.Code; + x.Code=item.Code; x.Value = x.Code.IsNullOrEmpty() ? item.Value : x.Value; x.DictionaryType = x.DictionaryType.IsNullOrEmpty() ? item.DictionaryType : x.DictionaryType; x.DictionaryCode = x.DictionaryCode.IsNullOrEmpty() ? item.DictionaryCode : x.DictionaryCode; + x.DataType = x.DataType.IsNullOrEmpty() ? item.DataType : x.DataType; + x.DateType = x.DateType.IsNullOrEmpty() ? item.DateType : x.DateType; + x.DictionaryKey = x.DictionaryKey.IsNullOrEmpty() ? item.DictionaryKey : x.DictionaryKey; + x.IsShowParent = x.IsShowParent==null ? item.IsShowParent : x.IsShowParent; + x.ForeignKeyTable = x.ForeignKeyTable.IsNullOrEmpty() ? item.ForeignKeyTable : x.ForeignKeyTable; + x.ForeignKeyText = x.ForeignKeyText.IsNullOrEmpty() ? item.ForeignKeyText : x.ForeignKeyText; + x.ForeignKeyValue = x.ForeignKeyValue.IsNullOrEmpty() ? item.ForeignKeyValue : x.ForeignKeyValue; + x.EnumType = x.EnumType.IsNullOrEmpty() ? item.EnumType : x.EnumType; } }); diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index a5c2db85d..2f9c49f10 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Service.Inspection from lefttrialSign in trialSigntemp.DefaultIfEmpty() - join leftfrontAuditConfig in _repository.GetQueryable().Where(x=>x.ConfigType=="M"&&x.Identification!=null) on + join leftfrontAuditConfig in _repository.GetQueryable().Where(x=>x.ConfigType=="M"&&x.Identification!=null&&x.IsEnable==true) on data.Identification.ToLower() equals leftfrontAuditConfig.Identification.ToLower() diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 055f21b23..1ec525f30 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -1441,7 +1441,7 @@ namespace IRaCIS.Core.Application.Image.QA } } - + dbSubjectVisit.Auditor = _userInfo.Id; dbSubjectVisit.IsTake = false; dbSubjectVisit.CurrentActionUserId = null; dbSubjectVisit.CurrentActionUserExpireTime = null; diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index d8db7c9a8..fca625f64 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -54,7 +54,7 @@ namespace IRaCIS.Application.Services //添加受试者的时候,获取访视计划列表,添加到受试者访视表。 - var visitPlan = await _repository.Where(t => t.TrialId == subjectCommand.TrialId).ToListAsync(); + var visitPlan = await _repository.Where(t => t.TrialId == subjectCommand.TrialId&&t.IsConfirmed).ToListAsync(); svlist = _mapper.Map>(visitPlan); diff --git a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs index a4ec907c2..9576dee2e 100644 --- a/IRaCIS.Core.Domain/Visit/SubjectVisit.cs +++ b/IRaCIS.Core.Domain/Visit/SubjectVisit.cs @@ -49,6 +49,9 @@ namespace IRaCIS.Core.Domain.Models public Guid UpdateUserId { get; set; } public DateTime UpdateTime { get; set; } + public Guid? Auditor { get; set; } + + //public SubjectVisitStateEnum VisitState { get; set; } //核查状态 diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index bde268bab..79838ca0b 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -49,8 +49,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common public async Task IncomingEntitys(List entitys) { // 修改 - await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Modified && (!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) - || !(bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity)) + await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Modified && ((!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) + || !(bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity))||x.Entity.GetType()== typeof(DicomSeries)) ).ToList(), "Update"); // 新增 @@ -58,7 +58,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common // 删除 await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Deleted - ||((typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType())&& (bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity))) + ||((typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType())&& x.Entity.GetType() != typeof(DicomSeries) && (bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity))) ).ToList(), "Deleted"); @@ -146,17 +146,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomSeries))) { var entity = item.Entity as DicomSeries; - if (entity.DicomStudy == null) + var dicomStudy = entity.DicomStudy.Clone(); + if (dicomStudy == null) { - entity.DicomStudy = await _dbContext.DicomStudys.AsNoTracking().FirstOrDefaultAsync(x => x.Id == entity.StudyId); + dicomStudy = await _dbContext.DicomStudys.AsNoTracking().FirstOrDefaultAsync(x => x.Id == entity.StudyId); } await InsertInspection(item, type, x => new DataInspection() { GeneralId = x.Id, }, new { - StudyCode = entity.DicomStudy?.StudyCode, - Modalities = entity.DicomStudy?.Modalities, + StudyCode = dicomStudy?.StudyCode, + Modalities = dicomStudy?.Modalities, }); } diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index f0048ec8a..a157d7609 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -701,27 +701,31 @@ namespace IRaCIS.Core.Infra.EFCore string Table = item.ForeignKeyTable; string ForeignKeyValue = item.ForeignKeyValue; string ForeignKeyText = item.ForeignKeyText; - string value = JsonDataValue[item.Key].ToString(); - string para = string.Empty; - string sql = string.Empty; - var JsonData = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(new { item = value })); - if (JsonData["item"].GetType() == typeof(JArray)) + if (JsonDataValue[item.Key] != null) { - foreach (var v in JsonData["item"] as JArray) + string value = JsonDataValue[item.Key].ToString(); + string para = string.Empty; + string sql = string.Empty; + var JsonData = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(new { item = value })); + if (JsonData["item"].GetType() == typeof(JArray)) { - para += para == string.Empty ? $"'{v.ToString()}'" : $",'{v.ToString()}'"; + foreach (var v in JsonData["item"] as JArray) + { + para += para == string.Empty ? $"'{v.ToString()}'" : $",'{v.ToString()}'"; + } + sql = $"select {ForeignKeyText} Text from {Table} where {ForeignKeyValue} in (@para)"; } - sql = $"select {ForeignKeyText} Text from {Table} where {ForeignKeyValue} in (@para)"; - } - else - { - para = $"{JsonData["item"].ToString()}"; - sql = $"select {ForeignKeyText} Text from {Table} where {ForeignKeyValue} = @para"; - } - SqlParameter[] paravalue = new SqlParameter[] { + else + { + para = $"{JsonData["item"].ToString()}"; + sql = $"select {ForeignKeyText} Text from {Table} where {ForeignKeyValue} = @para"; + } + SqlParameter[] paravalue = new SqlParameter[] { new SqlParameter("@para",para) }; - JsonDataValue[item.Key] = string.Join(",", _dbContext.Database.SqlQuery(sql, paravalue).Select(x => x.Text).ToList()); + JsonDataValue[item.Key] = string.Join(",", _dbContext.Database.SqlQuery(sql, paravalue).Select(x => x.Text).ToList()); + } + } return JsonConvert.SerializeObject(JsonDataValue);