Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
commit
9b73522a8e
|
@ -9,6 +9,8 @@ using IRaCIS.Core.Application.MediatR.Handlers;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using MassTransit.NewIdProviders;
|
using MassTransit.NewIdProviders;
|
||||||
|
using System.IO;
|
||||||
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
|
||||||
namespace IRaCIS.Core.API
|
namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
|
@ -56,12 +58,18 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// Serilog
|
//// Serilog
|
||||||
SerilogExtension.AddSerilogSetup(enviromentName, host.Services);
|
SerilogExtension.AddSerilogSetup(enviromentName, host.Services);
|
||||||
|
|
||||||
//缓存项目的状态 匿名化数据
|
//缓存项目的状态 匿名化数据
|
||||||
await InitCache(host);
|
await InitCache(host);
|
||||||
|
|
||||||
|
WatchJsonFile(Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "en-US.json") );
|
||||||
|
|
||||||
|
WatchJsonFile(Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "zh-CN.json"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
host.Run();
|
host.Run();
|
||||||
|
@ -154,5 +162,45 @@ namespace IRaCIS.Core.API
|
||||||
await _mediator.Send(new TrialStateCacheRequest());
|
await _mediator.Send(new TrialStateCacheRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static void LoadJsonFile(string filePath)
|
||||||
|
{
|
||||||
|
|
||||||
|
IConfigurationBuilder builder = new ConfigurationBuilder()
|
||||||
|
.AddJsonFile(filePath);
|
||||||
|
|
||||||
|
IConfigurationRoot enConfiguration = builder.Build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (IConfigurationSection section in enConfiguration.GetChildren())
|
||||||
|
{
|
||||||
|
if (filePath.Contains("en-US.json") )
|
||||||
|
{
|
||||||
|
StaticData.En_US_Dic[section.Key] = section.Value;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StaticData.Zh_CN_Dic[section.Key] = section.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void WatchJsonFile(string filePath)
|
||||||
|
{
|
||||||
|
FileSystemWatcher watcher = new FileSystemWatcher(Path.GetDirectoryName(filePath), Path.GetFileName(filePath));
|
||||||
|
watcher.Changed += (sender, e) => LoadJsonFile(filePath);
|
||||||
|
watcher.EnableRaisingEvents = true;
|
||||||
|
|
||||||
|
LoadJsonFile(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
throw new BusinessValidationFailedException("解析Json文件配置出现问题");
|
throw new BusinessValidationFailedException("解析Json文件配置出现问题:"+e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//默认存储的路径
|
//默认存储的路径
|
||||||
|
@ -88,7 +88,6 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
if (bestDrive == null || ((double)(defaultDrive.TotalSize - defaultDrive.TotalFreeSpace) / defaultDrive.TotalSize) * 100 < switchingRatio)
|
if (bestDrive == null || ((double)(defaultDrive.TotalSize - defaultDrive.TotalFreeSpace) / defaultDrive.TotalSize) * 100 < switchingRatio)
|
||||||
{
|
{
|
||||||
bestStoreRootFolder = defaultStoreRootFolder;
|
bestStoreRootFolder = defaultStoreRootFolder;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,6 +176,24 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class PreArchiveDicomStudyCommand
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
[NotDefault]
|
||||||
|
public Guid SiteId { get; set; }
|
||||||
|
[NotDefault]
|
||||||
|
public Guid SubjectId { get; set; }
|
||||||
|
[NotDefault]
|
||||||
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
|
||||||
|
public int FailedFileCount { get; set; }
|
||||||
|
public decimal FileSize { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public int FileCount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class NewArchiveStudyCommand
|
public class NewArchiveStudyCommand
|
||||||
{
|
{
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
|
@ -186,6 +204,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public Guid SubjectId { get; set; }
|
public Guid SubjectId { get; set; }
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
public Guid SubjectVisitId { get; set; }
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
[NotDefault]
|
||||||
|
public Guid StudyMonitorId { get; set; }
|
||||||
|
|
||||||
public bool IsAdd { get; set; }
|
public bool IsAdd { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using DocumentFormat.OpenXml.Presentation;
|
using DocumentFormat.OpenXml.Presentation;
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
using IRaCIS.Core.Application.Filter;
|
||||||
|
using IRaCIS.Core.Application.MediatR.Handlers;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
|
@ -26,10 +30,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
private readonly IRepository<DicomStudy> _dicomstudyRepository;
|
private readonly IRepository<DicomStudy> _dicomstudyRepository;
|
||||||
private readonly IRepository<Dictionary> _dictionaryRepository;
|
private readonly IRepository<Dictionary> _dictionaryRepository;
|
||||||
|
|
||||||
|
private readonly IRepository<StudyMonitor> _studyMonitorRepository;
|
||||||
|
|
||||||
|
|
||||||
public StudyService(IEasyCachingProvider provider
|
public StudyService(IEasyCachingProvider provider
|
||||||
, IRepository<SubjectVisit> subjectVisitRepository,
|
, IRepository<SubjectVisit> subjectVisitRepository,
|
||||||
IRepository<DicomInstance> dicomInstanceRepository,
|
IRepository<DicomInstance> dicomInstanceRepository,
|
||||||
IRepository<DicomSeries> dicomSeriesRepository, IRepository<DicomStudy> dicomstudyRepository, IRepository<Dictionary> dictionaryRepository)
|
IRepository<DicomSeries> dicomSeriesRepository, IRepository<DicomStudy> dicomstudyRepository, IRepository<Dictionary> dictionaryRepository, IRepository<StudyMonitor> studyMonitorRepository)
|
||||||
{
|
{
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
_subjectVisitRepository = subjectVisitRepository;
|
_subjectVisitRepository = subjectVisitRepository;
|
||||||
|
@ -37,6 +44,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
_dicomSeriesRepository = dicomSeriesRepository;
|
_dicomSeriesRepository = dicomSeriesRepository;
|
||||||
_dicomstudyRepository = dicomstudyRepository;
|
_dicomstudyRepository = dicomstudyRepository;
|
||||||
_dictionaryRepository = dictionaryRepository;
|
_dictionaryRepository = dictionaryRepository;
|
||||||
|
_studyMonitorRepository = studyMonitorRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,9 +83,52 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
|
|
||||||
|
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var studyMonitor = new StudyMonitor()
|
||||||
|
{
|
||||||
|
TrialId = preArchiveStudyCommand.TrialId,
|
||||||
|
SiteId = preArchiveStudyCommand.SiteId,
|
||||||
|
SubjectId = preArchiveStudyCommand.SubjectId,
|
||||||
|
SubjectVisitId = preArchiveStudyCommand.SubjectVisitId,
|
||||||
|
|
||||||
|
IsSuccess = false,
|
||||||
|
UploadStartTime = DateTime.Now,
|
||||||
|
IsDicom = true,
|
||||||
|
IP = _userInfo.IP,
|
||||||
|
|
||||||
|
FileSize = preArchiveStudyCommand.FileSize,
|
||||||
|
FileCount = preArchiveStudyCommand.FileCount,
|
||||||
|
FailedFileCount = preArchiveStudyCommand.FailedFileCount,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(addEntity.Id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[UnitOfWork]
|
||||||
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
||||||
{
|
{
|
||||||
var trialId = incommand.TrialId;
|
var trialId = incommand.TrialId;
|
||||||
|
|
||||||
|
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == incommand.StudyMonitorId);
|
||||||
|
studyMonitor.UploadFinishedTime = DateTime.Now;
|
||||||
|
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||||
|
studyMonitor.IsDicomReUpload = !incommand.IsAdd;
|
||||||
|
|
||||||
if (incommand.IsAdd)
|
if (incommand.IsAdd)
|
||||||
{
|
{
|
||||||
var study = _mapper.Map<DicomStudy>(incommand.Study);
|
var study = _mapper.Map<DicomStudy>(incommand.Study);
|
||||||
|
@ -148,6 +199,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
studyMonitor.StudyId = study.Id;
|
||||||
|
studyMonitor.StudyCode = study.StudyCode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -181,7 +234,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
foreach (var instanceItem in incommand.InstanceList)
|
foreach (var instanceItem in incommand.InstanceList)
|
||||||
{
|
{
|
||||||
var insntance = _mapper.Map<DicomInstance>(instanceItem);
|
var insntance = _mapper.Map<DicomInstance>(instanceItem);
|
||||||
insntance.Id= IdentifierHelper.CreateGuid(insntance.StudyInstanceUid, insntance.SeriesInstanceUid, insntance.SopInstanceUid, trialId.ToString());
|
insntance.Id = IdentifierHelper.CreateGuid(insntance.StudyInstanceUid, insntance.SeriesInstanceUid, insntance.SopInstanceUid, trialId.ToString());
|
||||||
insntance.StudyId = study.Id;
|
insntance.StudyId = study.Id;
|
||||||
insntance.SeriesId = series.Id;
|
insntance.SeriesId = series.Id;
|
||||||
|
|
||||||
|
@ -199,6 +252,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
//某个序列下少了instance
|
//某个序列下少了instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _dicomstudyRepository.SaveChangesAsync();
|
await _dicomstudyRepository.SaveChangesAsync();
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
@ -207,8 +263,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageOutput<UnionStudyViewModel>> GetDicomAndNoneDicomStudyList(StudyQuery studyQuery)
|
public async Task<PageOutput<UnionStudyViewModel>> GetDicomAndNoneDicomStudyList(StudyQuery studyQuery)
|
||||||
{
|
{
|
||||||
|
|
|
@ -640,6 +640,8 @@ namespace IRaCIS.Core.Application
|
||||||
AdditionalAssessment additional = new AdditionalAssessment();
|
AdditionalAssessment additional = new AdditionalAssessment();
|
||||||
var addTypeList = additional.GetSystemDefeaultAdditionalAssessmentList(updateItem.CriterionType, updateItem.AdditionalAssessmentType);
|
var addTypeList = additional.GetSystemDefeaultAdditionalAssessmentList(updateItem.CriterionType, updateItem.AdditionalAssessmentType);
|
||||||
|
|
||||||
|
if(! await _readingQuestionTrialRepository.AnyAsync(t => t.ReadingQuestionCriterionTrialId == updateItem.TrialReadingCriterionId && t.IsAdditional==true))
|
||||||
|
{
|
||||||
foreach (var addType in addTypeList)
|
foreach (var addType in addTypeList)
|
||||||
{
|
{
|
||||||
foreach (var question in addType.AdditionalQuestionList)
|
foreach (var question in addType.AdditionalQuestionList)
|
||||||
|
@ -651,11 +653,6 @@ namespace IRaCIS.Core.Application
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
//删除附加问题
|
|
||||||
|
|
||||||
await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(t => t.ReadingQuestionCriterionTrialId == updateItem.TrialReadingCriterionId && t.IsAdditional == true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _trialCriterionAdditionalAssessmentTypeRepository.UpdatePartialFromQueryAsync(updateItem.Id, t => new TrialCriterionAdditionalAssessmentType() { IsSelected = updateItem.IsSelected });
|
await _trialCriterionAdditionalAssessmentTypeRepository.UpdatePartialFromQueryAsync(updateItem.Id, t => new TrialCriterionAdditionalAssessmentType() { IsSelected = updateItem.IsSelected });
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
namespace IRaCIS.Core.Domain.Share;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Domain.Share;
|
||||||
|
|
||||||
public static class StaticData
|
public static class StaticData
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static Dictionary<string, string> En_US_Dic = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
public static Dictionary<string, string> Zh_CN_Dic = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 字典表项固定值
|
#region 字典表项固定值
|
||||||
|
@ -19,6 +25,8 @@ public static class StaticData
|
||||||
|
|
||||||
public static class Folder
|
public static class Folder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static readonly string Resources = "Resources";
|
||||||
public static readonly string IRaCISDataFolder = "IRaCISData";
|
public static readonly string IRaCISDataFolder = "IRaCISData";
|
||||||
|
|
||||||
public static readonly string TrialDataFolder = "TrialData";
|
public static readonly string TrialDataFolder = "TrialData";
|
||||||
|
|
Loading…
Reference in New Issue