修改一版
parent
198a8601be
commit
46b5846d0c
|
@ -86,9 +86,9 @@ namespace IRaCIS.Core.API.Controllers
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Inspection/GetInspectionData")]
|
||||
public async Task<PageOutput<GetDataInspectionOutDto>> GetInspectionData(GetDataInspectionDto dto)
|
||||
public async Task<PageOutput<GetDataInspectionOutDto>> GetInspectionList(GetDataInspectionDto dto)
|
||||
{
|
||||
return await _inspectionService.GetInspectionData(dto);
|
||||
return await _inspectionService.GetInspectionList(dto);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
Financials /Monthly Payment 列表查询接口
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.InspectionController.GetInspectionData(IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto)">
|
||||
<member name="M:IRaCIS.Core.API.Controllers.InspectionController.GetInspectionList(IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto)">
|
||||
<summary>
|
||||
获取稽查数据
|
||||
</summary>
|
||||
|
|
|
@ -25,17 +25,17 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
|
||||
|
||||
|
||||
public async Task<PageOutput<GetDataInspectionOutDto>> GetInspectionData(GetDataInspectionDto dto)
|
||||
public async Task<PageOutput<GetDataInspectionOutDto>> GetInspectionList(GetDataInspectionDto dto)
|
||||
{
|
||||
//_repository.GetQueryable.GetQueryable < DataInspection >
|
||||
|
||||
var trialfirst= await _repository.GetQueryable< Trial >().Where(x=>x.Id== dto.TrialId).AsNoTracking().FirstOrDefaultAsync();
|
||||
var trialData= await _repository.GetQueryable<Trial>().Where(x=>x.Id== dto.TrialId).AsNoTracking().FirstOrDefaultAsync();
|
||||
|
||||
|
||||
trialfirst.TrialFinishTime = trialfirst.TrialFinishTime == null ? DateTime.Now : trialfirst.TrialFinishTime;
|
||||
trialData.TrialFinishTime = trialData.TrialFinishTime == null ? DateTime.Now : trialData.TrialFinishTime;
|
||||
|
||||
#region 逻辑代码
|
||||
var query = from data in _repository.GetQueryable<DataInspection>().Where(x => (x.TrialId == dto.TrialId)||(x.TrialId==null&&x.CreateTime> trialfirst.CreateTime&&x.CreateTime < trialfirst.TrialFinishTime))
|
||||
var query = from data in _repository.GetQueryable<DataInspection>().Where(x => (x.TrialId == dto.TrialId)||(x.TrialId==null&&x.CreateTime> trialData.CreateTime&&x.CreateTime < trialData.TrialFinishTime))
|
||||
|
||||
join trial in _repository.GetQueryable<Trial>().IgnoreQueryFilters() on data.TrialId equals trial.Id into trialtemp
|
||||
from leftrial in trialtemp.DefaultIfEmpty()
|
||||
|
@ -127,7 +127,6 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
IsFrontAdd=data.IsFrontAdd,
|
||||
BatchId=data.BatchId,
|
||||
OptTypeName = leftOptType.Value,
|
||||
|
||||
};
|
||||
|
||||
query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
|
||||
|
@ -141,14 +140,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
.WhereIf(!dto.OpByUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(dto.OpByUserName))
|
||||
//.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo))
|
||||
.WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
dto.Asc = false;
|
||||
return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize, "CreateTime", dto.Asc);
|
||||
return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize,"CreateTime", dto.Asc);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface
|
|||
public interface IInspectionService
|
||||
{
|
||||
|
||||
Task<PageOutput<GetDataInspectionOutDto>> GetInspectionData(GetDataInspectionDto dto);
|
||||
Task<PageOutput<GetDataInspectionOutDto>> GetInspectionList(GetDataInspectionDto dto);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -85,45 +85,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 需要赋值的GeneralId
|
||||
/// </summary>
|
||||
private List<Type> NeedSetGeneralIdList
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Type>()
|
||||
{
|
||||
typeof(SystemDocument),
|
||||
typeof(SystemBasicData),
|
||||
typeof(Trial),
|
||||
typeof(VisitStage),
|
||||
typeof(TrialDocument),
|
||||
typeof(SystemDocConfirmedUser),
|
||||
typeof(TrialDocUserTypeConfirmedUser),
|
||||
typeof(Enroll),
|
||||
typeof(EnrollDetail),
|
||||
typeof(TrialSite),
|
||||
typeof(TrialUser),
|
||||
typeof(TrialSiteUser),
|
||||
typeof(TrialSiteSurvey),
|
||||
typeof(TrialQCQuestion),
|
||||
typeof(DicomStudy),
|
||||
typeof(DicomSeries),
|
||||
typeof(NoneDicomStudy),
|
||||
typeof(CheckChallengeDialog),
|
||||
typeof(PreviousSurgery),
|
||||
typeof(PreviousHistory),
|
||||
typeof(PreviousOther),
|
||||
typeof(QCChallenge),
|
||||
typeof(QCChallengeDialog),
|
||||
typeof(QCQuestion),
|
||||
typeof(ConsistencyCheckFile),
|
||||
typeof(DataInspection),
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插入Add的实体
|
||||
|
@ -170,7 +132,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
|
||||
var entity = item.Entity as Trial;
|
||||
List<string> trials = new List<string>();
|
||||
List<string> trialDics = new List<string>();
|
||||
var dictionaryIds = new List<Guid>();
|
||||
if (entity.TrialDicList == null || entity.TrialDicList.Count == 0)
|
||||
{
|
||||
|
@ -183,7 +145,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
}
|
||||
|
||||
trials = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync();
|
||||
trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync();
|
||||
|
||||
await InsertInspection<Trial>(item.Entity as Trial, type, x => new DataInspection()
|
||||
|
||||
|
@ -194,7 +156,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
GeneralId = x.Id,
|
||||
}, new
|
||||
{
|
||||
TrialDicList = string.Join(",", trials)
|
||||
TrialDicList = string.Join(",", trialDics)
|
||||
}, item.OriginalValues);
|
||||
}
|
||||
|
||||
|
@ -204,10 +166,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
var entity = item.Entity as VisitStage;
|
||||
|
||||
|
||||
var VisitPlanStatus = await this._dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.VisitPlanConfirmed).FirstOrDefaultAsync();
|
||||
var visitPlanStatus = await this._dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.VisitPlanConfirmed).FirstOrDefaultAsync();
|
||||
if (type == "Add")
|
||||
{
|
||||
VisitPlanStatus = false;
|
||||
visitPlanStatus = false;
|
||||
}
|
||||
await InsertInspection<VisitStage>(item.Entity as VisitStage, type, x => new DataInspection()
|
||||
{
|
||||
|
@ -215,7 +177,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
GeneralId = x.Id,
|
||||
}, new
|
||||
{
|
||||
VisitPlanStatus = VisitPlanStatus,
|
||||
VisitPlanStatus = visitPlanStatus,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -319,7 +281,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
SiteAliasName = entity.TrialSiteAliasName,
|
||||
City = entity.Site.City,
|
||||
Country = entity.Site.Country,
|
||||
Status = entity.IsDeleted ? "禁用" : "启用",
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -340,7 +301,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
EMail = user.EMail,
|
||||
Phone = user.Phone,
|
||||
OrganizationName = user.OrganizationName,
|
||||
State = entity.IsDeleted ? "退出" : "加入",
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -386,7 +347,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
SiteAliasName = entity.TrialSite.TrialSiteAliasName,
|
||||
City = entity.Site.City,
|
||||
Country = entity.Site.Country,
|
||||
Status = entity.IsDeleted ? "禁用" : "启用",
|
||||
|
||||
UserName = user.UserName,
|
||||
UserRealName = user.FullName,
|
||||
UserType = userType.UserTypeShortName,
|
||||
|
@ -429,7 +390,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
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 ? "是" : "否",
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -459,7 +420,7 @@ 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();
|
||||
var finalSubjectVisitName = await _dbContext.SubjectVisit.AsNoTracking().Where(x => x.Id == entity.FinalSubjectVisitId && entity.FinalSubjectVisitId != null).Select(x => x.VisitName).FirstOrDefaultAsync();
|
||||
|
||||
await InsertInspection<Subject>(entity, type, x => new DataInspection()
|
||||
{
|
||||
|
@ -467,7 +428,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
SubjectCode = x.Code,
|
||||
}, new
|
||||
{
|
||||
FinalSubjectVisitName = FinalSubjectVisitName,
|
||||
FinalSubjectVisitName = finalSubjectVisitName,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -504,7 +465,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudy)))
|
||||
{
|
||||
var entity = item.Entity as NoneDicomStudy;
|
||||
var filecount = await _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == entity.Id).CountAsync();
|
||||
var fileCount = await _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == entity.Id).CountAsync();
|
||||
|
||||
|
||||
await InsertInspection<NoneDicomStudy>(item.Entity as NoneDicomStudy, type, x => new DataInspection()
|
||||
|
@ -512,7 +473,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
GeneralId = x.Id,
|
||||
}, new
|
||||
{
|
||||
FileCount = filecount,
|
||||
FileCount = fileCount,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -546,7 +507,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
|
||||
|
||||
//一致性核查
|
||||
//一致性核查 // 特殊GeneralId
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(CheckChallengeDialog)))
|
||||
{
|
||||
|
||||
|
@ -692,7 +653,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
});
|
||||
}
|
||||
|
||||
// 质疑信息
|
||||
// 质疑信息 // 特殊GeneralId
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallengeDialog)))
|
||||
{
|
||||
var reason = string.Empty;
|
||||
|
@ -742,7 +703,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
|
||||
|
||||
// 一致性核查文件
|
||||
// 一致性核查文件
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ConsistencyCheckFile)))
|
||||
{
|
||||
await InsertInspection<ConsistencyCheckFile>(item.Entity as ConsistencyCheckFile, type, x => new DataInspection()
|
||||
|
@ -752,24 +713,24 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
});
|
||||
}
|
||||
|
||||
// Qc 问题答案
|
||||
// Qc 问题答案 // 特殊GeneralId
|
||||
if (entitys.Any(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer)))
|
||||
{
|
||||
var entitylist = entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestionAnswer)).Select(x => x.Entity as TrialQCQuestionAnswer).ToList();
|
||||
var firstentity = entitylist.FirstOrDefault();
|
||||
var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == firstentity.SubjectVisitId).FirstOrDefaultAsync();
|
||||
subjectvisit = subjectvisit ?? new SubjectVisit();
|
||||
var firstEntity = entitylist.FirstOrDefault();
|
||||
var subjectVisit = await _dbContext.SubjectVisit.Where(x => x.Id == firstEntity.SubjectVisitId).FirstOrDefaultAsync();
|
||||
subjectVisit = subjectVisit ?? new SubjectVisit();
|
||||
if (type == "Add")
|
||||
{
|
||||
await AddInspectionRecordAsync(new DataInspection()
|
||||
{
|
||||
SiteId = subjectvisit.SiteId,
|
||||
Identification = $"{_userInfo.RequestUrl}/{ firstentity.GetType().Name}/{type}",
|
||||
SubjectId = subjectvisit.SubjectId,
|
||||
SubjectVisitName = subjectvisit.VisitName,
|
||||
TrialId = subjectvisit.TrialId,
|
||||
SubjectVisitId = subjectvisit.Id,
|
||||
GeneralId = subjectvisit.Id,
|
||||
SiteId = subjectVisit.SiteId,
|
||||
Identification = $"{_userInfo.RequestUrl}/{ firstEntity.GetType().Name}/{type}",
|
||||
SubjectId = subjectVisit.SubjectId,
|
||||
SubjectVisitName = subjectVisit.VisitName,
|
||||
TrialId = subjectVisit.TrialId,
|
||||
SubjectVisitId = subjectVisit.Id,
|
||||
GeneralId = subjectVisit.Id,
|
||||
}, new
|
||||
{
|
||||
QcQuestionAnswerCommands = await Getdata(entitylist),
|
||||
|
@ -778,19 +739,19 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
else if (type == "Update")
|
||||
{
|
||||
|
||||
var questionids = entitylist.Where(x => x.SubjectVisitId == subjectvisit.Id).Select(x => x.Id).ToList();
|
||||
var questionIds = entitylist.Where(x => x.SubjectVisitId == subjectVisit.Id).Select(x => x.Id).ToList();
|
||||
var createUserId = entitylist.Select(x => x.CreateUserId).FirstOrDefault();
|
||||
var noupdatedata = _dbContext.TrialQCQuestionAnswer.Where(x => x.CreateUserId== createUserId&& x.SubjectVisitId == subjectvisit.Id && !questionids.Contains(x.Id)).ToList();
|
||||
entitylist.AddRange(noupdatedata);
|
||||
var noUpdateData = _dbContext.TrialQCQuestionAnswer.Where(x => x.CreateUserId== createUserId&& x.SubjectVisitId == subjectVisit.Id && !questionIds.Contains(x.Id)).ToList();
|
||||
entitylist.AddRange(noUpdateData);
|
||||
await AddInspectionRecordAsync(new DataInspection()
|
||||
{
|
||||
Identification = $"{_userInfo.RequestUrl}/{ firstentity.GetType().Name}/{type}",
|
||||
SiteId = subjectvisit.SiteId,
|
||||
SubjectId = subjectvisit.SubjectId,
|
||||
TrialId = subjectvisit.TrialId,
|
||||
SubjectVisitId = subjectvisit.Id,
|
||||
SubjectVisitName = subjectvisit.VisitName,
|
||||
GeneralId = subjectvisit.Id,
|
||||
Identification = $"{_userInfo.RequestUrl}/{ firstEntity.GetType().Name}/{type}",
|
||||
SiteId = subjectVisit.SiteId,
|
||||
SubjectId = subjectVisit.SubjectId,
|
||||
TrialId = subjectVisit.TrialId,
|
||||
SubjectVisitId = subjectVisit.Id,
|
||||
SubjectVisitName = subjectVisit.VisitName,
|
||||
GeneralId = subjectVisit.Id,
|
||||
}, new
|
||||
{
|
||||
QcQuestionAnswerCommands = await Getdata(entitylist),
|
||||
|
@ -924,8 +885,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inspection.Identification = $"{_userInfo.RequestUrl}/{ entityTypeName}/{type}";
|
||||
|
||||
#region 注释
|
||||
|
@ -980,11 +939,25 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
/// <param name="data">数据</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
public async Task AddInspectionRecordAsync(DataInspection add, dynamic data, object otherItem = null)
|
||||
public async Task AddInspectionRecordAsync(DataInspection add, object data, object otherItem = null)
|
||||
{
|
||||
MapData(data, add);
|
||||
InspectionGeneralData generalData = new InspectionGeneralData();
|
||||
MapData(add, generalData);
|
||||
InspectionGeneralData generalData = new InspectionGeneralData()
|
||||
{
|
||||
CreateUserName = add.CreateUserName,
|
||||
SiteCode = add.SiteCode,
|
||||
SiteId = add.SiteId,
|
||||
SiteName = add.SiteName,
|
||||
SubjectCode = add.SubjectCode,
|
||||
SubjectId = add.SubjectId,
|
||||
SubjectVisitId = add.SubjectVisitId,
|
||||
SubjectVisitName = add.SubjectVisitName,
|
||||
ResearchProgramNo = add.ResearchProgramNo,
|
||||
RoleName = add.RoleName,
|
||||
TrialId = add.TrialId,
|
||||
TrialName = add.TrialName
|
||||
};
|
||||
|
||||
await SetInspectionNameValue(generalData);
|
||||
#region 处理标识
|
||||
|
||||
|
@ -1027,14 +1000,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
/// <summary>
|
||||
/// 往json里面添加属性
|
||||
/// </summary>
|
||||
/// <param name="json">json</param>
|
||||
/// <param name="jsonObj">json</param>
|
||||
/// <param name="otherItem">添加对象</param>
|
||||
/// <returns></returns>
|
||||
public IDictionary<string, object> AddJsonItem(dynamic json, object otherItem = null)
|
||||
public IDictionary<string, object> AddJsonItem(object jsonObj, object otherItem = null)
|
||||
{
|
||||
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>((json as object).ToJsonStr());
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>((jsonObj).ToJsonStr());
|
||||
|
||||
if (otherItem == null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue