导航属性加注释

Uat_Study
hang 2022-08-26 10:21:11 +08:00
parent 22f04c82ba
commit 0342048a02
5 changed files with 108 additions and 89 deletions

View File

@ -74,6 +74,7 @@ namespace IRaCIS.Core.Domain.Models
public Guid? ParentId { get; set; }
[JsonIgnore]
[ForeignKey("ParentId")]
public SystemBasicData Parent { get; set; }

View File

@ -15,14 +15,14 @@ namespace IRaCIS.Core.Domain.Models
[Table("SystemDocument")]
public class SystemDocument : Entity, IAuditUpdate, IAuditAdd,ISoftDelete
{
[JsonIgnore]
public List<SystemDocConfirmedUser> SystemDocConfirmedUserList { get; set; }
[JsonIgnore]
public List<SystemDocNeedConfirmedUserType> NeedConfirmedUserTypeList { get; set; }
[JsonIgnore]
[ForeignKey("FileTypeId")]
public Dictionary FileType { get; set; }

View File

@ -17,7 +17,7 @@ namespace IRaCIS.Core.Domain.Models
//public Guid TrialId { get; set; }
//public TrialUser TrialUser { get; set; }
[JsonIgnore]
public TrialDocument TrialDocument { get; set; }

View File

@ -18,13 +18,13 @@ namespace IRaCIS.Core.Domain.Models
//需要确认的项目用户 通过TrialId 关联 用中间表过滤
[JsonIgnore]
public List<TrialDocUserTypeConfirmedUser> TrialDocConfirmedUserList { get; set; }
[JsonIgnore]
public List<TrialDocNeedConfirmedUserType> NeedConfirmedUserTypeList { get; set; }
[JsonIgnore]
public Trial Trial { get; set; }
[JsonIgnore]
[ForeignKey("FileTypeId")]
public Dictionary FileType { get; set; }

View File

@ -100,52 +100,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
#region 区分
//系统文件
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocument)))
{
var entity = item.Entity as SystemDocument;
var userTypes = entity.NeedConfirmedUserTypeList;
if (userTypes == null)
{
userTypes = await _dbContext.SystemDocNeedConfirmedUserType.Where(x => x.SystemDocumentId == entity.Id).ToListAsync();
}
var userTypeIds = userTypes.Select(x => x.NeedConfirmUserTypeId).ToList();
var userTypeNameList = await _dbContext.UserType.Where(x => userTypeIds.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync();
var userTypeName = string.Join(",", userTypeNameList);
await InsertInspection<SystemDocument>(entity, type, null, new
{
NeedConfirmedUserType = userTypeName,
});
}
// 项目文档
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument)))
{
var entity = item.Entity as TrialDocument;
var userTypes = entity.NeedConfirmedUserTypeList;
if (userTypes == null)
{
userTypes = await _dbContext.TrialDocNeedConfirmedUserType.Where(x => x.TrialDocumentId == entity.Id).ToListAsync();
}
var userTypeIds = userTypes.Select(x => x.NeedConfirmUserTypeId).ToList();
var usertypeNames = await _dbContext.UserType.Where(x => userTypeIds.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync();
var usertypeName = string.Join(",", usertypeNames);
await InsertInspection<TrialDocument>(entity, type, null, new
{
NeedConfirmedUserType = usertypeName,
});
}
// 系统文件签署
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocConfirmedUser)))
@ -155,6 +109,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
await InsertInspection<SystemDocConfirmedUser>(entity, type, x => new InspectionConvertDTO()
{
GeneralId = x.Id,
ObjectRelationParentId=x.SystemDocumentId
}, new
{
@ -175,6 +132,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
await InsertInspection<TrialDocUserTypeConfirmedUser>(entity as TrialDocUserTypeConfirmedUser, type, x => new InspectionConvertDTO()
{
TrialId = trialid,
ObjectRelationParentId = x.TrialDocumentId
}, new
{
FileTypeId = trialDocument.FileTypeId,
@ -510,6 +468,65 @@ namespace IRaCIS.Core.Infra.EFCore.Common
#region 已修改
//系统文件
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocument)))
{
var entity = item.Entity as SystemDocument;
List<Guid> needConfirmedUserTypeIdList = new List<Guid>();
if (entity.NeedConfirmedUserTypeList == null)
{
needConfirmedUserTypeIdList = await _dbContext.SystemDocNeedConfirmedUserType.Where(x => x.SystemDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync();
}
else
{
needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList();
}
var userTypeNameList = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync();
var userTypeName = string.Join(",", userTypeNameList);
await InsertInspection<SystemDocument>(entity, type, null, new
{
NeedConfirmedUserType = userTypeName,
});
}
// 项目文档
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument)))
{
var entity = item.Entity as TrialDocument;
List<Guid> needConfirmedUserTypeIdList = new List<Guid>();
if (entity.NeedConfirmedUserTypeList == null)
{
needConfirmedUserTypeIdList = await _dbContext.TrialDocNeedConfirmedUserType.Where(x => x.TrialDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync();
}
else
{
needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList();
}
var usertypeNames = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync();
var usertypeName = string.Join(",", usertypeNames);
await InsertInspection<TrialDocument>(entity, type, x => new InspectionConvertDTO()
{ ObjectRelationParentId = x.TrialId },
new
{
NeedConfirmedUserType = usertypeName,
});
}
// 签名模板
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemBasicData)))
{
@ -606,8 +623,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}
// 受试者
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject)))
{
@ -709,31 +724,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
//});
}
//// 非Dicom文件
//if (entitys.Any(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)))
//{
// var noneDicomStudyfile = entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)).Select(x => x.Entity).FirstOrDefault() as NoneDicomStudyFile;
// var noneDicomStudy = await _dbContext.NoneDicomStudy.Where(x => x.Id == noneDicomStudyfile.NoneDicomStudyId).FirstOrDefaultAsync();
// if (noneDicomStudy != null)
// {
// var filecount = await _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == noneDicomStudyfile.NoneDicomStudyId).CountAsync();
// var count = entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)).ToList().Count;
// if (type == "Deleted")
// {
// filecount = filecount - count;
// }
// else
// {
// filecount = filecount + count;
// }
// await InsertInspection<NoneDicomStudy>(noneDicomStudy, type, null, new
// {
// FileCount = filecount,
// });
// }
//}
#region 阅片人入组
@ -1498,6 +1489,33 @@ namespace IRaCIS.Core.Infra.EFCore.Common
#region 待废弃 -by zhouhang 调整
//// 非Dicom文件
//if (entitys.Any(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)))
//{
// var noneDicomStudyfile = entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)).Select(x => x.Entity).FirstOrDefault() as NoneDicomStudyFile;
// var noneDicomStudy = await _dbContext.NoneDicomStudy.Where(x => x.Id == noneDicomStudyfile.NoneDicomStudyId).FirstOrDefaultAsync();
// if (noneDicomStudy != null)
// {
// var filecount = await _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == noneDicomStudyfile.NoneDicomStudyId).CountAsync();
// var count = entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)).ToList().Count;
// if (type == "Deleted")
// {
// filecount = filecount - count;
// }
// else
// {
// filecount = filecount + count;
// }
// await InsertInspection<NoneDicomStudy>(noneDicomStudy, type, null, new
// {
// FileCount = filecount,
// });
// }
//}
/// <summary>
/// 获取稽查通用数据 (每条稽查记录必须查询的)
/// </summary>