代码修改
parent
fa72980130
commit
6ab8d575f2
|
@ -79,14 +79,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
from lefttrialSign in trialSigntemp.DefaultIfEmpty()
|
||||
|
||||
|
||||
join leftfrontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M"&&x.Identification!=null) on new
|
||||
{
|
||||
data.Identification
|
||||
} equals new
|
||||
{
|
||||
leftfrontAuditConfig.Identification,
|
||||
join leftfrontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M"&&x.Identification!=null) on
|
||||
data.Identification.ToLower()
|
||||
equals
|
||||
leftfrontAuditConfig.Identification.ToLower()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
/// <summary>
|
||||
/// 处理 访视 1、提交状态 2、执行状态 3、最早最晚 拍片日期
|
||||
/// </summary>
|
||||
public class SubjectVisitTrigger : IAfterSaveTrigger<NoneDicomStudy>, IAfterSaveTrigger<DicomStudy>
|
||||
public class SubjectVisitTrigger : IAfterSaveTrigger<NoneDicomStudy>, IAfterSaveTrigger<DicomStudy>, IAfterSaveTrigger<NoneDicomStudyFile>
|
||||
{
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
|
||||
|
@ -60,6 +60,19 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
|
||||
}
|
||||
|
||||
public async Task AfterSave(ITriggerContext<NoneDicomStudyFile> context, CancellationToken cancellationToken)
|
||||
{
|
||||
var subjectVisitId =await _subjectVisitRepository._dbContext.NoneDicomStudy.Where(x=>x.Id== context.Entity.NoneDicomStudyId).Select(x=>x.SubjectVisitId).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
if (context.ChangeType == ChangeType.Deleted)
|
||||
{
|
||||
|
||||
await UpdateSubjectVisitSubmitStateAsync(subjectVisitId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>处理提交状态</summary>
|
||||
|
||||
public async Task UpdateSubjectVisitSubmitStateAsync(Guid subjectVisitId)
|
||||
|
|
|
@ -128,6 +128,96 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
FinalSubjectVisitName = FinalSubjectVisitName,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 检查
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy)))
|
||||
{
|
||||
await InsertInspection<DicomStudy>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 序列
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomSeries)))
|
||||
{
|
||||
var entity = item.Entity as DicomSeries;
|
||||
if (entity.DicomStudy == null)
|
||||
{
|
||||
entity.DicomStudy = await _dbContext.DicomStudys.AsNoTracking().FirstOrDefaultAsync(x => x.Id == entity.StudyId);
|
||||
}
|
||||
await InsertInspection<DicomSeries>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
}, new
|
||||
{
|
||||
StudyCode = entity.DicomStudy?.StudyCode,
|
||||
Modalities = entity.DicomStudy?.Modalities,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 非Dicom
|
||||
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();
|
||||
switch (GetRequestUrl().ToLower())
|
||||
{
|
||||
case "nonedicomstudy/addorupdatenonedicomstudy":
|
||||
type = _userInfo.UserTypeShortName + "/" + type;
|
||||
break;
|
||||
}
|
||||
|
||||
await InsertInspection<NoneDicomStudy>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
}, new
|
||||
{
|
||||
FileCount = filecount,
|
||||
});
|
||||
}
|
||||
|
||||
// 非Dicom文件
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)))
|
||||
{
|
||||
var entity = item.Entity as NoneDicomStudyFile;
|
||||
var noneDicomStudy = entity.NoneDicomStudy;
|
||||
if (noneDicomStudy == null)
|
||||
{
|
||||
noneDicomStudy = await _dbContext.NoneDicomStudy.FirstOrDefaultAsync(x => x.Id == entity.NoneDicomStudyId);
|
||||
}
|
||||
noneDicomStudy = noneDicomStudy ?? new NoneDicomStudy();
|
||||
var fileCount = 0;
|
||||
if (type == "Add")
|
||||
{
|
||||
fileCount = _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == entity.NoneDicomStudyId).Count() + 1;
|
||||
} else if (type == "Deleted")
|
||||
{
|
||||
fileCount = _dbContext.NoneDicomStudyFile.Where(x => x.NoneDicomStudyId == entity.NoneDicomStudyId).Count() - 1;
|
||||
}
|
||||
await InsertInspection<NoneDicomStudyFile>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
TrialId = noneDicomStudy.TrialId,
|
||||
SubjectId = noneDicomStudy.SubjectId,
|
||||
SiteId= noneDicomStudy.SiteId,
|
||||
SubjectVisitId = noneDicomStudy.SubjectVisitId,
|
||||
|
||||
},new {
|
||||
StudyCode = noneDicomStudy.StudyCode,
|
||||
Modality= noneDicomStudy.Modality,
|
||||
BodyPart= noneDicomStudy.BodyPart,
|
||||
FileCount= fileCount,
|
||||
ImageDate= noneDicomStudy.ImageDate,
|
||||
UpNum= 1,// 每次上传或下载一个
|
||||
});
|
||||
}
|
||||
|
||||
// 访视
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
|
||||
{
|
||||
|
@ -151,15 +241,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var subjectCode = entity.Subject?.Code;
|
||||
|
||||
await InsertInspection<SubjectVisit>(item, type, x => new DataInspection()
|
||||
{
|
||||
SubjectCode= subjectCode,
|
||||
SubjectId=x.SubjectId,
|
||||
|
||||
SubjectVisitId = x.Id,
|
||||
SubjectVisitName=x.VisitName,
|
||||
BlindName=x.BlindName,
|
||||
|
@ -170,9 +256,20 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
// 既往手术史
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousSurgery)))
|
||||
{
|
||||
var entity = item.Entity as PreviousSurgery;
|
||||
var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync();
|
||||
subjectvisit = subjectvisit ?? new SubjectVisit();
|
||||
await InsertInspection<PreviousSurgery>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
SiteId = subjectvisit.SiteId,
|
||||
SubjectVisitName = subjectvisit.VisitName,
|
||||
TrialId = subjectvisit.TrialId,
|
||||
SubjectId = subjectvisit.SubjectId,
|
||||
|
||||
}, new
|
||||
{
|
||||
Type = "既往手术史"
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -180,94 +277,41 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
// 既往放疗史
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousHistory)))
|
||||
{
|
||||
var entity = item.Entity as PreviousHistory;
|
||||
var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync();
|
||||
subjectvisit = subjectvisit ?? new SubjectVisit();
|
||||
await InsertInspection<PreviousHistory>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
SiteId = subjectvisit.SiteId,
|
||||
SubjectVisitName = subjectvisit.VisitName,
|
||||
TrialId = subjectvisit.TrialId,
|
||||
SubjectId = subjectvisit.SubjectId,
|
||||
}, new
|
||||
{
|
||||
Type = "既往放疗史"
|
||||
});
|
||||
}
|
||||
|
||||
// 其他治疗史
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousOther)))
|
||||
{
|
||||
|
||||
var entity = item.Entity as PreviousOther;
|
||||
var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync();
|
||||
subjectvisit = subjectvisit ?? new SubjectVisit();
|
||||
await InsertInspection<PreviousOther>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
});
|
||||
}
|
||||
|
||||
// 检查
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy)))
|
||||
{
|
||||
await InsertInspection<DicomStudy>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 序列
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomSeries)))
|
||||
{
|
||||
var entity = item.Entity as DicomSeries;
|
||||
if (entity.DicomStudy == null)
|
||||
{
|
||||
entity.DicomStudy =await _dbContext.DicomStudys.AsNoTracking().FirstOrDefaultAsync(x=>x.Id== entity.StudyId);
|
||||
}
|
||||
await InsertInspection<DicomSeries>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
SiteId = subjectvisit.SiteId,
|
||||
SubjectVisitName = subjectvisit.VisitName,
|
||||
TrialId = subjectvisit.TrialId,
|
||||
SubjectId = subjectvisit.SubjectId,
|
||||
}, new
|
||||
{
|
||||
StudyCode = entity.DicomStudy?.StudyCode,
|
||||
Modalities = entity.DicomStudy?.Modalities,
|
||||
|
||||
Type = "其他治疗史"
|
||||
});
|
||||
}
|
||||
|
||||
// 非Dicom
|
||||
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();
|
||||
switch (GetRequestUrl().ToLower())
|
||||
{
|
||||
case "nonedicomstudy/addorupdatenonedicomstudy":
|
||||
type = _userInfo.UserTypeShortName + "/" + type;
|
||||
break;
|
||||
}
|
||||
|
||||
await InsertInspection<NoneDicomStudy>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
},new {
|
||||
FileCount= filecount,
|
||||
});
|
||||
}
|
||||
|
||||
// 非Dicom文件
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)))
|
||||
{
|
||||
var entity = item.Entity as NoneDicomStudyFile;
|
||||
var noneDicomStudy = entity.NoneDicomStudy;
|
||||
if (noneDicomStudy == null)
|
||||
{
|
||||
noneDicomStudy = await _dbContext.NoneDicomStudy.FirstOrDefaultAsync(x => x.Id == entity.NoneDicomStudyId);
|
||||
}
|
||||
noneDicomStudy = noneDicomStudy ?? new NoneDicomStudy();
|
||||
await InsertInspection<NoneDicomStudyFile>(item, type, x => new DataInspection()
|
||||
{
|
||||
GeneralId = x.Id,
|
||||
TrialId= noneDicomStudy.TrialId,
|
||||
SubjectId=noneDicomStudy.SubjectId,
|
||||
SubjectVisitId=noneDicomStudy.SubjectVisitId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//质疑
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge)))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue