Uat_Study
parent
4f99de69b5
commit
12a0812bcd
|
@ -67,7 +67,7 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
|||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public DateTime? CreateTime { get; set; } = DateTime.Now;
|
||||
public string UserRealName { get; set; } = String.Empty;
|
||||
|
||||
}
|
||||
|
|
|
@ -288,9 +288,9 @@ namespace IRaCIS.Core.Application.Services
|
|||
{
|
||||
var addArray = _mapper.Map<List<TrialSiteUser>>(trialSiteCRCList);
|
||||
|
||||
await _repository.AddRangeAsync(addArray);
|
||||
await _trialSiteUserRepository.AddRangeAsync(addArray);
|
||||
|
||||
return ResponseOutput.Result(await _repository.SaveChangesAsync());
|
||||
return ResponseOutput.Result(await _trialSiteUserRepository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
/// <summary> 删除CRC人员</summary>
|
||||
|
@ -300,8 +300,8 @@ namespace IRaCIS.Core.Application.Services
|
|||
{
|
||||
|
||||
|
||||
var isSuccess = await _trialSiteUserRepository.BatchUpdateNoTrackingAsync(u => u.Id == id, u => new TrialSiteUser()
|
||||
{ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null });
|
||||
var isSuccess = await _trialSiteUserRepository.UpdatePartialFromQueryAsync(id, u => new TrialSiteUser()
|
||||
{ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null },true);
|
||||
|
||||
return ResponseOutput.Ok(isSuccess);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
|
||||
/// <summary>
|
||||
/// 数据库对象
|
||||
/// 数据库对象o
|
||||
/// </summary>
|
||||
public IRaCISDBContext _dbContext { get; set; }
|
||||
|
||||
|
@ -79,8 +79,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
return new List<Type>()
|
||||
{
|
||||
typeof(TrialUser)
|
||||
};
|
||||
typeof(TrialUser),
|
||||
typeof(TrialSiteUser),
|
||||
typeof(TrialSite)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,12 +182,71 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
// 项目中心
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSite)))
|
||||
{
|
||||
var entity = item.Entity as TrialSite;
|
||||
if (entity.Site == null)
|
||||
{
|
||||
entity.Site =await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
||||
}
|
||||
await InsertInspection<TrialSite>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
|
||||
},new
|
||||
{
|
||||
TrialSiteCode = entity.TrialSiteCode,
|
||||
SiteName= entity.Site.SiteName,
|
||||
SiteAliasName= entity.TrialSiteAliasName,
|
||||
City= entity.Site.City,
|
||||
Country= entity.Site.Country,
|
||||
Status= entity.IsDeleted?"禁用":"启用",
|
||||
});
|
||||
}
|
||||
|
||||
// 项目中心人员
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteUser)))
|
||||
{
|
||||
var entity = item.Entity as TrialSiteUser;
|
||||
if (entity.TrialSite == null)
|
||||
{
|
||||
entity.TrialSite= await _dbContext.TrialSite.Where(x => x.TrialId == entity.TrialId&&x.SiteId== entity.SiteId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
if (entity.Site == null)
|
||||
{
|
||||
entity.Site = await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
if (entity.User == null)
|
||||
{
|
||||
entity.User = await _dbContext.User.Where(x => x.Id == entity.UserId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
if (entity.UserTypeRole == null)
|
||||
{
|
||||
entity.UserTypeRole = await _dbContext.UserType.Where(x => x.Id == entity.User.UserTypeId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
await InsertInspection<TrialSiteUser>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
|
||||
}, new
|
||||
{
|
||||
TrialSiteCode = entity.TrialSite.TrialSiteCode,
|
||||
SiteName = entity.Site.SiteName,
|
||||
SiteAliasName = entity.TrialSite.TrialSiteAliasName,
|
||||
City = entity.Site.City,
|
||||
Country = entity.Site.Country,
|
||||
Status = entity.IsDeleted ? "禁用" : "启用",
|
||||
UserName = entity.User.UserName,
|
||||
UserRealName = entity.User.FullName,
|
||||
UserType= entity.UserTypeRole.UserTypeShortName,
|
||||
Phone= entity.User.Phone,
|
||||
Email= entity.User.EMail,
|
||||
Organization= entity.User.OrganizationName,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 项目人员
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser)))
|
||||
|
@ -206,6 +267,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
State=entity.IsDeleted?"退出":"加入",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 受试者
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject)))
|
||||
{
|
||||
|
|
|
@ -234,6 +234,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
public virtual DbSet<Site> Site { get; set; }
|
||||
|
||||
public virtual DbSet<User> User { get; set; }
|
||||
|
||||
public virtual DbSet<TrialSiteUserSurvey> TrialSiteUserSurvey { get; set; }
|
||||
public virtual DbSet<TrialSiteEquipmentSurvey> TrialSiteEquipmentSurvey { get; set; }
|
||||
public virtual DbSet<TrialSiteSurvey> TrialSiteSurvey { get; set; }
|
||||
|
|
|
@ -244,7 +244,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
var query = ignoreQueryFilter ? _dbSet.AsNoTracking().IgnoreQueryFilters() : _dbSet.AsNoTracking();
|
||||
//不跟踪 查询出来的实体就是Detached
|
||||
var searchEntity = await query.FirstOrDefaultAsync(t => t.Id == id);
|
||||
var searchEntity = await query.IgnoreQueryFilters().FirstOrDefaultAsync(t => t.Id == id);
|
||||
|
||||
if (searchEntity == null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue