Merge branch 'Test.Study' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test.Study
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
59e9d9df69
|
@ -143,44 +143,49 @@ namespace IRaCIS.Api.Controllers
|
|||
|
||||
if (Enum.TryParse<ObjectStoreUse>(serviceOption.ObjectStoreUse, out var parsedEnum) && parsedEnum == ObjectStoreUse.AliyunOSS)
|
||||
{
|
||||
|
||||
var ossOptions = serviceOption.AliyunOSS;
|
||||
|
||||
IClientProfile profile = DefaultProfile.GetProfile(ossOptions.RegionId, ossOptions.AccessKeyId, ossOptions.AccessKeySecret);
|
||||
DefaultAcsClient client = new DefaultAcsClient(profile);
|
||||
return ResponseOutput.Ok(new ObjectStoreDTO() { ObjectStoreUse = serviceOption.ObjectStoreUse, MinIO = serviceOption.MinIO ,AliyunOSS= serviceOption.AliyunOSS });
|
||||
|
||||
#region 临时token 屏蔽
|
||||
//IClientProfile profile = DefaultProfile.GetProfile(ossOptions.RegionId, ossOptions.AccessKeyId, ossOptions.AccessKeySecret);
|
||||
//DefaultAcsClient client = new DefaultAcsClient(profile);
|
||||
|
||||
|
||||
// 创建一个STS请求
|
||||
AssumeRoleRequest request = new AssumeRoleRequest
|
||||
{
|
||||
RoleArn = ossOptions.RoleArn, // 角色ARN,需要替换为你的角色ARN
|
||||
RoleSessionName = $"session-name-{NewId.NextGuid()}", // 角色会话名称,可自定义
|
||||
DurationSeconds = 900, // 令牌有效期(单位:秒),这里设置为1小时
|
||||
};
|
||||
//// 创建一个STS请求
|
||||
//AssumeRoleRequest request = new AssumeRoleRequest
|
||||
//{
|
||||
// RoleArn = ossOptions.RoleArn, // 角色ARN,需要替换为你的角色ARN
|
||||
// RoleSessionName = $"session-name-{NewId.NextGuid()}", // 角色会话名称,可自定义
|
||||
// DurationSeconds = 900, // 令牌有效期(单位:秒),这里设置为1小时
|
||||
//};
|
||||
|
||||
|
||||
AssumeRoleResponse response = client.GetAcsResponse(request);
|
||||
//AssumeRoleResponse response = client.GetAcsResponse(request);
|
||||
|
||||
// 返回STS令牌信息给前端
|
||||
var stsToken = new ObjectStoreDTO()
|
||||
{
|
||||
ObjectStoreUse = serviceOption.ObjectStoreUse,
|
||||
AliyunOSS = new AliyunOSSTempToken()
|
||||
{
|
||||
AccessKeyId = response.Credentials.AccessKeyId,
|
||||
AccessKeySecret = response.Credentials.AccessKeySecret,
|
||||
SecurityToken = response.Credentials.SecurityToken,
|
||||
Expiration = response.Credentials.Expiration,
|
||||
//// 返回STS令牌信息给前端
|
||||
//var stsToken = new ObjectStoreDTO()
|
||||
//{
|
||||
// ObjectStoreUse = serviceOption.ObjectStoreUse,
|
||||
// AliyunOSS = new AliyunOSSTempToken()
|
||||
// {
|
||||
// AccessKeyId = response.Credentials.AccessKeyId,
|
||||
// AccessKeySecret = response.Credentials.AccessKeySecret,
|
||||
// SecurityToken = response.Credentials.SecurityToken,
|
||||
// Expiration = response.Credentials.Expiration,
|
||||
|
||||
Region = ossOptions.Region,
|
||||
BucketName = ossOptions.BucketName,
|
||||
ViewEndpoint = ossOptions.ViewEndpoint,
|
||||
// Region = ossOptions.Region,
|
||||
// BucketName = ossOptions.BucketName,
|
||||
// ViewEndpoint = ossOptions.ViewEndpoint,
|
||||
|
||||
},
|
||||
MinIO = serviceOption.MinIO
|
||||
}
|
||||
;
|
||||
// },
|
||||
// MinIO = serviceOption.MinIO
|
||||
//};
|
||||
//return ResponseOutput.Ok(stsToken);
|
||||
|
||||
#endregion
|
||||
|
||||
return ResponseOutput.Ok(stsToken);
|
||||
}
|
||||
else if (Enum.TryParse<ObjectStoreUse>(serviceOption.ObjectStoreUse, out var parsedValue) && parsedValue == ObjectStoreUse.MinIO)
|
||||
{
|
||||
|
@ -199,14 +204,14 @@ namespace IRaCIS.Api.Controllers
|
|||
var ossOptions = options.CurrentValue;
|
||||
|
||||
|
||||
IClientProfile profile = DefaultProfile.GetProfile(ossOptions.RegionId, ossOptions.AccessKeyId, ossOptions.AccessKeySecret);
|
||||
IClientProfile profile = DefaultProfile.GetProfile(ossOptions.regionId, ossOptions.accessKeyId, ossOptions.accessKeySecret);
|
||||
DefaultAcsClient client = new DefaultAcsClient(profile);
|
||||
|
||||
|
||||
// 创建一个STS请求
|
||||
AssumeRoleRequest request = new AssumeRoleRequest
|
||||
{
|
||||
RoleArn = ossOptions.RoleArn, // 角色ARN,需要替换为你的角色ARN
|
||||
RoleArn = ossOptions.roleArn, // 角色ARN,需要替换为你的角色ARN
|
||||
RoleSessionName = $"session-name-{NewId.NextGuid()}", // 角色会话名称,可自定义
|
||||
DurationSeconds = 900, // 令牌有效期(单位:秒),这里设置为1小时
|
||||
};
|
||||
|
@ -222,9 +227,9 @@ namespace IRaCIS.Api.Controllers
|
|||
SecurityToken = response.Credentials.SecurityToken,
|
||||
Expiration = response.Credentials.Expiration,
|
||||
|
||||
Region = ossOptions.Region,
|
||||
BucketName = ossOptions.BucketName,
|
||||
ViewEndpoint = ossOptions.ViewEndpoint,
|
||||
Region = ossOptions.region ,
|
||||
BucketName = ossOptions.bucketName ,
|
||||
ViewEndpoint = ossOptions.viewEndpoint ,
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1065,7 +1065,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
//有邮箱不符合邮箱格式,请核查Excel数据
|
||||
throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_InvalidEmail"));
|
||||
}
|
||||
var generateUserTypeList = new List<string>() { "CRC", "CRA" };
|
||||
var generateUserTypeList = new List<string>() { "CRC", "CRA","SR" };
|
||||
|
||||
if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper())))
|
||||
{
|
||||
|
@ -1077,7 +1077,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_NoValiddata"));
|
||||
}
|
||||
//处理好 用户类型 和用户类型枚举
|
||||
var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator ).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList();
|
||||
var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList();
|
||||
var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, t.SiteId }).ToList();
|
||||
|
||||
foreach (var item in excelList)
|
||||
|
@ -1095,7 +1095,10 @@ namespace IRaCIS.Core.API.Controllers
|
|||
item.UserTypeEnum = UserTypeEnum.CRA;
|
||||
break;
|
||||
|
||||
|
||||
case "SR":
|
||||
item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId;
|
||||
item.UserTypeEnum = UserTypeEnum.SR;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["IRaCIS.Core.API/IRaCIS.Core.API.csproj", "IRaCIS.Core.API/"]
|
||||
COPY ["IRaCIS.Core.Application/IRaCIS.Core.Application.csproj", "IRaCIS.Core.Application/"]
|
||||
COPY ["IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj", "IRaCIS.Core.Infra.EFCore/"]
|
||||
COPY ["IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj", "IRaCIS.Core.Domain/"]
|
||||
COPY ["IRaCIS.Core.Domain.Share/IRaCIS.Core.Domain.Share.csproj", "IRaCIS.Core.Domain.Share/"]
|
||||
COPY ["IRaCIS.Core.Infrastructure/IRaCIS.Core.Infrastructure.csproj", "IRaCIS.Core.Infrastructure/"]
|
||||
RUN dotnet restore "IRaCIS.Core.API/IRaCIS.Core.API.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/IRaCIS.Core.API"
|
||||
RUN dotnet build "IRaCIS.Core.API.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "IRaCIS.Core.API.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"]
|
|
@ -1,11 +1,13 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"profiles": {
|
||||
"Test_Study": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"publishAllPorts": true
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Test_Study"
|
||||
},
|
||||
"applicationUrl": "http://localhost:6100"
|
||||
},
|
||||
"Uat_Study": {
|
||||
"commandName": "Project",
|
||||
|
@ -14,14 +16,6 @@
|
|||
"ASPNETCORE_ENVIRONMENT": "Uat_Study"
|
||||
},
|
||||
"applicationUrl": "http://localhost:6100"
|
||||
},
|
||||
"Test_Study": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Test_Study"
|
||||
},
|
||||
"applicationUrl": "http://localhost:6100"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
using Autofac;
|
||||
using Autofac.Extras.DynamicProxy;
|
||||
using IRaCIS.Core.Application;
|
||||
using IRaCIS.Core.Application.AOP;
|
||||
using IRaCIS.Core.Application.BackGroundJob;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
|
|
@ -6,15 +6,27 @@
|
|||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AliyunOSS": {
|
||||
"regionId": "cn-shanghai",
|
||||
"region": "oss-cn-shanghai",
|
||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"bucketName": "zy-sir-store",
|
||||
"RoleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"viewEndpoint": "https://zy-sir-cache.oss-cn-shanghai.aliyuncs.com"
|
||||
"ObjectStoreService": {
|
||||
"ObjectStoreUse": "AliyunOSS",
|
||||
"AliyunOSS": {
|
||||
"regionId": "cn-shanghai",
|
||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"bucketName": "zy-sir-store",
|
||||
"roleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"viewEndpoint": "https://zy-sir-cache.oss-cn-shanghai.aliyuncs.com",
|
||||
"region": "oss-cn-shanghai"
|
||||
},
|
||||
|
||||
"MinIO": {
|
||||
"endpoint": "http://192.168.3.68",
|
||||
"port": "8001",
|
||||
"useSSL": false,
|
||||
"accessKey": "IDFkwEpWej0b4DtiuThL",
|
||||
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h",
|
||||
"bucketName": "test"
|
||||
}
|
||||
},
|
||||
|
||||
"ConnectionStrings": {
|
||||
|
|
|
@ -6,16 +6,29 @@
|
|||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AliyunOSS": {
|
||||
"regionId": "cn-shanghai",
|
||||
"region": "oss-cn-shanghai",
|
||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"bucketName": "zy-sir-test-store",
|
||||
"RoleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"viewEndpoint": "https://zy-sir-test-store.oss-cn-shanghai.aliyuncs.com"
|
||||
"ObjectStoreService": {
|
||||
"ObjectStoreUse": "AliyunOSS",
|
||||
"AliyunOSS": {
|
||||
"regionId": "cn-shanghai",
|
||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"bucketName": "zy-sir-test-store",
|
||||
"roleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"viewEndpoint": "https://zy-sir-test-store.oss-cn-shanghai.aliyuncs.com",
|
||||
"region": "oss-cn-shanghai"
|
||||
},
|
||||
|
||||
"MinIO": {
|
||||
"endpoint": "http://192.168.3.68",
|
||||
"port": "8001",
|
||||
"useSSL": false,
|
||||
"accessKey": "IDFkwEpWej0b4DtiuThL",
|
||||
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h",
|
||||
"bucketName": "test"
|
||||
}
|
||||
},
|
||||
|
||||
"ConnectionStrings": {
|
||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study.hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
|
||||
|
|
|
@ -6,15 +6,27 @@
|
|||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AliyunOSS": {
|
||||
"regionId": "cn-shanghai",
|
||||
"region": "oss-cn-shanghai",
|
||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"bucketName": "zy-sir-uat-store",
|
||||
"RoleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"viewEndpoint": "https://zy-sir-uat-store.oss-cn-shanghai.aliyuncs.com"
|
||||
"ObjectStoreService": {
|
||||
"ObjectStoreUse": "AliyunOSS",
|
||||
"AliyunOSS": {
|
||||
"regionId": "cn-shanghai",
|
||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"accessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"bucketName": "zy-sir-uat-store",
|
||||
"roleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"viewEndpoint": "https://zy-sir-uat-store.oss-cn-shanghai.aliyuncs.com",
|
||||
"region": "oss-cn-shanghai"
|
||||
},
|
||||
|
||||
"MinIO": {
|
||||
"endpoint": "http://192.168.3.68",
|
||||
"port": "8001",
|
||||
"useSSL": false,
|
||||
"accessKey": "IDFkwEpWej0b4DtiuThL",
|
||||
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h",
|
||||
"bucketName": "test"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RemoteNew": "Server=47.117.164.182,1434;Database=Uat.Study;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
using Castle.DynamicProxy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.AOP
|
||||
{
|
||||
public abstract class AsyncInterceptorBase : IInterceptor
|
||||
{
|
||||
public AsyncInterceptorBase()
|
||||
{
|
||||
}
|
||||
|
||||
public void Intercept(IInvocation invocation)
|
||||
{
|
||||
BeforeProceed(invocation);
|
||||
invocation.Proceed();
|
||||
if (IsAsyncMethod(invocation.MethodInvocationTarget))
|
||||
{
|
||||
invocation.ReturnValue = InterceptAsync((dynamic)invocation.ReturnValue, invocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
AfterProceedSync(invocation);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckMethodReturnTypeIsTaskType(MethodInfo method)
|
||||
{
|
||||
var methodReturnType = method.ReturnType;
|
||||
if (methodReturnType.IsGenericType)
|
||||
{
|
||||
if (methodReturnType.GetGenericTypeDefinition() == typeof(Task<>) ||
|
||||
methodReturnType.GetGenericTypeDefinition() == typeof(ValueTask<>))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (methodReturnType == typeof(Task) ||
|
||||
methodReturnType == typeof(ValueTask))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsAsyncMethod(MethodInfo method)
|
||||
{
|
||||
bool isDefAsync = Attribute.IsDefined(method, typeof(AsyncStateMachineAttribute), false);
|
||||
bool isTaskType = CheckMethodReturnTypeIsTaskType(method);
|
||||
bool isAsync = isDefAsync && isTaskType;
|
||||
|
||||
return isAsync;
|
||||
}
|
||||
|
||||
protected object ProceedAsyncResult { get; set; }
|
||||
|
||||
|
||||
private async Task InterceptAsync(Task task, IInvocation invocation)
|
||||
{
|
||||
await task.ConfigureAwait(false);
|
||||
await AfterProceedAsync(invocation, false);
|
||||
}
|
||||
|
||||
private async Task<TResult> InterceptAsync<TResult>(Task<TResult> task, IInvocation invocation)
|
||||
{
|
||||
ProceedAsyncResult = await task.ConfigureAwait(false);
|
||||
await AfterProceedAsync(invocation, true);
|
||||
return (TResult)ProceedAsyncResult;
|
||||
}
|
||||
|
||||
private async ValueTask InterceptAsync(ValueTask task, IInvocation invocation)
|
||||
{
|
||||
await task.ConfigureAwait(false);
|
||||
await AfterProceedAsync(invocation, false);
|
||||
}
|
||||
|
||||
private async ValueTask<TResult> InterceptAsync<TResult>(ValueTask<TResult> task, IInvocation invocation)
|
||||
{
|
||||
ProceedAsyncResult = await task.ConfigureAwait(false);
|
||||
await AfterProceedAsync(invocation, true);
|
||||
return (TResult)ProceedAsyncResult;
|
||||
}
|
||||
|
||||
protected virtual void BeforeProceed(IInvocation invocation) { }
|
||||
|
||||
protected virtual void AfterProceedSync(IInvocation invocation) { }
|
||||
|
||||
protected virtual Task AfterProceedAsync(IInvocation invocation, bool hasAsynResult)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,499 +0,0 @@
|
|||
//using System;
|
||||
//using Castle.DynamicProxy;
|
||||
//using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
||||
//using IRaCIS.Core.Infra.EFCore;
|
||||
|
||||
//using System.Linq;
|
||||
//using IRaCIS.Core.Domain.Models;
|
||||
//using IRaCIS.Core.Domain.Share;
|
||||
|
||||
//namespace IRaCIS.Core.API.Utility.AOP
|
||||
//{
|
||||
//#pragma warning disable
|
||||
// public class QANoticeAOP : IInterceptor
|
||||
// {
|
||||
// private readonly IRepository<QANotice> _qaNoticeRepository;
|
||||
|
||||
// private readonly IRepository<DicomStudy> _studyRepository;
|
||||
// private readonly IRepository<TrialUser> _userTrialRepository;
|
||||
// private readonly IRepository<TrialSiteUser> _userTrialSiteRepository;
|
||||
// private readonly IUserInfo _userInfo;
|
||||
|
||||
// public QANoticeAOP(IRepository<QANotice> qaNoticeRepository,
|
||||
// IUserInfo userInfo, IRepository<DicomStudy> studyRepository, IRepository<TrialUser> userTrialRepository, IRepository<TrialSiteUser> userTrialSiteRepository)
|
||||
// {
|
||||
// _qaNoticeRepository = qaNoticeRepository;
|
||||
|
||||
// _studyRepository = studyRepository;
|
||||
// _userTrialRepository = userTrialRepository;
|
||||
// _userTrialSiteRepository = userTrialSiteRepository;
|
||||
// _userInfo = userInfo;
|
||||
// }
|
||||
|
||||
// public void Intercept(IInvocation invocation)
|
||||
// {
|
||||
// //处理拦截的方法
|
||||
// invocation.Proceed();
|
||||
|
||||
// if (invocation.Method.Name == "UpdateStudyStatus")
|
||||
// {
|
||||
// var studyStatus = invocation.Arguments[0] as StudyStatusDetailCommand;
|
||||
|
||||
// var study = _studyRepository.FirstOrDefault(t=>t.Id==studyStatus.StudyId);
|
||||
|
||||
|
||||
// if (study.Status == (int)StudyStatus.Uploaded)
|
||||
// {
|
||||
// _qaNoticeRepository.Add(new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
|
||||
// NoticeTypeEnum = NoticeType.NotNeedNotice,
|
||||
// NeedDeal = false,
|
||||
// StudyStatusStr = "Uploaded",
|
||||
// Message = $"CRC : {_userInfo.RealName} has uploaded {study.StudyCode} ",
|
||||
// SendTime = DateTime.Now,
|
||||
// });
|
||||
// }
|
||||
|
||||
// #region 处理QA通知模块
|
||||
|
||||
// //查询项目的参与者 和 负责site下CRC用户
|
||||
// var trialUserList = _userTrialRepository.Where(t => t.TrialId == study.TrialId).ToList();
|
||||
|
||||
// // 找到该study 关联Site 下的CRC
|
||||
|
||||
// var crcList = _userTrialSiteRepository.Where(t =>
|
||||
// t.SiteId == study.SiteId && t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && t.TrialId == study.TrialId).ToList();
|
||||
|
||||
|
||||
// var qaList = trialUserList.Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).ToList();
|
||||
|
||||
// var pm = trialUserList.FirstOrDefault(t => t.User.UserTypeEnum == UserTypeEnum.ProjectManager);
|
||||
|
||||
|
||||
|
||||
|
||||
// // CRC =>QA
|
||||
// if (studyStatus.Status == (int)StudyStatus.QARequested)
|
||||
// {
|
||||
// //找出当前操作的CRC
|
||||
// //PM 或者admin可以代替CRC角色 不能从CRC列表中查询用户
|
||||
// //var currentCRC = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
|
||||
// //FromUser = currentCRC.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentCRC.UserType,
|
||||
// NoticeTypeEnum = NoticeType.CRC_RequestToQA_NoticeQA,
|
||||
// NeedDeal = true,
|
||||
// StudyStatusStr = "QA Requested",
|
||||
// Message =
|
||||
// $"CRC -> QA : {_userInfo.RealName} request QA {study.StudyCode} , Inquiry can be performed! ",
|
||||
// SendTime = DateTime.Now,
|
||||
// };
|
||||
|
||||
// qaList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = study.Id,
|
||||
// ToUser = t.User.LastName + " / " + t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.User.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
// //DealRequestToQA(study.Id);
|
||||
|
||||
// var needDealNoticeList = _qaNoticeRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectVisitId == study.Id && t.NeedDeal && t.NoticeTypeEnum == NoticeType.CRC_RequestToQA_NoticeQA).ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
// }
|
||||
|
||||
// // QA =>CRC 向CRC推送消息影像有问题 同时作为 requestToQA 的边界
|
||||
// else if (studyStatus.Status == (int)StudyStatus.QAing)
|
||||
// {
|
||||
// //找出当前操作的QA 如果是pm 或者admin 代替操作 此时会有问题 所以 谁代替,就以谁的名义执行
|
||||
// //var currentQA = qaList.First(t => t.UserId == _userInfo.Id);
|
||||
// //var currentQA = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// //在项目CRC列表中筛选出 负责该study关联 site的CRC
|
||||
// var siteCRCList = _userTrialSiteRepository.Where(t =>
|
||||
// t.SiteId == study.SiteId && t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && t.TrialId == study.TrialId).ToList();
|
||||
|
||||
// //查询项目的参与者 和 负责site下CRC用户
|
||||
|
||||
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// //FromUser = currentQA.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentQA.UserType,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.QA_InQA_NoticeCRC,
|
||||
// NeedDeal = true,
|
||||
// StudyStatusStr = "In QA",
|
||||
// Message = $"QA -> CRC : {_userInfo.RealName} inquiry {study.StudyCode} ",
|
||||
// SendTime = DateTime.Now,
|
||||
// };
|
||||
|
||||
// siteCRCList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = study.Id,
|
||||
// ToUser = t.User.LastName + " / " + t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// //添加 发送给CRC的消息 消息和CRC是 一对多
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
|
||||
// //处理 消息 标记已处理
|
||||
// var needDealNoticeList = _qaNoticeRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectVisitId == study.Id && t.NeedDeal &&
|
||||
// (t.NoticeTypeEnum == NoticeType.CRC_RequestToQA_NoticeQA ||
|
||||
// t.NoticeTypeEnum == NoticeType.CRC_ReUpload_NoticeQA ||
|
||||
// t.NoticeTypeEnum == NoticeType.CRC_QARecordDialogPost_NoticeQA)).ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
|
||||
|
||||
// }
|
||||
// // QA =>QA 给自己的消息 通知需要匿名化 同时作为 requestToQA 的边界
|
||||
// else if (studyStatus.Status == (int)StudyStatus.QAFinish)
|
||||
// {
|
||||
|
||||
// //找出当前操作的QA 如果是pm 或者admin 代替操作 此时会有问题 所以 谁代替,就以谁的名义执行
|
||||
// //var currentQA = qaList.First(t => t.UserId == _userInfo.Id);
|
||||
// //var currentQA = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// //发送给当前项目QA列表
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// //FromUser = currentQA.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentQA.UserType,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.QA_QAPass_NoticeQA,
|
||||
// NeedDeal = true,
|
||||
// StudyStatusStr = "QA-Passed",
|
||||
// Message =
|
||||
// $"QA -> QA : {_userInfo.RealName} inquiry {study.StudyCode} finished,Anonymization can be performed!",
|
||||
// SendTime = DateTime.Now,
|
||||
// };
|
||||
|
||||
// qaList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = study.Id,
|
||||
// ToUser = t.User.LastName+" / "+t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.User.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
// //处理 消息 标记已处理 存在意外情况 qa发给CRC的 但是qa里面设置了 通过或者不通过 此时qa发送的消息也设置为已处理
|
||||
// var needDealNoticeList = _qaNoticeRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectVisitId == study.Id && t.NeedDeal &&
|
||||
// (t.NoticeTypeEnum == NoticeType.CRC_RequestToQA_NoticeQA ||
|
||||
// t.NoticeTypeEnum == NoticeType.CRC_ReUpload_NoticeQA ||
|
||||
// t.NoticeTypeEnum == NoticeType.CRC_QARecordDialogPost_NoticeQA ||
|
||||
|
||||
// t.NoticeTypeEnum == NoticeType.QA_QARecordDialogPost_NoticeCRC ||
|
||||
// t.NoticeTypeEnum == NoticeType.QA_InQA_NoticeCRC ||
|
||||
// t.NoticeTypeEnum == NoticeType.QA_AddQARecord_NoticeCRC)).ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
|
||||
|
||||
// }
|
||||
// // QA =>CRC 暂时不用发送消息给CRC 因为CRC 暂时没有入口回复 同时作为 requestToQA 的边界
|
||||
// else if (studyStatus.Status == (int)StudyStatus.QAFInishNotPass)
|
||||
// {
|
||||
|
||||
// _qaNoticeRepository.Add(new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.NotNeedNotice,
|
||||
// NeedDeal = false,
|
||||
// StudyStatusStr = "QA-Failed",
|
||||
// Message = $"QA : {_userInfo.RealName} set {study.StudyCode} QA-Failed !",
|
||||
// SendTime = DateTime.Now,
|
||||
// });
|
||||
|
||||
// //处理 消息 标记已处理
|
||||
// var needDealNoticeList = _qaNoticeRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectVisitId == study.Id && t.NeedDeal &&
|
||||
// (t.NoticeTypeEnum == NoticeType.CRC_RequestToQA_NoticeQA ||
|
||||
// t.NoticeTypeEnum == NoticeType.CRC_ReUpload_NoticeQA ||
|
||||
// t.NoticeTypeEnum == NoticeType.CRC_QARecordDialogPost_NoticeQA ||
|
||||
|
||||
|
||||
// t.NoticeTypeEnum == NoticeType.QA_QARecordDialogPost_NoticeCRC ||
|
||||
// t.NoticeTypeEnum == NoticeType.QA_InQA_NoticeCRC ||
|
||||
// t.NoticeTypeEnum == NoticeType.QA_AddQARecord_NoticeCRC)).ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// else if (invocation.Method.Name == "ReUploadSameStudy")
|
||||
// {
|
||||
// var studyId = Guid.Parse(invocation.Arguments[0].ToString());
|
||||
|
||||
// var study = _studyRepository.FirstOrDefault(t => t.Id == studyId);
|
||||
// var status = study.Status;
|
||||
|
||||
// //处理CRC 重传时 QA消息
|
||||
|
||||
// if (status == (int)StudyStatus.QAing)
|
||||
// {
|
||||
// //查询项目的参与者 和 负责site下CRC用户
|
||||
// var trialUserList = _userTrialRepository.Where(t => t.TrialId == study.TrialId).ToList();
|
||||
|
||||
// // 找到该study 关联Site 下的CRC
|
||||
|
||||
// var crcList = _userTrialSiteRepository.Where(t =>
|
||||
// t.SiteId == study.SiteId && t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && t.TrialId == study.TrialId).ToList();
|
||||
|
||||
// var qaList = trialUserList.Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).ToList();
|
||||
|
||||
// //CRC =>QA CRC的职能被PM 或者admin代替
|
||||
// //if (_userInfo.UserTypeEnumInt == (int)UserType.ClinicalResearchCoordinator)
|
||||
// {
|
||||
// //PM 或者admin可以代替CRC角色 不能从CRC列表中查询用户
|
||||
// //var currentCRC = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// //FromUser = currentCRC.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentCRC.UserType,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.CRC_ReUpload_NoticeQA,
|
||||
// NeedDeal = true,
|
||||
// Message = $"CRC -> QA :{_userInfo.RealName} has reuploaded {study.StudyCode} , Need to be inquiry again",
|
||||
// SendTime = DateTime.Now
|
||||
// };
|
||||
|
||||
// qaList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = study.Id,
|
||||
// ToUser = t.User.LastName+" / "+t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.User.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
// //这里作为 QA 设置 Inqa 状态的回复 或者QA和CRC对话的
|
||||
// var needDealNoticeList = _qaNoticeRepository.Where(t => t.SubjectVisitId == study.Id && t.NeedDeal
|
||||
// && (t.NoticeTypeEnum == NoticeType.QA_InQA_NoticeCRC || t.NoticeTypeEnum == NoticeType.QA_QARecordDialogPost_NoticeCRC))
|
||||
// .ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //不是QAing 的重传 不发送qa消息
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// else if (invocation.Method.Name == "DicomAnonymize")
|
||||
// {
|
||||
// var studyId = Guid.Parse(invocation.Arguments[0].ToString());
|
||||
|
||||
// var study = _studyRepository.FirstOrDefault(t => t.Id == studyId);
|
||||
|
||||
// #region 处理QA通知 匿名化完毕 通知PM
|
||||
|
||||
// //查询项目的参与者 和 负责site下CRC用户
|
||||
// var trialUserList = _userTrialRepository.Where(t => t.TrialId == study.TrialId).ToList();
|
||||
|
||||
// // 找到该study 关联Site 下的CRC
|
||||
|
||||
// var crcList = _userTrialSiteRepository.Where(t =>
|
||||
// t.SiteId == study.SiteId && t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && t.TrialId == study.TrialId).ToList();
|
||||
|
||||
// var qaList = trialUserList.Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).ToList();
|
||||
|
||||
// //
|
||||
// var pm = trialUserList.FirstOrDefault(t => t.User.UserTypeEnum == UserTypeEnum.ProjectManager);
|
||||
|
||||
|
||||
// //找出当前操作的QA 如果是pm 或者admin 代替操作 此时会有问题 所以 谁代替,就以谁的名义执行
|
||||
// //var currentQA = trialUserList.First(t =>
|
||||
// // t.UserTypeEnum == UserType.IQC && t.UserId == _userInfo.Id);
|
||||
// //var currentQA = trialUserList.First(t => t.UserId == _userInfo.Id);
|
||||
|
||||
// var notice = new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// //FromUser = currentQA.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentQA.UserType,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.QA_Anonymized_NoticeQA,
|
||||
// NeedDeal = true,
|
||||
// StudyStatusStr = "Anonymized",
|
||||
// //Message = $"QA -> PM :{_userInfo.RealName} has anonymized {study.StudyCode} ,Forward can be performed!!",
|
||||
// Message = $"QA -> QA :{_userInfo.RealName} has anonymized {study.StudyCode} ,Forward can be performed!!",
|
||||
|
||||
// SendTime = DateTime.Now,
|
||||
|
||||
// };
|
||||
|
||||
// //notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// //{
|
||||
// // QANoticeId = notice.Id,
|
||||
// // StudyId = study.Id,
|
||||
// // ToUser = pm.UserRealName,
|
||||
// // ToUserId = pm.UserId,
|
||||
// // ToUserType = pm.UserType
|
||||
// //});
|
||||
|
||||
// qaList.ForEach(t => notice.QANoticeUserList.Add(new QANoticeUser()
|
||||
// {
|
||||
// QANoticeId = notice.Id,
|
||||
// SubjectVisitId = study.Id,
|
||||
// ToUser = t.User.LastName+" / "+t.User.FirstName,
|
||||
// ToUserId = t.UserId,
|
||||
// ToUserType = t.User.UserTypeRole.UserTypeShortName
|
||||
// }));
|
||||
|
||||
// _qaNoticeRepository.Add(notice);
|
||||
|
||||
// var needDealNoticeList = _qaNoticeRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectVisitId == study.Id && t.NeedDeal && (t.NoticeTypeEnum == NoticeType.QA_QAPass_NoticeQA)).ToList();
|
||||
|
||||
// needDealNoticeList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
|
||||
|
||||
// #endregion
|
||||
// }
|
||||
|
||||
// else if (invocation.Method.Name == "ForwardStudy")
|
||||
// {
|
||||
// var studyId = Guid.Parse(invocation.Arguments[0].ToString());
|
||||
|
||||
// var study = _studyRepository.FirstOrDefault(t => t.Id == studyId);
|
||||
|
||||
// //匿名化操作产生的消息 设置为已经处理
|
||||
// _qaNoticeRepository.Add(new QANotice()
|
||||
// {
|
||||
// TrialId = study.TrialId,
|
||||
// SubjectVisitId = study.Id,
|
||||
// //FromUser = currentQA.UserRealName,
|
||||
// //FromUserId = _userInfo.Id,
|
||||
// //FromUserType = currentQA.UserType,
|
||||
// FromUser = _userInfo.RealName,
|
||||
// FromUserId = _userInfo.Id,
|
||||
// FromUserType = _userInfo.UserTypeShortName,
|
||||
// NoticeTypeEnum = NoticeType.NotNeedNotice,
|
||||
// NeedDeal = false,
|
||||
// StudyStatusStr = "Forwarded",
|
||||
// //Message = $"PM :{_userInfo.RealName} has forwarded {study.StudyCode} !",
|
||||
// Message = $"QA :{_userInfo.RealName} has forwarded {study.StudyCode} !",
|
||||
// SendTime = DateTime.Now,
|
||||
// });
|
||||
|
||||
// var needDealList = _qaNoticeRepository.Where(t =>
|
||||
// t.SubjectVisitId == study.Id && t.NeedDeal && t.NoticeTypeEnum == NoticeType.QA_Anonymized_NoticeQA).ToList();
|
||||
|
||||
// needDealList.ForEach(t =>
|
||||
// {
|
||||
// t.NeedDeal = false;
|
||||
// t.DealTime = DateTime.Now;
|
||||
// _qaNoticeRepository.Update(t);
|
||||
// });
|
||||
// }
|
||||
|
||||
// var success = _qaNoticeRepository.SaveChanges();
|
||||
|
||||
// if (!success)
|
||||
// {
|
||||
// throw new Exception("Send QA message failed");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
//}
|
|
@ -1,89 +0,0 @@
|
|||
using Castle.DynamicProxy;
|
||||
using EasyCaching.Core;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Application.AOP
|
||||
{
|
||||
public class TrialStatusAutofacAOP : IAsyncInterceptor
|
||||
{
|
||||
private readonly IEasyCachingProvider _provider;
|
||||
|
||||
public TrialStatusAutofacAOP(IEasyCachingProvider provider)
|
||||
{
|
||||
_provider = provider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void InterceptAsynchronous(IInvocation invocation)
|
||||
{
|
||||
invocation.Proceed();
|
||||
}
|
||||
|
||||
//这里AOP 处理两个方法 分别是 项目的添加和更新、项目状态的变更
|
||||
|
||||
public void InterceptAsynchronous<TResult>(IInvocation invocation)
|
||||
{
|
||||
|
||||
|
||||
//处理拦截的方法
|
||||
invocation.Proceed();
|
||||
|
||||
|
||||
|
||||
dynamic result = invocation.ReturnValue;
|
||||
|
||||
//接口成功了,才修改缓存
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#region 处理项目列表的查询 在前端界面已经在某个界面,但是服务器重置了,此时没有缓存项目信息,接口不能正确返回,因故采用,启动时查询,每天查询一次,缓存一天,然后项目添加、更改状态时,及时更新
|
||||
|
||||
//if (invocation.Method.Name == "GetTrialList")
|
||||
//{
|
||||
// //在此 将当前查询的项目Id 和对应的项目状态进行缓存
|
||||
// dynamic result = invocation.ReturnValue;
|
||||
// foreach (var item in result.CurrentPageData)
|
||||
// {
|
||||
// _provider.Remove(item.Id.ToString());
|
||||
// _provider.Set(item.Id.ToString(), item.TrialStatusStr.ToString(), TimeSpan.FromDays(1));
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
if (invocation.Method.Name == "AddOrUpdateTrial")
|
||||
{
|
||||
//如果是添加 那么将对应的初始状态加进去 更新状态是单独操作的
|
||||
|
||||
var trialModel = (invocation.Arguments[0] as TrialCommand).IfNullThrowConvertException();
|
||||
if (trialModel.Id == null || trialModel.Id == Guid.Empty)
|
||||
{
|
||||
_provider.Set(result.Data.Id.ToString(), StaticData.TrialState.TrialOngoing, TimeSpan.FromDays(1));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 更新缓存
|
||||
else if (invocation.Method.Name == "UpdateTrialStatus")
|
||||
{
|
||||
//项目状态更新,也需要及时更新
|
||||
_provider.Set(invocation.Arguments[0].ToString(), invocation.Arguments[1].ToString(), TimeSpan.FromDays(1));
|
||||
|
||||
////Test参数是否符合要求
|
||||
//var tt = invocation.Arguments[0].ToString();
|
||||
//var cc = _provider.Get<string>(invocation.Arguments[0].ToString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void InterceptSynchronous(IInvocation invocation)
|
||||
{
|
||||
invocation.Proceed();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
//using System.Diagnostics;
|
||||
//using IRaCIS.Application.Interfaces;
|
||||
//using IRaCIS.Application.Contracts;
|
||||
//using IRaCIS.Core.Infra.EFCore;
|
||||
//using IRaCIS.Core.Infrastructure.Extention;
|
||||
//using Microsoft.AspNetCore.Mvc;
|
||||
//using Microsoft.AspNetCore.Mvc.Filters;
|
||||
//using Microsoft.Extensions.Logging;
|
||||
//using Newtonsoft.Json;
|
||||
|
||||
//namespace IRaCIS.Core.Application.Filter
|
||||
//{
|
||||
|
||||
// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
|
||||
// public class LogFilter : Attribute
|
||||
// {
|
||||
// }
|
||||
// public class LogActionFilter : IAsyncActionFilter
|
||||
// {
|
||||
// private readonly ILogService _logService;
|
||||
// private readonly IUserInfo _userInfo;
|
||||
// private readonly ILogger<LogActionFilter> _logger;
|
||||
|
||||
// public LogActionFilter(ILogService logService, IUserInfo userInfo , ILogger<LogActionFilter> logger)
|
||||
// {
|
||||
// _logService = logService;
|
||||
// _userInfo = userInfo;
|
||||
// _logger = logger;
|
||||
// }
|
||||
|
||||
// public Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||
// {
|
||||
|
||||
// if (context.ActionDescriptor.EndpointMetadata!=null&& context.ActionDescriptor.EndpointMetadata.Any(m => m.GetType() == typeof(LogFilter)))
|
||||
// {
|
||||
// return LogAsync(context, next);
|
||||
// }
|
||||
// return next();
|
||||
// }
|
||||
|
||||
// public async Task LogAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||
// {
|
||||
// var sw = new Stopwatch();
|
||||
// sw.Start();
|
||||
|
||||
// dynamic actionResult = (await next()).Result;
|
||||
// sw.Stop();
|
||||
// var args = JsonConvert.SerializeObject(context.ActionArguments);
|
||||
// var result = JsonConvert.SerializeObject(actionResult?.Value);
|
||||
|
||||
// var attr = (ApiExplorerSettingsAttribute)context.ActionDescriptor.EndpointMetadata.FirstOrDefault(m => m.GetType() == typeof(ApiExplorerSettingsAttribute));
|
||||
// var groupName = attr?.GroupName;
|
||||
// var res = actionResult?.Value as IResponseOutput;
|
||||
// var input = new SystemLogDTO
|
||||
// {
|
||||
// ClientIP = string.Empty,
|
||||
// OptUserId = _userInfo.Id,
|
||||
// OptUserName = _userInfo.UserName,
|
||||
// ApiPath = context.ActionDescriptor.AttributeRouteInfo.Template.ToLower(),
|
||||
// Params = args,
|
||||
// Result = result,
|
||||
// RequestTime = DateTime.Now,
|
||||
// ElapsedMilliseconds = sw.ElapsedMilliseconds,
|
||||
// Status =res?.IsSuccess?? false,
|
||||
// Message = res?.ErrorMessage,
|
||||
// LogCategory = groupName
|
||||
// };
|
||||
|
||||
// try
|
||||
// {
|
||||
// _logService.SaveLog2Db(input);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
|
||||
// _logger.LogError(ex.Message);
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
File diff suppressed because it is too large
Load Diff
|
@ -18,27 +18,27 @@ namespace IRaCIS.Core.Application.Helper
|
|||
{
|
||||
public class MinIOOptions
|
||||
{
|
||||
public string Endpoint { get; set; }
|
||||
public string Port { get; set; }
|
||||
public bool UseSSL { get; set; }
|
||||
public string AccessKey { get; set; }
|
||||
public string SecretKey { get; set; }
|
||||
public string BucketName { get; set; }
|
||||
public string endpoint { get; set; }
|
||||
public string port { get; set; }
|
||||
public bool useSSL { get; set; }
|
||||
public string accessKey { get; set; }
|
||||
public string secretKey { get; set; }
|
||||
public string bucketName { get; set; }
|
||||
}
|
||||
|
||||
public class AliyunOSSOptions
|
||||
{
|
||||
public string RegionId { get; set; }
|
||||
public string AccessKeyId { get; set; }
|
||||
public string AccessKeySecret { get; set; }
|
||||
public string EndPoint { get; set; }
|
||||
public string BucketName { get; set; }
|
||||
public string regionId { get; set; }
|
||||
public string accessKeyId { get; set; }
|
||||
public string accessKeySecret { get; set; }
|
||||
public string endPoint { get; set; }
|
||||
public string bucketName { get; set; }
|
||||
|
||||
public string RoleArn { get; set; }
|
||||
public string roleArn { get; set; }
|
||||
|
||||
public string Region { get; set; }
|
||||
public string region { get; set; }
|
||||
|
||||
public string ViewEndpoint { get; set; }
|
||||
public string viewEndpoint { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,8 @@ namespace IRaCIS.Core.Application.Helper
|
|||
public class ObjectStoreDTO
|
||||
{
|
||||
public string ObjectStoreUse { get; set; }
|
||||
public AliyunOSSTempToken AliyunOSS { get; set; }
|
||||
|
||||
public AliyunOSSOptions AliyunOSS { get; set; }
|
||||
|
||||
public MinIOOptions MinIO { get; set; }
|
||||
|
||||
|
@ -103,13 +104,13 @@ namespace IRaCIS.Core.Application.Helper
|
|||
|
||||
|
||||
|
||||
public OSSService(IOptionsMonitor<AliyunOSSOptions> options)
|
||||
public OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options)
|
||||
{
|
||||
var ossOptions = options.CurrentValue;
|
||||
|
||||
_OSSConfig = ossOptions;
|
||||
_OSSConfig = ossOptions.AliyunOSS;
|
||||
|
||||
_ossClient = new OssClient(_OSSConfig.EndPoint, _OSSConfig.AccessKeyId, _OSSConfig.AccessKeySecret);
|
||||
_ossClient = new OssClient(_OSSConfig.endPoint, _OSSConfig.accessKeyId, _OSSConfig.accessKeySecret);
|
||||
|
||||
}
|
||||
|
||||
|
@ -137,7 +138,7 @@ namespace IRaCIS.Core.Application.Helper
|
|||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
// 上传文件
|
||||
var result = _ossClient.PutObject(_OSSConfig.BucketName, ossRelativePath, memoryStream);
|
||||
var result = _ossClient.PutObject(_OSSConfig.bucketName, ossRelativePath, memoryStream);
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +168,7 @@ namespace IRaCIS.Core.Application.Helper
|
|||
try
|
||||
{
|
||||
// 上传文件
|
||||
var result = _ossClient.PutObject(_OSSConfig.BucketName, ossRelativePath, localFilePath);
|
||||
var result = _ossClient.PutObject(_OSSConfig.bucketName, ossRelativePath, localFilePath);
|
||||
|
||||
return ossRelativePath;
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ namespace IRaCIS.Core.Application.Helper
|
|||
{
|
||||
try
|
||||
{
|
||||
var result = _ossClient.GetObject(_OSSConfig.BucketName, ossRelativePath);
|
||||
var result = _ossClient.GetObject(_OSSConfig.bucketName, ossRelativePath);
|
||||
|
||||
// 将下载的文件流保存到本地文件
|
||||
using (var fs = File.OpenWrite(localFilePath))
|
||||
|
|
|
@ -11042,7 +11042,7 @@
|
|||
构造函数注入
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.MediatR.Handlers.ConsistencyVerificationHandler.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Domain.Share.IUserInfo,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},AutoMapper.IMapper)">
|
||||
<member name="M:IRaCIS.Core.Application.MediatR.Handlers.ConsistencyVerificationHandler.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Domain.Share.IUserInfo,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},AutoMapper.IMapper,Microsoft.Extensions.Localization.IStringLocalizer)">
|
||||
<summary>
|
||||
构造函数注入
|
||||
</summary>
|
||||
|
|
|
@ -31,8 +31,8 @@ namespace IRaCIS.Application.Services
|
|||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.AliasName), t => t.AliasName.Contains(searchModel.AliasName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.City), t => t.City.Contains(searchModel.City))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.Country), t => t.Country.Contains(searchModel.Country))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.Province), t => t.Country.Contains(searchModel.Province))
|
||||
.ProjectTo<SiteSelectDTO>(_mapper.ConfigurationProvider);
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.Province), t => t.Province.Contains(searchModel.Province))
|
||||
.ProjectTo<SiteSelectDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
|
||||
|
||||
|
||||
return await siteQueryable.ToPagedListAsync(searchModel.PageIndex, searchModel.PageSize, string.IsNullOrWhiteSpace(searchModel.SortField) ? "SiteName" : searchModel.SortField, searchModel.Asc);
|
||||
|
@ -76,11 +76,6 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary> 删除研究中心 </summary>
|
||||
|
|
|
@ -63,12 +63,10 @@ namespace IRaCIS.Application.Services
|
|||
private readonly IRepository<NoneDicomStudyFile> _noneDicomStudyFileSystem;
|
||||
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
||||
private readonly ISchedulerFactory _schedulerFactory;
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly ITrialEmailNoticeConfigService _trialEmailNoticeConfigService;
|
||||
|
||||
|
||||
public ReadingImageTaskService(
|
||||
IMapper mapper,
|
||||
IRepository<NoneDicomStudy> noneDicomStudyRepository,
|
||||
IRepository<VisitTask> visitTaskRepository,
|
||||
IRepository<Trial> TrialRepository,
|
||||
|
@ -109,7 +107,6 @@ namespace IRaCIS.Application.Services
|
|||
)
|
||||
{
|
||||
_schedulerFactory = schedulerFactory;
|
||||
base._mapper = mapper;
|
||||
this._noneDicomStudyRepository = noneDicomStudyRepository;
|
||||
this._visitTaskRepository = visitTaskRepository;
|
||||
this._trialRepository = TrialRepository;
|
||||
|
@ -145,7 +142,6 @@ namespace IRaCIS.Application.Services
|
|||
this._readingQuestionSystem = ReadingQuestionSystem;
|
||||
this._noneDicomStudyFileSystem = noneDicomStudyFileSystem;
|
||||
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||
this._cache = cache;
|
||||
this._trialEmailNoticeConfigService = trialEmailNoticeConfigService;
|
||||
}
|
||||
|
||||
|
|
|
@ -348,7 +348,6 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
/// <summary>删除 项目 下某一site </summary>
|
||||
[HttpDelete("{id:guid}/{trialId:guid}")]
|
||||
[TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrialSite)]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
[Obsolete]
|
||||
public async Task<IResponseOutput> DeleteTrialSite(Guid id)
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.IsSelect, u => u.MapFrom(t => t.UserTrials.Any(t => t.TrialId == trialId)));
|
||||
|
||||
CreateMap<Site, SiteSelectDTO>()
|
||||
.ForMember(d => d.HospitalName, u => u.MapFrom(s => s.Hospital.HospitalName));
|
||||
.ForMember(d => d.HospitalName, u => u.MapFrom(s => isEn_Us? s.Hospital.HospitalName:s.Hospital.HospitalNameCN));
|
||||
|
||||
//trial site 选择列表 subjectVisit pannel 模式添加的时候
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace IRaCIS.Application.Services
|
|||
/// <param name="subjectCommand">state:1-访视中,2-出组。0-全部</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[TrialAudit(AuditType.SubjectAudit, AuditOptType.AddOrUpdateSubject)]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
//[Authorize(Policy = IRaCISPolicy.PM_APM_CRC_QC)]
|
||||
public async Task<IResponseOutput<string>> AddOrUpdateSubject([FromBody] SubjectCommand subjectCommand)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using EntityFrameworkCore.Triggered;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -11,18 +12,19 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
{
|
||||
|
||||
// 统一处理 外部用户、中心调研(先添加 再发送邮件)、参与医生加入到项目 ----废弃
|
||||
public class AddlTrialUserTrigger :BaseService, IBeforeSaveTrigger<TrialUser>
|
||||
public class AddlTrialUserTrigger :IBeforeSaveTrigger<TrialUser>
|
||||
|
||||
{
|
||||
public IStringLocalizer _localizer;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
private readonly IRepository<User> _userRepository;
|
||||
|
||||
public AddlTrialUserTrigger(IRepository<Trial> trialRepository, IRepository<User> userRepository)
|
||||
public AddlTrialUserTrigger(IRepository<Trial> trialRepository, IRepository<User> userRepository, IStringLocalizer localizer)
|
||||
{
|
||||
_trialRepository = trialRepository;
|
||||
|
||||
_userRepository = userRepository;
|
||||
|
||||
_localizer = localizer;
|
||||
}
|
||||
public async Task BeforeSave(ITriggerContext<TrialUser> context, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
using AutoMapper;
|
||||
using EntityFrameworkCore.Triggered;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace IRaCIS.Core.Application.Triggers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SubjectStateTrigger :BaseService, IAfterSaveTrigger<Subject>
|
||||
public class SubjectStateTrigger : IAfterSaveTrigger<Subject>
|
||||
{
|
||||
public IStringLocalizer _localizer;
|
||||
private readonly IRepository _repository;
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
|
||||
public SubjectStateTrigger(IRepository<SubjectVisit> subjectVisitRepository)
|
||||
public SubjectStateTrigger(IRepository<SubjectVisit> subjectVisitRepository, IStringLocalizer localizer, IRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
_localizer = localizer;
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace IRaCIS.Core.Application.Triggers
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理 访视 末次评估 会影响Subject 状态
|
||||
/// </summary>
|
||||
public class SubjectVisitFinalVisitTrigger :BaseService, IAfterSaveTrigger<SubjectVisit>
|
||||
public class SubjectVisitFinalVisitTrigger :IAfterSaveTrigger<SubjectVisit>
|
||||
{
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
private readonly IRepository<ReadingPeriodSet> _readingPeriodSetRepository;
|
||||
|
@ -19,7 +21,8 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
private readonly IRepository<Subject> _subjectRepository;
|
||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||
private readonly IVisitTaskHelpeService _ivisitTaskHelpeService;
|
||||
|
||||
public IStringLocalizer _localizer;
|
||||
private readonly IRepository _repository;
|
||||
public SubjectVisitFinalVisitTrigger(IRepository<SubjectVisit> subjectVisitRepository,
|
||||
|
||||
IRepository<ReadingPeriodSet> readingPeriodSetRepository,
|
||||
|
@ -27,7 +30,9 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
IRepository<VisitTask> visitTaskRepository,
|
||||
IVisitTaskHelpeService visitTaskHelpeService,
|
||||
IRepository<ReadModule> readModuleRepository,
|
||||
IRepository<Subject> subjectRepository)
|
||||
IRepository<Subject> subjectRepository,
|
||||
IStringLocalizer localizer,
|
||||
IRepository repository)
|
||||
{
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
this._readingPeriodSetRepository = readingPeriodSetRepository;
|
||||
|
@ -36,6 +41,8 @@ namespace IRaCIS.Core.Application.Triggers
|
|||
this._readingPeriodPlanRepository = readingPeriodPlanRepository;
|
||||
this._readModuleRepository = readModuleRepository;
|
||||
_subjectRepository = subjectRepository;
|
||||
_repository = repository;
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
public async Task AfterSave(ITriggerContext<SubjectVisit> context, CancellationToken cancellationToken)
|
||||
|
|
|
@ -5,6 +5,7 @@ using Newtonsoft.Json;
|
|||
using MediatR;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace IRaCIS.Core.Application.MediatR.Handlers
|
||||
{
|
||||
|
@ -17,6 +18,7 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
private readonly IRepository<TrialSite> _trialSiteRepository;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IRepository<NoneDicomStudy> _noneDicomStudyRepository;
|
||||
public IStringLocalizer _localizer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数注入
|
||||
|
@ -25,7 +27,7 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
public ConsistencyVerificationHandler(IRepository<DicomStudy> studyRepository, IUserInfo userInfo,
|
||||
IRepository<Subject> subjectRepository, IRepository<SubjectVisit> subjectVisitRepository,
|
||||
IRepository<TrialSite> trialSiteRepository, IRepository<NoneDicomStudy> noneDicomStudyRepository,
|
||||
IMapper mapper)
|
||||
IMapper mapper, IStringLocalizer localizer)
|
||||
{
|
||||
_noneDicomStudyRepository = noneDicomStudyRepository;
|
||||
_studyRepository = studyRepository;
|
||||
|
@ -34,6 +36,7 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
_subjectVisitRepository = subjectVisitRepository;
|
||||
_trialSiteRepository = trialSiteRepository;
|
||||
_mapper = mapper;
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
async Task<string> IRequestHandler<ConsistencyVerificationRequest, string>.Handle(ConsistencyVerificationRequest request, CancellationToken cancellationToken)
|
||||
|
@ -112,14 +115,18 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
|
||||
|
||||
StringBuilder dialogMsg = new StringBuilder();
|
||||
//---您好,根据本系统自动识别,该受试者当前访视在IRC系统中已提交的影像检查情况如下:
|
||||
dialogMsg.Append(StaticData.International("ConsistencyVerification_Img"));
|
||||
//---您好,根据本系统自动识别,该受试者当前访视在IRC系统中已提交的影像检查情况如下:
|
||||
dialogMsg.Append($"<div>{_localizer["ConsistencyVerification_Img"]}</div>");
|
||||
var num = 0;
|
||||
List<ParamInfoDto> paramInfoList = new List<ParamInfoDto>();
|
||||
|
||||
foreach (var item in dbVisitStudyList)
|
||||
{
|
||||
num++;
|
||||
dialogMsg.AppendLine($"<br>{num}.{item.StudyDate}{StaticData.International("ConsistencyVerification_Of")}{item.Modality}{StaticData.International("ConsistencyVerification_ImgC")}");
|
||||
|
||||
dialogMsg.AppendLine($"<br/><div style='text-indent: 20px;'>{num}. {_localizer["ConsistencyVerification_ImgC", item.StudyDate, item.Modality]}</div>");
|
||||
|
||||
|
||||
paramInfoList.Add(new ParamInfoDto()
|
||||
{
|
||||
Modality = item.Modality,
|
||||
|
@ -176,18 +183,18 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
if (dbExceptExcel.Count() == 0 && excelExceptDB.Count() == 0)
|
||||
{
|
||||
dialogMsg.AppendLine($"<br/>");
|
||||
//---核对EDC数据,完全一致, 审核通过
|
||||
dialogMsg.AppendLine(StaticData.International("ConsistencyVerification_EDCA"));
|
||||
//---核对EDC数据,完全一致, 审核通过
|
||||
dialogMsg.AppendLine(_localizer["ConsistencyVerification_EDCA"]);
|
||||
|
||||
|
||||
// dialogMsg.AppendLine(@$"<br>说明:为高效解决/处理以上全部质疑问题,麻烦您准确核实实际影像检查情况。请注意影像日期与实际检查的日期可能会不一致,部分检查(如PET -CT)可能同时存在多种模态影像。准确核实后,请回复该访视正确的影像检查情况。");
|
||||
dbSV.CheckState = CheckStateEnum.CVPassed;
|
||||
dbSV.CheckUserId = _userInfo.Id;
|
||||
dbSV.CheckPassedTime = DateTime.Now;
|
||||
//---核对EDC数据,完全一致
|
||||
dbSV.CheckResult = StaticData.International("ConsistencyVerification_EDCB");
|
||||
//---自动核查通过
|
||||
dbSV.ManualPassReason = StaticData.International("ConsistencyVerification_Auto");
|
||||
//---核对EDC数据,完全一致
|
||||
dbSV.CheckResult = _localizer["ConsistencyVerification_EDCB"];
|
||||
//---自动核查通过
|
||||
dbSV.ManualPassReason = _localizer["ConsistencyVerification_Auto"];
|
||||
|
||||
//维护状态
|
||||
dbSV.ReadingStatus = ReadingStatusEnum.TaskAllocate;
|
||||
|
@ -205,34 +212,34 @@ namespace IRaCIS.Core.Application.MediatR.Handlers
|
|||
// ETC 和系统的有区别
|
||||
else
|
||||
{
|
||||
dialogMsg.AppendLine($"<br/>");
|
||||
//存在问题如下:
|
||||
dialogMsg.AppendLine($"<br><span style='color: #f00'>{StaticData.International("ConsistencyVerification_Prob")}</span>");
|
||||
//"Problems are as follows:
|
||||
dialogMsg.AppendLine($"<br/><div style='color: #f00'>{_localizer["ConsistencyVerification_Prob"]}</div>");
|
||||
|
||||
num = 0;
|
||||
foreach (var item in dbExceptExcel)
|
||||
{
|
||||
num++;
|
||||
//影像检查(EDC 缺少) ConsistencyVerification_EdcL
|
||||
dialogMsg.AppendLine($"<br>{num}.{item.StudyDate}{StaticData.International("ConsistencyVerification_Of")}{item.Modality}{StaticData.International("ConsistencyVerification_EdcL")} ");
|
||||
dialogMsg.AppendLine($"<br/><div style='text-indent: 20px;'>{num}. {_localizer["ConsistencyVerification_EdcL", item.StudyDate, item.Modality]}</div>");
|
||||
|
||||
}
|
||||
|
||||
foreach (var item in excelExceptDB)
|
||||
{
|
||||
num++;
|
||||
// 影像检查(IRC 缺少)
|
||||
dialogMsg.AppendLine($"<br>{num}.{item.StudyDate}{StaticData.International("ConsistencyVerification_Of")}{item.Modality}{StaticData.International("ConsistencyVerification_IrcL")} ");
|
||||
dialogMsg.AppendLine($"<br/><div style='text-indent: 20px;'>{num}. {_localizer["ConsistencyVerification_IrcLi", item.StudyDate, item.Modality]}</div>");
|
||||
}
|
||||
|
||||
dialogMsg.AppendLine($"<br/>");
|
||||
dialogMsg.AppendLine(@$"<br>{StaticData.International("ConsistencyVerification_Desc")}");
|
||||
dialogMsg.AppendLine(@$"<div>{_localizer["ConsistencyVerification_Desc"]}<div/>");
|
||||
|
||||
dbSV.CheckResult = _localizer["ConsistencyVerification_Conf"] +
|
||||
String.Join(" | ", dbExceptExcel.Select(t => $"{_localizer["ConsistencyVerification_EdcL", t.StudyDate, t.Modality]}")) + " | "
|
||||
+ String.Join(" | ", excelExceptDB.Select(t => $"{_localizer["ConsistencyVerification_IrcLi", t.StudyDate, t.Modality]}"));
|
||||
|
||||
//---根据导入的一致性核查数据,请确认本访视以下不一致检查项信息:
|
||||
dbSV.CheckResult = StaticData.International("ConsistencyVerification_Conf") + String.Join(" | ", dbExceptExcel.Select(t => $"{StaticData.International("ConsistencyVerification_Edc")}{t.StudyDate} {t.Modality} ")) + " | "
|
||||
+ String.Join(" | ", excelExceptDB.Select(t => $"{StaticData.International("ConsistencyVerification_IrcLi")}{t.StudyDate} {t.Modality}"));
|
||||
//新增一致性核查质疑记录
|
||||
|
||||
|
||||
dbSV.CheckState = CheckStateEnum.CVIng;
|
||||
dbSV.CheckChallengeState = CheckChanllengeTypeEnum.PMWaitCRCReply;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public partial class Site : Entity, IAuditUpdate, IAuditAdd
|
||||
{
|
||||
[JsonIgnore]
|
||||
[ForeignKey("HospitalId")]
|
||||
public Hospital Hospital { get; set; }
|
||||
public string SiteName { get; set; } = string.Empty;
|
||||
public string SiteNameCN{ get; set; } = string.Empty;
|
||||
|
|
|
@ -558,12 +558,12 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
throw new DBSaveFailedException("SQL 事务失败,请检查环境。");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex.InnerException is null ? ex.Message : ex.InnerException?.Message);
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// _logger.LogError(ex.InnerException is null ? ex.Message : ex.InnerException?.Message);
|
||||
|
||||
throw new DBSaveFailedException("数据保存异常。");
|
||||
}
|
||||
// throw new DBSaveFailedException(ex.Message);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue