修改一版
parent
d096461fda
commit
ad60991589
|
@ -48,14 +48,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
/// </summary>
|
||||
public async Task IncomingEntitys(List<EntityEntry> entitys)
|
||||
{
|
||||
// 新增
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Added).ToList(), "Add");
|
||||
|
||||
// 修改
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Modified&&(!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType())
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Modified && (!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType())
|
||||
|| !(bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity))
|
||||
).ToList(), "Update");
|
||||
|
||||
// 新增
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Added).ToList(), "Add");
|
||||
|
||||
// 删除
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Deleted
|
||||
||((typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType())&& (bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity)))
|
||||
|
@ -116,10 +116,16 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
// 受试者
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject)))
|
||||
{
|
||||
var entity = item.Entity as Subject;
|
||||
var FinalSubjectVisitName = await _dbContext.SubjectVisit.AsNoTracking().Where(x => x.Id == entity.FinalSubjectVisitId&& entity.FinalSubjectVisitId!=null).Select(x => x.VisitName).FirstOrDefaultAsync();
|
||||
|
||||
await InsertInspection<Subject>(item, type, x => new DataInspection()
|
||||
{
|
||||
SubjectId = x.Id,
|
||||
SubjectCode=x.Code,
|
||||
}, new
|
||||
{
|
||||
FinalSubjectVisitName = FinalSubjectVisitName,
|
||||
});
|
||||
}
|
||||
// 访视
|
||||
|
@ -154,6 +160,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
SubjectId=x.SubjectId,
|
||||
SubjectVisitId = x.Id,
|
||||
SubjectVisitName=x.VisitName,
|
||||
BlindName=x.BlindName,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -205,7 +212,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
var entity = item.Entity as DicomSeries;
|
||||
if (entity.DicomStudy == null)
|
||||
{
|
||||
entity.DicomStudy =await _dbContext.DicomStudys.FirstOrDefaultAsync(x=>x.Id== entity.StudyId);
|
||||
entity.DicomStudy =await _dbContext.DicomStudys.AsNoTracking().FirstOrDefaultAsync(x=>x.Id== entity.StudyId);
|
||||
}
|
||||
await InsertInspection<DicomSeries>(item, type, x => new DataInspection()
|
||||
{
|
||||
|
|
|
@ -43,27 +43,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// <returns></returns>
|
||||
Task<DataInspection> SetDataInspectionDateType(DataInspection Data);
|
||||
|
||||
/// <summary>
|
||||
/// 处理枚举
|
||||
/// </summary>
|
||||
/// <param name="Identification">标识</param>
|
||||
/// <param name="json">json对象</param>
|
||||
/// <returns></returns>
|
||||
|
||||
Task<string> SetEnum(Guid trial, string Identification, string json);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取外键表数据
|
||||
/// </summary>
|
||||
/// <param name="Table">表名称</param>
|
||||
/// <param name="ForeignKeyValue">外键value</param>
|
||||
/// <param name="ForeignKeyText">要查询的外键值</param>
|
||||
/// <param name="value">传入的纸</param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetInspectionEnumValue(string Identification, string json);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 翻译稽查数据
|
||||
/// </summary>
|
||||
|
|
|
@ -584,11 +584,16 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// <returns></returns>
|
||||
public async Task<List<string>> SetInspectionEnumValue(SetInspectionEnumValueDto dto)
|
||||
{
|
||||
var listIdentification = dto.Items.Select(x => x.Identification).ToList() ;
|
||||
foreach (var item in dto.Items)
|
||||
{
|
||||
item.Json = await GetInspectionEnumValue(item.Identification, item.Json);
|
||||
item.Json = await SetEnum(dto.TrialId, item.Identification, item.Json);
|
||||
item.Json = await SetDataInspectionDateType(item.Identification, item.Json);
|
||||
if (item.Identification == string.Empty || item.Json == string.Empty)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
item.Json = await GetInspectionEnumValue(listIdentification, item.Json);
|
||||
item.Json = await SetEnum(dto.TrialId, listIdentification, item.Json);
|
||||
item.Json = await SetDataInspectionDateType(listIdentification, item.Json);
|
||||
}
|
||||
return dto.Items.Select(x => x.Json).ToList();
|
||||
}
|
||||
|
@ -602,9 +607,9 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// </summary>
|
||||
/// <param name="Data">稽查数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> SetDataInspectionDateType(string identification, string json)
|
||||
public async Task<string> SetDataInspectionDateType(List<string> identification, string json)
|
||||
{
|
||||
var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == identification)
|
||||
var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => identification.Contains(x.Identification))
|
||||
join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable.HasValue && x.IsEnable.Value) on parent.Id equals child.ParentId
|
||||
select new DateDto()
|
||||
{
|
||||
|
@ -612,6 +617,12 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
DateType = child.DateType,
|
||||
}).ToListAsync();
|
||||
|
||||
list = list.GroupBy(x => new { x.Code }, (key, lst) => new DateDto()
|
||||
{
|
||||
Code = key.Code,
|
||||
DateType = lst.Max(x => x.DateType),
|
||||
}).ToList();
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
|
||||
if (JsonData == null)
|
||||
|
@ -657,9 +668,9 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// <param name="ForeignKeyText">要查询的外键值</param>
|
||||
/// <param name="value">传入的纸</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetInspectionEnumValue(string identification, string json)
|
||||
public async Task<string> GetInspectionEnumValue(List<string> identification, string json)
|
||||
{
|
||||
var list = await (from u in _dbContext.FrontAuditConfig.Where(x => x.Identification == identification)
|
||||
var list = await (from u in _dbContext.FrontAuditConfig.Where(x => identification.Contains(x.Identification))
|
||||
join p in _dbContext.FrontAuditConfig.Where(x => x.EnumType == "Foreign" && x.IsEnable.HasValue && x.IsEnable.Value) on u.Id equals p.ParentId
|
||||
select new
|
||||
{
|
||||
|
@ -669,6 +680,17 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
ForeignKeyTable = p.ForeignKeyTable
|
||||
}).ToListAsync();
|
||||
|
||||
list= list.GroupBy(x => new { x.Key }, (key, lst) => new
|
||||
{
|
||||
Key=key.Key,
|
||||
ForeignKeyValue=lst.Max(x=>x.ForeignKeyValue),
|
||||
ForeignKeyText = lst.Max(x => x.ForeignKeyText),
|
||||
ForeignKeyTable = lst.Max(x => x.ForeignKeyTable),
|
||||
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
var JsonDataValue = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
foreach (var item in list)
|
||||
{
|
||||
|
@ -713,13 +735,13 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
/// <param name="json">Json对象</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
public async Task<string> SetEnum(Guid trilaid, string identification, string json)
|
||||
public async Task<string> SetEnum(Guid trilaid, List<string> identification, string json)
|
||||
{
|
||||
if (json == null||json=="null")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var list = await (from u in _dbContext.FrontAuditConfig.Where(x => x.Identification == identification)
|
||||
var list = await (from u in _dbContext.FrontAuditConfig.Where(x => identification.Contains(x.Identification))
|
||||
join p in _dbContext.FrontAuditConfig.Where(x => x.Code != "AuditState" && x.EnumType == "Dictionary"&&x.IsEnable.HasValue&& x.IsEnable.Value) on u.Id equals p.ParentId
|
||||
select new
|
||||
{
|
||||
|
@ -739,6 +761,14 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
Type = "Code",
|
||||
});
|
||||
|
||||
|
||||
list = list.GroupBy(x => new { x.Key }, (key, lst) => new
|
||||
{
|
||||
Key = key.Key,
|
||||
Code = lst.Max(x => x.Code),
|
||||
Type = lst.Max(x => x.Type),
|
||||
}).ToList();
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
foreach (var item in list)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue