diff --git a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs index 40aab24a1..a0c251942 100644 --- a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs @@ -47,9 +47,9 @@ public static class ExcelExportHelper foreach (var needTranslateProperty in needTranslatePropertyList) { - var beforeValue = itemDic[needTranslateProperty.Name].ToString(); + var beforeValue = itemDic[needTranslateProperty.Name]?.ToString(); - itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue.ToLower()).FirstOrDefault()?.ValueCN??String.Empty; + itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).FirstOrDefault()?.ValueCN??String.Empty; } itemDic.Add("No", no++); diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index c37771d6a..31c85e57f 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -308,6 +308,7 @@ namespace IRaCIS.Core.Application.Contracts public string TrialSiteCode { get; set; } + [DictionaryTranslateAttribute("Subject_Visit_Status")] public SubjectStatus SubjectStatus { get; set; } @@ -332,7 +333,7 @@ namespace IRaCIS.Core.Application.Contracts public class UnionStudyExportDTO { - public string Modalities { get; set; } = string.Empty; + public string Modality { get; set; } = string.Empty; public DateTime? StudyTime { get; set; } @@ -352,6 +353,10 @@ namespace IRaCIS.Core.Application.Contracts [DictionaryTranslateAttribute("YesOrNo")] public bool IsDicom { get; set; } + + + [DictionaryTranslateAttribute("CheckState")] + public CheckStateEnum CheckState { get; set; } } @@ -394,6 +399,11 @@ namespace IRaCIS.Core.Application.Contracts public bool? IsCheckBack { get; set; } public string CheckResult { get; set; } = String.Empty; + + + public string CheckDialogStr { get; set; } + + public DateTime? CheckBackTime { get; set; } } diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index e71a6b5f8..03436107d 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -172,6 +172,7 @@ namespace IRaCIS.Core.Application.Image.QA .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + list = list.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ToList(); var exportInfo = (await _trialRepository.Where(t => t.Id == param.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); @@ -204,8 +205,8 @@ namespace IRaCIS.Core.Application.Image.QA VisitName = t.SubjectVisit.VisitName, VisitNum = t.SubjectVisit.VisitNum, IsDicom = true, - SubjectCode = t.Subject.Code, - Modalities = t.Modalities, + SubjectCode = t.Subject.Code, + Modality = t.Modalities, StudyCode = t.StudyCode, StudyTime = t.StudyTime, @@ -213,6 +214,7 @@ namespace IRaCIS.Core.Application.Image.QA TrialSiteCode = t.TrialSite.TrialSiteCode, + CheckState=t.SubjectVisit.CheckState, //Uploader = t.Uploader.UserName, //UploadTime = t.CreateTime @@ -232,8 +234,8 @@ namespace IRaCIS.Core.Application.Image.QA VisitName = t.SubjectVisit.VisitName, VisitNum = t.SubjectVisit.VisitNum, IsDicom = false, - SubjectCode = t.Subject.Code, - Modalities = t.Modality, + SubjectCode = t.Subject.Code, + Modality = t.Modality, StudyCode = t.StudyCode, StudyTime = t.ImageDate, @@ -241,6 +243,8 @@ namespace IRaCIS.Core.Application.Image.QA TrialSiteCode = t.TrialSite.TrialSiteCode, + CheckState = t.SubjectVisit.CheckState, + //Uploader = t.CreateUser.UserName, //UploadTime = t.CreateTime @@ -251,6 +255,8 @@ namespace IRaCIS.Core.Application.Image.QA var list = await dicomStudyQuery.Union(nodeDicomStudyQuery) .ToListAsync(); + list = list.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t=>t.VisitNum).ToList(); + var exportInfo = (await _trialRepository.Where(t => t.Id == studyQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); exportInfo.List = list; @@ -281,6 +287,8 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + list = list.OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ToList(); + var exportInfo = (await _trialRepository.Where(t => t.Id == checkQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); exportInfo.List = list; diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index b95c484f8..dbdf0893c 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -1323,6 +1323,10 @@ namespace IRaCIS.Core.Application.Image.QA await VerifyIsCanQCAsync(dbSubjectVisit); + //删除 软删除的物理文件 + var instanceIdList = await _repository.Where(t => t.DicomSerie.IsDeleted && t.SubjectVisitId == subjectVisitId) + .Select(t => new { InstanceId = t.Id, t.SeriesId, t.StudyId, t.SubjectId, t.SiteId }).ToListAsync(); + //维护统一状态 dbSubjectVisit.ReadingStatus = ReadingStatusEnum.ConsistencyCheck; @@ -1356,12 +1360,29 @@ namespace IRaCIS.Core.Application.Image.QA //维护统一状态 dbSubjectVisit.ReadingStatus = trialConfig.IsImageConsistencyVerification ? ReadingStatusEnum.ConsistencyCheck : ReadingStatusEnum.TaskAllocate; + //删除影像 + instanceIdList.ForEach(t => + { + var dicomStudy = new DicomStudy() { Id = t.StudyId, SubjectId = t.SubjectId, TrialId = trialId, SiteId = t.SiteId, SubjectVisitId = subjectVisitId }; + var path = + + FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, t.InstanceId); + + if (System.IO.File.Exists(path)) + { + File.Delete(path); + } + + }); + } else { return ResponseOutput.NotOk("项目配置影像质控为单审,当前访视影像质控任务不能从当前审核状态变更到 审核通过。"); } + + } else if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit) { @@ -1402,6 +1423,21 @@ namespace IRaCIS.Core.Application.Image.QA //维护统一状态 dbSubjectVisit.ReadingStatus = trialConfig.IsImageConsistencyVerification ? ReadingStatusEnum.ConsistencyCheck : ReadingStatusEnum.TaskAllocate; + //删除影像 + instanceIdList.ForEach(t => + { + var dicomStudy = new DicomStudy() { Id = t.StudyId, SubjectId = t.SubjectId, TrialId = trialId, SiteId = t.SiteId, SubjectVisitId = subjectVisitId }; + var path = + + FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, t.InstanceId); + + if (System.IO.File.Exists(path)) + { + File.Delete(path); + } + + }); + } else { @@ -1460,31 +1496,8 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.CurrentActionUserId = null; dbSubjectVisit.CurrentActionUserExpireTime = null; - //删除 软删除的物理文件 - - - - var instanceIdList = await _repository.Where(t => t.DicomSerie.IsDeleted && t.SubjectVisitId == subjectVisitId) - .Select(t => new { InstanceId = t.Id, t.SeriesId, t.StudyId, t.SubjectId, t.SiteId }).ToListAsync(); - - - instanceIdList.ForEach(t => - { - var dicomStudy = new DicomStudy() { Id = t.StudyId, SubjectId = t.SubjectId, TrialId = trialId, SiteId = t.SiteId, SubjectVisitId = subjectVisitId }; - var path = - - FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, t.InstanceId); - - if (System.IO.File.Exists(path)) - { - File.Delete(path); - } - - }); - await _repository.SaveChangesAsync(); - //var success = await _repository.BatchUpdateAsync(t => t.Id == signId, u => new TrialSign() { IsCompleted = true }); return ResponseOutput.Result(true); @@ -1492,6 +1505,8 @@ namespace IRaCIS.Core.Application.Image.QA } + + /// /// 设置、取消 访视紧急 /// diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 959b8a692..42b8961b8 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -37,7 +37,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUser.UserName)) .ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.UserName)) - .ForMember(d=>d.DialogStr,u=>u.MapFrom(t=> string.Join('|', t.DialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUser.UserName + " " + c.CreateTime.ToString("yyyy-mm-dd hh:mm:ss") + " :" + c.TalkContent)) )) + .ForMember(d=>d.DialogStr,u=>u.MapFrom(t=> string.Join(" | ", t.DialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUser.UserName + " " + c.CreateTime.ToString("yyyy-mm-dd hh:mm:ss") + " :" + c.TalkContent)) )) .ForMember(d => d.SubjectState, u => u.MapFrom(s => s.SubjectVisit.Subject.Status)); @@ -81,7 +81,10 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.TalkContent, u => u.MapFrom(s => s.CheckChallengeDialogList.OrderByDescending(y => y.CreateTime).Select(x => x.TalkContent).FirstOrDefault())) .ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code)) - .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)); + .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) + + .ForMember(d => d.CheckDialogStr, u => u.MapFrom(t => string.Join(" | ", t.CheckChallengeDialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUser.UserName + " " + c.CreateTime.ToString("yyyy-mm-dd hh:mm:ss") + " :" + c.TalkContent)))) + ; CreateMap() .ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName))