Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
commit
f9c61cabcc
|
@ -52,29 +52,27 @@ namespace IRaCIS.Core.API
|
|||
.Build();
|
||||
|
||||
|
||||
//// Serilog
|
||||
SerilogExtension.AddSerilogSetup(enviromentName, host.Services);
|
||||
Log.Logger.Warning($"µ±Ç°»·¾³£º{enviromentName}");
|
||||
|
||||
|
||||
|
||||
NewId.SetProcessIdProvider(new CurrentProcessIdProvider());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//// Serilog
|
||||
SerilogExtension.AddSerilogSetup(enviromentName, host.Services);
|
||||
|
||||
//缓存项目的状态 匿名化数据
|
||||
await InitCache(host);
|
||||
|
||||
WatchJsonFile(Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "en-US.json") );
|
||||
WatchJsonFile(Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, StaticData.En_US_Json) );
|
||||
|
||||
WatchJsonFile(Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "zh-CN.json"));
|
||||
WatchJsonFile(Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, StaticData.Zh_CN_Json));
|
||||
|
||||
|
||||
|
||||
|
||||
host.Run();
|
||||
|
||||
Log.Logger.Warning($"当前环境:{enviromentName}");
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -83,46 +81,6 @@ namespace IRaCIS.Core.API
|
|||
Log.Logger.Error(e.InnerException is null ? e.Message + e.StackTrace : e.InnerException?.Message + e.InnerException?.StackTrace);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Nlog 废弃
|
||||
//var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
|
||||
//try
|
||||
//{
|
||||
// var ihostBuilder = CreateHostBuilder(args);
|
||||
|
||||
// ihostBuilder.UseEnvironment(environment);
|
||||
|
||||
// ihostBuilder.ConfigureAppConfiguration((hostContext, config) =>
|
||||
// {
|
||||
|
||||
// //Console.WriteLine(hostContext.HostingEnvironment.EnvironmentName);
|
||||
// config.AddJsonFile("appsettings.json", false, true)
|
||||
// .AddJsonFile($"appsettings.{environment}.json", false, true);
|
||||
// });
|
||||
|
||||
// var host = ihostBuilder.Build();
|
||||
|
||||
// CacheTrialStatus(host);
|
||||
|
||||
// host.Run();
|
||||
|
||||
//}
|
||||
//catch (Exception exception)
|
||||
//{
|
||||
// //NLog: catch setup errors
|
||||
// logger.Error(exception, "Stopped program because of exception");
|
||||
//}
|
||||
//finally
|
||||
//{
|
||||
// // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
|
||||
// NLog.LogManager.Shutdown();
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
|
@ -141,17 +99,8 @@ namespace IRaCIS.Core.API
|
|||
//webBuilder.UseSerilog();//在宿主机启动的时候配置serilog,与微软ILogger进行整合
|
||||
webBuilder.UseStartup<Startup>();
|
||||
}).UseSerilog()
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory());//使用Autofac替代本身容器
|
||||
//ConfigureLogging(logging =>
|
||||
//{
|
||||
// logging.ClearProviders();
|
||||
// logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
||||
//})
|
||||
//.UseNLog()
|
||||
// NLog: Setup NLog for Dependency injection;
|
||||
|
||||
|
||||
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||
|
||||
|
||||
private static async Task InitCache(IHost host)
|
||||
{
|
||||
|
@ -176,7 +125,7 @@ namespace IRaCIS.Core.API
|
|||
|
||||
foreach (IConfigurationSection section in enConfiguration.GetChildren())
|
||||
{
|
||||
if (filePath.Contains("en-US.json") )
|
||||
if (filePath.Contains(StaticData.En_US_Json) )
|
||||
{
|
||||
StaticData.En_US_Dic[section.Key] = section.Value;
|
||||
|
||||
|
@ -195,11 +144,13 @@ namespace IRaCIS.Core.API
|
|||
}
|
||||
public static void WatchJsonFile(string filePath)
|
||||
{
|
||||
LoadJsonFile(filePath);
|
||||
|
||||
|
||||
FileSystemWatcher watcher = new FileSystemWatcher(Path.GetDirectoryName(filePath), Path.GetFileName(filePath));
|
||||
watcher.Changed += (sender, e) => LoadJsonFile(filePath);
|
||||
watcher.EnableRaisingEvents = true;
|
||||
|
||||
LoadJsonFile(filePath);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,10 +36,10 @@ namespace IRaCIS.Core.API
|
|||
config.WriteTo.Email(new EmailConnectionInfo()
|
||||
{
|
||||
EmailSubject = "系统警告,请速速查看!",//邮件标题
|
||||
FromEmail = "iracis_grr@163.com",//发件人邮箱
|
||||
MailServer = "smtp.163.com",//smtp服务器地址
|
||||
NetworkCredentials = new NetworkCredential("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"),//两个参数分别是发件人邮箱与客户端授权码
|
||||
Port = 25,//端口号
|
||||
FromEmail = "test@extimaging.com",//发件人邮箱
|
||||
MailServer = "smtp.qiye.aliyun.com",//smtp服务器地址
|
||||
NetworkCredentials = new NetworkCredential("test@extimaging.com", "SHzyyl2021"),//两个参数分别是发件人邮箱与客户端授权码
|
||||
Port = 465,//端口号
|
||||
ToEmail = "872297557@qq.com"//收件人
|
||||
}, restrictedToMinimumLevel: LogEventLevel.Error,
|
||||
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [ {Level} {ClientIp} {ClientAgent} {TokenUserRealName} {TokenUserType} ] || [path: {RequestPath} arguments: {RequestBody}] {SourceContext:l} || {Message} || {Exception} ||end {NewLine})");
|
||||
|
|
|
@ -210,12 +210,9 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public bool IsAdd { get; set; }
|
||||
|
||||
public AddOrUpdateStudyDto Study { get; set; }
|
||||
|
||||
|
||||
public List<AddOrUpdateSeriesDto> SeriesList { get; set; }
|
||||
|
||||
public List<AddInstanceDto> InstanceList { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class AddOrUpdateStudyDto
|
||||
{
|
||||
|
@ -253,6 +250,9 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public string BodyPartExamined { get; set; } = string.Empty;
|
||||
|
||||
public List<AddOrUpdateSeriesDto> SeriesList { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AddOrUpdateSeriesDto
|
||||
|
@ -278,6 +278,9 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string AcquisitionNumber { get; set; } = string.Empty;
|
||||
public string TriggerTime { get; set; } = string.Empty;
|
||||
|
||||
public List<AddInstanceDto> InstanceList { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
await _dicomstudyRepository.AddAsync(study);
|
||||
|
||||
|
||||
foreach (var seriesItem in incommand.SeriesList)
|
||||
foreach (var seriesItem in incommand.Study.SeriesList)
|
||||
{
|
||||
var series = _mapper.Map<DicomSeries>(seriesItem);
|
||||
|
||||
|
@ -182,7 +182,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
await _dicomSeriesRepository.AddAsync(series);
|
||||
|
||||
foreach (var instanceItem in incommand.InstanceList)
|
||||
foreach (var instanceItem in seriesItem.InstanceList)
|
||||
{
|
||||
var isntance = _mapper.Map<DicomInstance>(instanceItem);
|
||||
isntance.StudyId = study.Id;
|
||||
|
@ -209,34 +209,59 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
var study = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
||||
|
||||
_mapper.Map(incommand.Study, study);
|
||||
//_mapper.Map(incommand.Study, study);
|
||||
|
||||
//特殊处理逻辑
|
||||
SpecialArchiveStudyDeal(study);
|
||||
|
||||
await _dicomSeriesRepository.BatchDeleteNoTrackingAsync(t => t.StudyId == incommand.Study.Id);
|
||||
//await _dicomSeriesRepository.BatchDeleteNoTrackingAsync(t => t.StudyId == incommand.Study.Id);
|
||||
|
||||
|
||||
foreach (var seriesItem in incommand.SeriesList)
|
||||
// 少了整个序列
|
||||
|
||||
//某个序列下少了instance
|
||||
foreach (var seriesItem in incommand.Study.SeriesList)
|
||||
{
|
||||
var series = _mapper.Map<DicomSeries>(seriesItem);
|
||||
var seriesId = IdentifierHelper.CreateGuid(seriesItem.StudyInstanceUid, seriesItem.SeriesInstanceUid, trialId.ToString());
|
||||
|
||||
series.Id = IdentifierHelper.CreateGuid(series.StudyInstanceUid, series.SeriesInstanceUid, trialId.ToString());
|
||||
series.StudyId = study.Id;
|
||||
DicomSeries dicomSeries = await _dicomSeriesRepository.FirstOrDefaultAsync(t=>t.Id==seriesId);
|
||||
|
||||
series.TrialId = incommand.TrialId;
|
||||
series.SiteId = incommand.SiteId;
|
||||
series.SubjectId = incommand.SubjectId;
|
||||
series.SubjectVisitId = incommand.SubjectVisitId;
|
||||
//判断重复
|
||||
if (dicomSeries == null)
|
||||
{
|
||||
|
||||
await _dicomSeriesRepository.AddAsync(series);
|
||||
|
||||
foreach (var instanceItem in incommand.InstanceList)
|
||||
var series = _mapper.Map<DicomSeries>(seriesItem);
|
||||
|
||||
series.Id = seriesId;
|
||||
series.StudyId = study.Id;
|
||||
|
||||
series.TrialId = incommand.TrialId;
|
||||
series.SiteId = incommand.SiteId;
|
||||
series.SubjectId = incommand.SubjectId;
|
||||
series.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
|
||||
dicomSeries= await _dicomSeriesRepository.AddAsync(series);
|
||||
|
||||
//新的序列 那么 检查的序列数量+1
|
||||
study.SeriesCount += 1;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//该序列掉了instance
|
||||
dicomSeries.InstanceCount += seriesItem.InstanceCount;
|
||||
}
|
||||
|
||||
|
||||
foreach (var instanceItem in seriesItem.InstanceList)
|
||||
{
|
||||
var insntance = _mapper.Map<DicomInstance>(instanceItem);
|
||||
insntance.Id = IdentifierHelper.CreateGuid(insntance.StudyInstanceUid, insntance.SeriesInstanceUid, insntance.SopInstanceUid, trialId.ToString());
|
||||
insntance.StudyId = study.Id;
|
||||
insntance.SeriesId = series.Id;
|
||||
insntance.SeriesId = dicomSeries.Id;
|
||||
|
||||
insntance.TrialId = incommand.TrialId;
|
||||
insntance.SiteId = incommand.SiteId;
|
||||
|
@ -245,16 +270,17 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
await _dicomInstanceRepository.AddAsync(insntance);
|
||||
}
|
||||
|
||||
|
||||
// 不管是新的序列 还是 该序列 掉了Instance 重传的时候 检查的instance 数量都会增加
|
||||
study.InstanceCount += seriesItem.InstanceCount;
|
||||
|
||||
}
|
||||
|
||||
// 少了整个序列
|
||||
|
||||
//某个序列下少了instance
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
await _dicomstudyRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
@ -629,7 +655,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
/// 批量验证 检查是否可以上传 并告知原因
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public (List<VerifyStudyUploadResult>, object?) VerifyStudyAllowUpload(VerifyUploadOrReupload verifyInfo)
|
||||
public IResponseOutput<List<VerifyStudyUploadResult>> VerifyStudyAllowUpload(VerifyUploadOrReupload verifyInfo)
|
||||
{
|
||||
var trialInfo = _repository.Where<Trial>().FirstOrDefault(t => t.Id == verifyInfo.TrialId).IfNullThrowException();
|
||||
|
||||
|
@ -677,13 +703,12 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
var systemAnonymizationList = _repository.Where<SystemAnonymization>(t => t.IsEnable).ToList();
|
||||
|
||||
return (result, new
|
||||
return ResponseOutput.Ok<List<VerifyStudyUploadResult>>(result, new
|
||||
{
|
||||
DicomStoreInfo = otherData,
|
||||
AnonymizeFixedList = systemAnonymizationList.Where(t => t.IsFixed).ToList(),
|
||||
AnonymizeNotFixedList = systemAnonymizationList.Where(t => t.IsFixed == false).ToList()
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -738,7 +763,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
result.AllowReUpload = true;
|
||||
|
||||
result.UploadedSeriesList = _repository.Where<DicomSeries>(t => t.StudyId == verifyStudyInfo.Id).Select(t => new UploadedSeries()
|
||||
{ SeriesInstanceUid = t.SeriesInstanceUid, SOPInstanceUIDList = t.DicomInstanceList.Select(c => c.SopInstanceUid).ToList() }).ToList();
|
||||
{ SeriesId=t.Id, SeriesInstanceUid = t.SeriesInstanceUid, SOPInstanceUIDList = t.DicomInstanceList.Select(c => c.SopInstanceUid).ToList() }).ToList();
|
||||
}
|
||||
//不是同一个受试者
|
||||
else
|
||||
|
|
|
@ -162,7 +162,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<AssginSiteCRCCommand, TrialSiteUser>();
|
||||
|
||||
CreateMap<Domain.Models.Trial, TrialConfigDTO>().ForMember(t => t.TrialId, u => u.MapFrom(c => c.Id))
|
||||
var isEn_Us = false;
|
||||
|
||||
CreateMap<Domain.Models.Trial, TrialConfigDTO>().ForMember(t => t.TrialId, u => u.MapFrom(c => c.Id))
|
||||
.ForMember(t => t.TrialCriterionIds, u => u.MapFrom(c => c.ReadingQuestionCriterionTrialList.Where(v =>v.IsConfirm).OrderBy(x=>x.ShowOrder).Select(r => r.Id)))
|
||||
.ForMember(t => t.TrialCriterionNames, u => u.MapFrom(c => c.ReadingQuestionCriterionTrialList.Where(v => v.IsConfirm).OrderBy(x => x.ShowOrder).Select(r => r.CriterionName)))
|
||||
.ForMember(t => t.ClinicalDataTrialSetIds, u => u.MapFrom(c => c.clinicalDataTrialSets.Where(v => v.IsConfirm).Select(r => r.Id)))
|
||||
|
|
|
@ -319,6 +319,8 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public class UploadedSeries
|
||||
{
|
||||
public Guid SeriesId { get; set; }
|
||||
|
||||
public string SeriesInstanceUid { get; set; }
|
||||
|
||||
public List<string> SOPInstanceUIDList { get; set; }
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Share;
|
||||
|
||||
|
@ -10,6 +12,12 @@ public static class StaticData
|
|||
public static Dictionary<string, string> Zh_CN_Dic = new Dictionary<string, string>();
|
||||
|
||||
|
||||
public static readonly string En_US_Json = "en-US.json";
|
||||
public static readonly string Zh_CN_Json = "zh-CN.json";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 字典表项固定值
|
||||
public static readonly string Title = "Title";
|
||||
|
|
Loading…
Reference in New Issue