代码修改
parent
fa72980130
commit
6ab8d575f2
|
@ -79,14 +79,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||||
from lefttrialSign in trialSigntemp.DefaultIfEmpty()
|
from lefttrialSign in trialSigntemp.DefaultIfEmpty()
|
||||||
|
|
||||||
|
|
||||||
join leftfrontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M"&&x.Identification!=null) on new
|
join leftfrontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M"&&x.Identification!=null) on
|
||||||
{
|
data.Identification.ToLower()
|
||||||
data.Identification
|
equals
|
||||||
} equals new
|
leftfrontAuditConfig.Identification.ToLower()
|
||||||
{
|
|
||||||
leftfrontAuditConfig.Identification,
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace IRaCIS.Core.Application.Triggers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 处理 访视 1、提交状态 2、执行状态 3、最早最晚 拍片日期
|
/// 处理 访视 1、提交状态 2、执行状态 3、最早最晚 拍片日期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SubjectVisitTrigger : IAfterSaveTrigger<NoneDicomStudy>, IAfterSaveTrigger<DicomStudy>
|
public class SubjectVisitTrigger : IAfterSaveTrigger<NoneDicomStudy>, IAfterSaveTrigger<DicomStudy>, IAfterSaveTrigger<NoneDicomStudyFile>
|
||||||
{
|
{
|
||||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
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>
|
/// <summary>处理提交状态</summary>
|
||||||
|
|
||||||
public async Task UpdateSubjectVisitSubmitStateAsync(Guid subjectVisitId)
|
public async Task UpdateSubjectVisitSubmitStateAsync(Guid subjectVisitId)
|
||||||
|
|
|
@ -128,74 +128,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
FinalSubjectVisitName = FinalSubjectVisitName,
|
FinalSubjectVisitName = FinalSubjectVisitName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 访视
|
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
|
|
||||||
{
|
|
||||||
var entity = item.Entity as SubjectVisit;
|
|
||||||
switch (GetRequestUrl())
|
|
||||||
{
|
|
||||||
case "QCOperation/obtainOrCancelQCTask":
|
|
||||||
type = type +"/"+ entity.IsTake.ToString();
|
|
||||||
break;
|
|
||||||
case "QCOperation/QCPassedOrFailed":
|
|
||||||
try
|
|
||||||
{
|
|
||||||
type = type + "/" + (40 % (int)entity.AuditState).ToString();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 既往手术史
|
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousSurgery)))
|
|
||||||
{
|
|
||||||
await InsertInspection<PreviousSurgery>(item, type, x => new DataInspection()
|
|
||||||
{
|
|
||||||
GeneralId = x.Id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 既往放疗史
|
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousHistory)))
|
|
||||||
{
|
|
||||||
await InsertInspection<PreviousHistory>(item, type, x => new DataInspection()
|
|
||||||
{
|
|
||||||
GeneralId = x.Id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其他治疗史
|
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousOther)))
|
|
||||||
{
|
|
||||||
|
|
||||||
await InsertInspection<PreviousOther>(item, type, x => new DataInspection()
|
|
||||||
{
|
|
||||||
GeneralId = x.Id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查
|
// 检查
|
||||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy)))
|
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomStudy)))
|
||||||
{
|
{
|
||||||
|
@ -242,7 +176,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
await InsertInspection<NoneDicomStudy>(item, type, x => new DataInspection()
|
await InsertInspection<NoneDicomStudy>(item, type, x => new DataInspection()
|
||||||
{
|
{
|
||||||
GeneralId = x.Id,
|
GeneralId = x.Id,
|
||||||
},new {
|
}, new
|
||||||
|
{
|
||||||
FileCount = filecount,
|
FileCount = filecount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -257,16 +192,125 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
noneDicomStudy = await _dbContext.NoneDicomStudy.FirstOrDefaultAsync(x => x.Id == entity.NoneDicomStudyId);
|
noneDicomStudy = await _dbContext.NoneDicomStudy.FirstOrDefaultAsync(x => x.Id == entity.NoneDicomStudyId);
|
||||||
}
|
}
|
||||||
noneDicomStudy = noneDicomStudy ?? new NoneDicomStudy();
|
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()
|
await InsertInspection<NoneDicomStudyFile>(item, type, x => new DataInspection()
|
||||||
{
|
{
|
||||||
GeneralId = x.Id,
|
GeneralId = x.Id,
|
||||||
TrialId = noneDicomStudy.TrialId,
|
TrialId = noneDicomStudy.TrialId,
|
||||||
SubjectId = noneDicomStudy.SubjectId,
|
SubjectId = noneDicomStudy.SubjectId,
|
||||||
|
SiteId= noneDicomStudy.SiteId,
|
||||||
SubjectVisitId = noneDicomStudy.SubjectVisitId,
|
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)))
|
||||||
|
{
|
||||||
|
var entity = item.Entity as SubjectVisit;
|
||||||
|
switch (GetRequestUrl())
|
||||||
|
{
|
||||||
|
case "QCOperation/obtainOrCancelQCTask":
|
||||||
|
type = type +"/"+ entity.IsTake.ToString();
|
||||||
|
break;
|
||||||
|
case "QCOperation/QCPassedOrFailed":
|
||||||
|
try
|
||||||
|
{
|
||||||
|
type = type + "/" + (40 % (int)entity.AuditState).ToString();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 既往手术史
|
||||||
|
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 = "既往手术史"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 既往放疗史
|
||||||
|
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,
|
||||||
|
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(QCChallenge)))
|
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge)))
|
||||||
|
|
Loading…
Reference in New Issue