稽查修改

Uat_Study
hang 2022-08-25 17:05:57 +08:00
parent cc60c4f9f0
commit fbabbfc807
5 changed files with 68 additions and 68 deletions

View File

@ -142,19 +142,26 @@ namespace IRaCIS.Core.Application.Service.Inspection
query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
//.WhereIf(dto.RelationDeadlineTime != null, x => x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1))
.Where(x => (x.TrialId == dto.TrialId) || (x.TrialId == null && x.CreateTime >= trialData.CreateTime && x.CreateTime <= trialData.TrialFinishTime))
.WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null && dto.GeneralId == null, x => x.BatchId == dto.BatchId)
.WhereIf(dto.BatchId != null && dto.GeneralId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId ||
((x.GeneralId == dto.GeneralId || x.ObjectRelationParentId == dto.GeneralId) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
.WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null,
x =>
x.BatchId == dto.BatchId || //同一事务批次
//x.ObjectRelationParentId == dto.ObjectRelationParentId || //不同对象 但是同一层级 适用于子对象
#region 废弃
// .WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null && dto.GeneralId == null, x => x.BatchId == dto.BatchId)
// .WhereIf(dto.BatchId != null && dto.GeneralId != null && dto.ObjectRelationParentId == null, x => x.BatchId == dto.BatchId ||
// ((x.GeneralId == dto.GeneralId || x.ObjectRelationParentId == dto.GeneralId) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
// .WhereIf(dto.ObjectRelationParentId != null && dto.BatchId != null && dto.GeneralId != null,
// x =>
// x.BatchId == dto.BatchId || //同一事务批次
// //x.ObjectRelationParentId == dto.ObjectRelationParentId || //不同对象 但是同一层级 适用于子对象
//((x.GeneralId == dto.ObjectRelationParentId || //子稽查 查询父记录
// x.GeneralId == dto.GeneralId || //同一对象
// x.ObjectRelationParentId == dto.GeneralId //父稽查 查询子记录
// ) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
#endregion
.WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId)
.WhereIf(dto.BatchId == null && dto.GeneralId != null, x => x.GeneralId == dto.GeneralId)
( ( x.GeneralId == dto.ObjectRelationParentId || //子稽查 查询父记录
x.GeneralId == dto.GeneralId || //同一对象
x.ObjectRelationParentId == dto.GeneralId //父稽查 查询子记录
)&& x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1)))
.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo))
//.WhereIf(dto.VisitPlanInfo != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo)
//.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false)

View File

@ -74,13 +74,14 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public decimal VisitNum { get; set; }
[JsonIgnore]
/// <summary>
/// 对应
/// </summary>
[ForeignKey("ReadModuleId")]
public ReadModule ReadModuleModel { get; set; }
[JsonIgnore]
/// <summary>
/// 受试者
/// </summary>
@ -88,13 +89,14 @@ namespace IRaCIS.Core.Domain.Models
public Subject Subject { get; set; }
[JsonIgnore]
/// <summary>
/// 阅片期配置
/// </summary>
[ForeignKey("ReadingPeriodSetId")]
public ReadingPeriodSet ReadingPeriodSet { get; set; }
[JsonIgnore]
/// <summary>
/// 访视
/// </summary>

View File

@ -45,6 +45,7 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public Guid? VisitStageId { get; set; }
[JsonIgnore]
/// <summary>
/// 访视模板
/// </summary>
@ -81,13 +82,14 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public ReadingSetType ReadingSetType { get; set; }
[JsonIgnore]
public List<ReadingPeriodSite> ReadingPeriodSites { get; set; } = new List<ReadingPeriodSite>();
/// <summary>
/// 阅片期计划
/// </summary>
[JsonIgnore]
public List<ReadingPeriodPlan> ReadingPeriodPlanList { get; set; } = new List<ReadingPeriodPlan>();
}

View File

@ -6,6 +6,7 @@ namespace IRaCIS.Core.Domain.Models
[Table("VisitStage")]
public class VisitStage : Entity, IAuditUpdate, IAuditAdd,ISoftDelete
{
[JsonIgnore]
public Trial Trial { get; set; }
public Guid TrialId { get; set; }

View File

@ -123,23 +123,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
// 访视计划
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
{
var entity = item.Entity as VisitStage;
var visitPlanStatus = await this._dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.VisitPlanConfirmed).FirstOrDefaultAsync();
if (type == "Add")
{
visitPlanStatus = false;
}
await InsertInspection<VisitStage>(item.Entity as VisitStage, type, null, new
{
VisitPlanStatus = visitPlanStatus,
});
}
// 项目文档
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument)))
{
@ -690,6 +675,35 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
// 访视计划
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
{
var entity = item.Entity as VisitStage;
await InsertInspection<VisitStage>(item.Entity as VisitStage, type, x => new InspectionConvertDTO()
{
ObjectRelationParentId = x.TrialId
});
#region Old
//var visitPlanStatus = await this._dbContext.Trial.Where(x => x.Id == entity.TrialId).Select(x => x.VisitPlanConfirmed).FirstOrDefaultAsync();
//if (type == "Add")
//{
// visitPlanStatus = false;
//}
//await InsertInspection<VisitStage>(item.Entity as VisitStage, type, x => new InspectionConvertDTO()
//{
// ObjectRelationParentId = x.TrialId
//}, new
//{
// VisitPlanStatus = visitPlanStatus,
//});
#endregion
}
// 访视
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
{
@ -809,40 +823,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
});
}
//foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingClinicalDataPDF)))
//{
// var entity = item.Entity as ReadingClinicalDataPDF;
// await InsertInspection<ReadingClinicalDataPDF>(item.Entity as ReadingClinicalDataPDF, type, x => new InspectionConvertDTO()
// {
// SubjectId = x.SubjectId,
// IsDistinctionInterface = false,
// ObjectRelationParentId = entity.ReadingClinicalDataId
// }, new
// {
// IsCRCUpload = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator
// });
//}
#endregion
#endregion
#region Subject 阅片期和 临床数据
//阅片期计划
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingPeriodSet)))
{
var entity = item.Entity as ReadingPeriodSet;
var visitName = _dbContext.VisitPlans.Where(t => t.Id == entity.VisitStageId).Select(t => t.VisitName).FirstOrDefault();
var siteCodes = string.Empty;
if (entity.ReadingScope == ReadingScopeEnum.Site)
{
@ -852,10 +837,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
siteCodes = String.Join(',', nameList);
}
await InsertInspection<ReadingPeriodSet>(item.Entity as ReadingPeriodSet, type, null, new
await InsertInspection<ReadingPeriodSet>(item.Entity as ReadingPeriodSet, type, x => new InspectionConvertDTO()
{
ObjectRelationParentId = x.VisitStageId
}, new
{
VisitName = visitName,
SiteCodes = siteCodes
});
}
@ -884,29 +871,30 @@ namespace IRaCIS.Core.Infra.EFCore.Common
#endregion
//阅片期
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadModule)))
{
var entity = item.Entity as ReadModule;
var visitName = _dbContext.SubjectVisit.Where(t => t.Id == entity.SubjectVisitId).Select(t => t.VisitName).FirstOrDefault();
await InsertInspection<ReadModule>(item.Entity as ReadModule, type, x => new InspectionConvertDTO()
{
ObjectRelationParentId = entity.ReadingPeriodSetId,
ObjectRelationParentId = entity.SubjectVisitId,
SubjectVisitId = x.SubjectVisitId,
IsDistinctionInterface = false,
}, new
{
VisitName = visitName,
});
}
#endregion
#endregion
#region 阅片
//用户添加