Uat_Study
he 2022-05-18 08:58:35 +08:00
parent 4c0831e2c3
commit 3009fb422f
5 changed files with 102 additions and 32 deletions

View File

@ -140,7 +140,7 @@ namespace IRaCIS.Application.Services
//中心调研 登陆
public async Task AnolymousSendEmail(string researchProgramNo,string emailAddress, int verificationCode)
{
{
var messageToSend = new MimeMessage();

View File

@ -157,8 +157,8 @@ namespace IRaCIS.Core.Application.Contracts
return ResponseOutput.NotOk("已有QC审核记录不允许删除问题项");
}
var success = await _trialQcQuestionRepository.BatchDeleteNoTrackingAsync(t => t.Id == trialQCQuestionConfigureId);
return ResponseOutput.Result(success);
var success = await _trialQcQuestionRepository.DeleteFromQueryAsync(t => t.Id == trialQCQuestionConfigureId,true);
return ResponseOutput.Result(true);
}

View File

@ -355,9 +355,23 @@ namespace IRaCIS.Core.Application.Contracts
return ResponseOutput.NotOk("已锁定,不允许操作");
}
}
var entity = await _trialSiteSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteSurvey, true);
return ResponseOutput.Ok(entity.Id.ToString());
if (addOrEditTrialSiteSurvey.Id == null)
{
var entity = _mapper.Map<TrialSiteSurvey>(addOrEditTrialSiteSurvey);
await _trialSiteSurveyRepository.AddAsync(entity, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
else
{
var entity = await _trialSiteSurveyRepository.Where(t => t.Id == addOrEditTrialSiteSurvey.Id, true).Include(x=>x.ReviewerUser).Include(x=>x.PreliminaryUser).FirstOrDefaultAsync();
_mapper.Map(addOrEditTrialSiteSurvey, entity);
await _trialSiteSurveyRepository.SaveChangesAsync();
}
return ResponseOutput.Ok(true);
}
@ -801,12 +815,12 @@ namespace IRaCIS.Core.Application.Contracts
if (hasSPMOrCPM)
{
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
}
else
{
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
}
@ -814,7 +828,7 @@ namespace IRaCIS.Core.Application.Contracts
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
{
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
}
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
@ -831,10 +845,10 @@ namespace IRaCIS.Core.Application.Contracts
await SendInviteEmail(new InviteEmailCommand() { TrialId = trialId, RouteUrl = siteSurvyeSubmit.RouteUrl, UserList = needGenerateList });
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
}
await _trialSiteSurveyRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}

View File

@ -161,7 +161,7 @@ namespace IRaCIS.Core.Application
throw new BusinessValidationFailedException("QC审核问题已被其他QC确认不允许再次确认");
}
await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true });
await _trialRepository.UpdatePartialFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true },true);
}

View File

@ -80,6 +80,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
return new List<Type>()
{
typeof(TrialUser),
typeof(TrialSiteSurvey),
typeof(TrialSiteUser),
typeof(TrialSite)
};
@ -173,7 +174,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
// TrialDocument
// 项目文档
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument)))
{
await InsertInspection<TrialDocument>(item, type);
@ -202,6 +203,28 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
// 项目人员
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser)))
{
var entity = item.Entity as TrialUser;
var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
await InsertInspection<TrialUser>(item, type, x => new DataInspection
{
TrialId = x.TrialId,
}, new
{
UserRealName = user.FullName,
UserName = user.UserName,
UserType = user.UserTypeRole.UserTypeShortName,
EMail = user.EMail,
Phone = user.Phone,
OrganizationName = user.OrganizationName,
State = entity.IsDeleted ? "退出" : "加入",
});
}
// 项目中心人员
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteUser)))
{
@ -229,7 +252,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
await InsertInspection<TrialSiteUser>(item, type, x => new DataInspection()
{
GeneralId = x.Id,
}, new
{
TrialSiteCode = entity.TrialSite.TrialSiteCode,
@ -248,29 +270,65 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
// 项目人员
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser)))
// 中心调研表
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSiteSurvey)))
{
var entity = item.Entity as TrialUser;
var user =await _dbContext.Users.Include(x=>x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
await InsertInspection<TrialUser>(item, type, x => new DataInspection
{
TrialId=x.TrialId,
var entity = item.Entity as TrialSiteSurvey;
if (entity.TrialSite == null)
{
entity.TrialSite = await _dbContext.TrialSite.Where(x => x.SiteId == entity.SiteId&&x.TrialId== entity.TrialId).FirstOrDefaultAsync();
}
if (entity.PreliminaryUser == null)
{
entity.PreliminaryUser = await _dbContext.User.Where(x => x.Id == entity.PreliminaryUserId).FirstOrDefaultAsync();
}
if (entity.ReviewerUser == null)
{
entity.ReviewerUser = await _dbContext.User.Where(x => x.Id == entity.ReviewerUserId).FirstOrDefaultAsync();
}
await InsertInspection<TrialSiteSurvey>(item, type, x => new DataInspection()
{
GeneralId = x.Id,
},new {
UserRealName= user.FullName,
UserName= user.UserName,
UserType= user.UserTypeRole.UserTypeShortName,
EMail= user.EMail,
Phone= user.Phone,
OrganizationName= user.OrganizationName,
State=entity.IsDeleted?"退出":"加入",
TrialSiteCode = entity.TrialSite.TrialSiteCode,
TrialSiteAliasName = entity.TrialSite.TrialSiteAliasName,
Phone= entity.Phone,
Email=entity.Email,
PreliminaryUser= entity.PreliminaryUser==null?"": entity.PreliminaryUser.LastName + " / " + entity.PreliminaryUser.FirstName,
ReviewerUser = entity.ReviewerUser == null ? "" : entity.ReviewerUser.LastName + " / " + entity.ReviewerUser.FirstName,
IsDeleted=entity.IsDeleted ? "是" : "否",
});
}
// 项目问题
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestion)))
{
var entity = item.Entity as TrialQCQuestion;
var isQCQuestionConfirmed = await _dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.IsQCQuestionConfirmed).FirstOrDefaultAsync();
var paretName = await _dbContext.TrialQCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync();
await InsertInspection<TrialQCQuestion>(item, type, x => new DataInspection()
{
GeneralId = x.Id,
},new {
QuestionName= entity.QuestionName,
Type= entity.Type,
TypeValue=entity.TypeValue,
ShowOrder=entity.ShowOrder,
IsRequired= entity.IsRequired,
ParentName= paretName,
ParentTriggerValue=entity.ParentTriggerValue,
IsEnable=entity.IsEnable,
IsQCQuestionConfirmed= isQCQuestionConfirmed,
});
}
// 受试者
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject)))
@ -342,8 +400,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}
// 非Dicom文件
//var noneDicomFile=
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;